[OpenAFS-devel] Announcement: Significant changes to Rx internals

Ken Hornstein kenh@cmf.nrl.navy.mil
Tue, 09 May 2006 14:28:56 -0400


>I haven't studied your code, so perhaps that would make it clear,
>but what are the purpose of your saddrlen and socktype?  How are
>they different from the ss_len and ss_family fields of the
>sockaddr_storage struct?

A fair question.

First off, not all systems have a length field in the struct
sockaddr_storage; the coverage on that is relatively uneven.  E.g.,
Solaris and Linux do not.  Systems do have one if struct sockaddr_in
has sin_len, but again, it's uneven.  So for portability's sake we need
to include the length of the structure separately instead of being able
to depend on ss_len.

ss_family is the address family, which lets you select between AF_INET
and AF_INET6.  But the socket structure doesn't include the socket type
(e.g., SOCK_DGRAM or SOCK_STREAM).  That's what goes in socktype.  I
suppose technically I should have included a sockproto as well ...
but it seems like that's relatively unused, and enough people pass in
0 for the protocol that it doesn't really matter.

If you are curious, check out the macros at the end of rx.h, and you
can see the sort of contortions necessary for IPv6 support.

--Ken