pub struct UdpHeader {
pub source_port: u16,
pub dest_port: u16,
pub length: u16,
pub checksum: u16,
}Expand description
UDP header
Fields§
§source_port: u16§dest_port: u16§length: u16§checksum: u16Implementations§
Source§impl UdpHeader
impl UdpHeader
pub const SIZE: usize = 8usize
pub fn new(src_port: u16, dst_port: u16, data_len: usize) -> Self
pub fn to_bytes(&self) -> [u8; 8]
pub fn from_bytes(bytes: &[u8]) -> Result<Self, KernelError>
Sourcepub fn calculate_checksum(
&mut self,
src: IpAddress,
dst: IpAddress,
data: &[u8],
)
pub fn calculate_checksum( &mut self, src: IpAddress, dst: IpAddress, data: &[u8], )
Calculate UDP checksum
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UdpHeader
impl RefUnwindSafe for UdpHeader
impl Send for UdpHeader
impl Sync for UdpHeader
impl Unpin for UdpHeader
impl UnwindSafe for UdpHeader
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, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)