pub struct ClientSubnet { /* private fields */ }
Expand description
RFC 7871, Client Subnet, Optional
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0: | FAMILY |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2: | SOURCE PREFIX-LENGTH | SCOPE PREFIX-LENGTH |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
4: | ADDRESS... /
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
o FAMILY, 2 octets, indicates the family of the address contained in
the option, using address family codes as assigned by IANA in
Address Family Numbers [Address_Family_Numbers].
o SOURCE PREFIX-LENGTH, an unsigned octet representing the leftmost
number of significant bits of ADDRESS to be used for the lookup.
In responses, it mirrors the same value as in the queries.
o SCOPE PREFIX-LENGTH, an unsigned octet representing the leftmost
number of significant bits of ADDRESS that the response covers.
In queries, it MUST be set to 0.
o ADDRESS, variable number of octets, contains either an IPv4 or
IPv6 address, depending on FAMILY, which MUST be truncated to the
number of bits indicated by the SOURCE PREFIX-LENGTH field,
padding with 0 bits to pad to the end of the last octet needed.
o A server receiving an ECS option that uses either too few or too
many ADDRESS octets, or that has non-zero ADDRESS bits set beyond
SOURCE PREFIX-LENGTH, SHOULD return FORMERR to reject the packet,
as a signal to the software developer making the request to fix
their implementation.
Implementations§
Source§impl ClientSubnet
impl ClientSubnet
Sourcepub fn new(address: IpAddr, source_prefix: u8, scope_prefix: u8) -> Self
pub fn new(address: IpAddr, source_prefix: u8, scope_prefix: u8) -> Self
Construct a new EcsOption with the address, source_prefix and scope_prefix.
Sourcepub fn source_prefix(&self) -> u8
pub fn source_prefix(&self) -> u8
returns the source prefix
Sourcepub fn set_source_prefix(&mut self, source_prefix: u8)
pub fn set_source_prefix(&mut self, source_prefix: u8)
returns the source prefix
Sourcepub fn scope_prefix(&self) -> u8
pub fn scope_prefix(&self) -> u8
returns the scope prefix
Sourcepub fn set_scope_prefix(&mut self, scope_prefix: u8)
pub fn set_scope_prefix(&mut self, scope_prefix: u8)
returns the scope prefix
Trait Implementations§
Source§impl<'a> BinDecodable<'a> for ClientSubnet
impl<'a> BinDecodable<'a> for ClientSubnet
Source§fn read(decoder: &mut BinDecoder<'a>) -> Result<Self, ProtoError>
fn read(decoder: &mut BinDecoder<'a>) -> Result<Self, ProtoError>
Read the type from the stream
Source§fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
Returns the object in binary form
Source§impl BinEncodable for ClientSubnet
impl BinEncodable for ClientSubnet
Source§fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
Write the type to the stream
Source§impl Clone for ClientSubnet
impl Clone for ClientSubnet
Source§fn clone(&self) -> ClientSubnet
fn clone(&self) -> ClientSubnet
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ClientSubnet
impl Debug for ClientSubnet
Source§impl<'de> Deserialize<'de> for ClientSubnet
impl<'de> Deserialize<'de> for ClientSubnet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<IpNet> for ClientSubnet
impl From<IpNet> for ClientSubnet
Source§impl FromStr for ClientSubnet
impl FromStr for ClientSubnet
Source§impl Hash for ClientSubnet
impl Hash for ClientSubnet
Source§impl PartialEq for ClientSubnet
impl PartialEq for ClientSubnet
Source§impl PartialOrd for ClientSubnet
impl PartialOrd for ClientSubnet
Source§impl Serialize for ClientSubnet
impl Serialize for ClientSubnet
Source§impl<'a> TryFrom<&'a [u8]> for ClientSubnet
impl<'a> TryFrom<&'a [u8]> for ClientSubnet
Source§impl<'a> TryFrom<&'a ClientSubnet> for Vec<u8>
impl<'a> TryFrom<&'a ClientSubnet> for Vec<u8>
Source§type Error = ProtoError
type Error = ProtoError
The type returned in the event of a conversion error.
impl Copy for ClientSubnet
impl Eq for ClientSubnet
impl StructuralPartialEq for ClientSubnet
Auto Trait Implementations§
impl Freeze for ClientSubnet
impl RefUnwindSafe for ClientSubnet
impl Send for ClientSubnet
impl Sync for ClientSubnet
impl Unpin for ClientSubnet
impl UnwindSafe for ClientSubnet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.