getdns_list(3)

πŸ“¦
version 1.7.3 Β· 2 versions
, in alpine 3.24, arch rolling, epel 10, epel 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

✨ 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_bindata
  • getdns_dict
  • getdns_list
  • uint32_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 to answer. yes babe, zero-based, the first thing is at 0, that's just how it is πŸ™ˆ
  • answer β€” a copy of the object in the list gets placed in answer. 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 when this_list is not a valid list. like, that's not a list bestie, what is that.
  • GETDNS_RETURN_NO_SUCH_LIST_ITEM β€” thrown when index is 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:


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. πŸŽ€βœ¨πŸ¦‹