diff options
Diffstat (limited to 'lib/dns.h')
-rw-r--r-- | lib/dns.h | 46 |
1 files changed, 30 insertions, 16 deletions
@@ -33,5 +33,2 @@ typedef enum { -#define MAXMXCOUNT 32 - -#define MXF_MAX 0x01 #define MXF_REUSE 0x02 @@ -80,3 +77,3 @@ struct mxbuf { -void mxbuf_init(struct mxbuf *mxbuf); +void mxbuf_init(struct mxbuf *mxbuf, size_t n); void mxbuf_free(struct mxbuf *mxbuf); @@ -91,3 +88,3 @@ 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); @@ -95,15 +92,28 @@ dns_status dns_resolve_hostname(const char *host, unsigned char *answer, size_t answer_size, - char *ipbuf, size_t ipbsize, - unsigned long *ttl); -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); + 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, + 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); @@ -111,3 +121,7 @@ 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 |