diff options
Diffstat (limited to 'src/rexmpp_dns.h')
-rw-r--r-- | src/rexmpp_dns.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/rexmpp_dns.h b/src/rexmpp_dns.h index 9d9f271..3c94e90 100644 --- a/src/rexmpp_dns.h +++ b/src/rexmpp_dns.h @@ -11,6 +11,22 @@ #define REXMPP_DNS_H #include <stdint.h> +#include "config.h" + +#include "rexmpp.h" + +#if defined(USE_UNBOUND) +#include <unbound.h> +struct rexmpp_dns_ctx { + struct ub_ctx *ctx; +}; +#else +struct rexmpp_dns_ctx { + int dummy; +}; +#endif + +typedef struct rexmpp_dns_ctx rexmpp_dns_ctx_t; struct rexmpp_dns_srv { uint16_t priority; @@ -19,6 +35,13 @@ struct rexmpp_dns_srv { char target[256]; }; +struct rexmpp_dns_result { + char **data; + int *len; + char *qname; + int secure; +}; + /** @brief Parses an SRV DNS RR's RDATA. @param[in] in SRV record's RDATA. @@ -29,4 +52,29 @@ struct rexmpp_dns_srv { int rexmpp_parse_srv (char *in, int in_len, struct rexmpp_dns_srv *out); +typedef struct rexmpp_dns_result rexmpp_dns_result_t; + +/* struct rexmpp_dns_result *rexmpp_dns_result_init (int len); */ +void rexmpp_dns_result_free (rexmpp_dns_result_t *result); + +int rexmpp_dns_ctx_init (rexmpp_t *s); +void rexmpp_dns_ctx_cleanup (rexmpp_t *s); +void rexmpp_dns_ctx_deinit (rexmpp_t *s); +int rexmpp_dns_fds (rexmpp_t *s, fd_set *read_fds, fd_set *write_fds); +struct timeval * rexmpp_dns_timeout (rexmpp_t *s, + struct timeval *max_tv, + struct timeval *tv); + +typedef void (*dns_query_cb_t) (rexmpp_t *s, void *ptr, rexmpp_dns_result_t *result); + +int rexmpp_dns_resolve (rexmpp_t *s, + const char *query, + int rrtype, + int rrclass, + void* ptr, + dns_query_cb_t callback); + +int rexmpp_dns_process (rexmpp_t *s, fd_set *read_fds, fd_set *write_fds); + + #endif |