vquic_int.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef HEADER_CURL_VQUIC_QUIC_INT_H
  2. #define HEADER_CURL_VQUIC_QUIC_INT_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. #include "curl_setup.h"
  27. #ifdef ENABLE_QUIC
  28. struct vquic_blocked_pkt {
  29. const uint8_t *pkt;
  30. size_t pktlen;
  31. size_t gsolen;
  32. };
  33. struct cf_quic_ctx {
  34. curl_socket_t sockfd;
  35. struct sockaddr_storage local_addr;
  36. socklen_t local_addrlen;
  37. struct vquic_blocked_pkt blocked_pkt[2];
  38. uint8_t *pktbuf;
  39. /* the number of entries in blocked_pkt */
  40. size_t num_blocked_pkt;
  41. size_t num_blocked_pkt_sent;
  42. /* the packets blocked by sendmsg (EAGAIN or EWOULDBLOCK) */
  43. size_t pktbuflen;
  44. /* the number of processed entries in blocked_pkt */
  45. bool no_gso;
  46. };
  47. CURLcode vquic_ctx_init(struct cf_quic_ctx *qctx, size_t pktbuflen);
  48. void vquic_ctx_free(struct cf_quic_ctx *qctx);
  49. CURLcode vquic_send_packet(struct Curl_cfilter *cf,
  50. struct Curl_easy *data,
  51. struct cf_quic_ctx *qctx,
  52. const uint8_t *pkt, size_t pktlen, size_t gsolen,
  53. size_t *psent);
  54. void vquic_push_blocked_pkt(struct Curl_cfilter *cf,
  55. struct cf_quic_ctx *qctx,
  56. const uint8_t *pkt, size_t pktlen, size_t gsolen);
  57. CURLcode vquic_send_blocked_pkt(struct Curl_cfilter *cf,
  58. struct Curl_easy *data,
  59. struct cf_quic_ctx *qctx);
  60. #endif /* !ENABLE_QUIC */
  61. #endif /* HEADER_CURL_VQUIC_QUIC_INT_H */