File: README.md

package info (click to toggle)
rust-pktparse 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 132 kB
  • sloc: makefile: 2
file content (21 lines) | stat: -rw-r--r-- 631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# PktParse
This repository is just a bunch of packet parsing routines made with [nom](https://github.com/Geal/nom)
## Usage
Admitting your `packet.data` is an `[u8]`:
```rust
        if let Done(remaining, eth_frame) = ethernet::parse_ethernet_frame(packet.data) {
            if eth_frame.ethertype != EtherType::IPv4 {
                continue;
            }
            if let Done(remaining, ipv4_packet) = ipv4::parse_ipv4_header(remaining) {
```
For now the list of available parsers is rather short:
- ethernet
- IPv4
- UDP
- TCP
... but I'll gladly accept contributions.

## Last changes

- Port to nom 4 (breaking change)