7 #include <netinet/in.h>
42 #define FOREACH_STRUCT_IPS(_ptr, _s, _list) \
43 for (_ptr = _list, _s = 0; _ptr != NULL; (_s < _ptr->count - 1) ? (_s++) : (_ptr = _ptr->next, _s = 0))
47 extern int ask_dnsmx(
const char *,
struct ips **) __attribute__ ((nonnull (1,2)));
48 extern
int ask_dnsaaaa(const
char *, struct in6_addr **) __attribute__ ((nonnull (1,2)));
49 extern
int ask_dnsa(const
char *, struct in6_addr **) __attribute__ ((nonnull (1)));
50 extern
int ask_dnsname(const struct in6_addr *,
char **) __attribute__ ((nonnull (1,2)));
55 extern
int domainvalid(const
char * const) __attribute__ ((pure)) __attribute__ ((nonnull (1)));
56 extern
void sortmx(struct ips **p) __attribute__ ((nonnull (1)));
57 extern struct ips *
in6_to_ips(struct in6_addr *a,
unsigned int cnt, const
unsigned int priority) __attribute__ ((nonnull (1)));
59 #ifndef INET_ADDRSTRLEN
60 #define INET_ADDRSTRLEN 16
79 static inline struct in6_addr
84 ret.s6_addr32[0] = htonl(0);
85 ret.s6_addr32[1] = htonl(0);
86 ret.s6_addr32[2] = htonl(0xffff);
87 ret.s6_addr32[3] = ip4->s_addr;
92 extern int inet_pton_v4mapped(
const char *str,
struct in6_addr *addr) __attribute__ ((nonnull (1,2)));
list of IP addresses for a given host
Definition: qdns.h:28
struct ips * in6_to_ips(struct in6_addr *a, unsigned int cnt, const unsigned int priority)
convert an array of in6_addr structs to a list of struct ips
Definition: dns_helpers.c:205
struct in6_addr * addr
Definition: qdns.h:29
unsigned short count
Definition: qdns.h:32
dns_errors
error codes returned by the DNS lookup functions
Definition: qdns.h:66
int ask_dnsaaaa(const char *, struct in6_addr **)
get AAAA record from of the DNS
Definition: qdns.c:152
struct ips * next
Definition: qdns.h:33
char * name
Definition: qdns.h:30
int ask_dnsmx(const char *, struct ips **)
get info out of the DNS
Definition: qdns.c:26
int domainvalid(const char *const)
Definition: dns_helpers.c:23
int ask_dnsa(const char *, struct in6_addr **)
get A record from of the DNS
Definition: qdns.c:213
unsigned int priority
Definition: qdns.h:31
int inet_pton_v4mapped(const char *str, struct in6_addr *addr)
read an IPv4 address and convert it to a v4mapped IPv6 address
Definition: dns_helpers.c:234
void freeips(struct ips *)
Definition: dns_helpers.c:75
int ask_dnsname(const struct in6_addr *, char **)
get host name for IP address
Definition: qdns.c:277
mx_special_priorities
values used as priority in struct ips to reflect special conditions
Definition: qdns.h:12
void sortmx(struct ips **p)
sort MX list by priority
Definition: dns_helpers.c:124
static struct in6_addr in_addr_to_v4mapped(const struct in_addr *ip4)
convert an IPv4 address to a v4mapped IPv6 address
Definition: qdns.h:80