peel

Build Status Build status Coverage Status master doc peel License MIT Crates.io doc.rs

Dynamic parsing within trees 🌲 🌳 🌴

Target of this library is to provide a flexible parsing approach for network packets. This will be done within arena based parser trees which can be modified during runtime.

An example included within this crate is the parsing of the Internet Protocol Suite. Beside this, it is possible to build own parser trees or include a custom parser within an already existing tree.

Example usage

```rust use peel::prelude::*;

// Get the default tree based on the TCP/IP stack let peel = peeltcpip();

let eth_header = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 8, 0];

// Traverse the parser tree. If a parser matches check for available child parsers. // Stop parsing if there are no childs left. The vec![] memory will be used for // the resulting stack of Layers. let result = peel.traverse(&eth_header, vec![]).unwrap();

// There should be one parsed EthernetPacket in: assert_eq!(result.len(), 1); ```