In Linux, one use socket(family, type, protocol) to create a socket. Some tips about raw socket:
1. To capture packets with Ethernet header, use family AF_PACKET
2. PF_PACKET is the same as AF_PACKET. Actually PF_* is the same as AF_*. AF_ prefix is the new way of calling them. (Address Family)
3. When using PF_PACKET, type can either be SOCK_RAW or SOCK_DGRAM
4. protocol can be ETH_P_IP, ETH_P_ALL, etc. The complete list is under Linux source tree include/uapi/linux/if_ether.h
5. IMPORTANT ETH_P_ALL captures all incoming and outgoing packets. Other protocols only capture incoming packets. (See this question: http://stackoverflow.com/questions/20864962/does-capturing-outgoing-frames-using-linux-raw-socket-requires-eth-p-all)
Also remember to bind the raw socket to the particular network interface. Man 7 af_packet for details.