pub struct ExtendedCommunity(/* private fields */);Expand description
RFC 4360 Extended Community — 8-byte value stored as u64.
Wire layout: type (1) + sub-type (1) + value (6). Bit 6 of the type byte: 0 = transitive, 1 = non-transitive.
Implementations§
Source§impl ExtendedCommunity
impl ExtendedCommunity
Sourcepub fn is_transitive(self) -> bool
pub fn is_transitive(self) -> bool
Transitive if bit 6 of the type byte is 0.
Sourcepub fn value_bytes(self) -> [u8; 6]
pub fn value_bytes(self) -> [u8; 6]
Bytes 2-7 of the community value.
Sourcepub fn route_target(self) -> Option<(u32, u32)>
pub fn route_target(self) -> Option<(u32, u32)>
Decode as Route Target (sub-type 0x02).
Returns (global_admin, local_admin) as raw u32 values. The
interpretation of global_admin depends on the type byte:
- Type 0x00 (2-octet AS specific): global = ASN (fits u16), local = u32
- Type 0x01 (IPv4 address specific): global = IPv4 addr as u32, local = u16
- Type 0x02 (4-octet AS specific): global = ASN (u32), local = u16
Callers that need to distinguish these encodings (e.g. for display as
RT:192.0.2.1:100 vs RT:65001:100) must also check type_byte().
Sourcepub fn route_origin(self) -> Option<(u32, u32)>
pub fn route_origin(self) -> Option<(u32, u32)>
Decode as Route Origin (sub-type 0x03).
Same layout as route_target() — returns raw
(global_admin, local_admin) with the same type-byte-dependent
interpretation. Check type_byte() to distinguish
2-octet AS, IPv4-address, and 4-octet AS encodings.
Source§impl ExtendedCommunity
impl ExtendedCommunity
Sourcepub fn as_flowspec_action(&self) -> Option<FlowSpecAction>
pub fn as_flowspec_action(&self) -> Option<FlowSpecAction>
Try to decode this extended community as a FlowSpec action.
Sourcepub fn from_flowspec_action(action: &FlowSpecAction) -> Self
pub fn from_flowspec_action(action: &FlowSpecAction) -> Self
Create an extended community from a FlowSpec action.
Trait Implementations§
Source§impl Clone for ExtendedCommunity
impl Clone for ExtendedCommunity
Source§fn clone(&self) -> ExtendedCommunity
fn clone(&self) -> ExtendedCommunity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more