19 #ifdef HAVE_SYS_SOCKET_H
20 #include <sys/socket.h>
22 #ifdef HAVE_ARPA_INET_H
23 #include <arpa/inet.h>
31 #ifndef INET_ADDRSTRLEN
32 #define INET_ADDRSTRLEN 16
34 #ifndef INET6_ADDRSTRLEN
35 #define INET6_ADDRSTRLEN 46
137 if (lt && lt->
name) {
142 return ldns_buffer_status(output);
149 if (lt && lt->
name) {
154 return ldns_buffer_status(output);
163 if (lt && lt->
name) {
168 return ldns_buffer_status(output);
177 if (lt && lt->
name) {
183 return ldns_buffer_status(output);
294 for(i = 0; i < len; i++) {
298 c = (
unsigned char) data[src_pos];
299 if(c ==
'.' || c ==
';' ||
300 c ==
'(' || c ==
')' ||
304 }
else if (!(isascii(c) && isgraph(c))) {
319 return ldns_buffer_status(output);
327 return ldns_buffer_status(output);
335 return ldns_buffer_status(output);
343 return ldns_buffer_status(output);
353 memset(&tm, 0,
sizeof(tm));
355 && strftime(date_buf, 15,
"%Y%m%d%H%M%S", &tm)) {
358 return ldns_buffer_status(output);
369 return ldns_buffer_status(output);
381 return ldns_buffer_status(output);
388 uint8_t length = data[0];
392 for (i = 1; i <= length; ++
i) {
393 char ch = (char) data[i];
394 if (isprint((
int)ch) || ch==
'\t') {
395 if (ch==
'\"'||ch==
'\\')
401 (
unsigned)(uint8_t) ch);
405 return ldns_buffer_status(output);
411 size_t size = ldns_b64_ntop_calculate_size(
ldns_rdf_size(rdf));
418 return ldns_buffer_status(output);
439 return ldns_buffer_status(output);
450 return ldns_buffer_status(output);
460 if (descriptor && descriptor->
_name) {
465 return ldns_buffer_status(output);
480 return ldns_buffer_status(output);
494 return ldns_buffer_status(output);
504 return ldns_buffer_status(output);
508 loc_cm_print(
ldns_buffer *output, uint8_t mantissa, uint8_t exponent)
520 for(i=0; i<exponent-2; i++)
531 if (descriptor && descriptor->
_name) {
555 return ldns_buffer_status(output);
591 return ldns_buffer_status(output);
619 uint8_t horizontal_precision;
620 uint8_t vertical_precision;
630 uint32_t equator = (uint32_t) ldns_power(2, 31);
641 if (latitude > equator) {
643 latitude = latitude - equator;
646 latitude = equator - latitude;
648 h = latitude / (1000 * 60 * 60);
649 latitude = latitude % (1000 * 60 * 60);
650 m = latitude / (1000 * 60);
651 latitude = latitude % (1000 * 60);
652 s = (double) latitude / 1000.0;
654 h, m, s, northerness);
656 if (longitude > equator) {
658 longitude = longitude - equator;
661 longitude = equator - longitude;
663 h = longitude / (1000 * 60 * 60);
664 longitude = longitude % (1000 * 60 * 60);
665 m = longitude / (1000 * 60);
666 longitude = longitude % (1000 * 60);
667 s = (double) longitude / (1000.0);
669 h, m, s, easterness);
672 s = ((double) altitude) / 100;
675 if(altitude%100 != 0)
682 loc_cm_print(output, (size & 0xf0) >> 4, size & 0x0f);
685 loc_cm_print(output, (horizontal_precision & 0xf0) >> 4,
686 horizontal_precision & 0x0f);
689 loc_cm_print(output, (vertical_precision & 0xf0) >> 4,
690 vertical_precision & 0x0f);
693 return ldns_buffer_status(output);
723 struct protoent *protocol;
724 char *proto_name =
NULL;
726 struct servent *service;
727 uint16_t current_service;
730 protocol = getprotobynumber((
int) protocol_nr);
731 if (protocol && (protocol->p_name !=
NULL)) {
732 proto_name = protocol->p_name;
738 #ifdef HAVE_ENDPROTOENT
742 for (current_service = 0;
743 current_service <
ldns_rdf_size(rdf) * 7; current_service++) {
745 service = getservbyport((
int) htons(current_service),
747 if (service && service->s_name) {
752 #ifdef HAVE_ENDSERVENT
757 return ldns_buffer_status(output);
766 uint8_t window_block_nr;
767 uint8_t bitmap_length;
775 window_block_nr = data[pos];
776 bitmap_length = data[pos + 1];
779 for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) {
781 type = 256 * (uint16_t) window_block_nr + bit_pos;
784 if (descriptor && descriptor->
_name) {
793 pos += (uint16_t) bitmap_length;
796 return ldns_buffer_status(output);
809 return ldns_buffer_status(output);
811 salt_length = data[0];
813 if (salt_length == 0 || ((
size_t)salt_length)+1 >
ldns_rdf_size(rdf)) {
816 for (salt_pos = 0; salt_pos < salt_length; salt_pos++) {
822 return ldns_buffer_status(output);
831 return ldns_buffer_status(output);
838 uint64_t tsigtime = 0;
845 tsigtime = ldns_read_uint16(data);
847 tsigtime += ldns_read_uint16(data+2);
852 return ldns_buffer_status(output);
859 uint16_t address_family;
869 address_family = ldns_read_uint16(&data[pos]);
870 prefix = data[pos + 2];
880 for (i = 0; i < 4; i++) {
884 if (i < (
unsigned short) adf_length) {
901 for (i = 0; i < 16; i++) {
902 if (i % 2 == 0 && i > 0) {
905 if (i < (
unsigned short) adf_length) {
920 for (i = 1; i < (
unsigned short) (4 + adf_length); i++) {
926 pos += 4 + adf_length;
928 return ldns_buffer_status(output);
935 size_t size = ldns_b64_ntop_calculate_size(
ldns_rdf_size(rdf) - 2);
949 return ldns_buffer_status(output);
960 uint8_t gateway_type;
964 uint8_t *gateway_data;
966 size_t public_key_size;
967 uint8_t *public_key_data;
973 precedence = data[0];
974 gateway_type = data[1];
978 switch (gateway_type) {
1018 public_key_data =
LDNS_XMALLOC(uint8_t, public_key_size);
1019 if(!public_key_data) {
1023 memcpy(public_key_data, &data[offset], public_key_size);
1042 return ldns_buffer_status(output);
1169 size = ldns_b32_ntop_calculate_size(
ldns_rdf_size(rdf) - 1);
1201 return ldns_buffer_status(output);
1248 status = ldns_buffer_status(output);
1255 (
unsigned long) ldns_read_uint32(
1257 status = ldns_buffer_status(output);
1301 }
else if (fmt->
flags
1334 ,
" ;{%s}", babble);
1409 return ldns_buffer_status(output);
1428 return ldns_buffer_status(output);
1487 return ldns_buffer_status(output);
1497 struct timeval time;
1505 if (ldns_buffer_status_ok(output)) {
1566 ";; EDNS: version %u; flags:",
1599 time_tt = (time_t)time.tv_sec;
1601 (
char*)ctime(&time_tt));
1606 return ldns_buffer_status(output);
1637 #if defined(HAVE_SSL) && defined(USE_GOST)
1639 ldns_gost_key2buffer_str(
ldns_buffer *output, EVP_PKEY *
p)
1641 unsigned char* pp =
NULL;
1648 ret = i2d_PrivateKey(p, &pp);
1663 unsigned char *bignum;
1685 if (ldns_buffer_status_ok(output)) {
1701 "Algorithm: %u (RSA)\n",
1706 "Algorithm: %u (RSASHA1)\n",
1711 "Algorithm: %u (RSASHA1_NSEC3)\n",
1717 "Algorithm: %u (RSASHA256)\n",
1722 "Algorithm: %u (RSASHA512)\n",
1727 fprintf(stderr,
"Warning: unknown signature ");
1729 "algorithm type %u\n",
1732 "Algorithm: %u (Unknown)\n",
1741 i = (uint16_t)BN_bn2bin(rsa->n, bignum);
1753 i = (uint16_t)BN_bn2bin(rsa->e, bignum);
1767 i = (uint16_t)BN_bn2bin(rsa->d, bignum);
1784 i = (uint16_t)BN_bn2bin(rsa->p, bignum);
1801 i = (uint16_t)BN_bn2bin(rsa->q, bignum);
1818 i = (uint16_t)BN_bn2bin(rsa->dmp1, bignum);
1835 i = (uint16_t)BN_bn2bin(rsa->dmq1, bignum);
1852 i = (uint16_t)BN_bn2bin(rsa->iqmp, bignum);
1886 i = (uint16_t)BN_bn2bin(dsa->p, bignum);
1898 printf(
"(Not available)\n");
1903 i = (uint16_t)BN_bn2bin(dsa->q, bignum);
1915 printf(
"(Not available)\n");
1920 i = (uint16_t)BN_bn2bin(dsa->g, bignum);
1932 printf(
"(Not available)\n");
1936 if (dsa->priv_key) {
1937 i = (uint16_t)BN_bn2bin(dsa->priv_key, bignum);
1949 printf(
"(Not available)\n");
1954 i = (uint16_t)BN_bn2bin(dsa->pub_key, bignum);
1966 printf(
"(Not available)\n");
1972 #if defined(HAVE_SSL) && defined(USE_GOST)
1975 status = ldns_gost_key2buffer_str(output,
1995 EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->
_key.
key);
1996 const BIGNUM* b = EC_KEY_get0_private_key(ec);
1998 i = (uint16_t)BN_bn2bin(b, bignum);
2023 status = ldns_hmac_key2buffer_str(output, k);
2028 status = ldns_hmac_key2buffer_str(output, k);
2033 status = ldns_hmac_key2buffer_str(output, k);
2039 return ldns_buffer_status(output);
2063 if (*(ldns_buffer_at(buffer, ldns_buffer_position(buffer))) != 0) {
2067 ldns_buffer_write_u8(buffer, (uint8_t)
'\0');
2073 str = strdup((
const char *)ldns_buffer_begin(buffer));
2090 ldns_buffer_write_u8(buffer, 0);
2100 char *result =
NULL;
2117 char *result =
NULL;
2141 char *result =
NULL;
2166 char *result =
NULL;
2183 char *result =
NULL;
2191 tmp_buffer, fmt, list)
2220 fprintf(output,
"%s", str);
2222 fprintf(output,
";Unable to convert rdf to string\n");
2233 fprintf(output,
"%s", str);
2235 fprintf(output,
";Unable to convert rr to string\n");
2252 fprintf(output,
"%s", str);
2254 fprintf(output,
";Unable to convert packet to string\n");
2311 fprintf(output,
"trust anchors (%d listed):\n",
2314 fprintf(output,
"tsig: %s %s\n",
2319 fprintf(output,
"default domain: ");
2321 fprintf(output,
"\n");
2326 fprintf(output,
"\t");
2328 fprintf(output,
"\n");
2334 fprintf(output,
"\t");
2337 switch ((
int)rtt[i]) {
2339 fprintf(output,
" - reachable\n");
2342 fprintf(output,
" - unreachable\n");
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
uint8_t ldns_resolver_ip6(const ldns_resolver *r)
Does the resolver use ip6 or ip4.
implementation of buffers to ease operations
void ldns_resolver_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_resolver *r)
Print a resolver (in sofar that is possible) state to output.
ldns_status ldns_rdf2buffer_str_unknown(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...
enum ldns_enum_cert_algorithm ldns_cert_algorithm
ldns_status ldns_rdf2buffer_str_nsap(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...
bool ldns_resolver_dnsrch(const ldns_resolver *r)
Does the resolver apply search list.
uint16_t ldns_pkt_arcount(const ldns_pkt *packet)
Return the packet's ar count.
ldns_status ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode)
Converts an ldns packet opcode value to its mnemonic, and adds that to the output buffer...
ldns_rr * ldns_zone_soa(const ldns_zone *z)
Return the soa record of a zone.
char * ldns_resolver_tsig_algorithm(const ldns_resolver *r)
Return the tsig algorithm as used by the nameserver.
void * ldns_buffer_export(ldns_buffer *buffer)
Makes the buffer fixed and returns a pointer to the data.
uint8_t ldns_resolver_retry(const ldns_resolver *r)
Get the number of retries.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
#define LDNS_COMMENT_BUBBLEBABBLE
Provide bubblebabble representation for DS RR's as comment.
#define LDNS_COMMENT_KEY_TYPE
Show if a DNSKEY is a ZSK or KSK as comment.
ldns_status ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt)
Converts the header of a packet to presentation format and appends it to the output buffer...
ldns_rr_list * ldns_pkt_question(const ldns_pkt *packet)
Return the packet's question section.
DNS stub resolver structure.
ldns_status ldns_rdf2buffer_str_nsec(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...
char * ldns_bubblebabble(uint8_t *data, size_t len)
Encode data as BubbleBabble.
enum ldns_enum_rr_class ldns_rr_class
int ldns_buffer_printf(ldns_buffer *buffer, const char *format,...)
prints to the buffer, increasing the capacity if required using buffer_reserve(). ...
ldns_status ldns_rdf2buffer_str_ipseckey(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...
ldns_status ldns_rdf2buffer_str_aaaa(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...
char * ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm)
Converts a cert algorithm to its mnemonic and returns that as an allocated null-terminated string...
size_t ldns_resolver_searchlist_count(const ldns_resolver *r)
Return the resolver's searchlist count.
ldns_status ldns_rdf2buffer_str_tsigtime(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...
List or Set of Resource Records.
ldns_status ldns_str2rdf_dname(ldns_rdf **d, const char *str)
convert a dname string into wireformat
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 places it in the given buffer...
ldns_status _status
The current state of the buffer.
bool ldns_rr_is_question(const ldns_rr *rr)
returns the question flag of an rr structure.
bool ldns_pkt_tc(const ldns_pkt *packet)
Read the packet's tc bit.
ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *packet)
Return the packet's respons code.
const ldns_output_format * ldns_output_format_onlykeyids
Standard output format record that annotated only DNSKEY RR's with commenti text. ...
int ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize)
A request for mailbox-related records (MB, MG or MR)
uint16_t ldns_pkt_qdcount(const ldns_pkt *packet)
Return the packet's qd count.
bool ldns_resolver_dnssec(const ldns_resolver *r)
Does the resolver do DNSSEC.
uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet)
return the packet's edns extended rcode
ldns_status ldns_rdf2buffer_str_apl(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...
uint16_t ldns_pkt_id(const ldns_pkt *packet)
Read the packet id.
struct tm * ldns_serial_arithmitics_gmtime_r(int32_t time, time_t now, struct tm *result)
The function interprets time as the number of seconds since epoch with respect to now using serial ar...
#define LDNS_XMALLOC(type, count)
#define LDNS_COMMENT_NULLS
Represent a NULL pointer (in stead of a pointer to a ldns_rr as "; (null)" as opposed to outputting n...
bool ldns_pkt_edns(const ldns_pkt *pkt)
returns true if this packet needs and EDNS rr to be sent.
DSA * ldns_key_dsa_key(const ldns_key *k)
returns the (openssl) DSA struct contained in the key
size_t ldns_rdf_size(const ldns_rdf *rd)
returns the size of the rdf.
ldns_lookup_table ldns_rcodes[]
Response codes.
char * ldns_buffer2str(ldns_buffer *buffer)
Returns a copy of the data in the buffer as a null terminated char * string.
ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *packet)
Read the packet's code.
ldns_status ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k)
Converts the data in the DNS packet to presentation format (as char *) and appends it to the given bu...
bool ldns_pkt_aa(const ldns_pkt *packet)
Read the packet's aa bit.
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
struct ldns_struct_key::@0 _key
Storage pointers for the types of keys supported.
uint32_t ldns_pkt_querytime(const ldns_pkt *packet)
Return the packet's querytime.
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
#define LDNS_FMT_PAD_SOA_SERIAL
#define LDNS_MAX_PACKETLEN
#define LDNS_COMMENT_KEY
Show key id, type and size as comment for DNSKEY RR's.
ldns_status ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf)
Converts the data in the rdata field to presentation format (as char *) and appends it to the given b...
ldns_lookup_table ldns_rr_classes[]
rr types
ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf)
Converts an LDNS_RDF_TYPE_NSEC3_SALT rdata element to string format and adds it to the output buffer...
uint16_t ldns_resolver_port(const ldns_resolver *r)
Get the port the resolver should use.
ldns_rdf ** ldns_resolver_searchlist(const ldns_resolver *r)
What is the searchlist as used by the resolver.
char * ldns_pkt_opcode2str(ldns_pkt_opcode opcode)
Converts a packet opcode to its mnemonic and returns that as an allocated null-terminated string...
char * ldns_rr2str_fmt(const ldns_output_format *fmt, const ldns_rr *rr)
Converts the data in the resource record to presentation format and returns that as a char *...
ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r)
Get the resolver's DNSSEC anchors.
ldns_status ldns_rdf2buffer_str_alg(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...
char * ldns_rr_list2str(const ldns_rr_list *list)
Converts a list of resource records to presentation format and returns that as a char *...
void ldns_resolver_print(FILE *output, const ldns_resolver *r)
Print a resolver (in sofar that is possible) state to output.
bool ldns_resolver_dnssec_cd(const ldns_resolver *r)
Does the resolver set the CD bit.
const ldns_rr_descriptor * ldns_rr_descript(uint16_t type)
returns the resource record descriptor for the given rr type.
bool ldns_resolver_igntc(const ldns_resolver *r)
Does the resolver ignore the TC bit (truncated)
char * ldns_rr_list2str_fmt(const ldns_output_format *fmt, const ldns_rr_list *list)
Converts a list of resource records to presentation format and returns that as a char *...
protocol and port bitmaps
const ldns_output_format * ldns_output_format_default
The default output format record.
#define LDNS_RESOLV_RTT_MIN
void ldns_rdf_free(ldns_rdf *rd)
frees a rdf structure, leaving the data pointer intact.
#define LDNS_COMMENT_KEY_SIZE
Show DNSKEY key size as comment.
size_t ldns_key_hmac_size(const ldns_key *k)
return the hmac key size
void ldns_pkt_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_pkt *pkt)
Prints the data in the DNS packet to the given file stream (in presentation format) ...
const void * data
pointer to data
ldns_status ldns_rdf2buffer_str_class(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...
ldns_status ldns_rr2buffer_str_fmt(ldns_buffer *output, const ldns_output_format *fmt, const ldns_rr *rr)
Converts the data in the resource record to presentation format (as char *) and appends it to the giv...
bool ldns_resolver_defnames(const ldns_resolver *r)
Does the resolver apply default domain name.
Including this file will include all ldns files, and define some lookup tables.
bool ldns_resolver_fallback(const ldns_resolver *r)
Get the truncation fallback status.
marks the start of a zone of authority
uint16_t ldns_pkt_nscount(const ldns_pkt *packet)
Return the packet's ns count.
ldns_status ldns_rdf2buffer_str_b32_ext(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...
General key structure, can contain all types of keys that are used in DNSSEC.
uint8_t * ldns_rdf_data(const ldns_rdf *rd)
returns the data of the rdf.
ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos)
converts the data on the uint8_t bytearray (in wire format) to a DNS dname rdata field.
ldns_status ldns_rdf2buffer_str_b64(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...
ldns_rdf * ldns_nsec3_next_owner(const ldns_rr *nsec3_rr)
Returns the first label of the next ownername in the NSEC3 chain (ie.
void ldns_rr_list_print(FILE *output, const ldns_rr_list *lst)
print a rr_list to output
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
void ldns_zone_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_zone *z)
Print a zone structure * to output.
void ldns_rr_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_rr *rr)
Prints the data in the resource record to the given file stream (in presentation format) ...
enum ldns_enum_pkt_opcode ldns_pkt_opcode
char * ldns_rr2str(const ldns_rr *rr)
Converts the data in the resource record to presentation format and returns that as a char *...
#define LDNS_MAX_DOMAINLEN
Maximum length of a complete dname.
char * ldns_pkt_rcode2str(ldns_pkt_rcode rcode)
Converts a packet rcode to its mnemonic and returns that as an allocated null-terminated string...
ldns_status ldns_rdf2buffer_str_period(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...
char * ldns_buffer_export2str(ldns_buffer *buffer)
Exports and returns the data in the buffer as a null terminated char * string.
uint16_t ldns_pkt_ancount(const ldns_pkt *packet)
Return the packet's an count.
bool ldns_resolver_usevc(const ldns_resolver *r)
Does the resolver use tcp or udp.
bool ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity)
changes the buffer's capacity.
ldns_status ldns_rdf2buffer_str_loc(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...
ldns_status ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode)
Converts an ldns packet rcode value to its mnemonic, and adds that to the output buffer.
size_t ldns_resolver_nameserver_count(const ldns_resolver *r)
How many nameserver are configured in the resolver.
The rbnode_t struct definition.
variable length any type rdata where the length is specified by the first 2 bytes ...
bool ldns_pkt_cd(const ldns_pkt *packet)
Read the packet's cd bit.
None class, dynamic update.
bool ldns_pkt_ra(const ldns_pkt *packet)
Read the packet's ra bit.
uint16_t ldns_rdf2native_int16(const ldns_rdf *rd)
returns the native uint16_t representation from the rdf.
ldns_status ldns_rdf2buffer_str_int16_data(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...
ldns_status ldns_algorithm2buffer_str(ldns_buffer *output, ldns_algorithm algorithm)
Converts an ldns algorithm type to its mnemonic, and adds that to the output buffer.
uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r)
Get the resolver's udp size.
ldns_lookup_table * ldns_lookup_by_id(ldns_lookup_table *table, int id)
ldns_lookup_table ldns_algorithms[]
Taken from RFC 2535, section 7.
#define LDNS_KEY_ZONE_KEY
ldns_status ldns_cert_algorithm2buffer_str(ldns_buffer *output, ldns_cert_algorithm cert_algorithm)
Converts an ldns certificate algorithm type to its mnemonic, and adds that to the output buffer...
struct timeval ldns_pkt_timestamp(const ldns_pkt *packet)
Return the packet's timestamp.
ldns_status ldns_rdf2buffer_str_time(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...
bool ldns_nsec3_optout(const ldns_rr *nsec3_rr)
Returns true if the opt-out flag has been set in the given NSEC3 RR.
uint16_t ldns_calc_keytag(const ldns_rr *key)
calculates a keytag of a key for use in DNSSEC.
ldns_rdf * ldns_pkt_answerfrom(const ldns_pkt *packet)
Return the packet's answerfrom.
enum ldns_enum_pkt_rcode ldns_pkt_rcode
ldns_status ldns_rdf2buffer_str_int16(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...
ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname)
Print the ldns_rdf containing a dname to the buffer.
RSA * ldns_key_rsa_key(const ldns_key *k)
returns the (openssl) RSA struct contained in the key
Contains all information about resource record types.
bool ldns_pkt_rd(const ldns_pkt *packet)
Read the packet's rd bit.
uint8_t ldns_pkt_edns_version(const ldns_pkt *packet)
return the packet's edns version
draft-ietf-dnsext-delegation
bool ldns_resolver_debug(const ldns_resolver *r)
Get the debug status of the resolver.
ldns_rbnode_t * ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key)
Find key in tree.
definition for tree struct
#define LDNS_APL_NEGATION
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd)
returns the type of the rdf.
const ldns_output_format ldns_output_format_bubblebabble_record
ldns_lookup_table ldns_opcodes[]
Operation codes.
void ldns_rdf_print(FILE *output, const ldns_rdf *rdf)
Prints the data in the rdata field to the given file stream (in presentation format) ...
uint32_t ldns_rdf2native_int32(const ldns_rdf *rd)
returns the native uint32_t representation from the rdf.
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
bool ldns_resolver_random(const ldns_resolver *r)
Does the resolver randomize the nameserver before usage.
char * ldns_pkt2str_fmt(const ldns_output_format *fmt, const ldns_pkt *pkt)
Converts the data in the DNS packet to presentation format and returns that as a char *...
ldns_status ldns_rdf2buffer_str_atma(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...
const ldns_output_format ldns_output_format_onlykeyids_record
unsigned char * ldns_key_hmac_key(const ldns_key *k)
return the hmac key data
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 bu...
const ldns_output_format * ldns_output_format_nocomments
Standard output format record that disables commenting in the textual representation of Resource Reco...
A request for mail agent RRs (Obsolete - see MX)
nsec3 base32 string (with length byte on wire
int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize)
enum ldns_enum_status ldns_status
ldns_rdf * ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data)
allocates a new rdf structure and fills it.
ldns_buffer * ldns_buffer_new(size_t capacity)
creates a new buffer with the specified capacity.
ldns_rdf * ldns_rdf_new(ldns_rdf_type type, size_t size, void *data)
allocates a new rdf structure and fills it.
void ldns_zone_print(FILE *output, const ldns_zone *z)
Print a zone structure * to output.
A general purpose lookup table.
ldns_signing_algorithm ldns_key_algorithm(const ldns_key *k)
return the signing alg of the key
uint8_t ldns_resolver_retrans(const ldns_resolver *r)
Get the retransmit interval.
char * ldns_rr_class2str(const ldns_rr_class klass)
Converts an ldns_rr_class value to its string representation, and returns that string.
#define LDNS_FMT_ZEROIZE_RRSIGS
const ldns_output_format ldns_output_format_nocomments_record
size_t ldns_rr_dnskey_key_size(const ldns_rr *key)
get the length of the keydata in bits
ldns_status ldns_rdf2buffer_str_hex(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...
bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount)
ensures BUFFER can contain at least AMOUNT more bytes.
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) ...
ldns_status ldns_pkt2buffer_str_fmt(ldns_buffer *output, const ldns_output_format *fmt, const ldns_pkt *pkt)
Converts the data in the DNS packet to presentation format (as char *) and appends it to the given bu...
size_t * ldns_resolver_rtt(const ldns_resolver *r)
Return the used round trip times for the nameservers.
uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet)
return the packet's edns udp size
ldns_status ldns_rdf2buffer_str_str(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...
bool ldns_resolver_fail(const ldns_resolver *r)
Does the resolver only try the first nameserver.
#define LDNS_COMMENT_RRSIGS
Also comment KEY_ID with RRSIGS.
ldns_status ldns_rdf2buffer_str_wks(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...
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 giv...
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.
ldns_rdf * ldns_pkt_edns_data(const ldns_pkt *packet)
return the packet's edns data
#define LDNS_COMMENT_FLAGS
Show when a NSEC3 RR has the optout flag set as comment.
char * ldns_rr_type2str(const ldns_rr_type type)
Converts an ldns_rr_type value to its string representation, and returns that string.
char * ldns_rdf2str(const ldns_rdf *rdf)
Converts the data in the rdata field to presentation format and returns that as a char *...
char * ldns_pkt_algorithm2str(ldns_algorithm algorithm)
Converts a signing algorithms to its mnemonic and returns that as an allocated null-terminated string...
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z)
Get a list of a zone's content.
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) ...
ldns_rdf ** ldns_resolver_nameservers(const ldns_resolver *r)
Return the configured nameserver ip address.
char * ldns_resolver_tsig_keyname(const ldns_resolver *r)
Return the tsig keyname as used by the nameserver.
ldns_status ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf)
Converts an LDNS_RDF_TYPE_CERT rdata element to string format and adds it to the output buffer...
bool ldns_pkt_qr(const ldns_pkt *packet)
Read the packet's qr bit.
Resource record data field.
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 places it in the given buffer...
int ldns_get_bit(uint8_t bits[], size_t index)
Returns the value of the specified bit The bits are counted from left to right, so bit #0 is the left...
ldns_rr * ldns_pkt_tsig(const ldns_pkt *pkt)
Return the packet's tsig pseudo rr's.
const ldns_output_format * ldns_output_format_bubblebabble
Standard output format record that shows all DNSKEY related information in the comment text...
ldns_lookup_table ldns_cert_algorithms[]
Taken from RFC 2538.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
ldns_status ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf)
Converts an LDNS_RDF_TYPE_INT8 rdata element to string format and adds it to the output buffer...
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
#define LDNS_COMMENT_KEY_ID
Show key id with DNSKEY RR's as comment.
enum ldns_enum_rr_type ldns_rr_type
bool ldns_pkt_ad(const ldns_pkt *packet)
Read the packet's ad bit.
const char * _name
Textual name of the RR type.
#define LDNS_COMMENT_NSEC3_CHAIN
Show the unhashed owner and next owner names for NSEC3 RR's as comment.
ldns_rr_list * ldns_pkt_authority(const ldns_pkt *packet)
Return the packet's authority section.
ldns_status ldns_rr_list2buffer_str_fmt(ldns_buffer *output, const ldns_output_format *fmt, const ldns_rr_list *list)
Converts a rr_list to presentation format and appends it to the output buffer.
size_t ldns_pkt_size(const ldns_pkt *packet)
Return the packet's size in bytes.
bool ldns_resolver_recursive(const ldns_resolver *r)
Is the resolver set to recurse.
#define LDNS_RESOLV_RTT_INF
ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos)
look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label...
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
char * ldns_key2str(const ldns_key *k)
Converts a private key to the test presentation fmt and returns that as a char *. ...
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
ldns_rdf * ldns_b32_ext2dname(const ldns_rdf *rdf)
ldns_rr_list * ldns_pkt_additional(const ldns_pkt *packet)
Return the packet's additional section.
ldns_rr_list * ldns_pkt_answer(const ldns_pkt *packet)
Return the packet's answer section.
ldns_status ldns_rdf2buffer_str_tsig(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...
ldns_status ldns_rdf2buffer_str_int32(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...
char * ldns_pkt2str(const ldns_pkt *pkt)
Converts the data in the DNS packet to presentation format and returns that as a char *...
ldns_status ldns_rdf2buffer_str_type(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...
ldns_rdf * ldns_resolver_domain(const ldns_resolver *r)
What is the default dname to add to relative queries.
enum ldns_enum_algorithm ldns_algorithm
bool ldns_pkt_edns_do(const ldns_pkt *packet)
return the packet's edns do bit
struct timeval ldns_resolver_timeout(const ldns_resolver *r)
What is the timeout on socket connections.
void ldns_rr_list_print_fmt(FILE *output, const ldns_output_format *fmt, const ldns_rr_list *lst)
print a rr_list to output
ldns_status ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf)
Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer...