mirror of https://github.com/c-ares/c-ares.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
808 lines
34 KiB
808 lines
34 KiB
1 year ago
|
/* MIT License
|
||
|
*
|
||
|
* Copyright (c) 2023 Brad House
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
* of this software and associated documentation files (the "Software"), to deal
|
||
|
* in the Software without restriction, including without limitation the rights
|
||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
* copies of the Software, and to permit persons to whom the Software is
|
||
|
* furnished to do so, subject to the following conditions:
|
||
|
*
|
||
|
* The above copyright notice and this permission notice (including the next
|
||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||
|
* Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
* SOFTWARE.
|
||
|
*
|
||
|
* SPDX-License-Identifier: MIT
|
||
|
*/
|
||
|
#ifndef __ARES_DNS_RECORD_H
|
||
|
#define __ARES_DNS_RECORD_H
|
||
|
|
||
1 year ago
|
/* Include ares.h, not this file directly */
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
1 year ago
|
|
||
|
/*! \addtogroup ares_dns_record DNS Record Handling
|
||
|
*
|
||
|
* This is a set of functions to create and manipulate DNS records.
|
||
|
*
|
||
|
* @{
|
||
|
*/
|
||
|
|
||
|
/*! DNS Record types handled by c-ares. Some record types may only be valid
|
||
|
* on requests (e.g. ARES_REC_TYPE_ANY), and some may only be valid on
|
||
|
* responses */
|
||
|
typedef enum {
|
||
1 year ago
|
ARES_REC_TYPE_A = 1, /*!< Host address. */
|
||
|
ARES_REC_TYPE_NS = 2, /*!< Authoritative server. */
|
||
|
ARES_REC_TYPE_CNAME = 5, /*!< Canonical name. */
|
||
|
ARES_REC_TYPE_SOA = 6, /*!< Start of authority zone. */
|
||
|
ARES_REC_TYPE_PTR = 12, /*!< Domain name pointer. */
|
||
|
ARES_REC_TYPE_HINFO = 13, /*!< Host information. */
|
||
|
ARES_REC_TYPE_MX = 15, /*!< Mail routing information. */
|
||
|
ARES_REC_TYPE_TXT = 16, /*!< Text strings. */
|
||
|
ARES_REC_TYPE_AAAA = 28, /*!< RFC 3596. Ip6 Address. */
|
||
|
ARES_REC_TYPE_SRV = 33, /*!< RFC 2782. Server Selection. */
|
||
|
ARES_REC_TYPE_NAPTR = 35, /*!< RFC 3403. Naming Authority Pointer */
|
||
|
ARES_REC_TYPE_OPT = 41, /*!< RFC 6891. EDNS0 option (meta-RR) */
|
||
|
|
||
|
ARES_REC_TYPE_TLSA = 52, /*!< RFC 6698. DNS-Based Authentication of Named
|
||
|
* Entities (DANE) Transport Layer Security
|
||
|
* (TLS) Protocol: TLSA */
|
||
1 year ago
|
ARES_REC_TYPE_SVCB = 64, /*!< RFC 9460. General Purpose Service Binding */
|
||
|
ARES_REC_TYPE_HTTPS = 65, /*!< RFC 9460. Service Binding type for use with
|
||
|
* HTTPS */
|
||
1 year ago
|
ARES_REC_TYPE_ANY = 255, /*!< Wildcard match. Not response RR. */
|
||
|
ARES_REC_TYPE_URI = 256, /*!< RFC 7553. Uniform Resource Identifier */
|
||
|
ARES_REC_TYPE_CAA = 257, /*!< RFC 6844. Certification Authority
|
||
|
* Authorization. */
|
||
|
ARES_REC_TYPE_RAW_RR = 65536 /*!< Used as an indicator that the RR record
|
||
|
* is not parsed, but provided in wire
|
||
|
* format */
|
||
|
} ares_dns_rec_type_t;
|
||
|
|
||
|
/*! DNS Classes for requests and responses. */
|
||
|
typedef enum {
|
||
|
ARES_CLASS_IN = 1, /*!< Internet */
|
||
|
ARES_CLASS_CHAOS = 3, /*!< CHAOS */
|
||
|
ARES_CLASS_HESOID = 4, /*!< Hesoid [Dyer 87] */
|
||
|
ARES_CLASS_NONE = 254, /*!< RFC 2136 */
|
||
|
ARES_CLASS_ANY = 255 /*!< Any class (requests only) */
|
||
|
} ares_dns_class_t;
|
||
|
|
||
|
/*! DNS RR Section type */
|
||
|
typedef enum {
|
||
|
ARES_SECTION_ANSWER = 1, /*!< Answer section */
|
||
|
ARES_SECTION_AUTHORITY = 2, /*!< Authority section */
|
||
|
ARES_SECTION_ADDITIONAL = 3 /*!< Additional information section */
|
||
|
} ares_dns_section_t;
|
||
|
|
||
|
/*! DNS Header opcodes */
|
||
|
typedef enum {
|
||
|
ARES_OPCODE_QUERY = 0, /*!< Standard query */
|
||
|
ARES_OPCODE_IQUERY = 1, /*!< Inverse query. Obsolete. */
|
||
|
ARES_OPCODE_STATUS = 2, /*!< Name server status query */
|
||
|
ARES_OPCODE_NOTIFY = 4, /*!< Zone change notification (RFC 1996) */
|
||
|
ARES_OPCODE_UPDATE = 5, /*!< Zone update message (RFC2136) */
|
||
|
} ares_dns_opcode_t;
|
||
|
|
||
|
/*! DNS Header flags */
|
||
|
typedef enum {
|
||
|
ARES_FLAG_QR = 1 << 0, /*!< QR. If set, is a response */
|
||
|
ARES_FLAG_AA = 1 << 1, /*!< Authoritative Answer. If set, is authoritative */
|
||
|
ARES_FLAG_TC = 1 << 2, /*!< Truncation. If set, is truncated response */
|
||
|
ARES_FLAG_RD = 1 << 3, /*!< Recursion Desired. If set, recursion is desired */
|
||
|
ARES_FLAG_RA = 1 << 4, /*!< Recursion Available. If set, server supports
|
||
|
* recursion */
|
||
|
ARES_FLAG_AD = 1 << 5, /*!< RFC 2065. Authentic Data bit indicates in a
|
||
|
* response that the data included has been verified by
|
||
|
* the server providing it */
|
||
|
ARES_FLAG_CD = 1 << 6, /*!< RFC 2065. Checking Disabled bit indicates in a
|
||
|
* query that non-verified data is acceptable to the
|
||
|
* resolver sending the query. */
|
||
|
} ares_dns_flags_t;
|
||
|
|
||
|
/*! DNS Response Codes from server */
|
||
|
typedef enum {
|
||
|
ARES_RCODE_NOERROR = 0, /*!< Success */
|
||
|
ARES_RCODE_FORMAT_ERROR = 1, /*!< Format error. The name server was unable
|
||
|
* to interpret the query. */
|
||
|
ARES_RCODE_SERVER_FAILURE = 2, /*!< Server Failure. The name server was
|
||
|
* unable to process this query due to a
|
||
|
* problem with the nameserver */
|
||
|
ARES_RCODE_NAME_ERROR = 3, /*!< Name Error. Meaningful only for
|
||
|
* responses from an authoritative name
|
||
|
* server, this code signifies that the
|
||
|
* domain name referenced in the query does
|
||
|
* not exist. */
|
||
|
ARES_RCODE_NOT_IMPLEMENTED = 4, /*!< Not implemented. The name server does
|
||
|
* not support the requested kind of
|
||
|
* query */
|
||
|
ARES_RCODE_REFUSED = 5, /*!< Refused. The name server refuses to
|
||
|
* perform the speciied operation for
|
||
|
* policy reasons. */
|
||
|
ARES_RCODE_YXDOMAIN = 6, /*!< RFC 2136. Some name that ought not to
|
||
|
* exist, does exist. */
|
||
|
ARES_RCODE_YXRRSET = 7, /*!< RFC 2136. Some RRset that ought to not
|
||
|
* exist, does exist. */
|
||
|
ARES_RCODE_NXRRSET = 8, /*!< RFC 2136. Some RRset that ought to exist,
|
||
|
* does not exist. */
|
||
|
ARES_RCODE_NOTAUTH = 9, /*!< RFC 2136. The server is not authoritative
|
||
|
* for the zone named in the Zone section.
|
||
|
*/
|
||
|
ARES_RCODE_NOTZONE = 10, /*!< RFC 2136. A name used in the Prerequisite
|
||
|
* or Update Section is not within the zone
|
||
|
* denoted by the Zone Section. */
|
||
|
} ares_dns_rcode_t;
|
||
|
|
||
|
/*! Data types used */
|
||
|
typedef enum {
|
||
|
ARES_DATATYPE_INADDR = 1, /*!< struct in_addr * type */
|
||
|
ARES_DATATYPE_INADDR6 = 2, /*!< struct ares_in6_addr * type */
|
||
|
ARES_DATATYPE_U8 = 3, /*!< 8bit unsigned integer */
|
||
|
ARES_DATATYPE_U16 = 4, /*!< 16bit unsigned integer */
|
||
|
ARES_DATATYPE_U32 = 5, /*!< 32bit unsigned integer */
|
||
|
ARES_DATATYPE_STR = 6, /*!< Null-terminated string */
|
||
1 year ago
|
ARES_DATATYPE_BIN = 7, /*!< Binary data */
|
||
|
ARES_DATATYPE_BINP = 8, /*!< Officially defined as binary data, but likely
|
||
|
* printable. Guaranteed to have a NULL
|
||
|
* terminator for convenience (not included in
|
||
|
* length) */
|
||
1 year ago
|
ARES_DATATYPE_OPT = 9, /*!< Array of options. 16bit identifier, BINP
|
||
1 year ago
|
* data. */
|
||
1 year ago
|
} ares_dns_datatype_t;
|
||
|
|
||
|
/*! Keys used for all RR Types. We take the record type and multiply by 100
|
||
|
* to ensure we have a proper offset between keys so we can keep these sorted
|
||
|
*/
|
||
|
typedef enum {
|
||
1 year ago
|
/*! A Record. Address. Datatype: INADDR */
|
||
|
ARES_RR_A_ADDR = (ARES_REC_TYPE_A * 100) + 1,
|
||
1 year ago
|
/*! NS Record. Name. Datatype: STR */
|
||
1 year ago
|
ARES_RR_NS_NSDNAME = (ARES_REC_TYPE_NS * 100) + 1,
|
||
1 year ago
|
/*! CNAME Record. CName. Datatype: STR */
|
||
1 year ago
|
ARES_RR_CNAME_CNAME = (ARES_REC_TYPE_CNAME * 100) + 1,
|
||
1 year ago
|
/*! SOA Record. MNAME, Primary Source of Data. Datatype: STR */
|
||
1 year ago
|
ARES_RR_SOA_MNAME = (ARES_REC_TYPE_SOA * 100) + 1,
|
||
1 year ago
|
/*! SOA Record. RNAME, Mailbox of person responsible. Datatype: STR */
|
||
1 year ago
|
ARES_RR_SOA_RNAME = (ARES_REC_TYPE_SOA * 100) + 2,
|
||
1 year ago
|
/*! SOA Record. Serial, version. Datatype: U32 */
|
||
1 year ago
|
ARES_RR_SOA_SERIAL = (ARES_REC_TYPE_SOA * 100) + 3,
|
||
1 year ago
|
/*! SOA Record. Refresh, zone refersh interval. Datatype: U32 */
|
||
1 year ago
|
ARES_RR_SOA_REFRESH = (ARES_REC_TYPE_SOA * 100) + 4,
|
||
1 year ago
|
/*! SOA Record. Retry, failed refresh retry interval. Datatype: U32 */
|
||
1 year ago
|
ARES_RR_SOA_RETRY = (ARES_REC_TYPE_SOA * 100) + 5,
|
||
1 year ago
|
/*! SOA Record. Expire, upper limit on authority. Datatype: U32 */
|
||
1 year ago
|
ARES_RR_SOA_EXPIRE = (ARES_REC_TYPE_SOA * 100) + 6,
|
||
1 year ago
|
/*! SOA Record. Minimum, RR TTL. Datatype: U32 */
|
||
1 year ago
|
ARES_RR_SOA_MINIMUM = (ARES_REC_TYPE_SOA * 100) + 7,
|
||
1 year ago
|
/*! PTR Record. DNAME, pointer domain. Datatype: STR */
|
||
1 year ago
|
ARES_RR_PTR_DNAME = (ARES_REC_TYPE_PTR * 100) + 1,
|
||
1 year ago
|
/*! HINFO Record. CPU. Datatype: STR */
|
||
1 year ago
|
ARES_RR_HINFO_CPU = (ARES_REC_TYPE_HINFO * 100) + 1,
|
||
1 year ago
|
/*! HINFO Record. OS. Datatype: STR */
|
||
1 year ago
|
ARES_RR_HINFO_OS = (ARES_REC_TYPE_HINFO * 100) + 2,
|
||
1 year ago
|
/*! MX Record. Preference. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_MX_PREFERENCE = (ARES_REC_TYPE_MX * 100) + 1,
|
||
1 year ago
|
/*! MX Record. Exchange, domain. Datatype: STR */
|
||
1 year ago
|
ARES_RR_MX_EXCHANGE = (ARES_REC_TYPE_MX * 100) + 2,
|
||
1 year ago
|
/*! TXT Record. Data. Datatype: BINP */
|
||
1 year ago
|
ARES_RR_TXT_DATA = (ARES_REC_TYPE_TXT * 100) + 1,
|
||
|
/*! AAAA Record. Address. Datatype: INADDR6 */
|
||
|
ARES_RR_AAAA_ADDR = (ARES_REC_TYPE_AAAA * 100) + 1,
|
||
1 year ago
|
/*! SRV Record. Priority. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_SRV_PRIORITY = (ARES_REC_TYPE_SRV * 100) + 2,
|
||
1 year ago
|
/*! SRV Record. Weight. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_SRV_WEIGHT = (ARES_REC_TYPE_SRV * 100) + 3,
|
||
1 year ago
|
/*! SRV Record. Port. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_SRV_PORT = (ARES_REC_TYPE_SRV * 100) + 4,
|
||
1 year ago
|
/*! SRV Record. Target domain. Datatype: STR */
|
||
1 year ago
|
ARES_RR_SRV_TARGET = (ARES_REC_TYPE_SRV * 100) + 5,
|
||
1 year ago
|
/*! NAPTR Record. Order. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_NAPTR_ORDER = (ARES_REC_TYPE_NAPTR * 100) + 1,
|
||
1 year ago
|
/*! NAPTR Record. Preference. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_NAPTR_PREFERENCE = (ARES_REC_TYPE_NAPTR * 100) + 2,
|
||
1 year ago
|
/*! NAPTR Record. Flags. Datatype: STR */
|
||
1 year ago
|
ARES_RR_NAPTR_FLAGS = (ARES_REC_TYPE_NAPTR * 100) + 3,
|
||
1 year ago
|
/*! NAPTR Record. Services. Datatype: STR */
|
||
1 year ago
|
ARES_RR_NAPTR_SERVICES = (ARES_REC_TYPE_NAPTR * 100) + 4,
|
||
1 year ago
|
/*! NAPTR Record. Regexp. Datatype: STR */
|
||
1 year ago
|
ARES_RR_NAPTR_REGEXP = (ARES_REC_TYPE_NAPTR * 100) + 5,
|
||
1 year ago
|
/*! NAPTR Record. Replacement. Datatype: STR */
|
||
1 year ago
|
ARES_RR_NAPTR_REPLACEMENT = (ARES_REC_TYPE_NAPTR * 100) + 6,
|
||
1 year ago
|
/*! OPT Record. UDP Size. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_OPT_UDP_SIZE = (ARES_REC_TYPE_OPT * 100) + 1,
|
||
1 year ago
|
/*! OPT Record. Extended RCode. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_OPT_EXT_RCODE = (ARES_REC_TYPE_OPT * 100) + 2,
|
||
1 year ago
|
/*! OPT Record. Version. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_OPT_VERSION = (ARES_REC_TYPE_OPT * 100) + 3,
|
||
1 year ago
|
/*! OPT Record. Flags. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_OPT_FLAGS = (ARES_REC_TYPE_OPT * 100) + 4,
|
||
1 year ago
|
/*! OPT Record. Options. Datatype: OPT */
|
||
|
ARES_RR_OPT_OPTIONS = (ARES_REC_TYPE_OPT * 100) + 5,
|
||
|
/*! TLSA Record. Certificate Usage. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_TLSA_CERT_USAGE = (ARES_REC_TYPE_TLSA * 100) + 1,
|
||
1 year ago
|
/*! TLSA Record. Selector. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_TLSA_SELECTOR = (ARES_REC_TYPE_TLSA * 100) + 2,
|
||
1 year ago
|
/*! TLSA Record. Matching Type. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_TLSA_MATCH = (ARES_REC_TYPE_TLSA * 100) + 3,
|
||
1 year ago
|
/*! TLSA Record. Certificate Association Data. Datatype: BIN */
|
||
1 year ago
|
ARES_RR_TLSA_DATA = (ARES_REC_TYPE_TLSA * 100) + 4,
|
||
1 year ago
|
/*! SVCB Record. SvcPriority. Datatype: U16 */
|
||
|
ARES_RR_SVCB_PRIORITY = (ARES_REC_TYPE_SVCB * 100) + 1,
|
||
|
/*! SVCB Record. TargetName. Datatype: STR */
|
||
|
ARES_RR_SVCB_TARGET = (ARES_REC_TYPE_SVCB * 100) + 2,
|
||
|
/*! SVCB Record. SvcParams. Datatype: OPT */
|
||
|
ARES_RR_SVCB_PARAMS = (ARES_REC_TYPE_SVCB * 100) + 3,
|
||
|
/*! HTTPS Record. SvcPriority. Datatype: U16 */
|
||
|
ARES_RR_HTTPS_PRIORITY = (ARES_REC_TYPE_HTTPS * 100) + 1,
|
||
|
/*! HTTPS Record. TargetName. Datatype: STR */
|
||
|
ARES_RR_HTTPS_TARGET = (ARES_REC_TYPE_HTTPS * 100) + 2,
|
||
|
/*! HTTPS Record. SvcParams. Datatype: OPT */
|
||
|
ARES_RR_HTTPS_PARAMS = (ARES_REC_TYPE_HTTPS * 100) + 3,
|
||
1 year ago
|
/*! URI Record. Priority. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_URI_PRIORITY = (ARES_REC_TYPE_URI * 100) + 1,
|
||
1 year ago
|
/*! URI Record. Weight. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_URI_WEIGHT = (ARES_REC_TYPE_URI * 100) + 2,
|
||
1 year ago
|
/*! URI Record. Target domain. Datatype: STR */
|
||
1 year ago
|
ARES_RR_URI_TARGET = (ARES_REC_TYPE_URI * 100) + 3,
|
||
1 year ago
|
/*! CAA Record. Critical flag. Datatype: U8 */
|
||
1 year ago
|
ARES_RR_CAA_CRITICAL = (ARES_REC_TYPE_CAA * 100) + 1,
|
||
1 year ago
|
/*! CAA Record. Tag/Property. Datatype: STR */
|
||
1 year ago
|
ARES_RR_CAA_TAG = (ARES_REC_TYPE_CAA * 100) + 2,
|
||
1 year ago
|
/*! CAA Record. Value. Datatype: BINP */
|
||
1 year ago
|
ARES_RR_CAA_VALUE = (ARES_REC_TYPE_CAA * 100) + 3,
|
||
1 year ago
|
/*! RAW Record. RR Type. Datatype: U16 */
|
||
1 year ago
|
ARES_RR_RAW_RR_TYPE = (ARES_REC_TYPE_RAW_RR * 100) + 1,
|
||
1 year ago
|
/*! RAW Record. RR Data. Datatype: BIN */
|
||
1 year ago
|
ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100) + 2,
|
||
1 year ago
|
} ares_dns_rr_key_t;
|
||
|
|
||
1 year ago
|
/*! TLSA Record ARES_RR_TLSA_CERT_USAGE known values */
|
||
|
typedef enum {
|
||
|
/*! Certificate Usage 0. CA Constraint. */
|
||
1 year ago
|
ARES_TLSA_USAGE_CA = 0,
|
||
1 year ago
|
/*! Certificate Usage 1. Service Certificate Constraint. */
|
||
1 year ago
|
ARES_TLSA_USAGE_SERVICE = 1,
|
||
1 year ago
|
/*! Certificate Usage 2. Trust Anchor Assertation. */
|
||
|
ARES_TLSA_USAGE_TRUSTANCHOR = 2,
|
||
|
/*! Certificate Usage 3. Domain-issued certificate. */
|
||
1 year ago
|
ARES_TLSA_USAGE_DOMAIN = 3
|
||
1 year ago
|
} ares_tlsa_usage_t;
|
||
|
|
||
|
/*! TLSA Record ARES_RR_TLSA_SELECTOR known values */
|
||
|
typedef enum {
|
||
|
/*! Full Certificate */
|
||
|
ARES_TLSA_SELECTOR_FULL = 0,
|
||
|
/*! DER-encoded SubjectPublicKeyInfo */
|
||
|
ARES_TLSA_SELECTOR_SUBJPUBKEYINFO = 1
|
||
|
} ares_tlsa_selector_t;
|
||
|
|
||
|
/*! TLSA Record ARES_RR_TLSA_MATCH known values */
|
||
|
typedef enum {
|
||
|
/*! Exact match */
|
||
1 year ago
|
ARES_TLSA_MATCH_EXACT = 0,
|
||
1 year ago
|
/*! Sha256 match */
|
||
|
ARES_TLSA_MATCH_SHA256 = 1,
|
||
|
/*! Sha512 match */
|
||
|
ARES_TLSA_MATCH_SHA512 = 2
|
||
|
} ares_tlsa_match_t;
|
||
|
|
||
1 year ago
|
/*! SVCB (and HTTPS) known parameters */
|
||
|
typedef enum {
|
||
|
/*! Mandatory keys in this RR (RFC 9460 Section 8) */
|
||
1 year ago
|
ARES_SVCB_PARAM_MANDATORY = 0,
|
||
1 year ago
|
/*! Additional supported protocols (RFC 9460 Section 7.1) */
|
||
1 year ago
|
ARES_SVCB_PARAM_ALPN = 1,
|
||
1 year ago
|
/*! No support for default protocol (RFC 9460 Section 7.1) */
|
||
|
ARES_SVCB_PARAM_NO_DEFAULT_ALPN = 2,
|
||
|
/*! Port for alternative endpoint (RFC 9460 Section 7.2) */
|
||
1 year ago
|
ARES_SVCB_PARAM_PORT = 3,
|
||
1 year ago
|
/*! IPv4 address hints (RFC 9460 Section 7.3) */
|
||
1 year ago
|
ARES_SVCB_PARAM_IPV4HINT = 4,
|
||
1 year ago
|
/*! RESERVED (held for Encrypted ClientHello) */
|
||
1 year ago
|
ARES_SVCB_PARAM_ECH = 5,
|
||
1 year ago
|
/*! IPv6 address hints (RFC 9460 Section 7.3) */
|
||
1 year ago
|
ARES_SVCB_PARAM_IPV6HINT = 6
|
||
1 year ago
|
} ares_svcb_param_t;
|
||
|
|
||
1 year ago
|
/*! String representation of DNS Record Type
|
||
|
*
|
||
|
* \param[in] type DNS Record Type
|
||
|
* \return string
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_rec_type_tostr(ares_dns_rec_type_t type);
|
||
1 year ago
|
|
||
|
/*! String representation of DNS Class
|
||
|
*
|
||
|
* \param[in] qclass DNS Class
|
||
|
* \return string
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_class_tostr(ares_dns_class_t qclass);
|
||
1 year ago
|
|
||
|
/*! String representation of DNS OpCode
|
||
|
*
|
||
|
* \param[in] opcode DNS OpCode
|
||
|
* \return string
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_opcode_tostr(ares_dns_opcode_t opcode);
|
||
1 year ago
|
|
||
|
/*! String representation of DNS Resource Record Parameter
|
||
|
*
|
||
|
* \param[in] key DNS Resource Record parameter
|
||
|
* \return string
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_rr_key_tostr(ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
|
||
|
/*! Opaque data type representing a DNS RR (Resource Record) */
|
||
|
struct ares_dns_rr;
|
||
|
|
||
|
/*! Typedef for opaque data type representing a DNS RR (Resource Record) */
|
||
|
typedef struct ares_dns_rr ares_dns_rr_t;
|
||
|
|
||
|
/*! Opaque data type representing a DNS Query Data QD Packet */
|
||
|
struct ares_dns_qd;
|
||
|
|
||
|
/*! Typedef for opaque data type representing a DNS Query Data QD Packet */
|
||
|
typedef struct ares_dns_qd ares_dns_qd_t;
|
||
|
|
||
|
/*! Opaque data type representing a DNS Packet */
|
||
|
struct ares_dns_record;
|
||
|
|
||
|
/*! Typedef for opaque data type representing a DNS Packet */
|
||
|
typedef struct ares_dns_record ares_dns_record_t;
|
||
|
|
||
|
|
||
|
/*! Create a new DNS record object
|
||
|
*
|
||
|
* \param[out] dnsrec Pointer passed by reference for a newly allocated
|
||
|
* record object. Must be ares_dns_record_destroy()'d by
|
||
|
* caller.
|
||
|
* \param[in] id DNS Query ID
|
||
|
* \param[in] flags DNS Flags from \ares_dns_flags_t
|
||
|
* \param[in] opcode DNS OpCode (typically ARES_OPCODE_QUERY)
|
||
|
* \param[in] rcode DNS RCode
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_record_create(ares_dns_record_t **dnsrec,
|
||
|
unsigned short id,
|
||
|
unsigned short flags,
|
||
|
ares_dns_opcode_t opcode,
|
||
|
ares_dns_rcode_t rcode);
|
||
1 year ago
|
|
||
|
/*! Destroy a DNS record object
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN void ares_dns_record_destroy(ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Get the DNS Query ID
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \return DNS query id
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned short
|
||
|
ares_dns_record_get_id(const ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Get the DNS Record Flags
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \return One or more \ares_dns_flags_t
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned short
|
||
|
ares_dns_record_get_flags(const ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Get the DNS Record OpCode
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \return opcode
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_opcode_t
|
||
|
ares_dns_record_get_opcode(const ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Get the DNS Record RCode
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \return rcode
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_rcode_t
|
||
|
ares_dns_record_get_rcode(const ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Add a query to the DNS Record. Typically a record will have only 1
|
||
|
* query. Most DNS servers will reject queries with more than 1 question.
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] name Name/Hostname of request
|
||
|
* \param[in] qtype Type of query
|
||
|
* \param[in] qclass Class of query (typically ARES_CLASS_IN)
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec,
|
||
|
const char *name,
|
||
|
ares_dns_rec_type_t qtype,
|
||
|
ares_dns_class_t qclass);
|
||
1 year ago
|
|
||
|
/*! Get the count of queries in the DNS Record
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \return count of queries
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN size_t ares_dns_record_query_cnt(const ares_dns_record_t *dnsrec);
|
||
1 year ago
|
|
||
|
/*! Get the data about the query at the provided index.
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] idx Index of query
|
||
|
* \param[out] name Optional. Returns name, may pass NULL if not desired.
|
||
|
* \param[out] qtype Optional. Returns record type, may pass NULL.
|
||
|
* \param[out] qclass Optional. Returns class, may pass NULL.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_record_query_get(
|
||
|
const ares_dns_record_t *dnsrec, size_t idx, const char **name,
|
||
|
ares_dns_rec_type_t *qtype, ares_dns_class_t *qclass);
|
||
1 year ago
|
|
||
|
/*! Get the count of Resource Records in the provided section
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] sect Section. ARES_SECTION_ANSWER is most used.
|
||
|
* \return count of resource records.
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN size_t ares_dns_record_rr_cnt(const ares_dns_record_t *dnsrec,
|
||
|
ares_dns_section_t sect);
|
||
1 year ago
|
|
||
|
|
||
|
/*! Add a Resource Record to the DNS Record.
|
||
|
*
|
||
|
* \param[out] rr_out Pointer to created resource record. This pointer
|
||
|
* is owned by the DNS record itself, this is just made
|
||
|
* available to facilitate adding RR-specific fields.
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] sect Section to add resource record to
|
||
|
* \param[in] name Resource Record name/hostname
|
||
|
* \param[in] type Record Type
|
||
|
* \param[in] rclass Class
|
||
|
* \param[in] ttl TTL
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_record_rr_add(
|
||
|
ares_dns_rr_t **rr_out, ares_dns_record_t *dnsrec, ares_dns_section_t sect,
|
||
|
const char *name, ares_dns_rec_type_t type, ares_dns_class_t rclass,
|
||
|
unsigned int ttl);
|
||
1 year ago
|
|
||
|
/*! Fetch a resource record based on the section and index.
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] sect Section for resource record
|
||
|
* \param[in] idx Index of resource record in section
|
||
1 year ago
|
* \return NULL on misuse, otherwise a pointer to the resource record
|
||
1 year ago
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec,
|
||
|
ares_dns_section_t sect,
|
||
|
size_t idx);
|
||
1 year ago
|
|
||
|
|
||
1 year ago
|
/*! Remove the resource record based on the section and index
|
||
|
*
|
||
|
* \param[in] dnsrec Initialized record object
|
||
|
* \param[in] sect Section for resource record
|
||
|
* \param[in] idx Index of resource record in section
|
||
|
* \return ARES_SUCCESS on success, otherwise an error code.
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_record_rr_del(ares_dns_record_t *dnsrec,
|
||
|
ares_dns_section_t sect,
|
||
|
size_t idx);
|
||
1 year ago
|
|
||
1 year ago
|
/*! Retrieve a list of Resource Record keys that can be set or retrieved for
|
||
|
* the Resource record type.
|
||
|
*
|
||
|
* \param[in] type Record Type
|
||
|
* \param[out] cnt Number of keys returned
|
||
|
* \return array of keys associated with Resource Record
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const ares_dns_rr_key_t *
|
||
|
ares_dns_rr_get_keys(ares_dns_rec_type_t type, size_t *cnt);
|
||
1 year ago
|
|
||
|
/*! Retrieve the datatype associated with a Resource Record key.
|
||
|
*
|
||
|
* \param[in] key Resource Record Key
|
||
|
* \return datatype
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_datatype_t
|
||
|
ares_dns_rr_key_datatype(ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve the DNS Resource Record type associated with a Resource Record key.
|
||
|
*
|
||
|
* \param[in] key Resource Record Key
|
||
|
* \return DNS Resource Record Type
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_rec_type_t
|
||
|
ares_dns_rr_key_to_rec_type(ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve the resource record Name/Hostname
|
||
|
*
|
||
|
* \param[in] rr Pointer to resource record
|
||
|
* \return Name
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_rr_get_name(const ares_dns_rr_t *rr);
|
||
1 year ago
|
|
||
|
/*! Retrieve the resource record type
|
||
|
*
|
||
|
* \param[in] rr Pointer to resource record
|
||
|
* \return type
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_rec_type_t ares_dns_rr_get_type(const ares_dns_rr_t *rr);
|
||
1 year ago
|
|
||
|
/*! Retrieve the resource record class
|
||
|
*
|
||
|
* \param[in] rr Pointer to resource record
|
||
|
* \return class
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_dns_class_t ares_dns_rr_get_class(const ares_dns_rr_t *rr);
|
||
1 year ago
|
|
||
|
/*! Retrieve the resource record TTL
|
||
|
*
|
||
|
* \param[in] rr Pointer to resource record
|
||
|
* \return TTL
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned int ares_dns_rr_get_ttl(const ares_dns_rr_t *rr);
|
||
1 year ago
|
|
||
|
/*! Set ipv4 address data type for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_INADDR
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] addr Pointer to ipv4 address to use.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_addr(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
const struct in_addr *addr);
|
||
1 year ago
|
|
||
|
/*! Set ipv6 address data type for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_INADDR6
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] addr Pointer to ipv6 address to use.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t
|
||
|
ares_dns_rr_set_addr6(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||
|
const struct ares_in6_addr *addr);
|
||
1 year ago
|
|
||
|
/*! Set string data for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_STR
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] val Pointer to string to set.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_str(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
const char *val);
|
||
1 year ago
|
|
||
|
/*! Set 8bit unsigned integer for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_U8
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] val 8bit unsigned integer
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_u8(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
unsigned char val);
|
||
1 year ago
|
|
||
|
/*! Set 16bit unsigned integer for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_U16
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] val 16bit unsigned integer
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_u16(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
unsigned short val);
|
||
1 year ago
|
|
||
|
/*! Set 32bit unsigned integer for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_U32
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] val 32bit unsigned integer
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_u32(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
unsigned int val);
|
||
1 year ago
|
|
||
1 year ago
|
/*! Set binary (BIN or BINP) data for specified resource record and key. Can
|
||
|
* only be used on keys with datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP.
|
||
1 year ago
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] val Pointer to binary data.
|
||
|
* \param[in] len Length of binary data
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
const unsigned char *val,
|
||
|
size_t len);
|
||
1 year ago
|
|
||
1 year ago
|
/*! Set the option for the RR
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] opt Option record key id.
|
||
|
* \param[out] val Optional. Value to associate with option.
|
||
|
* \param[out] val_len Length of value passed.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_rr_set_opt(ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
unsigned short opt,
|
||
|
const unsigned char *val,
|
||
|
size_t val_len);
|
||
1 year ago
|
|
||
|
/*! Retrieve a pointer to the ipv4 address. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_INADDR.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return pointer to ipv4 address or NULL on error
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const struct in_addr *
|
||
|
ares_dns_rr_get_addr(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve a pointer to the ipv6 address. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_INADDR6.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return pointer to ipv6 address or NULL on error
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const struct ares_in6_addr *
|
||
|
ares_dns_rr_get_addr6(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve a pointer to the string. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_STR.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return pointer string or NULL on error
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const char *ares_dns_rr_get_str(const ares_dns_rr_t *dns_rr,
|
||
1 year ago
|
ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve an 8bit unsigned integer. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_U8.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return 8bit unsigned integer
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned char ares_dns_rr_get_u8(const ares_dns_rr_t *dns_rr,
|
||
1 year ago
|
ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve an 16bit unsigned integer. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_U16.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return 16bit unsigned integer
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned short ares_dns_rr_get_u16(const ares_dns_rr_t *dns_rr,
|
||
1 year ago
|
ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve an 32bit unsigned integer. Can only be used on keys with
|
||
|
* datatype ARES_DATATYPE_U32.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return 32bit unsigned integer
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned int ares_dns_rr_get_u32(const ares_dns_rr_t *dns_rr,
|
||
1 year ago
|
ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve a pointer to the binary data. Can only be used on keys with
|
||
1 year ago
|
* datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP. If BINP, the data is
|
||
|
* guaranteed to have a NULL terminator which is NOT included in the length.
|
||
1 year ago
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[out] len Length of binary data returned
|
||
|
* \return pointer binary data or NULL on error
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN const unsigned char *
|
||
|
ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||
|
size_t *len);
|
||
1 year ago
|
|
||
1 year ago
|
/*! Retrieve the number of options stored for the RR.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \return count, or 0 if none.
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key);
|
||
1 year ago
|
|
||
|
/*! Retrieve the option for the RR by index.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] idx Index of option record
|
||
|
* \param[out] val Optional. Pointer passed by reference to hold value.
|
||
|
* Options may not have values. Value if returned is
|
||
|
* likely printable and guaranteed to be NULL terminated.
|
||
|
* \param[out] val_len Optional. Pointer passed by reference to hold value
|
||
|
* length.
|
||
|
* \return option key/id on success, 65535 on misuse.
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN unsigned short
|
||
|
ares_dns_rr_get_opt(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
|
||
|
size_t idx, const unsigned char **val, size_t *val_len);
|
||
1 year ago
|
|
||
|
/*! Retrieve the option for the RR by the option key/id.
|
||
|
*
|
||
|
* \param[in] dns_rr Pointer to resource record
|
||
|
* \param[in] key DNS Resource Record Key
|
||
|
* \param[in] opt Option record key id (this is not the index).
|
||
|
* \param[out] val Optional. Pointer passed by reference to hold value.
|
||
|
* Options may not have values. Value if returned is
|
||
|
* likely printable and guaranteed to be NULL terminated.
|
||
|
* \param[out] val_len Optional. Pointer passed by reference to hold value
|
||
|
* length.
|
||
|
* \return ARES_TRUE on success, ARES_FALSE on misuse.
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_bool_t ares_dns_rr_get_opt_byid(const ares_dns_rr_t *dns_rr,
|
||
|
ares_dns_rr_key_t key,
|
||
|
unsigned short opt,
|
||
|
const unsigned char **val,
|
||
|
size_t *val_len);
|
||
1 year ago
|
|
||
|
/*! Parse a complete DNS message.
|
||
|
*
|
||
|
* \param[in] buf pointer to bytes to be parsed
|
||
|
* \param[in] buf_len Length of buf provided
|
||
|
* \param[in] flags Flags dictating how the message should be parsed. TBD.
|
||
|
* \param[out] dnsrec Pointer passed by reference for a new DNS record object
|
||
|
* that must be ares_dns_record_destroy()'d by caller.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_parse(const unsigned char *buf,
|
||
|
size_t buf_len, unsigned int flags,
|
||
|
ares_dns_record_t **dnsrec);
|
||
1 year ago
|
|
||
1 year ago
|
/*! Write a complete DNS message
|
||
|
*
|
||
|
* \param[in] dnsrec Pointer to initialized and filled DNS record object.
|
||
|
* \param[out] buf Pointer passed by reference to be filled in with with
|
||
|
* DNS message. Must be ares_free()'d by caller.
|
||
|
* \param[out] buf_len Length of returned buffer containing DNS message.
|
||
|
* \return ARES_SUCCESS on success
|
||
|
*/
|
||
1 year ago
|
CARES_EXTERN ares_status_t ares_dns_write(ares_dns_record_t *dnsrec,
|
||
|
unsigned char **buf, size_t *buf_len);
|
||
1 year ago
|
/*! @} */
|
||
|
|
||
1 year ago
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
1 year ago
|
|
||
|
#endif /* __ARES_DNS_RECORD_H */
|