12 releases (6 breaking)

0.7.1 Dec 26, 2021
0.7.0 Aug 27, 2021
0.6.1 Aug 2, 2021
0.6.0 Jul 3, 2021
0.1.0 Nov 21, 2016

#1691 in Network programming

Download history 87/week @ 2023-12-13 67/week @ 2023-12-20 113/week @ 2023-12-27 173/week @ 2024-01-03 100/week @ 2024-01-10 88/week @ 2024-01-17 68/week @ 2024-01-24 76/week @ 2024-01-31 175/week @ 2024-02-07 133/week @ 2024-02-14 115/week @ 2024-02-21 162/week @ 2024-02-28 109/week @ 2024-03-06 110/week @ 2024-03-13 123/week @ 2024-03-20 130/week @ 2024-03-27

488 downloads per month
Used in 9 crates

LGPL-3.0

50KB
1.5K SLoC

PktParse

This repository is just a bunch of packet parsing routines made with nom

Usage

Admitting your packet.data is an [u8]:

        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 (with optional VLAN tag)
  • IPv4
  • IPv6
  • UDP
  • TCP
  • ICMP ... and we'll gladly accept contributions.

Last changes

  • IHL is not multiplied by 4 anymore

Dependencies

~0.8–1.2MB
~21K SLoC