19 #include <openssl/ssl.h>
20 #include <openssl/sha.h>
169 if(!line || !word || !addr || !rr_str || !list) {
181 if (line[0] ==
'#') {
225 "%s IN AAAA %s", word, addr);
228 "%s IN A %s", word, addr);
256 fp = fopen(filename,
"r");
272 uint16_t names_found;
323 default :
return false;
333 va_start(va_rdf, rdfnum);
335 for (rdf = (int16_t)rdfnum; rdf != -1; rdf = (int16_t)va_arg(va_rdf,
int))
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
void ldns_buffer_new_frm_data(ldns_buffer *buffer, const void *data, size_t size)
creates a buffer with the specified data.
size_t strlcpy(char *dst, const char *src, size_t siz)
signed char ldns_nsec_bitmap_covers_type(const ldns_rdf *bitmap, ldns_rr_type type)
Check if RR type t is enumerated and set in the RR type bitmap rdf.
enum ldns_enum_status ldns_status
ldns_rr_list * ldns_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
void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum,...)
Print a number of rdf's of the RR.
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_na...
signed char ldns_nsec_type_check(const ldns_rr *nsec, ldns_rr_type t)
Check if t is enumerated in the nsec type rdata.
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 the...
ldns_rr_list * ldns_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.
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 the...
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 the...
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)
Including this file will include all ldns files, and define some lookup tables.
void ldns_pkt_free(ldns_pkt *packet)
frees the packet structure and all data that it contains.
ldns_rr_list * ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type t, ldns_pkt_section s)
return all the rr with a specific type from a packet.
ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
returns a token/char from the stream F.
ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit)
returns a token/char from the buffer b.
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd)
returns the type of the rdf.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
ldns_rdf * ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str)
creates a new rdf from a string.
@ LDNS_RDF_TYPE_AAAA
AAAA record.
@ LDNS_RDF_TYPE_DNAME
domain name
@ LDNS_RDF_TYPE_A
A record.
ldns_rdf * ldns_rdf_address_reverse(const ldns_rdf *rd)
reverses an rdf, only actually useful for AAAA and A records.
int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2)
compares two rdf's on their wire formats.
enum ldns_enum_rdf_type ldns_rdf_type
ldns_pkt * ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags)
Send a query to a nameserver.
#define LDNS_RESOLV_INETANY
void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i)
Whether the resolver uses ip6.
uint8_t ldns_resolver_ip6(const ldns_resolver *r)
Does the resolver use ip6 or ip4.
#define LDNS_RESOLV_HOSTS
Default location of the hosts file.
void ldns_resolver_deep_free(ldns_resolver *res)
Frees the allocated space for this resolver and all it's data.
ldns_status ldns_resolver_new_frm_file(ldns_resolver **r, const char *filename)
Configure a resolver by means of a resolv.conf file The file may be NULL in which case there will be ...
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
void ldns_rr_list_deep_free(ldns_rr_list *rr_list)
frees an rr_list structure and all rrs contained therein.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_status ldns_rr_new_frm_str(ldns_rr **n, const char *str, uint32_t default_ttl, const ldns_rdf *origin, ldns_rdf **prev)
creates an rr from a string.
enum ldns_enum_rr_type ldns_rr_type
@ LDNS_RR_TYPE_A
a host address
@ LDNS_RR_TYPE_PTR
a domain name pointer
@ LDNS_RR_TYPE_AAAA
ipv6 address
signed char ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
ldns_rr_list * ldns_rr_list_cat_clone(const ldns_rr_list *left, const ldns_rr_list *right)
concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying).
enum ldns_enum_rr_class ldns_rr_class
ldns_rr_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_rr * ldns_rr_clone(const ldns_rr *rr)
clones a rr and all its data
ldns_rr_list * ldns_rr_list_clone(const ldns_rr_list *rrlist)
clones an rrlist.
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
implementation of buffers to ease operations
Resource record data field.
DNS stub resolver structure.
List or Set of Resource Records.
#define LDNS_MALLOC(type)
Memory management macros.
#define LDNS_XMALLOC(type, count)