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

RETURN VALUES

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

SEE ALSO

111       lwres_packet(3).
112

AUTHOR

114       Internet Systems Consortium, Inc.
115
117       Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018-2020 Internet
118       Systems Consortium, Inc. ("ISC")
119
120
121
122ISC                               2007-06-18                     LWRES_GNBA(3)
Impressum