From 1173d5eff8dc423c129f442023419436ee94db23 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sun, 9 Dec 2007 13:39:46 +0000 Subject: resolve conflicts --- usr.sbin/bind/lib/lwres/context.c | 121 ++++- usr.sbin/bind/lib/lwres/getaddrinfo.c | 129 ++++- usr.sbin/bind/lib/lwres/gethost.c | 147 +++++- usr.sbin/bind/lib/lwres/getipnode.c | 129 ++++- usr.sbin/bind/lib/lwres/getnameinfo.c | 68 ++- usr.sbin/bind/lib/lwres/getrrset.c | 83 ++- usr.sbin/bind/lib/lwres/herror.c | 41 +- usr.sbin/bind/lib/lwres/lwconfig.c | 68 ++- usr.sbin/bind/lib/lwres/lwinetaton.c | 8 +- usr.sbin/bind/lib/lwres/lwinetntop.c | 12 +- usr.sbin/bind/lib/lwres/lwresutil.c | 93 +++- usr.sbin/bind/lib/lwres/man/lwres.html | 332 ++++++------ usr.sbin/bind/lib/lwres/man/lwres_buffer.html | 585 +++++++++------------ usr.sbin/bind/lib/lwres/man/lwres_config.html | 206 +++----- usr.sbin/bind/lib/lwres/man/lwres_context.3 | 30 +- usr.sbin/bind/lib/lwres/man/lwres_context.docbook | 426 +++++++-------- usr.sbin/bind/lib/lwres/man/lwres_context.html | 409 ++++++-------- usr.sbin/bind/lib/lwres/man/lwres_gabn.html | 361 ++++++------- .../bind/lib/lwres/man/lwres_gai_strerror.html | 122 ++--- usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html | 452 ++++++++-------- usr.sbin/bind/lib/lwres/man/lwres_gethostent.html | 563 ++++++++++---------- usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 | 75 ++- .../bind/lib/lwres/man/lwres_getipnode.docbook | 520 +++++++++--------- usr.sbin/bind/lib/lwres/man/lwres_getipnode.html | 327 +++++------- usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html | 173 +++--- .../bind/lib/lwres/man/lwres_getrrsetbyname.html | 220 ++++---- usr.sbin/bind/lib/lwres/man/lwres_gnba.html | 345 ++++++------ usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html | 100 ++-- usr.sbin/bind/lib/lwres/man/lwres_inetntop.html | 90 ++-- usr.sbin/bind/lib/lwres/man/lwres_noop.html | 342 ++++++------ usr.sbin/bind/lib/lwres/man/lwres_packet.html | 245 ++++----- usr.sbin/bind/lib/lwres/man/lwres_resutil.html | 293 +++++------ usr.sbin/bind/lib/lwres/print.c | 2 +- 33 files changed, 3748 insertions(+), 3369 deletions(-) (limited to 'usr.sbin/bind/lib/lwres') diff --git a/usr.sbin/bind/lib/lwres/context.c b/usr.sbin/bind/lib/lwres/context.c index 23143b0b57d..2145be31805 100644 --- a/usr.sbin/bind/lib/lwres/context.c +++ b/usr.sbin/bind/lib/lwres/context.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001, 2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,8 +15,76 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: context.c,v 1.41.2.1.2.4 2004/09/17 05:50:31 marka Exp $ */ - +/* $ISC: context.c,v 1.45.18.7 2007/08/28 07:20:06 tbox Exp $ */ + +/*! \file context.c + lwres_context_create() creates a #lwres_context_t structure for use in + lightweight resolver operations. It holds a socket and other data + needed for communicating with a resolver daemon. The new + lwres_context_t is returned through contextp, a pointer to a + lwres_context_t pointer. This lwres_context_t pointer must initially + be NULL, and is modified to point to the newly created + lwres_context_t. + + When the lightweight resolver needs to perform dynamic memory + allocation, it will call malloc_function to allocate memory and + free_function to free it. If malloc_function and free_function are + NULL, memory is allocated using malloc and free. It is not + permitted to have a NULL malloc_function and a non-NULL free_function + or vice versa. arg is passed as the first parameter to the memory + allocation functions. If malloc_function and free_function are NULL, + arg is unused and should be passed as NULL. + + Once memory for the structure has been allocated, it is initialized + using lwres_conf_init() and returned via *contextp. + + lwres_context_destroy() destroys a #lwres_context_t, closing its + socket. contextp is a pointer to a pointer to the context that is to + be destroyed. The pointer will be set to NULL when the context has + been destroyed. + + The context holds a serial number that is used to identify resolver + request packets and associate responses with the corresponding + requests. This serial number is controlled using + lwres_context_initserial() and lwres_context_nextserial(). + lwres_context_initserial() sets the serial number for context *ctx to + serial. lwres_context_nextserial() increments the serial number and + returns the previous value. + + Memory for a lightweight resolver context is allocated and freed using + lwres_context_allocmem() and lwres_context_freemem(). These use + whatever allocations were defined when the context was created with + lwres_context_create(). lwres_context_allocmem() allocates len bytes + of memory and if successful returns a pointer to the allocated + storage. lwres_context_freemem() frees len bytes of space starting at + location mem. + + lwres_context_sendrecv() performs I/O for the context ctx. Data are + read and written from the context's socket. It writes data from + sendbase -- typically a lightweight resolver query packet -- and waits + for a reply which is copied to the receive buffer at recvbase. The + number of bytes that were written to this receive buffer is returned + in *recvd_len. + +\section context_return Return Values + + lwres_context_create() returns #LWRES_R_NOMEMORY if memory for the + struct lwres_context could not be allocated, #LWRES_R_SUCCESS + otherwise. + + Successful calls to the memory allocator lwres_context_allocmem() + return a pointer to the start of the allocated space. It returns NULL + if memory could not be allocated. + + #LWRES_R_SUCCESS is returned when lwres_context_sendrecv() completes + successfully. #LWRES_R_IOERROR is returned if an I/O error occurs and + #LWRES_R_TIMEOUT is returned if lwres_context_sendrecv() times out + waiting for a response. + +\section context_see See Also + + lwres_conf_init(), malloc, free. + */ #include #include @@ -37,7 +105,7 @@ #include "context_p.h" #include "assert_p.h" -/* +/*! * Some systems define the socket length argument as an int, some as size_t, * some as socklen_t. The last is what the current POSIX standard mandates. * This definition is here so it can be portable but easily changed if needed. @@ -46,7 +114,7 @@ #define LWRES_SOCKADDR_LEN_T unsigned int #endif -/* +/*! * Make a socket nonblocking. */ #ifndef MAKE_NONBLOCKING @@ -69,9 +137,16 @@ lwres_malloc(void *, size_t); static void lwres_free(void *, void *, size_t); +/*! + * lwres_result_t + */ static lwres_result_t context_connect(lwres_context_t *); +/*% + * Creates a #lwres_context_t structure for use in + * lightweight resolver operations. + */ lwres_result_t lwres_context_create(lwres_context_t **contextp, void *arg, lwres_malloc_t malloc_function, @@ -118,6 +193,12 @@ lwres_context_create(lwres_context_t **contextp, void *arg, return (LWRES_R_SUCCESS); } +/*% +Destroys a #lwres_context_t, closing its socket. +contextp is a pointer to a pointer to the context that is +to be destroyed. The pointer will be set to NULL +when the context has been destroyed. + */ void lwres_context_destroy(lwres_context_t **contextp) { lwres_context_t *ctx; @@ -128,13 +209,16 @@ lwres_context_destroy(lwres_context_t **contextp) { *contextp = NULL; if (ctx->sock != -1) { +#ifdef WIN32 + DestroySockets(); +#endif (void)close(ctx->sock); ctx->sock = -1; } CTXFREE(ctx, sizeof(lwres_context_t)); } - +/*% Increments the serial number and returns the previous value. */ lwres_uint32_t lwres_context_nextserial(lwres_context_t *ctx) { REQUIRE(ctx != NULL); @@ -142,6 +226,7 @@ lwres_context_nextserial(lwres_context_t *ctx) { return (ctx->serial++); } +/*% Sets the serial number for context *ctx to serial. */ void lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) { REQUIRE(ctx != NULL); @@ -149,6 +234,7 @@ lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) { ctx->serial = serial; } +/*% Frees len bytes of space starting at location mem. */ void lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) { REQUIRE(mem != NULL); @@ -157,6 +243,7 @@ lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len) { CTXFREE(mem, len); } +/*% Allocates len bytes of memory and if successful returns a pointer to the allocated storage. */ void * lwres_context_allocmem(lwres_context_t *ctx, size_t len) { REQUIRE(len != 0U); @@ -231,19 +318,34 @@ context_connect(lwres_context_t *ctx) { } else return (LWRES_R_IOERROR); +#ifdef WIN32 + InitSockets(); +#endif s = socket(domain, SOCK_DGRAM, IPPROTO_UDP); - if (s < 0) + if (s < 0) { +#ifdef WIN32 + DestroySockets(); +#endif return (LWRES_R_IOERROR); + } ret = connect(s, sa, salen); if (ret != 0) { +#ifdef WIN32 + DestroySockets(); +#endif (void)close(s); return (LWRES_R_IOERROR); } MAKE_NONBLOCKING(s, ret); - if (ret < 0) + if (ret < 0) { +#ifdef WIN32 + DestroySockets(); +#endif + (void)close(s); return (LWRES_R_IOERROR); + } ctx->sock = s; @@ -334,6 +436,7 @@ lwres_context_recv(lwres_context_t *ctx, return (LWRES_R_SUCCESS); } +/*% performs I/O for the context ctx. */ lwres_result_t lwres_context_sendrecv(lwres_context_t *ctx, void *sendbase, int sendlen, diff --git a/usr.sbin/bind/lib/lwres/getaddrinfo.c b/usr.sbin/bind/lib/lwres/getaddrinfo.c index b7f78f984c3..691288665e0 100644 --- a/usr.sbin/bind/lib/lwres/getaddrinfo.c +++ b/usr.sbin/bind/lib/lwres/getaddrinfo.c @@ -1,11 +1,11 @@ /* - * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * This code is derived from software contributed to ISC by * Berkeley Software Design, Inc. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -18,13 +18,125 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: getaddrinfo.c,v 1.41.206.6 2006/11/13 11:57:41 marka Exp $ */ +/* $ISC: getaddrinfo.c,v 1.43.18.8 2007/09/13 23:46:26 tbox Exp $ */ + +/*! \file */ + +/** + * lwres_getaddrinfo() is used to get a list of IP addresses and port + * numbers for host hostname and service servname. The function is the + * lightweight resolver's implementation of getaddrinfo() as defined in + * RFC2133. hostname and servname are pointers to null-terminated strings + * or NULL. hostname is either a host name or a numeric host address + * string: a dotted decimal IPv4 address or an IPv6 address. servname is + * either a decimal port number or a service name as listed in + * /etc/services. + * + * If the operating system does not provide a struct addrinfo, the + * following structure is used: + * + * \code + * struct addrinfo { + * int ai_flags; // AI_PASSIVE, AI_CANONNAME + * int ai_family; // PF_xxx + * int ai_socktype; // SOCK_xxx + * int ai_protocol; // 0 or IPPROTO_xxx for IPv4 and IPv6 + * size_t ai_addrlen; // length of ai_addr + * char *ai_canonname; // canonical name for hostname + * struct sockaddr *ai_addr; // binary address + * struct addrinfo *ai_next; // next structure in linked list + * }; + * \endcode + * + * + * hints is an optional pointer to a struct addrinfo. This structure can + * be used to provide hints concerning the type of socket that the caller + * supports or wishes to use. The caller can supply the following + * structure elements in *hints: + * + *
    + *
  • ai_family: + * The protocol family that should be used. When ai_family is set + * to PF_UNSPEC, it means the caller will accept any protocol + * family supported by the operating system.
  • + * + *
  • ai_socktype: + * denotes the type of socket -- SOCK_STREAM, SOCK_DGRAM or + * SOCK_RAW -- that is wanted. When ai_socktype is zero the caller + * will accept any socket type.
  • + * + *
  • ai_protocol: + * indicates which transport protocol is wanted: IPPROTO_UDP or + * IPPROTO_TCP. If ai_protocol is zero the caller will accept any + * protocol.
  • + * + *
  • ai_flags: + * Flag bits. If the AI_CANONNAME bit is set, a successful call to + * lwres_getaddrinfo() will return a null-terminated string + * containing the canonical name of the specified hostname in + * ai_canonname of the first addrinfo structure returned. Setting + * the AI_PASSIVE bit indicates that the returned socket address + * structure is intended for used in a call to bind(2). In this + * case, if the hostname argument is a NULL pointer, then the IP + * address portion of the socket address structure will be set to + * INADDR_ANY for an IPv4 address or IN6ADDR_ANY_INIT for an IPv6 + * address.

    + * + * When ai_flags does not set the AI_PASSIVE bit, the returned + * socket address structure will be ready for use in a call to + * connect(2) for a connection-oriented protocol or connect(2), + * sendto(2), or sendmsg(2) if a connectionless protocol was + * chosen. The IP address portion of the socket address structure + * will be set to the loopback address if hostname is a NULL + * pointer and AI_PASSIVE is not set in ai_flags.

    + * + * If ai_flags is set to AI_NUMERICHOST it indicates that hostname + * should be treated as a numeric string defining an IPv4 or IPv6 + * address and no name resolution should be attempted. + *
+ * + * All other elements of the struct addrinfo passed via hints must be + * zero. + * + * A hints of NULL is treated as if the caller provided a struct addrinfo + * initialized to zero with ai_familyset to PF_UNSPEC. + * + * After a successful call to lwres_getaddrinfo(), *res is a pointer to a + * linked list of one or more addrinfo structures. Each struct addrinfo + * in this list cn be processed by following the ai_next pointer, until a + * NULL pointer is encountered. The three members ai_family, ai_socktype, + * and ai_protocol in each returned addrinfo structure contain the + * corresponding arguments for a call to socket(2). For each addrinfo + * structure in the list, the ai_addr member points to a filled-in socket + * address structure of length ai_addrlen. + * + * All of the information returned by lwres_getaddrinfo() is dynamically + * allocated: the addrinfo structures, and the socket address structures + * and canonical host name strings pointed to by the addrinfostructures. + * Memory allocated for the dynamically allocated structures created by a + * successful call to lwres_getaddrinfo() is released by + * lwres_freeaddrinfo(). ai is a pointer to a struct addrinfo created by + * a call to lwres_getaddrinfo(). + * + * \section lwresreturn RETURN VALUES + * + * lwres_getaddrinfo() returns zero on success or one of the error codes + * listed in gai_strerror() if an error occurs. If both hostname and + * servname are NULL lwres_getaddrinfo() returns #EAI_NONAME. + * + * \section lwressee SEE ALSO + * + * lwres(3), lwres_getaddrinfo(), lwres_freeaddrinfo(), + * lwres_gai_strerror(), RFC2133, getservbyname(3), connect(2), + * sendto(2), sendmsg(2), socket(2). + */ #include -#include #include +#include + #include #include #include @@ -35,6 +147,8 @@ #define SIN6(addr) ((struct sockaddr_in6 *)(addr)) #define SUN(addr) ((struct sockaddr_un *)(addr)) +/*! \struct addrinfo + */ static struct addrinfo *ai_reverse(struct addrinfo *oai), *ai_clone(struct addrinfo *oai, int family), @@ -55,7 +169,7 @@ static void set_order(int, int (**)(const char *, int, struct addrinfo **, #define FOUND_MAX 2 #define ISC_AI_MASK (AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST) - +/*% Get a list of IP addresses and port numbers for host hostname and service servname. */ int lwres_getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) @@ -137,7 +251,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname, } #ifdef AF_LOCAL - /* + /*! * First, deal with AF_LOCAL. If the family was not set, * then assume AF_LOCAL if the first character of the * hostname/servname is '/'. @@ -574,6 +688,7 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip, return (result); } +/*% Free address info. */ void lwres_freeaddrinfo(struct addrinfo *ai) { struct addrinfo *ai_next; @@ -616,7 +731,7 @@ get_local(const char *name, int socktype, struct addrinfo **res) { } #endif -/* +/*! * Allocate an addrinfo structure, and a sockaddr structure * of the specificed length. We initialize: * ai_addrlen diff --git a/usr.sbin/bind/lib/lwres/gethost.c b/usr.sbin/bind/lib/lwres/gethost.c index cfb3160369b..f06ee54ff9b 100644 --- a/usr.sbin/bind/lib/lwres/gethost.c +++ b/usr.sbin/bind/lib/lwres/gethost.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,139 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: gethost.c,v 1.29.206.1 2004/03/06 08:15:30 marka Exp $ */ +/* $ISC: gethost.c,v 1.30.18.2 2005/04/29 00:17:17 marka Exp $ */ + +/*! \file */ + +/** + * These functions provide hostname-to-address and address-to-hostname + * lookups by means of the lightweight resolver. They are similar to the + * standard gethostent(3) functions provided by most operating systems. + * They use a struct hostent which is usually defined in . + * + * \code + * struct hostent { + * char *h_name; // official name of host + * char **h_aliases; // alias list + * int h_addrtype; // host address type + * int h_length; // length of address + * char **h_addr_list; // list of addresses from name server + * }; + * #define h_addr h_addr_list[0] // address, for backward compatibility + * \endcode + * + * The members of this structure are: + * + * \li h_name: + * The official (canonical) name of the host. + * + * \li h_aliases: + * A NULL-terminated array of alternate names (nicknames) for the + * host. + * + * \li h_addrtype: + * The type of address being returned -- PF_INET or PF_INET6. + * + * \li h_length: + * The length of the address in bytes. + * + * \li h_addr_list: + * A NULL terminated array of network addresses for the host. Host + * addresses are returned in network byte order. + * + * For backward compatibility with very old software, h_addr is the first + * address in h_addr_list. + * + * lwres_gethostent(), lwres_sethostent(), lwres_endhostent(), + * lwres_gethostent_r(), lwres_sethostent_r() and lwres_endhostent_r() + * provide iteration over the known host entries on systems that provide + * such functionality through facilities like /etc/hosts or NIS. The + * lightweight resolver does not currently implement these functions; it + * only provides them as stub functions that always return failure. + * + * lwres_gethostbyname() and lwres_gethostbyname2() look up the hostname + * name. lwres_gethostbyname() always looks for an IPv4 address while + * lwres_gethostbyname2() looks for an address of protocol family af: + * either PF_INET or PF_INET6 -- IPv4 or IPV6 addresses respectively. + * Successful calls of the functions return a struct hostent for the name + * that was looked up. NULL is returned if the lookups by + * lwres_gethostbyname() or lwres_gethostbyname2() fail. + * + * Reverse lookups of addresses are performed by lwres_gethostbyaddr(). + * addr is an address of length len bytes and protocol family type -- + * PF_INET or PF_INET6. lwres_gethostbyname_r() is a thread-safe function + * for forward lookups. If an error occurs, an error code is returned in + * *error. resbuf is a pointer to a struct hostent which is initialised + * by a successful call to lwres_gethostbyname_r() . buf is a buffer of + * length len bytes which is used to store the h_name, h_aliases, and + * h_addr_list elements of the struct hostent returned in resbuf. + * Successful calls to lwres_gethostbyname_r() return resbuf, which is a + * pointer to the struct hostent it created. + * + * lwres_gethostbyaddr_r() is a thread-safe function that performs a + * reverse lookup of address addr which is len bytes long and is of + * protocol family type -- PF_INET or PF_INET6. If an error occurs, the + * error code is returned in *error. The other function parameters are + * identical to those in lwres_gethostbyname_r(). resbuf is a pointer to + * a struct hostent which is initialised by a successful call to + * lwres_gethostbyaddr_r(). buf is a buffer of length len bytes which is + * used to store the h_name, h_aliases, and h_addr_list elements of the + * struct hostent returned in resbuf. Successful calls to + * lwres_gethostbyaddr_r() return resbuf, which is a pointer to the + * struct hostent it created. + * + * \section gethost_return Return Values + * + * The functions lwres_gethostbyname(), lwres_gethostbyname2(), + * lwres_gethostbyaddr(), and lwres_gethostent() return NULL to indicate + * an error. In this case the global variable lwres_h_errno will contain + * one of the following error codes defined in \link netdb.h :\endlink + * + * \li #HOST_NOT_FOUND: + * The host or address was not found. + * + * \li #TRY_AGAIN: + * A recoverable error occurred, e.g., a timeout. Retrying the + * lookup may succeed. + * + * \li #NO_RECOVERY: + * A non-recoverable error occurred. + * + * \li #NO_DATA: + * The name exists, but has no address information associated with + * it (or vice versa in the case of a reverse lookup). The code + * NO_ADDRESS is accepted as a synonym for NO_DATA for backwards + * compatibility. + * + * lwres_hstrerror() translates these error codes to suitable error + * messages. + * + * lwres_gethostent() and lwres_gethostent_r() always return NULL. + * + * Successful calls to lwres_gethostbyname_r() and + * lwres_gethostbyaddr_r() return resbuf, a pointer to the struct hostent + * that was initialised by these functions. They return NULL if the + * lookups fail or if buf was too small to hold the list of addresses and + * names referenced by the h_name, h_aliases, and h_addr_list elements of + * the struct hostent. If buf was too small, both lwres_gethostbyname_r() + * and lwres_gethostbyaddr_r() set the global variable errno to ERANGE. + * + * \section gethost_see See Also + * + * gethostent(), \link getipnode.c getipnode\endlink, lwres_hstrerror() + * + * \section gethost_bugs Bugs + * + * lwres_gethostbyname(), lwres_gethostbyname2(), lwres_gethostbyaddr() + * and lwres_endhostent() are not thread safe; they return pointers to + * static data and provide error codes through a global variable. + * Thread-safe versions for name and address lookup are provided by + * lwres_gethostbyname_r(), and lwres_gethostbyaddr_r() respectively. + * + * The resolver daemon does not currently support any non-DNS name + * services such as /etc/hosts or NIS, consequently the above functions + * don't, either. + */ #include @@ -34,6 +166,7 @@ static struct hostent *he = NULL; static int copytobuf(struct hostent *, struct hostent *, char *, int); +/*% Always looks for an IPv4 address. */ struct hostent * lwres_gethostbyname(const char *name) { @@ -44,6 +177,7 @@ lwres_gethostbyname(const char *name) { return (he); } +/*% Looks for either an IPv4 or IPv6 address. */ struct hostent * lwres_gethostbyname2(const char *name, int af) { if (he != NULL) @@ -53,6 +187,7 @@ lwres_gethostbyname2(const char *name, int af) { return (he); } +/*% Reverse lookup of addresses. */ struct hostent * lwres_gethostbyaddr(const char *addr, int len, int type) { @@ -63,6 +198,7 @@ lwres_gethostbyaddr(const char *addr, int len, int type) { return (he); } +/*% Stub function. Always returns failure. */ struct hostent * lwres_gethostent(void) { if (he != NULL) @@ -71,6 +207,7 @@ lwres_gethostent(void) { return (NULL); } +/*% Stub function. Always returns failure. */ void lwres_sethostent(int stayopen) { /* @@ -79,6 +216,7 @@ lwres_sethostent(int stayopen) { UNUSED(stayopen); } +/*% Stub function. Always returns failure. */ void lwres_endhostent(void) { /* @@ -86,6 +224,7 @@ lwres_endhostent(void) { */ } +/*% Thread-safe function for forward lookups. */ struct hostent * lwres_gethostbyname_r(const char *name, struct hostent *resbuf, char *buf, int buflen, int *error) @@ -105,6 +244,7 @@ lwres_gethostbyname_r(const char *name, struct hostent *resbuf, return (resbuf); } +/*% Thread-safe reverse lookup. */ struct hostent * lwres_gethostbyaddr_r(const char *addr, int len, int type, struct hostent *resbuf, char *buf, int buflen, @@ -125,6 +265,7 @@ lwres_gethostbyaddr_r(const char *addr, int len, int type, return (resbuf); } +/*% Stub function. Always returns failure. */ struct hostent * lwres_gethostent_r(struct hostent *resbuf, char *buf, int buflen, int *error) { UNUSED(resbuf); @@ -134,6 +275,7 @@ lwres_gethostent_r(struct hostent *resbuf, char *buf, int buflen, int *error) { return (NULL); } +/*% Stub function. Always returns failure. */ void lwres_sethostent_r(int stayopen) { /* @@ -142,6 +284,7 @@ lwres_sethostent_r(int stayopen) { UNUSED(stayopen); } +/*% Stub function. Always returns failure. */ void lwres_endhostent_r(void) { /* diff --git a/usr.sbin/bind/lib/lwres/getipnode.c b/usr.sbin/bind/lib/lwres/getipnode.c index 5f13502da2d..829a07e1849 100644 --- a/usr.sbin/bind/lib/lwres/getipnode.c +++ b/usr.sbin/bind/lib/lwres/getipnode.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,110 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: getipnode.c,v 1.30.2.4.2.6 2005/04/29 00:03:32 marka Exp $ */ +/* $ISC: getipnode.c,v 1.37.18.7 2007/08/28 07:20:06 tbox Exp $ */ + +/*! \file */ + +/** + * These functions perform thread safe, protocol independent + * nodename-to-address and address-to-nodename translation as defined in + * RFC2553. This use a struct hostent which is defined in namedb.h: + * + * \code + * struct hostent { + * char *h_name; // official name of host + * char **h_aliases; // alias list + * int h_addrtype; // host address type + * int h_length; // length of address + * char **h_addr_list; // list of addresses from name server + * }; + * #define h_addr h_addr_list[0] // address, for backward compatibility + * \endcode + * + * The members of this structure are: + * + * \li h_name: + * The official (canonical) name of the host. + * + * \li h_aliases: + * A NULL-terminated array of alternate names (nicknames) for the + * host. + * + * \li h_addrtype: + * The type of address being returned - usually PF_INET or + * PF_INET6. + * + * \li h_length: + * The length of the address in bytes. + * + * \li h_addr_list: + * A NULL terminated array of network addresses for the host. Host + * addresses are returned in network byte order. + * + * lwres_getipnodebyname() looks up addresses of protocol family af for + * the hostname name. The flags parameter contains ORed flag bits to + * specify the types of addresses that are searched for, and the types of + * addresses that are returned. The flag bits are: + * + * \li #AI_V4MAPPED: + * This is used with an af of #AF_INET6, and causes IPv4 addresses + * to be returned as IPv4-mapped IPv6 addresses. + * + * \li #AI_ALL: + * This is used with an af of #AF_INET6, and causes all known + * addresses (IPv6 and IPv4) to be returned. If #AI_V4MAPPED is + * also set, the IPv4 addresses are return as mapped IPv6 + * addresses. + * + * \li #AI_ADDRCONFIG: + * Only return an IPv6 or IPv4 address if here is an active + * network interface of that type. This is not currently + * implemented in the BIND 9 lightweight resolver, and the flag is + * ignored. + * + * \li #AI_DEFAULT: + * This default sets the #AI_V4MAPPED and #AI_ADDRCONFIG flag bits. + * + * lwres_getipnodebyaddr() performs a reverse lookup of address src which + * is len bytes long. af denotes the protocol family, typically PF_INET + * or PF_INET6. + * + * lwres_freehostent() releases all the memory associated with the struct + * hostent pointer. Any memory allocated for the h_name, h_addr_list + * and h_aliases is freed, as is the memory for the hostent structure + * itself. + * + * \section getipnode_return Return Values + * + * If an error occurs, lwres_getipnodebyname() and + * lwres_getipnodebyaddr() set *error_num to an appropriate error code + * and the function returns a NULL pointer. The error codes and their + * meanings are defined in \link netdb.h \endlink: + * + * \li #HOST_NOT_FOUND: + * No such host is known. + * + * \li #NO_ADDRESS: + * The server recognised the request and the name but no address + * is available. Another type of request to the name server for + * the domain might return an answer. + * + * \li #TRY_AGAIN: + * A temporary and possibly transient error occurred, such as a + * failure of a server to respond. The request may succeed if + * retried. + * + * \li #NO_RECOVERY: + * An unexpected failure occurred, and retrying the request is + * pointless. + * + * lwres_hstrerror() translates these error codes to suitable error + * messages. + * + * \section getipnode_see See Also + * + * getaddrinfo.c, gethost.c, getnameinfo.c, herror.c, RFC2553 + */ #include @@ -80,7 +183,7 @@ hostfromname(lwres_gabnresponse_t *name, int af); *** Public functions. ***/ -/* +/*! * AI_V4MAPPED + AF_INET6 * If no IPv6 address then a query for IPv4 and map returned values. * @@ -222,6 +325,7 @@ lwres_getipnodebyname(const char *name, int af, int flags, int *error_num) { return (he3); } +/*% performs a reverse lookup of address src which is len bytes long. af denotes the protocol family, typically #PF_INET or PF_INET6. */ struct hostent * lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) { struct hostent *he1, *he2; @@ -345,6 +449,7 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) { return (he1); } +/*% releases all the memory associated with the struct hostent pointer */ void lwres_freehostent(struct hostent *he) { char **cpp; @@ -566,13 +671,20 @@ scan_interfaces(int *have_v4, int *have_v6) { int s, n; size_t cpsize; +#ifdef WIN32 + InitSockets(); +#endif #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \ !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF) /* * Try to scan the interfaces using IPv6 ioctls(). */ - if (!scan_interfaces6(have_v4, have_v6)) + if (!scan_interfaces6(have_v4, have_v6)) { +#ifdef WIN32 + DestroySockets(); +#endif return (0); + } #endif /* @@ -697,13 +809,20 @@ scan_interfaces(int *have_v4, int *have_v6) { } if (buf != NULL) free(buf); +#ifdef WIN32 + DestroySockets(); +#endif close(s); return (0); + err_ret: if (buf != NULL) free(buf); if (s != -1) close(s); +#ifdef WIN32 + DestroySockets(); +#endif return (-1); #endif } diff --git a/usr.sbin/bind/lib/lwres/getnameinfo.c b/usr.sbin/bind/lib/lwres/getnameinfo.c index 8b33cd883d7..6cd58629c95 100644 --- a/usr.sbin/bind/lib/lwres/getnameinfo.c +++ b/usr.sbin/bind/lib/lwres/getnameinfo.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: getnameinfo.c,v 1.30.2.3.2.4 2004/08/28 06:25:24 marka Exp $ */ +/* $ISC: getnameinfo.c,v 1.34.18.3 2005/04/29 00:17:18 marka Exp $ */ + +/*! \file */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -53,6 +55,62 @@ * but INRIA implementation returns EAI_xxx defined for getaddrinfo(). */ + +/** + * This function is equivalent to the getnameinfo(3) function defined in + * RFC2133. lwres_getnameinfo() returns the hostname for the struct + * sockaddr sa which is salen bytes long. The hostname is of length + * hostlen and is returned via *host. The maximum length of the hostname + * is 1025 bytes: #NI_MAXHOST. + * + * The name of the service associated with the port number in sa is + * returned in *serv. It is servlen bytes long. The maximum length of the + * service name is #NI_MAXSERV - 32 bytes. + * + * The flags argument sets the following bits: + * + * \li #NI_NOFQDN: + * A fully qualified domain name is not required for local hosts. + * The local part of the fully qualified domain name is returned + * instead. + * + * \li #NI_NUMERICHOST + * Return the address in numeric form, as if calling inet_ntop(), + * instead of a host name. + * + * \li #NI_NAMEREQD + * A name is required. If the hostname cannot be found in the DNS + * and this flag is set, a non-zero error code is returned. If the + * hostname is not found and the flag is not set, the address is + * returned in numeric form. + * + * \li #NI_NUMERICSERV + * The service name is returned as a digit string representing the + * port number. + * + * \li #NI_DGRAM + * Specifies that the service being looked up is a datagram + * service, and causes getservbyport() to be called with a second + * argument of "udp" instead of its default of "tcp". This is + * required for the few ports (512-514) that have different + * services for UDP and TCP. + * + * \section getnameinfo_return Return Values + * + * lwres_getnameinfo() returns 0 on success or a non-zero error code if + * an error occurs. + * + * \section getname_see See Also + * + * RFC2133, getservbyport(), + * lwres_getnamebyaddr(). lwres_net_ntop(). + * + * \section getnameinfo_bugs Bugs + * + * RFC2133 fails to define what the nonzero return values of + * getnameinfo() are. + */ + #include #include @@ -67,12 +125,13 @@ #define SUCCESS 0 +/*% afd structure definition */ static struct afd { int a_af; size_t a_addrlen; size_t a_socklen; } afdl [] = { - /* + /*! * First entry is linked last... */ { AF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in) }, @@ -88,7 +147,7 @@ static struct afd { #define ENI_SALEN 6 #define ENI_NOSOCKET 7 -/* +/*! * The test against 0 is there to keep the Solaris compiler * from complaining about "end-of-loop code not reached". */ @@ -97,6 +156,7 @@ static struct afd { if (result != 0) goto cleanup; \ } while (0) +/*% lightweight resolver socket address structure to hostname and service name */ int lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) diff --git a/usr.sbin/bind/lib/lwres/getrrset.c b/usr.sbin/bind/lib/lwres/getrrset.c index 74f4697f87e..73326f602eb 100644 --- a/usr.sbin/bind/lib/lwres/getrrset.c +++ b/usr.sbin/bind/lib/lwres/getrrset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,77 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: getrrset.c,v 1.11.2.3.2.2 2004/03/06 08:15:31 marka Exp $ */ +/* $ISC: getrrset.c,v 1.14.18.2 2005/04/29 00:17:18 marka Exp $ */ + +/*! \file */ + +/** + * DESCRIPTION + * + * lwres_getrrsetbyname() gets a set of resource records associated with + * a hostname, class, and type. hostname is a pointer a to + * null-terminated string. The flags field is currently unused and must + * be zero. + * + * After a successful call to lwres_getrrsetbyname(), *res is a pointer + * to an #rrsetinfo structure, containing a list of one or more #rdatainfo + * structures containing resource records and potentially another list of + * rdatainfo structures containing SIG resource records associated with + * those records. The members #rri_rdclass and #rri_rdtype are copied from + * the parameters. #rri_ttl and #rri_name are properties of the obtained + * rrset. The resource records contained in #rri_rdatas and #rri_sigs are + * in uncompressed DNS wire format. Properties of the rdataset are + * represented in the #rri_flags bitfield. If the #RRSET_VALIDATED bit is + * set, the data has been DNSSEC validated and the signatures verified. + * + * All of the information returned by lwres_getrrsetbyname() is + * dynamically allocated: the rrsetinfo and rdatainfo structures, and the + * canonical host name strings pointed to by the rrsetinfostructure. + * Memory allocated for the dynamically allocated structures created by a + * successful call to lwres_getrrsetbyname() is released by + * lwres_freerrset(). rrset is a pointer to a struct rrset created by a + * call to lwres_getrrsetbyname(). + * + * The following structures are used: + * + * \code + * struct rdatainfo { + * unsigned int rdi_length; // length of data + * unsigned char *rdi_data; // record data + * }; + * + * struct rrsetinfo { + * unsigned int rri_flags; // RRSET_VALIDATED... + * unsigned int rri_rdclass; // class number + * unsigned int rri_rdtype; // RR type number + * unsigned int rri_ttl; // time to live + * unsigned int rri_nrdatas; // size of rdatas array + * unsigned int rri_nsigs; // size of sigs array + * char *rri_name; // canonical name + * struct rdatainfo *rri_rdatas; // individual records + * struct rdatainfo *rri_sigs; // individual signatures + * }; + * \endcode + * + * \section getrrset_return Return Values + * + * lwres_getrrsetbyname() returns zero on success, and one of the + * following error codes if an error occurred: + * + * \li #ERRSET_NONAME: the name does not exist + * + * \li #ERRSET_NODATA: + * the name exists, but does not have data of the desired type + * + * \li #ERRSET_NOMEMORY: + * memory could not be allocated + * + * \li #ERRSET_INVAL: + * a parameter is invalid + * + * \li #ERRSET_FAIL: + * other failure + */ #include @@ -29,6 +99,9 @@ #include "assert_p.h" +/*! + * Structure to map results + */ static unsigned int lwresult_to_result(lwres_result_t lwresult) { switch (lwresult) { @@ -40,7 +113,8 @@ lwresult_to_result(lwres_result_t lwresult) { } } -/* +/*@{*/ +/*! * malloc / calloc functions that guarantee to only * return NULL if there is an error, like they used * to before the ANSI C committee broke them. @@ -61,7 +135,9 @@ sane_calloc(size_t number, size_t size) { memset(mem, 0, len); return (mem); } +/*@}*/ +/*% Returns a set of resource records associated with a hostname, class, and type. hostname is a pointer a to null-terminated string. */ int lwres_getrrsetbyname(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, @@ -190,6 +266,7 @@ lwres_getrrsetbyname(const char *hostname, unsigned int rdclass, return (result); } +/*% Releases memory allocated for the dynamically allocated structures created by a successful call to lwres_getrrsetbyname(). */ void lwres_freerrset(struct rrsetinfo *rrset) { unsigned int i; diff --git a/usr.sbin/bind/lib/lwres/herror.c b/usr.sbin/bind/lib/lwres/herror.c index f138408d49e..e837b01a3ba 100644 --- a/usr.sbin/bind/lib/lwres/herror.c +++ b/usr.sbin/bind/lib/lwres/herror.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 2000, 2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -48,10 +48,31 @@ * SUCH DAMAGE. */ +/*! \file herror.c + lwres_herror() prints the string s on stderr followed by the string + generated by lwres_hstrerror() for the error code stored in the global + variable lwres_h_errno. + + lwres_hstrerror() returns an appropriate string for the error code + gievn by err. The values of the error codes and messages are as + follows: + +\li #NETDB_SUCCESS: Resolver Error 0 (no error) + +\li #HOST_NOT_FOUND: Unknown host + +\li #TRY_AGAIN: Host name lookup failure + +\li #NO_RECOVERY: Unknown server error + +\li #NO_DATA: No address associated with name + + */ + #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; static const char rcsid[] = - "$ISC: herror.c,v 1.10.12.2 2004/03/06 08:15:31 marka Exp $"; + "$ISC: herror.c,v 1.13.18.2 2005/04/29 00:17:18 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -63,22 +84,22 @@ static const char rcsid[] = LIBLWRES_EXTERNAL_DATA int lwres_h_errno; -/* +/*! * these have never been declared in any header file so make them static */ static const char *h_errlist[] = { - "Resolver Error 0 (no error)", - "Unknown host", /* 1 HOST_NOT_FOUND */ - "Host name lookup failure", /* 2 TRY_AGAIN */ - "Unknown server error", /* 3 NO_RECOVERY */ - "No address associated with name", /* 4 NO_ADDRESS */ + "Resolver Error 0 (no error)", /*%< 0 no error */ + "Unknown host", /*%< 1 HOST_NOT_FOUND */ + "Host name lookup failure", /*%< 2 TRY_AGAIN */ + "Unknown server error", /*%< 3 NO_RECOVERY */ + "No address associated with name", /*%< 4 NO_ADDRESS */ }; static int h_nerr = { sizeof(h_errlist) / sizeof(h_errlist[0]) }; -/* +/*! * herror -- * print the error indicated by the h_errno value. */ @@ -87,7 +108,7 @@ lwres_herror(const char *s) { fprintf(stderr, "%s: %s\n", s, lwres_hstrerror(lwres_h_errno)); } -/* +/*! * hstrerror -- * return the string associated with a given "host" errno value. */ diff --git a/usr.sbin/bind/lib/lwres/lwconfig.c b/usr.sbin/bind/lib/lwres/lwconfig.c index 7c10e18fef5..e231d4b6506 100644 --- a/usr.sbin/bind/lib/lwres/lwconfig.c +++ b/usr.sbin/bind/lib/lwres/lwconfig.c @@ -15,26 +15,43 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: lwconfig.c,v 1.33.2.1.2.10 2006/10/03 23:50:50 marka Exp $ */ - -/*** - *** Module for parsing resolv.conf files. - *** - *** entry points are: - *** lwres_conf_init(lwres_context_t *ctx) - *** initializes data structure for subsequent config parsing. - *** - *** lwres_conf_parse(lwres_context_t *ctx, const char *filename) - *** parses a file and fills in the data structure. - *** - *** lwres_conf_print(lwres_context_t *ctx, FILE *fp) - *** prints the config data structure to the FILE. - *** - *** lwres_conf_clear(lwres_context_t *ctx) - *** frees up all the internal memory used by the config data - *** structure, returning it to the lwres_context_t. - *** - ***/ +/* $ISC: lwconfig.c,v 1.38.18.5 2006/10/03 23:50:51 marka Exp $ */ + +/*! \file */ + +/** + * Module for parsing resolv.conf files. + * + * lwres_conf_init() creates an empty lwres_conf_t structure for + * lightweight resolver context ctx. + * + * lwres_conf_clear() frees up all the internal memory used by that + * lwres_conf_t structure in resolver context ctx. + * + * lwres_conf_parse() opens the file filename and parses it to initialise + * the resolver context ctx's lwres_conf_t structure. + * + * lwres_conf_print() prints the lwres_conf_t structure for resolver + * context ctx to the FILE fp. + * + * \section lwconfig_return Return Values + * + * lwres_conf_parse() returns #LWRES_R_SUCCESS if it successfully read and + * parsed filename. It returns #LWRES_R_FAILURE if filename could not be + * opened or contained incorrect resolver statements. + * + * lwres_conf_print() returns #LWRES_R_SUCCESS unless an error occurred + * when converting the network addresses to a numeric host address + * string. If this happens, the function returns #LWRES_R_FAILURE. + * + * \section lwconfig_see See Also + * + * stdio(3), \link resolver resolver \endlink + * + * \section files Files + * + * /etc/resolv.conf + */ #include @@ -109,7 +126,7 @@ lwresaddr2af(int lwresaddrtype) } -/* +/*! * Eat characters from FP until EOL or EOF. Returns EOF or '\n' */ static int @@ -124,7 +141,7 @@ eatline(FILE *fp) { } -/* +/*! * Eats white space up to next newline or non-whitespace character (of * EOF). Returns the last character read. Comments are considered white * space. @@ -144,7 +161,7 @@ eatwhite(FILE *fp) { } -/* +/*! * Skip over any leading whitespace and then read in the next sequence of * non-whitespace characters. In this context newline is not considered * whitespace. Returns EOF on end-of-file, or the character @@ -205,6 +222,7 @@ lwres_strdup(lwres_context_t *ctx, const char *str) { return (p); } +/*% intializes data structure for subsequent config parsing. */ void lwres_conf_init(lwres_context_t *ctx) { int i; @@ -234,6 +252,7 @@ lwres_conf_init(lwres_context_t *ctx) { } } +/*% Frees up all the internal memory used by the config data structure, returning it to the lwres_context_t. */ void lwres_conf_clear(lwres_context_t *ctx) { int i; @@ -544,6 +563,7 @@ lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) { return (LWRES_R_SUCCESS); } +/*% parses a file and fills in the data structure. */ lwres_result_t lwres_conf_parse(lwres_context_t *ctx, const char *filename) { FILE *fp = NULL; @@ -602,6 +622,7 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { return (ret); } +/*% Prints the config data structure to the FILE. */ lwres_result_t lwres_conf_print(lwres_context_t *ctx, FILE *fp) { int i; @@ -697,6 +718,7 @@ lwres_conf_print(lwres_context_t *ctx, FILE *fp) { return (LWRES_R_SUCCESS); } +/*% Returns a pointer to the current config structure. */ lwres_conf_t * lwres_conf_get(lwres_context_t *ctx) { REQUIRE(ctx != NULL); diff --git a/usr.sbin/bind/lib/lwres/lwinetaton.c b/usr.sbin/bind/lib/lwres/lwinetaton.c index 923034986da..3a95a10bd4a 100644 --- a/usr.sbin/bind/lib/lwres/lwinetaton.c +++ b/usr.sbin/bind/lib/lwres/lwinetaton.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1996-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -68,9 +68,11 @@ * SOFTWARE. */ +/*! \file lwinetaton.c + */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$ISC: lwinetaton.c,v 1.10.2.1.2.1 2004/03/06 08:15:32 marka Exp $"; +static char rcsid[] = "$ISC: lwinetaton.c,v 1.12.18.2 2005/04/29 00:17:19 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -84,7 +86,7 @@ static char rcsid[] = "$ISC: lwinetaton.c,v 1.10.2.1.2.1 2004/03/06 08:15:32 mar #include "assert_p.h" -/* +/*! * Check whether "cp" is a valid ascii representation * of an Internet address and convert to a binary address. * Returns 1 if the address is valid, 0 if not. diff --git a/usr.sbin/bind/lib/lwres/lwinetntop.c b/usr.sbin/bind/lib/lwres/lwinetntop.c index 97aa462a19c..08f7d1945cd 100644 --- a/usr.sbin/bind/lib/lwres/lwinetntop.c +++ b/usr.sbin/bind/lib/lwres/lwinetntop.c @@ -15,9 +15,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ +/*! \file lwinetntop.c + */ #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = - "$ISC: lwinetntop.c,v 1.9.12.5 2005/11/04 00:16:34 marka Exp $"; + "$ISC: lwinetntop.c,v 1.12.18.4 2005/11/03 23:02:24 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,7 +47,7 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size); #endif -/* char * +/*! char * * lwres_net_ntop(af, src, dst, size) * convert a network format address to presentation format. * return: @@ -69,7 +71,7 @@ lwres_net_ntop(int af, const void *src, char *dst, size_t size) { /* NOTREACHED */ } -/* const char * +/*! const char * * inet_ntop4(src, dst, size) * format an IPv4 address * return: @@ -98,7 +100,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size) { return (dst); } -/* const char * +/*! const char * * inet_ntop6(src, dst, size) * convert IPv6 binary address into presentation (printable) format * author: @@ -107,7 +109,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size) { #ifdef AF_INET6 static const char * inet_ntop6(const unsigned char *src, char *dst, size_t size) { - /* + /*! * Note that int32_t and int16_t need only be "at least" large enough * to contain a value of the specified size. On some systems, like * Crays, there is no such thing as an integer variable with 16 bits. diff --git a/usr.sbin/bind/lib/lwres/lwresutil.c b/usr.sbin/bind/lib/lwres/lwresutil.c index deebc6e3617..b127f620078 100644 --- a/usr.sbin/bind/lib/lwres/lwresutil.c +++ b/usr.sbin/bind/lib/lwres/lwresutil.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,86 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: lwresutil.c,v 1.29.206.1 2004/03/06 08:15:33 marka Exp $ */ +/* $ISC: lwresutil.c,v 1.30.18.2 2005/04/29 00:17:20 marka Exp $ */ + +/*! \file */ + +/** + * lwres_string_parse() retrieves a DNS-encoded string starting the + * current pointer of lightweight resolver buffer b: i.e. b->current. + * When the function returns, the address of the first byte of the + * encoded string is returned via *c and the length of that string is + * given by *len. The buffer's current pointer is advanced to point at + * the character following the string length, the encoded string, and + * the trailing NULL character. + * + * lwres_addr_parse() extracts an address from the buffer b. The + * buffer's current pointer b->current is presumed to point at an + * encoded address: the address preceded by a 32-bit protocol family + * identifier and a 16-bit length field. The encoded address is copied + * to addr->address and addr->length indicates the size in bytes of + * the address that was copied. b->current is advanced to point at the + * next byte of available data in the buffer following the encoded + * address. + * + * lwres_getaddrsbyname() and lwres_getnamebyaddr() use the + * lwres_gnbaresponse_t structure defined below: + * + * \code + * typedef struct { + * lwres_uint32_t flags; + * lwres_uint16_t naliases; + * lwres_uint16_t naddrs; + * char *realname; + * char **aliases; + * lwres_uint16_t realnamelen; + * lwres_uint16_t *aliaslen; + * lwres_addrlist_t addrs; + * void *base; + * size_t baselen; + * } lwres_gabnresponse_t; + * \endcode + * + * The contents of this structure are not manipulated directly but + * they are controlled through the \link lwres_gabn.c lwres_gabn*\endlink functions. + * + * The lightweight resolver uses lwres_getaddrsbyname() to perform + * foward lookups. Hostname name is looked up using the resolver + * context ctx for memory allocation. addrtypes is a bitmask + * indicating which type of addresses are to be looked up. Current + * values for this bitmask are #LWRES_ADDRTYPE_V4 for IPv4 addresses + * and #LWRES_ADDRTYPE_V6 for IPv6 addresses. Results of the lookup are + * returned in *structp. + * + * lwres_getnamebyaddr() performs reverse lookups. Resolver context + * ctx is used for memory allocation. The address type is indicated by + * addrtype: #LWRES_ADDRTYPE_V4 or #LWRES_ADDRTYPE_V6. The address to be + * looked up is given by addr and its length is addrlen bytes. The + * result of the function call is made available through *structp. + * + * \section lwresutil_return Return Values + * + * Successful calls to lwres_string_parse() and lwres_addr_parse() + * return #LWRES_R_SUCCESS. Both functions return #LWRES_R_FAILURE if + * the buffer is corrupt or #LWRES_R_UNEXPECTEDEND if the buffer has + * less space than expected for the components of the encoded string + * or address. + * + * lwres_getaddrsbyname() returns #LWRES_R_SUCCESS on success and it + * returns #LWRES_R_NOTFOUND if the hostname name could not be found. + * + * #LWRES_R_SUCCESS is returned by a successful call to + * lwres_getnamebyaddr(). + * + * Both lwres_getaddrsbyname() and lwres_getnamebyaddr() return + * #LWRES_R_NOMEMORY when memory allocation requests fail and + * #LWRES_R_UNEXPECTEDEND if the buffers used for sending queries and + * receiving replies are too small. + * + * \section lwresutil_see See Also + * + * lwbuffer.c, lwres_gabn.c + */ #include @@ -31,7 +110,8 @@ #include "assert_p.h" #include "context_p.h" -/* +/*% Parse data. */ +/*! * Requires: * * The "current" pointer in "b" points to encoded raw data. @@ -78,7 +158,8 @@ lwres_data_parse(lwres_buffer_t *b, unsigned char **p, lwres_uint16_t *len) return (LWRES_R_SUCCESS); } -/* +/*% Retrieves a DNS-encoded string. */ +/*! * Requires: * * The "current" pointer in "b" point to an encoded string. @@ -133,6 +214,7 @@ lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len) return (LWRES_R_SUCCESS); } +/*% Extracts an address from the buffer b. */ lwres_result_t lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr) { @@ -154,6 +236,7 @@ lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr) return (LWRES_R_SUCCESS); } +/*% Used to perform forward lookups. */ lwres_result_t lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp) @@ -268,6 +351,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, } +/*% Used to perform reverse lookups. */ lwres_result_t lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, @@ -376,6 +460,7 @@ lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, return (ret); } +/*% Get rdata by name. */ lwres_result_t lwres_getrdatabyname(lwres_context_t *ctx, const char *name, lwres_uint16_t rdclass, lwres_uint16_t rdtype, diff --git a/usr.sbin/bind/lib/lwres/man/lwres.html b/usr.sbin/bind/lib/lwres/man/lwres.html index 030d57a01c9..280ae625dbd 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres.html +++ b/usr.sbin/bind/lib/lwres/man/lwres.html @@ -1,5 +1,5 @@ - + lwres - +
-
+

Name

lwres — introduction to the lightweight resolver library

@@ -32,185 +32,187 @@
#include <lwres/lwres.h>
-

DESCRIPTION

-

-The BIND 9 lightweight resolver library is a simple, name service -independent stub resolver library. It provides hostname-to-address -and address-to-hostname lookup services to applications by -transmitting lookup requests to a resolver daemon -lwresd -running on the local host. The resover daemon performs the -lookup using the DNS or possibly other name service protocols, -and returns the results to the application through the library. -The library and resolver daemon communicate using a simple -UDP-based protocol. -

+

DESCRIPTION

+

+ The BIND 9 lightweight resolver library is a simple, name service + independent stub resolver library. It provides hostname-to-address + and address-to-hostname lookup services to applications by + transmitting lookup requests to a resolver daemon + lwresd + running on the local host. The resover daemon performs the + lookup using the DNS or possibly other name service protocols, + and returns the results to the application through the library. + The library and resolver daemon communicate using a simple + UDP-based protocol. +

-

OVERVIEW

-

-The lwresd library implements multiple name service APIs. -The standard -gethostbyname(), -gethostbyaddr(), -gethostbyname_r(), -gethostbyaddr_r(), -getaddrinfo(), -getipnodebyname(), -and -getipnodebyaddr() -functions are all supported. To allow the lwres library to coexist -with system libraries that define functions of the same name, -the library defines these functions with names prefixed by -lwres_. -To define the standard names, applications must include the -header file -<lwres/netdb.h> -which contains macro definitions mapping the standard function names -into -lwres_ -prefixed ones. Operating system vendors who integrate the lwres -library into their base distributions should rename the functions -in the library proper so that the renaming macros are not needed. -

-

-The library also provides a native API consisting of the functions -lwres_getaddrsbyname() -and -lwres_getnamebyaddr(). -These may be called by applications that require more detailed -control over the lookup process than the standard functions -provide. -

-

-In addition to these name service independent address lookup -functions, the library implements a new, experimental API -for looking up arbitrary DNS resource records, using the -lwres_getaddrsbyname() -function. -

-

-Finally, there is a low-level API for converting lookup -requests and responses to and from raw lwres protocol packets. -This API can be used by clients requiring nonblocking operation, -and is also used when implementing the server side of the lwres -protocol, for example in the -lwresd -resolver daemon. The use of this low-level API in clients -and servers is outlined in the following sections. -

+

OVERVIEW

+

+ The lwresd library implements multiple name service APIs. + The standard + gethostbyname(), + gethostbyaddr(), + gethostbyname_r(), + gethostbyaddr_r(), + getaddrinfo(), + getipnodebyname(), + and + getipnodebyaddr() + functions are all supported. To allow the lwres library to coexist + with system libraries that define functions of the same name, + the library defines these functions with names prefixed by + lwres_. + To define the standard names, applications must include the + header file + <lwres/netdb.h> + which contains macro definitions mapping the standard function names + into + lwres_ + prefixed ones. Operating system vendors who integrate the lwres + library into their base distributions should rename the functions + in the library proper so that the renaming macros are not needed. +

+

+ The library also provides a native API consisting of the functions + lwres_getaddrsbyname() + and + lwres_getnamebyaddr(). + These may be called by applications that require more detailed + control over the lookup process than the standard functions + provide. +

+

+ In addition to these name service independent address lookup + functions, the library implements a new, experimental API + for looking up arbitrary DNS resource records, using the + lwres_getaddrsbyname() + function. +

+

+ Finally, there is a low-level API for converting lookup + requests and responses to and from raw lwres protocol packets. + This API can be used by clients requiring nonblocking operation, + and is also used when implementing the server side of the lwres + protocol, for example in the + lwresd + resolver daemon. The use of this low-level API in clients + and servers is outlined in the following sections. +

-

CLIENT-SIDE LOW-LEVEL API CALL FLOW

-

-When a client program wishes to make an lwres request using the -native low-level API, it typically performs the following -sequence of actions. -

-

-(1) Allocate or use an existing lwres_packet_t, -called pkt below. -

-

-(2) Set pkt.recvlength to the maximum length we will accept. -This is done so the receiver of our packets knows how large our receive -buffer is. The "default" is a constant in -lwres.h: LWRES_RECVLENGTH = 4096. -

-

-(3) Set pkt.serial -to a unique serial number. This value is echoed -back to the application by the remote server. -

-

-(4) Set pkt.pktflags. Usually this is set to 0. -

-

-(5) Set pkt.result to 0. -

-

-(6) Call lwres_*request_render(), -or marshall in the data using the primitives -such as lwres_packet_render() -and storing the packet data. -

-

-(7) Transmit the resulting buffer. -

-

-(8) Call lwres_*response_parse() -to parse any packets received. -

-

-(9) Verify that the opcode and serial match a request, and process the -packet specific information contained in the body. -

+

CLIENT-SIDE LOW-LEVEL API CALL FLOW

+

+ When a client program wishes to make an lwres request using the + native low-level API, it typically performs the following + sequence of actions. +

+

+ (1) Allocate or use an existing lwres_packet_t, + called pkt below. +

+

+ (2) Set pkt.recvlength to the maximum length + we will accept. + This is done so the receiver of our packets knows how large our receive + buffer is. The "default" is a constant in + lwres.h: LWRES_RECVLENGTH = 4096. +

+

+ (3) Set pkt.serial + to a unique serial number. This value is echoed + back to the application by the remote server. +

+

+ (4) Set pkt.pktflags. Usually this is set to + 0. +

+

+ (5) Set pkt.result to 0. +

+

+ (6) Call lwres_*request_render(), + or marshall in the data using the primitives + such as lwres_packet_render() + and storing the packet data. +

+

+ (7) Transmit the resulting buffer. +

+

+ (8) Call lwres_*response_parse() + to parse any packets received. +

+

+ (9) Verify that the opcode and serial match a request, and process the + packet specific information contained in the body. +

-

SERVER-SIDE LOW-LEVEL API CALL FLOW

-

-When implementing the server side of the lightweight resolver -protocol using the lwres library, a sequence of actions like the -following is typically involved in processing each request packet. -

-

-Note that the same lwres_packet_t is used -in both the _parse() and _render() calls, -with only a few modifications made -to the packet header's contents between uses. This method is recommended -as it keeps the serial, opcode, and other fields correct. -

-

-(1) When a packet is received, call lwres_*request_parse() to -unmarshall it. This returns a lwres_packet_t (also called pkt, below) -as well as a data specific type, such as lwres_gabnrequest_t. -

-

-(2) Process the request in the data specific type. -

-

-(3) Set the pkt.result, -pkt.recvlength as above. All other fields can -be left untouched since they were filled in by the *_parse() call -above. If using lwres_*response_render(), -pkt.pktflags will be set up -properly. Otherwise, the LWRES_LWPACKETFLAG_RESPONSE bit should be -set. -

-

-(4) Call the data specific rendering function, such as -lwres_gabnresponse_render(). -

-

-(5) Send the resulting packet to the client. -

-

-

+

SERVER-SIDE LOW-LEVEL API CALL FLOW

+

+ When implementing the server side of the lightweight resolver + protocol using the lwres library, a sequence of actions like the + following is typically involved in processing each request packet. +

+

+ Note that the same lwres_packet_t is used + in both the _parse() and _render() calls, + with only a few modifications made + to the packet header's contents between uses. This method is + recommended + as it keeps the serial, opcode, and other fields correct. +

+

+ (1) When a packet is received, call lwres_*request_parse() to + unmarshall it. This returns a lwres_packet_t (also called pkt, below) + as well as a data specific type, such as lwres_gabnrequest_t. +

+

+ (2) Process the request in the data specific type. +

+

+ (3) Set the pkt.result, + pkt.recvlength as above. All other fields + can + be left untouched since they were filled in by the *_parse() call + above. If using lwres_*response_render(), + pkt.pktflags will be set up + properly. Otherwise, the LWRES_LWPACKETFLAG_RESPONSE bit should be + set. +

+

+ (4) Call the data specific rendering function, such as + lwres_gabnresponse_render(). +

+

+ (5) Send the resulting packet to the client. +

+

-

SEE ALSO

-

-lwres_gethostent(3), +

SEE ALSO

+

lwres_gethostent(3), -lwres_getipnode(3), + lwres_getipnode(3), -lwres_getnameinfo(3), + lwres_getnameinfo(3), -lwres_noop(3), + lwres_noop(3), -lwres_gabn(3), + lwres_gabn(3), -lwres_gnba(3), + lwres_gnba(3), -lwres_context(3), + lwres_context(3), -lwres_config(3), + lwres_config(3), -resolver(5), + resolver(5), -lwresd(8). + lwresd(8). -

+

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_buffer.html b/usr.sbin/bind/lib/lwres/man/lwres_buffer.html index c899b643b25..203c4a103b4 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_buffer.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_buffer.html @@ -1,5 +1,5 @@ - + lwres_buffer - +
-
+

Name

lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem — lightweight resolver buffer management

@@ -38,60 +38,45 @@ void lwres_buffer_init( -  -, - - -  -  -, +lwres_buffer_t *  + +b,   -  -, +void *  + +base,   -  +unsigned int   -); +length); - - +
- + - - - - - - -
void lwres_buffer_invalidate( lwres_buffer_t *  -);
   -);
+b); + - - - - - - - + + - + +n);
void lwres_buffer_add( ,
  , lwres_buffer_t *  +b,
  unsigned int   -);
@@ -99,71 +84,47 @@ void - - - - - - - + + - + +n);
void lwres_buffer_subtract( ,
  , lwres_buffer_t *  +b,
  unsigned int   -);
- - +
- - - - - - + - -
void lwres_buffer_clear(  -);
  lwres_buffer_t *  -);
- - +b); +
+ - + - - - - - - -
void lwres_buffer_first( lwres_buffer_t *  -);
   -);
+b); + - - - - - - - + + - + +n);
void lwres_buffer_forward( ,
  , lwres_buffer_t *  +b,
  unsigned int   -);
@@ -171,127 +132,87 @@ void - - - - - - - + + - + +n);
void lwres_buffer_back( ,
  , lwres_buffer_t *  +b,
  unsigned int   -);
- - +
- + - - - - - - -
lwres_uint8_t lwres_buffer_getuint8( lwres_buffer_t *  -);
   -);
+b); + - - - - - - - + + - + +val);
void lwres_buffer_putuint8( ,
  , lwres_buffer_t *  +b,
  lwres_uint8_t   -);
- - +
- + - - - - - - -
lwres_uint16_t lwres_buffer_getuint16( lwres_buffer_t *  -);
   -);
+b); + - - - - - - - + + - + +val);
void lwres_buffer_putuint16( ,
  , lwres_buffer_t *  +b,
  lwres_uint16_t   -);
- - +
- + - - - - - - -
lwres_uint32_t lwres_buffer_getuint32( lwres_buffer_t *  -);
   -);
+b); + - - - - - - - + + - + +val);
void lwres_buffer_putuint32( ,
  , lwres_buffer_t *  +b,
  lwres_uint32_t   -);
@@ -299,24 +220,21 @@ void - - - - - - - + + - - + + - + +length);
void lwres_buffer_putmem( ,
  , lwres_buffer_t *  +b,
  , const unsigned char *  +base,
  unsigned int   -);
@@ -324,89 +242,91 @@ void - - - - - - - + + - - + + - + +length);
void lwres_buffer_getmem( ,
  , lwres_buffer_t *  +b,
  , unsigned char *  +base,
  unsigned int   -);
-

DESCRIPTION

+

DESCRIPTION

-These functions provide bounds checked access to a region of memory -where data is being read or written. -They are based on, and similar to, the -isc_buffer_ -functions in the ISC library. -

+ These functions provide bounds checked access to a region of memory + where data is being read or written. + They are based on, and similar to, the + isc_buffer_ + functions in the ISC library. +

-A buffer is a region of memory, together with a set of related -subregions. -The used region and the -available region are disjoint, and -their union is the buffer's region. -The used region extends from the beginning of the buffer region to the -last used byte. -The available region extends from one byte greater than the last used -byte to the end of the buffer's region. -The size of the used region can be changed using various -buffer commands. -Initially, the used region is empty. -

+ A buffer is a region of memory, together with a set of related + subregions. + The used region and the + available region are disjoint, and + their union is the buffer's region. + The used region extends from the beginning of the buffer region to the + last used byte. + The available region extends from one byte greater than the last used + byte to the end of the buffer's region. + The size of the used region can be changed using various + buffer commands. + Initially, the used region is empty. +

-The used region is further subdivided into two disjoint regions: the -consumed region and the remaining region. -The union of these two regions is the used region. -The consumed region extends from the beginning of the used region to -the byte before the current offset (if any). -The remaining region the current pointer to the end of the used -region. -The size of the consumed region can be changed using various -buffer commands. -Initially, the consumed region is empty. -

+ The used region is further subdivided into two disjoint regions: the + consumed region and the remaining region. + The union of these two regions is the used region. + The consumed region extends from the beginning of the used region to + the byte before the current offset (if any). + The remaining region the current pointer to the end + of the used + region. + The size of the consumed region can be changed using various + buffer commands. + Initially, the consumed region is empty. +

-The active region is an (optional) subregion of the remaining -region. -It extends from the current offset to an offset in the -remaining region. -Initially, the active region is empty. -If the current offset advances beyond the chosen offset, -the active region will also be empty. -

-

-

+ The active region is an (optional) subregion of the + remaining + region. + It extends from the current offset to an offset in the + remaining region. + Initially, the active region is empty. + If the current offset advances beyond the chosen offset, + the active region will also be empty. +

- 
    /------------entire length---------------\\
    /----- used region -----\\/-- available --\\
    +----------------------------------------+
    | consumed  | remaining |                |
    +----------------------------------------+
    a           b     c     d                e
- 
+      
+

+

+
   a == base of buffer.
   b == current pointer.  Can be anywhere between a and d.
   c == active pointer.  Meaningful between b and d.
   d == used pointer.
   e == length of buffer.
- 
+      
+

+

+
   a-e == entire length of buffer.
   a-d == used region.
   a-b == consumed region.
@@ -414,129 +334,122 @@ the active region will also be empty.
   b-c == optional active region.
 

-

-

-lwres_buffer_init() -initializes the -lwres_buffer_t -*b -and assocates it with the memory region of size -length -bytes starting at location -base. -

-

-lwres_buffer_invalidate() -marks the buffer -*b -as invalid. Invalidating a buffer after use is not required, -but makes it possible to catch its possible accidental use. -

-

-The functions -lwres_buffer_add() -and -lwres_buffer_subtract() -respectively increase and decrease the used space in -buffer -*b -by -n -bytes. -lwres_buffer_add() -checks for buffer overflow and -lwres_buffer_subtract() -checks for underflow. -These functions do not allocate or deallocate memory. -They just change the value of -used. -

-

-A buffer is re-initialised by -lwres_buffer_clear(). -The function sets -used , -current -and -active -to zero. -

-

-lwres_buffer_first -makes the consumed region of buffer -*p -empty by setting -current -to zero (the start of the buffer). -

-

-lwres_buffer_forward() -increases the consumed region of buffer -*b -by -n -bytes, checking for overflow. -Similarly, -lwres_buffer_back() -decreases buffer -b's -consumed region by -n -bytes and checks for underflow. -

+

+

lwres_buffer_init() + initializes the + lwres_buffer_t + *b + and assocates it with the memory region of size + length + bytes starting at location + base. +

+

lwres_buffer_invalidate() + marks the buffer *b + as invalid. Invalidating a buffer after use is not required, + but makes it possible to catch its possible accidental use. +

-lwres_buffer_getuint8() -reads an unsigned 8-bit integer from -*b -and returns it. -lwres_buffer_putuint8() -writes the unsigned 8-bit integer -val -to buffer -*b. -

+ The functions + lwres_buffer_add() + and + lwres_buffer_subtract() + respectively increase and decrease the used space in + buffer + *b + by + n + bytes. + lwres_buffer_add() + checks for buffer overflow and + lwres_buffer_subtract() + checks for underflow. + These functions do not allocate or deallocate memory. + They just change the value of + used. +

-lwres_buffer_getuint16() -and -lwres_buffer_getuint32() -are identical to -lwres_buffer_putuint8() -except that they respectively read an unsigned 16-bit or 32-bit integer -in network byte order from -b. -Similarly, -lwres_buffer_putuint16() -and -lwres_buffer_putuint32() -writes the unsigned 16-bit or 32-bit integer -val -to buffer -b, -in network byte order. -

+ A buffer is re-initialised by + lwres_buffer_clear(). + The function sets + used, + current + and + active + to zero. +

+

lwres_buffer_first + makes the consumed region of buffer + *p + empty by setting + current + to zero (the start of the buffer). +

+

lwres_buffer_forward() + increases the consumed region of buffer + *b + by + n + bytes, checking for overflow. + Similarly, + lwres_buffer_back() + decreases buffer + b's + consumed region by + n + bytes and checks for underflow. +

+

lwres_buffer_getuint8() + reads an unsigned 8-bit integer from + *b + and returns it. + lwres_buffer_putuint8() + writes the unsigned 8-bit integer + val + to buffer + *b. +

+

lwres_buffer_getuint16() + and + lwres_buffer_getuint32() + are identical to + lwres_buffer_putuint8() + except that they respectively read an unsigned 16-bit or 32-bit integer + in network byte order from + b. + Similarly, + lwres_buffer_putuint16() + and + lwres_buffer_putuint32() + writes the unsigned 16-bit or 32-bit integer + val + to buffer + b, + in network byte order. +

-Arbitrary amounts of data are read or written from a lightweight -resolver buffer with -lwres_buffer_getmem() -and -lwres_buffer_putmem() -respectively. -lwres_buffer_putmem() -copies -length -bytes of memory at -base -to -b. -Conversely, -lwres_buffer_getmem() -copies -length -bytes of memory from -b -to -base. -

+ Arbitrary amounts of data are read or written from a lightweight + resolver buffer with + lwres_buffer_getmem() + and + lwres_buffer_putmem() + respectively. + lwres_buffer_putmem() + copies + length + bytes of memory at + base + to + b. + Conversely, + lwres_buffer_getmem() + copies + length + bytes of memory from + b + to + base. +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_config.html b/usr.sbin/bind/lib/lwres/man/lwres_config.html index f2c66c0b387..5c52a8f8a2a 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_config.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_config.html @@ -1,5 +1,5 @@ - + lwres_config - +
-
+

Name

lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_conf_get — lightweight resolver configuration

@@ -31,56 +31,36 @@

Synopsis

#include <lwres/lwres.h>
- - +
- + - - - - - - -
void lwres_conf_init( lwres_context_t *  -);
   -);
- - +ctx); +
+ - + - - - - - - -
void lwres_conf_clear( lwres_context_t *  -);
   -);
+ctx); + - - - - - - - + + - + +filename);
lwres_result_t lwres_conf_parse( ,
  , lwres_context_t *  +ctx,
  const char *  -);
@@ -88,113 +68,89 @@ lwres_result_t - - - - - - - + + - + +fp);
lwres_result_t lwres_conf_print( ,
  , lwres_context_t *  +ctx,
  FILE *  -);
- - +
- - - - - - + - -
lwres_conf_t * lwres_conf_get(  -);
  lwres_context_t *  -);
+ctx); +
-

DESCRIPTION

-

-lwres_conf_init() -creates an empty -lwres_conf_t -structure for lightweight resolver context -ctx. -

-

-lwres_conf_clear() -frees up all the internal memory used by -that -lwres_conf_t -structure in resolver context -ctx. -

-

-lwres_conf_parse() -opens the file -filename -and parses it to initialise the resolver context -ctx's -lwres_conf_t -structure. -

-

-lwres_conf_print() -prints the -lwres_conf_t -structure for resolver context -ctx -to the -FILE -fp. -

+

DESCRIPTION

+

lwres_conf_init() + creates an empty + lwres_conf_t + structure for lightweight resolver context + ctx. +

+

lwres_conf_clear() + frees up all the internal memory used by + that + lwres_conf_t + structure in resolver context + ctx. +

+

lwres_conf_parse() + opens the file + filename + and parses it to initialise the resolver context + ctx's + lwres_conf_t + structure. +

+

lwres_conf_print() + prints the + lwres_conf_t + structure for resolver context + ctx + to the + FILE + fp. +

-

RETURN VALUES

-

-lwres_conf_parse() -returns -LWRES_R_SUCCESS -if it successfully read and parsed -filename. -It returns -LWRES_R_FAILURE -if -filename -could not be opened or contained incorrect -resolver statements. -

-

-lwres_conf_print() -returns -LWRES_R_SUCCESS -unless an error occurred when converting the network addresses to a -numeric host address string. -If this happens, the function returns -LWRES_R_FAILURE. -

+

RETURN VALUES

+

lwres_conf_parse() + returns LWRES_R_SUCCESS + if it successfully read and parsed + filename. + It returns LWRES_R_FAILURE + if filename + could not be opened or contained incorrect + resolver statements. +

+

lwres_conf_print() + returns LWRES_R_SUCCESS + unless an error occurred when converting the network addresses to a + numeric host address string. + If this happens, the function returns + LWRES_R_FAILURE. +

-

SEE ALSO

-

-stdio(3), -resolver(5). -

+

SEE ALSO

+

stdio(3), + resolver(5). +

-

FILES

-

-/etc/resolv.conf -

+

FILES

+

/etc/resolv.conf +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_context.3 b/usr.sbin/bind/lib/lwres/man/lwres_context.3 index 9efe5175e82..9c91adb4d23 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_context.3 +++ b/usr.sbin/bind/lib/lwres/man/lwres_context.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,13 +13,13 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $ISC: lwres_context.3,v 1.13.2.2.2.7 2006/06/29 13:02:31 marka Exp $ +.\" $ISC: lwres_context.3,v 1.17.18.11 2007/01/30 00:23:45 marka Exp $ .\" .hy 0 .ad l .\" Title: lwres_context .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: Jun 30, 2000 .\" Manual: BIND9 .\" Source: BIND9 @@ -36,19 +36,19 @@ lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_con #include .fi .HP 36 -.BI "lwres_result_t lwres_context_create(lwres_context_t\ **contextp, void\ *arg, lwres_malloc_t\ malloc_function, lwres_free_t\ free_function);" +.BI "lwres_result_t lwres_context_create(lwres_context_t\ **" "contextp" ", void\ *" "arg" ", lwres_malloc_t\ " "malloc_function" ", lwres_free_t\ " "free_function" ");" .HP 37 -.BI "lwres_result_t lwres_context_destroy(lwres_context_t\ **contextp);" +.BI "lwres_result_t lwres_context_destroy(lwres_context_t\ **" "contextp" ");" .HP 30 -.BI "void lwres_context_initserial(lwres_context_t\ *ctx, lwres_uint32_t\ serial);" +.BI "void lwres_context_initserial(lwres_context_t\ *" "ctx" ", lwres_uint32_t\ " "serial" ");" .HP 40 -.BI "lwres_uint32_t lwres_context_nextserial(lwres_context_t\ *ctx);" +.BI "lwres_uint32_t lwres_context_nextserial(lwres_context_t\ *" "ctx" ");" .HP 27 -.BI "void lwres_context_freemem(lwres_context_t\ *ctx, void\ *mem, size_t\ len);" +.BI "void lwres_context_freemem(lwres_context_t\ *" "ctx" ", void\ *" "mem" ", size_t\ " "len" ");" .HP 28 -.BI "void lwres_context_allocmem(lwres_context_t\ *ctx, size_t\ len);" +.BI "void lwres_context_allocmem(lwres_context_t\ *" "ctx" ", size_t\ " "len" ");" .HP 30 -.BI "void * lwres_context_sendrecv(lwres_context_t\ *ctx, void\ *sendbase, int\ sendlen, void\ *recvbase, int\ recvlen, int\ *recvd_len);" +.BI "void * lwres_context_sendrecv(lwres_context_t\ *" "ctx" ", void\ *" "sendbase" ", int\ " "sendlen" ", void\ *" "recvbase" ", int\ " "recvlen" ", int\ *" "recvd_len" ");" .SH "DESCRIPTION" .PP \fBlwres_context_create()\fR @@ -72,7 +72,8 @@ to free it. If \fImalloc_function\fR and \fIfree_function\fR -are NULL, memory is allocated using .Xr malloc 3 and +are NULL, memory is allocated using +\fBmalloc\fR(3). and \fBfree\fR(3). It is not permitted to have a NULL \fImalloc_function\fR and a non\-NULL @@ -161,6 +162,9 @@ times out waiting for a response. .PP \fBlwres_conf_init\fR(3), \fBmalloc\fR(3), -\fBfree\fR(3 ). +\fBfree\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2000, 2001, 2003 Internet Software Consortium. +.br diff --git a/usr.sbin/bind/lib/lwres/man/lwres_context.docbook b/usr.sbin/bind/lib/lwres/man/lwres_context.docbook index 2a12c223bcf..2746e401292 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_context.docbook +++ b/usr.sbin/bind/lib/lwres/man/lwres_context.docbook @@ -1,11 +1,11 @@ -]> - - + - + + Jun 30, 2000 + -Jun 30, 2000 - - -lwres_context -3 -BIND9 - + + lwres_context + 3 + BIND9 + 2004 2005 + 2007 Internet Systems Consortium, Inc. ("ISC") @@ -46,255 +46,217 @@ - -lwres_context_create -lwres_context_destroy -lwres_context_nextserial -lwres_context_initserial -lwres_context_freemem -lwres_context_allocmem -lwres_context_sendrecv -lightweight resolver context management - - - + + lwres_context_create + lwres_context_destroy + lwres_context_nextserial + lwres_context_initserial + lwres_context_freemem + lwres_context_allocmem + lwres_context_sendrecv + lightweight resolver context management + + + #include <lwres/lwres.h> - + lwres_result_t lwres_context_create -lwres_context_t **contextp -void *arg -lwres_malloc_t malloc_function -lwres_free_t free_function - + lwres_context_t **contextp + void *arg + lwres_malloc_t malloc_function + lwres_free_t free_function + - + lwres_result_t lwres_context_destroy -lwres_context_t **contextp - + lwres_context_t **contextp + - + void lwres_context_initserial -lwres_context_t *ctx -lwres_uint32_t serial - + lwres_context_t *ctx + lwres_uint32_t serial + - + lwres_uint32_t lwres_context_nextserial -lwres_context_t *ctx - + lwres_context_t *ctx + - + void lwres_context_freemem -lwres_context_t *ctx -void *mem -size_t len - + lwres_context_t *ctx + void *mem + size_t len + - + void lwres_context_allocmem -lwres_context_t *ctx -size_t len - + lwres_context_t *ctx + size_t len + - + void * lwres_context_sendrecv -lwres_context_t *ctx -void *sendbase -int sendlen -void *recvbase -int recvlen -int *recvd_len - + lwres_context_t *ctx + void *sendbase + int sendlen + void *recvbase + int recvlen + int *recvd_len + - - -DESCRIPTION - -lwres_context_create() -creates a -lwres_context_t -structure for use in lightweight resolver operations. -It holds a socket and other data needed for communicating -with a resolver daemon. -The new -lwres_context_t -is returned through -contextp, - -a pointer to a -lwres_context_t -pointer. This -lwres_context_t -pointer must initially be NULL, and is modified -to point to the newly created -lwres_context_t. - - - -When the lightweight resolver needs to perform dynamic memory -allocation, it will call -malloc_function -to allocate memory and -free_function - -to free it. If -malloc_function -and -free_function + + + DESCRIPTION -are NULL, memory is allocated using -.Xr malloc 3 -and - -free3 -. + lwres_context_create() + creates a lwres_context_t structure for use in + lightweight resolver operations. It holds a socket and other + data needed for communicating with a resolver daemon. The new + lwres_context_t is returned through + contextp, a pointer to a + lwres_context_t pointer. This + lwres_context_t pointer must initially be NULL, and + is modified to point to the newly created + lwres_context_t. + + + When the lightweight resolver needs to perform dynamic memory + allocation, it will call + malloc_function + to allocate memory and + free_function + to free it. If + malloc_function + and + free_function + are NULL, memory is allocated using + + malloc3 + . + and + + free3 + . -It is not permitted to have a NULL -malloc_function -and a non-NULL -free_function -or vice versa. -arg -is passed as the first parameter to the memory -allocation functions. -If -malloc_function -and -free_function -are NULL, -arg + It is not permitted to have a NULL + malloc_function and a non-NULL + free_function or vice versa. + arg is passed as the first parameter to + the memory allocation functions. If + malloc_function and + free_function are NULL, + arg is unused and should be passed as + NULL. + -is unused and should be passed as NULL. - - -Once memory for the structure has been allocated, -it is initialized using - -lwres_conf_init3 - + + Once memory for the structure has been allocated, + it is initialized using + + lwres_conf_init3 + + and returned via *contextp. + -and returned via -*contextp. + lwres_context_destroy() + destroys a lwres_context_t, closing its socket. + contextp is a pointer to a pointer to the + context that is to be destroyed. The pointer will be set to + NULL when the context has been destroyed. + - - -lwres_context_destroy() -destroys a -lwres_context_t, + + The context holds a serial number that is used to identify + resolver request packets and associate responses with the + corresponding requests. This serial number is controlled using + lwres_context_initserial() and + lwres_context_nextserial(). + lwres_context_initserial() sets the serial + number for context *ctx to + serial. + lwres_context_nextserial() increments the + serial number and returns the previous value. + -closing its socket. -contextp -is a pointer to a pointer to the context that is to be destroyed. -The pointer will be set to NULL when the context has been destroyed. - - -The context holds a serial number that is used to identify resolver -request packets and associate responses with the corresponding requests. -This serial number is controlled using -lwres_context_initserial() -and -lwres_context_nextserial(). -lwres_context_initserial() -sets the serial number for context -*ctx -to -serial. + + Memory for a lightweight resolver context is allocated and freed + using lwres_context_allocmem() and + lwres_context_freemem(). These use + whatever allocations were defined when the context was created + with lwres_context_create(). + lwres_context_allocmem() allocates + len bytes of memory and if successful + returns a pointer to the allocated storage. + lwres_context_freemem() frees + len bytes of space starting at location + mem. + -lwres_context_nextserial() -increments the serial number and returns the previous value. - - -Memory for a lightweight resolver context is allocated and freed using -lwres_context_allocmem() -and -lwres_context_freemem(). -These use whatever allocations were defined when the context was -created with -lwres_context_create(). -lwres_context_allocmem() -allocates -len -bytes of memory and if successful returns a pointer to the allocated -storage. -lwres_context_freemem() -frees -len -bytes of space starting at location -mem. + lwres_context_sendrecv() + performs I/O for the context ctx. Data + are read and written from the context's socket. It writes data + from sendbase — typically a + lightweight resolver query packet — and waits for a reply + which is copied to the receive buffer at + recvbase. The number of bytes that were + written to this receive buffer is returned in + *recvd_len. + + - - -lwres_context_sendrecv() -performs I/O for the context -ctx. + + RETURN VALUES -Data are read and written from the context's socket. -It writes data from -sendbase -— typically a lightweight resolver query packet — -and waits for a reply which is copied to the receive buffer at -recvbase. + lwres_context_create() + returns LWRES_R_NOMEMORY if memory for + the struct lwres_context could not be allocated, + LWRES_R_SUCCESS otherwise. + + + Successful calls to the memory allocator + lwres_context_allocmem() + return a pointer to the start of the allocated space. + It returns NULL if memory could not be allocated. + + LWRES_R_SUCCESS + is returned when + lwres_context_sendrecv() + completes successfully. + LWRES_R_IOERROR + is returned if an I/O error occurs and + LWRES_R_TIMEOUT + is returned if + lwres_context_sendrecv() + times out waiting for a response. + + + + SEE ALSO + + lwres_conf_init3 + , -The number of bytes that were written to this receive buffer is -returned in -*recvd_len. + + malloc3 + , - - - -RETURN VALUES - -lwres_context_create() -returns -LWRES_R_NOMEMORY -if memory for the -struct lwres_context -could not be allocated, -LWRES_R_SUCCESS -otherwise. - - -Successful calls to the memory allocator -lwres_context_allocmem() -return a pointer to the start of the allocated space. -It returns NULL if memory could not be allocated. - - -LWRES_R_SUCCESS -is returned when -lwres_context_sendrecv() -completes successfully. -LWRES_R_IOERROR -is returned if an I/O error occurs and -LWRES_R_TIMEOUT -is returned if -lwres_context_sendrecv() -times out waiting for a response. - - - -SEE ALSO - - -lwres_conf_init3 -, - - -malloc3 -, - - -free3 - -. - - - + + free3 + . + + + diff --git a/usr.sbin/bind/lib/lwres/man/lwres_context.html b/usr.sbin/bind/lib/lwres/man/lwres_context.html index 7efc75def8e..efc549d672b 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_context.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_context.html @@ -1,5 +1,5 @@ - + lwres_context - +
-
+

Name

lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_context_initserial, lwres_context_freemem, lwres_context_allocmem, lwres_context_sendrecv — lightweight resolver context management

@@ -36,106 +36,81 @@ lwres_result_t lwres_context_create( -  -, - - -  -  -, +lwres_context_t **  + +contextp,   -  -, +void *  + +arg,   -  -, +lwres_malloc_t   + +malloc_function,   -  +lwres_free_t   -); +free_function); - - +
- + - - - - - - -
lwres_result_t lwres_context_destroy( lwres_context_t **  -);
   -);
+contextp); + - - - - - - - + + - + +serial);
void lwres_context_initserial( ,
  , lwres_context_t *  +ctx,
  lwres_uint32_t   -);
- - +
- - - - - - + - -
lwres_uint32_t lwres_context_nextserial(  -);
  lwres_context_t *  -);
+ctx); + - - - - - - - + + - - + + - + +len);
void lwres_context_freemem( ,
  , lwres_context_t *  +ctx,
  , void *  +mem,
  size_t   -);
@@ -143,19 +118,15 @@ void - - - - - - - + + - + +len);
void lwres_context_allocmem( ,
  , lwres_context_t *  +ctx,
  size_t   -);
@@ -163,214 +134,162 @@ void - - - - - - - + + - - + + - - + + - - + + - - + + - + +recvd_len);
void * lwres_context_sendrecv( ,
  , lwres_context_t *  +ctx,
  , void *  +sendbase,
  , int   +sendlen,
  , void *  +recvbase,
  , int   +recvlen,
  int *  -);
-

DESCRIPTION

-

-lwres_context_create() -creates a -lwres_context_t -structure for use in lightweight resolver operations. -It holds a socket and other data needed for communicating -with a resolver daemon. -The new -lwres_context_t -is returned through -contextp, - -a pointer to a -lwres_context_t -pointer. This -lwres_context_t -pointer must initially be NULL, and is modified -to point to the newly created -lwres_context_t. - -

-

-When the lightweight resolver needs to perform dynamic memory -allocation, it will call -malloc_function -to allocate memory and -free_function - -to free it. If -malloc_function -and -free_function - -are NULL, memory is allocated using -.Xr malloc 3 -and -free(3). - -It is not permitted to have a NULL -malloc_function -and a non-NULL -free_function -or vice versa. -arg -is passed as the first parameter to the memory -allocation functions. -If -malloc_function -and -free_function -are NULL, -arg - -is unused and should be passed as NULL. -

+

DESCRIPTION

+

lwres_context_create() + creates a lwres_context_t structure for use in + lightweight resolver operations. It holds a socket and other + data needed for communicating with a resolver daemon. The new + lwres_context_t is returned through + contextp, a pointer to a + lwres_context_t pointer. This + lwres_context_t pointer must initially be NULL, and + is modified to point to the newly created + lwres_context_t. +

-Once memory for the structure has been allocated, -it is initialized using -lwres_conf_init(3) + When the lightweight resolver needs to perform dynamic memory + allocation, it will call + malloc_function + to allocate memory and + free_function + to free it. If + malloc_function + and + free_function + are NULL, memory is allocated using + malloc(3). + and + free(3). -and returned via -*contextp. - -

-

-lwres_context_destroy() -destroys a -lwres_context_t, - -closing its socket. -contextp -is a pointer to a pointer to the context that is to be destroyed. -The pointer will be set to NULL when the context has been destroyed. -

+ It is not permitted to have a NULL + malloc_function and a non-NULL + free_function or vice versa. + arg is passed as the first parameter to + the memory allocation functions. If + malloc_function and + free_function are NULL, + arg is unused and should be passed as + NULL. +

-The context holds a serial number that is used to identify resolver -request packets and associate responses with the corresponding requests. -This serial number is controlled using -lwres_context_initserial() -and -lwres_context_nextserial(). -lwres_context_initserial() -sets the serial number for context -*ctx -to -serial. - -lwres_context_nextserial() -increments the serial number and returns the previous value. -

+ Once memory for the structure has been allocated, + it is initialized using + lwres_conf_init(3) + and returned via *contextp. +

+

lwres_context_destroy() + destroys a lwres_context_t, closing its socket. + contextp is a pointer to a pointer to the + context that is to be destroyed. The pointer will be set to + NULL when the context has been destroyed. +

-Memory for a lightweight resolver context is allocated and freed using -lwres_context_allocmem() -and -lwres_context_freemem(). -These use whatever allocations were defined when the context was -created with -lwres_context_create(). -lwres_context_allocmem() -allocates -len -bytes of memory and if successful returns a pointer to the allocated -storage. -lwres_context_freemem() -frees -len -bytes of space starting at location -mem. - -

+ The context holds a serial number that is used to identify + resolver request packets and associate responses with the + corresponding requests. This serial number is controlled using + lwres_context_initserial() and + lwres_context_nextserial(). + lwres_context_initserial() sets the serial + number for context *ctx to + serial. + lwres_context_nextserial() increments the + serial number and returns the previous value. +

-lwres_context_sendrecv() -performs I/O for the context -ctx. - -Data are read and written from the context's socket. -It writes data from -sendbase -— typically a lightweight resolver query packet — -and waits for a reply which is copied to the receive buffer at -recvbase. - -The number of bytes that were written to this receive buffer is -returned in -*recvd_len. - -

+ Memory for a lightweight resolver context is allocated and freed + using lwres_context_allocmem() and + lwres_context_freemem(). These use + whatever allocations were defined when the context was created + with lwres_context_create(). + lwres_context_allocmem() allocates + len bytes of memory and if successful + returns a pointer to the allocated storage. + lwres_context_freemem() frees + len bytes of space starting at location + mem. +

+

lwres_context_sendrecv() + performs I/O for the context ctx. Data + are read and written from the context's socket. It writes data + from sendbase — typically a + lightweight resolver query packet — and waits for a reply + which is copied to the receive buffer at + recvbase. The number of bytes that were + written to this receive buffer is returned in + *recvd_len. +

-

RETURN VALUES

-

-lwres_context_create() -returns -LWRES_R_NOMEMORY -if memory for the -struct lwres_context -could not be allocated, -LWRES_R_SUCCESS -otherwise. -

+

RETURN VALUES

+

lwres_context_create() + returns LWRES_R_NOMEMORY if memory for + the struct lwres_context could not be allocated, + LWRES_R_SUCCESS otherwise. +

-Successful calls to the memory allocator -lwres_context_allocmem() -return a pointer to the start of the allocated space. -It returns NULL if memory could not be allocated. -

-

-LWRES_R_SUCCESS -is returned when -lwres_context_sendrecv() -completes successfully. -LWRES_R_IOERROR -is returned if an I/O error occurs and -LWRES_R_TIMEOUT -is returned if -lwres_context_sendrecv() -times out waiting for a response. -

+ Successful calls to the memory allocator + lwres_context_allocmem() + return a pointer to the start of the allocated space. + It returns NULL if memory could not be allocated. +

+

LWRES_R_SUCCESS + is returned when + lwres_context_sendrecv() + completes successfully. + LWRES_R_IOERROR + is returned if an I/O error occurs and + LWRES_R_TIMEOUT + is returned if + lwres_context_sendrecv() + times out waiting for a response. +

-

SEE ALSO

-

-lwres_conf_init(3), +

SEE ALSO

+

lwres_conf_init(3), -malloc(3), + malloc(3), -free(3 -). -

+ free(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gabn.html b/usr.sbin/bind/lib/lwres/man/lwres_gabn.html index 41ab93f9130..a6f2ffcd427 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_gabn.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_gabn.html @@ -1,5 +1,5 @@ - + lwres_gabn - +
-
+

Name

lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free — lightweight resolver getaddrbyname message handling

@@ -36,29 +36,27 @@ lwres_result_t lwres_gabnrequest_render( -  -, - - -  -  -, +lwres_context_t *  + +ctx,   -  -, +lwres_gabnrequest_t *  + +req,   -  -, +lwres_lwpacket_t *  + +pkt,   -  +lwres_buffer_t *  -); +b); @@ -66,29 +64,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +b);
lwres_result_t lwres_gabnresponse_render( ,
  , lwres_context_t *  +ctx,
  , lwres_gabnresponse_t *  +req,
  , lwres_lwpacket_t *  +pkt,
  lwres_buffer_t *  -);
@@ -96,29 +92,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_gabnrequest_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_gabnrequest_t **  -);
@@ -126,29 +120,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_gabnresponse_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_gabnresponse_t **  -);
@@ -156,19 +148,15 @@ lwres_result_t - - - - - - - + + - + +structp);
void lwres_gabnresponse_free( ,
  , lwres_context_t *  +ctx,
  lwres_gabnresponse_t **  -);
@@ -176,61 +164,66 @@ void - - - - - - - + + - + +structp);
void lwres_gabnrequest_free( ,
  , lwres_context_t *  +ctx,
  lwres_gabnrequest_t **  -);
-

DESCRIPTION

+

DESCRIPTION

-These are low-level routines for creating and parsing -lightweight resolver name-to-address lookup request and -response messages. -

+ These are low-level routines for creating and parsing + lightweight resolver name-to-address lookup request and + response messages. +

-There are four main functions for the getaddrbyname opcode. -One render function converts a getaddrbyname request structure — -lwres_gabnrequest_t — -to the lighweight resolver's canonical format. -It is complemented by a parse function that converts a packet in this -canonical format to a getaddrbyname request structure. -Another render function converts the getaddrbyname response structure — -lwres_gabnresponse_t — -to the canonical format. -This is complemented by a parse function which converts a packet in -canonical format to a getaddrbyname response structure. -

+ There are four main functions for the getaddrbyname opcode. + One render function converts a getaddrbyname request structure — + lwres_gabnrequest_t — + to the lighweight resolver's canonical format. + It is complemented by a parse function that converts a packet in this + canonical format to a getaddrbyname request structure. + Another render function converts the getaddrbyname response structure + — lwres_gabnresponse_t — + to the canonical format. + This is complemented by a parse function which converts a packet in + canonical format to a getaddrbyname response structure. +

-These structures are defined in -<lwres/lwres.h>. -They are shown below. -

+ These structures are defined in + <lwres/lwres.h>. + They are shown below. +

 #define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
-
+
+

+

+
 typedef struct lwres_addr lwres_addr_t;
 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
-
+
+

+

+
 typedef struct {
         lwres_uint32_t  flags;
         lwres_uint32_t  addrtypes;
         lwres_uint16_t  namelen;
         char           *name;
 } lwres_gabnrequest_t;
-
+
+

+

+
 typedef struct {
         lwres_uint32_t          flags;
         lwres_uint16_t          naliases;
@@ -245,113 +238,87 @@ typedef struct {
 } lwres_gabnresponse_t;
 

-

-

-lwres_gabnrequest_render() -uses resolver context -ctx -to convert getaddrbyname request structure -req -to canonical format. -The packet header structure -pkt -is initialised and transferred to -buffer -b. +

+

lwres_gabnrequest_render() + uses resolver context ctx to convert + getaddrbyname request structure req to + canonical format. The packet header structure + pkt is initialised and transferred to + buffer b. -The contents of -*req -are then appended to the buffer in canonical format. -lwres_gabnresponse_render() -performs the same task, except it converts a getaddrbyname response structure -lwres_gabnresponse_t -to the lightweight resolver's canonical format. -

-

-lwres_gabnrequest_parse() -uses context -ctx -to convert the contents of packet -pkt -to a -lwres_gabnrequest_t -structure. -Buffer -b -provides space to be used for storing this structure. -When the function succeeds, the resulting -lwres_gabnrequest_t -is made available through -*structp. + The contents of *req are then appended to + the buffer in canonical format. + lwres_gabnresponse_render() performs the + same task, except it converts a getaddrbyname response structure + lwres_gabnresponse_t to the lightweight resolver's + canonical format. +

+

lwres_gabnrequest_parse() + uses context ctx to convert the contents + of packet pkt to a + lwres_gabnrequest_t structure. Buffer + b provides space to be used for storing + this structure. When the function succeeds, the resulting + lwres_gabnrequest_t is made available through + *structp. -lwres_gabnresponse_parse() -offers the same semantics as -lwres_gabnrequest_parse() -except it yields a -lwres_gabnresponse_t -structure. -

-

-lwres_gabnresponse_free() -and -lwres_gabnrequest_free() -release the memory in resolver context -ctx -that was allocated to the -lwres_gabnresponse_t -or -lwres_gabnrequest_t -structures referenced via -structp. + lwres_gabnresponse_parse() offers the same + semantics as lwres_gabnrequest_parse() + except it yields a lwres_gabnresponse_t structure. +

+

lwres_gabnresponse_free() + and lwres_gabnrequest_free() release the + memory in resolver context ctx that was + allocated to the lwres_gabnresponse_t or + lwres_gabnrequest_t structures referenced via + structp. -Any memory associated with ancillary buffers and strings for those -structures is also discarded. -

+ Any memory associated with ancillary buffers and strings for + those structures is also discarded. +

-

RETURN VALUES

+

RETURN VALUES

-The getaddrbyname opcode functions -lwres_gabnrequest_render(), -lwres_gabnresponse_render() -lwres_gabnrequest_parse() -and -lwres_gabnresponse_parse() -all return -LWRES_R_SUCCESS -on success. -They return -LWRES_R_NOMEMORY -if memory allocation fails. -LWRES_R_UNEXPECTEDEND -is returned if the available space in the buffer -b -is too small to accommodate the packet header or the -lwres_gabnrequest_t -and -lwres_gabnresponse_t -structures. -lwres_gabnrequest_parse() -and -lwres_gabnresponse_parse() -will return -LWRES_R_UNEXPECTEDEND -if the buffer is not empty after decoding the received packet. -These functions will return -LWRES_R_FAILURE -if -pktflags -in the packet header structure -lwres_lwpacket_t -indicate that the packet is not a response to an earlier query. -

+ The getaddrbyname opcode functions + lwres_gabnrequest_render(), + lwres_gabnresponse_render() + lwres_gabnrequest_parse() + and + lwres_gabnresponse_parse() + all return + LWRES_R_SUCCESS + on success. + They return + LWRES_R_NOMEMORY + if memory allocation fails. + LWRES_R_UNEXPECTEDEND + is returned if the available space in the buffer + b + is too small to accommodate the packet header or the + lwres_gabnrequest_t + and + lwres_gabnresponse_t + structures. + lwres_gabnrequest_parse() + and + lwres_gabnresponse_parse() + will return + LWRES_R_UNEXPECTEDEND + if the buffer is not empty after decoding the received packet. + These functions will return + LWRES_R_FAILURE + if + pktflags + in the packet header structure + lwres_lwpacket_t + indicate that the packet is not a response to an earlier query. +

-

SEE ALSO

-

-lwres_packet(3 -) -

+

SEE ALSO

+

lwres_packet(3) +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html b/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html index c31fd7c409c..468a93ff12f 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_gai_strerror.html @@ -1,5 +1,5 @@ - + lwres_gai_strerror - +
-
+

Name

-

gai_strerror — print suitable error string

+

lwres_gai_strerror — print suitable error string

Synopsis

#include <lwres/netdb.h>
-

+ + + + +
char * -gai_strerror(int ecode);

+gai_strerror(
int   +ecode);

-

DESCRIPTION

-

-lwres_gai_strerror() -returns an error message corresponding to an error code returned by -getaddrinfo(). -The following error codes and their meaning are defined in -include/lwres/netdb.h. -

+

DESCRIPTION

+

lwres_gai_strerror() + returns an error message corresponding to an error code returned by + getaddrinfo(). + The following error codes and their meaning are defined in + include/lwres/netdb.h. +

EAI_ADDRFAMILY

-address family for hostname not supported -

+ address family for hostname not supported +

EAI_AGAIN

-temporary failure in name resolution -

+ temporary failure in name resolution +

EAI_BADFLAGS

-invalid value for -ai_flags -

+ invalid value for + ai_flags +

EAI_FAIL

-non-recoverable failure in name resolution -

+ non-recoverable failure in name resolution +

EAI_FAMILY
-

-ai_family not supported -

+

ai_family not supported +

EAI_MEMORY

-memory allocation failure -

+ memory allocation failure +

EAI_NODATA

-no address associated with hostname -

+ no address associated with hostname +

EAI_NONAME

-hostname or servname not provided, or not known -

+ hostname or servname not provided, or not known +

EAI_SERVICE

-servname not supported for ai_socktype -

+ servname not supported for ai_socktype +

EAI_SOCKTYPE
-

-ai_socktype not supported -

+

ai_socktype not supported +

EAI_SYSTEM

-system error returned in errno -

+ system error returned in errno +

-The message invalid error code is returned if -ecode -is out of range. -

-

-ai_flags, -ai_family -and -ai_socktype -are elements of the -struct addrinfo -used by -lwres_getaddrinfo(). -

+ The message invalid error code is returned if + ecode + is out of range. +

+

ai_flags, + ai_family + and + ai_socktype + are elements of the + struct addrinfo + used by + lwres_getaddrinfo(). +

-

SEE ALSO

-

-strerror(3), +

SEE ALSO

+

strerror(3), -lwres_getaddrinfo(3), + lwres_getaddrinfo(3), -getaddrinfo(3), + getaddrinfo(3), -RFC2133. -

+ RFC2133. +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html b/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html index e9d2f0c5c7a..054dbfca014 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_getaddrinfo.html @@ -1,5 +1,5 @@ - + lwres_getaddrinfo - +
-
+

Name

lwres_getaddrinfo, lwres_freeaddrinfo — socket address structure to host and service name

@@ -36,54 +36,43 @@ int lwres_getaddrinfo( -  -, - - -  -  -, +const char *  + +hostname,   -  -, +const char *  + +servname,   -  -, +const struct addrinfo *  + +hints,   -  +struct addrinfo **  -); +res); - - +
- + - - - - - - -
void lwres_freeaddrinfo( struct addrinfo *  -);
   -);
+ai); +

-If the operating system does not provide a -struct addrinfo, -the following structure is used: - -

+ If the operating system does not provide a + struct addrinfo, + the following structure is used: +

 struct  addrinfo {
         int             ai_flags;       /* AI_PASSIVE, AI_CANONNAME */
@@ -97,250 +86,237 @@ struct  addrinfo {
 };
 

-

+

-

DESCRIPTION

-

-lwres_getaddrinfo() -is used to get a list of IP addresses and port numbers for host -hostname -and service -servname. +

DESCRIPTION

+

lwres_getaddrinfo() + is used to get a list of IP addresses and port numbers for host + hostname and service + servname. -The function is the lightweight resolver's implementation of -getaddrinfo() -as defined in RFC2133. -hostname -and -servname -are pointers to null-terminated -strings or -NULL. + The function is the lightweight resolver's implementation of + getaddrinfo() as defined in RFC2133. + hostname and + servname are pointers to null-terminated + strings or NULL. -hostname -is either a host name or a numeric host address string: a dotted decimal -IPv4 address or an IPv6 address. -servname -is either a decimal port number or a service name as listed in -/etc/services. -

-

-hints -is an optional pointer to a -struct addrinfo. -This structure can be used to provide hints concerning the type of socket -that the caller supports or wishes to use. -The caller can supply the following structure elements in -*hints: + hostname is either a host name or a + numeric host address string: a dotted decimal IPv4 address or an + IPv6 address. servname is either a + decimal port number or a service name as listed in + /etc/services. +

+

hints + is an optional pointer to a + struct addrinfo. + This structure can be used to provide hints concerning the type of + socket + that the caller supports or wishes to use. + The caller can supply the following structure elements in + *hints: -

+

ai_family
-

The protocol family that should be used. -When -ai_family -is set to -PF_UNSPEC, -it means the caller will accept any protocol family supported by the -operating system. -

+

+ The protocol family that should be used. + When + ai_family + is set to + PF_UNSPEC, + it means the caller will accept any protocol family supported by + the + operating system. +

ai_socktype

-denotes the type of socket — -SOCK_STREAM, -SOCK_DGRAM -or -SOCK_RAW -— that is wanted. -When -ai_socktype -is zero the caller will accept any socket type. -

+ denotes the type of socket — + SOCK_STREAM, + SOCK_DGRAM + or + SOCK_RAW + — that is wanted. + When + ai_socktype + is zero the caller will accept any socket type. +

ai_protocol

-indicates which transport protocol is wanted: IPPROTO_UDP or -IPPROTO_TCP. -If -ai_protocol -is zero the caller will accept any protocol. -

+ indicates which transport protocol is wanted: IPPROTO_UDP or + IPPROTO_TCP. + If + ai_protocol + is zero the caller will accept any protocol. +

ai_flags

-Flag bits. -If the -AI_CANONNAME -bit is set, a successful call to -lwres_getaddrinfo() -will return a null-terminated string containing the canonical name -of the specified hostname in -ai_canonname -of the first -addrinfo -structure returned. -Setting the -AI_PASSIVE -bit indicates that the returned socket address structure is intended -for used in a call to -bind(2). + Flag bits. + If the + AI_CANONNAME + bit is set, a successful call to + lwres_getaddrinfo() + will return a null-terminated string containing the canonical + name + of the specified hostname in + ai_canonname + of the first + addrinfo + structure returned. + Setting the + AI_PASSIVE + bit indicates that the returned socket address structure is + intended + for used in a call to + bind(2). -In this case, if the hostname argument is a -NULL -pointer, then the IP address portion of the socket -address structure will be set to -INADDR_ANY -for an IPv4 address or -IN6ADDR_ANY_INIT -for an IPv6 address. -

+ In this case, if the hostname argument is a + NULL + pointer, then the IP address portion of the socket + address structure will be set to + INADDR_ANY + for an IPv4 address or + IN6ADDR_ANY_INIT + for an IPv6 address. +

-When -ai_flags -does not set the -AI_PASSIVE -bit, the returned socket address structure will be ready -for use in a call to -connect(2 -) -for a connection-oriented protocol or -connect(2), + When + ai_flags + does not set the + AI_PASSIVE + bit, the returned socket address structure will be ready + for use in a call to + connect(2) + for a connection-oriented protocol or + connect(2), -sendto(2), + sendto(2), -or -sendmsg(2 -) -if a connectionless protocol was chosen. -The IP address portion of the socket address structure will be -set to the loopback address if -hostname -is a -NULL -pointer and -AI_PASSIVE -is not set in -ai_flags. -

+ or + sendmsg(2) + if a connectionless protocol was chosen. + The IP address portion of the socket address structure will be + set to the loopback address if + hostname + is a + NULL + pointer and + AI_PASSIVE + is not set in + ai_flags. +

-If -ai_flags -is set to -AI_NUMERICHOST -it indicates that -hostname -should be treated as a numeric string defining an IPv4 or IPv6 address -and no name resolution should be attempted. -

+ If + ai_flags + is set to + AI_NUMERICHOST + it indicates that + hostname + should be treated as a numeric string defining an IPv4 or IPv6 + address + and no name resolution should be attempted. +

-

+

-All other elements of the struct addrinfo passed -via hints must be zero. -

+ All other elements of the struct addrinfo passed + via hints must be zero. +

-A hints of NULL is treated as if -the caller provided a struct addrinfo initialized to zero -with ai_familyset to -PF_UNSPEC. -

+ A hints of NULL is + treated as if + the caller provided a struct addrinfo initialized to zero + with ai_familyset to + PF_UNSPEC. +

-After a successful call to -lwres_getaddrinfo(), -*res -is a pointer to a linked list of one or more -addrinfo -structures. -Each -struct addrinfo -in this list cn be processed by following -the -ai_next -pointer, until a -NULL -pointer is encountered. -The three members -ai_family, -ai_socktype, -and -ai_protocol -in each -returned -addrinfo -structure contain the corresponding arguments for a call to -socket(2). -For each -addrinfo -structure in the list, the -ai_addr -member points to a filled-in socket address structure of length -ai_addrlen. -

+ After a successful call to + lwres_getaddrinfo(), + *res + is a pointer to a linked list of one or more + addrinfo + structures. + Each + struct addrinfo + in this list cn be processed by following + the + ai_next + pointer, until a + NULL + pointer is encountered. + The three members + ai_family, + ai_socktype, + and + ai_protocol + in each + returned + addrinfo + structure contain the corresponding arguments for a call to + socket(2). + For each + addrinfo + structure in the list, the + ai_addr + member points to a filled-in socket address structure of length + ai_addrlen. +

-All of the information returned by -lwres_getaddrinfo() -is dynamically allocated: the addrinfo structures, and the socket -address structures and canonical host name strings pointed to by the -addrinfostructures. -Memory allocated for the dynamically allocated structures created by -a successful call to -lwres_getaddrinfo() -is released by -lwres_freeaddrinfo(). -ai -is a pointer to a -struct addrinfo -created by a call to -lwres_getaddrinfo(). -

+ All of the information returned by + lwres_getaddrinfo() + is dynamically allocated: the addrinfo structures, and the socket + address structures and canonical host name strings pointed to by the + addrinfostructures. + Memory allocated for the dynamically allocated structures created by + a successful call to + lwres_getaddrinfo() + is released by + lwres_freeaddrinfo(). + ai + is a pointer to a + struct addrinfo + created by a call to + lwres_getaddrinfo(). +

-

RETURN VALUES

-

-lwres_getaddrinfo() -returns zero on success or one of the error codes listed in -gai_strerror(3 -) -if an error occurs. -If both -hostname -and -servname -are -NULL -lwres_getaddrinfo() -returns -EAI_NONAME. - -

+

RETURN VALUES

+

lwres_getaddrinfo() + returns zero on success or one of the error codes listed in + gai_strerror(3) + if an error occurs. If both hostname and + servname are NULL + lwres_getaddrinfo() returns + EAI_NONAME. +

-

SEE ALSO

-

-lwres(3), +

SEE ALSO

+

lwres(3), -lwres_getaddrinfo(3), + lwres_getaddrinfo(3), -lwres_freeaddrinfo(3), + lwres_freeaddrinfo(3), -lwres_gai_strerror(3), + lwres_gai_strerror(3), -RFC2133, + RFC2133, -getservbyname(3), + getservbyname(3), -bind(2), + bind(2), -connect(2), + connect(2), -sendto(2), + sendto(2), -sendmsg(2), + sendmsg(2), -socket(2). -

+ socket(2). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html b/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html index 0413d459fb0..1f72dfede83 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_gethostent.html @@ -1,5 +1,5 @@ - + lwres_gethostent - +
-
+

Name

lwres_gethostbyname, lwres_gethostbyname2, lwres_gethostbyaddr, lwres_gethostent, lwres_sethostent, lwres_endhostent, lwres_gethostbyname_r, lwres_gethostbyaddr_r, lwres_gethostent_r, lwres_sethostent_r, lwres_endhostent_r — lightweight resolver get network host entry

@@ -31,40 +31,28 @@

Synopsis

#include <lwres/netdb.h>
- - +
- + - - - - - - -
struct hostent * lwres_gethostbyname( const char *  -);
   -);
+name); + - - - - - - - + + - + +af);
struct hostent * lwres_gethostbyname2( ,
  , const char *  +name,
  int   -);
@@ -72,68 +60,79 @@ struct hostent * - - - - - - - + + - - + + - + +type);
struct hostent * lwres_gethostbyaddr( ,
  , const char *  +addr,
  , int   +len,
  int   -);
-

+ + + + +
struct hostent * -lwres_gethostent(void);

-

+lwres_gethostent(

  +);
+ + + + +
void -lwres_sethostent(int stayopen);

-

+lwres_sethostent(

int   +stayopen);
+ + + + +
void -lwres_endhostent(void);

+lwres_endhostent(
  +);
- - - - - - - + + - - + + - - + + - - + + - + +error);
struct hostent * lwres_gethostbyname_r( ,
  , const char *  +name,
  , struct hostent *  +resbuf,
  , char *  +buf,
  , int   +buflen,
  int *  -);
@@ -141,44 +140,45 @@ struct hostent * - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - + +error);
struct hostent * lwres_gethostbyaddr_r( ,
  , const char *  +addr,
  , int   +len,
  , int   +type,
  , struct hostent *  +resbuf,
  , char *  +buf,
  , int   +buflen,
  int *  -);
@@ -186,54 +186,60 @@ struct hostent * - - - - - - - + + - - + + - - + + - + +error);
struct hostent * lwres_gethostent_r( ,
  , struct hostent *  +resbuf,
  , char *  +buf,
  , int   +buflen,
  int *  -);
-

+ + + + +
void -lwres_sethostent_r(int stayopen);

-

+lwres_sethostent_r(

int   +stayopen);
+ + + + +
void -lwres_endhostent_r(void);

+lwres_endhostent_r(
  +);

-

DESCRIPTION

+

DESCRIPTION

-These functions provide hostname-to-address and -address-to-hostname lookups by means of the lightweight resolver. -They are similar to the standard -gethostent(3 -) -functions provided by most operating systems. -They use a -struct hostent -which is usually defined in -<namedb.h>. - -

+ These functions provide hostname-to-address and + address-to-hostname lookups by means of the lightweight resolver. + They are similar to the standard + gethostent(3) + functions provided by most operating systems. + They use a + struct hostent + which is usually defined in + <namedb.h>. +

 struct  hostent {
         char    *h_name;        /* official name of host */
@@ -245,219 +251,216 @@ struct  hostent {
 #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
 

-

+

-The members of this structure are: -

+ The members of this structure are: +

h_name

-The official (canonical) name of the host. -

+ The official (canonical) name of the host. +

h_aliases

-A NULL-terminated array of alternate names (nicknames) for the host. -

+ A NULL-terminated array of alternate names (nicknames) for the + host. +

h_addrtype

-The type of address being returned — -PF_INET -or -PF_INET6. -

+ The type of address being returned — + PF_INET + or + PF_INET6. +

h_length

-The length of the address in bytes. -

+ The length of the address in bytes. +

h_addr_list

-A NULL -terminated array of network addresses for the host. -Host addresses are returned in network byte order. -

+ A NULL + terminated array of network addresses for the host. + Host addresses are returned in network byte order. +

-

-

-For backward compatibility with very old software, -h_addr -is the first address in -h_addr_list. -

+

-lwres_gethostent(), -lwres_sethostent(), -lwres_endhostent(), -lwres_gethostent_r(), -lwres_sethostent_r() -and -lwres_endhostent_r() -provide iteration over the known host entries on systems that -provide such functionality through facilities like -/etc/hosts -or NIS. The lightweight resolver does not currently implement -these functions; it only provides them as stub functions that always -return failure. -

+ For backward compatibility with very old software, + h_addr + is the first address in + h_addr_list. +

+

lwres_gethostent(), + lwres_sethostent(), + lwres_endhostent(), + lwres_gethostent_r(), + lwres_sethostent_r() + and + lwres_endhostent_r() + provide iteration over the known host entries on systems that + provide such functionality through facilities like + /etc/hosts + or NIS. The lightweight resolver does not currently implement + these functions; it only provides them as stub functions that always + return failure. +

+

lwres_gethostbyname() + and lwres_gethostbyname2() look up the + hostname name. + lwres_gethostbyname() always looks for an + IPv4 address while lwres_gethostbyname2() + looks for an address of protocol family + af: either PF_INET or + PF_INET6 — IPv4 or IPV6 addresses + respectively. Successful calls of the functions return a + struct hostentfor the name that was looked up. + NULL is returned if the lookups by + lwres_gethostbyname() or + lwres_gethostbyname2() fail. +

-lwres_gethostbyname() and -lwres_gethostbyname2() look up the hostname -name. -lwres_gethostbyname() always looks for an IPv4 -address while lwres_gethostbyname2() looks for an -address of protocol family af: either -PF_INET or PF_INET6 — IPv4 or IPV6 -addresses respectively. Successful calls of the functions return a -struct hostentfor the name that was looked up. -NULL is returned if the lookups by -lwres_gethostbyname() or -lwres_gethostbyname2() fail. -

-

-Reverse lookups of addresses are performed by -lwres_gethostbyaddr(). -addr is an address of length -len bytes and protocol family -typePF_INET or -PF_INET6. -lwres_gethostbyname_r() is a thread-safe function -for forward lookups. If an error occurs, an error code is returned in -*error. -resbuf is a pointer to a struct -hostent which is initialised by a successful call to -lwres_gethostbyname_r() . -buf is a buffer of length -len bytes which is used to store the -h_name, h_aliases, and -h_addr_list elements of the struct -hostent returned in resbuf. -Successful calls to lwres_gethostbyname_r() -return resbuf, -which is a pointer to the struct hostent it created. -

-

-lwres_gethostbyaddr_r() is a thread-safe function -that performs a reverse lookup of address addr -which is len bytes long and is of protocol -family typePF_INET or -PF_INET6. If an error occurs, the error code is returned -in *error. The other function parameters are -identical to those in lwres_gethostbyname_r(). -resbuf is a pointer to a struct -hostent which is initialised by a successful call to -lwres_gethostbyaddr_r(). -buf is a buffer of length -len bytes which is used to store the -h_name, h_aliases, and -h_addr_list elements of the struct -hostent returned in resbuf. Successful -calls to lwres_gethostbyaddr_r() return -resbuf, which is a pointer to the -struct hostent() it created. -

+ Reverse lookups of addresses are performed by + lwres_gethostbyaddr(). + addr is an address of length + len bytes and protocol family + typePF_INET or + PF_INET6. + lwres_gethostbyname_r() is a + thread-safe function + for forward lookups. If an error occurs, an error code is returned in + *error. + resbuf is a pointer to a + struct hostent which is initialised by a successful call to + lwres_gethostbyname_r(). + buf is a buffer of length + len bytes which is used to store the + h_name, h_aliases, and + h_addr_list elements of the + struct hostent returned in resbuf. + Successful calls to lwres_gethostbyname_r() + return resbuf, + which is a pointer to the struct hostent it created. +

+

lwres_gethostbyaddr_r() + is a thread-safe function + that performs a reverse lookup of address addr + which is len bytes long and is of + protocol + family typePF_INET or + PF_INET6. If an error occurs, the error code is returned + in *error. The other function + parameters are + identical to those in lwres_gethostbyname_r(). + resbuf is a pointer to a + struct hostent which is initialised by a successful call to + lwres_gethostbyaddr_r(). + buf is a buffer of length + len bytes which is used to store the + h_name, h_aliases, and + h_addr_list elements of the + struct hostent returned in resbuf. + Successful calls to lwres_gethostbyaddr_r() return + resbuf, which is a pointer to the + struct hostent() it created. +

-

RETURN VALUES

+

RETURN VALUES

-The functions -lwres_gethostbyname(), -lwres_gethostbyname2(), -lwres_gethostbyaddr(), -and -lwres_gethostent() -return NULL to indicate an error. In this case the global variable -lwres_h_errno -will contain one of the following error codes defined in -<lwres/netdb.h>: + The functions + lwres_gethostbyname(), + lwres_gethostbyname2(), + lwres_gethostbyaddr(), + and + lwres_gethostent() + return NULL to indicate an error. In this case the global variable + lwres_h_errno + will contain one of the following error codes defined in + <lwres/netdb.h>: -

+

HOST_NOT_FOUND

-The host or address was not found. -

+ The host or address was not found. +

TRY_AGAIN

-A recoverable error occurred, e.g., a timeout. -Retrying the lookup may succeed. -

+ A recoverable error occurred, e.g., a timeout. + Retrying the lookup may succeed. +

NO_RECOVERY

-A non-recoverable error occurred. -

+ A non-recoverable error occurred. +

NO_DATA

-The name exists, but has no address information -associated with it (or vice versa in the case -of a reverse lookup). The code NO_ADDRESS -is accepted as a synonym for NO_DATA for backwards -compatibility. -

+ The name exists, but has no address information + associated with it (or vice versa in the case + of a reverse lookup). The code NO_ADDRESS + is accepted as a synonym for NO_DATA for backwards + compatibility. +

-

-

-lwres_hstrerror(3 -) -translates these error codes to suitable error messages. -

+

+

lwres_hstrerror(3) + translates these error codes to suitable error messages. +

+

lwres_gethostent() + and lwres_gethostent_r() + always return NULL. +

-lwres_gethostent() -and -lwres_gethostent_r() -always return -NULL. -

-

-Successful calls to lwres_gethostbyname_r() and -lwres_gethostbyaddr_r() return -resbuf, a pointer to the struct -hostent that was initialised by these functions. They return -NULL if the lookups fail or if buf -was too small to hold the list of addresses and names referenced by -the h_name, h_aliases, and -h_addr_list elements of the struct -hostent. If buf was too small, both -lwres_gethostbyname_r() and -lwres_gethostbyaddr_r() set the global variable -errno to ERANGE. -

+ Successful calls to lwres_gethostbyname_r() and + lwres_gethostbyaddr_r() return + resbuf, a pointer to the + struct hostent that was initialised by these functions. They return + NULL if the lookups fail or if buf + was too small to hold the list of addresses and names referenced by + the h_name, h_aliases, and + h_addr_list elements of the + struct hostent. + If buf was too small, both + lwres_gethostbyname_r() and + lwres_gethostbyaddr_r() set the global + variable + errno to ERANGE. +

-

SEE ALSO

-

-gethostent(3), +

SEE ALSO

+

gethostent(3), -lwres_getipnode(3), + lwres_getipnode(3), -lwres_hstrerror(3 -) -

+ lwres_hstrerror(3) +

-

BUGS

-

-lwres_gethostbyname(), -lwres_gethostbyname2(), -lwres_gethostbyaddr() -and -lwres_endhostent() -are not thread safe; they return pointers to static data and -provide error codes through a global variable. -Thread-safe versions for name and address lookup are provided by -lwres_gethostbyname_r(), -and -lwres_gethostbyaddr_r() -respectively. -

+

BUGS

+

lwres_gethostbyname(), + lwres_gethostbyname2(), + lwres_gethostbyaddr() + and + lwres_endhostent() + are not thread safe; they return pointers to static data and + provide error codes through a global variable. + Thread-safe versions for name and address lookup are provided by + lwres_gethostbyname_r(), + and + lwres_gethostbyaddr_r() + respectively. +

-The resolver daemon does not currently support any non-DNS -name services such as -/etc/hosts -or -NIS, -consequently the above functions don't, either. -

+ The resolver daemon does not currently support any non-DNS + name services such as + /etc/hosts + or + NIS, + consequently the above functions don't, either. +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 index f044c1cc4c3..58d49f782fd 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 +++ b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,13 +13,13 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $ISC: lwres_getipnode.3,v 1.13.2.2.4.7 2006/06/29 13:02:31 marka Exp $ +.\" $ISC: lwres_getipnode.3,v 1.17.18.11 2007/01/30 00:23:45 marka Exp $ .\" .hy 0 .ad l .\" Title: lwres_getipnode .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: Jun 30, 2000 .\" Manual: BIND9 .\" Source: BIND9 @@ -36,11 +36,11 @@ lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight r #include .fi .HP 39 -.BI "struct hostent * lwres_getipnodebyname(const\ char\ *name, int\ af, int\ flags, int\ *error_num);" +.BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");" .HP 39 -.BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *src, size_t\ len, int\ af, int\ *error_num);" +.BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");" .HP 23 -.BI "void lwres_freehostent(struct\ hostent\ *he);" +.BI "void lwres_freehostent(struct\ hostent\ *" "he" ");" .SH "DESCRIPTION" .PP These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553. @@ -49,8 +49,8 @@ They use a \fBstruct hostent\fR which is defined in \fInamedb.h\fR: -.sp -.RS 3n +.PP +.RS 4 .nf struct hostent { char *h_name; /* official name of host */ @@ -65,26 +65,36 @@ struct hostent { .sp .PP The members of this structure are: -.TP 3n +.PP \fBh_name\fR +.RS 4 The official (canonical) name of the host. -.TP 3n +.RE +.PP \fBh_aliases\fR +.RS 4 A NULL\-terminated array of alternate names (nicknames) for the host. -.TP 3n +.RE +.PP \fBh_addrtype\fR +.RS 4 The type of address being returned \- usually \fBPF_INET\fR or \fBPF_INET6\fR. -.TP 3n +.RE +.PP \fBh_length\fR +.RS 4 The length of the address in bytes. -.TP 3n +.RE +.PP \fBh_addr_list\fR +.RS 4 A \fBNULL\fR terminated array of network addresses for the host. Host addresses are returned in network byte order. +.RE .PP \fBlwres_getipnodebyname()\fR looks up addresses of protocol family @@ -93,26 +103,34 @@ for the hostname \fIname\fR. The \fIflags\fR parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned. The flag bits are: -.TP 3n +.PP \fBAI_V4MAPPED\fR +.RS 4 This is used with an \fIaf\fR of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses. -.TP 3n +.RE +.PP \fBAI_ALL\fR +.RS 4 This is used with an \fIaf\fR of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses. -.TP 3n +.RE +.PP \fBAI_ADDRCONFIG\fR +.RS 4 Only return an IPv6 or IPv4 address if here is an active network interface of that type. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored. -.TP 3n +.RE +.PP \fBAI_DEFAULT\fR +.RS 4 This default sets the \fBAI_V4MAPPED\fR and \fBAI_ADDRCONFIG\fR flag bits. +.RE .PP \fBlwres_getipnodebyaddr()\fR performs a reverse lookup of address @@ -150,20 +168,28 @@ to an appropriate error code and the function returns a \fBNULL\fR pointer. The error codes and their meanings are defined in \fI\fR: -.TP 3n +.PP \fBHOST_NOT_FOUND\fR +.RS 4 No such host is known. -.TP 3n +.RE +.PP \fBNO_ADDRESS\fR +.RS 4 The server recognised the request and the name but no address is available. Another type of request to the name server for the domain might return an answer. -.TP 3n +.RE +.PP \fBTRY_AGAIN\fR +.RS 4 A temporary and possibly transient error occurred, such as a failure of a server to respond. The request may succeed if retried. -.TP 3n +.RE +.PP \fBNO_RECOVERY\fR +.RS 4 An unexpected failure occurred, and retrying the request is pointless. +.RE .PP -\fBlwres_hstrerror\fR(3 ) +\fBlwres_hstrerror\fR(3) translates these error codes to suitable error messages. .SH "SEE ALSO" .PP @@ -174,4 +200,7 @@ translates these error codes to suitable error messages. \fBlwres_getnameinfo\fR(3), \fBlwres_hstrerror\fR(3). .SH "COPYRIGHT" -Copyright \(co 2004, 2005 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2000, 2001, 2003 Internet Software Consortium. +.br diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.docbook b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.docbook index 32cce201996..db8ff7afaee 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.docbook +++ b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.docbook @@ -1,11 +1,11 @@ -]> - - + - -Jun 30, 2000 - + + Jun 30, 2000 + - -lwres_getipnode -3 -BIND9 - + + lwres_getipnode + 3 + BIND9 + 2004 2005 + 2007 Internet Systems Consortium, Inc. ("ISC") @@ -46,57 +46,58 @@ - -lwres_getipnodebyname -lwres_getipnodebyaddr -lwres_freehostent -lightweight resolver nodename / address translation API - - - + + lwres_getipnodebyname + lwres_getipnodebyaddr + lwres_freehostent + lightweight resolver nodename / address translation API + + + #include <lwres/netdb.h> - + struct hostent * lwres_getipnodebyname -const char *name -int af -int flags -int *error_num - + const char *name + int af + int flags + int *error_num + - + struct hostent * lwres_getipnodebyaddr -const void *src -size_t len -int af -int *error_num - + const void *src + size_t len + int af + int *error_num + - + void lwres_freehostent -struct hostent *he - + struct hostent *he + - + - -DESCRIPTION + + DESCRIPTION - -These functions perform thread safe, protocol independent -nodename-to-address and address-to-nodename -translation as defined in RFC2553. - + + These functions perform thread safe, protocol independent + nodename-to-address and address-to-nodename + translation as defined in RFC2553. + - -They use a -struct hostent -which is defined in -namedb.h: - + + They use a + struct hostent + which is defined in + namedb.h: + + struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ @@ -106,218 +107,225 @@ struct hostent { }; #define h_addr h_addr_list[0] /* address, for backward compatibility */ - - - -The members of this structure are: - -h_name - - -The official (canonical) name of the host. - - -h_aliases - - -A NULL-terminated array of alternate names (nicknames) for the host. - - -h_addrtype - - -The type of address being returned - usually -PF_INET -or -PF_INET6. + - - -h_length - - -The length of the address in bytes. - - -h_addr_list - - -A -NULL -terminated array of network addresses for the host. -Host addresses are returned in network byte order. - - - - - -lwres_getipnodebyname() -looks up addresses of protocol family -af + + The members of this structure are: + + + h_name + + + The official (canonical) name of the host. + + + + + h_aliases + + + A NULL-terminated array of alternate names (nicknames) for the + host. + + + + + h_addrtype + + + The type of address being returned - usually + PF_INET + or + PF_INET6. -for the hostname -name. + + + + + h_length + + + The length of the address in bytes. + + + + + h_addr_list + + + A + NULL + terminated array of network addresses for the host. + Host addresses are returned in network byte order. + + + + + -The -flags -parameter contains ORed flag bits to -specify the types of addresses that are searched -for, and the types of addresses that are returned. -The flag bits are: - -AI_V4MAPPED - - -This is used with an -af -of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped -IPv6 addresses. - - -AI_ALL - - -This is used with an -af -of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. -If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped -IPv6 addresses. - - -AI_ADDRCONFIG - - -Only return an IPv6 or IPv4 address if here is an active network -interface of that type. This is not currently implemented -in the BIND 9 lightweight resolver, and the flag is ignored. - - -AI_DEFAULT - - -This default sets the -AI_V4MAPPED -and -AI_ADDRCONFIG -flag bits. - - - - - -lwres_getipnodebyaddr() -performs a reverse lookup -of address -src -which is -len -bytes long. -af -denotes the protocol family, typically -PF_INET -or -PF_INET6. + lwres_getipnodebyname() + looks up addresses of protocol family af + for the hostname name. The + flags parameter contains ORed flag bits + to specify the types of addresses that are searched for, and the + types of addresses that are returned. The flag bits are: - - -lwres_freehostent() -releases all the memory associated with -the -struct hostent -pointer -he. + + + AI_V4MAPPED + + + This is used with an + af + of AF_INET6, and causes IPv4 addresses to be returned as + IPv4-mapped + IPv6 addresses. + + + + + AI_ALL + + + This is used with an + af + of AF_INET6, and causes all known addresses (IPv6 and IPv4) to + be returned. + If AI_V4MAPPED is also set, the IPv4 addresses are return as + mapped + IPv6 addresses. + + + + + AI_ADDRCONFIG + + + Only return an IPv6 or IPv4 address if here is an active network + interface of that type. This is not currently implemented + in the BIND 9 lightweight resolver, and the flag is ignored. + + + + + AI_DEFAULT + + + This default sets the + AI_V4MAPPED + and + AI_ADDRCONFIG + flag bits. + + + + + -Any memory allocated for the -h_name, + lwres_getipnodebyaddr() + performs a reverse lookup of address src + which is len bytes long. + af denotes the protocol family, typically + PF_INET or PF_INET6. + + lwres_freehostent() + releases all the memory associated with the struct + hostent pointer he. Any memory + allocated for the h_name, + h_addr_list and + h_aliases is freed, as is the memory for + the hostent structure itself. + + + + RETURN VALUES + + If an error occurs, + lwres_getipnodebyname() + and + lwres_getipnodebyaddr() + set + *error_num + to an appropriate error code and the function returns a + NULL + pointer. + The error codes and their meanings are defined in + <lwres/netdb.h>: + + + HOST_NOT_FOUND + + + No such host is known. + + + + + NO_ADDRESS + + + The server recognised the request and the name but no address is + available. Another type of request to the name server for the + domain might return an answer. + + + + + TRY_AGAIN + + + A temporary and possibly transient error occurred, such as a + failure of a server to respond. The request may succeed if + retried. + + + + + NO_RECOVERY + + + An unexpected failure occurred, and retrying the request + is pointless. + + + + + + + lwres_hstrerror3 + + translates these error codes to suitable error messages. + + + + SEE ALSO + + RFC2553 + , -h_addr_list -and -h_aliases -is freed, as is the memory for the -hostent -structure itself. - - - -RETURN VALUES - -If an error occurs, -lwres_getipnodebyname() -and -lwres_getipnodebyaddr() -set -*error_num -to an appropriate error code and the function returns a -NULL -pointer. -The error codes and their meanings are defined in -<lwres/netdb.h>: - -HOST_NOT_FOUND - - -No such host is known. - - -NO_ADDRESS - - -The server recognised the request and the name but no address is -available. Another type of request to the name server for the -domain might return an answer. - - -TRY_AGAIN - - -A temporary and possibly transient error occurred, such as a -failure of a server to respond. The request may succeed if -retried. - - -NO_RECOVERY - - -An unexpected failure occurred, and retrying the request -is pointless. - - - - - - -lwres_hstrerror3 - - -translates these error codes to suitable error messages. - - - -SEE ALSO - - -RFC2553 -, + + lwres3 + , - -lwres3 -, + + lwres_gethostent3 + , - -lwres_gethostent3 -, + + lwres_getaddrinfo3 + , - -lwres_getaddrinfo3 -, + + lwres_getnameinfo3 + , - -lwres_getnameinfo3 -, - - -lwres_hstrerror3 -. - - - + + lwres_hstrerror3 + . + + + diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html index d38c835eb0d..e080b935d8b 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_getipnode.html @@ -1,5 +1,5 @@ - + lwres_getipnode - +
-
+

Name

lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent — lightweight resolver nodename / address translation API

@@ -36,29 +36,27 @@ struct hostent * lwres_getipnodebyname( -  -, - - -  -  -, +const char *  + +name,   -  -, +int   + +af,   -  -, +int   + +flags,   -  +int *  -); +error_num); @@ -66,62 +64,52 @@ struct hostent * - - - - - - - + + - - + + - - + + - + +error_num);
struct hostent * lwres_getipnodebyaddr( ,
  , const void *  +src,
  , size_t   +len,
  , int   +af,
  int *  -);
- - +
- - - - - - + - -
void lwres_freehostent(  -);
  struct hostent *  -);
+he); +
-

DESCRIPTION

+

DESCRIPTION

-These functions perform thread safe, protocol independent -nodename-to-address and address-to-nodename -translation as defined in RFC2553. -

+ These functions perform thread safe, protocol independent + nodename-to-address and address-to-nodename + translation as defined in RFC2553. +

-They use a -struct hostent -which is defined in -namedb.h: -

+ They use a + struct hostent + which is defined in + namedb.h: +

 struct  hostent {
         char    *h_name;        /* official name of host */
@@ -133,184 +121,159 @@ struct  hostent {
 #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
 

-

+

-The members of this structure are: -

+ The members of this structure are: +

h_name

-The official (canonical) name of the host. -

+ The official (canonical) name of the host. +

h_aliases

-A NULL-terminated array of alternate names (nicknames) for the host. -

+ A NULL-terminated array of alternate names (nicknames) for the + host. +

h_addrtype

-The type of address being returned - usually -PF_INET -or -PF_INET6. + The type of address being returned - usually + PF_INET + or + PF_INET6. -

+

h_length

-The length of the address in bytes. -

+ The length of the address in bytes. +

h_addr_list

-A -NULL -terminated array of network addresses for the host. -Host addresses are returned in network byte order. -

+ A + NULL + terminated array of network addresses for the host. + Host addresses are returned in network byte order. +

-

-

-lwres_getipnodebyname() -looks up addresses of protocol family -af - -for the hostname -name. +

+

lwres_getipnodebyname() + looks up addresses of protocol family af + for the hostname name. The + flags parameter contains ORed flag bits + to specify the types of addresses that are searched for, and the + types of addresses that are returned. The flag bits are: -The -flags -parameter contains ORed flag bits to -specify the types of addresses that are searched -for, and the types of addresses that are returned. -The flag bits are: -

+

AI_V4MAPPED

-This is used with an -af -of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped -IPv6 addresses. -

+ This is used with an + af + of AF_INET6, and causes IPv4 addresses to be returned as + IPv4-mapped + IPv6 addresses. +

AI_ALL

-This is used with an -af -of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. -If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped -IPv6 addresses. -

+ This is used with an + af + of AF_INET6, and causes all known addresses (IPv6 and IPv4) to + be returned. + If AI_V4MAPPED is also set, the IPv4 addresses are return as + mapped + IPv6 addresses. +

AI_ADDRCONFIG

-Only return an IPv6 or IPv4 address if here is an active network -interface of that type. This is not currently implemented -in the BIND 9 lightweight resolver, and the flag is ignored. -

+ Only return an IPv6 or IPv4 address if here is an active network + interface of that type. This is not currently implemented + in the BIND 9 lightweight resolver, and the flag is ignored. +

AI_DEFAULT

-This default sets the -AI_V4MAPPED -and -AI_ADDRCONFIG -flag bits. -

+ This default sets the + AI_V4MAPPED + and + AI_ADDRCONFIG + flag bits. +

-

-

-lwres_getipnodebyaddr() -performs a reverse lookup -of address -src -which is -len -bytes long. -af -denotes the protocol family, typically -PF_INET -or -PF_INET6. - -

-

-lwres_freehostent() -releases all the memory associated with -the -struct hostent -pointer -he. - -Any memory allocated for the -h_name, - -h_addr_list -and -h_aliases -is freed, as is the memory for the -hostent -structure itself. -

+

+

lwres_getipnodebyaddr() + performs a reverse lookup of address src + which is len bytes long. + af denotes the protocol family, typically + PF_INET or PF_INET6. +

+

lwres_freehostent() + releases all the memory associated with the struct + hostent pointer he. Any memory + allocated for the h_name, + h_addr_list and + h_aliases is freed, as is the memory for + the hostent structure itself. +

-

RETURN VALUES

+

RETURN VALUES

-If an error occurs, -lwres_getipnodebyname() -and -lwres_getipnodebyaddr() -set -*error_num -to an appropriate error code and the function returns a -NULL -pointer. -The error codes and their meanings are defined in -<lwres/netdb.h>: -

+ If an error occurs, + lwres_getipnodebyname() + and + lwres_getipnodebyaddr() + set + *error_num + to an appropriate error code and the function returns a + NULL + pointer. + The error codes and their meanings are defined in + <lwres/netdb.h>: +

HOST_NOT_FOUND

-No such host is known. -

+ No such host is known. +

NO_ADDRESS

-The server recognised the request and the name but no address is -available. Another type of request to the name server for the -domain might return an answer. -

+ The server recognised the request and the name but no address is + available. Another type of request to the name server for the + domain might return an answer. +

TRY_AGAIN

-A temporary and possibly transient error occurred, such as a -failure of a server to respond. The request may succeed if -retried. -

+ A temporary and possibly transient error occurred, such as a + failure of a server to respond. The request may succeed if + retried. +

NO_RECOVERY

-An unexpected failure occurred, and retrying the request -is pointless. -

+ An unexpected failure occurred, and retrying the request + is pointless. +

-

-

-lwres_hstrerror(3 -) -translates these error codes to suitable error messages. -

+

+

lwres_hstrerror(3) + translates these error codes to suitable error messages. +

-

SEE ALSO

-

-RFC2553, +

SEE ALSO

+

RFC2553, -lwres(3), + lwres(3), -lwres_gethostent(3), + lwres_gethostent(3), -lwres_getaddrinfo(3), + lwres_getaddrinfo(3), -lwres_getnameinfo(3), + lwres_getnameinfo(3), -lwres_hstrerror(3). -

+ lwres_hstrerror(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html b/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html index 32cfef61d5f..6a3784b47f2 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_getnameinfo.html @@ -1,5 +1,5 @@ - + lwres_getnameinfo - +
-
+

Name

-

lwres_getnameinfo — lightweight resolver socket address structure to hostname and service name

+

lwres_getnameinfo — lightweight resolver socket address structure to hostname and + service name +

Synopsis

@@ -36,124 +38,139 @@ int lwres_getnameinfo( -  -, - - -  -  -, +const struct sockaddr *  + +sa,   -  -, +size_t   + +salen,   -  -, +char *  + +host,   -  -, +size_t   + +hostlen,   -  -, +char *  + +serv,   -  -, +size_t   + +servlen,   -  +int   -); +flags);
-

DESCRIPTION

-

This function is equivalent to the getnameinfo(3) function defined in RFC2133. -lwres_getnameinfo() returns the hostname for the -struct sockaddr sa which is -salen bytes long. The hostname is of length -hostlen and is returned via -*host. The maximum length of the hostname is -1025 bytes: NI_MAXHOST.

+

DESCRIPTION

+

+ This function is equivalent to the + getnameinfo(3) function defined in RFC2133. + lwres_getnameinfo() returns the + hostname for the + struct sockaddr sa which + is + salen bytes long. The hostname is of + length + hostlen and is returned via + *host. The maximum length of the + hostname is + 1025 bytes: NI_MAXHOST. +

The name of the service associated with the port number in -sa is returned in *serv. -It is servlen bytes long. The maximum length -of the service name is NI_MAXSERV - 32 bytes. -

-

The flags argument sets the following -bits: -

+ sa is returned in *serv. + It is servlen bytes long. The + maximum length + of the service name is NI_MAXSERV - 32 + bytes. +

+

+ The flags argument sets the + following + bits: +

NI_NOFQDN

-A fully qualified domain name is not required for local hosts. -The local part of the fully qualified domain name is returned instead. -

+ A fully qualified domain name is not required for local hosts. + The local part of the fully qualified domain name is returned + instead. +

NI_NUMERICHOST

-Return the address in numeric form, as if calling inet_ntop(), -instead of a host name. -

+ Return the address in numeric form, as if calling inet_ntop(), + instead of a host name. +

NI_NAMEREQD

-A name is required. If the hostname cannot be found in the DNS and -this flag is set, a non-zero error code is returned. -If the hostname is not found and the flag is not set, the -address is returned in numeric form. -

+ A name is required. If the hostname cannot be found in the DNS + and + this flag is set, a non-zero error code is returned. + If the hostname is not found and the flag is not set, the + address is returned in numeric form. +

NI_NUMERICSERV

-The service name is returned as a digit string representing the port number. -

+ The service name is returned as a digit string representing the + port number. +

NI_DGRAM

-Specifies that the service being looked up is a datagram -service, and causes getservbyport() to be called with a second -argument of "udp" instead of its default of "tcp". This is required -for the few ports (512-514) that have different services for UDP and -TCP. -

+ Specifies that the service being looked up is a datagram + service, and causes getservbyport() to be called with a second + argument of "udp" instead of its default of "tcp". This is + required + for the few ports (512-514) that have different services for UDP + and + TCP. +

-

+

-

RETURN VALUES

-

-lwres_getnameinfo() -returns 0 on success or a non-zero error code if an error occurs. -

+

RETURN VALUES

+

lwres_getnameinfo() + returns 0 on success or a non-zero error code if an error occurs. +

-

SEE ALSO

-

-RFC2133, -getservbyport(3), -lwres(3), -lwres_getnameinfo(3), -lwres_getnamebyaddr(3). -lwres_net_ntop(3). -

+

SEE ALSO

+

RFC2133, + getservbyport(3), + lwres(3), + lwres_getnameinfo(3), + lwres_getnamebyaddr(3). + lwres_net_ntop(3). +

-

BUGS

+

BUGS

-RFC2133 fails to define what the nonzero return values of -getnameinfo(3) -are. -

+ RFC2133 fails to define what the nonzero return values of + getnameinfo(3) + are. +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html b/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html index 75b4f5b5ede..76d5736f5a7 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_getrrsetbyname.html @@ -1,5 +1,5 @@ - + lwres_getrrsetbyname - +
-
+

Name

lwres_getrrsetbyname, lwres_freerrset — retrieve DNS records

@@ -36,62 +36,56 @@ int lwres_getrrsetbyname( -  -, - - -  -  -, +const char *  + +hostname,   -  -, +unsigned int   + +rdclass,   -  -, +unsigned int   + +rdtype,   -  -, +unsigned int   + +flags,   -  +struct rrsetinfo **  -); +res); - - +
- - - - - - + - -
void lwres_freerrset(  -);
  struct rrsetinfo *  -);
+rrset); +

-The following structures are used: -

+ The following structures are used: +

 struct  rdatainfo {
         unsigned int            rdi_length;     /* length of data */
         unsigned char           *rdi_data;      /* record data */
 };
-
+
+

+

+
 struct  rrsetinfo {
         unsigned int            rri_flags;      /* RRSET_VALIDATED... */
         unsigned int            rri_rdclass;    /* class number */
@@ -105,126 +99,94 @@ struct  rrsetinfo {
 };
 

-

+

-

DESCRIPTION

-

-lwres_getrrsetbyname() -gets a set of resource records associated with a -hostname, - -class, - -and -type. - -hostname -is -a pointer a to null-terminated string. The -flags -field is currently unused and must be zero. -

+

DESCRIPTION

+

lwres_getrrsetbyname() + gets a set of resource records associated with a + hostname, class, + and type. + hostname is a pointer a to + null-terminated string. The flags field + is currently unused and must be zero. +

-After a successful call to -lwres_getrrsetbyname(), - -*res -is a pointer to an -rrsetinfo -structure, containing a list of one or more -rdatainfo -structures containing resource records and potentially another list of -rdatainfo -structures containing SIG resource records -associated with those records. -The members -rri_rdclass -and -rri_rdtype -are copied from the parameters. -rri_ttl -and -rri_name -are properties of the obtained rrset. -The resource records contained in -rri_rdatas -and -rri_sigs -are in uncompressed DNS wire format. -Properties of the rdataset are represented in the -rri_flags -bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC -validated and the signatures verified. -

+ After a successful call to + lwres_getrrsetbyname(), + *res is a pointer to an + rrsetinfo structure, containing a list of one or + more rdatainfo structures containing resource + records and potentially another list of rdatainfo + structures containing SIG resource records associated with those + records. The members rri_rdclass and + rri_rdtype are copied from the parameters. + rri_ttl and rri_name + are properties of the obtained rrset. The resource records + contained in rri_rdatas and + rri_sigs are in uncompressed DNS wire + format. Properties of the rdataset are represented in the + rri_flags bitfield. If the RRSET_VALIDATED + bit is set, the data has been DNSSEC validated and the + signatures verified. +

-All of the information returned by -lwres_getrrsetbyname() -is dynamically allocated: the -rrsetinfo -and -rdatainfo -structures, -and the canonical host name strings pointed to by the -rrsetinfostructure. - -Memory allocated for the dynamically allocated structures created by -a successful call to -lwres_getrrsetbyname() -is released by -lwres_freerrset(). + All of the information returned by + lwres_getrrsetbyname() is dynamically + allocated: the rrsetinfo and + rdatainfo structures, and the canonical + host name strings pointed to by the + rrsetinfostructure. -rrset -is a pointer to a -struct rrset -created by a call to -lwres_getrrsetbyname(). + Memory allocated for the dynamically allocated structures + created by a successful call to + lwres_getrrsetbyname() is released by + lwres_freerrset(). -

-

-

+ rrset is a pointer to a struct + rrset created by a call to + lwres_getrrsetbyname(). +

+

-

RETURN VALUES

-

-lwres_getrrsetbyname() -returns zero on success, and one of the following error -codes if an error occurred: -

+

RETURN VALUES

+

lwres_getrrsetbyname() + returns zero on success, and one of the following error codes if + an error occurred: +

ERRSET_NONAME

-the name does not exist -

+ the name does not exist +

ERRSET_NODATA

-the name exists, but does not have data of the desired type -

+ the name exists, but does not have data of the desired type +

ERRSET_NOMEMORY

-memory could not be allocated -

+ memory could not be allocated +

ERRSET_INVAL

-a parameter is invalid -

+ a parameter is invalid +

ERRSET_FAIL

-other failure -

+ other failure +

-

-

+

-

+

-

SEE ALSO

-

-lwres(3). -

+

SEE ALSO

+

lwres(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_gnba.html b/usr.sbin/bind/lib/lwres/man/lwres_gnba.html index 3d898597e4c..8883db6cb96 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_gnba.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_gnba.html @@ -1,5 +1,5 @@ - + lwres_gnba - +
-
+

Name

lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free — lightweight resolver getnamebyaddress message handling

@@ -39,31 +39,25 @@ lwres_result_t lwres_gnbarequest_render (
-  - -ctx, - - -  -  +lwres_context_t *  ctx,   -  +lwres_gnbarequest_t *  req,   -  +lwres_lwpacket_t *  pkt,   -  +lwres_buffer_t *  b); @@ -74,29 +68,27 @@ lwres_result_t lwres_result_t lwres_gnbaresponse_render (
-  -, - - -  -  -, +lwres_context_t *  + +ctx,   -  -, +lwres_gnbaresponse_t *  + +req,   -  -, +lwres_lwpacket_t *  + +pkt,   -  +lwres_buffer_t *  -); +b); @@ -104,29 +96,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_gnbarequest_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_gnbarequest_t **  -);
@@ -134,29 +124,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_gnbaresponse_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_gnbaresponse_t **  -);
@@ -165,19 +153,15 @@ lwres_result_t void lwres_gnbaresponse_free ( - - - - - - - + + - + +structp);
 ,
  , lwres_context_t *  +ctx,
  lwres_gnbaresponse_t **  -);
@@ -185,56 +169,59 @@ void - - - - - - - + + - + +structp);
void lwres_gnbarequest_free( ,
  , lwres_context_t *  +ctx,
  lwres_gnbarequest_t **  -);
-

DESCRIPTION

+

DESCRIPTION

-These are low-level routines for creating and parsing -lightweight resolver address-to-name lookup request and -response messages. -

+ These are low-level routines for creating and parsing + lightweight resolver address-to-name lookup request and + response messages. +

-There are four main functions for the getnamebyaddr opcode. -One render function converts a getnamebyaddr request structure — -lwres_gnbarequest_t — -to the lightweight resolver's canonical format. -It is complemented by a parse function that converts a packet in this -canonical format to a getnamebyaddr request structure. -Another render function converts the getnamebyaddr response structure — -lwres_gnbaresponse_t -to the canonical format. -This is complemented by a parse function which converts a packet in -canonical format to a getnamebyaddr response structure. -

+ There are four main functions for the getnamebyaddr opcode. + One render function converts a getnamebyaddr request structure — + lwres_gnbarequest_t — + to the lightweight resolver's canonical format. + It is complemented by a parse function that converts a packet in this + canonical format to a getnamebyaddr request structure. + Another render function converts the getnamebyaddr response structure + — + lwres_gnbaresponse_t + to the canonical format. + This is complemented by a parse function which converts a packet in + canonical format to a getnamebyaddr response structure. +

-These structures are defined in -lwres/lwres.h. -They are shown below. -

+ These structures are defined in + lwres/lwres.h. + They are shown below. +

 #define LWRES_OPCODE_GETNAMEBYADDR      0x00010002U
-
+
+

+

+
 typedef struct {
         lwres_uint32_t  flags;
         lwres_addr_t    addr;
 } lwres_gnbarequest_t;
-
+
+

+

+
 typedef struct {
         lwres_uint32_t  flags;
         lwres_uint16_t  naliases;
@@ -247,109 +234,83 @@ typedef struct {
 } lwres_gnbaresponse_t;
 

-

-

-lwres_gnbarequest_render() -uses resolver context -ctx -to convert getnamebyaddr request structure -req -to canonical format. -The packet header structure -pkt -is initialised and transferred to -buffer -b. -The contents of -*req -are then appended to the buffer in canonical format. -lwres_gnbaresponse_render() -performs the same task, except it converts a getnamebyaddr response structure -lwres_gnbaresponse_t -to the lightweight resolver's canonical format. -

-

-lwres_gnbarequest_parse() -uses context -ctx -to convert the contents of packet -pkt -to a -lwres_gnbarequest_t -structure. -Buffer -b -provides space to be used for storing this structure. -When the function succeeds, the resulting -lwres_gnbarequest_t -is made available through -*structp. -lwres_gnbaresponse_parse() -offers the same semantics as -lwres_gnbarequest_parse() -except it yields a -lwres_gnbaresponse_t -structure. -

-

-lwres_gnbaresponse_free() -and -lwres_gnbarequest_free() -release the memory in resolver context -ctx -that was allocated to the -lwres_gnbaresponse_t -or -lwres_gnbarequest_t -structures referenced via -structp. -Any memory associated with ancillary buffers and strings for those -structures is also discarded. -

+

+

lwres_gnbarequest_render() + uses resolver context ctx to convert + getnamebyaddr request structure req to + canonical format. The packet header structure + pkt is initialised and transferred to buffer + b. The contents of *req + are then appended to the buffer in canonical format. + lwres_gnbaresponse_render() performs the + same task, except it converts a getnamebyaddr response structure + lwres_gnbaresponse_t to the lightweight resolver's + canonical format. +

+

lwres_gnbarequest_parse() + uses context ctx to convert the contents of + packet pkt to a + lwres_gnbarequest_t structure. Buffer + b provides space to be used for storing this + structure. When the function succeeds, the resulting + lwres_gnbarequest_t is made available through + *structp. + lwres_gnbaresponse_parse() offers the same + semantics as lwres_gnbarequest_parse() + except it yields a lwres_gnbaresponse_t structure. +

+

lwres_gnbaresponse_free() + and lwres_gnbarequest_free() release the + memory in resolver context ctx that was + allocated to the lwres_gnbaresponse_t or + lwres_gnbarequest_t structures referenced via + structp. Any memory associated with + ancillary buffers and strings for those structures is also + discarded. +

-

RETURN VALUES

+

RETURN VALUES

-The getnamebyaddr opcode functions -lwres_gnbarequest_render(), -lwres_gnbaresponse_render() -lwres_gnbarequest_parse() -and -lwres_gnbaresponse_parse() -all return -LWRES_R_SUCCESS -on success. -They return -LWRES_R_NOMEMORY -if memory allocation fails. -LWRES_R_UNEXPECTEDEND -is returned if the available space in the buffer -b -is too small to accommodate the packet header or the -lwres_gnbarequest_t -and -lwres_gnbaresponse_t -structures. -lwres_gnbarequest_parse() -and -lwres_gnbaresponse_parse() -will return -LWRES_R_UNEXPECTEDEND -if the buffer is not empty after decoding the received packet. -These functions will return -LWRES_R_FAILURE -if -pktflags -in the packet header structure -lwres_lwpacket_t -indicate that the packet is not a response to an earlier query. -

+ The getnamebyaddr opcode functions + lwres_gnbarequest_render(), + lwres_gnbaresponse_render() + lwres_gnbarequest_parse() + and + lwres_gnbaresponse_parse() + all return + LWRES_R_SUCCESS + on success. + They return + LWRES_R_NOMEMORY + if memory allocation fails. + LWRES_R_UNEXPECTEDEND + is returned if the available space in the buffer + b + is too small to accommodate the packet header or the + lwres_gnbarequest_t + and + lwres_gnbaresponse_t + structures. + lwres_gnbarequest_parse() + and + lwres_gnbaresponse_parse() + will return + LWRES_R_UNEXPECTEDEND + if the buffer is not empty after decoding the received packet. + These functions will return + LWRES_R_FAILURE + if + pktflags + in the packet header structure + lwres_lwpacket_t + indicate that the packet is not a response to an earlier query. +

-

SEE ALSO

-

-lwres_packet(3). -

+

SEE ALSO

+

lwres_packet(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html b/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html index 6e7c5ba70b2..a6af72b86e5 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_hstrerror.html @@ -1,5 +1,5 @@ - + lwres_hstrerror - +
-
+

Name

lwres_herror, lwres_hstrerror — lightweight resolver error message generation

@@ -31,70 +31,74 @@

Synopsis

#include <lwres/netdb.h>
-

+ + + + +
void -lwres_herror(const char *s);

-

+lwres_herror(

const char *  +s);
+ + + + +
const char * -lwres_hstrerror(int err);

+lwres_hstrerror(
int   +err);

-

DESCRIPTION

-

-lwres_herror() prints the string -s on stderr followed by the string -generated by lwres_hstrerror() for the error code -stored in the global variable lwres_h_errno. -

-

-lwres_hstrerror() returns an appropriate string -for the error code gievn by err. The values of -the error codes and messages are as follows: +

DESCRIPTION

+

lwres_herror() + prints the string s on + stderr followed by the string generated by + lwres_hstrerror() for the error code stored + in the global variable lwres_h_errno. +

+

lwres_hstrerror() + returns an appropriate string for the error code gievn by + err. The values of the error codes and + messages are as follows: -

+

NETDB_SUCCESS
-

-Resolver Error 0 (no error) -

+

Resolver Error 0 (no error) +

HOST_NOT_FOUND
-

-Unknown host -

+

Unknown host +

TRY_AGAIN
-

-Host name lookup failure -

+

Host name lookup failure +

NO_RECOVERY
-

-Unknown server error -

+

Unknown server error +

NO_DATA
-

-No address associated with name -

+

No address associated with name +

-

+

-

RETURN VALUES

+

RETURN VALUES

-The string Unknown resolver error is returned by -lwres_hstrerror() -when the value of -lwres_h_errno -is not a valid error code. -

+ The string Unknown resolver error is returned by + lwres_hstrerror() + when the value of + lwres_h_errno + is not a valid error code. +

-

SEE ALSO

-

-herror(3), +

SEE ALSO

+

herror(3), -lwres_hstrerror(3). -

+ lwres_hstrerror(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html b/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html index e4dda3765e3..1cf90daf0d0 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_inetntop.html @@ -1,5 +1,5 @@ - + lwres_inetntop - +
-
+

Name

lwres_net_ntop — lightweight resolver IP address presentation

@@ -36,68 +36,68 @@ const char * lwres_net_ntop( -  -, - - -  -  -, +int   + +af,   -  -, +const void *  + +src,   -  -, +char *  + +dst,   -  +size_t   -); +size);
-

DESCRIPTION

-

-lwres_net_ntop() converts an IP address of -protocol family af — IPv4 or IPv6 — -at location src from network format to its -conventional representation as a string. For IPv4 addresses, that -string would be a dotted-decimal. An IPv6 address would be -represented in colon notation as described in RFC1884. -

+

DESCRIPTION

+

lwres_net_ntop() + converts an IP address of protocol family + af — IPv4 or IPv6 — at + location src from network format to its + conventional representation as a string. For IPv4 addresses, + that string would be a dotted-decimal. An IPv6 address would be + represented in colon notation as described in RFC1884. +

-The generated string is copied to dst provided -size indicates it is long enough to store the -ASCII representation of the address. -

+ The generated string is copied to dst + provided + size indicates it is long enough to + store the + ASCII representation of the address. +

-

RETURN VALUES

+

RETURN VALUES

-If successful, the function returns dst: -a pointer to a string containing the presentation format of the -address. lwres_net_ntop() returns -NULL and sets the global variable -errno to EAFNOSUPPORT if -the protocol family given in af is not -supported. -

+ If successful, the function returns dst: + a pointer to a string containing the presentation format of the + address. lwres_net_ntop() returns + NULL and sets the global variable + errno to EAFNOSUPPORT if + the protocol family given in af is + not + supported. +

-

SEE ALSO

-

-RFC1884, -inet_ntop(3), -errno(3). -

+

SEE ALSO

+

RFC1884, + inet_ntop(3), + errno(3). +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_noop.html b/usr.sbin/bind/lib/lwres/man/lwres_noop.html index d47af0cb2b5..b83dc29c79a 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_noop.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_noop.html @@ -1,5 +1,5 @@ - + lwres_noop - +
-
+

Name

lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free — lightweight resolver no-op message handling

@@ -37,29 +37,27 @@ lwres_result_t lwres_nooprequest_render( -  -, - - -  -  -, +lwres_context_t *  + +ctx,   -  -, +lwres_nooprequest_t *  + +req,   -  -, +lwres_lwpacket_t *  + +pkt,   -  +lwres_buffer_t *  -); +b); @@ -67,29 +65,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +b);
lwres_result_t lwres_noopresponse_render( ,
  , lwres_context_t *  +ctx,
  , lwres_noopresponse_t *  +req,
  , lwres_lwpacket_t *  +pkt,
  lwres_buffer_t *  -);
@@ -97,29 +93,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_nooprequest_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_nooprequest_t **  -);
@@ -127,29 +121,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_noopresponse_parse( ,
  , lwres_context_t *  +ctx,
  , lwres_buffer_t *  +b,
  , lwres_lwpacket_t *  +pkt,
  lwres_noopresponse_t **  -);
@@ -157,19 +149,15 @@ lwres_result_t - - - - - - - + + - + +structp);
void lwres_noopresponse_free( ,
  , lwres_context_t *  +ctx,
  lwres_noopresponse_t **  -);
@@ -177,149 +165,153 @@ void - - - - - - - + + - + +structp);
void lwres_nooprequest_free( ,
  , lwres_context_t *  +ctx,
  lwres_nooprequest_t **  -);
-

DESCRIPTION

+

DESCRIPTION

-These are low-level routines for creating and parsing -lightweight resolver no-op request and response messages. -

+ These are low-level routines for creating and parsing + lightweight resolver no-op request and response messages. +

-The no-op message is analogous to a ping packet: -a packet is sent to the resolver daemon and is simply echoed back. -The opcode is intended to allow a client to determine if the server is -operational or not. -

+ The no-op message is analogous to a ping + packet: + a packet is sent to the resolver daemon and is simply echoed back. + The opcode is intended to allow a client to determine if the server is + operational or not. +

-There are four main functions for the no-op opcode. -One render function converts a no-op request structure — -lwres_nooprequest_t — -to the lighweight resolver's canonical format. -It is complemented by a parse function that converts a packet in this -canonical format to a no-op request structure. -Another render function converts the no-op response structure — -lwres_noopresponse_t -to the canonical format. -This is complemented by a parse function which converts a packet in -canonical format to a no-op response structure. -

+ There are four main functions for the no-op opcode. + One render function converts a no-op request structure — + lwres_nooprequest_t — + to the lighweight resolver's canonical format. + It is complemented by a parse function that converts a packet in this + canonical format to a no-op request structure. + Another render function converts the no-op response structure — + lwres_noopresponse_t + to the canonical format. + This is complemented by a parse function which converts a packet in + canonical format to a no-op response structure. +

-These structures are defined in -lwres/lwres.h. + These structures are defined in + lwres/lwres.h. -They are shown below. -

+ They are shown below. +

 #define LWRES_OPCODE_NOOP       0x00000000U
-
+
+

+

+
 typedef struct {
         lwres_uint16_t  datalength;
         unsigned char   *data;
 } lwres_nooprequest_t;
-
+
+

+

+
 typedef struct {
         lwres_uint16_t  datalength;
         unsigned char   *data;
 } lwres_noopresponse_t;
 

-Although the structures have different types, they are identical. -This is because the no-op opcode simply echos whatever data was sent: -the response is therefore identical to the request. -

-

-lwres_nooprequest_render() uses resolver -context ctx to convert no-op request structure -req to canonical format. The packet header -structure pkt is initialised and transferred to -buffer b. The contents of -*req are then appended to the buffer in -canonical format. lwres_noopresponse_render() -performs the same task, except it converts a no-op response structure -lwres_noopresponse_t to the lightweight resolver's -canonical format. -

+

-lwres_nooprequest_parse() uses context -ctx to convert the contents of packet -pkt to a lwres_nooprequest_t -structure. Buffer b provides space to be used -for storing this structure. When the function succeeds, the resulting -lwres_nooprequest_t is made available through -*structp. -lwres_noopresponse_parse() offers the same -semantics as lwres_nooprequest_parse() except it -yields a lwres_noopresponse_t structure. -

-

-lwres_noopresponse_free() and -lwres_nooprequest_free() release the memory in -resolver context ctx that was allocated to the -lwres_noopresponse_t or lwres_nooprequest_t -structures referenced via structp. -

+ Although the structures have different types, they are identical. + This is because the no-op opcode simply echos whatever data was sent: + the response is therefore identical to the request. +

+

lwres_nooprequest_render() + uses resolver context ctx to convert + no-op request structure req to canonical + format. The packet header structure pkt + is initialised and transferred to buffer + b. The contents of + *req are then appended to the buffer in + canonical format. + lwres_noopresponse_render() performs the + same task, except it converts a no-op response structure + lwres_noopresponse_t to the lightweight resolver's + canonical format. +

+

lwres_nooprequest_parse() + uses context ctx to convert the contents + of packet pkt to a + lwres_nooprequest_t structure. Buffer + b provides space to be used for storing + this structure. When the function succeeds, the resulting + lwres_nooprequest_t is made available through + *structp. + lwres_noopresponse_parse() offers the same + semantics as lwres_nooprequest_parse() + except it yields a lwres_noopresponse_t structure. +

+

lwres_noopresponse_free() + and lwres_nooprequest_free() release the + memory in resolver context ctx that was + allocated to the lwres_noopresponse_t or + lwres_nooprequest_t structures referenced via + structp. +

-

RETURN VALUES

+

RETURN VALUES

-The no-op opcode functions -lwres_nooprequest_render(), + The no-op opcode functions + lwres_nooprequest_render(), -lwres_noopresponse_render() -lwres_nooprequest_parse() -and -lwres_noopresponse_parse() -all return -LWRES_R_SUCCESS -on success. -They return -LWRES_R_NOMEMORY -if memory allocation fails. -LWRES_R_UNEXPECTEDEND -is returned if the available space in the buffer -b -is too small to accommodate the packet header or the -lwres_nooprequest_t -and -lwres_noopresponse_t -structures. -lwres_nooprequest_parse() -and -lwres_noopresponse_parse() -will return -LWRES_R_UNEXPECTEDEND -if the buffer is not empty after decoding the received packet. -These functions will return -LWRES_R_FAILURE -if -pktflags -in the packet header structure -lwres_lwpacket_t -indicate that the packet is not a response to an earlier query. -

+ lwres_noopresponse_render() + lwres_nooprequest_parse() + and + lwres_noopresponse_parse() + all return + LWRES_R_SUCCESS + on success. + They return + LWRES_R_NOMEMORY + if memory allocation fails. + LWRES_R_UNEXPECTEDEND + is returned if the available space in the buffer + b + is too small to accommodate the packet header or the + lwres_nooprequest_t + and + lwres_noopresponse_t + structures. + lwres_nooprequest_parse() + and + lwres_noopresponse_parse() + will return + LWRES_R_UNEXPECTEDEND + if the buffer is not empty after decoding the received packet. + These functions will return + LWRES_R_FAILURE + if + pktflags + in the packet header structure + lwres_lwpacket_t + indicate that the packet is not a response to an earlier query. +

-

SEE ALSO

-

-lwres_packet(3 -) -

+

SEE ALSO

+

lwres_packet(3) +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_packet.html b/usr.sbin/bind/lib/lwres/man/lwres_packet.html index 1c650db7469..2c2700548ca 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_packet.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_packet.html @@ -1,5 +1,5 @@ - + lwres_packet - +
-
+

Name

lwres_lwpacket_renderheader, lwres_lwpacket_parseheader — lightweight resolver packet handling functions

@@ -36,19 +36,15 @@ lwres_result_t lwres_lwpacket_renderheader( -  -, - - -  -  -, +lwres_buffer_t *  + +b,   -  +lwres_lwpacket_t *  -); +pkt); @@ -56,35 +52,33 @@ lwres_result_t - - - - - - - + + - + +pkt);
lwres_result_t lwres_lwpacket_parseheader( ,
  , lwres_buffer_t *  +b,
  lwres_lwpacket_t *  -);
-

DESCRIPTION

+

DESCRIPTION

-These functions rely on a -struct lwres_lwpacket -which is defined in -lwres/lwpacket.h. - -

+ These functions rely on a + struct lwres_lwpacket + which is defined in + lwres/lwpacket.h. +

 typedef struct lwres_lwpacket lwres_lwpacket_t;
-
+      
+

+

+
 struct lwres_lwpacket {
         lwres_uint32_t          length;
         lwres_uint16_t          version;
@@ -98,129 +92,144 @@ struct lwres_lwpacket {
 };
 

-

+

-The elements of this structure are: -

+ The elements of this structure are: +

length

-the overall packet length, including the entire packet header. -This field is filled in by the lwres_gabn_*() and lwres_gnba_*() -calls. -

+ the overall packet length, including the entire packet header. + This field is filled in by the lwres_gabn_*() and lwres_gnba_*() + calls. +

version

-the header format. There is currently only one format, -LWRES_LWPACKETVERSION_0. + the header format. There is currently only one format, + LWRES_LWPACKETVERSION_0. -This field is filled in by the lwres_gabn_*() and lwres_gnba_*() -calls. -

+ This field is filled in by the lwres_gabn_*() and lwres_gnba_*() + calls. +

pktflags

-library-defined flags for this packet: for instance whether the packet -is a request or a reply. Flag values can be set, but not defined by -the caller. -This field is filled in by the application wit the exception of the -LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the -lwres_gabn_*() and lwres_gnba_*() calls. -

+ library-defined flags for this packet: for instance whether the + packet + is a request or a reply. Flag values can be set, but not defined + by + the caller. + This field is filled in by the application wit the exception of + the + LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in + the + lwres_gabn_*() and lwres_gnba_*() calls. +

serial

-is set by the requestor and is returned in all replies. If two or more -packets from the same source have the same serial number and are from -the same source, they are assumed to be duplicates and the latter ones -may be dropped. -This field must be set by the application. -

+ is set by the requestor and is returned in all replies. If two + or more + packets from the same source have the same serial number and are + from + the same source, they are assumed to be duplicates and the + latter ones + may be dropped. + This field must be set by the application. +

opcode

-indicates the operation. -Opcodes between 0x00000000 and 0x03ffffff are -reserved for use by the lightweight resolver library. Opcodes between -0x04000000 and 0xffffffff are application defined. -This field is filled in by the lwres_gabn_*() and lwres_gnba_*() -calls. -

+ indicates the operation. + Opcodes between 0x00000000 and 0x03ffffff are + reserved for use by the lightweight resolver library. Opcodes + between + 0x04000000 and 0xffffffff are application defined. + This field is filled in by the lwres_gabn_*() and lwres_gnba_*() + calls. +

result

-is only valid for replies. -Results between 0x04000000 and 0xffffffff are application defined. -Results between 0x00000000 and 0x03ffffff are reserved for library use. -This field is filled in by the lwres_gabn_*() and lwres_gnba_*() -calls. -

+ is only valid for replies. + Results between 0x04000000 and 0xffffffff are application + defined. + Results between 0x00000000 and 0x03ffffff are reserved for + library use. + This field is filled in by the lwres_gabn_*() and lwres_gnba_*() + calls. +

recvlength

-is the maximum buffer size that the receiver can handle on requests -and the size of the buffer needed to satisfy a request when the buffer -is too large for replies. -This field is supplied by the application. -

+ is the maximum buffer size that the receiver can handle on + requests + and the size of the buffer needed to satisfy a request when the + buffer + is too large for replies. + This field is supplied by the application. +

authtype

-defines the packet level authentication that is used. -Authorisation types between 0x1000 and 0xffff are application defined -and types between 0x0000 and 0x0fff are reserved for library use. -Currently these are not used and must be zero. -

+ defines the packet level authentication that is used. + Authorisation types between 0x1000 and 0xffff are application + defined + and types between 0x0000 and 0x0fff are reserved for library + use. + Currently these are not used and must be zero. +

authlen

-gives the length of the authentication data. -Since packet authentication is currently not used, this must be zero. -

+ gives the length of the authentication data. + Since packet authentication is currently not used, this must be + zero. +

-

+

-The following opcodes are currently defined: -

+ The following opcodes are currently defined: +

NOOP

-Success is always returned and the packet contents are echoed. -The lwres_noop_*() functions should be used for this type. -

+ Success is always returned and the packet contents are echoed. + The lwres_noop_*() functions should be used for this type. +

GETADDRSBYNAME

-returns all known addresses for a given name. -The lwres_gabn_*() functions should be used for this type. -

+ returns all known addresses for a given name. + The lwres_gabn_*() functions should be used for this type. +

GETNAMEBYADDR

-return the hostname for the given address. -The lwres_gnba_*() functions should be used for this type. -

+ return the hostname for the given address. + The lwres_gnba_*() functions should be used for this type. +

-

-

-lwres_lwpacket_renderheader() transfers the -contents of lightweight resolver packet structure -lwres_lwpacket_t *pkt in network -byte order to the lightweight resolver buffer, -*b. -

-

-lwres_lwpacket_parseheader() performs the -converse operation. It transfers data in network byte order from -buffer *b to resolver packet -*pkt. The contents of the buffer -b should correspond to a -lwres_lwpacket_t. -

+

+

lwres_lwpacket_renderheader() + transfers the contents of lightweight resolver packet structure + lwres_lwpacket_t *pkt in + network byte order to the lightweight resolver buffer, + *b. +

+

lwres_lwpacket_parseheader() + performs the converse operation. It transfers data in network + byte order from buffer *b to resolver + packet *pkt. The contents of the buffer + b should correspond to a + lwres_lwpacket_t. +

-

RETURN VALUES

-

Successful calls to -lwres_lwpacket_renderheader() and -lwres_lwpacket_parseheader() return -LWRES_R_SUCCESS. If there is insufficient -space to copy data between the buffer *b and -lightweight resolver packet *pkt both functions -return LWRES_R_UNEXPECTEDEND. -

+

RETURN VALUES

+

+ Successful calls to + lwres_lwpacket_renderheader() and + lwres_lwpacket_parseheader() return + LWRES_R_SUCCESS. If there is insufficient + space to copy data between the buffer *b and + lightweight resolver packet *pkt both + functions + return LWRES_R_UNEXPECTEDEND. +

diff --git a/usr.sbin/bind/lib/lwres/man/lwres_resutil.html b/usr.sbin/bind/lib/lwres/man/lwres_resutil.html index a4cd0a7c57d..d468bcd1b31 100644 --- a/usr.sbin/bind/lib/lwres/man/lwres_resutil.html +++ b/usr.sbin/bind/lib/lwres/man/lwres_resutil.html @@ -1,5 +1,5 @@ - + lwres_resutil - +
-
+

Name

lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr — lightweight resolver utility functions

@@ -36,24 +36,21 @@ lwres_result_t lwres_string_parse( -  -, - - -  -  -, +lwres_buffer_t *  + +b,   -  -, +char **  + +c,   -  +lwres_uint16_t *  -); +len); @@ -61,19 +58,15 @@ lwres_result_t - - - - - - - + + - + +addr);
lwres_result_t lwres_addr_parse( ,
  , lwres_buffer_t *  +b,
  lwres_addr_t *  -);
@@ -81,29 +74,27 @@ lwres_result_t - - - - - - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_getaddrsbyname( ,
  , lwres_context_t *  +ctx,
  , const char *  +name,
  , lwres_uint32_t   +addrtypes,
  lwres_gabnresponse_t **  -);
@@ -111,71 +102,67 @@ lwres_result_t - - - - - - - + + - - + + - - + + - - + + - + +structp);
lwres_result_t lwres_getnamebyaddr( ,
  , lwres_context_t *  +ctx,
  , lwres_uint32_t   +addrtype,
  , lwres_uint16_t   +addrlen,
  , const unsigned char *  +addr,
  lwres_gnbaresponse_t **  -);
-

DESCRIPTION

-

-lwres_string_parse() retrieves a DNS-encoded -string starting the current pointer of lightweight resolver buffer -b: i.e. b->current. -When the function returns, the address of the first byte of the -encoded string is returned via *c and the -length of that string is given by *len. The -buffer's current pointer is advanced to point at the character -following the string length, the encoded string, and the trailing -NULL character. -

-

-lwres_addr_parse() extracts an address from the -buffer b. The buffer's current pointer -b->current is presumed to point at an encoded -address: the address preceded by a 32-bit protocol family identifier -and a 16-bit length field. The encoded address is copied to -addr->address and -addr->length indicates the size in bytes of -the address that was copied. b->current is -advanced to point at the next byte of available data in the buffer -following the encoded address. -

-

-lwres_getaddrsbyname() -and -lwres_getnamebyaddr() -use the -lwres_gnbaresponse_t -structure defined below: -

+

DESCRIPTION

+

lwres_string_parse() + retrieves a DNS-encoded string starting the current pointer of + lightweight resolver buffer b: i.e. + b->current. When the function returns, + the address of the first byte of the encoded string is returned + via *c and the length of that string is + given by *len. The buffer's current + pointer is advanced to point at the character following the + string length, the encoded string, and the trailing + NULL character. +

+

lwres_addr_parse() + extracts an address from the buffer b. + The buffer's current pointer b->current + is presumed to point at an encoded address: the address preceded + by a 32-bit protocol family identifier and a 16-bit length + field. The encoded address is copied to + addr->address and + addr->length indicates the size in bytes + of the address that was copied. + b->current is advanced to point at the + next byte of available data in the buffer following the encoded + address. +

+

lwres_getaddrsbyname() + and lwres_getnamebyaddr() use the + lwres_gnbaresponse_t structure defined below: +

 typedef struct {
         lwres_uint32_t          flags;
@@ -191,85 +178,81 @@ typedef struct {
 } lwres_gabnresponse_t;
 

-The contents of this structure are not manipulated directly but -they are controlled through the -lwres_gabn(3 -) -functions. -

-

-The lightweight resolver uses -lwres_getaddrsbyname() to perform foward lookups. -Hostname name is looked up using the resolver -context ctx for memory allocation. -addrtypes is a bitmask indicating which type of -addresses are to be looked up. Current values for this bitmask are -LWRES_ADDRTYPE_V4 for IPv4 addresses and -LWRES_ADDRTYPE_V6 for IPv6 addresses. Results of the -lookup are returned in *structp. -

+ The contents of this structure are not manipulated directly but + they are controlled through the + lwres_gabn(3) + functions. +

-lwres_getnamebyaddr() performs reverse lookups. -Resolver context ctx is used for memory -allocation. The address type is indicated by -addrtype: LWRES_ADDRTYPE_V4 or -LWRES_ADDRTYPE_V6. The address to be looked up is given -by addr and its length is -addrlen bytes. The result of the function call -is made available through *structp. -

+ The lightweight resolver uses + lwres_getaddrsbyname() to perform + foward lookups. + Hostname name is looked up using the + resolver + context ctx for memory allocation. + addrtypes is a bitmask indicating + which type of + addresses are to be looked up. Current values for this bitmask are + LWRES_ADDRTYPE_V4 for IPv4 addresses and + LWRES_ADDRTYPE_V6 for IPv6 addresses. Results of the + lookup are returned in *structp. +

+

lwres_getnamebyaddr() + performs reverse lookups. Resolver context + ctx is used for memory allocation. The + address type is indicated by addrtype: + LWRES_ADDRTYPE_V4 or + LWRES_ADDRTYPE_V6. The address to be looked up is + given by addr and its length is + addrlen bytes. The result of the + function call is made available through + *structp. +

-

RETURN VALUES

-

-Successful calls to -lwres_string_parse() -and -lwres_addr_parse() -return -LWRES_R_SUCCESS. -Both functions return -LWRES_R_FAILURE -if the buffer is corrupt or -LWRES_R_UNEXPECTEDEND -if the buffer has less space than expected for the components of the -encoded string or address. -

+

RETURN VALUES

-lwres_getaddrsbyname() -returns -LWRES_R_SUCCESS -on success and it returns -LWRES_R_NOTFOUND -if the hostname -name -could not be found. -

+ Successful calls to + lwres_string_parse() + and + lwres_addr_parse() + return + LWRES_R_SUCCESS. + Both functions return + LWRES_R_FAILURE + if the buffer is corrupt or + LWRES_R_UNEXPECTEDEND + if the buffer has less space than expected for the components of the + encoded string or address. +

+

lwres_getaddrsbyname() + returns LWRES_R_SUCCESS on success and it + returns LWRES_R_NOTFOUND if the hostname + name could not be found. +

+

LWRES_R_SUCCESS + is returned by a successful call to + lwres_getnamebyaddr(). +

-LWRES_R_SUCCESS -is returned by a successful call to -lwres_getnamebyaddr(). -

-

-Both -lwres_getaddrsbyname() -and -lwres_getnamebyaddr() -return -LWRES_R_NOMEMORY -when memory allocation requests fail and -LWRES_R_UNEXPECTEDEND -if the buffers used for sending queries and receiving replies are too -small. -

+ Both + lwres_getaddrsbyname() + and + lwres_getnamebyaddr() + return + LWRES_R_NOMEMORY + when memory allocation requests fail and + LWRES_R_UNEXPECTEDEND + if the buffers used for sending queries and receiving replies are too + small. +

-

SEE ALSO

-

-lwres_buffer(3), +

SEE ALSO

+

lwres_buffer(3), -lwres_gabn(3). -

+ lwres_gabn(3). +

diff --git a/usr.sbin/bind/lib/lwres/print.c b/usr.sbin/bind/lib/lwres/print.c index 9e6e5fa69e0..87cec5b47a5 100644 --- a/usr.sbin/bind/lib/lwres/print.c +++ b/usr.sbin/bind/lib/lwres/print.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: print.c,v 1.2.4.7 2005/10/14 01:38:51 marka Exp $ */ +/* $ISC: print.c,v 1.2.2.7 2005/10/14 01:28:30 marka Exp $ */ #include -- cgit v1.2.3