Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

add UDP, rustify IPv4 #4

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open

Conversation

bestouff
Copy link

Yes I know, I know, I should have done 2 separate pull requests.
The first commit is a small UDP "parser".
The second one uses Rust's std::net::Ipv4Addr instead of a custom struct (easier for reusing it).

bestouff and others added 30 commits July 9, 2018 13:23
This bumps the minimum rust version to 1.34.0
In order to handle potentially tagged traffic, a new struct and function
were created: `VlanEthernetFrame` and `parse_vlan_ethernet_frame`. This
is to keep the public interface of the `EthernetFrame` struct the same
and remove the overhead of parsing for potentially tagged traffic in the
common use case where traffic is guaranteed to be untagged.
* Change nom version to 5.1

* Fix compilation error

* Rewrite ipv4 in nom 5 fn style

* Rework derive feature by removing macro_use obsolete feature & Added From for IPProtocol

* Rewrite ipv6 in nom 5 fn style & move some commun code from ipv4 and ipv6 to ip

* Fix clippy hint

* Rewrite arp in nom 5 fn style

* Rewrite ethernet in nom 5 fn style

* Rewrite tcp in nom 5 fn style

* Rewrite udp in nom 5 fn style

* Fix clippy hint

* Remove internal utils public function & Remove to_x public function in favor of From implementation

* Add Clone & Copy trait when possible

See https://doc.rust-lang.org/std/marker/trait.Copy.html#when-should-my-type-be-copy
Only TcpHeader is non Copy cause it have a vector option.

* Delete derive feature, now it's named serde
The Internet Header Length is expressed in 32bits words; previously we
were automagically multiplying IHL by 4 to return a bytes length, but as
discussed in issue #14 this was probably a bad idea so now we just
return it straight.
NB: maybe this should have been a breaking change, if it causes
some problem please report, I'll yank this version and publish a sermver
change.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants