quic_port_local.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef OSSL_QUIC_PORT_LOCAL_H
  10. # define OSSL_QUIC_PORT_LOCAL_H
  11. # include "internal/quic_port.h"
  12. # include "internal/quic_reactor.h"
  13. # include "internal/list.h"
  14. # ifndef OPENSSL_NO_QUIC
  15. /*
  16. * QUIC Port Structure
  17. * ===================
  18. *
  19. * QUIC port internals. It is intended that only the QUIC_PORT and QUIC_CHANNEL
  20. * implementation be allowed to access this structure directly.
  21. *
  22. * Other components should not include this header.
  23. */
  24. DECLARE_LIST_OF(ch, QUIC_CHANNEL);
  25. /* A port is always in one of the following states: */
  26. enum {
  27. /* Initial and steady state. */
  28. QUIC_PORT_STATE_RUNNING,
  29. /*
  30. * Terminal state indicating port is no longer functioning. There are no
  31. * transitions out of this state. May be triggered by e.g. a permanent
  32. * network BIO error.
  33. */
  34. QUIC_PORT_STATE_FAILED
  35. };
  36. struct quic_port_st {
  37. /* The engine which this port is a child of. */
  38. QUIC_ENGINE *engine;
  39. /*
  40. * QUIC_ENGINE keeps the ports which belong to it on a list for bookkeeping
  41. * purposes.
  42. */
  43. OSSL_LIST_MEMBER(port, QUIC_PORT);
  44. /* Used to create handshake layer objects inside newly created channels. */
  45. SSL_CTX *channel_ctx;
  46. /* Network-side read and write BIOs. */
  47. BIO *net_rbio, *net_wbio;
  48. /* RX demuxer. We register incoming DCIDs with this. */
  49. QUIC_DEMUX *demux;
  50. /* List of all child channels. */
  51. OSSL_LIST(ch) channel_list;
  52. /* Special TSERVER channel. To be removed in the future. */
  53. QUIC_CHANNEL *tserver_ch;
  54. /* LCIDM used for incoming packet routing by DCID. */
  55. QUIC_LCIDM *lcidm;
  56. /* SRTM used for incoming packet routing by SRT. */
  57. QUIC_SRTM *srtm;
  58. /* Port-level permanent errors (causing failure state) are stored here. */
  59. ERR_STATE *err_state;
  60. /* DCID length used for incoming short header packets. */
  61. unsigned char rx_short_dcid_len;
  62. /* For clients, CID length used for outgoing Initial packets. */
  63. unsigned char tx_init_dcid_len;
  64. /* Port state (QUIC_PORT_STATE_*). */
  65. unsigned int state : 1;
  66. /* Is this port created to support multiple connections? */
  67. unsigned int is_multi_conn : 1;
  68. /* Has this port sent any packet of any kind yet? */
  69. unsigned int have_sent_any_pkt : 1;
  70. /* Does this port allow incoming connections? */
  71. unsigned int is_server : 1;
  72. /* Are we on the QUIC_ENGINE linked list of ports? */
  73. unsigned int on_engine_list : 1;
  74. };
  75. # endif
  76. #endif