There are times when one needs to construct the full ethernet frame to send/receive. Most unixes support BPF (BSD Packet Filter) to achieve it, but linux provides the same functionality via AF_SOCKET. This API works with either a BPF or AF_SOCKET backend, so it should work on every usable UNIX, as well as linux out there.
open_link ~filter ~promisc interface sw. Creates a rawlink on the specified interface, a BPF program filter can be passed to filter out incoming packets. If promisc is true, sets interface to promiscuous mode, defaults to false.