add debug logging to ticket generation for debugging
This commit is contained in:
parent
b6b7d2559d
commit
4ad883a54d
10 changed files with 223 additions and 127 deletions
|
|
@ -1,37 +1,42 @@
|
|||
use crate::rmc::response::ErrorCode;
|
||||
use crate::rmc::structures::{Result, RmcSerialize};
|
||||
use bytemuck::{Pod, Zeroable, bytes_of};
|
||||
use std::io::{Read, Write};
|
||||
use bytemuck::{bytes_of, Pod, Zeroable};
|
||||
use v_byte_helpers::SwapEndian;
|
||||
use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions};
|
||||
use crate::rmc::response::ErrorCode;
|
||||
use crate::rmc::structures::{RmcSerialize, Result};
|
||||
|
||||
pub const ERROR_MASK: u32 = 1 << 31;
|
||||
pub const ERROR_MASK: u32 = 1 << 31;
|
||||
|
||||
#[derive(Pod, Zeroable, Copy, Clone, SwapEndian, Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct QResult(u32);
|
||||
|
||||
impl QResult{
|
||||
pub fn success(error_code: ErrorCode) -> Self{
|
||||
impl QResult {
|
||||
pub fn success(error_code: ErrorCode) -> Self {
|
||||
let val: u32 = error_code.into();
|
||||
|
||||
Self(val & (!ERROR_MASK))
|
||||
}
|
||||
|
||||
pub fn error(error_code: ErrorCode) -> Self{
|
||||
pub fn error(error_code: ErrorCode) -> Self {
|
||||
let val: u32 = error_code.into();
|
||||
|
||||
Self(val | ERROR_MASK)
|
||||
}
|
||||
}
|
||||
|
||||
impl RmcSerialize for QResult{
|
||||
impl RmcSerialize for QResult {
|
||||
fn serialize(&self, writer: &mut impl Write) -> Result<()> {
|
||||
writer.write(bytes_of(self))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn deserialize(reader: &mut impl Read) -> Result<Self> {
|
||||
Ok(reader.read_struct(IS_BIG_ENDIAN)?)
|
||||
let result: Self = reader.read_struct(IS_BIG_ENDIAN)?;
|
||||
println!("reading qresult: {:x}", result.0);
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
fn serialize_write_size(&self) -> Result<u32> {
|
||||
Ok(4)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue