pub struct UdpRepr {
pub src_port: u16,
pub dst_port: u16,
}
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 const fn header_len(&self) -> usize
pub const 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>(
&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]> + ?Sized,
pub fn emit<T>(
&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]> + ?Sized,
Emit a high-level representation into an User Datagram Protocol packet.
Trait Implementations§
impl Copy for Repr
impl Eq for Repr
impl StructuralPartialEq for Repr
Auto Trait Implementations§
impl Freeze for Repr
impl RefUnwindSafe for Repr
impl Send for Repr
impl Sync for Repr
impl Unpin for Repr
impl UnwindSafe for Repr
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)