Scroll to navigation

libwget-dns-caching(3) wget2 libwget-dns-caching(3)

NAME

libwget-dns-caching - DNS caching

SYNOPSIS

Functions


void wget_dns_cache_init (void)
void wget_dns_cache_exit (void)
struct addrinfo * wget_dns_cache_get (const char *host, uint16_t port)
struct addrinfo * wget_dns_cache_add (const char *host, uint16_t port, struct addrinfo *addrinfo)
void wget_dns_cache_free (void)

Detailed Description

DNS cache management functions.

Function Documentation

void wget_dns_cache_init (void)

Initialize the internal mutex needed for thread-safety operations on the cache entry container (hashmap). If you don't use multi-threading, you don't have to call this function.

The initialization is normally automatically during library construction. But some systems doesn't support library constructors, also static linking doesn't do. That's where this function is needed.

void wget_dns_cache_exit (void)

Free the internal mutex allocated by wget_dns_cache_init().

struct addrinfo* wget_dns_cache_get (const char * host, uint16_t port)

Parameters

host Hostname to look up
port Port to look up

Returns

The cached addrinfo structure or NULL if not found

struct addrinfo* wget_dns_cache_add (const char * host, uint16_t port, struct addrinfo * addrinfo)

Parameters

host Hostname part of the key
port Port part of the key
addrinfo Addrinfo structure to cache

Returns

The cached addrinfo structure or NULL if not found

void wget_dns_cache_free (void)

Free the DNS cache.

The DNS cache is kept internally in memory. This function releases all its entries and then removes the cache itself, thus freeing memory.

The cache will be re-generated again when calling wget_tcp_resolve(), if the tcp->caching flag was set.

Author

Generated automatically by Doxygen for wget2 from the source code.

Tue Jan 26 2021 Version 1.99.1