Extract Ethernet, IPv4, TCP, UDP headers in C

It is easier and less error-prone to extract these headers in C than it
is to unpack them in ruby, so move the code over.