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>
impl<'a> IPv6Writer<'a>
Sourcepub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
pub fn new(bytes: &'a mut [u8]) -> Result<Self, &'static str>
Creates a new IPv6Writer
from the given data slice.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the actual header length in bytes.
Sourcepub fn set_version(&mut self, version: u8)
pub fn set_version(&mut self, version: u8)
Sets the version field.
Indicates the IP version number. Should be set to 6.
Sourcepub fn set_traffic_class(&mut self, traffic_class: u8)
pub fn set_traffic_class(&mut self, traffic_class: u8)
Sets the traffic class field.
Specifies the priority of the packet.
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.
Identifies packets belonging to the same flow (group of packets).
Sourcepub fn set_payload_length(&mut self, payload_length: u16)
pub fn set_payload_length(&mut self, payload_length: u16)
Sets the payload length field.
Specifies the length of the payload in bytes.
Sourcepub fn set_next_header(&mut self, next_header: u8)
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.
Sourcepub fn set_hop_limit(&mut self, hop_limit: u8)
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.
Sourcepub fn set_src_addr(&mut self, src_addr: &[u8; 16])
pub fn set_src_addr(&mut self, src_addr: &[u8; 16])
Sets the source address field.
Unicast IPv6 address of the sender.
Sourcepub fn set_dest_addr(&mut self, dest_addr: &[u8; 16])
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.