resolve: Domain name resolution functions

## Macros

#define | RESOLVE_OK 0
#define | RESOLVE_NOTFOUND 1
#define | RESOLVE_NOADDR 2
#define | RESOLVE_NSERROR 3
#define | RESOLVE_TEMPFAIL 4
#define | resolve_ipv4name(N, A) resolve_ipv4name_n((N),(A),1)
#define | resolve_error() (__resolve_error)

## Functions

const char * | resolve_ipv4addr (const ipv4addr *addr)
int | resolve_ipv4name_n (const char *name, ipv4addr *addr, int maxaddrs)
int | resolve_calldns (int(*dnsfn)(), struct dns_result *out, const void *param)
int | resolve_qualdns (int(*dnsfn)(struct dns_transmit *, struct dns_result *out, const char *), struct dns_result *out, const char *name)

## Variables

int | __resolve_error

## Detailed Description

## Macro Definition Documentation

## resolve_error

#define resolve_error | ( |  | ) | (__resolve_error)

Look up the last resolve error code.

## resolve_ipv4name

#define resolve_ipv4name | ( |  | N,
|  |  | A
| ) |  | resolve_ipv4name_n((N),(A),1)

Compatibility macro for resolve_ipv4name_n

## RESOLVE_NOADDR

#define RESOLVE_NOADDR 2

Domain name exists, but has no address.

## RESOLVE_NOTFOUND

#define RESOLVE_NOTFOUND 1

Domain name not found.

Referenced by resolve_calldns(), and resolve_qualdns().

## RESOLVE_NSERROR

#define RESOLVE_NSERROR 3

Non-recoverable name server error.

## RESOLVE_OK

#define RESOLVE_OK 0

No error.

## RESOLVE_TEMPFAIL

#define RESOLVE_TEMPFAIL 4

Temporary failure.

Referenced by resolve_calldns(), and resolve_qualdns().

## Function Documentation

## resolve_calldns()

int resolve_calldns | ( | int(*)() | dnsfn,
|  | struct dns_result * | out,
|  | const void * | param
| ) |  |

Call a dns_* function and save an error code if necessary.

References __resolve_error, dns_result::count, RESOLVE_NOTFOUND, and RESOLVE_TEMPFAIL.

Referenced by resolve_ipv4addr().

## resolve_ipv4addr()

const char* resolve_ipv4addr | ( | const ipv4addr * | addr | ) |

Look up the domain name corresponding to an IPv4 address.

References dns_name4(), ipv4_format(), obuf_putf(), outbuf, resolve_calldns(), and dns_result::rr.

## resolve_ipv4name_n()

int resolve_ipv4name_n | ( | const char * | name,
|  | ipv4addr * | addr,
|  | int | maxaddrs
| ) |  |

Look up the IPv4 address(es) corresponding to a domain name.

References dns_result::count, DNS_C_IN, dns_ip4_r(), DNS_T_A, DNS_T_NS, ipv4_format(), obuf_putf(), outbuf, resolve_qualdns(), and dns_result::rr.

## resolve_qualdns()

int resolve_qualdns | ( | int(*)(struct dns_transmit *, struct dns_result *out, const char *) | dnsfn,
|  | struct dns_result * | out,
|  | const char * | name
| ) |  |

Call a dns_* function using `dns_qualify` and save an error code if necessary.

References __resolve_error, dns_result::count, dns_qualify(), RESOLVE_NOTFOUND, RESOLVE_TEMPFAIL, and str_free().

Referenced by resolve_ipv4name_n().

## Variable Documentation

## __resolve_error

int __resolve_error

Saved error code from last dns call.

Referenced by resolve_calldns(), and resolve_qualdns().