diff options
Diffstat (limited to 'lib/dns.h')
-rw-r--r-- | lib/dns.h | 42 |
1 files changed, 28 insertions, 14 deletions
@@ -31,9 +31,6 @@ typedef enum { # define MAXPACKET 8192 /* max packet size used internally by BIND */ #endif -#define MAXMXCOUNT 32 - -#define MXF_MAX 0x01 #define MXF_REUSE 0x02 struct mxbuf { @@ -78,7 +75,7 @@ struct mxbuf { #define UPDATE_TTL(m, ttl) do { if ((m) > (ttl)) (m) = (ttl); } while(0) -void mxbuf_init(struct mxbuf *mxbuf); +void mxbuf_init(struct mxbuf *mxbuf, size_t n); void mxbuf_free(struct mxbuf *mxbuf); int dns_str_is_ipv4(const char *addr); @@ -89,25 +86,42 @@ int dns_reverse_ipstr(const char *ipstr, char *revipstr); dns_status dns_resolve_ipstr(const char *ipstr, const char *domain, unsigned char *answer, size_t answer_size, - char *hbuf, size_t hbsize, unsigned long *ttl); + char **hbuf, unsigned long *ttl); dns_status dns_resolve_hostname(const char *host, unsigned char *answer, size_t answer_size, - char *ipbuf, size_t ipbsize, - unsigned long *ttl); + char **ipbuf, unsigned long *ttl); + +struct dns_reply { + size_t count; + size_t max; + + void **base; + size_t last_len; + size_t last_max; +}; + +void dns_reply_free(struct dns_reply *r); + +static inline GACOPYZ_UINT32_T +dns_reply_ip(struct dns_reply const *repl, size_t n) +{ + return *(GACOPYZ_UINT32_T*)repl->base[n]; +} + dns_status a_lookup(const char *host, - GACOPYZ_UINT32_T *ipbuf, size_t ipbsize, size_t *ipcount, - unsigned long *ttl, - unsigned char *answer, size_t answer_size); + struct dns_reply *repl, unsigned long *ttl); dns_status ptr_lookup(struct in_addr ip, - char **names, size_t maxnames, unsigned long *ttl, - unsigned char *answer, size_t answer_size); + struct dns_reply *repl, unsigned long *ttl); dns_status txt_lookup(const char *name, - char **names, size_t maxnames, unsigned long *ttl, - unsigned char *answer, size_t answer_size); + struct dns_reply *repl, unsigned long *ttl); dns_status ptr_validate(const char *ipstr, char ***vnptr, size_t *vcount, unsigned long *pttl); +dns_status spf_lookup(const char *domain, + char ***txtv, size_t *txtc, unsigned long *ttl); + + #endif |