ARES_DNS_MAPPINGS(3)

πŸ“¦
version 1.34.9 Β· 2 versions
  • 1.34.9 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.27.0 Β· ubuntu noble
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸŽ€ 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_fromstr
  • ares_dns_class_tostr
  • ares_dns_datatype_t
  • ares_dns_opcode_tostr
  • ares_dns_opt_datatype_t
  • ares_dns_opt_get_datatype
  • ares_dns_opt_get_name
  • ares_dns_rcode_tostr
  • ares_dns_rec_type_fromstr
  • ares_dns_rr_get_keys
  • ares_dns_rr_key_datatype
  • ares_dns_rr_key_to_rec_type
  • ares_dns_rr_key_tostr
  • ares_dns_section_tostr
  • ares_opt_param_t
  • ares_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_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 use ares_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 use ares_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 in type. 🏷️
  • the ares_dns_class_tostr(3) function outputs a human readable DNS class from its numeric form passed in qclass. πŸŽ“
  • the ares_dns_opcode_tostr(3) function outputs a human readable DNS opcode from its numeric form in opcode. πŸ”€
  • the ares_dns_rr_key_tostr(3) function outputs a human readable DNS Resource Record parameter name from its numeric form in key. πŸ”‘
  • the ares_dns_section_tostr(3) function outputs a human readable DNS message section from its numeric form in section. πŸ“š
  • the ares_dns_rcode_tostr(3) function outputs a human readable DNS response code from its numeric form in rcode. πŸ“Ÿ
  • the ares_dns_class_fromstr(3) function outputs the DNS class in numeric from from its string representation in str. the result is stored into the variable pointed to by qclass. πŸ”„
  • the ares_dns_rec_type_fromstr(3) function outputs the DNS record type in numeric from from its string representation in str. the result is stored into the variable pointed to by qtype. πŸ”„
  • the ares_dns_rr_get_keys(3) function retrieves a list of parameters that may be set or retrieved for the provided type. the count of returned keys is stored into the variable pointed to by cnt. πŸ“‹
  • the ares_dns_rr_key_datatype(3) function retrieves the associated datatype for an RR parameter specified by key. 🧬
  • the ares_dns_rr_key_to_rec_type(3) function dereferences the provided RR parameter specified by key to the DNS Record Type it belongs. 🎯
  • the ares_dns_opt_get_datatype(3) function is used in association with ares_dns_rr_set_opt(3) and ares_dns_rr_get_opt(3) to retrieve the datatype of an option record contained within an RR as specified in key if it is known. the raw option record identifier is provided by opt. βš™οΈ
  • the ares_dns_opt_get_name(3) function is used in association with ares_dns_rr_set_opt(3) and ares_dns_rr_get_opt(3) to retrieve human readable parameter name of an option record contained within an RR as specified in key if it is known. the raw option record identifier is provided by opt. 🏷️

πŸ‘‘ RETURN VALUES πŸ‘‘


⭐ 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 πŸ’–βœ¨πŸŽ€