Struct bgpkit_parser::attributes::AsPath
source · pub struct AsPath {
pub segments: Vec<AsPathSegment, Global>,
}
Fields§
§segments: Vec<AsPathSegment, Global>
Implementations§
source§impl AsPath
impl AsPath
pub fn new() -> AsPath
pub fn from_segments(segments: Vec<AsPathSegment, Global>) -> AsPath
pub fn add_segment(&mut self, segment: AsPathSegment)
pub fn segments(&self) -> &Vec<AsPathSegment, Global>
pub fn count_asns(&self) -> usize
sourcepub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
pub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
Construct AsPath from AS_PATH and AS4_PATH
https://datatracker.ietf.org/doc/html/rfc6793#section-4.2.3 If the number of AS numbers in the AS_PATH attribute is less than the number of AS numbers in the AS4_PATH attribute, then the AS4_PATH attribute SHALL be ignored, and the AS_PATH attribute SHALL be taken as the AS path information.
If the number of AS numbers in the AS_PATH attribute is larger than or equal to the number of AS numbers in the AS4_PATH attribute, then the AS path information SHALL be constructed by taking as many AS numbers and path segments as necessary from the leading part of the AS_PATH attribute, and then prepending them to the AS4_PATH attribute so that the AS path information has a number of AS numbers identical to that of the AS_PATH attribute. Note that a valid AS_CONFED_SEQUENCE or AS_CONFED_SET path segment SHALL be prepended if it is either the leading path segment or is adjacent to a path segment that is prepended.
pub fn get_origin(&self) -> Option<Vec<Asn, Global>>
pub fn to_u32_vec(&self) -> Option<Vec<u32, Global>>
Trait Implementations§
source§impl PartialEq<AsPath> for AsPath
impl PartialEq<AsPath> for AsPath
source§impl Serialize for AsPath
impl Serialize for AsPath
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
impl Eq for AsPath
impl StructuralEq for AsPath
impl StructuralPartialEq for AsPath
Auto Trait Implementations§
impl RefUnwindSafe for AsPath
impl Send for AsPath
impl Sync for AsPath
impl Unpin for AsPath
impl UnwindSafe for AsPath
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.