ARES_PARSE_PTR_REPLY(3)
β¨ ares_parse_ptr_reply β the PTR parser era β¨
ok so bestie, this is the manual page for ares_parse_ptr_reply, living in section 3 of the Library Functions Manual. she's a libc-ares girlie and she has ONE job and she does it slayfully π
πΈ NAME πΈ
ares_parse_ptr_reply β parse a reply to a DNS query of type PTR into a hostent
π¦ SYNOPSIS π¦
#include <ares.h>
int ares_parse_ptr_reply(const unsigned char *abuf, int alen,
const void *addr, int addrlen,
int family, struct hostent **host);
π DESCRIPTION π
okay so picture this: you sent out a DNS query of type PTR, the response came back, and now somebody has to make sense of it. that somebody is ares_parse_ptr_reply. she takes the response and parses it into a struct hostent. no cap. π«Ά
here's the deets on the parameters:
abufandalenβ these two give the contents of the response. that's the whole raw reply, right there.addr,addrlen, andfamilyβ these specify which address was queried for. and listen, important: they are not used to verify the response. not even a little. they are merely used to fill in the address of thestruct hostent. so don't come for her thinking she's validating anything, because she is not. π
the resulting struct hostent gets stored in allocated memory, and a pointer to it gets stored into the variable pointed to by host.
β οΈ bestie, this is the part you cannot skip: 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're the caller. free your girl or she's leaking in memory forever π
π₯ RETURN VALUES π₯
ares_parse_ptr_reply can return any of the following values:
ARES_SUCCESSβ the response was successfully parsed. we ate. πARES_EBADRESPβ the response was malformatted. it's giving cursed input πARES_ENODATAβ the response did not contain an answer to the query. nothing there. ghosted β¨ARES_ENOMEMβ memory was exhausted. she's tired, your honor π
π SEE ALSO π
and that's the whole page, bestie β this icon was documented back on 25 July 1998, and she comes to you courtesy of the Library Functions Manual. yes she's vintage, yes she still serves. 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