datex_core/global/
dxb_block.rsuse num_enum::TryFromPrimitive;
use crate::datex_values::Endpoint;
pub struct DXBBlock {
pub header: DXBHeader
}
#[derive(Debug, Clone, PartialEq)]
pub struct DXBHeader {
pub version: u8,
pub size: u16,
pub signed: bool,
pub encrypted: bool,
pub timestamp: u64,
pub scope_id: u32,
pub block_index: u16,
pub block_increment: u16,
pub block_type: DXBBlockType,
pub flags: HeaderFlags,
pub routing: RoutingInfo
}
#[derive(Debug, Clone, Copy, PartialEq, TryFromPrimitive)]
#[repr(u8)]
pub enum DXBBlockType {
REQUEST = 0, RESPONSE = 1, DATA = 2, TMP_SCOPE = 3, LOCAL = 4, HELLO = 5, DEBUGGER = 6, SOURCE_MAP = 7, UPDATE = 8, }
#[derive(Debug, Clone, PartialEq)]
pub struct HeaderFlags {
pub allow_execute: bool,
pub end_of_scope: bool,
pub device_type: u8
}
#[derive(Debug, Clone, PartialEq)]
pub struct RoutingInfo {
pub ttl: u8,
pub priority: u8,
pub sender: Option<Endpoint>,
}