/usr/include/ldns/host2str.h is in libldns-dev 1.6.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | /**
* host2str.h - txt presentation of RRs
*
* a Net::DNS like library for C
*
* (c) NLnet Labs, 2005-2006
*
* See the file LICENSE for the license
*/
/**
* \file
*
* Contains functions to translate the main structures to their text
* representation, as well as functions to print them.
*/
#ifndef LDNS_HOST2STR_H
#define LDNS_HOST2STR_H
#include <ldns/common.h>
#include <ldns/error.h>
#include <ldns/rr.h>
#include <ldns/rdata.h>
#include <ldns/packet.h>
#include <ldns/buffer.h>
#include <ldns/resolver.h>
#include <ldns/zone.h>
#include <ctype.h>
#include "ldns/util.h"
#ifdef __cplusplus
extern "C" {
#endif
#define LDNS_APL_IP4 1
#define LDNS_APL_IP6 2
#define LDNS_APL_MASK 0x7f
#define LDNS_APL_NEGATION 0x80
/**
* Represent a NULL pointer (in stead of a pointer to a ldns_rr as "; (null)"
* as opposed to outputting nothing at all in such a case.
*/
#define LDNS_COMMENT_NULLS 0x0001
/** Show key id with DNSKEY RR's as comment */
#define LDNS_COMMENT_KEY_ID 0x0002
/** Show if a DNSKEY is a ZSK or KSK as comment */
#define LDNS_COMMENT_KEY_TYPE 0x0004
/** Show DNSKEY key size as comment */
#define LDNS_COMMENT_KEY_SIZE 0x0008
/** Show key id, type and size as comment for DNSKEY RR's */
#define LDNS_COMMENT_KEY (LDNS_COMMENT_KEY_ID \
|LDNS_COMMENT_KEY_TYPE\
|LDNS_COMMENT_KEY_SIZE)
/** Provide bubblebabble representation for DS RR's as comment */
#define LDNS_COMMENT_BUBBLEBABBLE 0x0010
/** Show when a NSEC3 RR has the optout flag set as comment */
#define LDNS_COMMENT_FLAGS 0x0020
/** Show the unhashed owner and next owner names for NSEC3 RR's as comment */
#define LDNS_COMMENT_NSEC3_CHAIN 0x0040
/** Print mark up */
#define LDNS_COMMENT_LAYOUT 0x0080
/** Also comment KEY_ID with RRSIGS **/
#define LDNS_COMMENT_RRSIGS 0x0100
/**
* Output format specifier
*
* Determines how Packets, Resource Records and Resource record data fiels are
* formatted when printing or converting to string.
* Currently it is only used to specify what aspects of a Resource Record are
* annotated in the comment section of the textual representation the record.
* This is speciefed with flags and potential exra data (such as for example
* a lookup map of hashes to real names for annotation NSEC3 records).
*/
struct ldns_struct_output_format
{
/** Specification of how RR's should be formatted in text */
int flags;
/** Potential extra data to be used with formatting RR's in text */
void *data;
};
typedef struct ldns_struct_output_format ldns_output_format;
/**
* Standard output format record that disables commenting in the textual
* representation of Resource Records completely.
*/
extern const ldns_output_format *ldns_output_format_nocomments;
/**
* Standard output format record that annotated only DNSKEY RR's with commenti
* text.
*/
extern const ldns_output_format *ldns_output_format_onlykeyids;
/**
* The default output format record. Same as ldns_output_format_onlykeyids.
*/
extern const ldns_output_format *ldns_output_format_default;
/**
* Standard output format record that shows all DNSKEY related information in
* the comment text, plus the optout flag when set with NSEC3's, plus the
* bubblebabble representation of DS RR's.
*/
extern const ldns_output_format *ldns_output_format_bubblebabble;
/**
* Converts an ldns packet opcode value to its mnemonic, and adds that
* to the output buffer
* \param[in] *output the buffer to add the data to
* \param[in] opcode to find the string representation of
* \return LDNS_STATUS_OK on success, or a buffer failure mode on error
*/
ldns_status
ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode);
/**
* Converts an ldns packet rcode value to its mnemonic, and adds that
* to the output buffer
* \param[in] *output the buffer to add the data to
* \param[in] rcode to find the string representation of
* \return LDNS_STATUS_OK on success, or a buffer failure mode on error
*/
ldns_status
ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode);
/**
* Converts an ldns algorithm type to its mnemonic, and adds that
* to the output buffer
* \param[in] *output the buffer to add the data to
* \param[in] algorithm to find the string representation of
* \return LDNS_STATUS_OK on success, or a buffer failure mode on error
*/
ldns_status
ldns_algorithm2buffer_str(ldns_buffer *output,
ldns_algorithm algorithm);
/**
* Converts an ldns certificate algorithm type to its mnemonic,
* and adds that to the output buffer
* \param[in] *output the buffer to add the data to
* \param[in] cert_algorithm to find the string representation of
* \return LDNS_STATUS_OK on success, or a buffer failure mode on error
*/
ldns_status
ldns_cert_algorithm2buffer_str(ldns_buffer *output,
ldns_cert_algorithm cert_algorithm);
/**
* Converts a packet opcode to its mnemonic and returns that as
* an allocated null-terminated string.
* Remember to free it.
*
* \param[in] opcode the opcode to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt_opcode2str(ldns_pkt_opcode opcode);
/**
* Converts a packet rcode to its mnemonic and returns that as
* an allocated null-terminated string.
* Remember to free it.
*
* \param[in] rcode the rcode to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt_rcode2str(ldns_pkt_rcode rcode);
/**
* Converts a signing algorithms to its mnemonic and returns that as
* an allocated null-terminated string.
* Remember to free it.
*
* \param[in] algorithm the algorithm to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt_algorithm2str(ldns_algorithm algorithm);
/**
* Converts a cert algorithm to its mnemonic and returns that as
* an allocated null-terminated string.
* Remember to free it.
*
* \param[in] cert_algorithm to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm);
/**
* Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_AAAA rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_STR rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_B64 rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_B32_EXT rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_HEX rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_TYPE rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_CLASS rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_ALG rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an ldns_rr_type value to its string representation,
* and places it in the given buffer
* \param[in] *output The buffer to add the data to
* \param[in] type the ldns_rr_type to convert
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rr_type2buffer_str(ldns_buffer *output,
const ldns_rr_type type);
/**
* Converts an ldns_rr_type value to its string representation,
* and returns that string. For unknown types, the string
* "TYPE<id>" is returned. This function allocates data that must be
* freed by the caller
* \param[in] type the ldns_rr_type to convert
* \return a newly allocated string
*/
char *ldns_rr_type2str(const ldns_rr_type type);
/**
* Converts an ldns_rr_class value to its string representation,
* and places it in the given buffer
* \param[in] *output The buffer to add the data to
* \param[in] klass the ldns_rr_class to convert
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rr_class2buffer_str(ldns_buffer *output,
const ldns_rr_class klass);
/**
* Converts an ldns_rr_class value to its string representation,
* and returns that string. For unknown types, the string
* "CLASS<id>" is returned. This function allocates data that must be
* freed by the caller
* \param[in] klass the ldns_rr_class to convert
* \return a newly allocated string
*/
char *ldns_rr_class2str(const ldns_rr_class klass);
/**
* Converts an LDNS_RDF_TYPE_CERT rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_LOC rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_UNKNOWN rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_NSAP rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_ATMA rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_WKS rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_NSEC rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_PERIOD rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_TSIGTIME rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_tsigtime(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_APL rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_INT16_DATA rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_IPSECKEY rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_TSIG rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts the data in the rdata field to presentation
* format (as char *) and appends it to the given buffer
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] rdf the pointer to the rdafa field containing the data
* \return status
*/
ldns_status ldns_rdf2buffer_str(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts the data in the resource record to presentation
* format (as char *) and appends it to the given buffer.
* The presentation format of DNSKEY record is annotated with comments giving
* the id, type and size of the key.
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] rr the pointer to the rr field to convert
* \return status
*/
ldns_status ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr);
/**
* Converts the data in the resource record to presentation
* format (as char *) and appends it to the given buffer.
* The presentation format is annotated with comments giving
* additional information on the record.
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] fmt how to format the textual representation of the
* resource record.
* \param[in] rr the pointer to the rr field to convert
* \return status
*/
ldns_status ldns_rr2buffer_str_fmt(ldns_buffer *output,
const ldns_output_format *fmt, const ldns_rr *rr);
/**
* Converts the data in the DNS packet to presentation
* format (as char *) and appends it to the given buffer
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] pkt the pointer to the packet to convert
* \return status
*/
ldns_status ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt);
/**
* Converts the data in the DNS packet to presentation
* format (as char *) and appends it to the given buffer
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] fmt how to format the textual representation of the packet
* \param[in] pkt the pointer to the packet to convert
* \return status
*/
ldns_status ldns_pkt2buffer_str_fmt(ldns_buffer *output,
const ldns_output_format *fmt, const ldns_pkt *pkt);
/**
* Converts an LDNS_RDF_TYPE_NSEC3_SALT rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts the data in the DNS packet to presentation
* format (as char *) and appends it to the given buffer
*
* \param[in] output pointer to the buffer to append the data to
* \param[in] k the pointer to the private key to convert
* \return status
*/
ldns_status ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k);
/**
* Converts an LDNS_RDF_TYPE_INT8 rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_INT16 rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_INT32 rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts an LDNS_RDF_TYPE_TIME rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
* \param[in] *output The buffer to add the data to
* \return LDNS_STATUS_OK on success, and error status on failure
*/
ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf);
/**
* Converts the data in the rdata field to presentation format and
* returns that as a char *.
* Remember to free it.
*
* \param[in] rdf The rdata field to convert
* \return null terminated char * data, or NULL on error
*/
char *ldns_rdf2str(const ldns_rdf *rdf);
/**
* Converts the data in the resource record to presentation format and
* returns that as a char *.
* Remember to free it.
*
* \param[in] rr The rdata field to convert
* \return null terminated char * data, or NULL on error
*/
char *ldns_rr2str(const ldns_rr *rr);
/**
* Converts the data in the resource record to presentation format and
* returns that as a char *.
* Remember to free it.
*
* \param[in] fmt how to format the resource record
* \param[in] rr The rdata field to convert
* \return null terminated char * data, or NULL on error
*/
char *ldns_rr2str_fmt(const ldns_output_format *fmt, const ldns_rr *rr);
/**
* Converts the data in the DNS packet to presentation format and
* returns that as a char *.
* Remember to free it.
*
* \param[in] pkt The rdata field to convert
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt2str(const ldns_pkt *pkt);
/**
* Converts the data in the DNS packet to presentation format and
* returns that as a char *.
* Remember to free it.
*
* \param[in] fmt how to format the packet
* \param[in] pkt The rdata field to convert
* \return null terminated char * data, or NULL on error
*/
char *ldns_pkt2str_fmt(const ldns_output_format *fmt, const ldns_pkt *pkt);
/**
* Converts a private key to the test presentation fmt and
* returns that as a char *.
* Remember to free it.
*
* \param[in] k the key to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_key2str(const ldns_key *k);
/**
* Converts a list of resource records to presentation format
* and returns that as a char *.
* Remember to free it.
*
* \param[in] rr_list the rr_list to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_rr_list2str(const ldns_rr_list *rr_list);
/**
* Converts a list of resource records to presentation format
* and returns that as a char *.
* Remember to free it.
*
* \param[in] fmt how to format the list of resource records
* \param[in] rr_list the rr_list to convert to text
* \return null terminated char * data, or NULL on error
*/
char *ldns_rr_list2str_fmt(
const ldns_output_format *fmt, const ldns_rr_list *rr_list);
/**
* Returns the data in the buffer as a null terminated char * string
* Buffer data must be char * type, and must be freed by the caller
*
* \param[in] buffer buffer containing char * data
* \return null terminated char * data, or NULL on error
*/
char *ldns_buffer2str(ldns_buffer *buffer);
/**
* Prints the data in the rdata field to the given file stream
* (in presentation format)
*
* \param[in] output the file stream to print to
* \param[in] rdf the rdata field to print
* \return void
*/
void ldns_rdf_print(FILE *output, const ldns_rdf *rdf);
/**
* Prints the data in the resource record to the given file stream
* (in presentation format)
*
* \param[in] output the file stream to print to
* \param[in] rr the resource record to print
* \return void
*/
void ldns_rr_print(FILE *output, const ldns_rr *rr);
/**
* Prints the data in the resource record to the given file stream
* (in presentation format)
*
* \param[in] output the file stream to print to
* \param[in] fmt format of the textual representation
* \param[in] rr the resource record to print
* \return void
*/
void ldns_rr_print_fmt(FILE *output,
const ldns_output_format *fmt, const ldns_rr *rr);
/**
* Prints the data in the DNS packet to the given file stream
* (in presentation format)
*
* \param[in] output the file stream to print to
* \param[in] pkt the packet to print
* \return void
*/
void ldns_pkt_print(FILE *output, const ldns_pkt *pkt);
/**
* Prints the data in the DNS packet to the given file stream
* (in presentation format)
*
* \param[in] output the file stream to print to
* \param[in] fmt format of the textual representation
* \param[in] pkt the packet to print
* \return void
*/
void ldns_pkt_print_fmt(FILE *output,
const ldns_output_format *fmt, const ldns_pkt *pkt);
/**
* Converts a rr_list to presentation format and appends it to
* the output buffer
* \param[in] output the buffer to append output to
* \param[in] list the ldns_rr_list to print
* \return ldns_status
*/
ldns_status ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list);
/**
* Converts a rr_list to presentation format and appends it to
* the output buffer
* \param[in] output the buffer to append output to
* \param[in] fmt format of the textual representation
* \param[in] list the ldns_rr_list to print
* \return ldns_status
*/
ldns_status ldns_rr_list2buffer_str_fmt(ldns_buffer *output,
const ldns_output_format *fmt, const ldns_rr_list *list);
/**
* Converts the header of a packet to presentation format and appends it to
* the output buffer
* \param[in] output the buffer to append output to
* \param[in] pkt the packet to convert the header of
* \return ldns_status
*/
ldns_status ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt);
/**
* print a rr_list to output
* \param[in] output the fd to print to
* \param[in] list the rr_list to print
*/
void ldns_rr_list_print(FILE *output, const ldns_rr_list *list);
/**
* print a rr_list to output
* \param[in] output the fd to print to
* \param[in] fmt format of the textual representation
* \param[in] list the rr_list to print
*/
void ldns_rr_list_print_fmt(FILE *output,
const ldns_output_format *fmt, const ldns_rr_list *list);
/**
* Print a resolver (in sofar that is possible) state
* to output.
* \param[in] output the fd to print to
* \param[in] r the resolver to print
*/
void ldns_resolver_print(FILE *output, const ldns_resolver *r);
/**
* Print a resolver (in sofar that is possible) state
* to output.
* \param[in] output the fd to print to
* \param[in] fmt format of the textual representation
* \param[in] r the resolver to print
*/
void ldns_resolver_print_fmt(FILE *output,
const ldns_output_format *fmt, const ldns_resolver *r);
/**
* Print a zone structure * to output. Note the SOA record
* is included in this output
* \param[in] output the fd to print to
* \param[in] z the zone to print
*/
void ldns_zone_print(FILE *output, const ldns_zone *z);
/**
* Print a zone structure * to output. Note the SOA record
* is included in this output
* \param[in] output the fd to print to
* \param[in] fmt format of the textual representation
* \param[in] z the zone to print
*/
void ldns_zone_print_fmt(FILE *output,
const ldns_output_format *fmt, const ldns_zone *z);
/**
* Print the ldns_rdf containing a dname to the buffer
* \param[in] output the buffer to print to
* \param[in] dname the dname to print
* \return ldns_status message if the printing succeeded
*/
ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname);
#ifdef __cplusplus
}
#endif
#endif /* LDNS_HOST2STR_H */
|