1LWRES_NOOP(3) BIND9 LWRES_NOOP(3)
2
3
4
6 lwres_nooprequest_render, lwres_noopresponse_render,
7 lwres_nooprequest_parse, lwres_noopresponse_parse,
8 lwres_noopresponse_free, lwres_nooprequest_free - lightweight resolver
9 no-op message handling
10
12 #include <lwres/lwres.h>
13
14 lwres_result_t lwres_nooprequest_render(lwres_context_t *ctx,
15 lwres_nooprequest_t *req,
16 lwres_lwpacket_t *pkt,
17 lwres_buffer_t *b);
18
19 lwres_result_t lwres_noopresponse_render(lwres_context_t *ctx,
20 lwres_noopresponse_t *req,
21 lwres_lwpacket_t *pkt,
22 lwres_buffer_t *b);
23
24 lwres_result_t lwres_nooprequest_parse(lwres_context_t *ctx,
25 lwres_buffer_t *b,
26 lwres_lwpacket_t *pkt,
27 lwres_nooprequest_t **structp);
28
29 lwres_result_t lwres_noopresponse_parse(lwres_context_t *ctx,
30 lwres_buffer_t *b,
31 lwres_lwpacket_t *pkt,
32 lwres_noopresponse_t **structp);
33
34 void lwres_noopresponse_free(lwres_context_t *ctx,
35 lwres_noopresponse_t **structp);
36
37 void lwres_nooprequest_free(lwres_context_t *ctx,
38 lwres_nooprequest_t **structp);
39
41 These are low-level routines for creating and parsing lightweight
42 resolver no-op request and response messages.
43
44 The no-op message is analogous to a ping packet: a packet is sent to
45 the resolver daemon and is simply echoed back. The opcode is intended
46 to allow a client to determine if the server is operational or not.
47
48 There are four main functions for the no-op opcode. One render function
49 converts a no-op request structure — lwres_nooprequest_t — to the
50 lightweight resolver's canonical format. It is complemented by a parse
51 function that converts a packet in this canonical format to a no-op
52 request structure. Another render function converts the no-op response
53 structure — lwres_noopresponse_t to the canonical format. This is
54 complemented by a parse function which converts a packet in canonical
55 format to a no-op response structure.
56
57 These structures are defined in lwres/lwres.h. They are shown below.
58
59 #define LWRES_OPCODE_NOOP 0x00000000U
60
61 typedef struct {
62 lwres_uint16_t datalength;
63 unsigned char *data;
64 } lwres_nooprequest_t;
65
66 typedef struct {
67 lwres_uint16_t datalength;
68 unsigned char *data;
69 } lwres_noopresponse_t;
70
71 Although the structures have different types, they are identical. This
72 is because the no-op opcode simply echos whatever data was sent: the
73 response is therefore identical to the request.
74
75 lwres_nooprequest_render() uses resolver context ctx to convert no-op
76 request structure req to canonical format. The packet header structure
77 pkt is initialised and transferred to buffer b. The contents of *req
78 are then appended to the buffer in canonical format.
79 lwres_noopresponse_render() performs the same task, except it converts
80 a no-op response structure lwres_noopresponse_t to the lightweight
81 resolver's canonical format.
82
83 lwres_nooprequest_parse() uses context ctx to convert the contents of
84 packet pkt to a lwres_nooprequest_t structure. Buffer b provides space
85 to be used for storing this structure. When the function succeeds, the
86 resulting lwres_nooprequest_t is made available through *structp.
87 lwres_noopresponse_parse() offers the same semantics as
88 lwres_nooprequest_parse() except it yields a lwres_noopresponse_t
89 structure.
90
91 lwres_noopresponse_free() and lwres_nooprequest_free() release the
92 memory in resolver context ctx that was allocated to the
93 lwres_noopresponse_t or lwres_nooprequest_t structures referenced via
94 structp.
95
97 The no-op opcode functions lwres_nooprequest_render(),
98 lwres_noopresponse_render()lwres_nooprequest_parse() and
99 lwres_noopresponse_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_nooprequest_t and lwres_noopresponse_t structures.
104 lwres_nooprequest_parse() and lwres_noopresponse_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
111 lwres_packet(3)
112
114 Internet Systems Consortium, Inc.
115
117 Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet
118 Systems Consortium, Inc. ("ISC")
119
120
121
122ISC 2007-06-18 LWRES_NOOP(3)