]> git.ipfire.org Git - people/ms/strongswan.git/blame - src/libfreeswan/liblwres/man/lwres_gabn.docbook
- started to rebuild source layout
[people/ms/strongswan.git] / src / libfreeswan / liblwres / man / lwres_gabn.docbook
CommitLineData
997358a6
MW
1<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
2<!--
3 - Copyright (C) 2001 Internet Software Consortium.
4 -
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
8 -
9 - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
10 - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
11 - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
12 - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
13 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14 - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
16 - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17-->
18
19<!-- $Id: lwres_gabn.docbook,v 1.1 2004/03/15 20:35:25 as Exp $ -->
20
21<refentry>
22<refentryinfo>
23
24
25<date>Jun 30, 2000</date>
26</refentryinfo>
27<refmeta>
28<refentrytitle>lwres_gabn</refentrytitle>
29<manvolnum>3</manvolnum>
30<refmiscinfo>BIND9</refmiscinfo>
31</refmeta>
32<refnamediv>
33<refname>lwres_gabnrequest_render</refname>
34<refname>lwres_gabnresponse_render</refname>
35<refname>lwres_gabnrequest_parse</refname>
36<refname>lwres_gabnresponse_parse</refname>
37<refname>lwres_gabnresponse_free</refname>
38<refname>lwres_gabnrequest_free</refname>
39<refpurpose>lightweight resolver getaddrbyname message handling</refpurpose>
40</refnamediv>
41<refsynopsisdiv>
42<funcsynopsis>
43<funcsynopsisinfo>#include &lt;lwres/lwres.h&gt;</funcsynopsisinfo>
44<funcprototype>
45<funcdef>
46lwres_result_t
47<function>lwres_gabnrequest_render</function></funcdef>
48<paramdef>lwres_context_t *ctx</paramdef>
49<paramdef>lwres_gabnrequest_t *req</paramdef>
50<paramdef>lwres_lwpacket_t *pkt</paramdef>
51<paramdef>lwres_buffer_t *b</paramdef>
52</funcprototype>
53<funcprototype>
54<funcdef>
55lwres_result_t
56<function>lwres_gabnresponse_render</function></funcdef>
57<paramdef>lwres_context_t *ctx</paramdef>
58<paramdef>lwres_gabnresponse_t *req</paramdef>
59<paramdef>lwres_lwpacket_t *pkt</paramdef>
60<paramdef>lwres_buffer_t *b</paramdef>
61</funcprototype>
62<funcprototype>
63<funcdef>
64lwres_result_t
65<function>lwres_gabnrequest_parse</function></funcdef>
66<paramdef>lwres_context_t *ctx</paramdef>
67<paramdef>lwres_buffer_t *b</paramdef>
68<paramdef>lwres_lwpacket_t *pkt</paramdef>
69<paramdef>lwres_gabnrequest_t **structp</paramdef>
70</funcprototype>
71<funcprototype>
72<funcdef>
73lwres_result_t
74<function>lwres_gabnresponse_parse</function></funcdef>
75<paramdef>lwres_context_t *ctx</paramdef>
76<paramdef>lwres_buffer_t *b</paramdef>
77<paramdef>lwres_lwpacket_t *pkt</paramdef>
78<paramdef>lwres_gabnresponse_t **structp</paramdef>
79</funcprototype>
80<funcprototype>
81<funcdef>
82void
83<function>lwres_gabnresponse_free</function></funcdef>
84<paramdef>lwres_context_t *ctx</paramdef>
85<paramdef>lwres_gabnresponse_t **structp</paramdef>
86</funcprototype>
87<funcprototype>
88<funcdef>
89void
90<function>lwres_gabnrequest_free</function></funcdef>
91<paramdef>lwres_context_t *ctx</paramdef>
92<paramdef>lwres_gabnrequest_t **structp</paramdef>
93</funcprototype>
94</funcsynopsis>
95</refsynopsisdiv>
96<refsect1>
97<title>DESCRIPTION</title>
98<para>
99These are low-level routines for creating and parsing
100lightweight resolver name-to-address lookup request and
101response messages.
102</para><para>
103There are four main functions for the getaddrbyname opcode.
104One render function converts a getaddrbyname request structure &mdash;
105<type>lwres_gabnrequest_t</type> &mdash;
106to the lighweight resolver's canonical format.
107It is complemented by a parse function that converts a packet in this
108canonical format to a getaddrbyname request structure.
109Another render function converts the getaddrbyname response structure &mdash;
110<type>lwres_gabnresponse_t</type> &mdash;
111to the canonical format.
112This is complemented by a parse function which converts a packet in
113canonical format to a getaddrbyname response structure.
114</para>
115<para>
116These structures are defined in
117<filename>&lt;lwres/lwres.h&gt;</filename>.
118They are shown below.
119<programlisting>
120#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
121
122typedef struct lwres_addr lwres_addr_t;
123typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
124
125typedef struct {
126 lwres_uint32_t flags;
127 lwres_uint32_t addrtypes;
128 lwres_uint16_t namelen;
129 char *name;
130} lwres_gabnrequest_t;
131
132typedef struct {
133 lwres_uint32_t flags;
134 lwres_uint16_t naliases;
135 lwres_uint16_t naddrs;
136 char *realname;
137 char **aliases;
138 lwres_uint16_t realnamelen;
139 lwres_uint16_t *aliaslen;
140 lwres_addrlist_t addrs;
141 void *base;
142 size_t baselen;
143} lwres_gabnresponse_t;
144</programlisting>
145</para>
146<para>
147<function>lwres_gabnrequest_render()</function>
148uses resolver context
149<parameter>ctx</parameter>
150to convert getaddrbyname request structure
151<parameter>req</parameter>
152to canonical format.
153The packet header structure
154<parameter>pkt</parameter>
155is initialised and transferred to
156buffer
157<parameter>b</parameter>.
158
159The contents of
160<parameter>*req</parameter>
161are then appended to the buffer in canonical format.
162<function>lwres_gabnresponse_render()</function>
163performs the same task, except it converts a getaddrbyname response structure
164<type>lwres_gabnresponse_t</type>
165to the lightweight resolver's canonical format.
166</para>
167<para>
168<function>lwres_gabnrequest_parse()</function>
169uses context
170<parameter>ctx</parameter>
171to convert the contents of packet
172<parameter>pkt</parameter>
173to a
174<type>lwres_gabnrequest_t</type>
175structure.
176Buffer
177<parameter>b</parameter>
178provides space to be used for storing this structure.
179When the function succeeds, the resulting
180<type>lwres_gabnrequest_t</type>
181is made available through
182<parameter>*structp</parameter>.
183
184<function>lwres_gabnresponse_parse()</function>
185offers the same semantics as
186<function>lwres_gabnrequest_parse()</function>
187except it yields a
188<type>lwres_gabnresponse_t</type>
189structure.
190</para>
191<para>
192<function>lwres_gabnresponse_free()</function>
193and
194<function>lwres_gabnrequest_free()</function>
195release the memory in resolver context
196<parameter>ctx</parameter>
197that was allocated to the
198<type>lwres_gabnresponse_t</type>
199or
200<type>lwres_gabnrequest_t</type>
201structures referenced via
202<parameter>structp</parameter>.
203
204Any memory associated with ancillary buffers and strings for those
205structures is also discarded.
206</para>
207</refsect1>
208<refsect1>
209<title>RETURN VALUES</title>
210<para>
211The getaddrbyname opcode functions
212<function>lwres_gabnrequest_render()</function>,
213<function>lwres_gabnresponse_render()</function>
214<function>lwres_gabnrequest_parse()</function>
215and
216<function>lwres_gabnresponse_parse()</function>
217all return
218<errorcode>LWRES_R_SUCCESS</errorcode>
219on success.
220They return
221<errorcode>LWRES_R_NOMEMORY</errorcode>
222if memory allocation fails.
223<errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
224is returned if the available space in the buffer
225<parameter>b</parameter>
226is too small to accommodate the packet header or the
227<type>lwres_gabnrequest_t</type>
228and
229<type>lwres_gabnresponse_t</type>
230structures.
231<function>lwres_gabnrequest_parse()</function>
232and
233<function>lwres_gabnresponse_parse()</function>
234will return
235<errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
236if the buffer is not empty after decoding the received packet.
237These functions will return
238<errorcode>LWRES_R_FAILURE</errorcode>
239if
240<structfield>pktflags</structfield>
241in the packet header structure
242<type>lwres_lwpacket_t</type>
243indicate that the packet is not a response to an earlier query.
244</para>
245</refsect1>
246<refsect1>
247<title>SEE ALSO</title>
248<para>
249<citerefentry>
250<refentrytitle>lwres_packet</refentrytitle><manvolnum>3
251</manvolnum>
252</citerefentry>
253</para>
254</refsect1>
255</refentry>