https://github.com/ccakes/bmp-protocol-rs
Rust decoder for a stream of BMP (BGP Monitoring Protocol) packets
https://github.com/ccakes/bmp-protocol-rs
Last synced: 5 months ago
JSON representation
Rust decoder for a stream of BMP (BGP Monitoring Protocol) packets
- Host: GitHub
- URL: https://github.com/ccakes/bmp-protocol-rs
- Owner: ccakes
- License: mit
- Created: 2019-08-06T11:36:17.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-29T16:09:31.000Z (about 6 years ago)
- Last Synced: 2025-01-31T15:47:54.334Z (over 1 year ago)
- Language: Rust
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
# bmp-protocol
This crate implements a simple BMP packet decoder. It can decode BMP v3 packets and will use [`bgp-rs`](https://github.com/DevQps/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`](https://github.com/ccakes/bmp-client-rs) for a working example of this.
## Usage
```toml
# Cargo.toml
bmp-protocol = "^0.1"
```
```rust
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.