higher.c File Reference

Go to the source code of this file.

Functions

ldns_rr_listldns_get_rr_list_addr_by_name (ldns_resolver *res, const ldns_rdf *name, ldns_rr_class c, uint16_t flags)
 Ask the resolver about name and return all address records. More...
 
ldns_rr_listldns_get_rr_list_name_by_addr (ldns_resolver *res, const ldns_rdf *addr, ldns_rr_class c, uint16_t flags)
 ask the resolver about the address and return the name More...
 
ldns_rr_listldns_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_listldns_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_listldns_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, const ldns_rdf *node, ldns_rr_class c, ldns_rr_list **ret)
 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 (const 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...
 

Function Documentation

◆ ldns_get_rr_list_addr_by_name()

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

◆ ldns_get_rr_list_name_by_addr()

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

ask the resolver about the address and return the name

Parameters
[in]rthe resolver to use
[in]addrthe addr to look for
[in]cthe class to use
[in]flagsgive 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_get_rr_list_hosts_frm_fp()

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]fpthe 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_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]fpthe file pointer to use
[in]line_nrpointer 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_get_rr_list_hosts_frm_file()

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]filenamethe filename to use (NULL for /etc/hosts)
Returns
ldns_rr_list * with the names

Definition at line 247 of file higher.c.

References ldns_get_rr_list_hosts_frm_fp(), and LDNS_RESOLV_HOSTS.

◆ ldns_getaddrinfo()

uint16_t ldns_getaddrinfo ( ldns_resolver res,
const 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]resThe resolver. If this value is NULL then a resolver will be created by ldns_getaddrinfo.
[in]nodethe name or ip address to look up
[in]cthe class to look in
[out]listput the found RR's in this list
Returns
the number of RR found.

Definition at line 268 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.

◆ ldns_nsec_type_check()

signed char ldns_nsec_type_check ( const ldns_rr nsec,
ldns_rr_type  t 
)

Check if t is enumerated in the nsec type rdata.

Parameters
[in]nsecthe NSEC Record to look in
[in]tthe type to check for
Returns
true when t is found, otherwise return false

Definition at line 308 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.

◆ ldns_print_rr_rdf()

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]fpFILE * to write to
[in]rRR to write
[in]rdfnuma list of rdf to print.

Definition at line 328 of file higher.c.

References ldns_rdf_print(), and ldns_rr_rdf().