Expand description
A high-level representation of an User Datagram Protocol packet.
Fields§
§src_port: u16
§dst_port: u16
Implementations§
source§impl Repr
impl Repr
sourcepub fn parse<T>(
packet: &Packet<&T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
checksum_caps: &ChecksumCapabilities
) -> Result<Repr>where
T: AsRef<[u8]> + ?Sized,
pub fn parse<T>(
packet: &Packet<&T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
checksum_caps: &ChecksumCapabilities
) -> Result<Repr>where
T: AsRef<[u8]> + ?Sized,
Parse an User Datagram Protocol packet and return a high-level representation.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Return the length of the packet header that will be emitted from this high-level representation.
sourcepub fn emit<T: ?Sized>(
&self,
packet: &mut Packet<&mut T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
payload_len: usize,
emit_payload: impl FnOnce(&mut [u8]),
checksum_caps: &ChecksumCapabilities
)where
T: AsRef<[u8]> + AsMut<[u8]>,
pub fn emit<T: ?Sized>(
&self,
packet: &mut Packet<&mut T>,
src_addr: &IpAddress,
dst_addr: &IpAddress,
payload_len: usize,
emit_payload: impl FnOnce(&mut [u8]),
checksum_caps: &ChecksumCapabilities
)where
T: AsRef<[u8]> + AsMut<[u8]>,
Emit a high-level representation into an User Datagram Protocol packet.