Qsmtp
0.30dev
|
connector functions for libowfat DNS functions More...
#include <libowfatconn.h>
#include <dns.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <stralloc.h>
#include <string.h>
Macros | |
#define | const_stralloc_from_string(str) |
create a stralloc for the given string More... | |
Functions | |
static int | mangle_ip_ret (struct stralloc *sa, char **out, size_t *len, int r) |
handle the libowfat return codes More... | |
int | dnsip6 (char **out, size_t *len, const char *host) |
query DNS for IPv6 address of host More... | |
int | dnsip4 (char **out, size_t *len, const char *host) |
query DNS for IPv4 address of host More... | |
int | dnsmx (char **out, size_t *len, const char *host) |
query DNS for MX entries More... | |
int | dnstxt (char **out, const char *host) |
query DNS for TXT entries More... | |
int | dnsname (char **out, const struct in6_addr *ip) |
query DNS for name for a given IP address More... | |
connector functions for libowfat DNS functions
#define const_stralloc_from_string | ( | str | ) |
create a stralloc for the given string
Even if the s member of the stralloc is not const, we trust everyone who takes a const stralloc not to change it.
int dnsip4 | ( | char ** | out, |
size_t * | len, | ||
const char * | host | ||
) |
query DNS for IPv4 address of host
out | result string will be stored here, memory is malloced |
len | length of out |
host | host name to look up |
0 | success |
-1 | an error occurred, errno is set |
int dnsip6 | ( | char ** | out, |
size_t * | len, | ||
const char * | host | ||
) |
query DNS for IPv6 address of host
out | result string will be stored here, memory is malloced |
len | length of out |
host | host name to look up |
0 | success |
-1 | an error occurred, errno is set |
int dnsmx | ( | char ** | out, |
size_t * | len, | ||
const char * | host | ||
) |
query DNS for MX entries
out | result string will be stored here, memory is malloced |
len | length of out |
host | host name to look up |
0 | success |
-1 | an error occurred, errno is set |
int dnsname | ( | char ** | out, |
const struct in6_addr * | ip | ||
) |
query DNS for name for a given IP address
out | DNS name of host will be stored here, memory is malloced |
ip | IPv6 address of host to look up |
0 | success |
-1 | an error occurred, errno is set |
int dnstxt | ( | char ** | out, |
const char * | host | ||
) |
query DNS for TXT entries
out | TXT record of host will be stored here, memory is malloced |
host | name of host to look up |
0 | success |
-1 | an error occurred, errno is set |
|
static |
handle the libowfat return codes
sa | the result buffer passed to libowfat function |
out | result string from sa will be stored here on success |
len | length of out |
r | return code from libowfat function |
libowfat functions can allocate memory into sa even if the function returns with an error. Also memory will be allocated even if the function returns 0 and sa.len is 0. Make sure the memory is freed in this cases.