This page documents the API for the asynchronous, stub, DNS resolver used internally by RULI.
The resolver interface operates asynchronously in an event-driven fashion. The application registers a callback function prior to submitting the desired query. Actually, the callback function is an argument for the query. When the answer arrives, the resolver asynchronously dispatches the registered callback passing the proper result.
This resolver API is not tied to SRV records. It's a general-purpose library aimed at querying recursive DNS servers. However, the resource records provided in the server answer are not interpreted; it's up to the application to handle them.
The asynchronous event management interface used here is provided by the excellent Liboop library.
/* Opaque resolver context */ typedef struct { oop_source *res_source; /* event source */ ruli_list_t *res_server_list; /* list of in_addr* */ int res_retry; /* retry limit for each server */ int res_timeout; /* query timeout for each server */ } ruli_res_t; struct ruli_res_query_t; typedef struct ruli_res_query_t ruli_res_query_t; typedef void *(*ruli_res_query_call_t)(ruli_res_query_t *qry, void *arg); /* Opaque query context */ struct ruli_res_query_t { /* * input */ ruli_res_query_call_t q_on_answer; /* query callback function */ void *q_on_answer_arg; /* query callback opaque argument */ char *q_domain; /* query domain (encoded, uncompressed) */ int q_domain_len; /* domain length */ int q_class; /* query class (encoded, uncompressed) */ int q_type; /* query type */ /* * output */ char *answer_buf; int answer_buf_size; int answer_msg_len; int answer_code; ruli_msg_header_t answer_header; };
Input parameters
Input parameters