chiark / gitweb /
addrfam: New arrangements for protocol address types
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 12 Jul 2014 11:56:46 +0000 (12:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Oct 2014 20:14:46 +0000 (21:14 +0100)
commit82ae109eba3901127fcd5267872b0afd64af4a7c
tree0091676c9ed1146e849dc3661c3e11a928748055
parent6380363dc46040dcc7c00c056b310b9a9495f36f
addrfam: New arrangements for protocol address types

Abolish union gen_addr and struct af_addr.  It is not legitimate to
up-cast to a union (since the alignment might be wrong), and the
profusion of additonal address types is confusing.

The new arrangements are:

* Use adns_sockaddr wherever we can.  That includes situations
  where the port (or v6 scope, etc.) is not relevant.

* Where that's not possible, use a struct sockaddr if we can.

* Where we need to deal with an IP address of unspecified family (we
  use the phrase `protocol address') we must use a void*.

Other changes we make here:

* Reorganise the set of functions provided by addrfam.c.  Previously
  there was a comprehensive set of manipulators.  Now, we have
  precisely the set of functions we need.

  The new functions are called adns__addr_* when they deal with
  adns_sockaddrs, and adns_sockaddr_* when dealing with struct
  sockaddrs.

  The new functions normally no longer need to take an explicit af
  parameter, since they can use the af field in the sockaddr.

* adns__sockaddrs_equal (previously, adns__sockaddr_equal_p) now uses
  the generic protocol address comparison function; consequently
  remove the IN6_ADDR_EQUALP macro since it now has only one use site.

* Remove the Lispy "-p" suffix from predicate function names.

And of course the very formulaic changes to code which accesses
addresses of various kinds.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/addrfam.c
src/check.c
src/event.c
src/internal.h
src/setup.c
src/types.c