1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::io::Read;
use bgp_models::mrt::MrtRecord;
#[macro_use]
pub(crate) mod utils;
pub(crate) mod mrt;
pub(crate) mod bgp;
pub(crate) mod iters;
pub(crate) use self::utils::*;
pub(crate) use bgp::attributes::AttributeParser;
pub(crate) use mrt::{parse_bgp4mp, parse_table_dump_message, parse_table_dump_v2_message, parse_mrt_record, };
pub use crate::error::ParserError;
pub use mrt::mrt_elem::{BgpElem, Elementor, ElemType};
use crate::io::get_reader;
pub struct BgpkitParser {
reader: Box<dyn Read>
}
impl BgpkitParser {
pub fn new(path: &str) -> BgpkitParser{
BgpkitParser{
reader: get_reader(path)
}
}
pub fn next(&mut self) -> Result<MrtRecord, ParserError> {
parse_mrt_record(&mut self.reader)
}
}