Re: AF_INET versus PF_INET question
Mon, 19 Apr 1999 22:47:54 -0400 (EWT)

On Mon, 19 Apr 1999, Tuan Hoang wrote:

@>I can't seem to find info on why there's both a AF_INET and PF_INET.
@>Or in general why there are address families and protocol families.
@>Can anyone explain why we have both? Which is older/newer?
@>Also, as good programming practice, should one be used instead of the
@>other or mixed, etc..?

To quote from W. Richard Stevens 'Unix Network Programming V1 2ed p.88':
(forgive any typos)

AF_xxx versus PR_xxx

The AF_ prefix stands for "address family" and the PF_prefix stands for
"protocol family". Historicly, the intent was that a single protocol family
might support multiple address families and that the PF_ value was used to
create the socket and the AF_ value was used in socket address structures.
But in actuality, a protocol family supporting multiple address families has
never been supported and the <sys/socket.h> header defines the PF_ value
for a given protocol to be equal to the AF_ value for that protocol. While
there is no guarentee that this equality between the two will always be true,
should anyone change this for existing protocols, lots of existing code would
break. To conform to existing coding practice, we use only the AF_ constants
in this text, although you may encounter the PF_ value, mainly in calls to

[ some historical discusion follows... ]


To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to