1 use super::{param_header::*, param_type::*, *}; 2 3 use bytes::{Bytes, BytesMut}; 4 5 /// At the initialization of the association, the sender of the INIT or 6 /// INIT ACK chunk MAY include this OPTIONAL parameter to inform its peer 7 /// that it is able to support the Forward TSN chunk 8 /// 9 /// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 10 ///+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 11 ///| Parameter Type = 49152 | Parameter Length = 4 | 12 ///+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 13 #[derive(Default, Debug, Clone, PartialEq)] 14 pub(crate) struct ParamForwardTsnSupported; 15 16 impl fmt::Display for ParamForwardTsnSupported { fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 18 write!(f, "{}", self.header()) 19 } 20 } 21 22 impl Param for ParamForwardTsnSupported { header(&self) -> ParamHeader23 fn header(&self) -> ParamHeader { 24 ParamHeader { 25 typ: ParamType::ForwardTsnSupp, 26 value_length: self.value_length() as u16, 27 } 28 } 29 unmarshal(raw: &Bytes) -> Result<Self>30 fn unmarshal(raw: &Bytes) -> Result<Self> { 31 let _ = ParamHeader::unmarshal(raw)?; 32 Ok(ParamForwardTsnSupported {}) 33 } 34 marshal_to(&self, buf: &mut BytesMut) -> Result<usize>35 fn marshal_to(&self, buf: &mut BytesMut) -> Result<usize> { 36 self.header().marshal_to(buf)?; 37 Ok(buf.len()) 38 } 39 value_length(&self) -> usize40 fn value_length(&self) -> usize { 41 0 42 } 43 clone_to(&self) -> Box<dyn Param + Send + Sync>44 fn clone_to(&self) -> Box<dyn Param + Send + Sync> { 45 Box::new(self.clone()) 46 } 47 as_any(&self) -> &(dyn Any + Send + Sync)48 fn as_any(&self) -> &(dyn Any + Send + Sync) { 49 self 50 } 51 } 52