Files
irtt-rs/crates/irtt-proto/src/flags.rs
T
Nils Andreas Svee 82491f0f61 feat(project): Establish initial IRTT workspace and protocol definitions
Set up the multi-crate project structure and add the core IRTT protocol with pinned dependencies for reproducible builds.
2026-04-28 16:03:50 +07:00

21 lines
478 B
Rust

use crate::{error::Result, ProtoError};
pub const FLAG_OPEN: u8 = 0x01;
pub const FLAG_REPLY: u8 = 0x02;
pub const FLAG_CLOSE: u8 = 0x04;
pub const FLAG_HMAC: u8 = 0x08;
pub const RESERVED_FLAGS_MASK: u8 = 0xF0;
pub fn validate_flags(flags: u8) -> Result<()> {
let reserved = flags & RESERVED_FLAGS_MASK;
if reserved != 0 {
return Err(ProtoError::ReservedFlags(reserved));
}
Ok(())
}
pub fn has(flags: u8, flag: u8) -> bool {
flags & flag != 0
}