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 lightweight resolver's canonical format.
47       It 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           typedef struct lwres_addr lwres_addr_t;
59           typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
60
61           typedef struct {
62                   uint32_t  flags;
63                   uint32_t  addrtypes;
64                   uint16_t  namelen;
65                   char           *name;
66           } lwres_gabnrequest_t;
67
68           typedef struct {
69                   uint32_t          flags;
70                   uint16_t          naliases;
71                   uint16_t          naddrs;
72                   char                   *realname;
73                   char                  **aliases;
74                   uint16_t          realnamelen;
75                   uint16_t         *aliaslen;
76                   lwres_addrlist_t        addrs;
77                   void                   *base;
78                   size_t                  baselen;
79           } lwres_gabnresponse_t;
80
81       lwres_gabnrequest_render() uses resolver context ctx to convert
82       getaddrbyname request structure req to canonical format. The packet
83       header structure pkt is initialised and transferred to buffer b. The
84       contents of *req are then appended to the buffer in canonical format.
85       lwres_gabnresponse_render() performs the same task, except it converts
86       a getaddrbyname response structure lwres_gabnresponse_t to the
87       lightweight resolver's canonical format.
88
89       lwres_gabnrequest_parse() uses context ctx to convert the contents of
90       packet pkt to a lwres_gabnrequest_t structure. Buffer b provides space
91       to be used for storing this structure. When the function succeeds, the
92       resulting lwres_gabnrequest_t is made available through *structp.
93       lwres_gabnresponse_parse() offers the same semantics as
94       lwres_gabnrequest_parse() except it yields a lwres_gabnresponse_t
95       structure.
96
97       lwres_gabnresponse_free() and lwres_gabnrequest_free() release the
98       memory in resolver context ctx that was allocated to the
99       lwres_gabnresponse_t or lwres_gabnrequest_t structures referenced via
100       structp. Any memory associated with ancillary buffers and strings for
101       those structures is also discarded.
102

RETURN VALUES

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

SEE ALSO

118       lwres_packet(3)
119

AUTHOR

121       Internet Systems Consortium, Inc.
122
124       Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018, 2019
125       Internet Systems Consortium, Inc. ("ISC")
126
127
128
129ISC                               2007-06-18                     LWRES_GABN(3)
Impressum