nghttp2_option.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * nghttp2 - HTTP/2 C Library
  3. *
  4. * Copyright (c) 2014 Tatsuhiro Tsujikawa
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be
  15. * included in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. #ifndef NGHTTP2_OPTION_H
  26. #define NGHTTP2_OPTION_H
  27. #ifdef HAVE_CONFIG_H
  28. # include <config.h>
  29. #endif /* HAVE_CONFIG_H */
  30. #include <nghttp2/nghttp2.h>
  31. /**
  32. * Configuration options
  33. */
  34. typedef enum {
  35. /**
  36. * This option prevents the library from sending WINDOW_UPDATE for a
  37. * connection automatically. If this option is set to nonzero, the
  38. * library won't send WINDOW_UPDATE for DATA until application calls
  39. * nghttp2_session_consume() to indicate the amount of consumed
  40. * DATA. By default, this option is set to zero.
  41. */
  42. NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE = 1,
  43. /**
  44. * This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of
  45. * remote endpoint as if it is received in SETTINGS frame. Without
  46. * specifying this option, before the local endpoint receives
  47. * SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame from remote
  48. * endpoint, SETTINGS_MAX_CONCURRENT_STREAMS is unlimited. This may
  49. * cause problem if local endpoint submits lots of requests
  50. * initially and sending them at once to the remote peer may lead to
  51. * the rejection of some requests. Specifying this option to the
  52. * sensible value, say 100, may avoid this kind of issue. This value
  53. * will be overwritten if the local endpoint receives
  54. * SETTINGS_MAX_CONCURRENT_STREAMS from the remote endpoint.
  55. */
  56. NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS = 1 << 1,
  57. NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC = 1 << 2,
  58. NGHTTP2_OPT_NO_HTTP_MESSAGING = 1 << 3,
  59. NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS = 1 << 4,
  60. NGHTTP2_OPT_USER_RECV_EXT_TYPES = 1 << 5,
  61. NGHTTP2_OPT_NO_AUTO_PING_ACK = 1 << 6,
  62. NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES = 1 << 7,
  63. NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH = 1 << 8,
  64. NGHTTP2_OPT_MAX_DEFLATE_DYNAMIC_TABLE_SIZE = 1 << 9,
  65. NGHTTP2_OPT_NO_CLOSED_STREAMS = 1 << 10,
  66. NGHTTP2_OPT_MAX_OUTBOUND_ACK = 1 << 11,
  67. NGHTTP2_OPT_MAX_SETTINGS = 1 << 12,
  68. NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES = 1 << 13,
  69. NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION = 1 << 14,
  70. NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT = 1 << 15,
  71. } nghttp2_option_flag;
  72. /**
  73. * Struct to store option values for nghttp2_session.
  74. */
  75. struct nghttp2_option {
  76. /**
  77. * NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT
  78. */
  79. uint64_t stream_reset_burst;
  80. uint64_t stream_reset_rate;
  81. /**
  82. * NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH
  83. */
  84. size_t max_send_header_block_length;
  85. /**
  86. * NGHTTP2_OPT_MAX_DEFLATE_DYNAMIC_TABLE_SIZE
  87. */
  88. size_t max_deflate_dynamic_table_size;
  89. /**
  90. * NGHTTP2_OPT_MAX_OUTBOUND_ACK
  91. */
  92. size_t max_outbound_ack;
  93. /**
  94. * NGHTTP2_OPT_MAX_SETTINGS
  95. */
  96. size_t max_settings;
  97. /**
  98. * Bitwise OR of nghttp2_option_flag to determine that which fields
  99. * are specified.
  100. */
  101. uint32_t opt_set_mask;
  102. /**
  103. * NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS
  104. */
  105. uint32_t peer_max_concurrent_streams;
  106. /**
  107. * NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS
  108. */
  109. uint32_t max_reserved_remote_streams;
  110. /**
  111. * NGHTTP2_OPT_BUILTIN_RECV_EXT_TYPES
  112. */
  113. uint32_t builtin_recv_ext_types;
  114. /**
  115. * NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE
  116. */
  117. int no_auto_window_update;
  118. /**
  119. * NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC
  120. */
  121. int no_recv_client_magic;
  122. /**
  123. * NGHTTP2_OPT_NO_HTTP_MESSAGING
  124. */
  125. int no_http_messaging;
  126. /**
  127. * NGHTTP2_OPT_NO_AUTO_PING_ACK
  128. */
  129. int no_auto_ping_ack;
  130. /**
  131. * NGHTTP2_OPT_NO_CLOSED_STREAMS
  132. */
  133. int no_closed_streams;
  134. /**
  135. * NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES
  136. */
  137. int server_fallback_rfc7540_priorities;
  138. /**
  139. * NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION
  140. */
  141. int no_rfc9113_leading_and_trailing_ws_validation;
  142. /**
  143. * NGHTTP2_OPT_USER_RECV_EXT_TYPES
  144. */
  145. uint8_t user_recv_ext_types[32];
  146. };
  147. #endif /* NGHTTP2_OPTION_H */