lwres_gabn.html revision c651f15b30f1dae5cc2f00878fb5da5b3a35a468
1fdd2470b625a58b57d0b155e6caf8c4fc0afe8aAutomatic Updater - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - Copyright (C) 2000, 2001 Internet Software Consortium.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater - Permission to use, copy, modify, and distribute this software for any
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - purpose with or without fee is hereby granted, provided that the above
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - copyright notice and this permission notice appear in all copies.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - PERFORMANCE OF THIS SOFTWARE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<!-- $Id: lwres_gabn.html,v 1.12 2005/04/07 03:50:01 marka Exp $ -->
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabn</TITLE
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic UpdaterNAME="GENERATOR"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="REFENTRY"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsBGCOLOR="#FFFFFF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsTEXT="#000000"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsLINK="#0000FF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsVLINK="#840084"
28b3569d6248168e6c00caab951521cc8141a49dAutomatic UpdaterALINK="#0000FF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabn</H1
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="REFNAMEDIV"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free -- lightweight resolver getaddrbyname message handling</DIV
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="REFSYNOPSISDIV"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>Synopsis</H2
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark AndrewsCLASS="FUNCSYNOPSIS"
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic UpdaterCLASS="FUNCSYNOPSISINFO"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCDEF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_result_t
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslwres_gabnrequest_render</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="FUNCDEF"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_result_t
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterlwres_gabnresponse_render</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCDEF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_result_t
731cc132f22dbc9e0ecd7035dce314a61076d31bAutomatic Updaterlwres_gabnrequest_parse</CODE
731cc132f22dbc9e0ecd7035dce314a61076d31bAutomatic Updater>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCDEF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_result_t
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslwres_gabnresponse_parse</CODE
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCDEF"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslwres_gabnresponse_free</CODE
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater>(lwres_context_t *ctx, lwres_gabnresponse_t **structp);</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="FUNCDEF"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterlwres_gabnrequest_free</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>(lwres_context_t *ctx, lwres_gabnrequest_t **structp);</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="REFSECT1"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>DESCRIPTION</H2
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>These are low-level routines for creating and parsing
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterlightweight resolver name-to-address lookup request and
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterresponse messages.</P
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>There are four main functions for the getaddrbyname opcode.
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterOne render function converts a getaddrbyname request structure —
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnrequest_t</SPAN
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterto the lighweight resolver's canonical format.
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterIt is complemented by a parse function that converts a packet in this
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updatercanonical format to a getaddrbyname request structure.
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterAnother render function converts the getaddrbyname response structure —
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsto the canonical format.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsThis is complemented by a parse function which converts a packet in
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewscanonical format to a getaddrbyname response structure.</P
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>These structures are defined in
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FILENAME"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsThey are shown below.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PROGRAMLISTING"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewstypedef struct lwres_addr lwres_addr_t;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewstypedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewstypedef struct {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews lwres_uint32_t flags;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews lwres_uint32_t addrtypes;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews lwres_uint16_t namelen;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews} lwres_gabnrequest_t;
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updatertypedef struct {
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater lwres_uint32_t flags;
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater lwres_uint16_t naliases;
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater lwres_uint16_t naddrs;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews char *realname;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews char **aliases;
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater lwres_uint16_t realnamelen;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews lwres_uint16_t *aliaslen;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews lwres_addrlist_t addrs;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews size_t baselen;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews} lwres_gabnresponse_t;</PRE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_render()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsuses resolver context
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsto convert getaddrbyname request structure
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsto canonical format.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsThe packet header structure
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updateris initialised and transferred to
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterThe contents of
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterare then appended to the buffer in canonical format.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_render()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsperforms the same task, except it converts a getaddrbyname response structure
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsto the lightweight resolver's canonical format.</P
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_parse()</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="PARAMETER"
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updaterto convert the contents of packet
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic UpdaterCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnrequest_t</SPAN
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterprovides space to be used for storing this structure.
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterWhen the function succeeds, the resulting
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnrequest_t</SPAN
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updateris made available through
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="PARAMETER"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>*structp</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="FUNCTION"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnresponse_parse()</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updateroffers the same semantics as
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterCLASS="FUNCTION"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnrequest_parse()</CODE
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterexcept it yields a
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater>lwres_gabnresponse_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_free()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_free()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrelease the memory in resolver context
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsthat was allocated to the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsstructures referenced via
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>structp</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsAny memory associated with ancillary buffers and strings for those
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsstructures is also discarded.</P
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="REFSECT1"
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark Andrews>RETURN VALUES</H2
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>The getaddrbyname opcode functions
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater>lwres_gabnrequest_render()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_render()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_parse()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_parse()</CODE
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark AndrewsCLASS="ERRORCODE"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>LWRES_R_SUCCESS</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="ERRORCODE"
c6c78f699b55b3344fb6b17ddc854cbae4610468Automatic Updater>LWRES_R_NOMEMORY</SPAN
c6c78f699b55b3344fb6b17ddc854cbae4610468Automatic Updaterif memory allocation fails.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="ERRORCODE"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>LWRES_R_UNEXPECTEDEND</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsis returned if the available space in the buffer
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="PARAMETER"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsis too small to accommodate the packet header or the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnrequest_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_t</SPAN
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater>lwres_gabnrequest_parse()</CODE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCLASS="FUNCTION"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews>lwres_gabnresponse_parse()</CODE