From ddccd5811feff696ba460dabfb666ce61040f545 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Sat, 31 Mar 2001 00:08:23 +0000 Subject: [PATCH] man page docbook conversion --- lib/lwres/man/Makefile.in | 104 ++- lib/lwres/man/lwres.3 | 185 +++-- lib/lwres/man/lwres.docbook | 14 +- lib/lwres/man/lwres.html | 444 ++++++++++ lib/lwres/man/lwres_buffer.3 | 330 ++++---- lib/lwres/man/lwres_buffer.docbook | 10 +- lib/lwres/man/lwres_buffer.html | 608 ++++++++++++++ lib/lwres/man/lwres_config.3 | 133 ++- lib/lwres/man/lwres_config.docbook | 159 ++++ lib/lwres/man/lwres_config.html | 295 +++++++ lib/lwres/man/lwres_context.3 | 246 +++--- lib/lwres/man/lwres_context.docbook | 287 +++++++ lib/lwres/man/lwres_context.html | 531 ++++++++++++ lib/lwres/man/lwres_gabn.3 | 210 +++-- lib/lwres/man/lwres_gabn.docbook | 255 ++++++ lib/lwres/man/lwres_gabn.html | 442 ++++++++++ lib/lwres/man/lwres_gai_strerror.3 | 105 +-- lib/lwres/man/lwres_gai_strerror.docbook | 154 ++++ lib/lwres/man/lwres_gai_strerror.html | 297 +++++++ lib/lwres/man/lwres_getaddrinfo.3 | 270 +++--- lib/lwres/man/lwres_getaddrinfo.docbook | 382 +++++++++ lib/lwres/man/lwres_getaddrinfo.html | 739 +++++++++++++++++ lib/lwres/man/lwres_gethostent.3 | 428 +++++----- lib/lwres/man/lwres_gethostent.docbook | 490 +++++++++++ lib/lwres/man/lwres_gethostent.html | 918 +++++++++++++++++++++ lib/lwres/man/lwres_getipnode.3 | 207 +++-- lib/lwres/man/lwres_getipnode.docbook | 303 +++++++ lib/lwres/man/lwres_getipnode.html | 530 ++++++++++++ lib/lwres/man/lwres_getnameinfo.3 | 143 ++-- lib/lwres/man/lwres_getnameinfo.docbook | 171 ++++ lib/lwres/man/lwres_getnameinfo.html | 321 +++++++ lib/lwres/man/lwres_getrrsetbyname.3 | 158 ++-- lib/lwres/man/lwres_getrrsetbyname.docbook | 176 ++++ lib/lwres/man/lwres_getrrsetbyname.html | 310 +++++++ lib/lwres/man/lwres_gnba.3 | 212 +++-- lib/lwres/man/lwres_gnba.docbook | 37 +- lib/lwres/man/lwres_gnba.html | 408 +++++++++ lib/lwres/man/lwres_hstrerror.3 | 95 +-- lib/lwres/man/lwres_hstrerror.docbook | 128 +++ lib/lwres/man/lwres_hstrerror.html | 248 ++++++ lib/lwres/man/lwres_inetntop.3 | 74 +- lib/lwres/man/lwres_inetntop.docbook | 107 +++ lib/lwres/man/lwres_inetntop.html | 201 +++++ lib/lwres/man/lwres_noop.3 | 214 +++-- lib/lwres/man/lwres_noop.docbook | 252 ++++++ lib/lwres/man/lwres_noop.html | 436 ++++++++++ lib/lwres/man/lwres_packet.3 | 145 ++-- lib/lwres/man/lwres_packet.docbook | 240 ++++++ lib/lwres/man/lwres_packet.html | 413 +++++++++ lib/lwres/man/lwres_resutil.3 | 220 +++-- lib/lwres/man/lwres_resutil.docbook | 276 +++++++ lib/lwres/man/lwres_resutil.html | 524 ++++++++++++ 52 files changed, 12732 insertions(+), 1853 deletions(-) create mode 100644 lib/lwres/man/lwres.html create mode 100644 lib/lwres/man/lwres_buffer.html create mode 100644 lib/lwres/man/lwres_config.docbook create mode 100644 lib/lwres/man/lwres_config.html create mode 100644 lib/lwres/man/lwres_context.docbook create mode 100644 lib/lwres/man/lwres_context.html create mode 100644 lib/lwres/man/lwres_gabn.docbook create mode 100644 lib/lwres/man/lwres_gabn.html create mode 100644 lib/lwres/man/lwres_gai_strerror.docbook create mode 100644 lib/lwres/man/lwres_gai_strerror.html create mode 100644 lib/lwres/man/lwres_getaddrinfo.docbook create mode 100644 lib/lwres/man/lwres_getaddrinfo.html create mode 100644 lib/lwres/man/lwres_gethostent.docbook create mode 100644 lib/lwres/man/lwres_gethostent.html create mode 100644 lib/lwres/man/lwres_getipnode.docbook create mode 100644 lib/lwres/man/lwres_getipnode.html create mode 100644 lib/lwres/man/lwres_getnameinfo.docbook create mode 100644 lib/lwres/man/lwres_getnameinfo.html create mode 100644 lib/lwres/man/lwres_getrrsetbyname.docbook create mode 100644 lib/lwres/man/lwres_getrrsetbyname.html create mode 100644 lib/lwres/man/lwres_gnba.html create mode 100644 lib/lwres/man/lwres_hstrerror.docbook create mode 100644 lib/lwres/man/lwres_hstrerror.html create mode 100644 lib/lwres/man/lwres_inetntop.docbook create mode 100644 lib/lwres/man/lwres_inetntop.html create mode 100644 lib/lwres/man/lwres_noop.docbook create mode 100644 lib/lwres/man/lwres_noop.html create mode 100644 lib/lwres/man/lwres_packet.docbook create mode 100644 lib/lwres/man/lwres_packet.html create mode 100644 lib/lwres/man/lwres_resutil.docbook create mode 100644 lib/lwres/man/lwres_resutil.html diff --git a/lib/lwres/man/Makefile.in b/lib/lwres/man/Makefile.in index b3123d8d7e..0e2d3539bb 100644 --- a/lib/lwres/man/Makefile.in +++ b/lib/lwres/man/Makefile.in @@ -7,48 +7,68 @@ top_srcdir = @top_srcdir@ @BIND9_MAKE_RULES@ # Alphabetically -MANPAGES = lwres.3 lwres_addr_parse.3 lwres_buffer.3 \ - lwres_buffer_add.3 lwres_buffer_back.3 lwres_buffer_clear.3 \ - lwres_buffer_first.3 lwres_buffer_forward.3 \ - lwres_buffer_getmem.3 lwres_buffer_getuint16.3 \ - lwres_buffer_getuint32.3 lwres_buffer_getuint8.3 \ - lwres_buffer_init.3 lwres_buffer_invalidate.3 \ - lwres_buffer_putmem.3 lwres_buffer_putuint16.3 \ - lwres_buffer_putuint32.3 lwres_buffer_putuint8.3 \ - lwres_buffer_subtract.3 lwres_conf_clear.3 \ - lwres_conf_get.3 lwres_conf_init.3 \ - lwres_conf_parse.3 lwres_conf_print.3 \ - lwres_config.3 lwres_context.3 \ - lwres_context_allocmem.3 lwres_context_create.3 \ - lwres_context_destroy.3 lwres_context_freemem.3 \ - lwres_context_initserial.3 lwres_context_nextserial.3 \ - lwres_context_sendrecv.3 lwres_endhostent.3 \ - lwres_endhostent_r.3 lwres_freeaddrinfo.3 \ - lwres_freehostent.3 lwres_gabn.3 \ - lwres_gabnrequest_free.3 lwres_gabnrequest_parse.3 \ - lwres_gabnrequest_render.3 lwres_gabnresponse_free.3 \ - lwres_gabnresponse_parse.3 lwres_gabnresponse_render.3 \ - lwres_gai_strerror.3 lwres_getaddrinfo.3 \ - lwres_getaddrsbyname.3 lwres_gethostbyaddr.3 \ - lwres_gethostbyaddr_r.3 lwres_gethostbyname.3 \ - lwres_gethostbyname2.3 lwres_gethostbyname_r.3 \ - lwres_gethostent.3 lwres_gethostent_r.3 \ - lwres_getipnode.3 lwres_getipnodebyaddr.3 \ - lwres_getipnodebyname.3 lwres_getnamebyaddr.3 \ - lwres_getnameinfo.3 lwres_getrrsetbyname.3 \ - lwres_gnba.3 lwres_gnbarequest_free.3 \ - lwres_gnbarequest_parse.3 lwres_gnbarequest_render.3 \ - lwres_gnbaresponse_free.3 lwres_gnbaresponse_parse.3 \ - lwres_gnbaresponse_render.3 lwres_herror.3 \ - lwres_hstrerror.3 lwres_inetntop.3 \ - lwres_lwpacket_parseheader.3 lwres_lwpacket_renderheader.3 \ - lwres_net_ntop.3 lwres_noop.3 \ - lwres_nooprequest_free.3 lwres_nooprequest_parse.3 \ - lwres_nooprequest_render.3 lwres_noopresponse_free.3 \ - lwres_noopresponse_parse.3 lwres_noopresponse_render.3 \ - lwres_packet.3 lwres_resutil.3 \ - lwres_sethostent.3 lwres_sethostent_r.3 \ - lwres_string_parse.3 +#MANPAGES = lwres.3 lwres_addr_parse.3 lwres_buffer.3 \ +# lwres_buffer_add.3 lwres_buffer_back.3 lwres_buffer_clear.3 \ +# lwres_buffer_first.3 lwres_buffer_forward.3 \ +# lwres_buffer_getmem.3 lwres_buffer_getuint16.3 \ +# lwres_buffer_getuint32.3 lwres_buffer_getuint8.3 \ +# lwres_buffer_init.3 lwres_buffer_invalidate.3 \ +# lwres_buffer_putmem.3 lwres_buffer_putuint16.3 \ +# lwres_buffer_putuint32.3 lwres_buffer_putuint8.3 \ +# lwres_buffer_subtract.3 lwres_conf_clear.3 \ +# lwres_conf_get.3 lwres_conf_init.3 \ +# lwres_conf_parse.3 lwres_conf_print.3 \ +# lwres_config.3 lwres_context.3 \ +# lwres_context_allocmem.3 lwres_context_create.3 \ +# lwres_context_destroy.3 lwres_context_freemem.3 \ +# lwres_context_initserial.3 lwres_context_nextserial.3 \ +# lwres_context_sendrecv.3 lwres_endhostent.3 \ +# lwres_endhostent_r.3 lwres_freeaddrinfo.3 \ +# lwres_freehostent.3 lwres_gabn.3 \ +# lwres_gabnrequest_free.3 lwres_gabnrequest_parse.3 \ +# lwres_gabnrequest_render.3 lwres_gabnresponse_free.3 \ +# lwres_gabnresponse_parse.3 lwres_gabnresponse_render.3 \ +# lwres_gai_strerror.3 lwres_getaddrinfo.3 \ +# lwres_getaddrsbyname.3 lwres_gethostbyaddr.3 \ +# lwres_gethostbyaddr_r.3 lwres_gethostbyname.3 \ +# lwres_gethostbyname2.3 lwres_gethostbyname_r.3 \ +# lwres_gethostent.3 lwres_gethostent_r.3 \ +# lwres_getipnode.3 lwres_getipnodebyaddr.3 \ +# lwres_getipnodebyname.3 lwres_getnamebyaddr.3 \ +# lwres_getnameinfo.3 lwres_getrrsetbyname.3 \ +# lwres_gnba.3 lwres_gnbarequest_free.3 \ +# lwres_gnbarequest_parse.3 lwres_gnbarequest_render.3 \ +# lwres_gnbaresponse_free.3 lwres_gnbaresponse_parse.3 \ +# lwres_gnbaresponse_render.3 lwres_herror.3 \ +# lwres_hstrerror.3 lwres_inetntop.3 \ +# lwres_lwpacket_parseheader.3 lwres_lwpacket_renderheader.3 \ +# lwres_net_ntop.3 lwres_noop.3 \ +# lwres_nooprequest_free.3 lwres_nooprequest_parse.3 \ +# lwres_nooprequest_render.3 lwres_noopresponse_free.3 \ +# lwres_noopresponse_parse.3 lwres_noopresponse_render.3 \ +# lwres_packet.3 lwres_resutil.3 \ +# lwres_sethostent.3 lwres_sethostent_r.3 \ +# lwres_string_parse.3 + + +MANPAGES = lwres.3 lwres_buffer.3 lwres_config.3 lwres_context.3 \ + lwres_gabn.3 lwres_gai_strerror.3 lwres_getaddrinfo.3 \ + lwres_gethostent.3 lwres_getipnode.3 lwres_getnameinfo.3 \ + lwres_getrrsetbyname.3 lwres_gnba.3 lwres_hstrerror.3 lwres_inetntop.3 \ + lwres_noop.3 lwres_packet.3 lwres_resutil.3 + +HTMLPAGES = lwres.html lwres_buffer.html lwres_config.html lwres_context.html \ + lwres_gabn.html lwres_gai_strerror.html lwres_getaddrinfo.html \ + lwres_gethostent.html lwres_getipnode.html lwres_getnameinfo.html \ + lwres_getrrsetbyname.html lwres_gnba.html lwres_hstrerror.html lwres_inetntop.html \ + lwres_noop.html lwres_packet.html lwres_resutil.html + +MANOBJS = ${MANPAGES} ${HTMLPAGES} + +doc man:: ${MANOBJS} + +docclean manclean maintainer-clean:: + rm -f ${MANOBJS} installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3 diff --git a/lib/lwres/man/lwres.3 b/lib/lwres/man/lwres.3 index 504472b3c3..fddcddbf40 100644 --- a/lib/lwres/man/lwres.3 +++ b/lib/lwres/man/lwres.3 @@ -12,140 +12,145 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres.3,v 1.9 2001/01/09 21:48:52 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres -.Nd introduction to the lightweight resolver library -.Sh SYNOPSIS -.Fd #include -.Sh DESCRIPTION +.TH "LWRES" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres \- introduction to the lightweight resolver library +.SH SYNOPSIS +\fB#include \fR +.SH "DESCRIPTION" +.PP The BIND 9 lightweight resolver library is a simple, name service -independent stub resolver library. It provides hostname-to-address +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 -.Nm lwresd +\fBlwresd\fR 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. +and returns the results to the application through the library. The library and resolver daemon communicate using a simple UDP-based protocol. -.Pp -.Sh OVERVIEW +.SH "OVERVIEW" +.PP The lwresd library implements multiple name service APIs. The standard -.Fn gethostbyname , -.Fn gethostbyaddr , -.Fn gethostbyname_r , -.Fn gethostbyaddr_r , -.Fn getaddrinfo , -.Fn getipnodebyname , +\fBgethostbyname()\fR, +\fBgethostbyaddr()\fR, +\fBgethostbyname_r()\fR, +\fBgethostbyaddr_r()\fR, +\fBgetaddrinfo()\fR, +\fBgetipnodebyname()\fR, and -.Fn getipnodebyaddr -functions are all supported. To allow the lwres library to coexist -with system libraries that define functions of the same name, +\fBgetipnodebyaddr()\fR +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 -.Va lwres_ . +lwres_. To define the standard names, applications must include the header file -.Fd +\fI\fR which contains macro definitions mapping the standard function names into -.Va lwres_ -prefixed ones. Operating system vendors who integrate the lwres +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. -.Pp +.PP The library also provides a native API consisting of the functions -.Fn lwres_getaddrsbyname +\fBlwres_getaddrsbyname()\fR and -.Fn lwres_getnamebyaddr . +\fBlwres_getnamebyaddr()\fR. These may be called by applications that require more detailed control over the lookup process than the standard functions provide. -.Pp +.PP 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 -.Fn lwres_getaddrsbyname +\fBlwres_getaddrsbyname()\fR function. -.Pp +.PP Finally, there is a low-level API for converting lookup -requests and responses to and from raw lwres protocol packets. +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 -.Nm lwresd -resolver daemon. The use of this low-level API in clients +\fBlwresd\fR +resolver daemon. The use of this low-level API in clients and servers is outlined in the following sections. -.P -.Sh CLIENT-SIDE LOW-LEVEL API CALL FLOW +.SH "CLIENT-SIDE LOW-LEVEL API CALL FLOW" +.PP When a client program wishes to make an lwres request using the native low-level API, it typically performs the following sequence of actions. -.Pp -(1) Allocate or use an existing lwres_packet_t, called "pkt" below. -.Pp -(2) Set pkt.recvlength to the maximum length we will accept. +.PP +(1) Allocate or use an existing \fBlwres_packet_t\fR, +called pkt below. +.PP +(2) Set \fBpkt.recvlength\fR 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. -.Pp -(3) Set the pkt.serial to a unique serial number. This value is echoed +buffer is. The "default" is a constant in +\fIlwres.h\fR: LWRES_RECVLENGTH = 4096. +.PP +(3) Set \fBpkt.serial\fR +to a unique serial number. This value is echoed back to the application by the remote server. -.Pp -(4) Set pkt.pktflags. Usually this is set to 0. -.Pp -(5) Set pkt.result to 0. -.Pp -(6) Call lwres_*request_render, or marshall in the data using the primitives -such as lwres_packet_render() and storing the packet data. -.Pp +.PP +(4) Set \fBpkt.pktflags\fR. Usually this is set to 0. +.PP +(5) Set \fBpkt.result\fR to 0. +.PP +(6) Call \fBlwres_*request_render()\fR, +or marshall in the data using the primitives +such as \fBlwres_packet_render()\fR +and storing the packet data. +.PP (7) Transmit the resulting buffer. -.Pp -(8) Call lwres_*response_parse() to parse any packets received. -.Pp +.PP +(8) Call \fBlwres_*response_parse()\fR +to parse any packets received. +.PP (9) Verify that the opcode and serial match a request, and process the packet specific information contained in the body. -.Sh SERVER-SIDE LOW-LEVEL API CALL FLOW +.SH "SERVER-SIDE LOW-LEVEL API CALL FLOW" +.PP 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. -.Pp -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 +.PP +Note that the same \fBlwres_packet_t\fR is used +in both the \fB_parse()\fR and \fB_render()\fR 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. -.Pp -(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. -.Pp +.PP +(1) When a packet is received, call \fBlwres_*request_parse()\fR to +unmarshall it. This returns a \fBlwres_packet_t\fR (also called pkt, below) +as well as a data specific type, such as \fBlwres_gabnrequest_t\fR. +.PP (2) Process the request in the data specific type. -.Pp -(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 +.PP +(3) Set the \fBpkt.result\fR, +\fBpkt.recvlength\fR as above. All other fields can +be left untouched since they were filled in by the \fB*_parse()\fR call +above. If using \fBlwres_*response_render()\fR, +\fBpkt.pktflags\fR will be set up +properly. Otherwise, the LWRES_LWPACKETFLAG_RESPONSE bit should be set. -.Pp +.PP (4) Call the data specific rendering function, such as -lwres_gabnresponse_render(). -.Pp +\fBlwres_gabnresponse_render()\fR. +.PP (5) Send the resulting packet to the client. -.Pp -.Sh SEE ALSO -.Xr lwres_gethostent 3 , -.Xr lwres_getipnode 3 , -.Xr lwres_getnameinfo 3 , -.Xr lwres_noop 3 , -.Xr lwres_gabn 3 , -.Xr lwres_gnba 3 , -.Xr lwres_context 3 , -.Xr lwres_config 3 , -.Xr resolver 5 , -.Xr lwresd 8 . +.PP +.SH "SEE ALSO" +.PP +\fBlwres_gethostent\fR(3), +\fBlwres_getipnode\fR(3), +\fBlwres_getnameinfo\fR(3), +\fBlwres_noop\fR(3), +\fBlwres_gabn\fR(3), +\fBlwres_gnba\fR(3), +\fBlwres_context\fR(3), +\fBlwres_config\fR(3), +\fBresolver\fR(5), +\fBlwresd\fR(8). diff --git a/lib/lwres/man/lwres.docbook b/lib/lwres/man/lwres.docbook index 5c272ff314..10f0ef61e7 100644 --- a/lib/lwres/man/lwres.docbook +++ b/lib/lwres/man/lwres.docbook @@ -16,18 +16,18 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - + - + Jun 30, 2000 - - lwres - 3 - BIND9 - + +lwres +3 +BIND9 + lwres introduction to the lightweight resolver library diff --git a/lib/lwres/man/lwres.html b/lib/lwres/man/lwres.html new file mode 100644 index 0000000000..7b9f88dcb1 --- /dev/null +++ b/lib/lwres/man/lwres.html @@ -0,0 +1,444 @@ + +lwres

lwres

Name

lwres -- introduction to the lightweight resolver library

Synopsis

#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.

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.

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), + +lwres_getipnode(3), + +lwres_getnameinfo(3), + +lwres_noop(3), + +lwres_gabn(3), + +lwres_gnba(3), + +lwres_context(3), + +lwres_config(3), + +resolver(5), + +lwresd(8).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_buffer.3 b/lib/lwres/man/lwres_buffer.3 index dfec297a45..cbe417bd00 100644 --- a/lib/lwres/man/lwres_buffer.3 +++ b/lib/lwres/man/lwres_buffer.3 @@ -12,155 +12,117 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_buffer.3,v 1.6 2001/01/09 21:48:54 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_BUFFER 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_buffer_init , -.Nm lwres_buffer_invalidate , -.Nm lwres_buffer_add , -.Nm lwres_buffer_subtract , -.Nm lwres_buffer_clear , -.Nm lwres_buffer_first , -.Nm lwres_buffer_forward , -.Nm lwres_buffer_back , -.Nm lwres_buffer_getuint8 , -.Nm lwres_buffer_putuint8 , -.Nm lwres_buffer_getuint16 , -.Nm lwres_buffer_putuint16 , -.Nm lwres_buffer_getuint32 , -.Nm lwres_buffer_putuint32 , -.Nm lwres_buffer_putmem , -.Nm lwres_buffer_getmem -.Nd lightweight resolver buffer management -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft void -.Fo lwres_buffer_init -.Fa "lwres_buffer_t *b" -.Fa "void *base" -.Fa "unsigned int length" -.Fc -.Ft void -.Fo lwres_buffer_invalidate -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_add -.Fa "lwres_buffer_t *b" -.Fa "unsigned int n" -.Fc -.Ft void -.Fo lwres_buffer_subtract -.Fa "lwres_buffer_t *b" -.Fa "unsigned int n" -.Fc -.Ft void -.Fo lwres_buffer_clear -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_first -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_forward -.Fa "lwres_buffer_t *b" -.Fa "unsigned int n" -.Fc -.Ft void -.Fo lwres_buffer_back -.Fa "lwres_buffer_t *b" -.Fa "unsigned int n" -.Fc -.Ft lwres_uint8_t -.Fo lwres_buffer_getuint8 -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_putuint8 -.Fa "lwres_buffer_t *b" -.Fa "lwres_uint8_t val" -.Fc -.Ft lwres_uint16_t -.Fo lwres_buffer_getuint16 -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_putuint16 -.Fa "lwres_buffer_t *b" -.Fa "lwres_uint16_t val" -.Fc -.Ft lwres_uint32_t -.Fo lwres_buffer_getuint32 -.Fa "lwres_buffer_t *b" -.Fc -.Ft void -.Fo lwres_buffer_putuint32 -.Fa "lwres_buffer_t *b" -.Fa "lwres_uint32_t val" -.Fc -.Ft void -.Fo lwres_buffer_putmem -.Fa "lwres_buffer_t *b" -.Fa "const unsigned char *base" -.Fa "unsigned int length" -.Fc -.Ft void -.Fo lwres_buffer_getmem -.Fa "lwres_buffer_t *b" -.Fa "unsigned char *base" -.Fa "unsigned int length" -.Fc -.Sh DESCRIPTION - - +.TH "LWRES_BUFFER" "3" "Jun 30, 2000" "BIND9" "" +.SH 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 +.SH SYNOPSIS +\fB#include +.sp +void +lwres_buffer_init(lwres_buffer_t *b); +(void *base); +(unsigned int length); +.sp +void +lwres_buffer_invalidate(lwres_buffer_t *b); +.sp +void +lwres_buffer_add(lwres_buffer_t *b); +(unsigned int n); +.sp +void +lwres_buffer_subtract(lwres_buffer_t *b); +(unsigned int n); +.sp +void +lwres_buffer_clear(lwres_buffer_t *b); +.sp +void +lwres_buffer_first(lwres_buffer_t *b); +.sp +void +lwres_buffer_forward(lwres_buffer_t *b); +(unsigned int n); +.sp +void +lwres_buffer_back(lwres_buffer_t *b); +(unsigned int n); +.sp +lwres_uint8_t +lwres_buffer_getuint8(lwres_buffer_t *b); +.sp +void +lwres_buffer_putuint8(lwres_buffer_t *b); +(lwres_uint8_t val); +.sp +lwres_uint16_t +lwres_buffer_getuint16(lwres_buffer_t *b); +.sp +void +lwres_buffer_putuint16(lwres_buffer_t *b); +(lwres_uint16_t val); +.sp +lwres_uint32_t +lwres_buffer_getuint32(lwres_buffer_t *b); +.sp +void +lwres_buffer_putuint32(lwres_buffer_t *b); +(lwres_uint32_t val); +.sp +void +lwres_buffer_putmem(lwres_buffer_t *b); +(const unsigned char *base); +(unsigned int length); +.sp +void +lwres_buffer_getmem(lwres_buffer_t *b); +(unsigned char *base); +(unsigned int length); +\fR.SH "DESCRIPTION" +.PP 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 -.Va isc_buffer_ +isc_buffer_ functions in the ISC library. -.Pp +.PP A buffer is a region of memory, together with a set of related subregions. -The \*qused region\*q and the \*qavailable\*q region are disjoint, and +The \fBused region\fR and the +\fBavailable\fR 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. +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. -.Pp +.PP The used region is further subdivided into two disjoint regions: the -\*qconsumed region\*q and the \*qremaining region\*q. +\fBconsumed region\fR and the \fBremaining region\fR. 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 \*qcurrent\*q offset (if any). -The \*qremaining\*q region the current pointer to the end of the used +the byte before the \fBcurrent\fR offset (if any). +The \fBremaining\fR 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. -.Pp -The \*qactive region\*q is an (optional) subregion of the remaining +.PP +The \fBactive region\fR 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. -.Pp -.Bd -literal -offset indent +.PP +.sp +.nf - /------------entire length---------------\\ - /----- used region -----\\/-- available --\\ + /------------entire length---------------\\\\ + /----- used region -----\\\\/-- available --\\\\ +----------------------------------------+ | consumed | remaining | | +----------------------------------------+ @@ -177,118 +139,118 @@ the active region will also be empty. a-b == consumed region. b-d == remaining region. b-c == optional active region. -.Ed -.Pp -.Fn lwres_buffer_init +.sp +.fi +.PP +\fBlwres_buffer_init()\fR initializes the -.Dv lwres_buffer_t -.Fa *b +\fBlwres_buffer_t\fR +\fI*b\fR and assocates it with the memory region of size -.Fa length +\fIlength\fR bytes starting at location -.Fa base. -.Pp -.Fn lwres_buffer_invalidate +\fIbase.\fR +.PP +\fBlwres_buffer_invalidate()\fR marks the buffer -.Fa *b -as invalid. Invalidating a buffer after use is not required, +\fI*b\fR +as invalid. Invalidating a buffer after use is not required, but makes it possible to catch its possible accidental use. -.Pp +.PP The functions -.Fn lwres_buffer_add +\fBlwres_buffer_add()\fR and -.Fn lwres_buffer_subtract +\fBlwres_buffer_subtract()\fR respectively increase and decrease the used space in buffer -.Fa *b +\fI*b\fR by -.Fa n +\fIn\fR bytes. -.Fn lwres_buffer_add +\fBlwres_buffer_add()\fR checks for buffer overflow and -.Fn lwres_buffer_subtract +\fBlwres_buffer_subtract()\fR checks for underflow. These functions do not allocate or deallocate memory. They just change the value of -.Li used . -.Pp +\fBused\fR. +.PP A buffer is re-initialised by -.Fn lwres_buffer_clear . +\fBlwres_buffer_clear()\fR. The function sets -.Li used , -.Li current +\fBused\fR , +\fBcurrent\fR and -.Li active +\fBactive\fR to zero. -.Pp -.Fn lwres_buffer_first +.PP +\fBlwres_buffer_first\fR makes the consumed region of buffer -.Fa *p +\fI*p\fR empty by setting -.Li current +\fBcurrent\fR to zero (the start of the buffer). -.Pp -.Fn lwres_buffer_forward +.PP +\fBlwres_buffer_forward()\fR increases the consumed region of buffer -.Fa *b +\fI*b\fR by -.Fa n +\fIn\fR bytes, checking for overflow. Similarly, -.Fn lwres_buffer_back +\fBlwres_buffer_back()\fR decreases buffer -.Fa b 's +\fIb\fR's consumed region by -.Fa n +\fIn\fR bytes and checks for underflow. -.Pp -.Fn lwres_buffer_getuint8 +.PP +\fBlwres_buffer_getuint8()\fR reads an unsigned 8-bit integer from -.Fa *b +\fI*b\fR and returns it. -.Fn lwres_buffer_putuint8 +\fBlwres_buffer_putuint8()\fR writes the unsigned 8-bit integer -.Fa val +\fIval\fR to buffer -.Fa *b . -.Pp -.Fn lwres_buffer_getuint16 +\fI*b\fR. +.PP +\fBlwres_buffer_getuint16()\fR and -.Fn lwres_buffer_getuint32 +\fBlwres_buffer_getuint32()\fR are identical to -.Fn lwres_buffer_putuint8 +\fBlwres_buffer_putuint8()\fR except that they respectively read an unsigned 16-bit or 32-bit integer in network byte order from -.Fa b . +\fIb\fR. Similarly, -.Fn lwres_buffer_putuint16 +\fBlwres_buffer_putuint16()\fR and -.Fn lwres_buffer_putuint32 +\fBlwres_buffer_putuint32()\fR writes the unsigned 16-bit or 32-bit integer -.Fa val +\fIval\fR to buffer -.Fa b , +\fIb\fR, in network byte order. -.Pp +.PP Arbitrary amounts of data are read or written from a lightweight resolver buffer with -.Fn lwres_buffer_getmem +\fBlwres_buffer_getmem()\fR and -.Fn lwres_buffer_putmem +\fBlwres_buffer_putmem()\fR respectively. -.Fn lwres_buffer_putmem +\fBlwres_buffer_putmem()\fR copies -.Fa length +\fIlength\fR bytes of memory at -.Fa base +\fIbase\fR to -.Fa b. +\fIb\fR. Conversely, -.Fn lwres_buffer_getmem +\fBlwres_buffer_getmem()\fR copies -.Fa length +\fIlength\fR bytes of memory from -.Fa b +\fIb\fR to -.Fa base . -.Sh SEE ALSO +\fIbase\fR. diff --git a/lib/lwres/man/lwres_buffer.docbook b/lib/lwres/man/lwres_buffer.docbook index 37bf0f6099..09283b6c97 100644 --- a/lib/lwres/man/lwres_buffer.docbook +++ b/lib/lwres/man/lwres_buffer.docbook @@ -16,17 +16,17 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - + - + Jun 30, 2000 - lwres_buffer - 3 - BIND9 +lwres_buffer +3 +BIND9 diff --git a/lib/lwres/man/lwres_buffer.html b/lib/lwres/man/lwres_buffer.html new file mode 100644 index 0000000000..ae2ffd50cc --- /dev/null +++ b/lib/lwres/man/lwres_buffer.html @@ -0,0 +1,608 @@ + +lwres_buffer

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

Synopsis

#include <lwres/lwbuffer.h>

void +lwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length);

void +lwres_buffer_invalidate(lwres_buffer_t *b);

void +lwres_buffer_add(lwres_buffer_t *b, unsigned int n);

void +lwres_buffer_subtract(lwres_buffer_t *b, unsigned int n);

void +lwres_buffer_clear(lwres_buffer_t *b);

void +lwres_buffer_first(lwres_buffer_t *b);

void +lwres_buffer_forward(lwres_buffer_t *b, unsigned int n);

void +lwres_buffer_back(lwres_buffer_t *b, unsigned int n);

lwres_uint8_t +lwres_buffer_getuint8(lwres_buffer_t *b);

void +lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val);

lwres_uint16_t +lwres_buffer_getuint16(lwres_buffer_t *b);

void +lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val);

lwres_uint32_t +lwres_buffer_getuint32(lwres_buffer_t *b);

void +lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val);

void +lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base, unsigned int length);

void +lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base, unsigned int length);

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.

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 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.
+  b-d == remaining region.
+  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_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.

\ No newline at end of file diff --git a/lib/lwres/man/lwres_config.3 b/lib/lwres/man/lwres_config.3 index aa3095b8d7..ae9a781e98 100644 --- a/lib/lwres/man/lwres_config.3 +++ b/lib/lwres/man/lwres_config.3 @@ -12,97 +12,84 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_config.3,v 1.6 2001/01/09 21:49:18 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_CONFIG 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_conf_init , -.Nm lwres_conf_clear , -.Nm lwres_conf_parse , -.Nm lwres_conf_print , -.Nm lwres_conf_get -.Nd lightweight resolver configuration -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft void -.Fo lwres_conf_init -.Fa "lwres_context_t *ctx" -.Fc -.Ft void -.Fo lwres_conf_clear -.Fa "lwres_context_t *ctx" -.Fc -.Ft lwres_result_t -.Fo lwres_conf_parse -.Fa "lwres_context_t *ctx" -.Fa "const char *filename" -.Fc -.Ft lwres_result_t -.Fo lwres_conf_print -.Fa "lwres_context_t *ctx" -.Fa "FILE *fp" -.Fc -.Ft lwres_conf_t * -.Fo lwres_conf_get -.Fa "lwres_context_t *ctx" -.Fc -.Sh DESCRIPTION -.Fn lwres_conf_init +.TH "LWRES_CONFIG" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_conf_get \- lightweight resolver configuration +.SH SYNOPSIS +\fB#include +.sp +void +lwres_conf_init(lwres_context_t *ctx); +.sp +void +lwres_conf_clear(lwres_context_t *ctx); +.sp +lwres_result_t +lwres_conf_parse(lwres_context_t *ctx); +(const char *filename); +.sp +lwres_result_t +lwres_conf_print(lwres_context_t *ctx); +(FILE *fp); +.sp +lwres_conf_t * +lwres_conf_get(lwres_context_t *ctx); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_conf_init()\fR creates an empty -.Dv lwres_conf_t +\fBlwres_conf_t\fR structure for lightweight resolver context -.Fa ctx . -.Pp -.Fn lwres_conf_clear +\fIctx\fR. +.PP +\fBlwres_conf_clear()\fR frees up all the internal memory used by that -.Dv lwres_conf_t +\fBlwres_conf_t\fR structure in resolver context -.Fa ctx . -.Pp -.Fn lwres_conf_parse +\fIctx\fR. +.PP +\fBlwres_conf_parse()\fR opens the file -.Fa filename +\fIfilename\fR and parses it to initialise the resolver context -.Fa ctx 's -.Dv lwres_conf_t +\fIctx\fR's +\fBlwres_conf_t\fR structure. -.Pp -.Fn lwres_conf_print +.PP +\fBlwres_conf_print()\fR prints the -.Dv lwres_conf_t +\fBlwres_conf_t\fR structure for resolver context -.Fa ctx +\fIctx\fR to the -.Dv FILE -.Fa fp. -.Sh RETURN VALUES -.Fn lwres_conf_parse +\fBFILE\fR +\fIfp\fR. +.SH "RETURN VALUES" +.PP +\fBlwres_conf_parse()\fR returns -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS if it successfully read and parsed -.Fa filename . +\fIfilename\fR. It returns -.Er LWRES_R_FAILURE +LWRES_R_FAILURE if -.Fa filename +\fIfilename\fR could not be opened or contained incorrect resolver statements. -.Pp -.Fn lwres_conf_print +.PP +\fBlwres_conf_print()\fR returns -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS unless an error occurred when converting the network addresses to a numeric host address string. If this happens, the function returns -.Er LWRES_R_FAILURE . -.Sh SEE ALSO -.Xr stdio 3 , -.Xr resolver 5 . -.Sh FILES -.Pa /etc/resolv.conf +LWRES_R_FAILURE. +.SH "SEE ALSO" +.PP +\fBstdio\fR(3), +\fBresolver\fR(5). +.SH "FILES" +.PP +\fI/etc/resolv.conf\fR diff --git a/lib/lwres/man/lwres_config.docbook b/lib/lwres/man/lwres_config.docbook new file mode 100644 index 0000000000..3c8d13a0c6 --- /dev/null +++ b/lib/lwres/man/lwres_config.docbook @@ -0,0 +1,159 @@ + + + + + + + + +Jun 30, 2000 + + + +lwres_config +3 +BIND9 + + + +lwres_conf_init +lwres_conf_clear +lwres_conf_parse +lwres_conf_print +lwres_conf_get +lightweight resolver configuration + + + + +#include <lwres/lwres.h> + + +void +lwres_conf_init +lwres_context_t *ctx + + + +void +lwres_conf_clear +lwres_context_t *ctx + + + +lwres_result_t +lwres_conf_parse +lwres_context_t *ctx +const char *filename + + + +lwres_result_t +lwres_conf_print +lwres_context_t *ctx +FILE *fp + + + +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. + + + + +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 + + +stdio3 +, + +resolver5 +. + + +FILES + +/etc/resolv.conf + + + diff --git a/lib/lwres/man/lwres_config.html b/lib/lwres/man/lwres_config.html new file mode 100644 index 0000000000..67fbcdd883 --- /dev/null +++ b/lib/lwres/man/lwres_config.html @@ -0,0 +1,295 @@ + +lwres_config

lwres_config

Name

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

Synopsis

#include <lwres/lwres.h>

void +lwres_conf_init(lwres_context_t *ctx);

void +lwres_conf_clear(lwres_context_t *ctx);

lwres_result_t +lwres_conf_parse(lwres_context_t *ctx, const char *filename);

lwres_result_t +lwres_conf_print(lwres_context_t *ctx, FILE *fp);

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.

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).

FILES

/etc/resolv.conf

\ No newline at end of file diff --git a/lib/lwres/man/lwres_context.3 b/lib/lwres/man/lwres_context.3 index 93dea3d75f..6d6a170784 100644 --- a/lib/lwres/man/lwres_context.3 +++ b/lib/lwres/man/lwres_context.3 @@ -12,201 +12,183 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_context.3,v 1.6 2001/01/09 21:49:19 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_CONTEXT 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_context_create , -.Nm lwres_context_destroy , -.Nm lwres_context_nextserial , -.Nm lwres_context_initserial , -.Nm lwres_context_freemem , -.Nm lwres_context_allocmem , -.Nm lwres_context_sendrecv -.Nd lightweight resolver context management -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_context_create -.Fa "lwres_context_t **contextp" -.Fa "void *arg" -.Fa "lwres_malloc_t malloc_function" -.Fa "lwres_free_t free_function" -.Fc -.Ft lwres_result_t -.Fo lwres_context_destroy -.Fa "lwres_context_t **contextp" -.Fc -.Ft void -.Fo lwres_context_initserial -.Fa "lwres_context_t *ctx" -.Fa "lwres_uint32_t serial" -.Fc -.Ft lwres_uint32_t -.Fo lwres_context_nextserial -.Fa "lwres_context_t *ctx" -.Fc -.Ft void -.Fo lwres_context_freemem -.Fa "lwres_context_t *ctx" -.Fa "void *mem" -.Fa "size_t len" -.Fc -.Ft void -.Fo lwres_context_allocmem -.Fa "lwres_context_t *ctx" -.Fa "size_t len" -.Fc -.Ft void * -.Fo lwres_context_sendrecv -.Fa "lwres_context_t *ctx" -.Fa "void *sendbase" -.Fa "int sendlen" -.Fa "void *recvbase" -.Fa "int recvlen" -.Fa "int *recvd_len" -.Fc -.Sh DESCRIPTION -.Fn lwres_context_create +.TH "LWRES_CONTEXT" "3" "Jun 30, 2000" "BIND9" "" +.SH 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 +.SH SYNOPSIS +\fB#include +.sp +lwres_result_t +lwres_context_create(lwres_context_t **contextp); +(void *arg); +(lwres_malloc_t malloc_function); +(lwres_free_t free_function); +.sp +lwres_result_t +lwres_context_destroy(lwres_context_t **contextp); +.sp +void +lwres_context_initserial(lwres_context_t *ctx); +(lwres_uint32_t serial); +.sp +lwres_uint32_t +lwres_context_nextserial(lwres_context_t *ctx); +.sp +void +lwres_context_freemem(lwres_context_t *ctx); +(void *mem); +(size_t len); +.sp +void +lwres_context_allocmem(lwres_context_t *ctx); +(size_t len); +.sp +void * +lwres_context_sendrecv(lwres_context_t *ctx); +(void *sendbase); +(int sendlen); +(void *recvbase); +(int recvlen); +(int *recvd_len); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_context_create()\fR creates a -.Dv lwres_context_t +\fBlwres_context_t\fR structure for use in lightweight resolver operations. It holds a socket and other data needed for communicating with a resolver daemon. The new -.Dv lwres_context_t +\fBlwres_context_t\fR is returned throught -.Fa contextp , +\fIcontextp\fR, a pointer to a -.Dv "lwres_context_t" -pointer. This -.Dv "lwres_context_t" +\fBlwres_context_t\fR +pointer. This +\fBlwres_context_t\fR pointer must initially be NULL, and is modified to point to the newly created -.Dv "lwres_context_t" . -.Pp +\fBlwres_context_t\fR. +.PP When the lightweight resolver needs to perform dynamic memory allocation, it will call -.Fa malloc_function +\fImalloc_function\fR to allocate memory and -.Fa free_function -to free it. If -.Fa malloc_function +\fIfree_function\fR +to free it. If +\fImalloc_function\fR and -.Fa free_function +\fIfree_function\fR are NULL, memory is allocated using -.Xr malloc 3 +\&.Xr malloc 3 and -.Xr free 3 . +\fBfree\fR(3). It is not permitted to have a NULL -.Fa malloc_function +\fImalloc_function\fR and a non-NULL -.Fa free_function +\fIfree_function\fR or vice versa. -.Fa arg +\fIarg\fR is passed as the first parameter to the memory -allocation functions. +allocation functions. If -.Fa malloc_function +\fImalloc_function\fR and -.Fa free_function +\fIfree_function\fR are NULL, -.Fa arg +\fIarg\fR is unused and should be passed as NULL. -.P +.PP Once memory for the structure has been allocated, it is initialized using -.Xr lwres_conf_init 3 +\fBlwres_conf_init\fR(3) and returned via -.Fa *contextp . -.Pp -.Fn lwres_context_destroy +\fI*contextp\fR. +.PP +\fBlwres_context_destroy()\fR destroys a -.Dv "lwres_context_t" , +\fBlwres_context_t\fR, closing its socket. -.Fa contextp +\fIcontextp\fR 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. -.Pp +.PP 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 -.Fn lwres_context_initserial +\fBlwres_context_initserial()\fR and -.Fn lwres_context_nextserial . -.Fn lwres_context_initserial +\fBlwres_context_nextserial()\fR. +\fBlwres_context_initserial()\fR sets the serial number for context -.Fa *ctx +\fI*ctx\fR to -.Fa serial . -.Fn lwres_context_nextserial +\fIserial\fR. +\fBlwres_context_nextserial()\fR increments the serial number and returns the previous value. -.Pp +.PP Memory for a lightweight resolver context is allocated and freed using -.Fn lwres_context_allocmem +\fBlwres_context_allocmem()\fR and -.Fn lwres_context_freemem . +\fBlwres_context_freemem()\fR. These use whatever allocations were defined when the context was created with -.Fn lwres_context_create . -.Fn lwres_context_allocmem +\fBlwres_context_create()\fR. +\fBlwres_context_allocmem()\fR allocates -.Fa len +\fIlen\fR bytes of memory and if successful returns a pointer to the allocated storage. -.Fn lwres_context_allocmem +\fBlwres_context_allocmem()\fR checks that -.Fa len +\fIlen\fR must be greater than 0. -.Fn lwres_context_freemem +\fBlwres_context_freemem()\fR frees -.Fa len +\fIlen\fR bytes of space starting at location -.Fa mem . -.Pp -.Fn lwres_context_sendrecv +\fImem\fR. +.PP +\fBlwres_context_sendrecv()\fR performs I/O for the context -.Fa ctx . +\fIctx\fR. Data are read and written from the context's socket. It writes data from -.Fa sendbase -- typically a lightweight resolver query packet - +\fIsendbase\fR +\(em typically a lightweight resolver query packet \(em and waits for a reply which is copied to the receive buffer at -.Fa recvbase . +\fIrecvbase\fR. The number of bytes that were written to this receive buffer is returned in -.Fa *recvd_len . -.Sh RETURN VALUES -.Fn lwres_context_create +\fI*recvd_len\fR. +.SH "RETURN VALUES" +.PP +\fBlwres_context_create()\fR returns -.Er LWRES_R_NOMEMORY +LWRES_R_NOMEMORY if memory for the -.Dv "struct lwres_context" +\fBstruct lwres_context\fR could not be allocated, -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS otherwise. -.Pp +.PP Successful calls to the memory allocator -.Fn lwres_context_allocmem +\fBlwres_context_allocmem()\fR return a pointer to the start of the allocated space. It returns NULL if memory could not be allocated. -.Pp -.Er LWRES_R_SUCCESS +.PP +LWRES_R_SUCCESS is returned when -.Fn lwres_context_sendrecv +\fBlwres_context_sendrecv()\fR completes successfully. -.Er LWRES_R_IOERROR +LWRES_R_IOERROR is returned if an I/O error occurs and -.Er LWRES_R_TIMEOUT +LWRES_R_TIMEOUT is returned if -.Fn lwres_context_sendrecv +\fBlwres_context_sendrecv()\fR times out waiting for a response. -.Sh SEE ALSO -.Xr lwres_conf_init 3 , -.Xr malloc 3 , -.Xr free 3 +.SH "SEE ALSO" +.PP +\fBlwres_conf_init\fR(3), +\fBmalloc\fR(3), +\fBfree\fR(3). diff --git a/lib/lwres/man/lwres_context.docbook b/lib/lwres/man/lwres_context.docbook new file mode 100644 index 0000000000..cd2f1ed825 --- /dev/null +++ b/lib/lwres/man/lwres_context.docbook @@ -0,0 +1,287 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_context +3 +BIND9 + + +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_result_t +lwres_context_destroy +lwres_context_t **contextp + + + +void +lwres_context_initserial +lwres_context_t *ctx +lwres_uint32_t serial + + + +lwres_uint32_t +lwres_context_nextserial +lwres_context_t *ctx + + + +void +lwres_context_freemem +lwres_context_t *ctx +void *mem +size_t len + + + +void +lwres_context_allocmem +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 + + + + +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 throught +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 + +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 + +is unused and should be passed as NULL. + + +Once memory for the structure has been allocated, +it is initialized using + +lwres_conf_init3 + + +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_allocmem() +checks that +len +must be greater than 0. +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. + + +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 + +. + + + diff --git a/lib/lwres/man/lwres_context.html b/lib/lwres/man/lwres_context.html new file mode 100644 index 0000000000..b9e2b69390 --- /dev/null +++ b/lib/lwres/man/lwres_context.html @@ -0,0 +1,531 @@ + +lwres_context

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

Synopsis

#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_result_t +lwres_context_destroy(lwres_context_t **contextp);

void +lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial);

lwres_uint32_t +lwres_context_nextserial(lwres_context_t *ctx);

void +lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len);

void +lwres_context_allocmem(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);

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 throught +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.

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.

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_allocmem() +checks that +len +must be greater than 0. +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.

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), + +malloc(3), + +free(3).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_gabn.3 b/lib/lwres/man/lwres_gabn.3 index 960a7490c8..880aaed316 100644 --- a/lib/lwres/man/lwres_gabn.3 +++ b/lib/lwres/man/lwres_gabn.3 @@ -12,83 +12,66 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_gabn.3,v 1.6 2001/01/09 21:49:33 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GABN 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_gabnrequest_render , -.Nm lwres_gabnresponse_render , -.Nm lwres_gabnrequest_parse , -.Nm lwres_gabnresponse_parse , -.Nm lwres_gabnresponse_free , -.Nm lwres_gabnrequest_free -.Nd lightweight resolver getaddrbyname message handling -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_gabnrequest_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_gabnrequest_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_gabnresponse_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_gabnresponse_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_gabnrequest_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_gabnrequest_t **structp" -.Fc -.Ft lwres_result_t -.Fo lwres_gabnresponse_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_gabnresponse_t **structp" -.Fc -.Ft void -.Fo lwres_gabnresponse_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_gabnresponse_t **structp" -.Fc -.Ft void -.Fo lwres_gabnrequest_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_gabnrequest_t **structp" -.Fc -.Sh DESCRIPTION +.TH "LWRES_GABN" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling +.SH SYNOPSIS +\fB#include +.sp +lwres_result_t +lwres_gabnrequest_render(lwres_context_t *ctx); +(lwres_gabnrequest_t *req); +(lwres_lwpacket_t *pkt); +(lwres_buffer_t *b); +.sp +lwres_result_t +lwres_gabnresponse_render(lwres_context_t *ctx); +(lwres_gabnresponse_t *req); +(lwres_lwpacket_t *pkt); +(lwres_buffer_t *b); +.sp +lwres_result_t +lwres_gabnrequest_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_gabnrequest_t **structp); +.sp +lwres_result_t +lwres_gabnresponse_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_gabnresponse_t **structp); +.sp +void +lwres_gabnresponse_free(lwres_context_t *ctx); +(lwres_gabnresponse_t **structp); +.sp +void +lwres_gabnrequest_free(lwres_context_t *ctx); +(lwres_gabnrequest_t **structp); +\fR.SH "DESCRIPTION" +.PP These are low-level routines for creating and parsing lightweight resolver name-to-address lookup request and response messages. -.P +.PP There are four main functions for the getaddrbyname opcode. -One render function converts a getaddrbyname request structure - -.Dv lwres_gabnrequest_t - +One render function converts a getaddrbyname request structure \(em +\fBlwres_gabnrequest_t\fR \(em 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 - -.Dv lwres_gabnresponse_t +Another render function converts the getaddrbyname response structure \(em +\fBlwres_gabnresponse_t\fR \(em to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure. -.Pp +.PP These structures are defined in -.Pa . +\fI\fR. They are shown below. -.Bd -literal -offset indent +.sp +.nf #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U typedef struct lwres_addr lwres_addr_t; @@ -113,95 +96,98 @@ typedef struct { void *base; size_t baselen; } lwres_gabnresponse_t; -.Ed -.Pp -.Fn lwres_gabnrequest_render +.sp +.fi +.PP +\fBlwres_gabnrequest_render()\fR uses resolver context -.Fa ctx +\fIctx\fR to convert getaddrbyname request structure -.Fa req +\fIreq\fR to canonical format. The packet header structure -.Fa pkt +\fIpkt\fR is initialised and transferred to buffer -.Fa b . +\fIb\fR. The contents of -.Fa *req +\fI*req\fR are then appended to the buffer in canonical format. -.Fn lwres_gabnresponse_render +\fBlwres_gabnresponse_render()\fR performs the same task, except it converts a getaddrbyname response structure -.Dv lwres_gabnresponse_t +\fBlwres_gabnresponse_t\fR to the lightweight resolver's canonical format. -.Pp -.Fn lwres_gabnrequest_parse +.PP +\fBlwres_gabnrequest_parse()\fR uses context -.Fa ctx +\fIctx\fR to convert the contents of packet -.Fa pkt +\fIpkt\fR to a -.Dv lwres_gabnrequest_t +\fBlwres_gabnrequest_t\fR structure. Buffer -.Fa b +\fIb\fR provides space to be used for storing this structure. When the function succeeds, the resulting -.Dv lwres_gabnrequest_t +\fBlwres_gabnrequest_t\fR is made available through -.Fa *structp . -.Fn lwres_gabnresponse_parse +\fI*structp\fR. +\fBlwres_gabnresponse_parse()\fR offers the same semantics as -.Fn lwres_gabnrequest_parse +\fBlwres_gabnrequest_parse()\fR except it yields a -.Dv lwres_gabnresponse_t +\fBlwres_gabnresponse_t\fR structure. -.Pp -.Fn lwres_gabnresponse_free +.PP +\fBlwres_gabnresponse_free()\fR and -.Fn lwres_gabnrequest_free +\fBlwres_gabnrequest_free()\fR release the memory in resolver context -.Fa ctx +\fIctx\fR that was allocated to the -.Dv lwres_gabnresponse_t +\fBlwres_gabnresponse_t\fR or -.Dv lwres_gabnrequest_t +\fBlwres_gabnrequest_t\fR structures referenced via -.Fa structp . +\fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded. -.Sh RETURN VALUES +.SH "RETURN VALUES" +.PP The getaddrbyname opcode functions -.Fn lwres_gabnrequest_render , -.Fn lwres_gabnresponse_render -.Fn lwres_gabnrequest_parse +\fBlwres_gabnrequest_render()\fR, +\fBlwres_gabnresponse_render()\fR +\fBlwres_gabnrequest_parse()\fR and -.Fn lwres_gabnresponse_parse +\fBlwres_gabnresponse_parse()\fR all return -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS on success. They return -.Er LWRES_R_NOMEMORY +LWRES_R_NOMEMORY if memory allocation fails. -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer -.Fa b +\fIb\fR is too small to accommodate the packet header or the -.Dv lwres_gabnrequest_t +\fBlwres_gabnrequest_t\fR and -.Dv lwres_gabnresponse_t +\fBlwres_gabnresponse_t\fR structures. -.Fn lwres_gabnrequest_parse +\fBlwres_gabnrequest_parse()\fR and -.Fn lwres_gabnresponse_parse +\fBlwres_gabnresponse_parse()\fR will return -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the received packet. These functions will return -.Er LWRES_R_FAILURE +LWRES_R_FAILURE if -.Li pktflags +\fBpktflags\fR in the packet header structure -.Dv lwres_lwpacket_t +\fBlwres_lwpacket_t\fR indicate that the packet is not a response to an earlier query. -.Sh SEE ALSO -.Xr lwres_packet 3 +.SH "SEE ALSO" +.PP +\fBlwres_packet\fR(3) diff --git a/lib/lwres/man/lwres_gabn.docbook b/lib/lwres/man/lwres_gabn.docbook new file mode 100644 index 0000000000..e4d784354a --- /dev/null +++ b/lib/lwres/man/lwres_gabn.docbook @@ -0,0 +1,255 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_gabn +3 +BIND9 + + +lwres_gabnrequest_render +lwres_gabnresponse_render +lwres_gabnrequest_parse +lwres_gabnresponse_parse +lwres_gabnresponse_free +lwres_gabnrequest_free +lightweight resolver getaddrbyname message handling + + + +#include <lwres/lwres.h> + + +lwres_result_t +lwres_gabnrequest_render +lwres_context_t *ctx +lwres_gabnrequest_t *req +lwres_lwpacket_t *pkt +lwres_buffer_t *b + + + +lwres_result_t +lwres_gabnresponse_render +lwres_context_t *ctx +lwres_gabnresponse_t *req +lwres_lwpacket_t *pkt +lwres_buffer_t *b + + + +lwres_result_t +lwres_gabnrequest_parse +lwres_context_t *ctx +lwres_buffer_t *b +lwres_lwpacket_t *pkt +lwres_gabnrequest_t **structp + + + +lwres_result_t +lwres_gabnresponse_parse +lwres_context_t *ctx +lwres_buffer_t *b +lwres_lwpacket_t *pkt +lwres_gabnresponse_t **structp + + + +void +lwres_gabnresponse_free +lwres_context_t *ctx +lwres_gabnresponse_t **structp + + + +void +lwres_gabnrequest_free +lwres_context_t *ctx +lwres_gabnrequest_t **structp + + + + +DESCRIPTION + +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. + + +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; + 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; + + + +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. + +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. + + + +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. + + + +SEE ALSO + + +lwres_packet3 + + + + + diff --git a/lib/lwres/man/lwres_gabn.html b/lib/lwres/man/lwres_gabn.html new file mode 100644 index 0000000000..e4486a088a --- /dev/null +++ b/lib/lwres/man/lwres_gabn.html @@ -0,0 +1,442 @@ + +lwres_gabn

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

Synopsis

#include <lwres/lwres.h>

lwres_result_t +lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);

lwres_result_t +lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);

void +lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp);

void +lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp);

DESCRIPTION

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.

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;
+	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;

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. + +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.

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.

SEE ALSO

lwres_packet(3)

\ No newline at end of file diff --git a/lib/lwres/man/lwres_gai_strerror.3 b/lib/lwres/man/lwres_gai_strerror.3 index 32c6f4efe6..a3086e1ca5 100644 --- a/lib/lwres/man/lwres_gai_strerror.3 +++ b/lib/lwres/man/lwres_gai_strerror.3 @@ -12,71 +12,74 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_gai_strerror.3,v 1.6 2001/01/09 21:49:40 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GAI_STRERROR 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm gai_strerror -.Nd print suitable error string -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft char * -.Fo gai_strerror -.Fa "int ecode" -.Fc -.Sh DESCRIPTION -.Fn lwres_gai_strerror +.TH "LWRES_GAI_STRERROR" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +gai_strerror \- print suitable error string +.SH SYNOPSIS +\fB#include +.sp +char * +gai_strerror(int ecode); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_gai_strerror()\fR returns an error message corresponding to an error code returned by -.Fn getaddrinfo . +\fBgetaddrinfo()\fR. The following error codes and their meaning are defined in -.Aq Pa include/lwres/netdb.h . -.Bl -tag -width EAI_ADDRFAMILY -offset indent -compact -.It Dv EAI_ADDRFAMILY +\fIinclude/lwres/netdb.h\fR. +.TP +\fBEAI_ADDRFAMILY\fR address family for hostname not supported -.It Dv EAI_AGAIN +.TP +\fBEAI_AGAIN\fR temporary failure in name resolution -.It Dv EAI_BADFLAGS +.TP +\fBEAI_BADFLAGS\fR invalid value for -.Li ai_flags -.It Dv EAI_FAIL +ai_flags +.TP +\fBEAI_FAIL\fR non-recoverable failure in name resolution -.It Dv EAI_FAMILY -.Li ai_family +.TP +\fBEAI_FAMILY\fR +ai_family not supported -.It Dv EAI_MEMORY +.TP +\fBEAI_MEMORY\fR memory allocation failure -.It Dv EAI_NODATA +.TP +\fBEAI_NODATA\fR no address associated with hostname -.It Dv EAI_NONAME +.TP +\fBEAI_NONAME\fR hostname or servname not provided, or not known -.It Dv EAI_SERVICE +.TP +\fBEAI_SERVICE\fR servname not supported for -.Li ai_socktype -.It Dv EAI_SOCKTYPE -.Li ai_socktype +ai_socktype +.TP +\fBEAI_SOCKTYPE\fR +ai_socktype not supported -.It Dv EAI_SYSTEM +.TP +\fBEAI_SYSTEM\fR system error returned in errno -.El -The message \*qinvalid error code\*q is returned if -.Fa ecode +.PP +The message \fBinvalid error code\fR is returned if +\fIecode\fR is out of range. -.Pp -.Li ai_flags , -.Li ai_family +.PP +ai_flags, +ai_family and -.Li ai_socktype +ai_socktype are elements of the -.Dv "struct addrinfo" +\fBstruct addrinfo\fR used by -.Fn lwres_getaddrinfo . -.Sh SEE ALSO -.Xr strerror 3 , -.Xr lwres_getaddrinfo 3 , -.Xr getaddrinfo 3 , -.Xr RFC2133 . +\fBlwres_getaddrinfo()\fR. +.SH "SEE ALSO" +.PP +\fBstrerror\fR(3), +\fBlwres_getaddrinfo\fR(3), +\fBgetaddrinfo\fR(3), +\fBRFC2133\fR. diff --git a/lib/lwres/man/lwres_gai_strerror.docbook b/lib/lwres/man/lwres_gai_strerror.docbook new file mode 100644 index 0000000000..21d7ad0c76 --- /dev/null +++ b/lib/lwres/man/lwres_gai_strerror.docbook @@ -0,0 +1,154 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_gai_strerror +3 +BIND9 + + +gai_strerror +print suitable error string + + + +#include <lwres/netdb.h> + + +char * +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. + +EAI_ADDRFAMILY + + +address family for hostname not supported + +EAI_AGAIN + + +temporary failure in name resolution + +EAI_BADFLAGS + + +invalid value for +ai_flags + +EAI_FAIL + + +non-recoverable failure in name resolution + +EAI_FAMILY + + +ai_family +not supported + +EAI_MEMORY + + +memory allocation failure + +EAI_NODATA + + +no address associated with hostname + +EAI_NONAME + + +hostname or servname not provided, or not known + +EAI_SERVICE + + +servname not supported for +ai_socktype + +EAI_SOCKTYPE + + +ai_socktype +not supported + +EAI_SYSTEM + + +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(). + + + + +SEE ALSO + + +strerror3 +, + + +lwres_getaddrinfo3 +, + + +getaddrinfo3 +, + + +RFC2133 +. + + + diff --git a/lib/lwres/man/lwres_gai_strerror.html b/lib/lwres/man/lwres_gai_strerror.html new file mode 100644 index 0000000000..b836683a7d --- /dev/null +++ b/lib/lwres/man/lwres_gai_strerror.html @@ -0,0 +1,297 @@ + +lwres_gai_strerror

lwres_gai_strerror

Name

gai_strerror -- print suitable error string

Synopsis

#include <lwres/netdb.h>

char * +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. +

EAI_ADDRFAMILY

address family for hostname not supported

EAI_AGAIN

temporary failure in name resolution

EAI_BADFLAGS

invalid value for +ai_flags

EAI_FAIL

non-recoverable failure in name resolution

EAI_FAMILY

ai_family +not supported

EAI_MEMORY

memory allocation failure

EAI_NODATA

no address associated with hostname

EAI_NONAME

hostname or servname not provided, or not known

EAI_SERVICE

servname not supported for +ai_socktype

EAI_SOCKTYPE

ai_socktype +not supported

EAI_SYSTEM

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().

SEE ALSO

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

\ No newline at end of file diff --git a/lib/lwres/man/lwres_getaddrinfo.3 b/lib/lwres/man/lwres_getaddrinfo.3 index 338a093b84..ad367653f4 100644 --- a/lib/lwres/man/lwres_getaddrinfo.3 +++ b/lib/lwres/man/lwres_getaddrinfo.3 @@ -12,37 +12,26 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_getaddrinfo.3,v 1.8 2001/01/09 21:49:41 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GETADDRINFO 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_getaddrinfo , -.Nm lwres_freeaddrinfo -.Nd socket address structure to host and service name -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft int -.Fo lwres_getaddrinfo -.Fa "const char *hostname" -.Fa "const char *servname" -.Fa "const struct addrinfo *hints" -.Fa "struct addrinfo **res" -.Fc -.Ft void -.Fo lwres_freeaddrinfo -.Fa "struct addrinfo *ai" -.Fc -.Pp +.TH "LWRES_GETADDRINFO" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_getaddrinfo, lwres_freeaddrinfo \- socket address structure to host and service name +.SH SYNOPSIS +\fB#include +.sp +int +lwres_getaddrinfo(const char *hostname); +(const char *servname); +(const struct addrinfo *hints); +(struct addrinfo **res); +.sp +void +lwres_freeaddrinfo(struct addrinfo *ai); +\fR.PP If the operating system does not provide a -.Dv "struct addrinfo" , +\fBstruct addrinfo\fR, the following structure is used: -.Pp -.Bd -literal -offset indent +.sp +.nf struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ int ai_family; /* PF_xxx */ @@ -53,206 +42,211 @@ struct addrinfo { struct sockaddr *ai_addr; /* binary address */ struct addrinfo *ai_next; /* next structure in linked list */ }; -.Ed -.Sh DESCRIPTION -.Pp -.Fn lwres_getaddrinfo +.sp +.fi +.SH "DESCRIPTION" +.PP +\fBlwres_getaddrinfo()\fR is used to get a list of IP addresses and port numbers for host -.Fa hostname +\fIhostname\fR and service -.Fa servname . +\fIservname\fR. The function is the lightweight resolver's implementation of -.Fn getaddrinfo +\fBgetaddrinfo()\fR as defined in RFC2133. -.Fa hostname +\fIhostname\fR and -.Fa servname +\fIservname\fR are pointers to null-terminated strings or -.Dv NULL . -.Fa hostname +\fBNULL\fR. +\fIhostname\fR is either a host name or a numeric host address string: a dotted decimal IPv4 address or an IPv6 address. -.Fa servname +\fIservname\fR is either a decimal port number or a service name as listed in -.Pa /etc/services . -.Pp -.Fa hints +\fI/etc/services\fR. +.PP +\fIhints\fR is an optional pointer to a -.Dv "struct addrinfo" . +\fBstruct addrinfo\fR. 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 -.Fa *hints : -.Bl -tag -width ai_socktyp -offset indent -compact -.It Li ai_family -the protocol family that should be used. +\fI*hints\fR: +.TP +\fBai_family\fR +The protocol family that should be used. When -.Li ai_family +ai_family is set to -.Dv PF_UNSPEC , +\fBPF_UNSPEC\fR, it means the caller will accept any protocol family supported by the operating system. -.It Dv ai_socktype -denotes the type of socket - -.Dv SOCK_STREAM , -.Dv SOCK_DGRAM +.TP +\fBai_socktype\fR +denotes the type of socket \(em +\fBSOCK_STREAM\fR, +\fBSOCK_DGRAM\fR or -.Dv SOCK_RAW -- that is wanted. +\fBSOCK_RAW\fR +\(em that is wanted. When -.Li ai_socktype +ai_socktype is zero the caller will accept any socket type. -.It Li ai_protocol +.TP +\fBai_protocol\fR indicates which transport protocol is wanted: IPPROTO_UDP or IPPROTO_TCP. If -.Li ai_protocol +ai_protocol is zero the caller will accept any protocol. -.It Li ai_flags +.TP +\fBai_flags\fR Flag bits. If the -.Dv AI_CANONNAME +\fBAI_CANONNAME\fR bit is set, a successful call to -.Fn lwres_getaddrinfo +\fBlwres_getaddrinfo()\fR will return a a null-terminated string containing the canonical name of the specified hostname in -.Li ai_canonname +ai_canonname of the first -.Dv addrinfo +\fBaddrinfo\fR structure returned. Setting the -.Dv AI_PASSIVE +\fBAI_PASSIVE\fR bit indicates that the returned socket address structure is intended for used in a call to -.Xr bind 2 . +\fBbind\fR(2). In this case, if the hostname argument is a -.Dv NULL +\fBNULL\fR pointer, then the IP address portion of the socket address structure will be set to -.Dv INADDR_ANY +\fBINADDR_ANY\fR for an IPv4 address or -.Dv IN6ADDR_ANY_INIT +\fBIN6ADDR_ANY_INIT\fR for an IPv6 address. -.Pp + When -.Li ai_flags +ai_flags does not set the -.Dv AI_PASSIVE +\fBAI_PASSIVE\fR bit, the returned socket address structure will be ready for use in a call to -.Xr connect 2 +\fBconnect\fR(2) for a connection-oriented protocol or -.Xr connect 2 , -.Xr sendto 2 , +\fBconnect\fR(2), +\fBsendto\fR(2), or -.Xr sendmsg 2 +\fBsendmsg\fR(2) if a connectionless protocol was chosen. The IP address portion of the socket address structure will be set to the loopback address if -.Fa hostname +\fIhostname\fR is a -.Dv NULL +\fBNULL\fR pointer and -.Dv AI_PASSIVE +\fBAI_PASSIVE\fR is not set in -.Li ai_flags . -.Pp +ai_flags. + If -.Li ai_flags +ai_flags is set to -.Dv AI_NUMERICHOST +\fBAI_NUMERICHOST\fR it indicates that -.Fa hostname +\fIhostname\fR should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. -.El -.Pp +.PP All other elements of the -.Dv "struct addrinfo" +\fBstruct addrinfo\fR passed via -.Fa hints +\fIhints\fR must be zero. -.Pp +.PP A -.Fa hints +\fIhints\fR of -.Dv NULL +\fBNULL\fR is treated as if the caller provided a -.Dv "struct addrinfo" +\fBstruct addrinfo\fR initialized to zero with -.Li ai_family set to -.Li PF_UNSPEC . -.Pp +ai_familyset to +PF_UNSPEC. +.PP After a successful call to -.Fn lwres_getaddrinfo , -.Fa *res +\fBlwres_getaddrinfo()\fR, +\fI*res\fR is a pointer to a linked list of one or more -.Dv addrinfo +\fBaddrinfo\fR structures. Each -.Dv "struct addrinfo" +\fBstruct addrinfo\fR in this list cn be processed by following the -.Li ai_next +ai_next pointer, until a -.Dv NULL +\fBNULL\fR pointer is encountered. The three members -.Li ai_family , -.Li ai_socktype , +ai_family, +ai_socktype, and -.Li ai_protocol +ai_protocol in each returned -.Dv addrinfo +\fBaddrinfo\fR structure contain the corresponding arguments for a call to -.Xr socket 2 . +\fBsocket\fR(2). For each -.Dv addrinfo +\fBaddrinfo\fR structure in the list, the -.Li ai_addr +ai_addr member points to a filled-in socket address structure of length -.Li ai_addrlen . -.Pp +ai_addrlen. +.PP All of the information returned by -.Fn lwres_getaddrinfo +\fBlwres_getaddrinfo()\fR is dynamically allocated: the addrinfo structures, and the socket address structures and canonical host name strings pointed to by the -.Li addrinfo structures. +addrinfostructures. Memory allocated for the dynamically allocated structures created by a successful call to -.Fn lwres_getaddrinfo +\fBlwres_getaddrinfo()\fR is released by -.Fn lwres_freeaddrinfo . -.Fa ai +\fBlwres_freeaddrinfo()\fR. +\fIai\fR is a pointer to a -.Dv "struct addrinfo" +\fBstruct addrinfo\fR created by a call to -.Fn lwres_getaddrinfo . -.Sh RETURN VALUES -.Fn lwres_getaddrinfo +\fBlwres_getaddrinfo()\fR. +.SH "RETURN VALUES" +.PP +\fBlwres_getaddrinfo()\fR returns zero on success or one of the error codes listed in -.Xr gai_strerror 3 +\fBgai_strerror\fR(3) if an error occurs. If both -.Fa hostname +\fIhostname\fR and -.Fa servname +\fIservname\fR are -.Dv NULL -.Fn lwres_getaddrinfo +\fBNULL\fR +\fBlwres_getaddrinfo()\fR returns -.Er EAI_NONAME . -.Sh SEE ALSO -.Xr lwres 3 , -.Xr lwres_getaddrinfo 3 , -.Xr lwres_freeaddrinfo 3 , -.Xr lwres_gai_strerror 3 , -.Xr RFC2133 , -.Xr getservbyname 3 , -.Xr bind 2 , -.Xr connect 2 , -.Xr sendto 2 , -.Xr sendmsg 2 , -.Xr socket 2 . +EAI_NONAME. +.SH "SEE ALSO" +.PP +\fBlwres\fR(3), +\fBlwres_getaddrinfo\fR(3), +\fBlwres_freeaddrinfo\fR(3), +\fBlwres_gai_strerror\fR(3), +\fBRFC2133\fR, +\fBgetservbyname\fR(3), +\fBbind\fR(2), +\fBconnect\fR(2), +\fBsendto\fR(2), +\fBsendmsg\fR(2), +\fBsocket\fR(2). diff --git a/lib/lwres/man/lwres_getaddrinfo.docbook b/lib/lwres/man/lwres_getaddrinfo.docbook new file mode 100644 index 0000000000..ef589eb40c --- /dev/null +++ b/lib/lwres/man/lwres_getaddrinfo.docbook @@ -0,0 +1,382 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_getaddrinfo +3 +BIND9 + + +lwres_getaddrinfo +lwres_freeaddrinfo +socket address structure to host and service name + + + +#include <lwres/netdb.h> + + +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: + + +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 */ +}; + + + + + + +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. + +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. +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 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 + +bind2 +. + +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 + +connect2 + + +for a connection-oriented protocol or + +connect2 +, + + +sendto2 +, + +or + +sendmsg2 + + +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 + +socket2 +. + +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(). + + + + +RETURN VALUES + +lwres_getaddrinfo() +returns zero on success or one of the error codes listed in + +gai_strerror3 + + +if an error occurs. +If both +hostname +and +servname +are +NULL +lwres_getaddrinfo() +returns +EAI_NONAME. + + + + +SEE ALSO + + +lwres3 +, + + +lwres_getaddrinfo3 +, + + +lwres_freeaddrinfo3 +, + + +lwres_gai_strerror3 +, + + +RFC2133 +, + + +getservbyname3 +, + + +bind2 +, + + +connect2 +, + + +sendto2 +, + + +sendmsg2 +, + + +socket2 +. + + + + diff --git a/lib/lwres/man/lwres_getaddrinfo.html b/lib/lwres/man/lwres_getaddrinfo.html new file mode 100644 index 0000000000..6fa1e07fcb --- /dev/null +++ b/lib/lwres/man/lwres_getaddrinfo.html @@ -0,0 +1,739 @@ + +lwres_getaddrinfo

lwres_getaddrinfo

Name

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

Synopsis

#include <lwres/netdb.h>

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: + +

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 */
+};

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. + +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.

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 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().

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), + +lwres_getaddrinfo(3), + +lwres_freeaddrinfo(3), + +lwres_gai_strerror(3), + +RFC2133, + +getservbyname(3), + +bind(2), + +connect(2), + +sendto(2), + +sendmsg(2), + +socket(2).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_gethostent.3 b/lib/lwres/man/lwres_gethostent.3 index 26e242fb43..5bd02d7895 100644 --- a/lib/lwres/man/lwres_gethostent.3 +++ b/lib/lwres/man/lwres_gethostent.3 @@ -12,100 +12,73 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_gethostent.3,v 1.7 2001/01/09 21:49:49 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GETHOSTENT 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_gethostbyname , -.Nm lwres_gethostbyname2 , -.Nm lwres_gethostbyaddr , -.Nm lwres_gethostent , -.Nm lwres_sethostent , -.Nm lwres_endhostent , -.Nm lwres_gethostbyname_r , -.Nm lwres_gethostbyaddr_r , -.Nm lwres_gethostent_r , -.Nm lwres_sethostent_r , -.Nm lwres_endhostent_r -.Nd lightweight resolver get network host entry -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft struct hostent * -.Fo lwres_gethostbyname -.Fa "const char *name" -.Fc -.Ft struct hostent * -.Fo lwres_gethostbyname2 -.Fa "const char *name" -.Fa "int af" -.Fc -.Ft struct hostent * -.Fo lwres_gethostbyaddr -.Fa "const char *addr" -.Fa "int len" -.Fa "int type" -.Fc -.Ft struct hostent * -.Fo lwres_gethostent -.Fa "void" -.Fc -.Ft void -.Fo lwres_sethostent -.Fa "int stayopen" -.Fc -.Ft void -.Fo lwres_endhostent -.Fa "void" -.Fc -.Ft struct hostent * -.Fo lwres_gethostbyname_r -.Fa "const char *name" -.Fa "struct hostent *resbuf" -.Fa "char *buf" -.Fa "int buflen" -.Fa "int *error" -.Fc -.Ft struct hostent * -.Fo lwres_gethostbyaddr_r -.Fa "const char *addr" -.Fa "int len" -.Fa "int type" -.Fa "struct hostent *resbuf" -.Fa "char *buf" -.Fa "int buflen" -.Fa "int *error" -.Fc -.Ft struct hostent * -.Fo lwres_gethostent_r -.Fa "struct hostent *resbuf" -.Fa "char *buf" -.Fa "int buflen" -.Fa "int *error" -.Fc -.Ft void -.Fo lwres_sethostent_r -.Fa "int stayopen" -.Fc -.Ft void -.Fo lwres_endhostent_r -.Fa "void" -.Fc -.Sh DESCRIPTION +.TH "LWRES_GETHOSTENT" "3" "Jun 30, 2000" "BIND9" "" +.SH 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 +.SH SYNOPSIS +\fB#include +.sp +struct hostent * +lwres_gethostbyname(const char *name); +.sp +struct hostent * +lwres_gethostbyname2(const char *name); +(int af); +.sp +struct hostent * +lwres_gethostbyaddr(const char *addr); +(int len); +(int type); +.sp +struct hostent * +lwres_gethostent(void); +.sp +void +lwres_sethostent(int stayopen); +.sp +void +lwres_endhostent(void); +.sp +struct hostent * +lwres_gethostbyname_r(const char *name); +(struct hostent *resbuf); +(char *buf); +(int buflen); +(int *error); +.sp +struct hostent * +lwres_gethostbyaddr_r(const char *addr); +(int len); +(int type); +(struct hostent *resbuf); +(char *buf); +(int buflen); +(int *error); +.sp +struct hostent * +lwres_gethostent_r(struct hostent *resbuf); +(char *buf); +(int buflen); +(int *error); +.sp +void +lwres_sethostent_r(int stayopen); +.sp +void +lwres_endhostent_r(void); +\fR.SH "DESCRIPTION" +.PP These functions provide hostname-to-address and address-to-hostname lookups by means of the lightweight resolver. They are similar to the standard -.Xr gethostent 3 +\fBgethostent\fR(3) functions provided by most operating systems. They use a -.Dv "struct hostent" +\fBstruct hostent\fR which is usually defined in -.Pa . -.Bd -literal +\fI\fR. +.sp +.nf struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ @@ -114,240 +87,247 @@ struct hostent { char **h_addr_list; /* list of addresses from name server */ }; #define h_addr h_addr_list[0] /* address, for backward compatibility */ -.Ed -.Pp +.sp +.fi +.PP The members of this structure are: -.Bl -tag -width h_addr_list -.It Li h_name +.TP +\fBh_name\fR The official (canonical) name of the host. -.It Li h_aliases +.TP +\fBh_aliases\fR A NULL-terminated array of alternate names (nicknames) for the host. -.It Li h_addrtype -The type of address being returned - -.Dv PF_INET +.TP +\fBh_addrtype\fR +The type of address being returned \(em +\fBPF_INET\fR or -.Dv PF_INET6 . -.It Li h_length +\fBPF_INET6\fR. +.TP +\fBh_length\fR The length of the address in bytes. -.It Li h_addr_list -A -.Dv NULL +.TP +\fBh_addr_list\fR +A \fBNULL\fR terminated array of network addresses for the host. Host addresses are returned in network byte order. -.El -.Pp +.PP For backward compatibility with very old software, -.Li h_addr +h_addr is the first address in -.Li h_addr_list. -.Pp -.Fn lwres_gethostent , -.Fn lwres_sethostent , -.Fn lwres_endhostent , -.Fn lwres_gethostent_r , -.Fn lwres_sethostent_r +h_addr_list. +.PP +\fBlwres_gethostent()\fR, +\fBlwres_sethostent()\fR, +\fBlwres_endhostent()\fR, +\fBlwres_gethostent_r()\fR, +\fBlwres_sethostent_r()\fR and -.Fn lwres_endhostent_r +\fBlwres_endhostent_r()\fR provide iteration over the known host entries on systems that provide such functionality through facilities like -.Pa /etc/hosts -or NIS. The lightweight resolver does not currently implement +\fI/etc/hosts\fR +or NIS. The lightweight resolver does not currently implement these functions; it only provides them as stub functions that always return failure. -.Pp -.Fn lwres_gethostbyname +.PP +\fBlwres_gethostbyname()\fR and -.Fn lwres_gethostbyname2 +\fBlwres_gethostbyname2()\fR look up the hostname -.Fa name . -.Fn lwres_gethostbyname +\fIname\fR. +\fBlwres_gethostbyname()\fR always looks for an IPv4 address while -.Fn lwres_gethostbyname2 +\fBlwres_gethostbyname2()\fR looks for an address of protocol family -.Fa af : +\fIaf\fR: either -.Dv PF_INET +\fBPF_INET\fR or -.Dv PF_INET6 -- IPv4 or IPV6 addresses respectively. +\fBPF_INET6\fR +\(em IPv4 or IPV6 addresses respectively. Successful calls of the functions return a -.Dv "struct hostent" for +\fBstruct hostent\fRfor the name that was looked up. -.Dv NULL +\fBNULL\fR is returned if the lookups by -.Fn lwres_gethostbyname +\fBlwres_gethostbyname()\fR or -.Fn lwres_gethostbyname2 +\fBlwres_gethostbyname2()\fR fail. -.Pp +.PP Reverse lookups of addresses are performed by -.Fn lwres_gethostbyaddr . -.Fa addr +\fBlwres_gethostbyaddr()\fR. +\fIaddr\fR is an address of length -.Fa len +\fIlen\fR bytes and protocol family -.Fa type - -.Dv PF_INET +\fItype\fR \(em +\fBPF_INET\fR or -.Dv PF_INET6 . -.Fn lwres_gethostbyname_r +\fBPF_INET6\fR. +\fBlwres_gethostbyname_r()\fR is a thread-safe function for forward lookups. If an error occurs, an error code is returned in -.Fa *error . -.Fa resbuf +\fI*error\fR. +\fIresbuf\fR is a pointer to a -.Dv "struct hostent" +\fBstruct hostent\fR which is initialised by a successful call to -.Fn lwres_gethostbyname_r . -.Fa buf +\fBlwres_gethostbyname_r()\fR . +\fIbuf\fR is a buffer of length -.Fa len +\fIlen\fR bytes which is used to store the -.Li h_name , -.Li h_aliases , +h_name, +h_aliases, and -.Li h_addr_list +h_addr_list elements of the -.Dv "struct hostent" +\fBstruct hostent\fR returned in -.Fa resbuf . +\fIresbuf\fR. Successful calls to -.Fn lwres_gethostbyname_r +\fBlwres_gethostbyname_r()\fR return -.Fa resbuf , +\fIresbuf\fR, which is a pointer to the -.Dv "struct hostent" +\fBstruct hostent\fR it created. -.Pp -.Fn lwres_gethostbyaddr_r +.PP +\fBlwres_gethostbyaddr_r()\fR is a thread-safe function that performs a reverse lookup of address -.Fa addr +\fIaddr\fR which is -.Fa len +\fIlen\fR bytes long and is of protocol family -.Fa type - -.Dv PF_INET +\fItype\fR \(em +\fBPF_INET\fR or -.Dv PF_INET6 . +\fBPF_INET6\fR. If an error occurs, the error code is returned in -.Fa *error . +\fI*error\fR. The other function parameters are identical to those in -.Fn lwres_gethostbyname_r . -.Fa resbuf +\fBlwres_gethostbyname_r()\fR. +\fIresbuf\fR is a pointer to a -.Dv "struct hostent" +\fBstruct hostent\fR which is initialised by a successful call to -.Fn lwres_gethostbyaddr_r . -.Fa buf +\fBlwres_gethostbyaddr_r()\fR. +\fIbuf\fR is a buffer of length -.Fa len +\fIlen\fR bytes which is used to store the -.Li h_name , -.Li h_aliases , +h_name, +h_aliases, and -.Li h_addr_list +h_addr_list elements of the -.Dv "struct hostent" +\fBstruct hostent\fR returned in -.Fa resbuf . +\fIresbuf\fR. Successful calls to -.Fn lwres_gethostbyaddr_r +\fBlwres_gethostbyaddr_r()\fR return -.Fa resbuf , +\fIresbuf\fR, which is a pointer to the -.Fn "struct hostent" +\fB"struct hostent"()\fR it created. -.Sh RETURN VALUES -.Pp +.SH "RETURN VALUES" +.PP The functions -.Fn lwres_gethostbyname , -.Fn lwres_gethostbyname2 , -.Fn lwres_gethostbyaddr , +\fBlwres_gethostbyname()\fR, +\fBlwres_gethostbyname2()\fR, +\fBlwres_gethostbyaddr()\fR, and -.Fn lwres_gethostent -return NULL to indicate an error. In this case the global variable -.Dv lwres_h_errno +\fBlwres_gethostent()\fR +return NULL to indicate an error. In this case the global variable +\fBlwres_h_errno\fR will contain one of the following error codes defined in -.Pa : -.Bl -tag -width HOST_NOT_FOUND -.It Li HOST_NOT_FOUND +\fI\fR: +.TP +\fBHOST_NOT_FOUND\fR The host or address was not found. -.It Li TRY_AGAIN +.TP +\fBTRY_AGAIN\fR A recoverable error occurred, e.g., a timeout. Retrying the lookup may succeed. -.It Li NO_RECOVERY +.TP +\fBNO_RECOVERY\fR A non-recoverable error occurred. -.It Li NO_DATA +.TP +\fBNO_DATA\fR 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 +of a reverse lookup). The code NO_ADDRESS is accepted as a synonym for NO_DATA for backwards compatibility. -.El -.Pp -.Xr lwres_hstrerror 3 +.PP +\fBlwres_hstrerror\fR(3) translates these error codes to suitable error messages. -.Pp -.Fn lwres_gethostent +.PP +\fBlwres_gethostent()\fR and -.Fn lwres_gethostent_r +\fBlwres_gethostent_r()\fR always return -.Dv NULL . -.Pp +\fBNULL\fR. +.PP Successful calls to -.Fn lwres_gethostbyname_r +\fBlwres_gethostbyname_r()\fR and -.Fn lwres_gethostbyaddr_r +\fBlwres_gethostbyaddr_r()\fR return -.Fa resbuf , +\fIresbuf\fR, a pointer to the -.Dv "struct hostent" +\fBstruct hostent\fR that was initialised by these functions. They return -.Dv NULL +\fBNULL\fR if the lookups fail or if -.Fa buf +\fIbuf\fR was too small to hold the list of addresses and names referenced by the -.Li h_name , -.Li h_aliases , +h_name, +h_aliases, and -.Li h_addr_list +h_addr_list elements of the -.Dv "struct hostent" . +\fBstruct hostent\fR. If -.Fa buf +\fIbuf\fR was too small, both -.Fn lwres_gethostbyname_r +\fBlwres_gethostbyname_r()\fR and -.Fn lwres_gethostbyaddr_r +\fBlwres_gethostbyaddr_r()\fR set the global variable -.Dv errno +\fBerrno\fR to -.Er ERANGE . -.Sh SEE ALSO -.Xr gethostent 3 , -.Xr lwres_getipnode 3 , -.Xr lwres_hstrerror 3 -.Sh BUGS -.Fn lwres_gethostbyname , -.Fn lwres_gethostbyname2 , -.Fn lwres_gethostbyaddr +ERANGE. +.SH "SEE ALSO" +.PP +\fBgethostent\fR(3), +\fBlwres_getipnode\fR(3), +\fBlwres_hstrerror\fR(3) +.SH "BUGS" +.PP +\fBlwres_gethostbyname()\fR, +\fBlwres_gethostbyname2()\fR, +\fBlwres_gethostbyaddr()\fR and -.Fn lwres_endhostent +\fBlwres_endhostent()\fR 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 -.Fn lwres_gethostbyname_r , +\fBlwres_gethostbyname_r()\fR, and -.Fn lwres_gethostbyaddr_r +\fBlwres_gethostbyaddr_r()\fR respectively. -.Pp +.PP The resolver daemon does not currently support any non-DNS name services such as -.Pa /etc/hosts +\fI/etc/hosts\fR or -.Dv NIS , +\fBNIS\fR, consequently the above functions don't, either. diff --git a/lib/lwres/man/lwres_gethostent.docbook b/lib/lwres/man/lwres_gethostent.docbook new file mode 100644 index 0000000000..a0babc1b43 --- /dev/null +++ b/lib/lwres/man/lwres_gethostent.docbook @@ -0,0 +1,490 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_gethostent +3 +BIND9 + + +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 + + + +#include <lwres/netdb.h> + + +struct hostent * +lwres_gethostbyname +const char *name + + + +struct hostent * +lwres_gethostbyname2 +const char *name +int af + + + +struct hostent * +lwres_gethostbyaddr +const char *addr +int len +int type + + + +struct hostent * +lwres_gethostent +void + + + +void +lwres_sethostent +int stayopen + + + +void +lwres_endhostent +void + + + +struct hostent * +lwres_gethostbyname_r +const char *name +struct hostent *resbuf +char *buf +int buflen +int *error + + + +struct hostent * +lwres_gethostbyaddr_r +const char *addr +int len +int type +struct hostent *resbuf +char *buf +int buflen +int *error + + + +struct hostent * +lwres_gethostent_r +struct hostent *resbuf +char *buf +int buflen +int *error + + + +void +lwres_sethostent_r +int stayopen + + + +void +lwres_endhostent_r +void + + + + + +DESCRIPTION + +These functions provide hostname-to-address and +address-to-hostname lookups by means of the lightweight resolver. +They are similar to the standard + +gethostent3 + + +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 */ + 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 */ + + + +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 — +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. + + + + + +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. + + +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. + + + +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>: + + +HOST_NOT_FOUND + + +The host or address was not found. + + +TRY_AGAIN + + +A recoverable error occurred, e.g., a timeout. +Retrying the lookup may succeed. + + +NO_RECOVERY + + +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. + + + + + + +lwres_hstrerror3 + + +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. + + + + +SEE ALSO + + +gethostent3 +, + + +lwres_getipnode3 +, + + +lwres_hstrerror3 + + + + + + +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. + + + diff --git a/lib/lwres/man/lwres_gethostent.html b/lib/lwres/man/lwres_gethostent.html new file mode 100644 index 0000000000..1ef97445b0 --- /dev/null +++ b/lib/lwres/man/lwres_gethostent.html @@ -0,0 +1,918 @@ + +lwres_gethostent

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

Synopsis

#include <lwres/netdb.h>

struct hostent * +lwres_gethostbyname(const char *name);

struct hostent * +lwres_gethostbyname2(const char *name, int af);

struct hostent * +lwres_gethostbyaddr(const char *addr, int len, int type);

struct hostent * +lwres_gethostent(void);

void +lwres_sethostent(int stayopen);

void +lwres_endhostent(void);

struct hostent * +lwres_gethostbyname_r(const char *name, struct hostent *resbuf, char *buf, int buflen, int *error);

struct hostent * +lwres_gethostbyaddr_r(const char *addr, int len, int type, struct hostent *resbuf, char *buf, int buflen, int *error);

struct hostent * +lwres_gethostent_r(struct hostent *resbuf, char *buf, int buflen, int *error);

void +lwres_sethostent_r(int stayopen);

void +lwres_endhostent_r(void);

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>. + +

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 */

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 — +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.

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.

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.

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>: + +

HOST_NOT_FOUND

The host or address was not found.

TRY_AGAIN

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

NO_RECOVERY

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.

lwres_hstrerror(3) +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.

SEE ALSO

gethostent(3), + +lwres_getipnode(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.

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.

\ No newline at end of file diff --git a/lib/lwres/man/lwres_getipnode.3 b/lib/lwres/man/lwres_getipnode.3 index 5da6d74cd2..391ea151f1 100644 --- a/lib/lwres/man/lwres_getipnode.3 +++ b/lib/lwres/man/lwres_getipnode.3 @@ -12,49 +12,38 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_getipnode.3,v 1.6 2001/01/09 21:49:51 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GETIPNODE 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_getipnodebyname , -.Nm lwres_getipnodebyaddr , -.Nm lwres_freehostent -.Nd lightweight resolver nodename / address translation API -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft struct hostent * -.Fo lwres_getipnodebyname -.Fa "const char *name" -.Fa "int af" -.Fa "int flags" -.Fa "int *error_num" -.Fc -.Ft struct hostent * -.Fo lwres_getipnodebyaddr -.Fa "const void *src" -.Fa "size_t len" -.Fa "int af" -.Fa "int *error_num" -.Fc -.Ft void -.Fo lwres_freehostent -.Fa "struct hostent *he" -.Fc -.Sh DESCRIPTION +.TH "LWRES_GETIPNODE" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API +.SH SYNOPSIS +\fB#include +.sp +struct hostent * +lwres_getipnodebyname(const char *name); +(int af); +(int flags); +(int *error_num); +.sp +struct hostent * +lwres_getipnodebyaddr(const void *src); +(size_t len); +(int af); +(int *error_num); +.sp +void +lwres_freehostent(struct hostent *he); +\fR.SH "DESCRIPTION" +.PP These functions perform thread safe, protocol independent nodename-to-address and address-to-nodename translation as defined in RFC2553. -.Pp +.PP They use a -.Dv "struct hostent" +\fBstruct hostent\fR which is defined in -.Pa namedb.h : -.Bd -literal +\fInamedb.h\fR: +.sp +.nf struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ @@ -63,124 +52,134 @@ struct hostent { char **h_addr_list; /* list of addresses from name server */ }; #define h_addr h_addr_list[0] /* address, for backward compatibility */ -.Ed -.Pp +.sp +.fi +.PP The members of this structure are: -.Bl -tag -width h_addr_list -.It Li h_name +.TP +\fBh_name\fR The official (canonical) name of the host. -.It Li h_aliases +.TP +\fBh_aliases\fR A NULL-terminated array of alternate names (nicknames) for the host. -.It Li h_addrtype +.TP +\fBh_addrtype\fR The type of address being returned - usually -.Dv PF_INET +\fBPF_INET\fR or -.Dv PF_INET6 . -.It Li h_length +\fBPF_INET6\fR. +.TP +\fBh_length\fR The length of the address in bytes. -.It Li h_addr_list +.TP +\fBh_addr_list\fR A -.Dv NULL +\fBNULL\fR terminated array of network addresses for the host. Host addresses are returned in network byte order. -.El -.Pp -.Fn lwres_getipnodebyname +.PP +\fBlwres_getipnodebyname()\fR looks up addresses of protocol family -.Fa af +\fIaf\fR for the hostname -.Fa name . +\fIname\fR. The -.Fa flags +\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: -.Bl -tag -width AI_ADDRCONFIG -.It Li AI_V4MAPPED +.TP +\fBAI_V4MAPPED\fR This is used with an -.Fa af +\fIaf\fR of AF_INET6, and causes IPv4 addresses to be returned as IPv4-mapped IPv6 addresses. -.It Li AI_ALL +.TP +\fBAI_ALL\fR This is used with an -.Fa af +\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. -.It Li AI_ADDRCONFIG +.TP +\fBAI_ADDRCONFIG\fR Only return an IPv6 or IPv4 address if here is an active network -interface of that type. This is not currently implemented +interface of that type. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored. -.It Li AI_DEFAULT +.TP +\fBAI_DEFAULT\fR This default sets the -.Li AI_V4MAPPED +AI_V4MAPPED and -.Li AI_ADDRCONFIG +AI_ADDRCONFIG flag bits. -.El -.Pp -.Fn lwres_getipnodebyaddr +.PP +\fBlwres_getipnodebyaddr()\fR performs a reverse lookup of address -.Fa src +\fIsrc\fR which is -.Fa len +\fIlen\fR bytes long. -.Fa af +\fIaf\fR denotes the protocol family, typically -.Dv PF_INET +\fBPF_INET\fR or -.Dv PF_INET6 . -.Pp -.Fn lwres_freehostent +\fBPF_INET6\fR. +.PP +\fBlwres_freehostent()\fR releases all the memory associated with the -.Dv "struct hostent" +\fBstruct hostent\fR pointer -.Fa he . +\fIhe\fR. Any memory allocated for the -.Li h_name , -.Li h_addr_list +h_name, +h_addr_list and -.Li h_aliases +h_aliases is freed, as is the memory for the -.Dv hostent +\fBhostent\fR structure itself. -.Sh RETURN VALUES +.SH "RETURN VALUES" +.PP If an error occurs, -.Fn lwres_getipnodebyname +\fBlwres_getipnodebyname()\fR and -.Fn lwres_getipnodebyaddr +\fBlwres_getipnodebyaddr()\fR set -.Fa *error_num +\fI*error_num\fR to an approriate error code and the function returns a -.Dv NULL +\fBNULL\fR pointer. The error codes and their meanings are defined in -.Pa : -.Bl -tag -width HOST_NOT_FOUND -.It Li HOST_NOT_FOUND +\fI\fR: +.TP +\fBHOST_NOT_FOUND\fR No such host is known. -.It Li NO_ADDRESS +.TP +\fBNO_ADDRESS\fR The server recognised the request and the name but no address is -available. Another type of request to the name server for the +available. Another type of request to the name server for the domain might return an answer. -.It Li TRY_AGAIN +.TP +\fBTRY_AGAIN\fR A temporary and possibly transient error occurred, such as a -failure of a server to respond. The request may succeed if +failure of a server to respond. The request may succeed if retried. -.It Li NO_RECOVERY +.TP +\fBNO_RECOVERY\fR An unexpected failure occurred, and retrying the request is pointless. -.El -.Pp -.Xr lwres_hstrerror 3 +.PP +\fBlwres_hstrerror\fR(3) translates these error codes to suitable error messages. -.Sh SEE ALSO -.Xr RFC2553 , -.Xr lwres 3 , -.Xr lwres_gethostent 3 , -.Xr lwres_getaddrinfo 3 , -.Xr lwres_getnameinfo 3 , -.Xr lwres_hstrerror 3 . +.SH "SEE ALSO" +.PP +\fBRFC2553\fR, +\fBlwres\fR(3), +\fBlwres_gethostent\fR(3), +\fBlwres_getaddrinfo\fR(3), +\fBlwres_getnameinfo\fR(3), +\fBlwres_hstrerror\fR(3). diff --git a/lib/lwres/man/lwres_getipnode.docbook b/lib/lwres/man/lwres_getipnode.docbook new file mode 100644 index 0000000000..5906a6e7ac --- /dev/null +++ b/lib/lwres/man/lwres_getipnode.docbook @@ -0,0 +1,303 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_getipnode +3 +BIND9 + + +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 + + + +struct hostent * +lwres_getipnodebyaddr +const void *src +size_t len +int af +int *error_num + + + +void +lwres_freehostent +struct hostent *he + + + + +DESCRIPTION + +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: + + +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 */ + + + +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 + +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: + +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_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 approriate 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 +, + + +lwres_gethostent3 +, + + +lwres_getaddrinfo3 +, + + +lwres_getnameinfo3 +, + + +lwres_hstrerror3 +. + + + diff --git a/lib/lwres/man/lwres_getipnode.html b/lib/lwres/man/lwres_getipnode.html new file mode 100644 index 0000000000..a3dd06f6a6 --- /dev/null +++ b/lib/lwres/man/lwres_getipnode.html @@ -0,0 +1,530 @@ + +lwres_getipnode

lwres_getipnode

Name

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

Synopsis

#include <lwres/netdb.h>

struct hostent * +lwres_getipnodebyname(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);

void +lwres_freehostent(struct hostent *he);

DESCRIPTION

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: + +

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 */

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 + +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: +

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_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 approriate 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_hstrerror(3) +translates these error codes to suitable error messages.

SEE ALSO

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

\ No newline at end of file diff --git a/lib/lwres/man/lwres_getnameinfo.3 b/lib/lwres/man/lwres_getnameinfo.3 index cff5d43cc4..7a492815f4 100644 --- a/lib/lwres/man/lwres_getnameinfo.3 +++ b/lib/lwres/man/lwres_getnameinfo.3 @@ -12,119 +12,92 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_getnameinfo.3,v 1.8 2001/01/09 21:49:56 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GETNAMEINFO 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_getnameinfo -.Nd lightweight resolver socket address structure to hostname and service name -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft int -.Fo lwres_getnameinfo -.Fa "const struct sockaddr *sa" -.Fa "size_t salen" -.Fa "char *host" -.Fa "size_t hostlen" -.Fa "char *serv" -.Fa "size_t servlen" -.Fa "int flags" -.Fc -.Sh DESCRIPTION -.Pp +.TH "LWRES_GETNAMEINFO" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_getnameinfo \- lightweight resolver socket address structure to hostname and service name +.SH SYNOPSIS +\fB#include +.sp +int +lwres_getnameinfo(const struct sockaddr *sa); +(size_t salen); +(char *host); +(size_t hostlen); +(char *serv); +(size_t servlen); +(int flags); +\fR.SH "DESCRIPTION" +.PP This function is equivalent to the -.Xr getnameinfo 3 +\fBgetnameinfo\fR(3) function defined in RFC2133. -.Fn lwres_getnameinfo +\fBlwres_getnameinfo()\fR returns the hostname for the -.Dv "struct sockaddr" -.Fa sa +\fBstruct sockaddr\fR +\fIsa\fR which is -.Fa salen +\fIsalen\fR bytes long. The hostname is of length -.Fa hostlen +\fIhostlen\fR and is returned via -.Fa *host. +\fI*host.\fR The maximum length of the hostname is 1025 bytes: -.Li NI_MAXHOST . -.Pp +NI_MAXHOST. +.PP The name of the service associated with the port number in -.Fa sa +\fIsa\fR is returned in -.Fa *serv. +\fI*serv.\fR It is -.Fa servlen +\fIservlen\fR bytes long. The maximum length of the service name is -.Li NI_MAXSERV -- 32 bytes. -.Pp +NI_MAXSERV - 32 bytes. +.PP The -.Fa flags +\fIflags\fR argument sets the following bits: -.Bl -tag -width NI_NUMERICSERV -.It Li NI_NOFQDN +.TP +\fBNI_NOFQDN\fR A fully qualified domain name is not required for local hosts. The local part of the fully qualified domain name is returned instead. -.It Li NI_NUMERICHOST +.TP +\fBNI_NUMERICHOST\fR Return the address in numeric form, as if calling inet_ntop(), instead of a host name. -.It Li NI_NAMEREQD +.TP +\fBNI_NAMEREQD\fR 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. -.It Li NI_NUMERICSERV +.TP +\fBNI_NUMERICSERV\fR The service name is returned as a digit string representing the port number. -.It Li NI_DGRAM +.TP +\fBNI_DGRAM\fR 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 +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. -.El -.Pp -.Sh RETURN VALUES -.Fn lwres_getnameinfo +.PP +.SH "RETURN VALUES" +.PP +\fBlwres_getnameinfo()\fR returns 0 on success or a non-zero error code if an error occurs. -.\" -.\" The error codes below were invented by the ISC/Nominum. They -.\" should be defined in RFC2133 before getting documented here. -.\" XXXJR 28/6/00 -.\" The error codes are: -.\" Bl -tag -width ENI_NOSERVNAME -.\" It Li ENI_NOSOCKET -.\" there was no socket in -.\" Fa sa -.\" It Li ENI_NOSERVNAME -.\" no service name was found -.\" It Li ENI_NOHOSTNAME -.\" no hostname was found -.\" It Li ENI_MEMORY -.\" memory could not be allocated -.\" It Li ENI_SYSTEM -.\" a system error occurred -.\" It Li ENI_FAMILY -.\" an unsupported protocol family was requested -.\" It Li ENI_SALEN -.\" Fa salen -.\" is the wrong number of bytes for the address in -.\" Fa sa . -.Sh SEE ALSO -.Xr RFC2133 , -.Xr getservbyport 3 , -.Xr lwres 3 , -.Xr lwres_getnameinfo 3 , -.Xr lwres_getnamebyaddr 3 . -.Xr lwres_net_ntop 3 . -.Sh BUGS +.SH "SEE ALSO" +.PP +\fBRFC2133\fR, +\fBgetservbyport\fR(3), +\fBlwres\fR(3), +\fBlwres_getnameinfo\fR(3), +\fBlwres_getnamebyaddr\fR(3). +\fBlwres_net_ntop\fR(3). +.SH "BUGS" +.PP RFC2133 fails to define what the nonzero return values of -.Xr getnameinfo 3 +\fBgetnameinfo\fR(3) are. diff --git a/lib/lwres/man/lwres_getnameinfo.docbook b/lib/lwres/man/lwres_getnameinfo.docbook new file mode 100644 index 0000000000..29b3093b39 --- /dev/null +++ b/lib/lwres/man/lwres_getnameinfo.docbook @@ -0,0 +1,171 @@ + + + + + + + +Jun 30, 2000 + + +lwres_getnameinfo +3 +BIND9 + + +lwres_getnameinfo +lightweight resolver socket address structure to hostname and service name + + + +#include <lwres/netdb.h> + + +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 + +getnameinfo3 + + +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: + +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. + +NI_NUMERICHOST + + +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. + +NI_NUMERICSERV + + +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. + + + + + + + + +RETURN VALUES + +lwres_getnameinfo() +returns 0 on success or a non-zero error code if an error occurs. + + + +SEE ALSO + + +RFC2133 +, + +getservbyport3 +, + +lwres3 +, + +lwres_getnameinfo3 +, + +lwres_getnamebyaddr3 +. + +lwres_net_ntop3 +. + + +BUGS + +RFC2133 fails to define what the nonzero return values of + +getnameinfo3 + +are. + + + diff --git a/lib/lwres/man/lwres_getnameinfo.html b/lib/lwres/man/lwres_getnameinfo.html new file mode 100644 index 0000000000..05e40b668b --- /dev/null +++ b/lib/lwres/man/lwres_getnameinfo.html @@ -0,0 +1,321 @@ + +lwres_getnameinfo

lwres_getnameinfo

Name

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

Synopsis

#include <lwres/netdb.h>

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.

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: +

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.

NI_NUMERICHOST

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.

NI_NUMERICSERV

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.

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).

BUGS

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

\ No newline at end of file diff --git a/lib/lwres/man/lwres_getrrsetbyname.3 b/lib/lwres/man/lwres_getrrsetbyname.3 index b65b8fcf7a..9837a9f7d8 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.3 +++ b/lib/lwres/man/lwres_getrrsetbyname.3 @@ -12,121 +12,113 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_getrrsetbyname.3,v 1.4 2001/01/09 21:49:57 bwelling Exp $ - -.Dd Oct 18, 2000 -.Dt LWRES_GETRRSETBYNAME 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_getrrsetbyname , -.Nm lwres_freerrset -.Nd retrieve DNS records -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft int -.Fo lwres_getrrsetbyname -.Fa "const char *hostname" -.Fa "unsigned int rdclass" -.Fa "unsigned int rdtype" -.Fa "unsigned int flags" -.Fa "struct rrsetinfo **res" -.Fc -.Ft void -.Fo lwres_freerrset -.Fa "struct rrsetinfo *rrset" -.Fc -.Pp +.TH "LWRES_GETRRSETBYNAME" "3" "Oct 18, 2000" "BIND9" "" +.SH NAME +lwres_getrrsetbyname, lwres_freerrset \- retrieve DNS records +.SH SYNOPSIS +\fB#include +.sp +int +lwres_getrrsetbyname(const char *hostname); +(unsigned int rdclass); +(unsigned int rdtype); +(unsigned int flags); +(struct rrsetinfo **res); +.sp +void +lwres_freerrset(struct rrsetinfo *rrset); +\fR.PP The following structures are used: -.Pp -.Bd -literal -offset indent -struct rdatainfo { - unsigned int rdi_length; /* length of data */ - unsigned char *rdi_data; /* record data */ +.sp +.nf +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 */ +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 */ }; -.Ed -.Sh DESCRIPTION -.Pp -.Fn lwres_getrrsetbyname +.sp +.fi +.SH "DESCRIPTION" +.PP +\fBlwres_getrrsetbyname()\fR gets a set of resource records associated with a -.Fa hostname , -.Fa class , +\fIhostname\fR, +\fIclass\fR, and -.Fa type . -.Fa hostname +\fItype\fR. +\fIhostname\fR is -a pointer a to null-terminated string. The -.Fa flags +a pointer a to null-terminated string. The +\fIflags\fR field is currently unused and must be zero. -.Pp +.PP After a successful call to -.Fn lwres_getrrsetbyname , -.Fa *res +\fBlwres_getrrsetbyname()\fR, +\fI*res\fR is a pointer to an -.Dv rrsetinfo +\fBrrsetinfo\fR structure, containing a list of one or more -.Dv rdatainfo +\fBrdatainfo\fR structures containing resource records and potentially another list of -.Dv rdatainfo +\fBrdatainfo\fR structures containing SIG resource records associated with those records. The members -.Li rri_rdclass +rri_rdclass and -.Li rri_rdtype +rri_rdtype are copied from the parameters. -.Li rri_ttl +rri_ttl and -.Li rri_name +rri_name are properties of the obtained rrset. The resource records contained in -.Li rri_rdatas +rri_rdatas and -.Li rri_sigs +rri_sigs are in uncompressed DNS wire format. Properties of the rdataset are represented in the -.Li rri_flags -bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC -validated and the signatures verified. -.Pp +rri_flags +bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC +validated and the signatures verified. +.PP All of the information returned by -.Fn lwres_getrrsetbyname +\fBlwres_getrrsetbyname()\fR is dynamically allocated: the -.Li rrsetinfo +rrsetinfo and -.Li rdatainfo +rdatainfo structures, and the canonical host name strings pointed to by the -.Li rrsetinfo structure. +rrsetinfostructure. Memory allocated for the dynamically allocated structures created by a successful call to -.Fn lwres_getrrsetbyname +\fBlwres_getrrsetbyname()\fR is released by -.Fn lwres_freerrset . -.Fa rrset +\fBlwres_freerrset()\fR. +\fIrrset\fR is a pointer to a -.Dv "struct rrset" +\fBstruct rrset\fR created by a call to -.Fn lwres_getrrsetbyname . -.Pp -.Sh RETURN VALUES -.Fn lwres_getrrsetbyname -returns zero on success or an error code if an error occurs. The defined +\fBlwres_getrrsetbyname()\fR. +.PP +.SH "RETURN VALUES" +.PP +\fBlwres_getrrsetbyname()\fR +returns zero on success or an error code if an error occurs. The defined error codes are ERRSET_NOMEMORY (memory could not be allocated), ERRSET_INVAL (a parameter is invalid) and ERRSET_FAIL (other failure). -.Sh SEE ALSO -.Xr lwres 3 . +.SH "SEE ALSO" +.PP +\fBlwres\fR(3). diff --git a/lib/lwres/man/lwres_getrrsetbyname.docbook b/lib/lwres/man/lwres_getrrsetbyname.docbook new file mode 100644 index 0000000000..4d871327a5 --- /dev/null +++ b/lib/lwres/man/lwres_getrrsetbyname.docbook @@ -0,0 +1,176 @@ + + + + + + + + + +Oct 18, 2000 + + +lwres_getrrsetbyname +3 +BIND9 + + +lwres_getrrsetbyname +lwres_freerrset +retrieve DNS records + + + +#include <lwres/netdb.h> + + +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: + +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 */ +}; + + + + + +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(). + + + + + + +RETURN VALUES + +lwres_getrrsetbyname() +returns zero on success or an error code if an error occurs. The defined +error codes are ERRSET_NOMEMORY (memory could not be allocated), +ERRSET_INVAL (a parameter is invalid) and ERRSET_FAIL (other failure). + + + +SEE ALSO + + +lwres3 +. + + + + diff --git a/lib/lwres/man/lwres_getrrsetbyname.html b/lib/lwres/man/lwres_getrrsetbyname.html new file mode 100644 index 0000000000..ba6c118f7f --- /dev/null +++ b/lib/lwres/man/lwres_getrrsetbyname.html @@ -0,0 +1,310 @@ + +lwres_getrrsetbyname

lwres_getrrsetbyname

Name

lwres_getrrsetbyname, lwres_freerrset -- retrieve DNS records

Synopsis

#include <lwres/netdb.h>

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: +

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 */
+};

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().

RETURN VALUES

lwres_getrrsetbyname() +returns zero on success or an error code if an error occurs. The defined +error codes are ERRSET_NOMEMORY (memory could not be allocated), +ERRSET_INVAL (a parameter is invalid) and ERRSET_FAIL (other failure).

SEE ALSO

lwres(3).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_gnba.3 b/lib/lwres/man/lwres_gnba.3 index 0662e311cf..1fa74f4605 100644 --- a/lib/lwres/man/lwres_gnba.3 +++ b/lib/lwres/man/lwres_gnba.3 @@ -12,83 +12,66 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_gnba.3,v 1.6 2001/01/09 21:49:58 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_GNBA 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_gnbarequest_render , -.Nm lwres_gnbaresponse_render , -.Nm lwres_gnbarequest_parse , -.Nm lwres_gnbaresponse_parse , -.Nm lwres_gnbaresponse_free , -.Nm lwres_gnbarequest_free -.Nd lightweight resolver getnamebyaddress message handling -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_gnbarequest_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_gnbarequest_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_gnbaresponse_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_gnbaresponse_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_gnbarequest_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_gnbarequest_t **structp" -.Fc -.Ft lwres_result_t -.Fo lwres_gnbaresponse_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_gnbaresponse_t **structp" -.Fc -.Ft void -.Fo lwres_gnbaresponse_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_gnbaresponse_t **structp" -.Fc -.Ft void -.Fo lwres_gnbarequest_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_gnbarequest_t **structp" -.Fc -.Sh DESCRIPTION +.TH "LWRES_GNBA" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling +.SH SYNOPSIS +\fB#include +.sp +lwres_result_t +lwres_gnbarequest_render(lwres_context_t *\fIctx\fB); +(lwres_gnbarequest_t *\fIreq\fB); +(lwres_lwpacket_t *\fIpkt\fB); +(lwres_buffer_t *\fIb\fB); +.sp +lwres_result_t +lwres_gnbaresponse_render(lwres_context_t *ctx); +(lwres_gnbaresponse_t *req); +(lwres_lwpacket_t *pkt); +(lwres_buffer_t *b); +.sp +lwres_result_t +lwres_gnbarequest_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_gnbarequest_t **structp); +.sp +lwres_result_t +lwres_gnbaresponse_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_gnbaresponse_t **structp); +.sp +void +lwres_gnbaresponse_free(lwres_context_t *ctx); +(lwres_gnbaresponse_t **structp); +.sp +void +lwres_gnbarequest_free(lwres_context_t *ctx); +(lwres_gnbarequest_t **structp); +\fR.SH "DESCRIPTION" +.PP These are low-level routines for creating and parsing lightweight resolver address-to-name lookup request and response messages. -.Pp +.PP There are four main functions for the getnamebyaddr opcode. -One render function converts a getnamebyaddr request structure - -.Dv lwres_gnbarequest_t - -to the lighweight resolver's canonical format. +One render function converts a getnamebyaddr request structure \(em +\fBlwres_gnbarequest_t\fR \(em +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 - -.Dv lwres_gnbaresponse_t +Another render function converts the getnamebyaddr response structure \(em +\fBlwres_gnbaresponse_t\fR to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure. -.Pp +.PP These structures are defined in -.Pa lwres/lwres.h . +\fIlwres/lwres.h\fR. They are shown below. -.Bd -literal -offset indent +.sp +.nf #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U typedef struct { @@ -106,95 +89,98 @@ typedef struct { void *base; size_t baselen; } lwres_gnbaresponse_t; -.Ed -.Pp -.Fn lwres_gnbarequest_render +.sp +.fi +.PP +\fBlwres_gnbarequest_render()\fR uses resolver context -.Fa ctx +ctx to convert getnamebyaddr request structure -.Fa req +req to canonical format. The packet header structure -.Fa pkt +pkt is initialised and transferred to buffer -.Fa b . +b. The contents of -.Fa *req +*req are then appended to the buffer in canonical format. -.Fn lwres_gnbaresponse_render +\fBlwres_gnbaresponse_render()\fR performs the same task, except it converts a getnamebyaddr response structure -.Dv lwres_gnbaresponse_t +\fBlwres_gnbaresponse_t\fR to the lightweight resolver's canonical format. -.Pp -.Fn lwres_gnbarequest_parse +.PP +\fBlwres_gnbarequest_parse()\fR uses context -.Fa ctx +ctx to convert the contents of packet -.Fa pkt +pkt to a -.Dv lwres_gnbarequest_t +\fBlwres_gnbarequest_t\fR structure. Buffer -.Fa b +b provides space to be used for storing this structure. When the function succeeds, the resulting -.Dv lwres_gnbarequest_t +\fBlwres_gnbarequest_t\fR is made available through -.Fa *structp . -.Fn lwres_gnbaresponse_parse +*structp. +\fBlwres_gnbaresponse_parse()\fR offers the same semantics as -.Fn lwres_gnbarequest_parse +\fBlwres_gnbarequest_parse()\fR except it yields a -.Dv lwres_gnbaresponse_t +\fBlwres_gnbaresponse_t\fR structure. -.Pp -.Fn lwres_gnbaresponse_free +.PP +\fBlwres_gnbaresponse_free()\fR and -.Fn lwres_gnbarequest_free +\fBlwres_gnbarequest_free()\fR release the memory in resolver context -.Fa ctx +ctx that was allocated to the -.Dv lwres_gnbaresponse_t +\fBlwres_gnbaresponse_t\fR or -.Dv lwres_gnbarequest_t +\fBlwres_gnbarequest_t\fR structures referenced via -.Fa structp . +structp. Any memory associated with ancillary buffers and strings for those structures is also discarded. -.Sh RETURN VALUES +.SH "RETURN VALUES" +.PP The getnamebyaddr opcode functions -.Fn lwres_gnbarequest_render , -.Fn lwres_gnbaresponse_render -.Fn lwres_gnbarequest_parse +\fBlwres_gnbarequest_render()\fR, +\fBlwres_gnbaresponse_render()\fR +\fBlwres_gnbarequest_parse()\fR and -.Fn lwres_gnbaresponse_parse +\fBlwres_gnbaresponse_parse()\fR all return -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS on success. They return -.Er LWRES_R_NOMEMORY +LWRES_R_NOMEMORY if memory allocation fails. -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer -.Fa b +b is too small to accommodate the packet header or the -.Dv lwres_gnbarequest_t +\fBlwres_gnbarequest_t\fR and -.Dv lwres_gnbaresponse_t +\fBlwres_gnbaresponse_t\fR structures. -.Fn lwres_gnbarequest_parse +\fBlwres_gnbarequest_parse()\fR and -.Fn lwres_gnbaresponse_parse +\fBlwres_gnbaresponse_parse()\fR will return -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the received packet. These functions will return -.Er LWRES_R_FAILURE +LWRES_R_FAILURE if -.Li pktflags +\fBpktflags\fR in the packet header structure -.Dv lwres_lwpacket_t +\fBlwres_lwpacket_t\fR indicate that the packet is not a response to an earlier query. -.Sh SEE ALSO -.Xr lwres_packet 3 +.SH "SEE ALSO" +.PP +\fBlwres_packet\fR(3). diff --git a/lib/lwres/man/lwres_gnba.docbook b/lib/lwres/man/lwres_gnba.docbook index e98bab9fa0..0e809b77c6 100644 --- a/lib/lwres/man/lwres_gnba.docbook +++ b/lib/lwres/man/lwres_gnba.docbook @@ -16,7 +16,7 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - + @@ -24,11 +24,11 @@ Jun 30, 2000
- - lwres_gnba - 3 - BIND9 - + +lwres_gnba +3 +BIND9 + lwres_gnbarequest_render @@ -115,12 +115,12 @@ response messages. There are four main functions for the getnamebyaddr opcode. -One render function converts a getnamebyaddr request structure - -lwres_gnbarequest_t - +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 - +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 @@ -219,12 +219,12 @@ The getnamebyaddr opcode functions and lwres_gnbaresponse_parse() all return -LWRES_R_SUCCESS +LWRES_R_SUCCESS on success. They return -LWRES_R_NOMEMORY +LWRES_R_NOMEMORY if memory allocation fails. -LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer b is too small to accommodate the packet header or the @@ -236,10 +236,10 @@ structures. and lwres_gnbaresponse_parse() will return -LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the received packet. These functions will return -LWRES_R_FAILURE +LWRES_R_FAILURE if pktflags in the packet header structure @@ -250,9 +250,10 @@ indicate that the packet is not a response to an earlier query. SEE ALSO - - lwres_packet - 3 - . + +lwres_packet +3 +. +
diff --git a/lib/lwres/man/lwres_gnba.html b/lib/lwres/man/lwres_gnba.html new file mode 100644 index 0000000000..72a85859e6 --- /dev/null +++ b/lib/lwres/man/lwres_gnba.html @@ -0,0 +1,408 @@ + +lwres_gnba

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

Synopsis

#include <lwres/lwres.h>

lwres_result_t +lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);

lwres_result_t +lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp);

void +lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);

void +lwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp);

DESCRIPTION

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.

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;
+	char	       *realname;
+	char	      **aliases;
+	lwres_uint16_t	realnamelen;
+	lwres_uint16_t *aliaslen;
+	void	       *base;
+	size_t		baselen;
+} 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.

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.

SEE ALSO

lwres_packet(3).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_hstrerror.3 b/lib/lwres/man/lwres_hstrerror.3 index 5ce1064381..3ec0bc9d8e 100644 --- a/lib/lwres/man/lwres_hstrerror.3 +++ b/lib/lwres/man/lwres_hstrerror.3 @@ -12,61 +12,56 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_hstrerror.3,v 1.6 2001/01/09 21:50:07 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_ERROR 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_herror , -.Nm lwres_hstrerror -.Nd lightweight resolver error message generation -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft void -.Fo lwres_herror -.Fa "const char *s" -.Fc -.Ft const char * -.Fo lwres_hstrerror -.Fa "int err" -.Fc -.Sh DESCRIPTION -.Fn lwres_herror +.TH "LWRES_HSTRERROR" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_herror, lwres_hstrerror \- lightweight resolver error message generation +.SH SYNOPSIS +\fB#include +.sp +void +lwres_herror(const char *s); +.sp +const char * +lwres_hstrerror(int err); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_herror()\fR prints the string -.Fa s +\fIs\fR on -.Dv stderr +\fBstderr\fR followed by the string generated by -.Fn lwres_hstrerror +\fBlwres_hstrerror()\fR for the error code stored in the global variable -.Li lwres_h_errno . -.Pp -.Fn lwres_hstrerror +lwres_h_errno. +.PP +\fBlwres_hstrerror()\fR returns an appropriate string for the error code gievn by -.Fa err . +\fIerr\fR. The values of the error codes and messages are as follows: -.Bl -tag -width HOST_NOT_FOUND -.It Li NETDB_SUCCESS -\*qResolver Error 0 (no error)\*q -.It Li HOST_NOT_FOUND -\*qUnknown host\*q -.It Li TRY_AGAIN -\*qHost name lookup failure\*q -.It Li NO_RECOVERY -\*qUnknown server error\*q -.It Li NO_DATA -\*qNo address associated with name\*q -.El -.Sh RETURN VALUES -The string \*qUnknown resolver error\*q is returned by -.Fn lwres_hstrerror +.TP +\fBNETDB_SUCCESS\fR +\fBResolver Error 0 (no error)\fR +.TP +\fBHOST_NOT_FOUND\fR +\fBUnknown host\fR +.TP +\fBTRY_AGAIN\fR +\fBHost name lookup failure\fR +.TP +\fBNO_RECOVERY\fR +\fBUnknown server error\fR +.TP +\fBNO_DATA\fR +\fBNo address associated with name\fR +.SH "RETURN VALUES" +.PP +The string \fBUnknown resolver error\fR is returned by +\fBlwres_hstrerror()\fR when the value of -.Li lwres_h_errno +lwres_h_errno is not a valid error code. -.Sh SEE ALSO -.Xr herror 3 , -.Xr lwres_hstrerror 3 . +.SH "SEE ALSO" +.PP +\fBherror\fR(3), +\fBlwres_hstrerror\fR(3). diff --git a/lib/lwres/man/lwres_hstrerror.docbook b/lib/lwres/man/lwres_hstrerror.docbook new file mode 100644 index 0000000000..e1c1091de1 --- /dev/null +++ b/lib/lwres/man/lwres_hstrerror.docbook @@ -0,0 +1,128 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_hstrerror +3 +BIND9 + + +lwres_herror +lwres_hstrerror +lightweight resolver error message generation + + + +#include <lwres/netdb.h> + + +void +lwres_herror +const char *s + + + +const char * +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: + +NETDB_SUCCESS + + +Resolver Error 0 (no error) + +HOST_NOT_FOUND + + +Unknown host + +TRY_AGAIN + + +Host name lookup failure + +NO_RECOVERY + + +Unknown server error + +NO_DATA + + +No address associated with name + + + + + + +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. + + + +SEE ALSO + + +herror3 +, + + +lwres_hstrerror3 +. + + + + diff --git a/lib/lwres/man/lwres_hstrerror.html b/lib/lwres/man/lwres_hstrerror.html new file mode 100644 index 0000000000..0e76a14558 --- /dev/null +++ b/lib/lwres/man/lwres_hstrerror.html @@ -0,0 +1,248 @@ + +lwres_hstrerror

lwres_hstrerror

Name

lwres_herror, lwres_hstrerror -- lightweight resolver error message generation

Synopsis

#include <lwres/netdb.h>

void +lwres_herror(const char *s);

const char * +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: +

NETDB_SUCCESS

Resolver Error 0 (no error)

HOST_NOT_FOUND

Unknown host

TRY_AGAIN

Host name lookup failure

NO_RECOVERY

Unknown server error

NO_DATA

No address associated with name

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.

SEE ALSO

herror(3), + +lwres_hstrerror(3).

\ No newline at end of file diff --git a/lib/lwres/man/lwres_inetntop.3 b/lib/lwres/man/lwres_inetntop.3 index 5eb3386529..f75a080ade 100644 --- a/lib/lwres/man/lwres_inetntop.3 +++ b/lib/lwres/man/lwres_inetntop.3 @@ -12,60 +12,54 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_inetntop.3,v 1.5 2001/01/09 21:50:08 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_INETNTOP 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_net_ntop -.Nd lightweight resolver IP address presentation -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft const char * -.Fo lwres_net_ntop -.Fa "int af" -.Fa "const void *src" -.Fa "char *dst" -.Fa "size_t size" -.Fc -.Sh DESCRIPTION -.Fn lwres_net_ntop +.TH "LWRES_INETNTOP" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_net_ntop \- lightweight resolver IP address presentation +.SH SYNOPSIS +\fB#include +.sp +const char * +lwres_net_ntop(int af); +(const void *src); +(char *dst); +(size_t size); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_net_ntop()\fR converts an IP address of protocol family -.Fa af -- IPv4 or IPv6 - at location -.Fa src +\fIaf\fR +\(em IPv4 or IPv6 \(em +at location +\fIsrc\fR 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. -.Pp +.PP The generated string is copied to -.Fa dst +\fIdst\fR provided -.Fa size +\fIsize\fR indicates it is long enough to store the ASCII representation of the address. -.Sh RETURN VALUES -.Pp +.SH "RETURN VALUES" +.PP If successful, the function returns -.Fa dst : +\fIdst\fR: a pointer to a string containing the presentation format of the address. -.Fn lwres_net_ntop +\fBlwres_net_ntop()\fR returns -.Dv NULL +\fBNULL\fR and sets the global variable -.Li errno +errno to -.Er EAFNOSUPPORT +EAFNOSUPPORT if the protocol family given in -.Fa af +\fIaf\fR is not supported. -.Sh SEE ALSO -.Xr RFC1884 , -.Xr inet_ntop 3 , -.Xr errno 3 . +.SH "SEE ALSO" +.PP +\fBRFC1884\fR, +\fBinet_ntop\fR(3), +\fBerrno\fR(3). diff --git a/lib/lwres/man/lwres_inetntop.docbook b/lib/lwres/man/lwres_inetntop.docbook new file mode 100644 index 0000000000..083c9f8f46 --- /dev/null +++ b/lib/lwres/man/lwres_inetntop.docbook @@ -0,0 +1,107 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_inetntop +3 +BIND9 + + +lwres_net_ntop +lightweight resolver IP address presentation + + + +#include <lwres/net.h> + + +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. + + +The generated string is copied to +dst +provided +size +indicates it is long enough to store the ASCII representation +of the address. + + + +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. + + + +SEE ALSO + + +RFC1884 +, + +inet_ntop3 +, + +errno3 +. + + + diff --git a/lib/lwres/man/lwres_inetntop.html b/lib/lwres/man/lwres_inetntop.html new file mode 100644 index 0000000000..91207cf91a --- /dev/null +++ b/lib/lwres/man/lwres_inetntop.html @@ -0,0 +1,201 @@ + +lwres_inetntop

lwres_inetntop

Name

lwres_net_ntop -- lightweight resolver IP address presentation

Synopsis

#include <lwres/net.h>

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.

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

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.

SEE ALSO

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

\ No newline at end of file diff --git a/lib/lwres/man/lwres_noop.3 b/lib/lwres/man/lwres_noop.3 index 2d6a1213c4..d1aa6e6649 100644 --- a/lib/lwres/man/lwres_noop.3 +++ b/lib/lwres/man/lwres_noop.3 @@ -12,87 +12,70 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_noop.3,v 1.6 2001/01/09 21:50:12 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_NOOP 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_nooprequest_render , -.Nm lwres_noopresponse_render , -.Nm lwres_nooprequest_parse , -.Nm lwres_noopresponse_parse , -.Nm lwres_noopresponse_free , -.Nm lwres_nooprequest_free -.Nd lightweight resolver no-op message handling -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_nooprequest_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_nooprequest_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_noopresponse_render -.Fa "lwres_context_t *ctx" -.Fa "lwres_noopresponse_t *req" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_buffer_t *b" -.Fc -.Ft lwres_result_t -.Fo lwres_nooprequest_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_nooprequest_t **structp" -.Fc -.Ft lwres_result_t -.Fo lwres_noopresponse_parse -.Fa "lwres_context_t *ctx" -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fa "lwres_noopresponse_t **structp" -.Fc -.Ft void -.Fo lwres_noopresponse_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_noopresponse_t **structp" -.Fc -.Ft void -.Fo lwres_nooprequest_free -.Fa "lwres_context_t *ctx" -.Fa "lwres_nooprequest_t **structp" -.Fc -.Sh DESCRIPTION +.TH "LWRES_NOOP" "3" "Jun 30, 2000" "BIND9" "" +.SH 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 +.SH SYNOPSIS +\fB#include +.sp +lwres_result_t +lwres_nooprequest_render(lwres_context_t *ctx); +(lwres_nooprequest_t *req); +(lwres_lwpacket_t *pkt); +(lwres_buffer_t *b); +.sp +lwres_result_t +lwres_noopresponse_render(lwres_context_t *ctx); +(lwres_noopresponse_t *req); +(lwres_lwpacket_t *pkt); +(lwres_buffer_t *b); +.sp +lwres_result_t +lwres_nooprequest_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_nooprequest_t **structp); +.sp +lwres_result_t +lwres_noopresponse_parse(lwres_context_t *ctx); +(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +(lwres_noopresponse_t **structp); +.sp +void +lwres_noopresponse_free(lwres_context_t *ctx); +(lwres_noopresponse_t **structp); +.sp +void +lwres_nooprequest_free(lwres_context_t *ctx); +(lwres_nooprequest_t **structp); +\fR.SH "DESCRIPTION" +.PP These are low-level routines for creating and parsing lightweight resolver no-op request and response messages. -.P -The no-op message is analogous to a \*qping\*q packet: +.PP +The no-op message is analogous to a \fBping\fR 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. -.Pp +.PP There are four main functions for the no-op opcode. -One render function converts a no-op request structure - -.Dv lwres_nooprequest_t - +One render function converts a no-op request structure \(em +\fBlwres_nooprequest_t\fR \(em 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 - -.Dv lwres_noopresponse_t +Another render function converts the no-op response structure \(em +\fBlwres_noopresponse_t\fR to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a no-op response structure. -.Pp +.PP These structures are defined in -.Pa lwres/lwres.h . +\fIlwres/lwres.h\fR. They are shown below. -.Bd -literal -offset indent +.sp +.nf #define LWRES_OPCODE_NOOP 0x00000000U typedef struct { @@ -104,96 +87,99 @@ typedef struct { lwres_uint16_t datalength; unsigned char *data; } lwres_noopresponse_t; -.Ed +.sp +.fi 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. -.Pp -.Fn lwres_nooprequest_render +.PP +\fBlwres_nooprequest_render()\fR uses resolver context -.Fa ctx +\fIctx\fR to convert no-op request structure -.Fa req +\fIreq\fR to canonical format. The packet header structure -.Fa pkt +\fIpkt\fR is initialised and transferred to buffer -.Fa b . +\fIb\fR. The contents of -.Fa *req +\fI*req\fR are then appended to the buffer in canonical format. -.Fn lwres_noopresponse_render +\fBlwres_noopresponse_render()\fR performs the same task, except it converts a no-op response structure -.Dv lwres_noopresponse_t +\fBlwres_noopresponse_t\fR to the lightweight resolver's canonical format. -.Pp -.Fn lwres_nooprequest_parse +.PP +\fBlwres_nooprequest_parse()\fR uses context -.Fa ctx +\fIctx\fR to convert the contents of packet -.Fa pkt +\fIpkt\fR to a -.Dv lwres_nooprequest_t +\fBlwres_nooprequest_t\fR structure. Buffer -.Fa b +\fIb\fR provides space to be used for storing this structure. When the function succeeds, the resulting -.Dv lwres_nooprequest_t +\fBlwres_nooprequest_t\fR is made available through -.Fa *structp . -.Fn lwres_noopresponse_parse +\fI*structp\fR. +\fBlwres_noopresponse_parse()\fR offers the same semantics as -.Fn lwres_nooprequest_parse +\fBlwres_nooprequest_parse()\fR except it yields a -.Dv lwres_noopresponse_t +\fBlwres_noopresponse_t\fR structure. -.Pp -.Fn lwres_noopresponse_free +.PP +\fBlwres_noopresponse_free()\fR and -.Fn lwres_nooprequest_free +\fBlwres_nooprequest_free()\fR release the memory in resolver context -.Fa ctx +\fIctx\fR that was allocated to the -.Dv lwres_noopresponse_t +\fBlwres_noopresponse_t\fR or -.Dv lwres_nooprequest_t +\fBlwres_nooprequest_t\fR structures referenced via -.Fa structp . -.Sh RETURN VALUES +\fIstructp\fR. +.SH "RETURN VALUES" +.PP The no-op opcode functions -.Fn lwres_nooprequest_render , -.Fn lwres_noopresponse_render -.Fn lwres_nooprequest_parse +\fBlwres_nooprequest_render()\fR, +\fBlwres_noopresponse_render()\fR +\fBlwres_nooprequest_parse()\fR and -.Fn lwres_noopresponse_parse +\fBlwres_noopresponse_parse()\fR all return -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS on success. They return -.Er LWRES_R_NOMEMORY +LWRES_R_NOMEMORY if memory allocation fails. -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer -.Fa b +\fIb\fR is too small to accommodate the packet header or the -.Dv lwres_nooprequest_t +\fBlwres_nooprequest_t\fR and -.Dv lwres_noopresponse_t +\fBlwres_noopresponse_t\fR structures. -.Fn lwres_nooprequest_parse +\fBlwres_nooprequest_parse()\fR and -.Fn lwres_noopresponse_parse +\fBlwres_noopresponse_parse()\fR will return -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the received packet. These functions will return -.Er LWRES_R_FAILURE +LWRES_R_FAILURE if -.Li pktflags +pktflags in the packet header structure -.Dv lwres_lwpacket_t +\fBlwres_lwpacket_t\fR indicate that the packet is not a response to an earlier query. -.Sh SEE ALSO -.Xr lwres_packet 3 +.SH "SEE ALSO" +.PP +\fBlwres_packet\fR(3) diff --git a/lib/lwres/man/lwres_noop.docbook b/lib/lwres/man/lwres_noop.docbook new file mode 100644 index 0000000000..e041d23a0e --- /dev/null +++ b/lib/lwres/man/lwres_noop.docbook @@ -0,0 +1,252 @@ + + + + + + + + + +Jun 30, 2000 + + +lwres_noop +3 +BIND9 + + +lwres_nooprequest_render +lwres_noopresponse_render +lwres_nooprequest_parse +lwres_noopresponse_parse +lwres_noopresponse_free +lwres_nooprequest_free +lightweight resolver no-op message handling + + + + +#include <lwres/lwres.h> + + +lwres_result_t +lwres_nooprequest_render +lwres_context_t *ctx +lwres_nooprequest_t *req +lwres_lwpacket_t *pkt +lwres_buffer_t *b + + + +lwres_result_t +lwres_noopresponse_render +lwres_context_t *ctx +lwres_noopresponse_t *req +lwres_lwpacket_t *pkt +lwres_buffer_t *b + + + +lwres_result_t +lwres_nooprequest_parse +lwres_context_t *ctx +lwres_buffer_t *b +lwres_lwpacket_t *pkt +lwres_nooprequest_t **structp + + + +lwres_result_t +lwres_noopresponse_parse +lwres_context_t *ctx +lwres_buffer_t *b +lwres_lwpacket_t *pkt +lwres_noopresponse_t **structp + + + +void +lwres_noopresponse_free +lwres_context_t *ctx +lwres_noopresponse_t **structp + + + +void +lwres_nooprequest_free +lwres_context_t *ctx +lwres_nooprequest_t **structp + + + + +DESCRIPTION + +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. + + +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. + +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. + + + + +RETURN VALUES + +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. + + + +SEE ALSO + + +lwres_packet3 + + + + + diff --git a/lib/lwres/man/lwres_noop.html b/lib/lwres/man/lwres_noop.html new file mode 100644 index 0000000000..18aa5c42df --- /dev/null +++ b/lib/lwres/man/lwres_noop.html @@ -0,0 +1,436 @@ + +lwres_noop

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

Synopsis

#include <lwres/lwres.h>

lwres_result_t +lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);

lwres_result_t +lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);

lwres_result_t +lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);

void +lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp);

void +lwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp);

DESCRIPTION

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.

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. + +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.

RETURN VALUES

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.

SEE ALSO

lwres_packet(3)

\ No newline at end of file diff --git a/lib/lwres/man/lwres_packet.3 b/lib/lwres/man/lwres_packet.3 index 8dec3dce5f..f97c011d2a 100644 --- a/lib/lwres/man/lwres_packet.3 +++ b/lib/lwres/man/lwres_packet.3 @@ -12,38 +12,27 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_packet.3,v 1.6 2001/01/09 21:50:20 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_PACKET 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_lwpacket_renderheader , -.Nm lwres_lwpacket_parseheader -.Nd lightweight resolver packet handling functions -.Sh SYNOPSIS -.Fd #include -.Fd #include -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_lwpacket_renderheader -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fc -.Ft lwres_result_t -.Fo lwres_lwpacket_parseheader -.Fa "lwres_buffer_t *b" -.Fa "lwres_lwpacket_t *pkt" -.Fc -.Sh DESCRIPTION +.TH "LWRES_PACKET" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions +.SH SYNOPSIS +\fB#include #include #include +.sp +lwres_result_t +lwres_lwpacket_renderheader(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +.sp +lwres_result_t +lwres_lwpacket_parseheader(lwres_buffer_t *b); +(lwres_lwpacket_t *pkt); +\fR.SH "DESCRIPTION" +.PP These functions rely on a -.Dv "struct lwres_lwpacket" +\fBstruct lwres_lwpacket\fR which is defined in -.Pa lwres/lwpacket.h . -.Bd -literal -offset indent +\fIlwres/lwpacket.h\fR. +.sp +.nf typedef struct lwres_lwpacket lwres_lwpacket_t; struct lwres_lwpacket { @@ -57,108 +46,118 @@ struct lwres_lwpacket { lwres_uint16_t authtype; lwres_uint16_t authlength; }; -.Ed -.Pp -.Pp +.sp +.fi +.PP +.PP The elements of this structure are: -.Bl -tag -width recvlength -.It Li length +.TP +\fBlength\fR the overall packet length, including the entire packet header. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. -.It Li version +.TP +\fBversion\fR the header format. There is currently only one format, -.Dv LWRES_LWPACKETVERSION_0 . +\fBLWRES_LWPACKETVERSION_0\fR. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. -.It Li pktflags +.TP +\fBpktflags\fR 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. -.It Li serial +.TP +\fBserial\fR 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. -.It Li opcode +.TP +\fBopcode\fR 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. -.It Li result +.TP +\fBresult\fR 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. -.It Li recvlength +.TP +\fBrecvlength\fR 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. -.It Li authtype +.TP +\fBauthtype\fR 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. -.It Li authlen +.TP +\fBauthlen\fR gives the length of the authentication data. Since packet authentication is currently not used, this must be zero. -.El -.Pp +.PP The following opcodes are currently defined: -.Bl -tag -width GETADDRSBYNAME -.It Li NOOP +.TP +\fBNOOP\fR Success is always returned and the packet contents are echoed. The lwres_noop_*() functions should be used for this type. -.It Li GETADDRSBYNAME +.TP +\fBGETADDRSBYNAME\fR returns all known addresses for a given name. The lwres_gabn_*() functions should be used for this type. -.It Li GETNAMEBYADDR +.TP +\fBGETNAMEBYADDR\fR return the hostname for the given address. The lwres_gnba_*() functions should be used for this type. -.El -.Pp -.Fn lwres_lwpacket_renderheader +.PP +\fBlwres_lwpacket_renderheader()\fR transfers the contents of lightweight resolver packet structure -.Dv lwres_lwpacket_t -.Fa *pkt +\fBlwres_lwpacket_t\fR +\fI*pkt\fR in network byte order to the lightweight resolver buffer, -.Fa *b . -.Pp -.Fn lwres_lwpacket_parseheader +\fI*b\fR. +.PP +\fBlwres_lwpacket_parseheader()\fR performs the converse operation. It transfers data in network byte order from buffer -.Fa *b +\fI*b\fR to resolver packet -.Fa *pkt . +\fI*pkt\fR. The contents of the buffer -.Fa b +\fIb\fR should correspond to a -.Dv "lwres_lwpacket_t" . -.Pp +\fBlwres_lwpacket_t\fR. +.PP Both functions have assertion checks to ensure that -.Fa b +\fIb\fR and -.Fa pkt +\fIpkt\fR are not -.Dv NULL . -.Sh RETURN VALUES +\fBNULL\fR. +.SH "RETURN VALUES" +.PP Successful calls to -.Fn lwres_lwpacket_renderheader +\fBlwres_lwpacket_renderheader()\fR and -.Fn lwres_lwpacket_parseheader +\fBlwres_lwpacket_parseheader()\fR return -.Er LWRES_R_SUCCESS . +LWRES_R_SUCCESS. If there is insufficient space to copy data between the buffer -.Fa *b +\fI*b\fR and lightweight resolver packet -.Fa *pkt +\fI*pkt\fR both functions return -.Er LWRES_R_UNEXPECTEDEND . +LWRES_R_UNEXPECTEDEND. diff --git a/lib/lwres/man/lwres_packet.docbook b/lib/lwres/man/lwres_packet.docbook new file mode 100644 index 0000000000..890ff86c64 --- /dev/null +++ b/lib/lwres/man/lwres_packet.docbook @@ -0,0 +1,240 @@ + + + + + + + +Jun 30, 2000 + + +lwres_packet +3 +BIND9 + + +lwres_lwpacket_renderheader +lwres_lwpacket_parseheader +lightweight resolver packet handling functions + + + +#include <lwres/lwbuffer.h> +#include <lwres/lwpacket.h> +#include <lwres/result.h> + + +lwres_result_t +lwres_lwpacket_renderheader +lwres_buffer_t *b +lwres_lwpacket_t *pkt + + + +lwres_result_t +lwres_lwpacket_parseheader +lwres_buffer_t *b +lwres_lwpacket_t *pkt + + + + +DESCRIPTION + +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; + lwres_uint16_t pktflags; + lwres_uint32_t serial; + lwres_uint32_t opcode; + lwres_uint32_t result; + lwres_uint32_t recvlength; + lwres_uint16_t authtype; + lwres_uint16_t authlength; +}; + + + + + +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. + +version + + +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. + +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. + +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. + +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. + +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. + +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. + +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. + +authlen + + +gives the length of the authentication data. +Since packet authentication is currently not used, this must be zero. + + + + + +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. + +GETADDRSBYNAME + + +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. + + + + + +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. + + + +Both functions have assertion checks to ensure that +b +and +pkt +are not +NULL. + + + + +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/lib/lwres/man/lwres_packet.html b/lib/lwres/man/lwres_packet.html new file mode 100644 index 0000000000..e7d54254ec --- /dev/null +++ b/lib/lwres/man/lwres_packet.html @@ -0,0 +1,413 @@ + +lwres_packet

lwres_packet

Name

lwres_lwpacket_renderheader, lwres_lwpacket_parseheader -- lightweight resolver packet handling functions

Synopsis

#include <lwres/lwbuffer.h>
#include <lwres/lwpacket.h>
#include <lwres/result.h>

lwres_result_t +lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);

lwres_result_t +lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);

DESCRIPTION

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;
+	lwres_uint16_t		pktflags;
+	lwres_uint32_t		serial;
+	lwres_uint32_t		opcode;
+	lwres_uint32_t		result;
+	lwres_uint32_t		recvlength;
+	lwres_uint16_t		authtype;
+	lwres_uint16_t		authlength;
+};

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.

version

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.

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.

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.

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.

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.

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.

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.

authlen

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

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.

GETADDRSBYNAME

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.

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.

Both functions have assertion checks to ensure that +b +and +pkt +are not +NULL.

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.

\ No newline at end of file diff --git a/lib/lwres/man/lwres_resutil.3 b/lib/lwres/man/lwres_resutil.3 index 1763dd2072..90d0caccba 100644 --- a/lib/lwres/man/lwres_resutil.3 +++ b/lib/lwres/man/lwres_resutil.3 @@ -12,96 +12,83 @@ .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.\" $Id: lwres_resutil.3,v 1.5 2001/01/09 21:50:21 bwelling Exp $ - -.Dd Jun 30, 2000 -.Dt LWRES_RESUTIL 3 -.Os BIND9 9 -.ds vT BIND9 Programmer's Manual -.Sh NAME -.Nm lwres_string_parse , -.Nm lwres_addr_parse , -.Nm lwres_getaddrsbyname , -.Nm lwres_getnamebyaddr -.Nd lightweight resolver utility functions -.Sh SYNOPSIS -.Fd #include -.Fd -.Ft lwres_result_t -.Fo lwres_string_parse -.Fa "lwres_buffer_t *b" -.Fa "char **c" -.Fa "lwres_uint16_t *len" -.Fc -.Ft lwres_result_t -.Fo lwres_addr_parse -.Fa "lwres_buffer_t *b" -.Fa "lwres_addr_t *addr" -.Fc -.Ft lwres_result_t -.Fo lwres_getaddrsbyname -.Fa "lwres_context_t *ctx" -.Fa "const char *name" -.Fa "lwres_uint32_t addrtypes" -.Fa "lwres_gabnresponse_t **structp" -.Fc -.Ft lwres_result_t -.Fo lwres_getnamebyaddr -.Fa "lwres_context_t *ctx" -.Fa "lwres_uint32_t addrtype" -.Fa "lwres_uint16_t addrlen" -.Fa "const unsigned char *addr" -.Fa "lwres_gnbaresponse_t **structp" -.Fc -.Sh DESCRIPTION -.Fn lwres_string_parse +.TH "LWRES_RESUTIL" "3" "Jun 30, 2000" "BIND9" "" +.SH NAME +lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr \- lightweight resolver utility functions +.SH SYNOPSIS +\fB#include +.sp +lwres_result_t +lwres_string_parse(lwres_buffer_t *b); +(char **c); +(lwres_uint16_t *len); +.sp +lwres_result_t +lwres_addr_parse(lwres_buffer_t *b); +(lwres_addr_t *addr); +.sp +lwres_result_t +lwres_getaddrsbyname(lwres_context_t *ctx); +(const char *name); +(lwres_uint32_t addrtypes); +(lwres_gabnresponse_t **structp); +.sp +lwres_result_t +lwres_getnamebyaddr(lwres_context_t *ctx); +(lwres_uint32_t addrtype); +(lwres_uint16_t addrlen); +(const unsigned char *addr); +(lwres_gnbaresponse_t **structp); +\fR.SH "DESCRIPTION" +.PP +\fBlwres_string_parse()\fR retrieves a DNS-encoded string starting the current pointer of lightweight resolver buffer -.Fa b : +\fIb\fR: i.e. -.Li b->current . +b->current. When the function returns, the address of the first byte of the encoded string is returned via -.Fa *c +\fI*c\fR and the length of that string is given by -.Fa *len . +\fI*len\fR. The buffer's current pointer is advanced to point at the character following the string length, the encoded string, and the trailing -.Dv NULL +\fBNULL\fR character. -.Fn lwres_string_parse +\fBlwres_string_parse()\fR has an assertion check that -.Fa b +\fIb\fR is not -.Dv NULL . -.Pp -.Fn lwres_addr_parse +\fBNULL\fR. +.PP +\fBlwres_addr_parse()\fR extracts an address from the buffer -.Fa b . +\fIb\fR. It checks that -.Fa addr +\fIaddr\fR is not null. The buffer's current pointer -.Li b->current +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 -.Li addr->address +addr->address and -.Li addr->length +addr->length indicates the size in bytes of the address that was copied. -.Li b->current +b->current is advanced to point at the next byte of available data in the buffer following the encoded address. -.Pp -.Fn lwres_getaddrsbyname +.PP +\fBlwres_getaddrsbyname()\fR and -.Fn lwres_getnamebyaddr +\fBlwres_getnamebyaddr()\fR use the -.Dv "lwres_gnbaresponse_t" +\fBlwres_gnbaresponse_t\fR structure defined below: -.Bd -literal -offset indent +.sp +.nf typedef struct { lwres_uint32_t flags; lwres_uint16_t naliases; @@ -114,102 +101,105 @@ typedef struct { void *base; size_t baselen; } lwres_gabnresponse_t; -.Ed +.sp +.fi The contents of this structure are not manipulated directly but they are controlled through the -.Xr lwres_gabn 3 +\fBlwres_gabn\fR(3) functions. -.Pp +.PP The lightweight resolver uses -.Fn lwres_getaddrsbyname +\fBlwres_getaddrsbyname()\fR to perform foward lookups. Hostname -.Fa name +\fIname\fR is looked up using the resolver context -.Fa ctx +\fIctx\fR for memory allocation. -.Fa addrtypes +\fIaddrtypes\fR is a bitmask indicating which type of addresses are to be looked up. Current values for this bitmask are -.Dv LWRES_ADDRTYPE_V4 +\fBLWRES_ADDRTYPE_V4\fR for IPv4 addresses and -.Dv LWRES_ADDRTYPE_V6 +\fBLWRES_ADDRTYPE_V6\fR for IPv6 addresses. Results of the lookup are returned in -.Fa *structp . -.Fn lwres_getaddrsbyname +\fI*structp\fR. +\fBlwres_getaddrsbyname()\fR checks that its pointer arguments are not -.Dv NULL +\fBNULL\fR and that -.Fa addrtypes +\fIaddrtypes\fR is non-zero. -.Pp -.Fn lwres_getnamebyaddr +.PP +\fBlwres_getnamebyaddr()\fR performs reverse lookups. Resolver context -.Fa ctx +\fIctx\fR is used for memory allocation. The address type is indicated by -.Fa addrtype : -.Dv LWRES_ADDRTYPE_V4 +\fIaddrtype\fR: +\fBLWRES_ADDRTYPE_V4\fR or -.Dv LWRES_ADDRTYPE_V6 . +\fBLWRES_ADDRTYPE_V6\fR. The address to be looked up is given by -.Fa addr +\fIaddr\fR and its length is -.Fa addrlen +\fIaddrlen\fR bytes. The result of the function call is made available through -.Fa *structp . +\fI*structp\fR. Like -.Fn lwres_getaddrsbyname , -.Fn lwres_getnamebyaddr +\fBlwres_getaddrsbyname()\fR, +\fBlwres_getnamebyaddr()\fR uses assertion checking to ensure its pointer arguments are not -.Dv NULL +\fBNULL\fR and -.Fa addrtype +\fIaddrtype\fR is not zero. -.Fn lwres_getaddrsbyname +\fBlwres_getaddrsbyname()\fR also checks that -.Fa addrlen +\fIaddrlen\fR is non-zero. -.Sh RETURN VALUES +.SH "RETURN VALUES" +.PP Successful calls to -.Fn lwres_string_parse +\fBlwres_string_parse()\fR and -.Fn lwres_addr_parse +\fBlwres_addr_parse()\fR return -.Er LWRES_R_SUCCESS. +LWRES_R_SUCCESS. Both functions return -.Er LWRES_R_FAILURE +LWRES_R_FAILURE if the buffer is corrupt or -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffer has less space than expected for the components of the encoded string or address. -.Pp -.Fn lwres_getaddrsbyname +.PP +\fBlwres_getaddrsbyname()\fR returns -.Er LWRES_R_SUCCESS +LWRES_R_SUCCESS on success and it returns -.Er LWRES_R_NOTFOUND +LWRES_R_NOTFOUND if the hostname -.Fa name +\fIname\fR could not be found. -.Pp -.Er LWRES_R_SUCCESS +.PP +LWRES_R_SUCCESS is returned by a successful call to -.Fn lwres_getnamebyaddr . -.Pp +\fBlwres_getnamebyaddr()\fR. +.PP Both -.Fn lwres_getaddrsbyname +\fBlwres_getaddrsbyname()\fR and -.Fn lwres_getnamebyaddr +\fBlwres_getnamebyaddr()\fR return -.Er LWRES_R_NOMEMORY +LWRES_R_NOMEMORY when memory allocation requests fail and -.Er LWRES_R_UNEXPECTEDEND +LWRES_R_UNEXPECTEDEND if the buffers used for sending queries and receiving replies are too small. -.Sh SEE ALSO -.Xr lwres_buffer 3 , -.Xr lwres_gabn 3 . +.SH "SEE ALSO" +.PP +\fBlwres_buffer\fR(3), +\fBlwres_gabn\fR(3). diff --git a/lib/lwres/man/lwres_resutil.docbook b/lib/lwres/man/lwres_resutil.docbook new file mode 100644 index 0000000000..6ec3564059 --- /dev/null +++ b/lib/lwres/man/lwres_resutil.docbook @@ -0,0 +1,276 @@ + + + + + + + + + +Jun 30, 2000 + + + lwres_resutil + 3 + BIND9 + + +lwres_string_parse +lwres_addr_parse +lwres_getaddrsbyname +lwres_getnamebyaddr +lightweight resolver utility functions + + + +#include <lwres/lwres.h> + + +lwres_result_t +lwres_string_parse +lwres_buffer_t *b +char **c +lwres_uint16_t *len + + + +lwres_result_t +lwres_addr_parse +lwres_buffer_t *b +lwres_addr_t *addr + + + +lwres_result_t +lwres_getaddrsbyname +lwres_context_t *ctx +const char *name +lwres_uint32_t addrtypes +lwres_gabnresponse_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 **structp + + + + +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_string_parse() +has an assertion check that +b +is not +NULL. + + + +lwres_addr_parse() +extracts an address from the buffer +b. + +It checks that +addr +is not null. +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; + 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; + +The contents of this structure are not manipulated directly but +they are controlled through the + +lwres_gabn3 + + +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_getaddrsbyname() +checks that its pointer arguments are not +NULL +and that +addrtypes +is non-zero. + + +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. + +Like +lwres_getaddrsbyname(), + +lwres_getnamebyaddr() +uses assertion checking to ensure its pointer arguments are not +NULL +and +addrtype +is not zero. +lwres_getaddrsbyname() +also checks that +addrlen +is non-zero. + + + +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. + + + +SEE ALSO + + +lwres_buffer3 +, + + +lwres_gabn3 +. + + + + diff --git a/lib/lwres/man/lwres_resutil.html b/lib/lwres/man/lwres_resutil.html new file mode 100644 index 0000000000..86ed882e62 --- /dev/null +++ b/lib/lwres/man/lwres_resutil.html @@ -0,0 +1,524 @@ + +lwres_resutil

lwres_resutil

Name

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

Synopsis

#include <lwres/lwres.h>

lwres_result_t +lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len);

lwres_result_t +lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr);

lwres_result_t +lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_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 **structp);

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_string_parse() +has an assertion check that +b +is not +NULL.

lwres_addr_parse() +extracts an address from the buffer +b. + +It checks that +addr +is not null. +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;
+	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;
+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. + +lwres_getaddrsbyname() +checks that its pointer arguments are not +NULL +and that +addrtypes +is non-zero.

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. + +Like +lwres_getaddrsbyname(), + +lwres_getnamebyaddr() +uses assertion checking to ensure its pointer arguments are not +NULL +and +addrtype +is not zero. +lwres_getaddrsbyname() +also checks that +addrlen +is non-zero.

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.

SEE ALSO

lwres_buffer(3), + +lwres_gabn(3).

\ No newline at end of file