use crate::Transmit;
#[derive(Debug)]
pub struct AssociationEvent(pub(crate) AssociationEventInner);
#[derive(Debug)]
pub(crate) enum AssociationEventInner {
Datagram(Transmit),
}
#[derive(Debug)]
pub struct EndpointEvent(pub(crate) EndpointEventInner);
impl EndpointEvent {
pub fn drained() -> Self {
Self(EndpointEventInner::Drained)
}
pub fn is_drained(&self) -> bool {
self.0 == EndpointEventInner::Drained
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub(crate) enum EndpointEventInner {
Drained,
}
pub type AssociationId = u32;
#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum EcnCodepoint {
#[doc(hidden)]
Ect0 = 0b10,
#[doc(hidden)]
Ect1 = 0b01,
#[doc(hidden)]
Ce = 0b11,
}
impl EcnCodepoint {
pub fn from_bits(x: u8) -> Option<Self> {
use self::EcnCodepoint::*;
Some(match x & 0b11 {
0b10 => Ect0,
0b01 => Ect1,
0b11 => Ce,
_ => {
return None;
}
})
}
}
#[derive(Debug, Copy, Clone)]
pub struct IssuedAid {
pub sequence: u64,
pub id: AssociationId,
}