2 * wire2str.h - txt presentation of RRs
4 * (c) NLnet Labs, 2005-2006
6 * See the file LICENSE for the license
12 * Contains functions to translate the wireformat to text
13 * representation, as well as functions to print them.
16 #ifndef LDNS_WIRE2STR_H
17 #define LDNS_WIRE2STR_H
22 struct sldns_struct_lookup_table;
24 /* lookup tables for standard DNS stuff */
25 /** Taken from RFC 2535, section 7. */
26 extern struct sldns_struct_lookup_table* sldns_algorithms;
27 /** DS record hash algorithms */
28 extern struct sldns_struct_lookup_table* sldns_hashes;
29 /** Taken from RFC 2538, section 2.1. */
30 extern struct sldns_struct_lookup_table* sldns_cert_algorithms;
32 extern struct sldns_struct_lookup_table* sldns_rcodes;
33 /** Operation codes */
34 extern struct sldns_struct_lookup_table* sldns_opcodes;
36 extern struct sldns_struct_lookup_table* sldns_edns_flags;
37 /** EDNS option codes */
38 extern struct sldns_struct_lookup_table* sldns_edns_options;
39 /** error string from wireparse */
40 extern struct sldns_struct_lookup_table* sldns_wireparse_errors;
41 /** tsig errors are the rcodes with extra (higher) values */
42 extern struct sldns_struct_lookup_table* sldns_tsig_errors;
45 * Convert wireformat packet to a string representation
46 * @param data: wireformat packet data (starting at ID bytes).
47 * @param len: length of packet.
48 * @return string(malloced) or NULL on failure.
50 char* sldns_wire2str_pkt(uint8_t* data, size_t len);
53 * Convert wireformat RR to a string representation.
54 * @param rr: the wireformat RR, in uncompressed form. Starts at the domain
55 * name start, ends with the rdata of the RR.
56 * @param len: length of the rr wireformat.
57 * @return string(malloced) or NULL on failure.
59 char* sldns_wire2str_rr(uint8_t* rr, size_t len);
62 * Conver wire dname to a string.
63 * @param dname: the dname in uncompressed wireformat.
64 * @param dname_len: length of the dname.
65 * @return string or NULL on failure.
67 char* sldns_wire2str_dname(uint8_t* dname, size_t dname_len);
70 * Convert wire RR type to a string, 'MX', 'TYPE1234'...
71 * @param rrtype: the RR type in host order.
72 * @return malloced string with the RR type or NULL on malloc failure.
74 char* sldns_wire2str_type(uint16_t rrtype);
77 * Convert wire RR class to a string, 'IN', 'CLASS1'.
78 * @param rrclass: the RR class in host order.
79 * @return malloced string with the RR class or NULL on malloc failure.
81 char* sldns_wire2str_class(uint16_t rrclass);
84 * Convert wire packet rcode to a string, 'NOERROR', 'NXDOMAIN'...
85 * @param rcode: as integer, host order
86 * @return malloced string with the rcode or NULL on malloc failure.
88 char* sldns_wire2str_rcode(int rcode);
91 * Print to string, move string along for next content. With va_list.
92 * @param str: string buffer. Adjusted at end to after the output.
93 * @param slen: length of the string buffer. Adjusted at end.
94 * @param format: printf format string.
95 * @param args: arguments for printf.
96 * @return number of characters needed. Can be larger than slen.
98 int sldns_str_vprint(char** str, size_t* slen, const char* format, va_list args);
101 * Print to string, move string along for next content.
102 * @param str: string buffer. Adjusted at end to after the output.
103 * @param slen: length of the string buffer. Adjusted at end.
104 * @param format: printf format string and arguments for it.
105 * @return number of characters needed. Can be larger than slen.
107 int sldns_str_print(char** str, size_t* slen, const char* format, ...)
108 ATTR_FORMAT(printf, 3, 4);
111 * Convert wireformat packet to a string representation with user buffer
112 * It appends every RR with default comments.
113 * For more formatter options use the function: TBD(TODO)
114 * @param data: wireformat packet data (starting at ID bytes).
115 * @param data_len: length of packet.
116 * @param str: the string buffer for the output.
117 * If you pass NULL as the str the return value of the function is
118 * the str_len you need for the entire packet. It does not include
119 * the 0 byte at the end.
120 * @param str_len: the size of the string buffer. If more is needed, it'll
121 * silently truncate the output to fit in the buffer.
122 * @return the number of characters for this element, excluding zerobyte.
123 * Is larger or equal than str_len if output was truncated.
125 int sldns_wire2str_pkt_buf(uint8_t* data, size_t data_len, char* str,
129 * Scan wireformat packet to a string representation with user buffer
130 * It appends every RR with default comments.
131 * For more formatter options use the function: TBD(TODO)
132 * @param data: wireformat packet data (starting at ID bytes).
133 * @param data_len: length of packet.
134 * @param str: the string buffer for the output.
135 * @param str_len: the size of the string buffer.
136 * @return number of characters for string.
137 * returns the number of characters that are needed (except terminating null),
138 * so it may return a value larger than str_len.
139 * On error you get less output (i.e. shorter output in str (null terminated))
140 * On exit the data, data_len, str and str_len values are adjusted to move them
141 * from their original position along the input and output for the content
142 * that has been consumed (and produced) by this function. If the end of the
143 * output string is reached, *str_len is set to 0. The output string is null
144 * terminated (shortening the output if necessary). If the end of the input
145 * is reached *data_len is set to 0.
147 int sldns_wire2str_pkt_scan(uint8_t** data, size_t* data_len, char** str,
151 * Scan wireformat rr to string, with user buffers. It shifts the arguments
152 * to move along (see sldns_wire2str_pkt_scan).
153 * @param data: wireformat data.
154 * @param data_len: length of data buffer.
155 * @param str: string buffer.
156 * @param str_len: length of string buffer.
157 * @param pkt: packet for decompression, if NULL no decompression.
158 * @param pktlen: length of packet buffer.
159 * @return number of characters (except null) needed to print.
161 int sldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str,
162 size_t* str_len, uint8_t* pkt, size_t pktlen);
165 * Scan wireformat question rr to string, with user buffers.
166 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
167 * @param data: wireformat data.
168 * @param data_len: length of data buffer.
169 * @param str: string buffer.
170 * @param str_len: length of string buffer.
171 * @param pkt: packet for decompression, if NULL no decompression.
172 * @param pktlen: length of packet buffer.
173 * @return number of characters (except null) needed to print.
175 int sldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str,
176 size_t* str_len, uint8_t* pkt, size_t pktlen);
179 * Scan wireformat RR to string in unknown RR format, with user buffers.
180 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
181 * @param data: wireformat data.
182 * @param data_len: length of data buffer.
183 * @param str: string buffer.
184 * @param str_len: length of string buffer.
185 * @param pkt: packet for decompression, if NULL no decompression.
186 * @param pktlen: length of packet buffer.
187 * @return number of characters (except null) needed to print.
189 int sldns_wire2str_rr_unknown_scan(uint8_t** data, size_t* data_len, char** str,
190 size_t* str_len, uint8_t* pkt, size_t pktlen);
193 * Print to string the RR-information comment in default format,
194 * with user buffers. Moves string along.
195 * @param str: string buffer.
196 * @param str_len: length of string buffer.
197 * @param rr: wireformat data.
198 * @param rrlen: length of data buffer.
199 * @param dname_off: offset in buffer behind owner dname, the compressed size
201 * @param rrtype: type of the RR, host format.
202 * @return number of characters (except null) needed to print.
204 int sldns_wire2str_rr_comment_print(char** str, size_t* str_len, uint8_t* rr,
205 size_t rrlen, size_t dname_off, uint16_t rrtype);
208 * Scan wireformat packet header to string, with user buffers.
209 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
210 * @param data: wireformat data.
211 * @param data_len: length of data buffer.
212 * @param str: string buffer.
213 * @param str_len: length of string buffer.
214 * @return number of characters (except null) needed to print.
216 int sldns_wire2str_header_scan(uint8_t** data, size_t* data_len, char** str,
220 * Scan wireformat rdata to string, with user buffers.
221 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
222 * @param data: wireformat data.
223 * @param data_len: length of data buffer. The length of the rdata in the
224 * buffer. The rdatalen itself has already been scanned, the data
225 * points to the rdata after the rdatalen.
226 * @param str: string buffer.
227 * @param str_len: length of string buffer.
228 * @param rrtype: RR type of Rdata, host format.
229 * @param pkt: packet for decompression, if NULL no decompression.
230 * @param pktlen: length of packet buffer.
231 * @return number of characters (except null) needed to print.
233 int sldns_wire2str_rdata_scan(uint8_t** data, size_t* data_len, char** str,
234 size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen);
237 * Scan wireformat rdata to string in unknown format, with user buffers.
238 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
239 * @param data: wireformat data.
240 * @param data_len: length of data buffer, the length of the rdata in buffer.
241 * @param str: string buffer.
242 * @param str_len: length of string buffer.
243 * @return number of characters (except null) needed to print.
245 int sldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len,
246 char** str, size_t* str_len);
249 * Scan wireformat domain name to string, with user buffers.
250 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
251 * @param data: wireformat data.
252 * @param data_len: length of data buffer.
253 * @param str: string buffer.
254 * @param str_len: length of string buffer.
255 * @param pkt: packet for decompression, if NULL no decompression.
256 * @param pktlen: length of packet buffer.
257 * @return number of characters (except null) needed to print.
259 int sldns_wire2str_dname_scan(uint8_t** data, size_t* data_len, char** str,
260 size_t* str_len, uint8_t* pkt, size_t pktlen);
263 * Scan wireformat rr type to string, with user buffers.
264 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
265 * @param data: wireformat data.
266 * @param data_len: length of data buffer.
267 * @param str: string buffer.
268 * @param str_len: length of string buffer.
269 * @return number of characters (except null) needed to print.
271 int sldns_wire2str_type_scan(uint8_t** data, size_t* data_len, char** str,
275 * Scan wireformat rr class to string, with user buffers.
276 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
277 * @param data: wireformat data.
278 * @param data_len: length of data buffer.
279 * @param str: string buffer.
280 * @param str_len: length of string buffer.
281 * @return number of characters (except null) needed to print.
283 int sldns_wire2str_class_scan(uint8_t** data, size_t* data_len, char** str,
287 * Scan wireformat rr ttl to string, with user buffers.
288 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
289 * @param data: wireformat data.
290 * @param data_len: length of data buffer.
291 * @param str: string buffer.
292 * @param str_len: length of string buffer.
293 * @return number of characters (except null) needed to print.
295 int sldns_wire2str_ttl_scan(uint8_t** data, size_t* data_len, char** str,
300 * Print host format rr type to string. Moves string along, user buffers.
301 * @param str: string buffer.
302 * @param str_len: length of string buffer.
303 * @param rrtype: host format rr type.
304 * @return number of characters (except null) needed to print.
306 int sldns_wire2str_type_print(char** str, size_t* str_len, uint16_t rrtype);
309 * Print host format rr class to string. Moves string along, user buffers.
310 * @param str: string buffer.
311 * @param str_len: length of string buffer.
312 * @param rrclass: host format rr class.
313 * @return number of characters (except null) needed to print.
315 int sldns_wire2str_class_print(char** str, size_t* str_len, uint16_t rrclass);
318 * Print host format rcode to string. Moves string along, user buffers.
319 * @param str: string buffer.
320 * @param str_len: length of string buffer.
321 * @param rcode: host format rcode number.
322 * @return number of characters (except null) needed to print.
324 int sldns_wire2str_rcode_print(char** str, size_t* str_len, int rcode);
327 * Print host format opcode to string. Moves string along, user buffers.
328 * @param str: string buffer.
329 * @param str_len: length of string buffer.
330 * @param opcode: host format opcode number.
331 * @return number of characters (except null) needed to print.
333 int sldns_wire2str_opcode_print(char** str, size_t* str_len, int opcode);
336 * Print host format EDNS0 option to string. Moves string along, user buffers.
337 * @param str: string buffer.
338 * @param str_len: length of string buffer.
339 * @param opcode: host format option number.
340 * @return number of characters (except null) needed to print.
342 int sldns_wire2str_edns_option_code_print(char** str, size_t* str_len,
346 * Convert RR to string presentation format, on one line. User buffer.
347 * @param rr: wireformat RR data
348 * @param rr_len: length of the rr wire data.
349 * @param str: the string buffer to write to.
350 * If you pass NULL as the str, the return value of the function is
351 * the str_len you need for the entire packet. It does not include
352 * the 0 byte at the end.
353 * @param str_len: the size of the string buffer. If more is needed, it'll
354 * silently truncate the output to fit in the buffer.
355 * @return the number of characters for this element, excluding zerobyte.
356 * Is larger or equal than str_len if output was truncated.
358 int sldns_wire2str_rr_buf(uint8_t* rr, size_t rr_len, char* str,
362 * 3597 printout of an RR in unknown rr format.
363 * There are more format and comment options available for printout
364 * with the function: TBD(TODO)
365 * @param rr: wireformat RR data
366 * @param rr_len: length of the rr wire data.
367 * @param str: the string buffer to write to.
368 * If you pass NULL as the str, the return value of the function is
369 * the str_len you need for the entire rr. It does not include
370 * the 0 byte at the end.
371 * @param str_len: the size of the string buffer. If more is needed, it'll
372 * silently truncate the output to fit in the buffer.
373 * @return the number of characters for this element, excluding zerobyte.
374 * Is larger or equal than str_len if output was truncated.
376 int sldns_wire2str_rr_unknown_buf(uint8_t* rr, size_t rr_len, char* str,
380 * This creates the comment to print after the RR. ; keytag=... , and other
381 * basic comments for RRs.
382 * There are more format and comment options available for printout
383 * with the function: TBD(TODO)
384 * @param rr: wireformat RR data
385 * @param rr_len: length of the rr wire data.
386 * @param dname_len: length of the dname in front of the RR.
387 * @param str: the string buffer to write to.
388 * If you pass NULL as the str, the return value of the function is
389 * the str_len you need for the entire comment. It does not include
390 * the 0 byte at the end.
391 * @param str_len: the size of the string buffer. If more is needed, it'll
392 * silently truncate the output to fit in the buffer.
393 * @return the number of characters for this element, excluding zerobyte.
394 * Is larger or equal than str_len if output was truncated.
396 int sldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rr_len, size_t dname_len,
397 char* str, size_t str_len);
400 * Convert RDATA to string presentation format, on one line. User buffer.
401 * @param rdata: wireformat rdata part of an RR.
402 * @param rdata_len: length of the rr wire data.
403 * @param str: the string buffer to write to.
404 * If you pass NULL as the str, the return value of the function is
405 * the str_len you need for the entire packet. It does not include
406 * the 0 byte at the end.
407 * @param str_len: the size of the string buffer. If more is needed, it'll
408 * silently truncate the output to fit in the buffer.
409 * @param rrtype: rr type of the data
410 * @return the number of characters for this element, excluding zerobyte.
411 * Is larger or equal than str_len if output was truncated.
413 int sldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str,
414 size_t str_len, uint16_t rrtype);
417 * Convert wire RR type to a string, 'MX', 'TYPE12'. With user buffer.
418 * @param rrtype: the RR type in host order.
419 * @param str: the string to write to.
420 * @param len: length of str.
421 * @return the number of characters for this element, excluding zerobyte.
422 * Is larger or equal than str_len if output was truncated.
424 int sldns_wire2str_type_buf(uint16_t rrtype, char* str, size_t len);
427 * Convert wire RR class to a string, 'IN', 'CLASS12'. With user buffer.
428 * @param rrclass: the RR class in host order.
429 * @param str: the string to write to.
430 * @param len: length of str.
431 * @return the number of characters for this element, excluding zerobyte.
432 * Is larger or equal than str_len if output was truncated.
434 int sldns_wire2str_class_buf(uint16_t rrclass, char* str, size_t len);
437 * Convert wire RR rcode to a string, 'NOERROR', 'NXDOMAIN'. With user buffer.
438 * @param rcode: rcode as integer in host order
439 * @param str: the string to write to.
440 * @param len: length of str.
441 * @return the number of characters for this element, excluding zerobyte.
442 * Is larger or equal than str_len if output was truncated.
444 int sldns_wire2str_rcode_buf(int rcode, char* str, size_t len);
447 * Convert host format opcode to a string. 'QUERY', 'NOTIFY', 'UPDATE'.
449 * @param opcode: opcode as integer in host order
450 * @param str: the string to write to.
451 * @param len: length of str.
452 * @return the number of characters for this element, excluding zerobyte.
453 * Is larger or equal than str_len if output was truncated.
455 int sldns_wire2str_opcode_buf(int opcode, char* str, size_t len);
458 * Convert wire dname to a string, "example.com.". With user buffer.
459 * @param dname: the dname in uncompressed wireformat.
460 * @param dname_len: length of the dname.
461 * @param str: the string to write to.
462 * @param len: length of string.
463 * @return the number of characters for this element, excluding zerobyte.
464 * Is larger or equal than str_len if output was truncated.
466 int sldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str,
470 * Scan wireformat rdf field to string, with user buffers.
471 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
472 * @param data: wireformat data.
473 * @param data_len: length of data buffer.
474 * @param str: string buffer.
475 * @param str_len: length of string buffer.
476 * @param rdftype: the type of the rdata field, enum sldns_rdf_type.
477 * @param pkt: packet for decompression, if NULL no decompression.
478 * @param pktlen: length of packet buffer.
479 * @return number of characters (except null) needed to print.
480 * Can return -1 on failure.
482 int sldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str,
483 size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen);
486 * Scan wireformat int8 field to string, with user buffers.
487 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
488 * @param data: wireformat data.
489 * @param data_len: length of data buffer.
490 * @param str: string buffer.
491 * @param str_len: length of string buffer.
492 * @return number of characters (except null) needed to print.
493 * Can return -1 on failure.
495 int sldns_wire2str_int8_scan(uint8_t** data, size_t* data_len, char** str,
499 * Scan wireformat int16 field to string, with user buffers.
500 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
501 * @param data: wireformat data.
502 * @param data_len: length of data buffer.
503 * @param str: string buffer.
504 * @param str_len: length of string buffer.
505 * @return number of characters (except null) needed to print.
506 * Can return -1 on failure.
508 int sldns_wire2str_int16_scan(uint8_t** data, size_t* data_len, char** str,
512 * Scan wireformat int32 field to string, with user buffers.
513 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
514 * @param data: wireformat data.
515 * @param data_len: length of data buffer.
516 * @param str: string buffer.
517 * @param str_len: length of string buffer.
518 * @return number of characters (except null) needed to print.
519 * Can return -1 on failure.
521 int sldns_wire2str_int32_scan(uint8_t** data, size_t* data_len, char** str,
525 * Scan wireformat period field to string, with user buffers.
526 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
527 * @param data: wireformat data.
528 * @param data_len: length of data buffer.
529 * @param str: string buffer.
530 * @param str_len: length of string buffer.
531 * @return number of characters (except null) needed to print.
532 * Can return -1 on failure.
534 int sldns_wire2str_period_scan(uint8_t** data, size_t* data_len, char** str,
538 * Scan wireformat tsigtime field to string, with user buffers.
539 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
540 * @param data: wireformat data.
541 * @param data_len: length of data buffer.
542 * @param str: string buffer.
543 * @param str_len: length of string buffer.
544 * @return number of characters (except null) needed to print.
545 * Can return -1 on failure.
547 int sldns_wire2str_tsigtime_scan(uint8_t** data, size_t* data_len, char** str,
551 * Scan wireformat ip4 A field to string, with user buffers.
552 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
553 * @param data: wireformat data.
554 * @param data_len: length of data buffer.
555 * @param str: string buffer.
556 * @param str_len: length of string buffer.
557 * @return number of characters (except null) needed to print.
558 * Can return -1 on failure.
560 int sldns_wire2str_a_scan(uint8_t** data, size_t* data_len, char** str,
564 * Scan wireformat ip6 AAAA field to string, with user buffers.
565 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
566 * @param data: wireformat data.
567 * @param data_len: length of data buffer.
568 * @param str: string buffer.
569 * @param str_len: length of string buffer.
570 * @return number of characters (except null) needed to print.
571 * Can return -1 on failure.
573 int sldns_wire2str_aaaa_scan(uint8_t** data, size_t* data_len, char** str,
577 * Scan wireformat str field to string, with user buffers.
578 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
579 * @param data: wireformat data.
580 * @param data_len: length of data buffer.
581 * @param str: string buffer.
582 * @param str_len: length of string buffer.
583 * @return number of characters (except null) needed to print.
584 * Can return -1 on failure.
586 int sldns_wire2str_str_scan(uint8_t** data, size_t* data_len, char** str,
590 * Scan wireformat apl field to string, with user buffers.
591 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
592 * @param data: wireformat data.
593 * @param data_len: length of data buffer.
594 * @param str: string buffer.
595 * @param str_len: length of string buffer.
596 * @return number of characters (except null) needed to print.
597 * Can return -1 on failure.
599 int sldns_wire2str_apl_scan(uint8_t** data, size_t* data_len, char** str,
603 * Scan wireformat b32_ext field to string, with user buffers.
604 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
605 * @param data: wireformat data.
606 * @param data_len: length of data buffer.
607 * @param str: string buffer.
608 * @param str_len: length of string buffer.
609 * @return number of characters (except null) needed to print.
610 * Can return -1 on failure.
612 int sldns_wire2str_b32_ext_scan(uint8_t** data, size_t* data_len, char** str,
616 * Scan wireformat b64 field to string, with user buffers.
617 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
618 * @param data: wireformat data.
619 * @param data_len: length of data buffer.
620 * @param str: string buffer.
621 * @param str_len: length of string buffer.
622 * @return number of characters (except null) needed to print.
623 * Can return -1 on failure.
625 int sldns_wire2str_b64_scan(uint8_t** data, size_t* data_len, char** str,
629 * Scan wireformat hex field to string, with user buffers.
630 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
631 * @param data: wireformat data.
632 * @param data_len: length of data buffer.
633 * @param str: string buffer.
634 * @param str_len: length of string buffer.
635 * @return number of characters (except null) needed to print.
636 * Can return -1 on failure.
638 int sldns_wire2str_hex_scan(uint8_t** data, size_t* data_len, char** str,
642 * Scan wireformat nsec bitmap field to string, with user buffers.
643 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
644 * @param data: wireformat data.
645 * @param data_len: length of data buffer.
646 * @param str: string buffer.
647 * @param str_len: length of string buffer.
648 * @return number of characters (except null) needed to print.
649 * Can return -1 on failure.
651 int sldns_wire2str_nsec_scan(uint8_t** data, size_t* data_len, char** str,
655 * Scan wireformat nsec3_salt field to string, with user buffers.
656 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
657 * @param data: wireformat data.
658 * @param data_len: length of data buffer.
659 * @param str: string buffer.
660 * @param str_len: length of string buffer.
661 * @return number of characters (except null) needed to print.
662 * Can return -1 on failure.
664 int sldns_wire2str_nsec3_salt_scan(uint8_t** data, size_t* data_len, char** str,
668 * Scan wireformat cert_alg field to string, with user buffers.
669 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
670 * @param data: wireformat data.
671 * @param data_len: length of data buffer.
672 * @param str: string buffer.
673 * @param str_len: length of string buffer.
674 * @return number of characters (except null) needed to print.
675 * Can return -1 on failure.
677 int sldns_wire2str_cert_alg_scan(uint8_t** data, size_t* data_len, char** str,
681 * Scan wireformat alg field to string, with user buffers.
682 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
683 * @param data: wireformat data.
684 * @param data_len: length of data buffer.
685 * @param str: string buffer.
686 * @param str_len: length of string buffer.
687 * @return number of characters (except null) needed to print.
688 * Can return -1 on failure.
690 int sldns_wire2str_alg_scan(uint8_t** data, size_t* data_len, char** str,
694 * Scan wireformat type unknown field to string, with user buffers.
695 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
696 * @param data: wireformat data.
697 * @param data_len: length of data buffer.
698 * @param str: string buffer.
699 * @param str_len: length of string buffer.
700 * @return number of characters (except null) needed to print.
701 * Can return -1 on failure.
703 int sldns_wire2str_unknown_scan(uint8_t** data, size_t* data_len, char** str,
707 * Scan wireformat time field to string, with user buffers.
708 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
709 * @param data: wireformat data.
710 * @param data_len: length of data buffer.
711 * @param str: string buffer.
712 * @param str_len: length of string buffer.
713 * @return number of characters (except null) needed to print.
714 * Can return -1 on failure.
716 int sldns_wire2str_time_scan(uint8_t** data, size_t* data_len, char** str,
720 * Scan wireformat LOC field to string, with user buffers.
721 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
722 * @param data: wireformat data.
723 * @param data_len: length of data buffer.
724 * @param str: string buffer.
725 * @param str_len: length of string buffer.
726 * @return number of characters (except null) needed to print.
727 * Can return -1 on failure.
729 int sldns_wire2str_loc_scan(uint8_t** data, size_t* data_len, char** str,
733 * Scan wireformat WKS field to string, with user buffers.
734 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
735 * @param data: wireformat data.
736 * @param data_len: length of data buffer.
737 * @param str: string buffer.
738 * @param str_len: length of string buffer.
739 * @return number of characters (except null) needed to print.
740 * Can return -1 on failure.
742 int sldns_wire2str_wks_scan(uint8_t** data, size_t* data_len, char** str,
746 * Scan wireformat NSAP field to string, with user buffers.
747 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
748 * @param data: wireformat data.
749 * @param data_len: length of data buffer.
750 * @param str: string buffer.
751 * @param str_len: length of string buffer.
752 * @return number of characters (except null) needed to print.
753 * Can return -1 on failure.
755 int sldns_wire2str_nsap_scan(uint8_t** data, size_t* data_len, char** str,
759 * Scan wireformat ATMA field to string, with user buffers.
760 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
761 * @param data: wireformat data.
762 * @param data_len: length of data buffer.
763 * @param str: string buffer.
764 * @param str_len: length of string buffer.
765 * @return number of characters (except null) needed to print.
766 * Can return -1 on failure.
768 int sldns_wire2str_atma_scan(uint8_t** data, size_t* data_len, char** str,
772 * Scan wireformat IPSECKEY field to string, with user buffers.
773 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
774 * @param data: wireformat data.
775 * @param data_len: length of data buffer.
776 * @param str: string buffer.
777 * @param str_len: length of string buffer.
778 * @param pkt: packet for decompression, if NULL no decompression.
779 * @param pktlen: length of packet buffer.
780 * @return number of characters (except null) needed to print.
781 * Can return -1 on failure.
783 int sldns_wire2str_ipseckey_scan(uint8_t** data, size_t* data_len, char** str,
784 size_t* str_len, uint8_t* pkt, size_t pktlen);
787 * Scan wireformat HIP (algo, HIT, pubkey) field to string, with user buffers.
788 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
789 * @param data: wireformat data.
790 * @param data_len: length of data buffer.
791 * @param str: string buffer.
792 * @param str_len: length of string buffer.
793 * @return number of characters (except null) needed to print.
794 * Can return -1 on failure.
796 int sldns_wire2str_hip_scan(uint8_t** data, size_t* data_len, char** str,
800 * Scan wireformat int16_data field to string, with user buffers.
801 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
802 * @param data: wireformat data.
803 * @param data_len: length of data buffer.
804 * @param str: string buffer.
805 * @param str_len: length of string buffer.
806 * @return number of characters (except null) needed to print.
807 * Can return -1 on failure.
809 int sldns_wire2str_int16_data_scan(uint8_t** data, size_t* data_len, char** str,
813 * Scan wireformat tsigerror field to string, with user buffers.
814 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
815 * @param data: wireformat data.
816 * @param data_len: length of data buffer.
817 * @param str: string buffer.
818 * @param str_len: length of string buffer.
819 * @return number of characters (except null) needed to print.
820 * Can return -1 on failure.
822 int sldns_wire2str_tsigerror_scan(uint8_t** data, size_t* data_len, char** str,
826 * Scan wireformat nsec3_next_owner field to string, with user buffers.
827 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
828 * @param data: wireformat data.
829 * @param data_len: length of data buffer.
830 * @param str: string buffer.
831 * @param str_len: length of string buffer.
832 * @return number of characters (except null) needed to print.
833 * Can return -1 on failure.
835 int sldns_wire2str_nsec3_next_owner_scan(uint8_t** data, size_t* data_len,
836 char** str, size_t* str_len);
839 * Scan wireformat ILNP64 field to string, with user buffers.
840 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
841 * @param data: wireformat data.
842 * @param data_len: length of data buffer.
843 * @param str: string buffer.
844 * @param str_len: length of string buffer.
845 * @return number of characters (except null) needed to print.
846 * Can return -1 on failure.
848 int sldns_wire2str_ilnp64_scan(uint8_t** data, size_t* data_len, char** str,
852 * Scan wireformat EUI48 field to string, with user buffers.
853 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
854 * @param data: wireformat data.
855 * @param data_len: length of data buffer.
856 * @param str: string buffer.
857 * @param str_len: length of string buffer.
858 * @return number of characters (except null) needed to print.
859 * Can return -1 on failure.
861 int sldns_wire2str_eui48_scan(uint8_t** data, size_t* data_len, char** str,
865 * Scan wireformat EUI64 field to string, with user buffers.
866 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
867 * @param data: wireformat data.
868 * @param data_len: length of data buffer.
869 * @param str: string buffer.
870 * @param str_len: length of string buffer.
871 * @return number of characters (except null) needed to print.
872 * Can return -1 on failure.
874 int sldns_wire2str_eui64_scan(uint8_t** data, size_t* data_len, char** str,
878 * Scan wireformat TAG field to string, with user buffers.
879 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
880 * @param data: wireformat data.
881 * @param data_len: length of data buffer.
882 * @param str: string buffer.
883 * @param str_len: length of string buffer.
884 * @return number of characters (except null) needed to print.
885 * Can return -1 on failure.
887 int sldns_wire2str_tag_scan(uint8_t** data, size_t* data_len, char** str,
891 * Scan wireformat long_str field to string, with user buffers.
892 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
893 * @param data: wireformat data.
894 * @param data_len: length of data buffer.
895 * @param str: string buffer.
896 * @param str_len: length of string buffer.
897 * @return number of characters (except null) needed to print.
898 * Can return -1 on failure.
900 int sldns_wire2str_long_str_scan(uint8_t** data, size_t* data_len, char** str,
904 * Print EDNS LLQ option data to string. User buffers, moves string pointers.
905 * @param str: string buffer.
906 * @param str_len: length of string buffer.
907 * @param option_data: buffer with EDNS option code data.
908 * @param option_len: length of the data for this option.
909 * @return number of characters (except null) needed to print.
911 int sldns_wire2str_edns_llq_print(char** str, size_t* str_len,
912 uint8_t* option_data, size_t option_len);
915 * Print EDNS UL option data to string. User buffers, moves string pointers.
916 * @param str: string buffer.
917 * @param str_len: length of string buffer.
918 * @param option_data: buffer with EDNS option code data.
919 * @param option_len: length of the data for this option.
920 * @return number of characters (except null) needed to print.
922 int sldns_wire2str_edns_ul_print(char** str, size_t* str_len,
923 uint8_t* option_data, size_t option_len);
926 * Print EDNS NSID option data to string. User buffers, moves string pointers.
927 * @param str: string buffer.
928 * @param str_len: length of string buffer.
929 * @param option_data: buffer with EDNS option code data.
930 * @param option_len: length of the data for this option.
931 * @return number of characters (except null) needed to print.
933 int sldns_wire2str_edns_nsid_print(char** str, size_t* str_len,
934 uint8_t* option_data, size_t option_len);
937 * Print EDNS DAU option data to string. User buffers, moves string pointers.
938 * @param str: string buffer.
939 * @param str_len: length of string buffer.
940 * @param option_data: buffer with EDNS option code data.
941 * @param option_len: length of the data for this option.
942 * @return number of characters (except null) needed to print.
944 int sldns_wire2str_edns_dau_print(char** str, size_t* str_len,
945 uint8_t* option_data, size_t option_len);
948 * Print EDNS DHU option data to string. User buffers, moves string pointers.
949 * @param str: string buffer.
950 * @param str_len: length of string buffer.
951 * @param option_data: buffer with EDNS option code data.
952 * @param option_len: length of the data for this option.
953 * @return number of characters (except null) needed to print.
955 int sldns_wire2str_edns_dhu_print(char** str, size_t* str_len,
956 uint8_t* option_data, size_t option_len);
959 * Print EDNS N3U option data to string. User buffers, moves string pointers.
960 * @param str: string buffer.
961 * @param str_len: length of string buffer.
962 * @param option_data: buffer with EDNS option code data.
963 * @param option_len: length of the data for this option.
964 * @return number of characters (except null) needed to print.
966 int sldns_wire2str_edns_n3u_print(char** str, size_t* str_len,
967 uint8_t* option_data, size_t option_len);
970 * Print EDNS SUBNET option data to string. User buffers, moves string pointers.
971 * @param str: string buffer.
972 * @param str_len: length of string buffer.
973 * @param option_data: buffer with EDNS option code data.
974 * @param option_len: length of the data for this option.
975 * @return number of characters (except null) needed to print.
977 int sldns_wire2str_edns_subnet_print(char** str, size_t* str_len,
978 uint8_t* option_data, size_t option_len);
981 * Print an EDNS option as OPT: VALUE. User buffers, moves string pointers.
982 * @param str: string buffer.
983 * @param str_len: length of string buffer.
984 * @param option_code: host format EDNS option code.
985 * @param option_data: buffer with EDNS option code data.
986 * @param option_len: length of the data for this option.
987 * @return number of characters (except null) needed to print.
989 int sldns_wire2str_edns_option_print(char** str, size_t* str_len,
990 uint16_t option_code, uint8_t* option_data, size_t option_len);
993 * Scan wireformat EDNS OPT to string, with user buffers.
994 * It shifts the arguments to move along (see sldns_wire2str_pkt_scan).
995 * @param data: wireformat data.
996 * @param data_len: length of data buffer.
997 * @param str: string buffer.
998 * @param str_len: length of string buffer.
999 * @param pkt: packet with header and other info (may be NULL)
1000 * @param pktlen: length of packet buffer.
1001 * @return number of characters (except null) needed to print.
1003 int sldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
1004 size_t* str_len, uint8_t* pkt, size_t pktlen);
1010 #endif /* LDNS_WIRE2STR_H */