/* blast a byte value across sockaddr_u v6 address */
#define MEMSET_ADDR6(psau, v) \
memset((psau)->sa6.sin6_addr.s6_addr, (v), \
sizeof((psau)->sa6.sin6_addr.s6_addr))
#define SET_ONESMASK(psau) \
do { \
if (IS_IPV6(psau)) \
MEMSET_ADDR6((psau), 0xff); \
else \
NSRCADR(psau) = 0xffffffff; \
} while(0)
/* zero sockaddr_u, fill in family and all-ones (host) mask */
#define SET_HOSTMASK(psau, family) \
do { \
ZERO_SOCK(psau); \
AF(psau) = (family); \
SET_ONESMASK(psau); \
} while (0)
/*
* compare two in6_addr returning negative, 0, or positive.
* ADDR6_CMP is negative if *pin6A is lower than *pin6B, zero if they
* are equal, positive if *pin6A is higher than *pin6B. IN6ADDR_ANY
* is the lowest address (128 zero bits).
*/
#define ADDR6_CMP(pin6A, pin6B) \
memcmp((pin6A)->s6_addr, (pin6B)->s6_addr, \
sizeof(pin6A)->s6_addr)
/* compare two in6_addr for equality only */
#if !defined(SYS_WINNT) || !defined(in_addr6)
#define ADDR6_EQ(pin6A, pin6B) \
(!ADDR6_CMP(pin6A, pin6B))
#else
#define ADDR6_EQ(pin6A, pin6B) \
IN6_ADDR_EQUAL(pin6A, pin6B)
#endif
/* compare a in6_addr with socket address */
#define S_ADDR6_EQ(psau, pin6) \
ADDR6_EQ(&(psau)->sa6.sin6_addr, pin6)
/* just how unspecified do you mean? (scope 0/unspec too) */
#define SOCK_UNSPEC_S(psau) \
(SOCK_UNSPEC(psau) && !SCOPE(psau))
/* choose a default net interface (endpt) for v4 or v6 */
#define ANY_INTERFACE_BYFAM(family) \
((AF_INET == family) \
? any_interface \
: any6_interface)
/* choose a default interface for addresses' protocol (addr family) */
#define ANY_INTERFACE_CHOOSE(psau) \
ANY_INTERFACE_BYFAM(AF(psau))
/*
* We tell reference clocks from real peers by giving the reference
* clocks an address of the form 127.127.t.u, where t is the type and
* u is the unit number. We define some of this here since we will need
* some sanity checks to make sure this address isn't interpretted as
* that of a normal peer.
*/
#define REFCLOCK_ADDR 0x7f7f0000 /* 127.127.0.0 */
#define REFCLOCK_MASK 0xffff0000 /* 255.255.0.0 */
/*
* Macro for checking for invalid addresses. This is really, really
* gross, but is needed so no one configures a host on net 127 now that
* we're encouraging it the the configuration file.
*/
#define LOOPBACKADR 0x7f000001
#define LOOPNETMASK 0xff000000
#ifdef WORDS_BIGENDIAN
# define LOOPBACKADR_N LOOPBACKADR
#else
# define LOOPBACKADR_N 0x0100007f
#endif