1238104Sdes/** 2238104Sdes * \file higher.h 3238104Sdes * 4238104Sdes * Specifies some higher level functions that could 5238104Sdes * be useful for certain applications 6238104Sdes */ 7238104Sdes 8238104Sdes/* 9238104Sdes * a Net::DNS like library for C 10238104Sdes * 11238104Sdes * (c) NLnet Labs, 2005-2006 12238104Sdes * 13238104Sdes * See the file LICENSE for the license 14238104Sdes */ 15238104Sdes 16238104Sdes#ifndef LDNS_HIGHER_H 17238104Sdes#define LDNS_HIGHER_H 18238104Sdes 19238104Sdes#include <ldns/resolver.h> 20238104Sdes#include <ldns/rdata.h> 21238104Sdes#include <ldns/rr.h> 22238104Sdes#include <ldns/host2str.h> 23238104Sdes#include <ldns/tsig.h> 24238104Sdes 25238104Sdes#ifdef __cplusplus 26238104Sdesextern "C" { 27238104Sdes#endif 28238104Sdes 29238104Sdes/** 30238104Sdes * Ask the resolver about name 31238104Sdes * and return all address records 32238104Sdes * \param[in] r the resolver to use 33238104Sdes * \param[in] name the name to look for 34238104Sdes * \param[in] c the class to use 35238104Sdes * \param[in] flags give some optional flags to the query 36238104Sdes */ 37238104Sdesldns_rr_list *ldns_get_rr_list_addr_by_name(ldns_resolver *r, ldns_rdf *name, ldns_rr_class c, uint16_t flags); 38238104Sdes 39238104Sdes/** 40238104Sdes * ask the resolver about the address 41238104Sdes * and return the name 42238104Sdes * \param[in] r the resolver to use 43238104Sdes * \param[in] addr the addr to look for 44238104Sdes * \param[in] c the class to use 45238104Sdes * \param[in] flags give some optional flags to the query 46238104Sdes */ 47238104Sdesldns_rr_list *ldns_get_rr_list_name_by_addr(ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags); 48238104Sdes 49238104Sdes/** 50238104Sdes * wade through fp (a /etc/hosts like file) 51238104Sdes * and return a rr_list containing all the 52238104Sdes * defined hosts in there 53238104Sdes * \param[in] fp the file pointer to use 54238104Sdes * \return ldns_rr_list * with the names 55238104Sdes */ 56238104Sdesldns_rr_list *ldns_get_rr_list_hosts_frm_fp(FILE *fp); 57238104Sdes 58238104Sdes/** 59238104Sdes * wade through fp (a /etc/hosts like file) 60238104Sdes * and return a rr_list containing all the 61238104Sdes * defined hosts in there 62238104Sdes * \param[in] fp the file pointer to use 63238104Sdes * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) 64238104Sdes * \return ldns_rr_list * with the names 65238104Sdes */ 66238104Sdesldns_rr_list *ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr); 67238104Sdes 68238104Sdes/** 69238104Sdes * wade through fp (a /etc/hosts like file) 70238104Sdes * and return a rr_list containing all the 71238104Sdes * defined hosts in there 72238104Sdes * \param[in] filename the filename to use (NULL for /etc/hosts) 73238104Sdes * \return ldns_rr_list * with the names 74238104Sdes */ 75238104Sdesldns_rr_list *ldns_get_rr_list_hosts_frm_file(char *filename); 76238104Sdes 77238104Sdes/** 78238104Sdes * This function is a wrapper function for ldns_get_rr_list_name_by_addr 79238104Sdes * and ldns_get_rr_list_addr_by_name. It's name is from the getaddrinfo() 80238104Sdes * library call. It tries to mimic that call, but without the lowlevel 81238104Sdes * stuff. 82238104Sdes * \param[in] res The resolver. If this value is NULL then a resolver will 83238104Sdes * be created by ldns_getaddrinfo. 84238104Sdes * \param[in] node the name or ip address to look up 85238104Sdes * \param[in] c the class to look in 86238104Sdes * \param[out] list put the found RR's in this list 87238104Sdes * \return the number of RR found. 88238104Sdes */ 89238104Sdesuint16_t ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, ldns_rr_list **list); 90238104Sdes 91238104Sdes/** 92238104Sdes * Check if t is enumerated in the nsec type rdata 93238104Sdes * \param[in] nsec the NSEC Record to look in 94238104Sdes * \param[in] t the type to check for 95238104Sdes * \return true when t is found, otherwise return false 96238104Sdes */ 97238104Sdesbool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t); 98238104Sdes 99238104Sdes/** 100238104Sdes * Print a number of rdf's of the RR. The rdfnum-list must 101238104Sdes * be ended by -1, otherwise unpredictable things might happen. 102238104Sdes * rdfs may be printed multiple times 103238104Sdes * \param[in] fp FILE * to write to 104238104Sdes * \param[in] r RR to write 105238104Sdes * \param[in] rdfnum a list of rdf to print. 106238104Sdes */ 107238104Sdesvoid ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...); 108238104Sdes 109238104Sdes#ifdef __cplusplus 110238104Sdes} 111238104Sdes#endif 112238104Sdes 113238104Sdes#endif /* LDNS_HIGHER_H */ 114