Struct rpki_rtr::pdu::Ipv6Prefix
source · [−]#[repr(packed)]pub struct Ipv6Prefix { /* private fields */ }
Expand description
An IPv6 prefix is the payload PDU for route origin authorisation in IPv46.
Implementations
sourceimpl Ipv6Prefix
impl Ipv6Prefix
sourcepub fn new(
version: u8,
flags: u8,
prefix_len: u8,
max_len: u8,
prefix: Ipv6Addr,
asn: u32
) -> Self
pub fn new(
version: u8,
flags: u8,
prefix_len: u8,
max_len: u8,
prefix: Ipv6Addr,
asn: u32
) -> Self
Creates a new IPv6 prefix from all the various fields.
sourcepub fn flags(&self) -> u8
pub fn flags(&self) -> u8
Returns the flags field of the prefix.
The only flag currently used is the least significant but that is 1 for an announcement and 0 for a withdrawal.
sourcepub fn prefix_len(&self) -> u8
pub fn prefix_len(&self) -> u8
Returns the prefix length.
sourceimpl Ipv6Prefix
impl Ipv6Prefix
sourceimpl Ipv6Prefix
impl Ipv6Prefix
sourcepub fn session(&self) -> u16
pub fn session(&self) -> u16
Returns the value of the session field of the header.
Note that this field is used for other purposes in some PDU types.
sourcepub fn size() -> u32
pub fn size() -> u32
Returns the PDU size.
The size is returned as a u32
since that type is used in
the header.
sourcepub async fn read<Sock: AsyncRead + Unpin>(
sock: &mut Sock
) -> Result<Self, Error>
pub async fn read<Sock: AsyncRead + Unpin>(
sock: &mut Sock
) -> Result<Self, Error>
Reads a value from a reader.
If a value with a different PDU type is received, returns an error.
sourcepub async fn try_read<Sock: AsyncRead + Unpin>(
sock: &mut Sock
) -> Result<Result<Self, Header>, Error>
pub async fn try_read<Sock: AsyncRead + Unpin>(
sock: &mut Sock
) -> Result<Result<Self, Header>, Error>
Tries to read a value from a reader.
If a different PDU type is received, returns the header as the error case of the ok case.
sourcepub async fn read_payload<Sock: AsyncRead + Unpin>(
header: Header,
sock: &mut Sock
) -> Result<Self, Error>
pub async fn read_payload<Sock: AsyncRead + Unpin>(
header: Header,
sock: &mut Sock
) -> Result<Self, Error>
Reads only the payload part of a value from a reader.
Assuming that the header was already read and is passed via
header
, the function reads the rest of the PUD from the
reader and returns the complete value.
Trait Implementations
sourceimpl AsMut<[u8]> for Ipv6Prefix
impl AsMut<[u8]> for Ipv6Prefix
sourceimpl AsRef<[u8]> for Ipv6Prefix
impl AsRef<[u8]> for Ipv6Prefix
sourceimpl Default for Ipv6Prefix
impl Default for Ipv6Prefix
sourcefn default() -> Ipv6Prefix
fn default() -> Ipv6Prefix
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for Ipv6Prefix
impl Send for Ipv6Prefix
impl Sync for Ipv6Prefix
impl Unpin for Ipv6Prefix
impl UnwindSafe for Ipv6Prefix
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more