#[repr(C)]pub struct Ipv6Hdr {
pub vcf: [u8; 4],
pub payload_len: [u8; 2],
pub next_hdr: IpProto,
pub hop_limit: u8,
pub src_addr: [u8; 16],
pub dst_addr: [u8; 16],
}Expand description
IPv6 header, which is present after the Ethernet header.
Fields§
§vcf: [u8; 4]First 4 bytes containing Version (4 bits), Traffic Class (8 bits), and Flow Label (20 bits)
payload_len: [u8; 2]Payload length (excluding the IPv6 header)
next_hdr: IpProtoNext header protocol
hop_limit: u8Hop limit (similar to TTL in IPv4)
src_addr: [u8; 16]Source IPv6 address (16 bytes)
dst_addr: [u8; 16]Destination IPv6 address (16 bytes)
Implementations§
Source§impl Ipv6Hdr
impl Ipv6Hdr
pub const LEN: usize = 40usize
Sourcepub fn set_version(&mut self, version: u8)
pub fn set_version(&mut self, version: u8)
Sets the version field.
Sourcepub fn flow_label(&self) -> u32
pub fn flow_label(&self) -> u32
Returns the flow label field (20 bits).
Sourcepub fn set_dscp_ecn(&mut self, dscp: u8, ecn: u8)
pub fn set_dscp_ecn(&mut self, dscp: u8, ecn: u8)
Sets the DSCP and ECN fields.
Sourcepub fn set_flow_label(&mut self, flow_label: u32)
pub fn set_flow_label(&mut self, flow_label: u32)
Sets the flow label field (20 bits).
Sourcepub fn set_vcf(&mut self, version: u8, dscp: u8, ecn: u8, flow_label: u32)
pub fn set_vcf(&mut self, version: u8, dscp: u8, ecn: u8, flow_label: u32)
Sets the version, DSCP, ECN, and flow label in one operation.
Sourcepub fn payload_len(&self) -> u16
pub fn payload_len(&self) -> u16
Returns the payload length.
Sourcepub fn set_payload_len(&mut self, len: u16)
pub fn set_payload_len(&mut self, len: u16)
Sets the payload length.
Sourcepub fn set_src_addr(&mut self, src: Ipv6Addr)
pub fn set_src_addr(&mut self, src: Ipv6Addr)
Sets the source address field.
Sourcepub fn set_dst_addr(&mut self, dst: Ipv6Addr)
pub fn set_dst_addr(&mut self, dst: Ipv6Addr)
Sets the destination address field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ipv6Hdr
impl RefUnwindSafe for Ipv6Hdr
impl Send for Ipv6Hdr
impl Sync for Ipv6Hdr
impl Unpin for Ipv6Hdr
impl UnwindSafe for Ipv6Hdr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more