1LWRES_GNBA(3)                        BIND9                       LWRES_GNBA(3)
2
3
4

NAME

6       lwres_gnbarequest_render, lwres_gnbaresponse_render,
7       lwres_gnbarequest_parse, lwres_gnbaresponse_parse,
8       lwres_gnbaresponse_free, lwres_gnbarequest_free - lightweight resolver
9       getnamebyaddress message handling
10

SYNOPSIS

12       #include <lwres/lwres.h>
13
14       lwres_result_t lwres_gnbarequest_render(lwres_context_t *ctx,
15                                               lwres_gnbarequest_t *req,
16                                               lwres_lwpacket_t *pkt,
17                                               lwres_buffer_t *b);
18
19       lwres_result_t lwres_gnbaresponse_render(lwres_context_t *ctx,
20                                                lwres_gnbaresponse_t *req,
21                                                lwres_lwpacket_t *pkt,
22                                                lwres_buffer_t *b);
23
24       lwres_result_t lwres_gnbarequest_parse(lwres_context_t *ctx,
25                                              lwres_buffer_t *b,
26                                              lwres_lwpacket_t *pkt,
27                                              lwres_gnbarequest_t **structp);
28
29       lwres_result_t lwres_gnbaresponse_parse(lwres_context_t *ctx,
30                                               lwres_buffer_t *b,
31                                               lwres_lwpacket_t *pkt,
32                                               lwres_gnbaresponse_t **structp);
33
34       void lwres_gnbaresponse_free(lwres_context_t *ctx,
35                                    lwres_gnbaresponse_t **structp);
36
37       void lwres_gnbarequest_free(lwres_context_t *ctx,
38                                   lwres_gnbarequest_t **structp);
39

DESCRIPTION

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

RETURN VALUES

100       The getnamebyaddr opcode functions lwres_gnbarequest_render(),
101       lwres_gnbaresponse_render() lwres_gnbarequest_parse() and
102       lwres_gnbaresponse_parse() all return LWRES_R_SUCCESS on success. They
103       return LWRES_R_NOMEMORY if memory allocation fails.
104       LWRES_R_UNEXPECTEDEND is returned if the available space in the buffer
105       b is too small to accommodate the packet header or the
106       lwres_gnbarequest_t and lwres_gnbaresponse_t structures.
107       lwres_gnbarequest_parse() and lwres_gnbaresponse_parse() will return
108       LWRES_R_UNEXPECTEDEND if the buffer is not empty after decoding the
109       received packet. These functions will return LWRES_R_FAILURE if
110       pktflags in the packet header structure lwres_lwpacket_t indicate that
111       the packet is not a response to an earlier query.
112

SEE ALSO

114       lwres_packet(3).
115
117       Copyright © 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
118       Copyright © 2000, 2001 Internet Software Consortium.
119
120
121
122BIND9                            Jun 30, 2000                    LWRES_GNBA(3)
Impressum