@encharm/cws 4.5.1 → 4.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/README.md +3 -5
  2. package/binding.gyp +1 -1
  3. package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
  4. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Info.plist +20 -0
  5. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node115.node +0 -0
  6. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node115.node.yml +931 -0
  7. package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
  8. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Info.plist +20 -0
  9. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node127.node +0 -0
  10. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node127.node.yml +931 -0
  11. package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
  12. package/dist/bindings/cws_linux_x64_node137.node +0 -0
  13. package/dist/bindings/cws_win32_x64_node137.node +0 -0
  14. package/package.json +1 -1
  15. package/src/Addon.h +6 -1
  16. package/src/headers/24/acorn_version.h +6 -0
  17. package/src/headers/24/addon_permission.h +31 -0
  18. package/src/headers/24/agent.h +195 -0
  19. package/src/headers/24/aliased_buffer-inl.h +244 -0
  20. package/src/headers/24/aliased_buffer.h +206 -0
  21. package/src/headers/24/aliased_struct-inl.h +54 -0
  22. package/src/headers/24/aliased_struct.h +63 -0
  23. package/src/headers/24/amaro_version.h +6 -0
  24. package/src/headers/24/application.h +165 -0
  25. package/src/headers/24/async_context_frame.h +33 -0
  26. package/src/headers/24/async_wrap-inl.h +96 -0
  27. package/src/headers/24/async_wrap.h +244 -0
  28. package/src/headers/24/base_object-inl.h +330 -0
  29. package/src/headers/24/base_object.h +338 -0
  30. package/src/headers/24/base_object_types.h +74 -0
  31. package/src/headers/24/bindingdata.h +272 -0
  32. package/src/headers/24/blob_serializer_deserializer-inl.h +385 -0
  33. package/src/headers/24/blob_serializer_deserializer.h +132 -0
  34. package/src/headers/24/callback_queue-inl.h +97 -0
  35. package/src/headers/24/callback_queue.h +79 -0
  36. package/src/headers/24/cares_wrap.h +447 -0
  37. package/src/headers/24/child_process_permission.h +31 -0
  38. package/src/headers/24/cid.h +127 -0
  39. package/src/headers/24/cjs_module_lexer_version.h +6 -0
  40. package/src/headers/24/cleanup_queue-inl.h +36 -0
  41. package/src/headers/24/cleanup_queue.h +79 -0
  42. package/src/headers/24/compile_cache.h +113 -0
  43. package/src/headers/24/connect_wrap.h +26 -0
  44. package/src/headers/24/connection_wrap.h +30 -0
  45. package/src/headers/24/cppgc_helpers-inl.h +65 -0
  46. package/src/headers/24/cppgc_helpers.h +162 -0
  47. package/src/headers/24/crypto/crypto_aes.h +97 -0
  48. package/src/headers/24/crypto/crypto_argon2.h +86 -0
  49. package/src/headers/24/crypto/crypto_bio.h +193 -0
  50. package/src/headers/24/crypto/crypto_chacha20_poly1305.h +64 -0
  51. package/src/headers/24/crypto/crypto_cipher.h +281 -0
  52. package/src/headers/24/crypto/crypto_clienthello-inl.h +90 -0
  53. package/src/headers/24/crypto/crypto_clienthello.h +131 -0
  54. package/src/headers/24/crypto/crypto_common.h +48 -0
  55. package/src/headers/24/crypto/crypto_context.h +171 -0
  56. package/src/headers/24/crypto/crypto_dh.h +126 -0
  57. package/src/headers/24/crypto/crypto_dsa.h +50 -0
  58. package/src/headers/24/crypto/crypto_ec.h +163 -0
  59. package/src/headers/24/crypto/crypto_hash.h +89 -0
  60. package/src/headers/24/crypto/crypto_hkdf.h +61 -0
  61. package/src/headers/24/crypto/crypto_hmac.h +92 -0
  62. package/src/headers/24/crypto/crypto_kem.h +113 -0
  63. package/src/headers/24/crypto/crypto_keygen.h +290 -0
  64. package/src/headers/24/crypto/crypto_keys.h +392 -0
  65. package/src/headers/24/crypto/crypto_ml_dsa.h +21 -0
  66. package/src/headers/24/crypto/crypto_pbkdf2.h +74 -0
  67. package/src/headers/24/crypto/crypto_random.h +124 -0
  68. package/src/headers/24/crypto/crypto_rsa.h +136 -0
  69. package/src/headers/24/crypto/crypto_scrypt.h +85 -0
  70. package/src/headers/24/crypto/crypto_sig.h +156 -0
  71. package/src/headers/24/crypto/crypto_spkac.h +21 -0
  72. package/src/headers/24/crypto/crypto_timing.h +20 -0
  73. package/src/headers/24/crypto/crypto_tls.h +309 -0
  74. package/src/headers/24/crypto/crypto_util.h +598 -0
  75. package/src/headers/24/crypto/crypto_x509.h +140 -0
  76. package/src/headers/24/data.h +148 -0
  77. package/src/headers/24/debug_utils-inl.h +232 -0
  78. package/src/headers/24/debug_utils.h +193 -0
  79. package/src/headers/24/defs.h +254 -0
  80. package/src/headers/24/diagnosticfilename-inl.h +33 -0
  81. package/src/headers/24/embedded_data.h +17 -0
  82. package/src/headers/24/encoding_binding.h +60 -0
  83. package/src/headers/24/endpoint.h +421 -0
  84. package/src/headers/24/env-inl.h +935 -0
  85. package/src/headers/24/env.h +1257 -0
  86. package/src/headers/24/env_properties.h +561 -0
  87. package/src/headers/24/fs_permission.h +167 -0
  88. package/src/headers/24/handle_wrap.h +123 -0
  89. package/src/headers/24/histogram-inl.h +107 -0
  90. package/src/headers/24/histogram.h +279 -0
  91. package/src/headers/24/http3.h +44 -0
  92. package/src/headers/24/inspector_agent.h +165 -0
  93. package/src/headers/24/inspector_io.h +78 -0
  94. package/src/headers/24/inspector_permission.h +31 -0
  95. package/src/headers/24/inspector_profiler.h +149 -0
  96. package/src/headers/24/inspector_socket.h +60 -0
  97. package/src/headers/24/inspector_socket_server.h +110 -0
  98. package/src/headers/24/io_agent.h +30 -0
  99. package/src/headers/24/js_native_api.h +615 -0
  100. package/src/headers/24/js_native_api_types.h +211 -0
  101. package/src/headers/24/js_native_api_v8.h +485 -0
  102. package/src/headers/24/js_native_api_v8_internals.h +45 -0
  103. package/src/headers/24/js_stream.h +52 -0
  104. package/src/headers/24/json_parser.h +40 -0
  105. package/src/headers/24/json_utils.h +172 -0
  106. package/src/headers/24/logstream.h +81 -0
  107. package/src/headers/24/main_thread_interface.h +116 -0
  108. package/src/headers/24/memory_tracker-inl.h +454 -0
  109. package/src/headers/24/memory_tracker.h +333 -0
  110. package/src/headers/24/module_wrap.h +229 -0
  111. package/src/headers/24/ncrypto.h +1625 -0
  112. package/src/headers/24/network_agent.h +118 -0
  113. package/src/headers/24/network_inspector.h +45 -0
  114. package/src/headers/24/network_resource_manager.h +29 -0
  115. package/src/headers/24/node.h +1620 -0
  116. package/src/headers/24/node_api.h +269 -0
  117. package/src/headers/24/node_api_internals.h +46 -0
  118. package/src/headers/24/node_api_types.h +52 -0
  119. package/src/headers/24/node_binding.h +163 -0
  120. package/src/headers/24/node_blob.h +159 -0
  121. package/src/headers/24/node_bob-inl.h +36 -0
  122. package/src/headers/24/node_bob.h +107 -0
  123. package/src/headers/24/node_buffer.h +92 -0
  124. package/src/headers/24/node_builtins.h +223 -0
  125. package/src/headers/24/node_config_file.h +65 -0
  126. package/src/headers/24/node_constants.h +82 -0
  127. package/src/headers/24/node_context_data.h +168 -0
  128. package/src/headers/24/node_contextify.h +261 -0
  129. package/src/headers/24/node_crypto.h +62 -0
  130. package/src/headers/24/node_debug.h +25 -0
  131. package/src/headers/24/node_dir.h +52 -0
  132. package/src/headers/24/node_dotenv.h +45 -0
  133. package/src/headers/24/node_errors.h +391 -0
  134. package/src/headers/24/node_exit_code.h +54 -0
  135. package/src/headers/24/node_external_reference.h +167 -0
  136. package/src/headers/24/node_file-inl.h +412 -0
  137. package/src/headers/24/node_file.h +540 -0
  138. package/src/headers/24/node_http2.h +1175 -0
  139. package/src/headers/24/node_http2_state.h +159 -0
  140. package/src/headers/24/node_http_common-inl.h +198 -0
  141. package/src/headers/24/node_http_common.h +535 -0
  142. package/src/headers/24/node_i18n.h +132 -0
  143. package/src/headers/24/node_internals.h +476 -0
  144. package/src/headers/24/node_json.h +24 -0
  145. package/src/headers/24/node_large_page.h +34 -0
  146. package/src/headers/24/node_locks.h +180 -0
  147. package/src/headers/24/node_main_instance.h +67 -0
  148. package/src/headers/24/node_mem-inl.h +112 -0
  149. package/src/headers/24/node_mem.h +45 -0
  150. package/src/headers/24/node_messaging.h +389 -0
  151. package/src/headers/24/node_metadata.h +164 -0
  152. package/src/headers/24/node_modules.h +93 -0
  153. package/src/headers/24/node_mutex.h +323 -0
  154. package/src/headers/24/node_object_wrap.h +132 -0
  155. package/src/headers/24/node_options-inl.h +524 -0
  156. package/src/headers/24/node_options.h +682 -0
  157. package/src/headers/24/node_perf.h +166 -0
  158. package/src/headers/24/node_perf_common.h +102 -0
  159. package/src/headers/24/node_platform.h +286 -0
  160. package/src/headers/24/node_process-inl.h +26 -0
  161. package/src/headers/24/node_process.h +111 -0
  162. package/src/headers/24/node_realm-inl.h +153 -0
  163. package/src/headers/24/node_realm.h +236 -0
  164. package/src/headers/24/node_report.h +43 -0
  165. package/src/headers/24/node_revert.h +82 -0
  166. package/src/headers/24/node_root_certs.h +3546 -0
  167. package/src/headers/24/node_sea.h +74 -0
  168. package/src/headers/24/node_shadow_realm.h +46 -0
  169. package/src/headers/24/node_snapshot_builder.h +57 -0
  170. package/src/headers/24/node_snapshotable.h +174 -0
  171. package/src/headers/24/node_sockaddr-inl.h +257 -0
  172. package/src/headers/24/node_sockaddr.h +394 -0
  173. package/src/headers/24/node_sqlite.h +270 -0
  174. package/src/headers/24/node_stat_watcher.h +73 -0
  175. package/src/headers/24/node_string.h +101 -0
  176. package/src/headers/24/node_task_runner.h +92 -0
  177. package/src/headers/24/node_threadsafe_cow-inl.h +54 -0
  178. package/src/headers/24/node_threadsafe_cow.h +105 -0
  179. package/src/headers/24/node_trace_buffer.h +83 -0
  180. package/src/headers/24/node_trace_writer.h +75 -0
  181. package/src/headers/24/node_union_bytes.h +81 -0
  182. package/src/headers/24/node_url.h +101 -0
  183. package/src/headers/24/node_url_pattern.h +118 -0
  184. package/src/headers/24/node_v8.h +77 -0
  185. package/src/headers/24/node_v8_platform-inl.h +185 -0
  186. package/src/headers/24/node_version.h +110 -0
  187. package/src/headers/24/node_wasi.h +185 -0
  188. package/src/headers/24/node_wasm_web_api.h +55 -0
  189. package/src/headers/24/node_watchdog.h +154 -0
  190. package/src/headers/24/node_webstorage.h +60 -0
  191. package/src/headers/24/node_worker.h +159 -0
  192. package/src/headers/24/packet.h +155 -0
  193. package/src/headers/24/path.h +33 -0
  194. package/src/headers/24/permission/addon_permission.h +31 -0
  195. package/src/headers/24/permission/child_process_permission.h +31 -0
  196. package/src/headers/24/permission/fs_permission.h +167 -0
  197. package/src/headers/24/permission/inspector_permission.h +31 -0
  198. package/src/headers/24/permission/permission.h +100 -0
  199. package/src/headers/24/permission/permission_base.h +65 -0
  200. package/src/headers/24/permission/wasi_permission.h +31 -0
  201. package/src/headers/24/permission/worker_permission.h +31 -0
  202. package/src/headers/24/permission.h +100 -0
  203. package/src/headers/24/permission_base.h +65 -0
  204. package/src/headers/24/pipe_wrap.h +80 -0
  205. package/src/headers/24/preferredaddress.h +72 -0
  206. package/src/headers/24/protocol_helper.h +27 -0
  207. package/src/headers/24/queue.h +306 -0
  208. package/src/headers/24/req_wrap-inl.h +176 -0
  209. package/src/headers/24/req_wrap.h +79 -0
  210. package/src/headers/24/runtime_agent.h +41 -0
  211. package/src/headers/24/session.h +528 -0
  212. package/src/headers/24/sessionticket.h +108 -0
  213. package/src/headers/24/spawn_sync.h +243 -0
  214. package/src/headers/24/stream_base-inl.h +173 -0
  215. package/src/headers/24/stream_base.h +478 -0
  216. package/src/headers/24/stream_pipe.h +76 -0
  217. package/src/headers/24/stream_wrap.h +132 -0
  218. package/src/headers/24/streams.h +370 -0
  219. package/src/headers/24/string_bytes.h +109 -0
  220. package/src/headers/24/string_decoder-inl.h +31 -0
  221. package/src/headers/24/string_decoder.h +49 -0
  222. package/src/headers/24/target_agent.h +75 -0
  223. package/src/headers/24/tcp_wrap.h +105 -0
  224. package/src/headers/24/threadpoolwork-inl.h +70 -0
  225. package/src/headers/24/timer_wrap-inl.h +32 -0
  226. package/src/headers/24/timer_wrap.h +87 -0
  227. package/src/headers/24/timers.h +75 -0
  228. package/src/headers/24/tlscontext.h +228 -0
  229. package/src/headers/24/tokens.h +256 -0
  230. package/src/headers/24/trace_event.h +722 -0
  231. package/src/headers/24/trace_event_common.h +1109 -0
  232. package/src/headers/24/traced_value.h +129 -0
  233. package/src/headers/24/tracing/agent.h +195 -0
  234. package/src/headers/24/tracing/trace_event.h +722 -0
  235. package/src/headers/24/tracing_agent.h +43 -0
  236. package/src/headers/24/transportparams.h +166 -0
  237. package/src/headers/24/tty_wrap.h +65 -0
  238. package/src/headers/24/udp_wrap.h +230 -0
  239. package/src/headers/24/undici_version.h +6 -0
  240. package/src/headers/24/util-inl.h +711 -0
  241. package/src/headers/24/util.h +1016 -0
  242. package/src/headers/24/v8-external-memory-accounter.h +60 -0
  243. package/src/headers/24/v8-fast-api-calls.h +819 -0
  244. package/src/headers/24/v8-inspector.h +426 -0
  245. package/src/headers/24/wasi_permission.h +31 -0
  246. package/src/headers/24/worker_agent.h +40 -0
  247. package/src/headers/24/worker_inspector.h +124 -0
  248. package/src/headers/24/worker_permission.h +31 -0
  249. package/src/headers/24/zlib_version.h +6 -0
@@ -0,0 +1,43 @@
1
+ #ifndef SRC_INSPECTOR_TRACING_AGENT_H_
2
+ #define SRC_INSPECTOR_TRACING_AGENT_H_
3
+
4
+ #include "node/inspector/protocol/NodeTracing.h"
5
+ #include "tracing/agent.h"
6
+ #include "v8.h"
7
+
8
+
9
+ namespace node {
10
+ class Environment;
11
+
12
+ namespace inspector {
13
+ class MainThreadHandle;
14
+
15
+ namespace protocol {
16
+
17
+ class TracingAgent : public NodeTracing::Backend {
18
+ public:
19
+ explicit TracingAgent(Environment*, std::shared_ptr<MainThreadHandle>);
20
+ ~TracingAgent() override;
21
+
22
+ void Wire(UberDispatcher* dispatcher);
23
+
24
+ DispatchResponse start(
25
+ std::unique_ptr<protocol::NodeTracing::TraceConfig> traceConfig) override;
26
+ DispatchResponse stop() override;
27
+ DispatchResponse getCategories(
28
+ std::unique_ptr<protocol::Array<String>>* categories) override;
29
+
30
+ private:
31
+ Environment* env_;
32
+ std::shared_ptr<MainThreadHandle> main_thread_;
33
+ tracing::AgentWriterHandle trace_writer_;
34
+ int frontend_object_id_ = 0;
35
+ std::shared_ptr<NodeTracing::Frontend> frontend_;
36
+ };
37
+
38
+
39
+ } // namespace protocol
40
+ } // namespace inspector
41
+ } // namespace node
42
+
43
+ #endif // SRC_INSPECTOR_TRACING_AGENT_H_
@@ -0,0 +1,166 @@
1
+ #pragma once
2
+
3
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4
+ #if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
5
+
6
+ #include <env.h>
7
+ #include <memory_tracker.h>
8
+ #include <ngtcp2/ngtcp2.h>
9
+ #include <node_sockaddr.h>
10
+ #include <optional>
11
+ #include "bindingdata.h"
12
+ #include "cid.h"
13
+ #include "data.h"
14
+ #include "tokens.h"
15
+
16
+ namespace node::quic {
17
+
18
+ class Endpoint;
19
+ class Session;
20
+
21
+ // The Transport Params are the set of configuration options that are sent to
22
+ // the remote peer. They communicate the protocol options the other peer
23
+ // should use when communicating with this session.
24
+ class TransportParams final {
25
+ public:
26
+ static void Initialize(Environment* env, v8::Local<v8::Object> target);
27
+
28
+ static constexpr int QUIC_TRANSPORT_PARAMS_V1 = NGTCP2_TRANSPORT_PARAMS_V1;
29
+ static constexpr int QUIC_TRANSPORT_PARAMS_VERSION =
30
+ NGTCP2_TRANSPORT_PARAMS_VERSION;
31
+ static constexpr uint64_t DEFAULT_MAX_STREAM_DATA = 256 * 1024;
32
+ static constexpr uint64_t DEFAULT_MAX_DATA = 1 * 1024 * 1024;
33
+ static constexpr uint64_t DEFAULT_MAX_IDLE_TIMEOUT = 10; // seconds
34
+ static constexpr uint64_t DEFAULT_MAX_STREAMS_BIDI = 100;
35
+ static constexpr uint64_t DEFAULT_MAX_STREAMS_UNI = 3;
36
+ static constexpr uint64_t DEFAULT_ACTIVE_CONNECTION_ID_LIMIT = 2;
37
+
38
+ struct Config {
39
+ Side side;
40
+ const CID& ocid;
41
+ const CID& retry_scid;
42
+ Config(Side side,
43
+ const CID& ocid = CID::kInvalid,
44
+ const CID& retry_scid = CID::kInvalid);
45
+ };
46
+
47
+ struct Options : public MemoryRetainer {
48
+ int transportParamsVersion = QUIC_TRANSPORT_PARAMS_V1;
49
+
50
+ // Set only on server Sessions, the preferred address communicates the IP
51
+ // address and port that the server would prefer the client to use when
52
+ // communicating with it. See the QUIC specification for more detail on how
53
+ // the preferred address mechanism works.
54
+ std::optional<SocketAddress> preferred_address_ipv4{};
55
+ std::optional<SocketAddress> preferred_address_ipv6{};
56
+
57
+ // The initial size of the flow control window of locally initiated streams.
58
+ // This is the maximum number of bytes that the *remote* endpoint can send
59
+ // when the connection is started.
60
+ uint64_t initial_max_stream_data_bidi_local = DEFAULT_MAX_STREAM_DATA;
61
+
62
+ // The initial size of the flow control window of remotely initiated
63
+ // streams. This is the maximum number of bytes that the remote endpoint can
64
+ // send when the connection is started.
65
+ uint64_t initial_max_stream_data_bidi_remote = DEFAULT_MAX_STREAM_DATA;
66
+
67
+ // The initial size of the flow control window of remotely initiated
68
+ // unidirectional streams. This is the maximum number of bytes that the
69
+ // remote endpoint can send when the connection is started.
70
+ uint64_t initial_max_stream_data_uni = DEFAULT_MAX_STREAM_DATA;
71
+
72
+ // The initial size of the session-level flow control window.
73
+ uint64_t initial_max_data = DEFAULT_MAX_DATA;
74
+
75
+ // The initial maximum number of concurrent bidirectional streams the remote
76
+ // endpoint is permitted to open.
77
+ uint64_t initial_max_streams_bidi = DEFAULT_MAX_STREAMS_BIDI;
78
+
79
+ // The initial maximum number of concurrent unidirectional streams the
80
+ // remote endpoint is permitted to open.
81
+ uint64_t initial_max_streams_uni = DEFAULT_MAX_STREAMS_UNI;
82
+
83
+ // The maximum amount of time that a Session is permitted to remain idle
84
+ // before it is silently closed and state is discarded.
85
+ uint64_t max_idle_timeout = DEFAULT_MAX_IDLE_TIMEOUT;
86
+
87
+ // The maximum number of Connection IDs that the peer can store. A single
88
+ // Session may have several connection IDs over it's lifetime.
89
+ uint64_t active_connection_id_limit = DEFAULT_ACTIVE_CONNECTION_ID_LIMIT;
90
+
91
+ // Establishes the exponent used in ACK Delay field in the ACK frame. See
92
+ // the QUIC specification for details. This is an advanced option that
93
+ // should rarely be modified and only if there is really good reason.
94
+ uint64_t ack_delay_exponent = NGTCP2_DEFAULT_ACK_DELAY_EXPONENT;
95
+
96
+ // The maximum amount of time by which the endpoint will delay sending
97
+ // acknowledgements. This is an advanced option that should rarely be
98
+ // modified and only if there is a really good reason. It is used to
99
+ // determine how long a Session will wait to determine that a packet has
100
+ // been lost.
101
+ uint64_t max_ack_delay = NGTCP2_DEFAULT_MAX_ACK_DELAY;
102
+
103
+ // The maximum size of DATAGRAM frames that the endpoint will accept.
104
+ // Setting the value to 0 will disable DATAGRAM support.
105
+ uint64_t max_datagram_frame_size = kDefaultMaxPacketLength;
106
+
107
+ // When true, communicates that the Session does not support active
108
+ // connection migration. See the QUIC specification for more details on
109
+ // connection migration.
110
+ // TODO(@jasnell): We currently do not implementation active migration.
111
+ bool disable_active_migration = true;
112
+
113
+ static const Options kDefault;
114
+
115
+ void MemoryInfo(MemoryTracker* tracker) const override;
116
+ SET_MEMORY_INFO_NAME(TransportParams::Options)
117
+ SET_SELF_SIZE(Options)
118
+
119
+ static v8::Maybe<Options> From(Environment* env,
120
+ v8::Local<v8::Value> value);
121
+
122
+ std::string ToString() const;
123
+ };
124
+
125
+ explicit TransportParams();
126
+
127
+ // Creates an instance of TransportParams wrapping the existing const
128
+ // ngtcp2_transport_params pointer.
129
+ TransportParams(const ngtcp2_transport_params* ptr);
130
+
131
+ TransportParams(const Config& config, const Options& options);
132
+
133
+ // Creates an instance of TransportParams by decoding the given buffer.
134
+ // If the parameters cannot be successfully decoded, the error()
135
+ // property will be set with an appropriate QuicError and the bool()
136
+ // operator will return false.
137
+ TransportParams(const ngtcp2_vec& buf,
138
+ int version = QUIC_TRANSPORT_PARAMS_V1);
139
+
140
+ void GenerateSessionTokens(Session* session);
141
+ void GenerateStatelessResetToken(const Endpoint& endpoint, const CID& cid);
142
+ void GeneratePreferredAddressToken(Session* session);
143
+ void SetPreferredAddress(const SocketAddress& address);
144
+
145
+ operator const ngtcp2_transport_params&() const;
146
+ operator const ngtcp2_transport_params*() const;
147
+
148
+ operator bool() const;
149
+
150
+ const QuicError& error() const;
151
+
152
+ // Returns an ArrayBuffer containing the encoded transport parameters.
153
+ // If an error occurs during encoding, an empty shared_ptr will be returned
154
+ // and the error() property will be set to an appropriate QuicError.
155
+ Store Encode(Environment* env, int version = QUIC_TRANSPORT_PARAMS_V1) const;
156
+
157
+ private:
158
+ ngtcp2_transport_params params_{};
159
+ const ngtcp2_transport_params* ptr_;
160
+ QuicError error_ = QuicError::TRANSPORT_NO_ERROR;
161
+ };
162
+
163
+ } // namespace node::quic
164
+
165
+ #endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
166
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
@@ -0,0 +1,65 @@
1
+ // Copyright Joyent, Inc. and other Node contributors.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a
4
+ // copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ // persons to whom the Software is furnished to do so, subject to the
9
+ // following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included
12
+ // in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ #ifndef SRC_TTY_WRAP_H_
23
+ #define SRC_TTY_WRAP_H_
24
+
25
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
+
27
+ #include "uv.h"
28
+ #include "stream_wrap.h"
29
+
30
+ namespace node {
31
+
32
+ class Environment;
33
+ class ExternalReferenceRegistry;
34
+
35
+ class TTYWrap : public LibuvStreamWrap {
36
+ public:
37
+ static void Initialize(v8::Local<v8::Object> target,
38
+ v8::Local<v8::Value> unused,
39
+ v8::Local<v8::Context> context,
40
+ void* priv);
41
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
42
+
43
+ SET_NO_MEMORY_INFO()
44
+ SET_MEMORY_INFO_NAME(TTYWrap)
45
+ SET_SELF_SIZE(TTYWrap)
46
+
47
+ private:
48
+ TTYWrap(Environment* env,
49
+ v8::Local<v8::Object> object,
50
+ int fd,
51
+ int* init_err);
52
+
53
+ static void IsTTY(const v8::FunctionCallbackInfo<v8::Value>& args);
54
+ static void GetWindowSize(const v8::FunctionCallbackInfo<v8::Value>& args);
55
+ static void SetRawMode(const v8::FunctionCallbackInfo<v8::Value>& args);
56
+ static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
57
+
58
+ uv_tty_t handle_;
59
+ };
60
+
61
+ } // namespace node
62
+
63
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
64
+
65
+ #endif // SRC_TTY_WRAP_H_
@@ -0,0 +1,230 @@
1
+ // Copyright Joyent, Inc. and other Node contributors.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a
4
+ // copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ // persons to whom the Software is furnished to do so, subject to the
9
+ // following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included
12
+ // in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ #ifndef SRC_UDP_WRAP_H_
23
+ #define SRC_UDP_WRAP_H_
24
+
25
+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
+
27
+ #include "handle_wrap.h"
28
+ #include "req_wrap.h"
29
+ #include "node_sockaddr.h"
30
+ #include "uv.h"
31
+ #include "v8.h"
32
+
33
+ namespace node {
34
+
35
+ class ExternalReferenceRegistry;
36
+ class UDPWrapBase;
37
+
38
+ // A listener that can be attached to an `UDPWrapBase` object and generally
39
+ // manages its I/O activity. This is similar to `StreamListener`.
40
+ class UDPListener {
41
+ public:
42
+ virtual ~UDPListener();
43
+
44
+ // Called right before data is received from the socket. Must return a
45
+ // buffer suitable for reading data into, that is then passed to OnRecv.
46
+ virtual uv_buf_t OnAlloc(size_t suggested_size) = 0;
47
+
48
+ // Called right after data is received from the socket, and includes
49
+ // information about the source address. If `nread` is negative, an error
50
+ // has occurred, and it represents a libuv error code.
51
+ virtual void OnRecv(ssize_t nread,
52
+ const uv_buf_t& buf,
53
+ const sockaddr* addr,
54
+ unsigned int flags) = 0;
55
+
56
+ // Called when an asynchronous request for writing data is created.
57
+ // The `msg_size` value contains the total size of the data to be sent,
58
+ // but may be ignored by the implementation of this Method.
59
+ // The return value is later passed to OnSendDone.
60
+ virtual ReqWrap<uv_udp_send_t>* CreateSendWrap(size_t msg_size) = 0;
61
+
62
+ // Called when an asynchronous request for writing data has finished.
63
+ // If status is negative, an error has occurred, and it represents a libuv
64
+ // error code.
65
+ virtual void OnSendDone(ReqWrap<uv_udp_send_t>* wrap, int status) = 0;
66
+
67
+ // Optional callback that is called after the socket has been bound.
68
+ virtual void OnAfterBind() {}
69
+
70
+ inline UDPWrapBase* udp() const { return wrap_; }
71
+
72
+ protected:
73
+ UDPWrapBase* wrap_ = nullptr;
74
+
75
+ friend class UDPWrapBase;
76
+ };
77
+
78
+ class UDPWrapBase {
79
+ public:
80
+ // While UDPWrapBase itself does not extend from HandleWrap, classes
81
+ // derived from it will (like UDPWrap)
82
+ enum InternalFields {
83
+ kUDPWrapBaseField = HandleWrap::kInternalFieldCount,
84
+ kInternalFieldCount
85
+ };
86
+ virtual ~UDPWrapBase();
87
+
88
+ // Start emitting OnAlloc() + OnRecv() events on the listener.
89
+ virtual int RecvStart() = 0;
90
+
91
+ // Stop emitting OnAlloc() + OnRecv() events on the listener.
92
+ virtual int RecvStop() = 0;
93
+
94
+ // Send a chunk of data over this socket. This may call CreateSendWrap()
95
+ // on the listener if an async transmission is necessary.
96
+ virtual ssize_t Send(uv_buf_t* bufs,
97
+ size_t nbufs,
98
+ const sockaddr* addr) = 0;
99
+
100
+ virtual SocketAddress GetPeerName() = 0;
101
+ virtual SocketAddress GetSockName() = 0;
102
+
103
+ // Returns an AsyncWrap object with the same lifetime as this object.
104
+ virtual AsyncWrap* GetAsyncWrap() = 0;
105
+
106
+ void set_listener(UDPListener* listener);
107
+ UDPListener* listener() const;
108
+
109
+ static UDPWrapBase* FromObject(v8::Local<v8::Object> obj);
110
+
111
+ static void RecvStart(const v8::FunctionCallbackInfo<v8::Value>& args);
112
+ static void RecvStop(const v8::FunctionCallbackInfo<v8::Value>& args);
113
+ static void AddMethods(Environment* env, v8::Local<v8::FunctionTemplate> t);
114
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
115
+
116
+ private:
117
+ UDPListener* listener_ = nullptr;
118
+ };
119
+
120
+ class UDPWrap final : public HandleWrap,
121
+ public UDPWrapBase,
122
+ public UDPListener {
123
+ public:
124
+ enum SocketType {
125
+ SOCKET
126
+ };
127
+ static void Initialize(v8::Local<v8::Object> target,
128
+ v8::Local<v8::Value> unused,
129
+ v8::Local<v8::Context> context,
130
+ void* priv);
131
+ static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
132
+ static void GetFD(const v8::FunctionCallbackInfo<v8::Value>& args);
133
+ static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
134
+ static void Open(const v8::FunctionCallbackInfo<v8::Value>& args);
135
+ static void Bind(const v8::FunctionCallbackInfo<v8::Value>& args);
136
+ static void Connect(const v8::FunctionCallbackInfo<v8::Value>& args);
137
+ static void Send(const v8::FunctionCallbackInfo<v8::Value>& args);
138
+ static void Bind6(const v8::FunctionCallbackInfo<v8::Value>& args);
139
+ static void Connect6(const v8::FunctionCallbackInfo<v8::Value>& args);
140
+ static void Send6(const v8::FunctionCallbackInfo<v8::Value>& args);
141
+ static void Disconnect(const v8::FunctionCallbackInfo<v8::Value>& args);
142
+ static void AddMembership(const v8::FunctionCallbackInfo<v8::Value>& args);
143
+ static void DropMembership(const v8::FunctionCallbackInfo<v8::Value>& args);
144
+ static void AddSourceSpecificMembership(
145
+ const v8::FunctionCallbackInfo<v8::Value>& args);
146
+ static void DropSourceSpecificMembership(
147
+ const v8::FunctionCallbackInfo<v8::Value>& args);
148
+ static void SetMulticastInterface(
149
+ const v8::FunctionCallbackInfo<v8::Value>& args);
150
+ static void BufferSize(const v8::FunctionCallbackInfo<v8::Value>& args);
151
+ static void GetSendQueueSize(const v8::FunctionCallbackInfo<v8::Value>& args);
152
+ static void GetSendQueueCount(
153
+ const v8::FunctionCallbackInfo<v8::Value>& args);
154
+
155
+ // UDPListener implementation
156
+ uv_buf_t OnAlloc(size_t suggested_size) override;
157
+ void OnRecv(ssize_t nread,
158
+ const uv_buf_t& buf,
159
+ const sockaddr* addr,
160
+ unsigned int flags) override;
161
+ ReqWrap<uv_udp_send_t>* CreateSendWrap(size_t msg_size) override;
162
+ void OnSendDone(ReqWrap<uv_udp_send_t>* wrap, int status) override;
163
+
164
+ // UDPWrapBase implementation
165
+ int RecvStart() override;
166
+ int RecvStop() override;
167
+ ssize_t Send(uv_buf_t* bufs,
168
+ size_t nbufs,
169
+ const sockaddr* addr) override;
170
+
171
+ SocketAddress GetPeerName() override;
172
+ SocketAddress GetSockName() override;
173
+
174
+ AsyncWrap* GetAsyncWrap() override;
175
+
176
+ inline uv_udp_t* GetLibuvHandle() { return &handle_; }
177
+
178
+ static v8::MaybeLocal<v8::Object> Instantiate(Environment* env,
179
+ AsyncWrap* parent,
180
+ SocketType type);
181
+ SET_NO_MEMORY_INFO()
182
+ SET_MEMORY_INFO_NAME(UDPWrap)
183
+ SET_SELF_SIZE(UDPWrap)
184
+
185
+ private:
186
+ typedef uv_udp_t HandleType;
187
+
188
+ template <typename T,
189
+ int (*F)(const typename T::HandleType*, sockaddr*, int*)>
190
+ friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&);
191
+
192
+ UDPWrap(Environment* env, v8::Local<v8::Object> object);
193
+
194
+ static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
195
+ int family);
196
+ static void DoConnect(const v8::FunctionCallbackInfo<v8::Value>& args,
197
+ int family);
198
+ static void DoSend(const v8::FunctionCallbackInfo<v8::Value>& args,
199
+ int family);
200
+ static void SetMembership(const v8::FunctionCallbackInfo<v8::Value>& args,
201
+ uv_membership membership);
202
+ static void SetSourceMembership(
203
+ const v8::FunctionCallbackInfo<v8::Value>& args,
204
+ uv_membership membership);
205
+
206
+ static void OnAlloc(uv_handle_t* handle,
207
+ size_t suggested_size,
208
+ uv_buf_t* buf);
209
+ static void OnRecv(uv_udp_t* handle,
210
+ ssize_t nread,
211
+ const uv_buf_t* buf,
212
+ const struct sockaddr* addr,
213
+ unsigned int flags);
214
+
215
+ uv_udp_t handle_;
216
+
217
+ bool current_send_has_callback_;
218
+ v8::Local<v8::Object> current_send_req_wrap_;
219
+ };
220
+
221
+ int sockaddr_for_family(int address_family,
222
+ const char* address,
223
+ const unsigned short port,
224
+ sockaddr_storage* addr);
225
+
226
+ } // namespace node
227
+
228
+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
229
+
230
+ #endif // SRC_UDP_WRAP_H_
@@ -0,0 +1,6 @@
1
+ // This is an auto generated file, please do not edit.
2
+ // Refer to tools/dep_updaters/update-undici.sh
3
+ #ifndef SRC_UNDICI_VERSION_H_
4
+ #define SRC_UNDICI_VERSION_H_
5
+ #define UNDICI_VERSION "7.14.0"
6
+ #endif // SRC_UNDICI_VERSION_H_