23 lines
535 B
Rust
23 lines
535 B
Rust
#[derive(Debug)]
|
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
pub enum ContentType {
|
|
Invalid = 0,
|
|
ChangeCipherSpec = 20,
|
|
Alert = 21,
|
|
Handshake = 22,
|
|
ApplicationData = 23,
|
|
}
|
|
|
|
impl ContentType {
|
|
pub fn of(num: u8) -> Option<Self> {
|
|
match num {
|
|
0 => Some(Self::Invalid),
|
|
20 => Some(Self::ChangeCipherSpec),
|
|
21 => Some(Self::Alert),
|
|
22 => Some(Self::Handshake),
|
|
23 => Some(Self::ApplicationData),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|