1LWRES_GABN(3)                        BIND9                       LWRES_GABN(3)
2
3
4

NAME

6       lwres_gabnrequest_render, lwres_gabnresponse_render,
7       lwres_gabnrequest_parse, lwres_gabnresponse_parse,
8       lwres_gabnresponse_free, lwres_gabnrequest_free - lightweight resolver
9       getaddrbyname message handling
10

SYNOPSIS

12       #include <lwres/lwres.h>
13
14       lwres_result_t lwres_gabnrequest_render(lwres_context_t *ctx,
15                                               lwres_gabnrequest_t *req,
16                                               lwres_lwpacket_t *pkt,
17                                               lwres_buffer_t *b);
18
19       lwres_result_t lwres_gabnresponse_render(lwres_context_t *ctx,
20                                                lwres_gabnresponse_t *req,
21                                                lwres_lwpacket_t *pkt,
22                                                lwres_buffer_t *b);
23
24       lwres_result_t lwres_gabnrequest_parse(lwres_context_t *ctx,
25                                              lwres_buffer_t *b,
26                                              lwres_lwpacket_t *pkt,
27                                              lwres_gabnrequest_t **structp);
28
29       lwres_result_t lwres_gabnresponse_parse(lwres_context_t *ctx,
30                                               lwres_buffer_t *b,
31                                               lwres_lwpacket_t *pkt,
32                                               lwres_gabnresponse_t **structp);
33
34       void lwres_gabnresponse_free(lwres_context_t *ctx,
35                                    lwres_gabnresponse_t **structp);
36
37       void lwres_gabnrequest_free(lwres_context_t *ctx,
38                                   lwres_gabnrequest_t **structp);
39

DESCRIPTION

41       These are low-level routines for creating and parsing lightweight
42       resolver name-to-address lookup request and response messages.
43
44       There are four main functions for the getaddrbyname opcode. One render
45       function converts a getaddrbyname request structure —
46       lwres_gabnrequest_t — to the lighweight resolver's canonical format. It
47       is complemented by a parse function that converts a packet in this
48       canonical format to a getaddrbyname request structure. Another render
49       function converts the getaddrbyname response structure —
50       lwres_gabnresponse_t — to the canonical format. This is complemented by
51       a parse function which converts a packet in canonical format to a
52       getaddrbyname response structure.
53
54       These structures are defined in <lwres/lwres.h>. They are shown below.
55
56           #define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
57
58
59           typedef struct lwres_addr lwres_addr_t;
60           typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
61
62
63           typedef struct {
64                   lwres_uint32_t  flags;
65                   lwres_uint32_t  addrtypes;
66                   lwres_uint16_t  namelen;
67                   char           *name;
68           } lwres_gabnrequest_t;
69
70
71           typedef struct {
72                   lwres_uint32_t          flags;
73                   lwres_uint16_t          naliases;
74                   lwres_uint16_t          naddrs;
75                   char                   *realname;
76                   char                  **aliases;
77                   lwres_uint16_t          realnamelen;
78                   lwres_uint16_t         *aliaslen;
79                   lwres_addrlist_t        addrs;
80                   void                   *base;
81                   size_t                  baselen;
82           } lwres_gabnresponse_t;
83
84
85       lwres_gabnrequest_render() uses resolver context ctx to convert
86       getaddrbyname request structure req to canonical format. The packet
87       header structure pkt is initialised and transferred to buffer b. The
88       contents of *req are then appended to the buffer in canonical format.
89       lwres_gabnresponse_render() performs the same task, except it converts
90       a getaddrbyname response structure lwres_gabnresponse_t to the
91       lightweight resolver's canonical format.
92
93       lwres_gabnrequest_parse() uses context ctx to convert the contents of
94       packet pkt to a lwres_gabnrequest_t structure. Buffer b provides space
95       to be used for storing this structure. When the function succeeds, the
96       resulting lwres_gabnrequest_t is made available through *structp.
97       lwres_gabnresponse_parse() offers the same semantics as
98       lwres_gabnrequest_parse() except it yields a lwres_gabnresponse_t
99       structure.
100
101       lwres_gabnresponse_free() and lwres_gabnrequest_free() release the
102       memory in resolver context ctx that was allocated to the
103       lwres_gabnresponse_t or lwres_gabnrequest_t structures referenced via
104       structp. Any memory associated with ancillary buffers and strings for
105       those structures is also discarded.
106

RETURN VALUES

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

SEE ALSO

122       lwres_packet(3)
123
125       Copyright © 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
126       Copyright © 2000, 2001 Internet Software Consortium.
127
128
129
130BIND9                            Jun 30, 2000                    LWRES_GABN(3)
Impressum