1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
<!--
- Copyright (C) 2000, 2001 Internet Software Consortium.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<HTML
><HEAD
><TITLE
>lwres_getrrsetbyname</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.61
"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><H1
><A
NAME="AEN1"
>lwres_getrrsetbyname</A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN8"
></A
><H2
>Name</H2
>lwres_getrrsetbyname, lwres_freerrset -- retrieve DNS records</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN12"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN13"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include <lwres/netdb.h></PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int
lwres_getrrsetbyname</CODE
>(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res);</CODE
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>void
lwres_freerrset</CODE
>(struct rrsetinfo *rrset);</CODE
></P
><P
></P
></DIV
><P
>The following structures are used:
<PRE
CLASS="PROGRAMLISTING"
>struct rdatainfo {
unsigned int rdi_length; /* length of data */
unsigned char *rdi_data; /* record data */
};
struct rrsetinfo {
unsigned int rri_flags; /* RRSET_VALIDATED... */
unsigned int rri_rdclass; /* class number */
unsigned int rri_rdtype; /* RR type number */
unsigned int rri_ttl; /* time to live */
unsigned int rri_nrdatas; /* size of rdatas array */
unsigned int rri_nsigs; /* size of sigs array */
char *rri_name; /* canonical name */
struct rdatainfo *rri_rdatas; /* individual records */
struct rdatainfo *rri_sigs; /* individual signatures */
};</PRE
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN29"
></A
><H2
>DESCRIPTION</H2
><P
><TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>
gets a set of resource records associated with a
<TT
CLASS="PARAMETER"
><I
>hostname</I
></TT
>,
<TT
CLASS="PARAMETER"
><I
>class</I
></TT
>,
and
<TT
CLASS="PARAMETER"
><I
>type</I
></TT
>.
<TT
CLASS="PARAMETER"
><I
>hostname</I
></TT
>
is
a pointer a to null-terminated string. The
<TT
CLASS="PARAMETER"
><I
>flags</I
></TT
>
field is currently unused and must be zero.</P
><P
>After a successful call to
<TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>,
<TT
CLASS="PARAMETER"
><I
>*res</I
></TT
>
is a pointer to an
<SPAN
CLASS="TYPE"
>rrsetinfo</SPAN
>
structure, containing a list of one or more
<SPAN
CLASS="TYPE"
>rdatainfo</SPAN
>
structures containing resource records and potentially another list of
<SPAN
CLASS="TYPE"
>rdatainfo</SPAN
>
structures containing SIG resource records
associated with those records.
The members
<TT
CLASS="CONSTANT"
>rri_rdclass</TT
>
and
<TT
CLASS="CONSTANT"
>rri_rdtype</TT
>
are copied from the parameters.
<TT
CLASS="CONSTANT"
>rri_ttl</TT
>
and
<TT
CLASS="CONSTANT"
>rri_name</TT
>
are properties of the obtained rrset.
The resource records contained in
<TT
CLASS="CONSTANT"
>rri_rdatas</TT
>
and
<TT
CLASS="CONSTANT"
>rri_sigs</TT
>
are in uncompressed DNS wire format.
Properties of the rdataset are represented in the
<TT
CLASS="CONSTANT"
>rri_flags</TT
>
bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC
validated and the signatures verified. </P
><P
>All of the information returned by
<TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>
is dynamically allocated: the
<TT
CLASS="CONSTANT"
>rrsetinfo</TT
>
and
<TT
CLASS="CONSTANT"
>rdatainfo</TT
>
structures,
and the canonical host name strings pointed to by the
<TT
CLASS="CONSTANT"
>rrsetinfo</TT
>structure.
Memory allocated for the dynamically allocated structures created by
a successful call to
<TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>
is released by
<TT
CLASS="FUNCTION"
>lwres_freerrset()</TT
>.
<TT
CLASS="PARAMETER"
><I
>rrset</I
></TT
>
is a pointer to a
<SPAN
CLASS="TYPE"
>struct rrset</SPAN
>
created by a call to
<TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>. </P
><P
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN62"
></A
><H2
>RETURN VALUES</H2
><P
><TT
CLASS="FUNCTION"
>lwres_getrrsetbyname()</TT
>
returns zero on success, and one of the following error
codes if an error occurred:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="CONSTANT"
>ERRSET_NONAME</TT
></DT
><DD
><P
>the name does not exist</P
></DD
><DT
><TT
CLASS="CONSTANT"
>ERRSET_NODATA</TT
></DT
><DD
><P
>the name exists, but does not have data of the desired type</P
></DD
><DT
><TT
CLASS="CONSTANT"
>ERRSET_NOMEMORY</TT
></DT
><DD
><P
>memory could not be allocated</P
></DD
><DT
><TT
CLASS="CONSTANT"
>ERRSET_INVAL</TT
></DT
><DD
><P
>a parameter is invalid</P
></DD
><DT
><TT
CLASS="CONSTANT"
>ERRSET_FAIL</TT
></DT
><DD
><P
>other failure</P
></DD
><DT
><TT
CLASS="CONSTANT"
></TT
></DT
><DD
><P
></P
></DD
></DL
></DIV
> </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN97"
></A
><H2
>SEE ALSO</H2
><P
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres</SPAN
>(3)</SPAN
>.</P
></DIV
></BODY
></HTML
>
|