clone_ns(), clone_ns_list(), free_name_server(), free_name_servers() - manage name server lists
print_response() - display answers returned from the name server
#include <resolver.h>
  int query_send(const char    *name,
            const u_int16_t     type,
            const u_int16_t     class,
            struct name_server  *nslist,
            int                 edns0_size,
            int                 *trans_id);
  int response_recv(int         *trans_id,
            fd_set              *pending_desc,
            struct timeval      *closest_event,
            struct name_server  **respondent,
            u_char              **response,
            size_t              *response_length);
  int get(const char          *name_n,
          const u_int16_t     type_h,
          const u_int16_t     class_h,
          struct name_server  *nslist,
          int                 edns0_size,
          struct name_server  **respondent,
          u_char              **response,
          size_t              *response_length);
int clone_ns(struct name_server **cloned_ns, struct name_server *ns);
  int clone_ns_list(struct name_server **ns_list,
                    struct name_server *orig_ns_list);
void free_name_server(struct name_server **ns);
void free_name_servers(struct name_server **ns);
void print_response(u_char *response, size_t response_length);
The response_recv() function returns the answers, if available, from the name server that responds for the query identified by trans_id. The response is available in response and the responding name server is returned in respondent. The length of the response in bytes is returned in response_length.
The get() function provides a wrapper around the query_send() and response_recv() functions. After sending a request, it blocks until a response is received from some name server or until the request times out. The libsres library does not automatically follow referrals; responses containing referrals are treated as valid responses.
The memory pointed to by *respondent is internally allocated by the libsres library and must be freed by the invoker using free_name_server(). An entire list of name servers can be freed using free_name_servers(). A copy of the name server can be created using clone_ns() and a copy of a name server list can be made using clone_ns_list().
print_response() provides a convenient way to display answers returned in response by the name server.
The name_server structure is defined in resolver.h as follows:
    struct name_server
    {
        u_int8_t ns_name_n[NS_MAXCDNAME];
        void *ns_tsig;
        u_int32_t ns_security_options;
        u_int32_t ns_status;
        u_long  ns_options;
        int ns_retry;
        int ns_retrans;
        struct name_server *ns_next;
        int ns_number_of_addresses;
        struct sockaddr_storage **ns_address;
    };
res_nametoclass res_nametotype ns_name_ntop ns_name_pton ns_name_unpack ns_parse_ttl p_class p_section p_type
The p_type() function exported from libsres has been augmented such that it recognizes the various DNSSEC type codes such DNSKEY, RRSIG, NSEC, NSEC3 and DLV.
There is limited support for specifying resolver policy; members of the struct name_server are still subject to change.
http://dnssec-tools.sourceforge.net