getdns_list(3)
β¨ getdns_list β get a value by index from a getdns list β¨
okay bestie, welcome to the getdns_list page of the getdns manual π this is section 3 of the manual, and it's literally all about pulling one single item out of a list by its index. no cap.
π LIBRARY
DNS Resolver library β that's libgetdns, and you link it with -lgetdns. π«Ά
πΈ SYNOPSIS
#include <getdns.h>
getdns_return_t
getdns_list_get_bindata (getdns_list *this_list,
size_t index,
getdns_bindata **answer)
getdns_return_t
getdns_list_get_data_type (getdns_list *this_list,
size_t index,
getdns_data_type *answer)
getdns_return_t
getdns_list_get_dict (getdns_list *this_list,
size_t index,
getdns_dict **answer)
getdns_return_t
getdns_list_get_length (getdns_list *this_list,
size_t *answer)
getdns_return_t
getdns_list_get_list (getdns_list *this_list,
size_t index,
getdns_list **answer)
getdns_return_t
getdns_list_get_int (getdns_list *this_list,
size_t index,
uint32_t *answer)
six whole functions π
and yes they're all getdns_list_get something, because the family that gets together, stays together. iykyk.
π¦ DESCRIPTION
so the getdns_list type is the whole vibe for managing heterogeneous lists β meaning the objects inside it don't all have to be the same type, they can be β¨anythingβ¨ from this roster of data types:
getdns_bindatagetdns_dictgetdns_listuint32_t
okay so here's what the arguments mean, bestie, listen up π
this_listβ the list you're retrieving the object from. your source. your origin story.indexβ the numeric index, and it's 0 based, of the item in the list you'd like copied over toanswer. yes babe, zero-based, the first thing is at0, that's just how it is πanswerβ a copy of the object in the list gets placed inanswer. and listen, this part matters: the caller is responsible for freeing the storage associated with that object by calling the appropriate destroy function. that memory is YOUR child now. you must raise it. you must also release it. π§
not me reminding you again: copy in, your job to free. don't be the person who leaks. π
π₯ RETURN VALUES
when everything goes right, these functions hand you back GETDNS_RETURN_GOOD and you get to feel like the main character. π
but if not? the following error values can come at you:
GETDNS_RETURN_GENERIC_ERRORβ thrown whenthis_listis not a valid list. like, that's not a list bestie, what is that.GETDNS_RETURN_NO_SUCH_LIST_ITEMβ thrown whenindexis out of range. you reached past the end of the list. there was nothing there. πGETDNS_RETURN_WRONG_TYPE_REQUESTEDβ thrown when the requested data type doesn't match the contents of the indexed argument. you asked for a dict and the list was giving... something else entirely. π
π EXAMPLES
TBD
it's giving "we'll fill this in later" and honestly? relatable. π
π«Ά SEE ALSO
go read these next, they're all connected, it's a whole cinematic universe:
libgetdns(3)getdns_address(3)getdns_dict(3)getdns_general(3)getdns_hostname(3)getdns_service(3)
okay that's the page!! π this was getdns 1.7.3, dated December 2015, and it lives in section 3 of the manual. slay, you read the whole thing, i'm so proud of you, go free your memory and hydrate. πβ¨π¦
π¦ where this page comes from
- alpine 3.24: getdns-doc 1.7.3-r0 Β· BSD-3-Clause
- arch rolling: getdns 1.7.3-2 Β· BSD
- epel 10: getdns-devel 1.7.3-9.el10_2 Β· BSD-3-Clause
- epel 9: getdns-devel 1.7.3-1.el9 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 Β· BSD-3-Clause
- nixpkgs unstable: getdns 1.7.3
- ubuntu resolute: libgetdns-dev 1.7.3-3 Β· BSD-3-Clause
- ubuntu stonking: libgetdns-dev 1.7.3-5build1 Β· BSD-3-Clause
- Copyright (c) 2013, NLNet Labs, Verisign, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms