pub struct Elementor {
pub peer_table: Option<PeerIndexTable>,
}Fields§
§peer_table: Option<PeerIndexTable>Implementations§
Source§impl Elementor
impl Elementor
pub fn new() -> Elementor
Sourcepub fn set_peer_table(&mut self, record: MrtRecord) -> Result<(), ParserError>
pub fn set_peer_table(&mut self, record: MrtRecord) -> Result<(), ParserError>
Sets the peer index table for the elementor.
This method takes an MRT record and extracts the peer index table from it if the record contains one. The peer index table is required for processing TableDumpV2 records, as it contains the mapping between peer indices and their corresponding IP addresses and ASNs.
§Arguments
record- An MRT record that should contain a peer index table
§Returns
Ok(())- If the peer table was successfully extracted and setErr(ParserError)- If the record does not contain a peer index table
§Example
use bgpkit_parser::{BgpkitParser, Elementor};
let mut parser = BgpkitParser::new("rib.dump.bz2").unwrap();
let mut elementor = Elementor::new();
// Get the first record which should be the peer index table
if let Ok(record) = parser.next_record() {
elementor.set_peer_table(record).unwrap();
}Sourcepub fn bgp_to_elems(
msg: BgpMessage,
timestamp: f64,
peer_ip: &IpAddr,
peer_asn: &Asn,
) -> Vec<BgpElem>
pub fn bgp_to_elems( msg: BgpMessage, timestamp: f64, peer_ip: &IpAddr, peer_asn: &Asn, ) -> Vec<BgpElem>
Convert a BgpMessage to a vector of BgpElems.
A BgpMessage may include Update, Open, Notification or KeepAlive messages,
and only Update message contains BgpElems.
Sourcepub fn bgp_update_to_elems(
msg: BgpUpdateMessage,
timestamp: f64,
peer_ip: &IpAddr,
peer_asn: &Asn,
) -> Vec<BgpElem>
pub fn bgp_update_to_elems( msg: BgpUpdateMessage, timestamp: f64, peer_ip: &IpAddr, peer_asn: &Asn, ) -> Vec<BgpElem>
Convert a BgpUpdateMessage to a vector of BgpElems.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Elementor
impl RefUnwindSafe for Elementor
impl Send for Elementor
impl Sync for Elementor
impl Unpin for Elementor
impl UnwindSafe for Elementor
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more