bmp-protocol

Crates.iobmp-protocol
lib.rsbmp-protocol
version0.1.3
sourcesrc
created_at2020-06-22 12:54:50.486029
updated_at2020-06-29 15:51:50.434911
descriptionTokio-based BMP protocol decoder
homepagehttps://github.com/ccakes/bmp-protocol-rs
repositoryhttps://github.com/ccakes/bmp-protocol-rs
max_upload_size
id256719
size30,767
Cameron Daniel (ccakes)

documentation

https://docs.rs/bmp-protocol

README

bmp-protocol

This crate implements a simple BMP packet decoder. It can decode BMP v3 packets and will use bgp-rs to decode any BGP messages contained within the BMP data.

We provide a Decoder ready to be used with a tokio_util::codec::FramedRead instance to provide decoded BMP messages to a consumer. See bmp-client for a working example of this.

Usage

# Cargo.toml
bmp-protocol = "^0.1"
use bmp_protocol::BmpDecoder;
use tokio::fs::File;
use tokio_util::codec::FramedRead;

// Read a file created using bmp_play (https://github.com/paololucente/bmp_play)
// A more likely real-world use case would be reading from a TcpStream
#[tokio::main]
async fn main() -> std::io::Result<()> {
    let fh = File::open(&entry.path()).await?;
    let mut reader = FramedRead::new(fh, BmpDecoder::new());

    while let Some(message) = reader.next().await {
        assert!(message.is_ok());
    }
}

Contributing

Contributions are welcome, the library is currently incomplete and there are still BMP message types to implement.

Commit count: 17

cargo fmt