1 #ifndef HEADER_CURL_HTTPSRR_H 2 #define HEADER_CURL_HTTPSRR_H 3 /*************************************************************************** 4 * _ _ ____ _ 5 * Project ___| | | | _ \| | 6 * / __| | | | |_) | | 7 * | (__| |_| | _ <| |___ 8 * \___|\___/|_| \_\_____| 9 * 10 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 11 * 12 * This software is licensed as described in the file COPYING, which 13 * you should have received as part of this distribution. The terms 14 * are also available at https://curl.se/docs/copyright.html. 15 * 16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 * copies of the Software, and permit persons to whom the Software is 18 * furnished to do so, under the terms of the COPYING file. 19 * 20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 * KIND, either express or implied. 22 * 23 * SPDX-License-Identifier: curl 24 * 25 ***************************************************************************/ 26 27 #include "curl_setup.h" 28 29 #ifdef USE_ARES 30 #include <ares.h> 31 #endif 32 33 #ifdef USE_HTTPSRR 34 35 #define CURL_MAXLEN_host_name 253 36 #define MAX_HTTPSRR_ALPNS 4 37 38 struct Curl_https_rrinfo { 39 /* 40 * Fields from HTTPS RR. The only mandatory fields are priority and target. 41 * See https://datatracker.ietf.org/doc/html/rfc9460#section-14.3.2 42 */ 43 char *target; 44 unsigned char *ipv4hints; /* keytag = 4 */ 45 size_t ipv4hints_len; 46 unsigned char *echconfiglist; /* keytag = 5 */ 47 size_t echconfiglist_len; 48 unsigned char *ipv6hints; /* keytag = 6 */ 49 size_t ipv6hints_len; 50 unsigned char alpns[MAX_HTTPSRR_ALPNS]; /* keytag = 1 */ 51 /* store parsed alpnid entries in the array, end with ALPN_none */ 52 int port; /* -1 means not set */ 53 uint16_t priority; 54 bool no_def_alpn; /* keytag = 2 */ 55 }; 56 #endif 57 58 /* 59 * Code points for DNS wire format SvcParams as per RFC 9460 60 */ 61 #define HTTPS_RR_CODE_ALPN 0x01 62 #define HTTPS_RR_CODE_NO_DEF_ALPN 0x02 63 #define HTTPS_RR_CODE_PORT 0x03 64 #define HTTPS_RR_CODE_IPV4 0x04 65 #define HTTPS_RR_CODE_ECH 0x05 66 #define HTTPS_RR_CODE_IPV6 0x06 67 68 CURLcode Curl_httpsrr_decode_alpn(const unsigned char *cp, size_t len, 69 unsigned char *alpns); 70 71 #if defined(USE_ARES) && defined(USE_HTTPSRR) 72 void Curl_dnsrec_done_cb(void *arg, ares_status_t status, 73 size_t timeouts, 74 const ares_dns_record_t *dnsrec); 75 #endif 76 #endif /* HEADER_CURL_HTTPSRR_H */ 77