httpsrr.h (2908B)
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_easy; 39 40 struct Curl_https_rrinfo { 41 /* 42 * Fields from HTTPS RR. The only mandatory fields are priority and target. 43 * See https://datatracker.ietf.org/doc/html/rfc9460#section-14.3.2 44 */ 45 char *target; 46 unsigned char *ipv4hints; /* keytag = 4 */ 47 size_t ipv4hints_len; 48 unsigned char *echconfiglist; /* keytag = 5 */ 49 size_t echconfiglist_len; 50 unsigned char *ipv6hints; /* keytag = 6 */ 51 size_t ipv6hints_len; 52 unsigned char alpns[MAX_HTTPSRR_ALPNS]; /* keytag = 1 */ 53 /* store parsed alpnid entries in the array, end with ALPN_none */ 54 int port; /* -1 means not set */ 55 uint16_t priority; 56 BIT(no_def_alpn); /* keytag = 2 */ 57 }; 58 59 CURLcode Curl_httpsrr_set(struct Curl_easy *data, 60 struct Curl_https_rrinfo *hi, 61 uint16_t rrkey, const uint8_t *val, size_t vlen); 62 63 struct Curl_https_rrinfo * 64 Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo); 65 66 void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo); 67 68 /* 69 * Code points for DNS wire format SvcParams as per RFC 9460 70 */ 71 #define HTTPS_RR_CODE_MANDATORY 0x00 72 #define HTTPS_RR_CODE_ALPN 0x01 73 #define HTTPS_RR_CODE_NO_DEF_ALPN 0x02 74 #define HTTPS_RR_CODE_PORT 0x03 75 #define HTTPS_RR_CODE_IPV4 0x04 76 #define HTTPS_RR_CODE_ECH 0x05 77 #define HTTPS_RR_CODE_IPV6 0x06 78 79 #if defined(USE_ARES) 80 CURLcode Curl_httpsrr_from_ares(struct Curl_easy *data, 81 const ares_dns_record_t *dnsrec, 82 struct Curl_https_rrinfo *hinfo); 83 #endif /* USE_ARES */ 84 #endif /* USE_HTTPSRR */ 85 86 #endif /* HEADER_CURL_HTTPSRR_H */