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
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};
pub struct BgpkitParser<T: Read> {
input: T,
}
impl<T: Read> BgpkitParser<T> {
pub fn new(input: T) -> BgpkitParser<T> {
BgpkitParser {
input: input,
}
}
pub fn next(&mut self) -> Result<MrtRecord, ParserError> {
parse_mrt_record(&mut self.input)
}
}