#include <sys/socket.h> /* for SOCK_PACKET define. */
#include <linux/if_ether.h> /* for ETH_IP_ALL define. */

main()
{
int fd;

fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_IP));
  /* the constant ETH_P_IP tells the kernel to pass our socket
     only IP datagrams. Just take my word for it. */

}