ARES_CREATE_QUERY(3)
π straight outta the Library Functions Manual, it's your girl ares_create_query(3) π
π NAME π
ares_create_query β compose a single-question DNS query buffer β¨π¦
π«Ά SYNOPSIS π«Ά
#include <ares.h>
int ares_create_query(const char *name,
int dnsclass,
int type,
unsigned short id,
int rd,
unsigned char **buf,
int *buflen,
int max_udp_size)
π DESCRIPTION π
okay bestie, first things first, and I need you to hear me on this one:
This function is deprecated as of c-ares 1.22. Please use ares_dns_record_create(3) instead. No cap. She's retired, she's still here, but she's retired. π
So, ares_create_query(3) composes a DNS query with a single question. Just the one. One question, one query, main character energy only.
The parameter name gives the query name as a NUL-terminated C string of period-separated labels, optionally ending with a period. And listen β periods and backslashes that live inside a label have to be escaped with a backslash. (the page spells it "backlash" and I love that for her, but yeah: backslash π
)
The parameters dnsclass and type give the class and the type of the query, using the values defined in <arpa/nameser.h>. Iconic, classic, we love a header file.
The parameter id gives a 16-bit identifier for the query. Sixteen bits of pure identity, slay.
The parameter rd should be nonzero if recursion is desired, and zero if it's not. That's it. That's the whole vibe check.
The query gets placed in an allocated buffer, a pointer to which will be stored in the variable pointed to by buf, and the length of which will be stored in the variable pointed to by buflen. So you hand her two pointers and she fills them in. π«Ά
It is the caller's responsibility to free this buffer using ares_free_string(3) when it is no longer needed. Not me forgetting to free, couldn't be me, but likeβ¦ don't be that girl. Free your buffer. π§
And finally, the parameter max_udp_size should be nonzero to activate EDNS. Usage of ares_create_query(3) with max_udp_size set to zero is equivalent to using ares_mkquery(3). Same energy, different name tag.
β¨ RETURN VALUES β¨
ares_create_query can return any of the following values, and yes we're listing all of them:
ARES_SUCCESSβ construction of the DNS query succeeded. We ate. πARES_ENOTFOUNDβ the query namenamerefers to a.oniondomain name. See RFC 7686. (she said no onions today π)ARES_EBADNAMEβ the query namenamecould not be encoded as a domain name, either because it contained a zero-length label or because it contained a label of more than 63 characters. Long labels are not the move, bestie.ARES_ENOMEMβ memory was exhausted. π
π AVAILABILITY π
Added in c-ares 1.10.0. A whole era. β
π SEE ALSO π
and that's the whole page, bestie!! π this little love letter was dated 17 Aug 2012, and you just finished reading ARES_CREATE_QUERY(3) β go free your strings and hydrate, 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