Struct IPv6Writer

Source
pub struct IPv6Writer<'a> {
    pub bytes: &'a mut [u8],
}
Expand description

Writes IPv6 header fields.

Fields§

§bytes: &'a mut [u8]

Implementations§

Source§

impl<'a> IPv6Writer<'a>

Source

pub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>

Creates a new IPv6Writer from the given data slice.

Source

pub fn header_len(&self) -> usize

Returns the actual header length in bytes.

Source

pub fn set_version(&mut self, version: u8)

Sets the version field.

Indicates the IP version number. Should be set to 6.

Source

pub fn set_traffic_class(&mut self, traffic_class: u8)

Sets the traffic class field.

Specifies the priority of the packet.

Source

pub fn set_flow_label(&mut self, flow_label: u32)

Sets the flow label field.

Identifies packets belonging to the same flow (group of packets).

Source

pub fn set_payload_length(&mut self, payload_length: u16)

Sets the payload length field.

Specifies the length of the payload in bytes.

Source

pub fn set_next_header(&mut self, next_header: u8)

Sets the next header field.

Specifies the type of the next header, usually a transport protocol.

Shares the same values as the protocol field in an IPv4 header.

Source

pub fn set_hop_limit(&mut self, hop_limit: u8)

Sets the hop limit field.

Replaces the time-to-live field in IPv4.

The value is decremented each time the packet is forwarded by a router.

When the value reaches 0, the packet is discarded, unless it has reached its destination.

Source

pub fn set_src_addr(&mut self, src_addr: &[u8; 16])

Sets the source address field.

Unicast IPv6 address of the sender.

Source

pub fn set_dest_addr(&mut self, dest_addr: &[u8; 16])

Sets the destination address field.

Unicast or multicast IPv6 address of the intended recipient.

Auto Trait Implementations§

§

impl<'a> Freeze for IPv6Writer<'a>

§

impl<'a> RefUnwindSafe for IPv6Writer<'a>

§

impl<'a> Send for IPv6Writer<'a>

§

impl<'a> Sync for IPv6Writer<'a>

§

impl<'a> Unpin for IPv6Writer<'a>

§

impl<'a> !UnwindSafe for IPv6Writer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.