From ff92fcaff313601b71199e7d19cb27d0e4e07375 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Wed, 9 Aug 2000 19:09:09 +0000 Subject: [PATCH] some isc_sockaddr_* functions were undocumented, and others were documented in the source file rather than the header file --- lib/isc/include/isc/sockaddr.h | 42 +++++++++++++++++++++++++++++++++- lib/isc/sockaddr.c | 14 +----------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h index e028e2883b..5d839eb88d 100644 --- a/lib/isc/include/isc/sockaddr.h +++ b/lib/isc/include/isc/sockaddr.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.h,v 1.33 2000/08/09 18:55:54 gson Exp $ */ +/* $Id: sockaddr.h,v 1.34 2000/08/09 19:09:09 gson Exp $ */ #ifndef ISC_SOCKADDR_H #define ISC_SOCKADDR_H 1 @@ -40,41 +40,81 @@ ISC_LANG_BEGINDECLS isc_boolean_t isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b); +/* + * Return ISC_TRUE iff the socket addresses 'a' and 'b' are equal. + */ isc_boolean_t isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b); +/* + * Return ISC_TRUE iff the address parts of the socket addresses + * 'a' and 'b' are equal, ignoring the ports. + */ isc_boolean_t isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int prefixlen); +/* + * Return ISC_TRUE iff the most significant 'prefixlen' bits of the + * socket addresses 'a' and 'b' are equal, ignoring the ports. + */ unsigned int isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only); +/* + * Return a hash value for the socket address 'sockaddr'. If 'address_only' + * is ISC_TRUE, the hash value will not depend on the port. + */ void isc_sockaddr_any(isc_sockaddr_t *sockaddr); +/* + * Return the IPv4 wildcard address. + */ void isc_sockaddr_any6(isc_sockaddr_t *sockaddr); +/* + * Return the IPv6 wildcard address. + */ void isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int family); +/* + * Set '*sockaddr' to the wildcard address of protocol family + * 'family'. + * + * Requires: + * 'family' is AF_INET or AF_INET6. + */ void isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, in_port_t port); +/* + * Construct an isc_sockaddr_t from an IPv4 address and port. + */ void isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6, in_port_t port); +/* + * Construct an isc_sockaddr_t from an IPv6 address and port. + */ void isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, in_port_t port); +/* + * Construct an IPv6 isc_sockaddr_t representing a mapped IPv4 address. + */ void isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, in_port_t port); +/* + * Construct an isc_sockaddr_t from an isc_netaddr_t and port. + */ int isc_sockaddr_pf(const isc_sockaddr_t *sockaddr); diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 93bbc40b8c..e9cdc5e409 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.c,v 1.45 2000/08/09 18:55:53 gson Exp $ */ +/* $Id: sockaddr.c,v 1.46 2000/08/09 19:09:08 gson Exp $ */ #include @@ -65,9 +65,6 @@ isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) { return (ISC_TRUE); } -/* - * Compare just the addresses (ignore ports) - */ isc_boolean_t isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) { REQUIRE(a != NULL && b != NULL); @@ -95,11 +92,6 @@ isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) { return (ISC_TRUE); } -/* - * Compare just a prefix of the addresses (ignore ports and - * low address bits) - */ - isc_boolean_t isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int prefixlen) @@ -182,10 +174,6 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) { unsigned int h = 0; unsigned int g; - /* - * Provide a hash value for 'sockaddr'. - */ - REQUIRE(sockaddr != NULL); if (address_only) {