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- TheIPPayloadstruct for theIP6Packet
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- TheTransportHeaderto be set as the next headerpayload- The transport payload to be copied into theIPPayloadtransport payload
pub fn encode(&self, buf: &mut [u8]) -> SResult<usize>
Auto Trait Implementations§
impl<'a> !UnwindSafe for IP6Packet<'a>
impl<'a> Freeze for IP6Packet<'a>
impl<'a> RefUnwindSafe for IP6Packet<'a>
impl<'a> Send for IP6Packet<'a>
impl<'a> Sync for IP6Packet<'a>
impl<'a> Unpin for IP6Packet<'a>
impl<'a> UnsafeUnpin for IP6Packet<'a>
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