DnsResolver
Description
In-tree resolver state. Created via DnsResolverInit (which reads /etc/hosts and /etc/resolv.conf from disk), torn down via DnsResolverDeinit. No globals, no shared cache; create one per subsystem that needs resolution.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
SysDns.c:15:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
bool ok = DnsResolverInit(&r, a);
if (!ok) {- In
SysDns.c:47:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:65:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:84:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:108:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:133:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:164:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:187:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
SysDns.c:206:
Allocator *a = ALLOCATOR_OF(&alloc);
DnsResolver r;
DnsResolverInit(&r, a);- In
Dns.c:410:
// ---------------------------------------------------------------------------
bool DnsResolverInit(DnsResolver *out, Allocator *alloc) {
if (!out || !alloc) {
return false;- In
Dns.c:426:
}
void DnsResolverDeinit(DnsResolver *self) {
if (!self) {
return;- In
Dns.c:510:
// the response's transaction id.
static bool try_one_query(
DnsResolver *self,
const SocketAddr *ns,
const char *hostname,- In
Dns.c:557:
}
bool DnsResolve_5(DnsResolver *self, const char *hostname, u16 port, SocketKind kind, DnsAddrs *out) {
(void)kind; // protocol byte doesn't affect resolution
if (!self || !hostname || !out) {- In
Dns.c:620:
}
bool DnsResolve_4_vec(DnsResolver *self, const char *spec, SocketKind kind, DnsAddrs *out) {
if (!self || !spec || !out) {
return false;- In
Dns.c:682:
}
bool DnsResolve_4_one(DnsResolver *self, const char *spec, SocketKind kind, SocketAddr *out) {
if (!self || !spec || !out) {
return false;- In
Dns.h:65:
u32 timeout_ms;
u32 retries;
} DnsResolver;
///
- In
Dns.h:77:
/// FAILURE : Returns false on allocator OOM.
///
bool DnsResolverInit(DnsResolver *out, Allocator *alloc);
///
- In
Dns.h:83:
/// resolver.
///
void DnsResolverDeinit(DnsResolver *self);
///
- In
Dns.h:109:
/// transport error, response with no A/AAAA).
///
bool DnsResolve_5(DnsResolver *self, const char *hostname, u16 port, SocketKind kind, DnsAddrs *out);
///
- In
Dns.h:123:
/// FAILURE : Returns false. Logs the failure cause.
///
bool DnsResolve_4_vec(DnsResolver *self, const char *spec, SocketKind kind, DnsAddrs *out);
///
- In
Dns.h:135:
/// FAILURE : Returns false; `out` untouched.
///
bool DnsResolve_4_one(DnsResolver *self, const char *spec, SocketKind kind, SocketAddr *out);
///
- In
Beam.c:210:
}
DnsResolver resolver;
if (!DnsResolverInit(&resolver, alloc)) {
LOG_ERROR("failed to init DNS resolver");- In
Resolve.c:32:
}
DnsResolver r;
if (!DnsResolverInit(&r, alloc)) {
LOG_ERROR("failed to init resolver");
Last updated on