httpsrr.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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, <[email protected]>, 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. #include "curl_setup.h"
  27. #ifdef USE_ARES
  28. #include <ares.h>
  29. #endif
  30. #ifdef USE_HTTPSRR
  31. #define CURL_MAXLEN_host_name 253
  32. #define MAX_HTTPSRR_ALPNS 4
  33. struct Curl_https_rrinfo {
  34. /*
  35. * Fields from HTTPS RR. The only mandatory fields are priority and target.
  36. * See https://datatracker.ietf.org/doc/html/rfc9460#section-14.3.2
  37. */
  38. char *target;
  39. unsigned char *ipv4hints; /* keytag = 4 */
  40. size_t ipv4hints_len;
  41. unsigned char *echconfiglist; /* keytag = 5 */
  42. size_t echconfiglist_len;
  43. unsigned char *ipv6hints; /* keytag = 6 */
  44. size_t ipv6hints_len;
  45. unsigned char alpns[MAX_HTTPSRR_ALPNS]; /* keytag = 1 */
  46. /* store parsed alpnid entries in the array, end with ALPN_none */
  47. int port; /* -1 means not set */
  48. uint16_t priority;
  49. bool no_def_alpn; /* keytag = 2 */
  50. };
  51. #endif
  52. /*
  53. * Code points for DNS wire format SvcParams as per RFC 9460
  54. */
  55. #define HTTPS_RR_CODE_ALPN 0x01
  56. #define HTTPS_RR_CODE_NO_DEF_ALPN 0x02
  57. #define HTTPS_RR_CODE_PORT 0x03
  58. #define HTTPS_RR_CODE_IPV4 0x04
  59. #define HTTPS_RR_CODE_ECH 0x05
  60. #define HTTPS_RR_CODE_IPV6 0x06
  61. CURLcode Curl_httpsrr_decode_alpn(const unsigned char *cp, size_t len,
  62. unsigned char *alpns);
  63. #if defined(USE_ARES) && defined(USE_HTTPSRR)
  64. void Curl_dnsrec_done_cb(void *arg, ares_status_t status,
  65. size_t timeouts,
  66. const ares_dns_record_t *dnsrec);
  67. #endif
  68. #endif /* HEADER_CURL_HTTPSRR_H */