ARES\_DNS\_MAPPINGS(3) Library Functions Manual ARES\_DNS\_MAPPINGS(3)

# [NAME](#NAME)

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 - Helper functions for converting dns record identifiers to and from their respective types, as well identifying datatypes for various records.

# [SYNOPSIS](#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](#ENUMERATIONS)

**ares\_dns\_datatype\_t -** Data types associated with *ares\_dns\_rr\_key\_t*:

**ARES\_DATATYPE\_INADDR** - IPv4 address as *struct in\_addr \**. Use [*ares\_dns\_rr\_set\_addr(3)*](/man/os/c-ares/ares_dns_rr_set_addr.3) to set and [*ares\_dns\_rr\_get\_addr(3)*](/man/os/c-ares/ares_dns_rr_get_addr.3) to get.  
**ARES\_DATATYPE\_INADDR6** - IPv6 address as *struct ares\_in6\_addr \**. Use [*ares\_dns\_rr\_set\_addr6(3)*](/man/os/c-ares/ares_dns_rr_set_addr6.3) to set and [*ares\_dns\_rr\_get\_addr6(3)*](/man/os/c-ares/ares_dns_rr_get_addr6.3) to get.  
**ARES\_DATATYPE\_U8** - 8bit unsigned integer. Use [*ares\_dns\_rr\_set\_u8(3)*](/man/os/c-ares/ares_dns_rr_set_u8.3) to set and [*ares\_dns\_rr\_get\_u8(3)*](/man/os/c-ares/ares_dns_rr_get_u8.3) to get.  
**ARES\_DATATYPE\_U16** - 16bit unsigned integer. Use [*ares\_dns\_rr\_set\_u16(3)*](/man/os/c-ares/ares_dns_rr_set_u16.3) to set and [*ares\_dns\_rr\_get\_u16(3)*](/man/os/c-ares/ares_dns_rr_get_u16.3) to get.  
**ARES\_DATATYPE\_U32** - 32bit unsigned integer. Use [*ares\_dns\_rr\_set\_u32(3)*](/man/os/c-ares/ares_dns_rr_set_u32.3) to set and [*ares\_dns\_rr\_get\_u32(3)*](/man/os/c-ares/ares_dns_rr_get_u32.3) to get.  
**ARES\_DATATYPE\_NAME** - Null-terminated string of a domain name (series of labels). Use [*ares\_dns\_rr\_set\_str(3)*](/man/os/c-ares/ares_dns_rr_set_str.3) to set and [*ares\_dns\_rr\_get\_str(3)*](/man/os/c-ares/ares_dns_rr_get_str.3) to get.  
**ARES\_DATATYPE\_STR** - Null-terminated string. Use [*ares\_dns\_rr\_set\_str(3)*](/man/os/c-ares/ares_dns_rr_set_str.3) to set and [*ares\_dns\_rr\_get\_str(3)*](/man/os/c-ares/ares_dns_rr_get_str.3) to get.  
**ARES\_DATATYPE\_BIN** - Binary Data. Use [*ares\_dns\_rr\_set\_bin(3)*](/man/os/c-ares/ares_dns_rr_set_bin.3) to set and [*ares\_dns\_rr\_get\_bin(3)*](/man/os/c-ares/ares_dns_rr_get_bin.3) to get.  
**ARES\_DATATYPE\_BINP** - Officially defined as binary data, but likely printable. Guaranteed to have a NULL terminator for convenience (not included in length). Use [*ares\_dns\_rr\_set\_bin(3)*](/man/os/c-ares/ares_dns_rr_set_bin.3) to set and [*ares\_dns\_rr\_get\_bin(3)*](/man/os/c-ares/ares_dns_rr_get_bin.3) to get.  
**ARES\_DATATYPE\_OPT** - Array of options. 16bit identifier, Binary data. Use [*ares\_dns\_rr\_set\_opt(3)*](/man/os/c-ares/ares_dns_rr_set_opt.3) to set and [*ares\_dns\_rr\_get\_opt(3)*](/man/os/c-ares/ares_dns_rr_get_opt.3) to get.  
**ARES\_DATATYPE\_ABINP** - Array of binary data, but likely printable. Guaranteed to have a NULL terminator for convenience (not included in length). Use [*ares\_dns\_rr\_add\_abin(3)*](/man/os/c-ares/ares_dns_rr_add_abin.3) to set and [*ares\_dns\_rr\_get\_abin(3)*](/man/os/c-ares/ares_dns_rr_get_abin.3) to get. Can also use [*ares\_dns\_rr\_set\_bin(3)*](/man/os/c-ares/ares_dns_rr_set_bin.3) and [*ares\_dns\_rr\_get\_bin(3)*](/man/os/c-ares/ares_dns_rr_get_bin.3) if only concatenated strings are desired.

**ares\_dns\_opt\_datatype\_t -** Data types associated with *ARES\_DATATYPE\_OPT* parameters if known as returned by [*ares\_dns\_opt\_get\_datatype(3)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/ares_expand_name.3)

**ares\_svcb\_param\_t -** SVCB (and HTTPS) RR known parameters as returned by [*ares\_dns\_opt\_get\_datatype(3)*](/man/os/c-ares/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)*](/man/os/c-ares/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](#DESCRIPTION)

The [*ares\_dns\_rec\_type\_tostr(3)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/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)*](/man/os/c-ares/ares_dns_opt_get_datatype.3) function is used in association with [*ares\_dns\_rr\_set\_opt(3)*](/man/os/c-ares/ares_dns_rr_set_opt.3) and [*ares\_dns\_rr\_get\_opt(3)*](/man/os/c-ares/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)*](/man/os/c-ares/ares_dns_opt_get_name.3) function is used in association with [*ares\_dns\_rr\_set\_opt(3)*](/man/os/c-ares/ares_dns_rr_set_opt.3) and [*ares\_dns\_rr\_get\_opt(3)*](/man/os/c-ares/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](#RETURN_VALUES)

[*ares\_dns\_rec\_type\_tostr(3)*](/man/os/c-ares/ares_dns_rec_type_tostr.3), [*ares\_dns\_class\_tostr(3)*](/man/os/c-ares/ares_dns_class_tostr.3), [*ares\_dns\_opcode\_tostr(3)*](/man/os/c-ares/ares_dns_opcode_tostr.3), [*ares\_dns\_rr\_key\_tostr(3)*](/man/os/c-ares/ares_dns_rr_key_tostr.3), [*ares\_dns\_section\_tostr(3)*](/man/os/c-ares/ares_dns_section_tostr.3), [*ares\_dns\_rcode\_tostr(3)*](/man/os/c-ares/ares_dns_rcode_tostr.3), and [*ares\_dns\_opt\_get\_name(3)*](/man/os/c-ares/ares_dns_opt_get_name.3) all return a human printable ASCII string, or NULL on error.

[*ares\_dns\_class\_fromstr(3)*](/man/os/c-ares/ares_dns_class_fromstr.3) and [*ares\_dns\_rec\_type\_fromstr(3)*](/man/os/c-ares/ares_dns_rec_type_fromstr.3) return **ARES\_TRUE** on successful conversion, otherwise **ARES\_FALSE.**

[*ares\_dns\_rr\_get\_keys(3)*](/man/os/c-ares/ares_dns_rr_get_keys.3) returns an array of keys or NULL on failure.

[*ares\_dns\_rr\_key\_datatype(3)*](/man/os/c-ares/ares_dns_rr_key_datatype.3), [*ares\_dns\_rr\_key\_to\_rec\_type(3)*](/man/os/c-ares/ares_dns_rr_key_to_rec_type.3), and [*ares\_dns\_opt\_get\_datatype(3)*](/man/os/c-ares/ares_dns_opt_get_datatype.3) return their respective integer values, or 0 on failure.

# [AVAILABILITY](#AVAILABILITY)

These functions were first introduced in c-ares version 1.22.0.

# [SEE ALSO](#SEE_ALSO)

[**ares\_dns\_record**(3)](/man/os/c-ares/ares_dns_record.3), [**ares\_dns\_rr**(3)](/man/os/c-ares/ares_dns_rr.3), [**ares\_init**(3)](/man/os/c-ares/ares_init.3)

12 November 2023

---

Document: ares_opt_param_t(3) from c-ares 1.34.8-r3 (Chainguard OS)
Source: https://github.com/c-ares/c-ares
