#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct VirtualLanTrafficClassIndicator
{
pub virtualLanValue: VirtualLanValue,
pub virtualLanId: Option<VirtualLanId>
}
impl VirtualLanTrafficClassIndicator
{
#[inline(always)]
pub fn writeLayer2HeaderData(&self, buffer: *mut u8, etherType: u16)
{
buffer.writeU16AsNetworkByteOrderU16(etherType);
let tci =
{
let mut topBits = (self.virtualLanValue.classOfService as u16) << 13;
if unlikely(self.virtualLanValue.dropEligibleIndicator)
{
topBits = topBits | 0x1000;
}
topBits | match self.virtualLanId
{
None => 0,
Some(value) => value.0,
}
};
const offset: usize = SizeOfEtherType as usize;
buffer.offsetUp(offset).writeU16AsNetworkByteOrderU16(tci);
}
}