Go to the documentation of this file.
8 #include <netinet/in.h>
43 #define FOREACH_STRUCT_IPS(_ptr, _s, _list) \
44 for (_ptr = _list, _s = 0; _ptr != NULL; (_s < _ptr->count - 1) ? (_s++) : (_ptr = _ptr->next, _s = 0))
48 extern int ask_dnsmx(
const char *,
struct ips **) __attribute__ ((nonnull (1,2)));
49 extern int ask_dnsaaaa(
const char *,
struct in6_addr **) __attribute__ ((nonnull (1,2)));
50 extern int ask_dnsa(
const char *,
struct in6_addr **) __attribute__ ((nonnull (1)));
51 extern int ask_dnsname(
const struct in6_addr *,
char **) __attribute__ ((nonnull (1,2)));
56 extern int domainvalid(
const char *
const) __attribute__ ((pure)) __attribute__ ((nonnull (1)));
57 extern int domainvalid_or_inherit(
const char *
const) __attribute__ ((pure)) __attribute__ ((nonnull (1)));
58 extern void sortmx(
struct ips **p) __attribute__ ((nonnull (1)));
59 extern struct ips *
in6_to_ips(
struct in6_addr *a,
unsigned int cnt,
const unsigned int priority) __attribute__ ((nonnull (1)));
61 #ifndef INET_ADDRSTRLEN
62 #define INET_ADDRSTRLEN 16
65 #define DOMAINNAME_MAX 255
83 static inline struct in6_addr
88 ret.s6_addr32[0] = htonl(0);
89 ret.s6_addr32[1] = htonl(0);
90 ret.s6_addr32[2] = htonl(0xffff);
91 ret.s6_addr32[3] = ip4->s_addr;
96 extern int inet_pton_v4mapped(
const char *str,
struct in6_addr *addr) __attribute__ ((nonnull (1,2)));
struct in6_addr * addr
Definition: qdns.h:30
void freeips(struct ips *)
Definition: dns_helpers.c:92
list of IP addresses for a given host
Definition: qdns.h:29
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:249
int ask_dnsa(const char *, struct in6_addr **)
get A record from of the DNS
Definition: qdns.c:217
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:84
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:222
mx_special_priorities
values used as priority in struct ips to reflect special conditions
Definition: qdns.h:13
void sortmx(struct ips **p)
sort MX list by priority
Definition: dns_helpers.c:141
struct ips * next
Definition: qdns.h:34
char * name
Definition: qdns.h:31
int ask_dnsname(const struct in6_addr *, char **)
get host name for IP address
Definition: qdns.c:283
int ask_dnsmx(const char *, struct ips **)
get info out of the DNS
Definition: qdns.c:27
int ask_dnsaaaa(const char *, struct in6_addr **)
get AAAA record from of the DNS
Definition: qdns.c:156
unsigned short count
Definition: qdns.h:33
int domainvalid(const char *const)
Definition: dns_helpers.c:24
unsigned int priority
Definition: qdns.h:32
int domainvalid_or_inherit(const char *const)
check if a string is a valid fqdn or "!inherit"
Definition: dns_helpers.c:78