ARES_PARSE_TXT_REPLY(3)
π ares_parse_txt_reply(3) π
okay bestie, sit down, hydrate, because today we're parsing TXT records and it's genuinely not that deep. this one lives in the Library Functions Manual, and yes it's the ares_parse_txt_reply page, the moment you've all been waiting for. β¨
πΈ NAME πΈ
ares_parse_txt_reply β parse a reply to a DNS query of type TXT. that's it. that's the job. lowkey iconic.
π¦ SYNOPSIS π¦
#include <ares.h>
int ares_parse_txt_reply(const unsigned char* abuf, int alen,
struct ares_txt_reply **txt_out);
int ares_parse_txt_reply_ext(const unsigned char* abuf, int alen,
struct ares_txt_ext **txt_out);
two functions. one include. we love a two-for-one. π
β¨ DESCRIPTION β¨
so ares_parse_txt_reply(3) and ares_parse_txt_reply_ext(3) take the response to a query of type TXT and turn it into a linked list β one element per sub-string, no skimping β of struct ares_txt_reply (or struct ares_txt_ext if you're fancy and called the _ext one).
the parameters abuf and alen give the contents of the response, fr fr. the result gets stored in allocated memory, and a pointer to it gets stored into the variable pointed to by txt_out.
π«Ά important, bestie: it is the caller's responsibility to free the resultingtxt_outstructure when it is no longer needed, usingares_free_data(3). do NOT forget. that's a leak and we don't do leaks in this house. π
the structure ares_txt_reply contains the following fields:
struct ares_txt_reply {
struct ares_txt_reply *next;
unsigned int length;
unsigned char *txt;
};
the structure ares_txt_ext contains the following fields:
struct ares_txt_ext {
struct ares_txt_ext *next;
unsigned int length;
unsigned char *txt;
unsigned char record_start;
};
now the tea on record_start β β in struct ares_txt_ext, the record_start field is 1 if this structure is a start of a TXT record, and 0 if the structure is a continuation of a previous record. the linked list of the struct ares_txt_ext will have at least one item with record_start equal to 1, and may have some items with record_start equal to 0 between them. so like, the 1s are the main characters and the 0s are the supporting cast. π
these sequences of struct ares_txt_ext (starting from the item with record_start equal to 1, and ending right before the record start item) may be treated as either components of a single TXT record or as a multi-parted TXT record, depending on your particular use case. you get to decide. it's giving choose-your-own-adventure. π
π₯ RETURN VALUES π₯
ares_parse_txt_reply (ares_parse_txt_reply_ext) can return any of the following values:
ARES_SUCCESSβ the response was successfully parsed. slay. ate. no notes. πARES_EBADRESPβ the response was malformatted. π something's wrong with it, bestie.ARES_ENODATAβ the response did not contain an answer to the query. it's giving silence. πARES_ENOMEMβ memory was exhausted. the vibes are depleted, we're out of room. π
π AVAILABILITY π
this function was first introduced in c-ares version 1.7.0. a classic. vintage. still hitting. β
π SEE ALSO π
and that's the whole page, bestie!! π«Ά go forth and parse responsibly. this was the ares_parse_txt_reply(3) page from the Library Functions Manual, dated 27 October 2009 β mwah, ily, bye!! πππ¦
π¦ where this page comes from
- alpine 3.22: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.23: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.24: c-ares-doc 1.34.9-r0 Β· MIT
- arch rolling: c-ares 1.34.9-1 Β· MIT
- centos-stream 10: c-ares-devel 1.34.9-1.el10 Β· MIT
- debian trixie: libc-ares-dev 1.34.5-1+deb13u1 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- nixos 26.05: c-ares 1.34.9
- nixpkgs unstable: c-ares 1.34.8
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- ubuntu questing: libc-ares-dev 1.34.5-1
- ubuntu questing: libc-ares-dev 1.34.5-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1 Β· MIT
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.2 Β· MIT
- ubuntu stonking: libc-ares-dev 1.34.8-1 Β· MIT
- π the page's license: MIT
- Copyright 1998 by the Massachusetts Institute of Technology
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms