Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A zero allocation supporting library for parsing & writing a bunch of packet bas
Currently supported are:
* Ethernet II
* IEEE 802.1Q VLAN Tagging Header
* ARP
* IPv4
* IPv6 (supporting the most common extension headers, but not all)
* UDP
Expand Down Expand Up @@ -49,7 +50,7 @@ match SlicedPacket::from_ethernet(&packet) {
Ok(value) => {
println!("link: {:?}", value.link);
println!("vlan: {:?}", value.vlan);
println!("net: {:?}", value.net); // contains ip
println!("net: {:?}", value.net); // contains ip & arp
println!("transport: {:?}", value.transport);
}
}
Expand Down Expand Up @@ -77,7 +78,7 @@ match PacketHeaders::from_ethernet_slice(&packet) {
Ok(value) => {
println!("link: {:?}", value.link);
println!("vlan: {:?}", value.vlan);
println!("net: {:?}", value.net); // contains ip
println!("net: {:?}", value.net); // contains ip & arp
println!("transport: {:?}", value.transport);
}
}
Expand All @@ -103,6 +104,7 @@ It is also possible to only slice one packet layer:
* [`Ethernet2Slice::from_slice_without_fcs`](https://docs.rs/etherparse/~0/etherparse/struct.Ethernet2Slice.html#method.from_slice_without_fcs) & [`Ethernet2Slice::from_slice_with_crc32_fcs`](https://docs.rs/etherparse/~0/etherparse/struct.Ethernet2Slice.html#method.from_slice_with_crc32_fcs)
* [`LinuxSllSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.LinuxSllSlice.html#method.from_slice)
* [`SingleVlanSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.SingleVlanSlice.html#method.from_slice) & [`DoubleVlanSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.DoubleVlanSlice.html#method.from_slice)
* [`ArpPacketSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.ArpPacketSlice.html#method.from_slice)
* [`IpSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/enum.IpSlice.html#method.from_slice) & [`LaxIpSlice::from_slice`](https://docs.rs/etherparse/~0/etherparse/enum.LaxIpSlice.html#method.from_slice)
* [`Ipv4Slice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Slice.html#method.from_slice) & [`LaxIpv4Slice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.LaxIpv4Slice.html#method.from_slice)
* [`Ipv6Slice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv6Slice.html#method.from_slice) & [`LaxIpv6Slice::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.LaxIpv6Slice.html#method.from_slice)
Expand Down Expand Up @@ -141,6 +143,7 @@ And for deserialization into the corresponding header structs have a look at:
* [`LinuxSllHeader::read`](https://docs.rs/etherparse/~0/etherparse/struct.LinuxSllHeader.html#method.read) & [`LinuxSllHeader::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.LinuxSllHeader.html#method.from_slice)
* [`SingleVlanHeader::read`](https://docs.rs/etherparse/~0/etherparse/struct.SingleVlanHeader.html#method.read) & [`SingleVlanHeader::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.SingleVlanHeader.html#method.from_slice)
* [`DoubleVlanHeader::read`](https://docs.rs/etherparse/~0/etherparse/struct.DoubleVlanHeader.html#method.read) & [`DoubleVlanHeader::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.DoubleVlanHeader.html#method.from_slice)
* [`ArpPacket::read`](https://docs.rs/etherparse/~0/etherparse/struct.ArpPacket.html#method.read) & [`ArpPacket::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.ArpPacket.html#method.from_slice)
* [`IpHeaders::read`](https://docs.rs/etherparse/~0/etherparse/enum.IpHeaders.html#method.read) & [`IpHeaders::from_slice`](https://docs.rs/etherparse/~0/etherparse/enum.IpHeaders.html#method.from_slice)
* [`Ipv4Header::read`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Header.html#method.read) & [`Ipv4Header::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Header.html#method.from_slice)
* [`Ipv4Extensions::read`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Extensions.html#method.read) & [`Ipv4Extensions::from_slice`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Extensions.html#method.from_slice)
Expand Down Expand Up @@ -198,6 +201,8 @@ Read the documentations of the different methods for a more details:
* [`LinuxSllHeader::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.LinuxSllHeader.html#method.to_bytes) & [`LinuxSllHeader::write`](https://docs.rs/etherparse/~0/etherparse/struct.LinuxSllHeader.html#method.write)
* [`SingleVlanHeader::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.SingleVlanHeader.html#method.to_bytes) & [`SingleVlanHeader::write`](https://docs.rs/etherparse/~0/etherparse/struct.SingleVlanHeader.html#method.write)
* [`DoubleVlanHeader::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.DoubleVlanHeader.html#method.to_bytes) & [`DoubleVlanHeader::write`](https://docs.rs/etherparse/~0/etherparse/struct.DoubleVlanHeader.html#method.write)
* [`ArpPacket::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.ArpPacket.html#method.to_bytes) & [`ArpPacket::write`](https://docs.rs/etherparse/~0/etherparse/struct.ArpPacket.html#method.write)
* [`ArpEthIpv4Packet::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.ArpEthIpv4Packet.html#method.to_bytes)
* [`Ipv4Header::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Header.html#method.to_bytes) & [`Ipv4Header::write`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Header.html#method.write) & [`Ipv4Header::write_raw`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Header.html#method.write_raw)
* [`Ipv4Extensions::write`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv4Extensions.html#method.write)
* [`Ipv6Header::to_bytes`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv6Header.html#method.to_bytes) & [`Ipv6Header::write`](https://docs.rs/etherparse/~0/etherparse/struct.Ipv6Header.html#method.write)
Expand Down
1 change: 1 addition & 0 deletions etherparse/examples/read_by_slicing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn main() {
println!(" {:?}", ipv6.extensions());
}
}
Some(Arp(value)) => println!(" Arp {:?}", value),
None => {}
}

Expand Down
1 change: 1 addition & 0 deletions etherparse/proptest-regressions/compositions_tests.txt

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions etherparse/proptest-regressions/net/arp_eth_ipv4_packet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 586bfcca48a89809a557b83c703e64b33458a7b99e492937dc9d27cd15f12884 # shrinks to arp = ArpEthIpv4Packet { operation: ArpOperation(0), sender_mac: [0, 0, 0, 0, 0, 0], sender_ipv4: [0, 0, 0, 0], target_mac: [0, 0, 0, 0, 0, 0], target_ipv4: [0, 0, 0, 0] }
7 changes: 7 additions & 0 deletions etherparse/proptest-regressions/net/arp_packet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 851d44d91acc679380cc543da5c9c124ada08859a988834338417d6e186c45bc # shrinks to arp_eth_ipv4 = ArpEthIpv4Packet { operation: ArpOperation(0), sender_mac: [0, 0, 0, 0, 0, 0], sender_ipv4: [0, 0, 0, 0], target_mac: [0, 0, 0, 0, 0, 0], target_ipv4: [0, 0, 0, 0] }
7 changes: 7 additions & 0 deletions etherparse/proptest-regressions/net/arp_packet_slice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 1a4c5722fbe8b2c58d2ebb4f140cb4655407ddbc5972f4b14f50f743ef72a03b # shrinks to packet = ArpPacket { hw_addr_type: 0 (from KA9Q: NET/ROM pseudo), proto_addr_type: 0x0000, hw_addr_size: 211, proto_addr_size: 74, operation: ArpOperation(0), sender_hw_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 202, 150, 216, 12, 76, 238, 98, 229, 121, 39, 172, 59, 94, 140, 211, 148, 188, 50, 18, 80, 41, 153, 167, 119, 35, 140, 120, 152, 201, 226, 208, 223, 192, 247, 79, 30, 145, 16, 135, 44, 22, 146, 117, 102, 57, 159, 179, 81, 83, 74, 49, 97, 20, 237, 86, 202, 21, 122, 12, 146, 146, 252, 253, 218, 153, 94, 71, 147, 137, 188, 54], sender_protocol_addr: [237, 238, 108, 127, 141, 251, 105, 6, 10, 128, 214, 186, 26, 165, 196, 137, 202, 142, 53, 175, 48, 169, 149, 76, 22, 140, 61, 223, 245, 75, 180, 131, 219, 57, 64, 35, 165, 205, 38, 212, 168, 70, 247, 208, 172, 207, 47, 145, 65, 19, 165, 171, 7, 197, 135, 227, 209, 37, 29, 37, 67, 8, 93, 201, 250, 131, 20, 22, 157, 238, 56, 156, 86, 115], target_hw_addr: [29, 254, 122, 18, 135, 228, 147, 190, 154, 52, 156, 255, 94, 78, 80, 14, 239, 11, 128, 100, 202, 250, 166, 103, 210, 14, 9, 195, 75, 199, 69, 33, 198, 87, 125, 118, 21, 151, 253, 121, 246, 50, 3, 196, 25, 38, 210, 101, 25, 232, 171, 65, 110, 233, 57, 62, 53, 8, 13, 125, 248, 185, 13, 237, 152, 249, 246, 236, 147, 230, 143, 82, 0, 220, 177, 106, 162, 237, 217, 30, 58, 31, 39, 244, 191, 33, 248, 201, 46, 153, 38, 20, 120, 124, 215, 93, 65, 91, 242, 45, 184, 248, 243, 64, 93, 158, 214, 244, 77, 247, 76, 85, 3, 146, 203, 79, 111, 82, 87, 72, 118, 100, 215, 186, 155, 139, 241, 162, 13, 55, 24, 114, 238, 27, 180, 101, 35, 50, 161, 46, 242, 17, 29, 20, 38, 66, 252, 226, 110, 92, 99, 177, 207, 108, 188, 169, 193, 51, 42, 107, 157, 73, 217, 229, 141, 89, 215, 149, 139, 196, 30, 24, 242, 220, 164, 5, 86, 191, 128, 177, 177, 99, 37, 198, 20, 102, 185, 163, 245, 25, 178, 210, 196, 156, 240, 65, 218, 127, 254, 20, 240, 41, 137, 29, 241, 160, 198, 218, 50, 61, 131], target_protocol_addr: [66, 87, 247, 183, 139, 227, 187, 185, 147, 188, 228, 171, 89, 50, 198, 181, 249, 92, 139, 114, 49, 17, 111, 191, 145, 5, 84, 204, 190, 174, 36, 0, 224, 9, 76, 117, 226, 198, 32, 247, 238, 245, 182, 73, 7, 239, 26, 25, 14, 62, 110, 34, 88, 156, 78, 118, 223, 127, 36, 229, 50, 96, 248, 145, 41, 80, 135, 169, 195, 101, 215, 24, 8, 24] }
Loading
Loading