ARES_PARSE_URI_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

πŸ’– ares_parse_uri_reply β€” bestie edition πŸ’–

okay so this is ARES_PARSE_URI_REPLY(3), from the Library Functions Manual, and it's literally the glow-up page for one very specific little function. no cap. πŸ¦‹


✨ NAME ✨

ares_parse_uri_reply β€” she parses a reply to a DNS query of type URI. that's the whole job. she's an icon, she's a specialist. πŸ’…


🌸 SYNOPSIS 🌸

#include <ares.h>

int ares_parse_uri_reply(const unsigned char* abuf, int alen,
                         struct ares_uri_reply** uri_out);

πŸŽ€ DESCRIPTION πŸŽ€

so the ares_parse_uri_reply(3) function takes the response to a query of type URI and parses it into a linked list of struct ares_uri_reply. yes, a linked list, we love a little chain of structs. β›“οΈβœ¨

the parameters abuf and alen give the contents of the response β€” that's your raw buffer and its length, hand them over together like a matched set. 🫢

the result gets stored in allocated memory, and a pointer to that memory gets stored into the variable pointed to by uri_out.

⚠️ bestie, listen. it is the caller's responsibility to free the resulting uri_out structure when it is no longer needed, using the function ares_free_data(3). you allocated it, you clean it up. no leaving your mess in the group chat. 😭

the structure ares_uri_reply contains the following fields:

struct ares_uri_reply {
    struct ares_uri_reply       *next;
    unsigned short              weight;
    unsigned short              priority;
    char                        *uri;
    int                         ttl;
};

look at her. next, weight, priority, uri, ttl. five fields, zero notes. main character energy fr fr. πŸ‘‘


🌈 RETURN VALUES 🌈

ares_parse_uri_reply can return any of the following values:

  • ARES_SUCCESS β€” the response was successfully parsed. ate and left no crumbs. πŸ’–
  • ARES_EBADRESP β€” the response was malformatted. it's giving chaos, not data. πŸ’€
  • ARES_ENODATA β€” the response did not contain an answer to the query. she looked. nothing was there. πŸ™ˆ
  • ARES_ENOMEM β€” memory was exhausted. the vibes ran out. 😭

⭐ AVAILABILITY ⭐

this section is here, and it is empty. that's not me skipping it, that's genuinely what's in the original β€” the heading exists and nothing is underneath it. respect the blank space, it's minimalism. 🧚


πŸ¦‹ SEE ALSO πŸ¦‹

(yes you need both. one asks the question, one cleans up after the party. πŸŽ‰)


and that's the page!! brought to you by the 14 August 2020 crew, from ARES_PARSE_URI_REPLY(3), with so much love. go forth and free your uri_out, bestie. πŸ“πŸ’œβœ¨