ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Functions
higher.h File Reference

Specifies some higher level functions that could be useful for certain applications. More...

Go to the source code of this file.

## Functions
ldns_rr_list * | ldns_get_rr_list_addr_by_name (ldns_resolver *r, ldns_rdf *name, ldns_rr_class c, uint16_t flags)
| Ask the resolver about name and return all address records. More...
ldns_rr_list * | ldns_get_rr_list_name_by_addr (ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags)
| ask the resolver about the address and return the name More...
ldns_rr_list * | ldns_get_rr_list_hosts_frm_fp (FILE *fp)
| wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there More...
ldns_rr_list * | ldns_get_rr_list_hosts_frm_fp_l (FILE *fp, int *line_nr)
| wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there More...
ldns_rr_list * | ldns_get_rr_list_hosts_frm_file (char *filename)
| wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there More...
uint16_t | ldns_getaddrinfo (ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, ldns_rr_list **list)
| This function is a wrapper function for ldns_get_rr_list_name_by_addr and ldns_get_rr_list_addr_by_name. More...
signed char | ldns_nsec_type_check (ldns_rr *nsec, ldns_rr_type t)
| Check if t is enumerated in the nsec type rdata. More...
void | ldns_print_rr_rdf (FILE *fp, ldns_rr *r, int rdfnum,...)
| Print a number of rdf's of the RR. More...

## Detailed Description

Specifies some higher level functions that could be useful for certain applications.

Definition in file higher.h.

## Function Documentation

ldns_rr_list* ldns_get_rr_list_addr_by_name | ( | ldns_resolver * | r,
|  | ldns_rdf * | name,
|  | ldns_rr_class | c,
|  | uint16_t | flags
| ) |  |

Ask the resolver about name and return all address records.

Parameters

  [in] | r | the resolver to use
  [in] | name | the name to look for
  [in] | c | the class to use
  [in] | flags | give some optional flags to the query

Definition at line 24 of file higher.c.

References ldns_get_rr_list_hosts_frm_file(), ldns_pkt_free(), ldns_pkt_rr_list_by_type(), LDNS_RD, ldns_rdf_compare(), ldns_rdf_get_type(), LDNS_RDF_TYPE_DNAME, LDNS_RESOLV_INETANY, ldns_resolver_ip6(), ldns_resolver_query(), ldns_resolver_set_ip6(), ldns_rr_clone(), ldns_rr_list_cat_clone(), ldns_rr_list_clone(), ldns_rr_list_deep_free(), ldns_rr_list_new(), ldns_rr_list_push_rr(), ldns_rr_list_rr(), ldns_rr_list_rr_count(), ldns_rr_owner(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, and LDNS_SECTION_ANSWER.

ldns_rr_list* ldns_get_rr_list_name_by_addr | ( | ldns_resolver * | r,
|  | ldns_rdf * | addr,
|  | ldns_rr_class | c,
|  | uint16_t | flags
| ) |  |

ask the resolver about the address and return the name

Parameters

  [in] | r | the resolver to use
  [in] | addr | the addr to look for
  [in] | c | the class to use
  [in] | flags | give some optional flags to the query

Definition at line 107 of file higher.c.

References ldns_pkt_free(), ldns_pkt_rr_list_by_type(), LDNS_RD, ldns_rdf_address_reverse(), ldns_rdf_deep_free(), ldns_rdf_get_type(), LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, ldns_resolver_query(), LDNS_RR_TYPE_PTR, and LDNS_SECTION_ANSWER.

ldns_rr_list* ldns_get_rr_list_hosts_frm_fp | ( | FILE * | fp | ) |

wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there

Parameters

  [in] | fp | the file pointer to use

Returns
  ldns_rr_list * with the names

Definition at line 141 of file higher.c.

References ldns_get_rr_list_hosts_frm_fp_l().

ldns_rr_list* ldns_get_rr_list_hosts_frm_fp_l | ( | FILE * | fp,
|  | int * | line_nr
| ) |  |

wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there

Parameters

  [in] | fp | the file pointer to use
  [in] | line_nr | pointer to an integer containing the current line number (for debugging purposes)

Returns
  ldns_rr_list * with the names

Definition at line 147 of file higher.c.

References ldns_bget_token(), ldns_buffer_free(), ldns_buffer_new_frm_data(), ldns_fget_token_l(), LDNS_FREE, LDNS_MALLOC, LDNS_MAX_LINELEN, LDNS_PARSE_NO_NL, ldns_rdf_deep_free(), ldns_rdf_new_frm_str(), LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, ldns_rr_clone(), ldns_rr_free(), ldns_rr_list_deep_free(), ldns_rr_list_free(), ldns_rr_list_new(), ldns_rr_list_push_rr(), ldns_rr_new_frm_str(), ldns_rr_owner(), ldns_rr_rd_count(), LDNS_STATUS_OK, LDNS_XMALLOC, and strlcpy().

ldns_rr_list* ldns_get_rr_list_hosts_frm_file | ( | char * | filename | ) |

wade through fp (a /etc/hosts like file) and return a rr_list containing all the defined hosts in there

Parameters

  [in] | filename | the filename to use (NULL for /etc/hosts)

Returns
  ldns_rr_list * with the names

Definition at line 244 of file higher.c.

References ldns_get_rr_list_hosts_frm_fp(), and LDNS_RESOLV_HOSTS.

uint16_t ldns_getaddrinfo | ( | ldns_resolver * | res,
|  | ldns_rdf * | node,
|  | ldns_rr_class | c,
|  | ldns_rr_list ** | list
| ) |  |

This function is a wrapper function for ldns_get_rr_list_name_by_addr and ldns_get_rr_list_addr_by_name.

It's name is from the getaddrinfo() library call. It tries to mimic that call, but without the lowlevel stuff.

Parameters

  [in] | res | The resolver. If this value is NULL then a resolver will be created by ldns_getaddrinfo.
  [in] | node | the name or ip address to look up
  [in] | c | the class to look in
  [out] | list | put the found RR's in this list

Returns
  the number of RR found.

Definition at line 265 of file higher.c.

References ldns_get_rr_list_addr_by_name(), ldns_get_rr_list_name_by_addr(), ldns_rdf_get_type(), LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, LDNS_RDF_TYPE_DNAME, ldns_resolver_deep_free(), ldns_resolver_new_frm_file(), ldns_rr_list_rr_count(), and LDNS_STATUS_OK.

signed char ldns_nsec_type_check | ( | ldns_rr * | nsec,
|  | ldns_rr_type | t
| ) |  |

Check if t is enumerated in the nsec type rdata.

Parameters

  [in] | nsec | the NSEC Record to look in
  [in] | t | the type to check for

Returns
  true when t is found, otherwise return false

Definition at line 305 of file higher.c.

References ldns_nsec_bitmap_covers_type(), ldns_rr_get_type(), ldns_rr_rd_count(), ldns_rr_rdf(), LDNS_RR_TYPE_NSEC, and LDNS_RR_TYPE_NSEC3.

void ldns_print_rr_rdf | ( | FILE * | fp,
|  | ldns_rr * | r,
|  | int | rdfnum,
|  |  | ...
| ) |  |

Print a number of rdf's of the RR.

The rdfnum-list must be ended by -1, otherwise unpredictable things might happen. rdfs may be printed multiple times

Parameters

  [in] | fp | FILE * to write to
  [in] | r | RR to write
  [in] | rdfnum | a list of rdf to print.

Definition at line 325 of file higher.c.

References ldns_rdf_print(), and ldns_rr_rdf().