ngtcp2.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef HEADER_CURL_VQUIC_NGTCP2_H
  2. #define HEADER_CURL_VQUIC_NGTCP2_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2022, 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. #include "curl_setup.h"
  27. #ifdef USE_NGTCP2
  28. #ifdef HAVE_NETINET_UDP_H
  29. #include <netinet/udp.h>
  30. #endif
  31. #include <ngtcp2/ngtcp2_crypto.h>
  32. #include <nghttp3/nghttp3.h>
  33. #ifdef USE_OPENSSL
  34. #include <openssl/ssl.h>
  35. #elif defined(USE_GNUTLS)
  36. #include <gnutls/gnutls.h>
  37. #elif defined(USE_WOLFSSL)
  38. #include <wolfssl/options.h>
  39. #include <wolfssl/ssl.h>
  40. #include <wolfssl/quic.h>
  41. #endif
  42. struct blocked_pkt {
  43. const uint8_t *pkt;
  44. size_t pktlen;
  45. size_t gsolen;
  46. };
  47. struct quicsocket {
  48. struct connectdata *conn; /* point back to the connection */
  49. ngtcp2_conn *qconn;
  50. ngtcp2_cid dcid;
  51. ngtcp2_cid scid;
  52. uint32_t version;
  53. ngtcp2_settings settings;
  54. ngtcp2_transport_params transport_params;
  55. ngtcp2_connection_close_error last_error;
  56. ngtcp2_crypto_conn_ref conn_ref;
  57. #ifdef USE_OPENSSL
  58. SSL_CTX *sslctx;
  59. SSL *ssl;
  60. #elif defined(USE_GNUTLS)
  61. gnutls_certificate_credentials_t cred;
  62. gnutls_session_t ssl;
  63. #elif defined(USE_WOLFSSL)
  64. WOLFSSL_CTX *sslctx;
  65. WOLFSSL *ssl;
  66. #endif
  67. struct sockaddr_storage local_addr;
  68. socklen_t local_addrlen;
  69. bool no_gso;
  70. uint8_t *pktbuf;
  71. size_t pktbuflen;
  72. /* the number of entries in blocked_pkt */
  73. size_t num_blocked_pkt;
  74. /* the number of processed entries in blocked_pkt */
  75. size_t num_blocked_pkt_sent;
  76. /* the packets blocked by sendmsg (EAGAIN or EWOULDBLOCK) */
  77. struct blocked_pkt blocked_pkt[2];
  78. nghttp3_conn *h3conn;
  79. nghttp3_settings h3settings;
  80. int qlogfd;
  81. };
  82. #include "urldata.h"
  83. #endif
  84. #endif /* HEADER_CURL_VQUIC_NGTCP2_H */