Struct capsules_extra::net::ipv6::IP6Packet
source · pub struct IP6Packet<'a> {
pub header: IP6Header,
pub payload: IPPayload<'a>,
}
Expand description
This struct defines the IP6Packet
format, and contains an IP6Header
and an IPPayload
.
Fields§
§header: IP6Header
§payload: IPPayload<'a>
Implementations§
source§impl<'a> IP6Packet<'a>
impl<'a> IP6Packet<'a>
sourcepub fn new(payload: IPPayload<'a>) -> IP6Packet<'a>
pub fn new(payload: IPPayload<'a>) -> IP6Packet<'a>
This function returns a new IP6Packet
struct. Note that the
IP6Packet.header
field is set to IP6Header::default()
§Arguments
payload
- The IPPayload
struct for the IP6Packet
pub fn reset(&mut self)
pub fn get_total_len(&self) -> u16
pub fn get_payload(&self) -> &[u8]
pub fn get_total_hdr_size(&self) -> usize
pub fn set_transport_checksum(&mut self)
sourcepub fn set_payload(
&mut self,
transport_header: TransportHeader,
payload: &SubSliceMut<'static, u8>,
)
pub fn set_payload( &mut self, transport_header: TransportHeader, payload: &SubSliceMut<'static, u8>, )
This function should be the function used to set the payload for a
given IP6Packet
object. It first calls the IPPayload::set_payload
method to set the transport header and transport payload, which then
returns the ip6_nh
value for the TransportHeader
and the length of
the serialized IPPayload
region. This function then sets the
IP6Header
next header field correctly. Without using this function,
the IP6Header.next_header
field may not agree with the actual
next header (IP6Header.payload.header
)
§Arguments
transport_header
- The TransportHeader
to be set as the next header
payload
- The transport payload to be copied into the IPPayload
transport payload