libwget-dns-caching(3)
π libwget-dns-caching β DNS caching, bestie edition
okay so this is libwget-dns-caching(3), a Library Functions Manual page, and it's literally all about DNS caching. no cap. it's part of the wget2 crew. let's get into it π¦
β¨ NAME β¨
libwget-dns-caching β DNS caching
like. that's it. that's the whole vibe. it caches DNS lookups so you're not out here asking the resolver the same question forty times like a clown π
πΈ SYNOPSIS πΈ
π Data Structures
struct cache_entrystruct 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)
π₯ DETAILED DESCRIPTION π₯
DNS cache management functions. that's the whole thing, bestie β the entire job of this lil library is keeping your DNS answers around so you don't have to go ask again. main character energy fr fr π
β FUNCTION DOCUMENTATION β
π int wget_dns_cache_init (wget_dns_cache ** cache)
Parameters
cacheβ pointer to return newly allocated and initializedwget_dns_cacheinstance
Returns
WGET_E_SUCCESSif OKWGET_E_MEMORYif out-of-memoryWGET_E_INVALIDif the mutex initialization failed
Allocates and initializes a wget_dns_cache instance. it's giving "birth of a cache" πΌβ¨
π void wget_dns_cache_free (wget_dns_cache ** cache)
Parameters
[in/out] cacheβ pointer towget_dns_cacheinstance that will be freed and NULLified
Free the resources allocated by wget_dns_cache_init(). so like, when you're done with your lil cache baby, this is how you let it go. and yes, it NULLifies the pointer too, so no dangling drama afterward. iconic π«Ά
π¦ struct addrinfo * wget_dns_cache_get (wget_dns_cache * cache, const char * host, uint16_t port)
Parameters
cacheβ awget_dns_cacheinstance, created bywget_dns_cache_init().hostβ hostname to look upportβ port to look up
Returns
- the cached
addrinfostructure, orNULLif not found
so you hand it a host + port and it's like "oh bestie I already know this one" and hands you back the cached addrinfo. if it doesn't know? NULL. no hard feelings π
π int wget_dns_cache_add (wget_dns_cache * cache, const char * host, uint16_t port, struct addrinfo ** addrinfo)
Parameters
cacheβ awget_dns_cacheinstance, created bywget_dns_cache_init().hostβ hostname part of the keyportβ port part of the key[in/out] addrinfoβ addrinfo structure to cache, returns cached addrinfo
Returns
WGET_E_SUCCESSon success, else aWGET_E_*error value
this function 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. like, hands off, bestie, that's not yours to yeet π
π AUTHOR π
Generated automatically by Doxygen for wget2 from the source code. so nobody hand-wrote this, it's a robot's lil masterpiece, and honestly? it ate π
okay that's the whole page!! this was libwget-dns-caching(3) from the wget2 girlies, Version 2.3.0 β cache responsibly, free your caches, and never free an addrinfo you didn't own. periodt. πβ¨πΈ
π¦ where this page comes from
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms