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 lighweight 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
62 typedef struct {
63 lwres_uint16_t datalength;
64 unsigned char *data;
65 } lwres_nooprequest_t;
66
67
68 typedef struct {
69 lwres_uint16_t datalength;
70 unsigned char *data;
71 } lwres_noopresponse_t;
72
73
74 Although the structures have different types, they are identical. This
75 is because the no-op opcode simply echos whatever data was sent: the
76 response is therefore identical to the request.
77
78 lwres_nooprequest_render() uses resolver context ctx to convert no-op
79 request structure req to canonical format. The packet header structure
80 pkt is initialised and transferred to buffer b. The contents of *req
81 are then appended to the buffer in canonical format.
82 lwres_noopresponse_render() performs the same task, except it converts
83 a no-op response structure lwres_noopresponse_t to the lightweight
84 resolver's canonical format.
85
86 lwres_nooprequest_parse() uses context ctx to convert the contents of
87 packet pkt to a lwres_nooprequest_t structure. Buffer b provides space
88 to be used for storing this structure. When the function succeeds, the
89 resulting lwres_nooprequest_t is made available through *structp.
90 lwres_noopresponse_parse() offers the same semantics as
91 lwres_nooprequest_parse() except it yields a lwres_noopresponse_t
92 structure.
93
94 lwres_noopresponse_free() and lwres_nooprequest_free() release the
95 memory in resolver context ctx that was allocated to the
96 lwres_noopresponse_t or lwres_nooprequest_t structures referenced via
97 structp.
98
100 The no-op opcode functions lwres_nooprequest_render(),
101 lwres_noopresponse_render() lwres_nooprequest_parse() and
102 lwres_noopresponse_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_nooprequest_t and lwres_noopresponse_t structures.
107 lwres_nooprequest_parse() and lwres_noopresponse_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
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_NOOP(3)