1
0

httpsrr.h 2.9 KB

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