![]() |
wget2 2.3.0
|
Data Structures | |
| struct | cache_entry |
| struct | wget_dns_cache_st |
Functions | |
| int | wget_dns_cache_init (wget_dns_cache **cache) |
| void | wget_dns_cache_free (wget_dns_cache **cache) |
| struct addrinfo * | wget_dns_cache_get (wget_dns_cache *cache, const char *host, uint16_t port) |
| int | wget_dns_cache_add (wget_dns_cache *cache, const char *host, uint16_t port, struct addrinfo **addrinfo) |
DNS cache management functions.
| int wget_dns_cache_init | ( | wget_dns_cache ** | cache | ) |
| [out] | cache | Pointer to return newly allocated and initialized wget_dns_cache instance |
Allocates and initializes a wget_dns_cache instance.
| void wget_dns_cache_free | ( | wget_dns_cache ** | cache | ) |
| [in/out] | cache Pointer to wget_dns_cache instance that will be freed and NULLified. |
Free the resources allocated by wget_dns_cache_init().
| struct addrinfo * wget_dns_cache_get | ( | wget_dns_cache * | cache, |
| const char * | host, | ||
| uint16_t | port ) |
| [in] | cache | A wget_dns_cache instance, created by wget_dns_cache_init(). |
| [in] | host | Hostname to look up |
| [in] | port | Port to look up |
| int wget_dns_cache_add | ( | wget_dns_cache * | cache, |
| const char * | host, | ||
| uint16_t | port, | ||
| struct addrinfo ** | addrinfo ) |
| [in] | cache | A wget_dns_cache instance, created by wget_dns_cache_init(). |
| [in] | host | Hostname part of the key |
| [in] | port | Port part of the key |
| [in/out] | addrinfo Addrinfo structure to cache, returns cached addrinfo |
This functions adds addrinfo to the given DNS cache cache.
If an entry for [host,port] already exists, addrinfo is free'd and replaced by the cached entry. Do not free addrinfo yourself - this will be done when the whole cache is freed.