pub type Ipv6RawExtensionHeader = Ipv6RawExtHeader;
Expand description
Deprecated. Use Ipv6RawExtHeader instead.
Aliased Type§
struct Ipv6RawExtensionHeader {
pub next_header: IpNumber,
/* private fields */
}
Fields§
§next_header: IpNumber
IP protocol number specifying the next header or transport layer protocol.
See IpNumber or ip_number for a definition of the known values.
Implementations
Source§impl Ipv6RawExtHeader
impl Ipv6RawExtHeader
Sourcepub const MIN_LEN: usize = 8usize
pub const MIN_LEN: usize = 8usize
Minimum length of an raw IPv6 extension header in bytes/octets.
Sourcepub const MAX_LEN: usize = 2_048usize
pub const MAX_LEN: usize = 2_048usize
Maximum length of an raw IPv6 extension header in bytes/octets.
This number is calculated by multiplying the maximum “hdr ext len” (0xff) with 8 and adding 8. As RFC8200 states that “hdr ext len” is defined as “8-bit unsigned integer. Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets.”
Sourcepub const MIN_PAYLOAD_LEN: usize = 6usize
pub const MIN_PAYLOAD_LEN: usize = 6usize
Minimum length of a Ipv6RawExtHeader payload
Sourcepub const MAX_PAYLOAD_LEN: usize = 2_046usize
pub const MAX_PAYLOAD_LEN: usize = 2_046usize
Maximum length of a Ipv6RawExtHeader the payload
Sourcepub fn header_type_supported(next_header: IpNumber) -> bool
pub fn header_type_supported(next_header: IpNumber) -> bool
Returns true if the given header type ip number can be represented in an Ipv6ExtensionHeader
.
Sourcepub fn new_raw(
next_header: IpNumber,
payload: &[u8],
) -> Result<Ipv6RawExtHeader, ExtPayloadLenError>
pub fn new_raw( next_header: IpNumber, payload: &[u8], ) -> Result<Ipv6RawExtHeader, ExtPayloadLenError>
Creates an generic IPv6 extension header with the given data.
§Arguments
next_header
- type of content after this header (protocol number)payload
- slice containing the data of the header. This must NOT contain thenext header
andextended header length
fields of the header.
Note that payload
must have at least the length of 6 bytes and only supports
length increases in steps of 8. This measn that the following expression must be true (payload.len() + 2) % 8 == 0
.
The maximum length of the payload is 2046
bytes (Ipv6RawExtHeader::MAX_PAYLOAD_LEN
).
If a payload with a non supported length is provided a crate::err::ipv6_exts::ExtPayloadLenError
is returned.
Sourcepub fn from_slice(slice: &[u8]) -> Result<(Ipv6RawExtHeader, &[u8]), LenError>
pub fn from_slice(slice: &[u8]) -> Result<(Ipv6RawExtHeader, &[u8]), LenError>
Read an Ipv6ExtensionHeader from a slice and return the header & unused parts of the slice.
Sourcepub fn payload(&self) -> &[u8] ⓘ
pub fn payload(&self) -> &[u8] ⓘ
Return a slice containing the current payload. This does NOT contain
the next_header
and header_length
fields. But everything after these
two fields.
Sourcepub fn set_payload(&mut self, payload: &[u8]) -> Result<(), ExtPayloadLenError>
pub fn set_payload(&mut self, payload: &[u8]) -> Result<(), ExtPayloadLenError>
Sets the payload (content of the header after the next_header
& header_length
fields).
Note that payload
must have at least the length of 6 bytes and only supports
length increases in steps of 8. This measn that the following expression must be true (payload.len() + 2) % 8 == 0
.
The maximum length of the payload is 2046
bytes (crate::Ipv6RawExtHeader::MAX_PAYLOAD_LEN
).
If a payload with a non supported length is provided a crate::err::ipv6_exts::ExtPayloadLenError
is returned and the payload of the header is not changed.
Sourcepub fn read<T: Read + Seek + Sized>(
reader: &mut T,
) -> Result<Ipv6RawExtHeader, Error>
Available on crate feature std
only.
pub fn read<T: Read + Seek + Sized>( reader: &mut T, ) -> Result<Ipv6RawExtHeader, Error>
std
only.Read an fragment header from the current reader position.
Sourcepub fn read_limited<T: Read + Seek + Sized>(
reader: &mut LimitedReader<T>,
) -> Result<Ipv6RawExtHeader, LimitedReadError>
Available on crate feature std
only.
pub fn read_limited<T: Read + Seek + Sized>( reader: &mut LimitedReader<T>, ) -> Result<Ipv6RawExtHeader, LimitedReadError>
std
only.Read an fragment header from the current limited reader position.
Sourcepub fn write<W: Write + Sized>(&self, writer: &mut W) -> Result<(), Error>
Available on crate feature std
only.
pub fn write<W: Write + Sized>(&self, writer: &mut W) -> Result<(), Error>
std
only.Writes a given IPv6 extension header to the current position.
Sourcepub fn to_bytes(&self) -> ArrayVec<u8, { Ipv6RawExtHeader::MAX_LEN }>
pub fn to_bytes(&self) -> ArrayVec<u8, { Ipv6RawExtHeader::MAX_LEN }>
Returns the serialized header.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Length of the header in bytes.
Trait Implementations
Source§impl Clone for Ipv6RawExtHeader
impl Clone for Ipv6RawExtHeader
Source§fn clone(&self) -> Ipv6RawExtHeader
fn clone(&self) -> Ipv6RawExtHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more