#[repr(C)]pub struct Ipv6Hdr {
pub vcf: [u8; 4],
pub payload_len: [u8; 2],
pub next_hdr: u8,
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: u8Next 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
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_next_hdr(&mut self, proto: IpProto)
pub fn set_next_hdr(&mut self, proto: IpProto)
Sets the encapsulated protocol.
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§
Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for Ipv6Hdr
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for Ipv6Hdr
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for Ipv6Hdr
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for Ipv6Hdr
Source§impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for Ipv6Hdrwhere
for<'_wincode_internal> [u8; 4]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 2]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal, '_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal, '_wincode_internal> [u8; 16]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for Ipv6Hdrwhere
for<'_wincode_internal> [u8; 4]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 2]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal, '_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal, '_wincode_internal> [u8; 16]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
Source§fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
Like
crate::ZeroCopy::from_bytes, but allows the caller to provide a custom configuration.Source§fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
Like
crate::ZeroCopy::from_bytes_mut, but allows the caller to provide a custom configuration.impl Copy for Ipv6Hdr
Auto Trait Implementations§
impl Freeze for Ipv6Hdr
impl RefUnwindSafe for Ipv6Hdr
impl Send for Ipv6Hdr
impl Sync for Ipv6Hdr
impl Unpin for Ipv6Hdr
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
Source§impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
Source§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given
Reader into dst.Source§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Deserialize from the given
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Deserialize from the given
Reader into dst.Source§impl<T, C> Serialize<C> for T
impl<T, C> Serialize<C> for T
Source§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Serialize a serializable type into the given
Writer.Source§fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.
Source§impl<T> Serialize for T
impl<T> Serialize for T
Source§fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
Serialize a serializable type into the given byte buffer.
Source§fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
Get the size in bytes of the type when serialized.