ARES_PARSE_MX_REPLY(3)
π ARES_PARSE_MX_REPLY π
okay bestie, pull up a chair, because we're digging into ares_parse_mx_reply from the Library Functions Manual and honestly? it's giving "tiny function, big responsibility" π
β¨ NAME β¨
ares_parse_mx_reply β the girl who parses a reply to a DNS query of type MX π
πΈ SYNOPSIS πΈ
#include <ares.h>
int ares_parse_mx_reply(const unsigned char* abuf, int alen,
struct ares_mx_reply** mx_out);
π¦ DESCRIPTION π¦
so basically, ares_parse_mx_reply takes the response to a query of type MX and turns it into a linked list of struct ares_mx_reply β¨ no cap, that's the whole job.
the parameters abuf and alen give you the contents of the response. the way that it works is: the result gets stored in allocated memory, and a pointer to it gets stored into the variable pointed to by mx_out. π
β οΈ bestie, listen: it is the caller's responsibility to free the resultingmx_outstructure when it is no longer needed, usingares_free_data(3). don't be the girl who forgets. that's a leak, and leaks are not cute. π
the structure ares_mx_reply contains the following fields:
struct ares_mx_reply {
struct ares_mx_reply *next;
char *host;
unsigned short priority;
};
next, host, priority β iconic trio, no notes. π«Ά
π RETURN VALUES π
ares_parse_mx_reply can return any of the following values, and you will be checking them:
ARES_SUCCESSβ slay! the response was successfully parsed. βARES_EBADRESPβ the response was malformatted. it's giving chaos, and not the fun kind. πARES_ENODATAβ the response did not contain an answer to the query. she showed up empty-handed fr fr. πARES_ENOMEMβ memory was exhausted. we ran out of room, bestie, it happens to the best of us. π
π AVAILABILITY π
this function was first introduced in c-ares version 1.7.2 β vintage but make it functional, iykyk. β
π SEE ALSO π
and that's the whole page, bestie!! go forth, parse those MX replies, free your data, and be the main character of your own memory management. π
this cutie was served up on 4 August 2009, straight from the Library Functions Manual β ARES_PARSE_MX_REPLY(3), periodt. π
β¨
π¦ 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