linux网络编程中协议簇AF_和PF_的区别

  在socket.h文件中有对协议簇的宏定义,如下:

/* Protocol families, same as address families. */
#define PF_UNSPEC		AF_UNSPEC
#define PF_UNIX			AF_UNIX
#define PF_LOCAL		AF_LOCAL
#define PF_INET			AF_INET
#define PF_AX25			AF_AX25
#define PF_IPX			AF_IPX
#define PF_APPLETALK	AF_APPLETALK
#define	PF_NETROM		AF_NETROM
#define PF_BRIDGE		AF_BRIDGE
#define PF_ATMPVC		AF_ATMPVC
#define PF_X25			AF_X25
#define PF_INET6		AF_INET6
#define PF_ROSE			AF_ROSE
#define PF_DECnet		AF_DECnet
#define PF_NETBEUI		AF_NETBEUI
#define PF_SECURITY		AF_SECURITY
#define PF_KEY			AF_KEY
#define PF_NETLINK		AF_NETLINK
#define PF_ROUTE		AF_ROUTE
#define PF_PACKET		AF_PACKET
#define PF_ASH			AF_ASH
#define PF_ECONET		AF_ECONET
#define PF_ATMSVC		AF_ATMSVC
#define PF_RDS			AF_RDS
#define PF_SNA			AF_SNA
#define PF_IRDA			AF_IRDA
#define PF_PPPOX		AF_PPPOX
#define PF_WANPIPE		AF_WANPIPE
#define PF_LLC			AF_LLC
#define PF_IB			AF_IB
#define PF_MPLS			AF_MPLS
#define PF_CAN			AF_CAN
#define PF_TIPC			AF_TIPC
#define PF_BLUETOOTH	AF_BLUETOOTH
#define PF_IUCV			AF_IUCV
#define PF_RXRPC		AF_RXRPC
#define PF_ISDN			AF_ISDN
#define PF_PHONET		AF_PHONET
#define PF_IEEE802154	AF_IEEE802154
#define PF_CAIF			AF_CAIF
#define PF_ALG			AF_ALG
#define PF_NFC			AF_NFC
#define PF_VSOCK		AF_VSOCK
#define PF_KCM			AF_KCM
#define PF_QIPCRTR		AF_QIPCRTR
#define PF_SMC			AF_SMC
#define PF_XDP			AF_XDP
#define PF_MAX			AF_MAX

  可以看出AF_和PF_的值直接可以替换,没有其它区别。

你可能感兴趣的:(UNIX环境高级编程,linux)