ARES_PARSE_AAAA_REPLY(3)

πŸ“¦
version 1.34.9 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay so this is ares_parse_aaaa_reply β€” it parses a reply to a DNS query of type AAAA πŸ’… (that's the IPv6 one bestie, not the IPv4 A record, keep up 🫢). It lives in the manual as ARES_PARSE_AAAA_REPLY(3), third section, library functions, iconic behavior only πŸ’–


🌸 SYNOPSIS 🌸

#include <ares.h>

int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
                          struct hostent **host,
                          struct ares_addr6ttl *addrttls, int *naddrttls);

like… that's the whole signature. look at her. she's perfect πŸŽ€


πŸ’« DESCRIPTION πŸ’«

So ares_parse_aaaa_reply takes the response to a query of type AAAA and parses it into a struct hostent and/or an array of struct ares_addr6ttl. Choose your fighter, or honestly, take both ✨

The parameters abuf and alen give the contents of the response. fr fr, that's the raw bytes and how long they are.

The result is stored in allocated memory and a pointer to it stored into the variable pointed to by host, if host is nonnull. so like, if you passed NULL there, no host struct for you, no biggie, still valid πŸ™ˆ

🚨 bestie LISTEN: it is the caller's responsibility to free the resulting host structure using ares_free_hostent(3) when it is no longer needed. That's you. You are the caller. Free your memory. The way that leaking is not the vibe πŸ’€

Now for the second thing β€” if addrttls and naddrttls are both nonnull, then up to *naddrttls struct ares_addr6ttl records are stored in the array pointed to by addrttls, and then *naddrttls is set to the number of records so stored. Note that the memory for these records is supplied by the caller β€” that's you again, queen, you're providing the buffer πŸ‘‘


πŸ”₯ RETURN VALUES πŸ”₯

ares_parse_aaaa_reply can return any of the following values:

  • ARES_SUCCESS β€” slay πŸ’– the response was successfully parsed.
  • ARES_EBADRESP β€” the response was malformatted 😭 it's giving broken.
  • ARES_ENODATA β€” the response did not contain an answer to the query. so valid packet, just… nothing in it. the audacity honestly 🫠
  • ARES_ENOMEM β€” memory was exhausted πŸ’€ out of RAM, out of luck.

πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page bestie, no notes, go forth and parse your AAAA records πŸ’œ

this one's from the Library Functions Manual, dated 20 Nov 2009 β€” yeah she's vintage, she's a classic, she aged like fine wine πŸ“