ARES_DNS_MAPPINGS(3)
π ARES_DNS_MAPPINGS π
okay bestie, welcome to the ARES_DNS_MAPPINGS(3) page β straight outta the Library Functions Manual. this is the group chat where all the lil DNS identifier helper functions live, the ones that translate record identifiers back and forth between their numeric selves and their type selves, plus they clock which datatype each record is serving. it's giving "glue code but make it glam" π
β¨
πΈ NAME πΈ
say hi to the whole squad π:
ares_dns_class_fromstrares_dns_class_tostrares_dns_datatype_tares_dns_opcode_tostrares_dns_opt_datatype_tares_dns_opt_get_datatypeares_dns_opt_get_nameares_dns_rcode_tostrares_dns_rec_type_fromstrares_dns_rr_get_keysares_dns_rr_key_datatypeares_dns_rr_key_to_rec_typeares_dns_rr_key_tostrares_dns_section_tostrares_opt_param_tares_svcb_param_t
and what are they all doing here? helper functions for converting dns record identifiers to and from their respective types, as well as identifying datatypes for various records. iconic. no cap. π¦
β¨ SYNOPSIS β¨
#include <ares.h>
const char *ares_dns_rec_type_tostr(ares_dns_rec_type_t type);
const char *ares_dns_class_tostr(ares_dns_class_t qclass);
const char *ares_dns_opcode_tostr(ares_dns_opcode_t opcode);
const char *ares_dns_rr_key_tostr(ares_dns_rr_key_t key);
const char *ares_dns_section_tostr(ares_dns_section_t section);
const char *ares_dns_rcode_tostr(ares_dns_rcode_t rcode);
ares_bool_t ares_dns_class_fromstr(ares_dns_class_t *qclass, const char *str);
ares_bool_t ares_dns_rec_type_fromstr(ares_dns_rec_type_t *qtype,
const char *str);
const ares_dns_rr_key_t *ares_dns_rr_get_keys(ares_dns_rec_type_t type,
size_t *cnt);
ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key);
ares_dns_rec_type_t ares_dns_rr_key_to_rec_type(ares_dns_rr_key_t key);
ares_dns_opt_datatype_t ares_dns_opt_get_datatype(ares_dns_rr_key_t key,
unsigned short opt);
const char *ares_dns_opt_get_name(ares_dns_rr_key_t key, unsigned short opt);
π ENUMERATIONS π
π ares_dns_datatype_t
the datatypes that vibe with a ares_dns_rr_key_t, fr fr:
ARES_DATATYPE_INADDRβ IPv4 address asstruct in_addr *. useares_dns_rr_set_addr(3)to set andares_dns_rr_get_addr(3)to get. πΈARES_DATATYPE_INADDR6β IPv6 address asstruct ares_in6_addr *. useares_dns_rr_set_addr6(3)to set andares_dns_rr_get_addr6(3)to get. πΈARES_DATATYPE_U8β 8bit unsigned integer. useares_dns_rr_set_u8(3)to set andares_dns_rr_get_u8(3)to get. π’ARES_DATATYPE_U16β 16bit unsigned integer. useares_dns_rr_set_u16(3)to set andares_dns_rr_get_u16(3)to get. π’ARES_DATATYPE_U32β 32bit unsigned integer. useares_dns_rr_set_u32(3)to set andares_dns_rr_get_u32(3)to get. π’ARES_DATATYPE_NAMEβ null-terminated string of a domain name (series of labels). useares_dns_rr_set_str(3)to set andares_dns_rr_get_str(3)to get. π·οΈARES_DATATYPE_STRβ null-terminated string. useares_dns_rr_set_str(3)to set andares_dns_rr_get_str(3)to get. βοΈARES_DATATYPE_BINβ binary data. useares_dns_rr_set_bin(3)to set andares_dns_rr_get_bin(3)to get. π§±ARES_DATATYPE_BINPβ officially defined as binary data, but likely printable. guaranteed to have aNULLterminator for convenience (not included in length). useares_dns_rr_set_bin(3)to set andares_dns_rr_get_bin(3)to get. π¨οΈARES_DATATYPE_OPTβ array of options. 16bit identifier, binary data. useares_dns_rr_set_opt(3)to set andares_dns_rr_get_opt(3)to get. βοΈARES_DATATYPE_ABINPβ array of binary data, but likely printable. guaranteed to have aNULLterminator for convenience (not included in length). useares_dns_rr_add_abin(3)to set andares_dns_rr_get_abin(3)to get. can also useares_dns_rr_set_bin(3)andares_dns_rr_get_bin(3)if only concatenated strings are desired. π¨οΈβ¨
π
ares_dns_opt_datatype_t
datatypes that go with ARES_DATATYPE_OPT parameters β but only if they're known, as returned by ares_dns_opt_get_datatype(3):
ARES_OPT_DATATYPE_NONEβ no value allowed for this parameter π«ARES_OPT_DATATYPE_STR_LISTβ list of strings, each prefixed with a single octet representing the length as defined by RFC 1035. can useares_expand_string(3)until buffer is consumed. πARES_OPT_DATATYPE_U8_LISTβ list of 8bit unsigned integers, concatenated πARES_OPT_DATATYPE_U16β 16bit unsigned integer in network byte order π’ARES_OPT_DATATYPE_U16_LISTβ list of 16bit unsigned integers in network byte order, concatenated. πARES_OPT_DATATYPE_U32β 32bit unsigned integer in network byte order π’ARES_OPT_DATATYPE_U32_LISTβ list of 16bit unsigned integers in network byte order, concatenated. πARES_OPT_DATATYPE_INADDR4_LISTβ list of ipv4 addresses in network byte order, concatenated πARES_OPT_DATATYPE_INADDR6_LISTβ list of ipv6 addresses in network byte order, concatenated πARES_OPT_DATATYPE_BINβ binary data π§±ARES_OPT_DATATYPE_NAMEβ DNS domain name binary format as defined in RFC1035, can useares_expand_name(3)π·οΈ
π¦ ares_svcb_param_t
SVCB (and HTTPS) RR known parameters, as returned by ares_dns_opt_get_datatype(3) with ARES_RR_SVCB_PARAMS or ARES_RR_HTTPS_PARAMS:
ARES_SVCB_PARAM_MANDATORYβ mandatory keys in this RR (RFC 9460 Section 8). Datatype:ARES_OPT_DATATYPE_U16_LISTπARES_SVCB_PARAM_ALPNβ additional supported protocols (RFC 9460 Section 7.1). Datatype:ARES_OPT_DATATYPE_STR_LISTπ‘ARES_SVCB_PARAM_NO_DEFAULT_ALPNβ no support for default protocol (RFC 9460 Section 7.1). Datatype:ARES_OPT_DATATYPE_NONEπ«ARES_SVCB_PARAM_PORTβ port for alternative endpoint (RFC 9460 Section 7.2). Datatype:ARES_OPT_DATATYPE_U16πͺARES_SVCB_PARAM_IPV4HINTβ IPv4 address hints (RFC 9460 Section 7.3). Datatype:ARES_OPT_DATATYPE_INADDR4_LISTπARES_SVCB_PARAM_ECHβ RESERVED (held for Encrypted ClientHello) πARES_SVCB_PARAM_IPV6HINTβ IPv6 address hints (RFC 9460 Section 7.3). Datatype:ARES_OPT_DATATYPE_INADDR6_LISTπ
π ares_opt_param_t
OPT RR known parameters, as returned by ares_dns_opt_get_datatype(3) with ARES_RR_OPT_OPTIONS:
ARES_OPT_PARAM_LLQβ RFC 8764. Apple's DNS Long-Lived Queries Protocol. Datatype:ARES_OPT_DATATYPE_BINπARES_OPT_PARAM_ULβhttp://files.dns-sd.org/draft-sekar-dns-ul.txt: Update Lease. Datatype:ARES_OPT_DATATYPE_U32πARES_OPT_PARAM_NSIDβ RFC 5001. Name Server Identification. Datatype:ARES_OPT_DATATYPE_BINπͺͺARES_OPT_PARAM_DAUβ RFC 6975. DNSSEC Algorithm Understood. Datatype:ARES_OPT_DATATYPE_U8_LISTπARES_OPT_PARAM_DHUβ RFC 6975. DS Hash Understood. Datatype:ARES_OPT_DATATYPE_U8_LISTπARES_OPT_PARAM_N3Uβ RFC 6975. NSEC3 Hash Understood. Datatype:ARES_OPT_DATATYPE_U8_LISTπARES_OPT_PARAM_EDNS_CLIENT_SUBNETβ RFC 7871. Client Subnet. Datatype:ARES_OPT_DATATYPE_BINπARES_OPT_PARAM_EDNS_EXPIREβ RFC 7314. Expire Timer. Datatype:ARES_OPT_DATATYPE_U32β³ARES_OPT_PARAM_COOKIEβ RFC 7873. Client and Server Cookies. Datatype:ARES_OPT_DATATYPE_BINπͺARES_OPT_PARAM_EDNS_TCP_KEEPALIVEβ RFC 7828. TCP Keepalive timeout. Datatype:ARES_OPT_DATATYPE_U16πARES_OPT_PARAM_PADDINGβ RFC 7830. Padding. Datatype:ARES_OPT_DATATYPE_BINποΈARES_OPT_PARAM_CHAINβ RFC 7901. Chain query requests. Datatype:ARES_OPT_DATATYPE_NAMEβοΈARES_OPT_PARAM_EDNS_KEY_TAGβ RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC. Datatype:ARES_OPT_DATATYPE_U16_LISTπARES_OPT_PARAM_EXTENDED_DNS_ERRORβ RFC 8914. Extended ERROR code and message. Datatype:ARES_OPT_DATATYPE_BINπ
π DESCRIPTION π
okay so, function by function, here's the tea β:
- the
ares_dns_rec_type_tostr(3)function outputs a human readable DNS record type from its numeric form passed intype. π·οΈ - the
ares_dns_class_tostr(3)function outputs a human readable DNS class from its numeric form passed inqclass. π - the
ares_dns_opcode_tostr(3)function outputs a human readable DNS opcode from its numeric form inopcode. π€ - the
ares_dns_rr_key_tostr(3)function outputs a human readable DNS Resource Record parameter name from its numeric form inkey. π - the
ares_dns_section_tostr(3)function outputs a human readable DNS message section from its numeric form insection. π - the
ares_dns_rcode_tostr(3)function outputs a human readable DNS response code from its numeric form inrcode. π - the
ares_dns_class_fromstr(3)function outputs the DNS class in numeric from from its string representation instr. the result is stored into the variable pointed to byqclass. π - the
ares_dns_rec_type_fromstr(3)function outputs the DNS record type in numeric from from its string representation instr. the result is stored into the variable pointed to byqtype. π - the
ares_dns_rr_get_keys(3)function retrieves a list of parameters that may be set or retrieved for the providedtype. the count of returned keys is stored into the variable pointed to bycnt. π - the
ares_dns_rr_key_datatype(3)function retrieves the associated datatype for an RR parameter specified bykey. 𧬠- the
ares_dns_rr_key_to_rec_type(3)function dereferences the provided RR parameter specified bykeyto the DNS Record Type it belongs. π― - the
ares_dns_opt_get_datatype(3)function is used in association withares_dns_rr_set_opt(3)andares_dns_rr_get_opt(3)to retrieve the datatype of an option record contained within an RR as specified inkeyif it is known. the raw option record identifier is provided byopt. βοΈ - the
ares_dns_opt_get_name(3)function is used in association withares_dns_rr_set_opt(3)andares_dns_rr_get_opt(3)to retrieve human readable parameter name of an option record contained within an RR as specified inkeyif it is known. the raw option record identifier is provided byopt. π·οΈ
π RETURN VALUES π
ares_dns_rec_type_tostr(3),ares_dns_class_tostr(3),ares_dns_opcode_tostr(3),ares_dns_rr_key_tostr(3),ares_dns_section_tostr(3),ares_dns_rcode_tostr(3), andares_dns_opt_get_name(3)all return a human printable ASCII string, orNULLon error. πares_dns_class_fromstr(3)andares_dns_rec_type_fromstr(3)returnARES_TRUEon successful conversion, otherwiseARES_FALSE. βares_dns_rr_get_keys(3)returns an array of keys orNULLon failure. πares_dns_rr_key_datatype(3),ares_dns_rr_key_to_rec_type(3), andares_dns_opt_get_datatype(3)return their respective integer values, or0on failure. 0οΈβ£
β AVAILABILITY β
these functions were first introduced in c-ares version 1.22.0. a whole era. periodt. π
π₯ SEE ALSO π₯
and that's the whole page bestie, ily π«Ά β this lil masterpiece got written down on 12 November 2023, and it's the ARES_DNS_MAPPINGS(3) page from the Library Functions Manual, so you know exactly where to find it again. go slay some DNS records πβ¨π
π¦ 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 (C) 2023 The c-ares project and its contributors
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms