@encharm/cws 4.5.2 → 4.6.0
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.
- package/CHANGELOG.md +9 -0
- package/CLAUDE.md +81 -0
- package/README.md +10 -5
- package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_arm64_node115.node +0 -0
- package/dist/bindings/cws_linux_arm64_node127.node +0 -0
- package/dist/bindings/cws_linux_arm64_node137.node +0 -0
- package/dist/bindings/cws_linux_arm64_node147.node +0 -0
- package/dist/bindings/cws_linux_x64_node115.node +0 -0
- package/dist/bindings/cws_linux_x64_node127.node +0 -0
- package/dist/bindings/cws_linux_x64_node137.node +0 -0
- package/dist/bindings/cws_linux_x64_node147.node +0 -0
- package/dist/bindings/cws_win32_x64_node115.node +0 -0
- package/dist/bindings/cws_win32_x64_node127.node +0 -0
- package/dist/bindings/cws_win32_x64_node137.node +0 -0
- package/dist/bindings/cws_win32_x64_node147.node +0 -0
- package/package.json +1 -1
- package/src/Addon.cpp +2 -1
- package/src/Addon.h +70 -14
- package/src/Hub.h +1 -0
- package/src/Networking.h +11 -0
- package/src/Socket.h +201 -6
- package/src/WebSocket.cpp +4 -1
- package/src/cSNode.cpp +2 -0
- package/src/cSNode.h +4 -0
- package/src/headers/24/tracing/agent.h +195 -0
- package/src/headers/24/tracing/trace_event.h +722 -0
- package/src/headers/26/acorn_version.h +6 -0
- package/src/headers/26/aliased_buffer-inl.h +264 -0
- package/src/headers/26/aliased_buffer.h +205 -0
- package/src/headers/26/aliased_struct-inl.h +143 -0
- package/src/headers/26/aliased_struct.h +248 -0
- package/src/headers/26/amaro_version.h +6 -0
- package/src/headers/26/async_context_frame.h +33 -0
- package/src/headers/26/async_wrap-inl.h +123 -0
- package/src/headers/26/async_wrap.h +254 -0
- package/src/headers/26/base_object-inl.h +333 -0
- package/src/headers/26/base_object.h +339 -0
- package/src/headers/26/base_object_types.h +76 -0
- package/src/headers/26/blob_serializer_deserializer-inl.h +385 -0
- package/src/headers/26/blob_serializer_deserializer.h +142 -0
- package/src/headers/26/builtin_info.h +57 -0
- package/src/headers/26/callback_queue-inl.h +97 -0
- package/src/headers/26/callback_queue.h +79 -0
- package/src/headers/26/cares_wrap.h +475 -0
- package/src/headers/26/cleanup_queue-inl.h +36 -0
- package/src/headers/26/cleanup_queue.h +79 -0
- package/src/headers/26/compile_cache.h +134 -0
- package/src/headers/26/connect_wrap.h +26 -0
- package/src/headers/26/connection_wrap.h +30 -0
- package/src/headers/26/cppgc_helpers-inl.h +69 -0
- package/src/headers/26/cppgc_helpers.h +162 -0
- package/src/headers/26/crypto/crypto_aes.h +107 -0
- package/src/headers/26/crypto/crypto_argon2.h +88 -0
- package/src/headers/26/crypto/crypto_bio.h +193 -0
- package/src/headers/26/crypto/crypto_chacha20_poly1305.h +62 -0
- package/src/headers/26/crypto/crypto_cipher.h +291 -0
- package/src/headers/26/crypto/crypto_common.h +48 -0
- package/src/headers/26/crypto/crypto_context.h +219 -0
- package/src/headers/26/crypto/crypto_dh.h +104 -0
- package/src/headers/26/crypto/crypto_dsa.h +50 -0
- package/src/headers/26/crypto/crypto_ec.h +102 -0
- package/src/headers/26/crypto/crypto_hash.h +157 -0
- package/src/headers/26/crypto/crypto_hkdf.h +62 -0
- package/src/headers/26/crypto/crypto_hmac.h +92 -0
- package/src/headers/26/crypto/crypto_kem.h +131 -0
- package/src/headers/26/crypto/crypto_keygen.h +382 -0
- package/src/headers/26/crypto/crypto_keys.h +366 -0
- package/src/headers/26/crypto/crypto_kmac.h +79 -0
- package/src/headers/26/crypto/crypto_pbkdf2.h +76 -0
- package/src/headers/26/crypto/crypto_pqc.h +39 -0
- package/src/headers/26/crypto/crypto_random.h +127 -0
- package/src/headers/26/crypto/crypto_rsa.h +108 -0
- package/src/headers/26/crypto/crypto_scrypt.h +85 -0
- package/src/headers/26/crypto/crypto_sig.h +159 -0
- package/src/headers/26/crypto/crypto_spkac.h +21 -0
- package/src/headers/26/crypto/crypto_timing.h +20 -0
- package/src/headers/26/crypto/crypto_tls.h +342 -0
- package/src/headers/26/crypto/crypto_turboshake.h +105 -0
- package/src/headers/26/crypto/crypto_util.h +775 -0
- package/src/headers/26/crypto/crypto_x509.h +140 -0
- package/src/headers/26/dataqueue/queue.h +311 -0
- package/src/headers/26/debug_utils-inl.h +291 -0
- package/src/headers/26/debug_utils.h +200 -0
- package/src/headers/26/diagnosticfilename-inl.h +33 -0
- package/src/headers/26/embedded_data.h +17 -0
- package/src/headers/26/encoding_binding.h +59 -0
- package/src/headers/26/env-inl.h +956 -0
- package/src/headers/26/env.h +1294 -0
- package/src/headers/26/env_properties.h +562 -0
- package/src/headers/26/ffi/data.h +30 -0
- package/src/headers/26/ffi/fast.h +96 -0
- package/src/headers/26/ffi/jit_memory.h +26 -0
- package/src/headers/26/ffi/types.h +99 -0
- package/src/headers/26/handle_wrap.h +123 -0
- package/src/headers/26/histogram-inl.h +211 -0
- package/src/headers/26/histogram.h +474 -0
- package/src/headers/26/inspector/dom_storage_agent.h +68 -0
- package/src/headers/26/inspector/inspector_object_utils.h +38 -0
- package/src/headers/26/inspector/io_agent.h +30 -0
- package/src/headers/26/inspector/main_thread_interface.h +116 -0
- package/src/headers/26/inspector/network_agent.h +110 -0
- package/src/headers/26/inspector/network_inspector.h +45 -0
- package/src/headers/26/inspector/network_requests_buffer.h +195 -0
- package/src/headers/26/inspector/network_resource_manager.h +29 -0
- package/src/headers/26/inspector/node_json.h +24 -0
- package/src/headers/26/inspector/node_string.h +101 -0
- package/src/headers/26/inspector/notification_emitter.h +38 -0
- package/src/headers/26/inspector/protocol_helper.h +27 -0
- package/src/headers/26/inspector/runtime_agent.h +41 -0
- package/src/headers/26/inspector/storage_agent.h +33 -0
- package/src/headers/26/inspector/target_agent.h +59 -0
- package/src/headers/26/inspector/target_manager.h +70 -0
- package/src/headers/26/inspector/tracing_agent.h +43 -0
- package/src/headers/26/inspector/worker_agent.h +40 -0
- package/src/headers/26/inspector/worker_inspector.h +124 -0
- package/src/headers/26/inspector_agent.h +168 -0
- package/src/headers/26/inspector_io.h +78 -0
- package/src/headers/26/inspector_profiler.h +149 -0
- package/src/headers/26/inspector_socket.h +60 -0
- package/src/headers/26/inspector_socket_server.h +110 -0
- package/src/headers/26/js_native_api.h +634 -0
- package/src/headers/26/js_native_api_types.h +244 -0
- package/src/headers/26/js_native_api_v8.h +485 -0
- package/src/headers/26/js_native_api_v8_internals.h +45 -0
- package/src/headers/26/js_stream.h +57 -0
- package/src/headers/26/json_utils.h +172 -0
- package/src/headers/26/large_pages/node_large_page.h +34 -0
- package/src/headers/26/lru_cache-inl.h +69 -0
- package/src/headers/26/memory_tracker-inl.h +461 -0
- package/src/headers/26/memory_tracker.h +341 -0
- package/src/headers/26/module_wrap.h +231 -0
- package/src/headers/26/ncrypto.h +2008 -0
- package/src/headers/26/node.h +1693 -0
- package/src/headers/26/node_api.h +265 -0
- package/src/headers/26/node_api_internals.h +48 -0
- package/src/headers/26/node_api_types.h +58 -0
- package/src/headers/26/node_binding.h +170 -0
- package/src/headers/26/node_blob.h +160 -0
- package/src/headers/26/node_bob-inl.h +36 -0
- package/src/headers/26/node_bob.h +107 -0
- package/src/headers/26/node_buffer.h +92 -0
- package/src/headers/26/node_builtins.h +239 -0
- package/src/headers/26/node_concepts.h +46 -0
- package/src/headers/26/node_config_file.h +77 -0
- package/src/headers/26/node_constants.h +82 -0
- package/src/headers/26/node_context_data.h +171 -0
- package/src/headers/26/node_contextify.h +261 -0
- package/src/headers/26/node_crypto.h +66 -0
- package/src/headers/26/node_debug.h +30 -0
- package/src/headers/26/node_diagnostics_channel.h +121 -0
- package/src/headers/26/node_dir.h +52 -0
- package/src/headers/26/node_dotenv.h +45 -0
- package/src/headers/26/node_errors.h +378 -0
- package/src/headers/26/node_exit_code.h +54 -0
- package/src/headers/26/node_external_reference.h +171 -0
- package/src/headers/26/node_ffi.h +212 -0
- package/src/headers/26/node_file-inl.h +421 -0
- package/src/headers/26/node_file.h +561 -0
- package/src/headers/26/node_file_utils.h +39 -0
- package/src/headers/26/node_hash.h +212 -0
- package/src/headers/26/node_http2.h +1202 -0
- package/src/headers/26/node_http2_state.h +159 -0
- package/src/headers/26/node_http_common-inl.h +199 -0
- package/src/headers/26/node_http_common.h +535 -0
- package/src/headers/26/node_i18n.h +132 -0
- package/src/headers/26/node_internals.h +485 -0
- package/src/headers/26/node_locks.h +184 -0
- package/src/headers/26/node_main_instance.h +67 -0
- package/src/headers/26/node_mem-inl.h +113 -0
- package/src/headers/26/node_mem.h +45 -0
- package/src/headers/26/node_messaging.h +389 -0
- package/src/headers/26/node_metadata.h +172 -0
- package/src/headers/26/node_modules.h +102 -0
- package/src/headers/26/node_mutex.h +323 -0
- package/src/headers/26/node_object_wrap.h +145 -0
- package/src/headers/26/node_options-inl.h +524 -0
- package/src/headers/26/node_options.h +710 -0
- package/src/headers/26/node_perf.h +167 -0
- package/src/headers/26/node_perf_common.h +103 -0
- package/src/headers/26/node_platform.h +290 -0
- package/src/headers/26/node_process-inl.h +26 -0
- package/src/headers/26/node_process.h +112 -0
- package/src/headers/26/node_profiling.h +38 -0
- package/src/headers/26/node_realm-inl.h +156 -0
- package/src/headers/26/node_realm.h +236 -0
- package/src/headers/26/node_report.h +43 -0
- package/src/headers/26/node_revert.h +82 -0
- package/src/headers/26/node_root_certs.h +2937 -0
- package/src/headers/26/node_sea.h +101 -0
- package/src/headers/26/node_shadow_realm.h +46 -0
- package/src/headers/26/node_snapshot_builder.h +57 -0
- package/src/headers/26/node_snapshotable.h +167 -0
- package/src/headers/26/node_sockaddr-inl.h +248 -0
- package/src/headers/26/node_sockaddr.h +459 -0
- package/src/headers/26/node_sqlite.h +607 -0
- package/src/headers/26/node_stat_watcher.h +73 -0
- package/src/headers/26/node_task_runner.h +92 -0
- package/src/headers/26/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/26/node_threadsafe_cow.h +105 -0
- package/src/headers/26/node_union_bytes.h +81 -0
- package/src/headers/26/node_url.h +101 -0
- package/src/headers/26/node_url_pattern.h +118 -0
- package/src/headers/26/node_v8.h +78 -0
- package/src/headers/26/node_v8_embedder.h +26 -0
- package/src/headers/26/node_v8_platform-inl.h +96 -0
- package/src/headers/26/node_version.h +116 -0
- package/src/headers/26/node_wasi.h +184 -0
- package/src/headers/26/node_wasm_web_api.h +55 -0
- package/src/headers/26/node_watchdog.h +164 -0
- package/src/headers/26/node_webstorage.h +62 -0
- package/src/headers/26/node_worker.h +162 -0
- package/src/headers/26/path.h +36 -0
- package/src/headers/26/permission/boolean_permission.h +50 -0
- package/src/headers/26/permission/fs_permission.h +192 -0
- package/src/headers/26/permission/permission.h +155 -0
- package/src/headers/26/permission/permission_base.h +79 -0
- package/src/headers/26/pipe_wrap.h +80 -0
- package/src/headers/26/quic/application.h +279 -0
- package/src/headers/26/quic/arena.h +373 -0
- package/src/headers/26/quic/bindingdata.h +440 -0
- package/src/headers/26/quic/cid.h +127 -0
- package/src/headers/26/quic/data.h +358 -0
- package/src/headers/26/quic/defs.h +417 -0
- package/src/headers/26/quic/endpoint.h +519 -0
- package/src/headers/26/quic/guard.h +5 -0
- package/src/headers/26/quic/http3.h +25 -0
- package/src/headers/26/quic/packet.h +166 -0
- package/src/headers/26/quic/preferredaddress.h +72 -0
- package/src/headers/26/quic/session.h +770 -0
- package/src/headers/26/quic/session_manager.h +107 -0
- package/src/headers/26/quic/sessionticket.h +110 -0
- package/src/headers/26/quic/streams.h +518 -0
- package/src/headers/26/quic/tlscontext.h +353 -0
- package/src/headers/26/quic/tokens.h +263 -0
- package/src/headers/26/quic/transportparams.h +184 -0
- package/src/headers/26/req_wrap-inl.h +175 -0
- package/src/headers/26/req_wrap.h +79 -0
- package/src/headers/26/spawn_sync.h +243 -0
- package/src/headers/26/stream_base-inl.h +170 -0
- package/src/headers/26/stream_base.h +487 -0
- package/src/headers/26/stream_pipe.h +76 -0
- package/src/headers/26/stream_wrap.h +137 -0
- package/src/headers/26/string_bytes.h +114 -0
- package/src/headers/26/string_decoder-inl.h +31 -0
- package/src/headers/26/string_decoder.h +49 -0
- package/src/headers/26/tcp_wrap.h +138 -0
- package/src/headers/26/threadpoolwork-inl.h +70 -0
- package/src/headers/26/timer_wrap-inl.h +32 -0
- package/src/headers/26/timer_wrap.h +87 -0
- package/src/headers/26/timers.h +70 -0
- package/src/headers/26/tracing/agent.h +125 -0
- package/src/headers/26/tracing/agent_legacy.h +146 -0
- package/src/headers/26/tracing/agent_perfetto.h +145 -0
- package/src/headers/26/tracing/node_trace_buffer.h +91 -0
- package/src/headers/26/tracing/node_trace_writer.h +79 -0
- package/src/headers/26/tracing/trace_event.h +27 -0
- package/src/headers/26/tracing/trace_event_helper.h +40 -0
- package/src/headers/26/tracing/trace_event_legacy.h +1113 -0
- package/src/headers/26/tracing/trace_event_legacy_inl.h +711 -0
- package/src/headers/26/tracing/trace_event_perfetto.h +47 -0
- package/src/headers/26/tracing/traced_value.h +167 -0
- package/src/headers/26/tty_wrap.h +65 -0
- package/src/headers/26/udp_wrap.h +231 -0
- package/src/headers/26/undici_version.h +6 -0
- package/src/headers/26/util-inl.h +788 -0
- package/src/headers/26/util.h +1207 -0
- package/src/headers/26/v8-cpp-heap-external.h +56 -0
- package/src/headers/26/v8-external-memory-accounter.h +60 -0
- package/src/headers/26/v8-fast-api-calls.h +784 -0
- package/src/headers/26/v8-inspector-protocol.h +13 -0
- package/src/headers/26/v8-inspector.h +458 -0
- package/src/headers/26/v8-metrics.h +273 -0
- package/src/headers/26/v8-trace-categories.h +28 -0
- package/src/headers/26/v8-unwinder-state.h +30 -0
- package/src/headers/26/v8-util.h +549 -0
- package/src/headers/26/v8-value-serializer-version.h +24 -0
- package/src/headers/26/v8-version-string.h +38 -0
- package/src/headers/26/v8-wasm-trap-handler-posix.h +31 -0
- package/src/headers/26/v8-wasm-trap-handler-win.h +28 -0
- package/src/headers/26/zlib_version.h +6 -0
|
@@ -0,0 +1,80 @@
|
|
|
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_PIPE_WRAP_H_
|
|
23
|
+
#define SRC_PIPE_WRAP_H_
|
|
24
|
+
|
|
25
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
+
|
|
27
|
+
#include "async_wrap.h"
|
|
28
|
+
#include "connection_wrap.h"
|
|
29
|
+
|
|
30
|
+
namespace node {
|
|
31
|
+
|
|
32
|
+
class ExternalReferenceRegistry;
|
|
33
|
+
class Environment;
|
|
34
|
+
|
|
35
|
+
class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
|
|
36
|
+
public:
|
|
37
|
+
enum SocketType {
|
|
38
|
+
SOCKET,
|
|
39
|
+
SERVER,
|
|
40
|
+
IPC
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
static v8::MaybeLocal<v8::Object> Instantiate(Environment* env,
|
|
44
|
+
AsyncWrap* parent,
|
|
45
|
+
SocketType type);
|
|
46
|
+
static void Initialize(v8::Local<v8::Object> target,
|
|
47
|
+
v8::Local<v8::Value> unused,
|
|
48
|
+
v8::Local<v8::Context> context,
|
|
49
|
+
void* priv);
|
|
50
|
+
|
|
51
|
+
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
|
52
|
+
SET_NO_MEMORY_INFO()
|
|
53
|
+
SET_MEMORY_INFO_NAME(PipeWrap)
|
|
54
|
+
SET_SELF_SIZE(PipeWrap)
|
|
55
|
+
|
|
56
|
+
private:
|
|
57
|
+
PipeWrap(Environment* env,
|
|
58
|
+
v8::Local<v8::Object> object,
|
|
59
|
+
ProviderType provider,
|
|
60
|
+
bool ipc);
|
|
61
|
+
|
|
62
|
+
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
63
|
+
static void Bind(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
64
|
+
static void Listen(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
65
|
+
static void Connect(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
66
|
+
static void Open(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
67
|
+
|
|
68
|
+
#ifdef _WIN32
|
|
69
|
+
static void SetPendingInstances(
|
|
70
|
+
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
71
|
+
#endif
|
|
72
|
+
static void Fchmod(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
} // namespace node
|
|
77
|
+
|
|
78
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
79
|
+
|
|
80
|
+
#endif // SRC_PIPE_WRAP_H_
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
4
|
+
|
|
5
|
+
#include <optional>
|
|
6
|
+
#include <variant>
|
|
7
|
+
|
|
8
|
+
#include "base_object.h"
|
|
9
|
+
#include "bindingdata.h"
|
|
10
|
+
#include "defs.h"
|
|
11
|
+
#include "session.h"
|
|
12
|
+
#include "sessionticket.h"
|
|
13
|
+
#include "streams.h"
|
|
14
|
+
|
|
15
|
+
namespace node::quic {
|
|
16
|
+
|
|
17
|
+
// Parsed session ticket application data, produced by
|
|
18
|
+
// Application::ParseTicketData() before ALPN negotiation and consumed
|
|
19
|
+
// by Application::ApplySessionTicketData() after.
|
|
20
|
+
struct DefaultTicketData {};
|
|
21
|
+
struct Http3TicketData {
|
|
22
|
+
uint64_t max_field_section_size;
|
|
23
|
+
uint64_t qpack_max_dtable_capacity;
|
|
24
|
+
uint64_t qpack_encoder_max_dtable_capacity;
|
|
25
|
+
uint64_t qpack_blocked_streams;
|
|
26
|
+
bool enable_connect_protocol;
|
|
27
|
+
bool enable_datagrams;
|
|
28
|
+
};
|
|
29
|
+
using PendingTicketAppData =
|
|
30
|
+
std::variant<std::monostate, DefaultTicketData, Http3TicketData>;
|
|
31
|
+
|
|
32
|
+
// An Application implements the ALPN-protocol specific semantics on behalf
|
|
33
|
+
// of a QUIC Session.
|
|
34
|
+
class Session::Application : public MemoryRetainer {
|
|
35
|
+
public:
|
|
36
|
+
using Options = Session::Application_Options;
|
|
37
|
+
|
|
38
|
+
Application(Session* session, const Options& options);
|
|
39
|
+
DISALLOW_COPY_AND_MOVE(Application)
|
|
40
|
+
|
|
41
|
+
// Get the active options for this application. These may differ from the
|
|
42
|
+
// options passed at construction time since some options can be negotiated.
|
|
43
|
+
virtual const Options& options() const = 0;
|
|
44
|
+
|
|
45
|
+
// The type of Application, exposed via the session state so JS
|
|
46
|
+
// can observe which Application was selected after ALPN negotiation.
|
|
47
|
+
// This is used primarily for testing/debugging.
|
|
48
|
+
enum class Type : uint8_t {
|
|
49
|
+
NONE = 0, // Not yet selected (server pre-negotiation)
|
|
50
|
+
DEFAULT = 1, // DefaultApplication (non-h3 ALPN)
|
|
51
|
+
HTTP3 = 2, // Http3ApplicationImpl (h3 / h3-XX ALPN)
|
|
52
|
+
};
|
|
53
|
+
virtual Type type() const = 0;
|
|
54
|
+
|
|
55
|
+
virtual bool Start();
|
|
56
|
+
|
|
57
|
+
// Returns true if Start() has been called successfully.
|
|
58
|
+
virtual bool is_started() const { return false; }
|
|
59
|
+
|
|
60
|
+
// Called when the server rejects 0-RTT early data. The application
|
|
61
|
+
// must destroy all streams that were opened during the 0-RTT phase
|
|
62
|
+
// since ngtcp2 has already discarded their internal state.
|
|
63
|
+
virtual void EarlyDataRejected() = 0;
|
|
64
|
+
|
|
65
|
+
// The "no error code" is the application-level error code that signals
|
|
66
|
+
// "no error". Per the QUIC spec, this can vary by application protocol
|
|
67
|
+
// and is not necessarily 0.
|
|
68
|
+
virtual error_code GetNoErrorCode() const = 0;
|
|
69
|
+
|
|
70
|
+
// The "internal error code" is the application-level error code used
|
|
71
|
+
// to signal a non-specific failure when no more specific code has
|
|
72
|
+
// been provided by the caller. For example, `writer.fail(reason)` on
|
|
73
|
+
// the JS side uses this code when `reason` is not a `QuicError`
|
|
74
|
+
// carrying an explicit code. For HTTP/3 this is
|
|
75
|
+
// `NGHTTP3_H3_INTERNAL_ERROR` (0x102); for raw QUIC applications
|
|
76
|
+
// there is no defined application code so we fall back to
|
|
77
|
+
// NGTCP2_INTERNAL_ERROR (0x1).
|
|
78
|
+
virtual error_code GetInternalErrorCode() const = 0;
|
|
79
|
+
|
|
80
|
+
// The "request rejected" code is sent on RESET_STREAM when an incoming
|
|
81
|
+
// request stream is rejected without any application processing (e.g.
|
|
82
|
+
// the session has no consumer for it), so the peer learns the request
|
|
83
|
+
// was not processed. For HTTP/3 this is NGHTTP3_H3_REQUEST_REJECTED
|
|
84
|
+
// (0x10b); other applications have no such semantic and reuse the
|
|
85
|
+
// "no error" code.
|
|
86
|
+
virtual error_code GetRequestRejectedCode() const = 0;
|
|
87
|
+
|
|
88
|
+
// Called after Session::Receive processes a packet, outside all callback
|
|
89
|
+
// scopes. Applications can use this to handle deferred operations that
|
|
90
|
+
// require calling into JS (e.g., HTTP/3 GOAWAY processing).
|
|
91
|
+
virtual void PostReceive() {}
|
|
92
|
+
|
|
93
|
+
// Called when ngtcp2 notifies us that a new remote stream has been
|
|
94
|
+
// opened. The Application decides whether to create a Stream object
|
|
95
|
+
// (and fire the JS onstream callback) based on the stream type. For
|
|
96
|
+
// example, HTTP/3 only creates Stream objects for bidi streams since
|
|
97
|
+
// uni streams are managed internally by nghttp3.
|
|
98
|
+
virtual bool ReceiveStreamOpen(stream_id id) = 0;
|
|
99
|
+
|
|
100
|
+
// Session will forward all received stream data immediately on to the
|
|
101
|
+
// Application. The only additional processing the Session does is to
|
|
102
|
+
// automatically adjust the session-level flow control window. It is up to
|
|
103
|
+
// the Application to do the same for the Stream-level flow control.
|
|
104
|
+
virtual bool ReceiveStreamData(stream_id id,
|
|
105
|
+
const uint8_t* data,
|
|
106
|
+
size_t datalen,
|
|
107
|
+
const Stream::ReceiveDataFlags& flags,
|
|
108
|
+
void* stream_user_data) = 0;
|
|
109
|
+
|
|
110
|
+
// Session will forward all data acknowledgements for a stream to the
|
|
111
|
+
// Application.
|
|
112
|
+
virtual bool AcknowledgeStreamData(stream_id id, size_t datalen);
|
|
113
|
+
|
|
114
|
+
// Called to determine if a Header can be added to this application.
|
|
115
|
+
// Applications that do not support headers will always return false.
|
|
116
|
+
virtual bool CanAddHeader(size_t current_count,
|
|
117
|
+
size_t current_headers_length,
|
|
118
|
+
size_t this_header_length) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Called when ngtcp2 reports NGTCP2_ERR_STREAM_SHUT_WR for a stream.
|
|
123
|
+
// Applications that manage their own framing (e.g., HTTP/3) must inform
|
|
124
|
+
// their protocol layer that the stream's write side is shut so it stops
|
|
125
|
+
// queuing data for that stream. The default is a no-op.
|
|
126
|
+
virtual void StreamWriteShut(stream_id id) {}
|
|
127
|
+
|
|
128
|
+
// Called to mark the identified stream as being blocked. Not all
|
|
129
|
+
// Application types will support blocked streams, and those that do will do
|
|
130
|
+
// so differently.
|
|
131
|
+
virtual void BlockStream(stream_id id) {}
|
|
132
|
+
|
|
133
|
+
// Called when the session determines that there is outbound data available
|
|
134
|
+
// to send for the given stream.
|
|
135
|
+
virtual void ResumeStream(stream_id id) {}
|
|
136
|
+
|
|
137
|
+
// Called when the Session determines that the maximum number of
|
|
138
|
+
// remotely-initiated unidirectional streams has been extended. Not all
|
|
139
|
+
// Application types will require this notification so the default is to do
|
|
140
|
+
// nothing.
|
|
141
|
+
virtual void ExtendMaxStreams(EndpointLabel label,
|
|
142
|
+
Direction direction,
|
|
143
|
+
uint64_t max_streams) {}
|
|
144
|
+
|
|
145
|
+
// Returns true if the application manages stream FIN internally (e.g.,
|
|
146
|
+
// HTTP/3 uses nghttp3 which sends FIN via the fin flag in writev_stream).
|
|
147
|
+
// When true, the stream infrastructure must NOT call
|
|
148
|
+
// ngtcp2_conn_shutdown_stream_write when the JS write side ends —
|
|
149
|
+
// the application protocol layer handles it.
|
|
150
|
+
virtual bool stream_fin_managed_by_application() const { return false; }
|
|
151
|
+
|
|
152
|
+
// Called when the Session determines that the flow control window for the
|
|
153
|
+
// given stream has been expanded. Not all Application types will require
|
|
154
|
+
// this notification so the default is to do nothing.
|
|
155
|
+
virtual void ExtendMaxStreamData(Stream* stream, uint64_t max_data) {
|
|
156
|
+
Debug(session_, "Application extending max stream data");
|
|
157
|
+
// By default do nothing.
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Different Applications may wish to set some application data in the
|
|
161
|
+
// session ticket (e.g. http/3 would set server settings in the application
|
|
162
|
+
// data). The first byte written MUST be the Application::Type enum value.
|
|
163
|
+
// By default, writes just the type byte.
|
|
164
|
+
virtual void CollectSessionTicketAppData(
|
|
165
|
+
SessionTicket::AppData* app_data) const;
|
|
166
|
+
|
|
167
|
+
// Different Applications may set some application data in the session
|
|
168
|
+
// ticket (e.g. http/3 would set server settings in the application data).
|
|
169
|
+
// By default, there's nothing to get.
|
|
170
|
+
virtual SessionTicket::AppData::Status ExtractSessionTicketAppData(
|
|
171
|
+
const SessionTicket::AppData& app_data,
|
|
172
|
+
SessionTicket::AppData::Source::Flag flag);
|
|
173
|
+
|
|
174
|
+
// Validates parsed ticket data against current application options.
|
|
175
|
+
// Returns false if the stored settings are more permissive than the
|
|
176
|
+
// current config (e.g., a feature was enabled when the ticket was
|
|
177
|
+
// issued but is now disabled).
|
|
178
|
+
static bool ValidateTicketData(const PendingTicketAppData& data,
|
|
179
|
+
const Application_Options& options);
|
|
180
|
+
|
|
181
|
+
// Parse session ticket app data before ALPN negotiation. Reads the
|
|
182
|
+
// type byte and dispatches to the appropriate application-specific
|
|
183
|
+
// parser. Returns std::nullopt if parsing fails.
|
|
184
|
+
static std::optional<PendingTicketAppData> ParseTicketData(
|
|
185
|
+
const uv_buf_t& data);
|
|
186
|
+
|
|
187
|
+
// Called after ALPN negotiation to validate and apply previously
|
|
188
|
+
// parsed session ticket app data. Returns false if the data is
|
|
189
|
+
// incompatible (e.g., type mismatch or settings downgrade), which
|
|
190
|
+
// causes the handshake to fail.
|
|
191
|
+
virtual bool ApplySessionTicketData(const PendingTicketAppData& data) = 0;
|
|
192
|
+
|
|
193
|
+
// Notifies the Application that the identified stream has been closed.
|
|
194
|
+
virtual void ReceiveStreamClose(Stream* stream,
|
|
195
|
+
QuicError&& error = QuicError());
|
|
196
|
+
|
|
197
|
+
// Notifies the Application that the identified stream has been reset.
|
|
198
|
+
virtual void ReceiveStreamReset(Stream* stream,
|
|
199
|
+
uint64_t final_size,
|
|
200
|
+
QuicError&& error = QuicError());
|
|
201
|
+
|
|
202
|
+
// Notifies the Application that the identified stream should stop sending.
|
|
203
|
+
virtual void ReceiveStreamStopSending(Stream* stream,
|
|
204
|
+
QuicError&& error = QuicError());
|
|
205
|
+
|
|
206
|
+
// Submits an outbound block of headers for the given stream. Not all
|
|
207
|
+
// Application types will support headers, in which case this function
|
|
208
|
+
// should return false.
|
|
209
|
+
virtual bool SendHeaders(const Stream& stream,
|
|
210
|
+
HeadersKind kind,
|
|
211
|
+
const v8::Local<v8::Array>& headers,
|
|
212
|
+
HeadersFlags flags = HeadersFlags::NONE) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Returns true if the application protocol supports sending and
|
|
217
|
+
// receiving headers on streams (e.g. HTTP/3). Applications that
|
|
218
|
+
// do not support headers should return false (the default).
|
|
219
|
+
virtual bool SupportsHeaders() const { return false; }
|
|
220
|
+
|
|
221
|
+
// True if this application dispatches the session-level stream
|
|
222
|
+
// callbacks (onheaders et al) for incoming streams when they are
|
|
223
|
+
// registered on the session.
|
|
224
|
+
virtual bool SupportsStreamCallbacks() const { return false; }
|
|
225
|
+
|
|
226
|
+
// Initiates application-level graceful shutdown signaling (e.g.,
|
|
227
|
+
// HTTP/3 GOAWAY). Called when Session::Close(GRACEFUL) is invoked.
|
|
228
|
+
virtual void BeginShutdown() {}
|
|
229
|
+
|
|
230
|
+
// Completes the application-level graceful shutdown. Called from
|
|
231
|
+
// FinishClose() before CONNECTION_CLOSE is sent. For HTTP/3, this
|
|
232
|
+
// sends the final GOAWAY with the actual last accepted stream ID.
|
|
233
|
+
virtual void CompleteShutdown() {}
|
|
234
|
+
|
|
235
|
+
// Set the priority level of the stream if supported by the application. Not
|
|
236
|
+
// all applications support priorities, in which case this function is a
|
|
237
|
+
// non-op.
|
|
238
|
+
virtual void SetStreamPriority(
|
|
239
|
+
const Stream& stream,
|
|
240
|
+
StreamPriority priority = StreamPriority::DEFAULT,
|
|
241
|
+
StreamPriorityFlags flags = StreamPriorityFlags::NON_INCREMENTAL) {}
|
|
242
|
+
|
|
243
|
+
struct StreamPriorityResult {
|
|
244
|
+
StreamPriority priority;
|
|
245
|
+
StreamPriorityFlags flags;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// Get the priority level of the stream if supported by the application. Not
|
|
249
|
+
// all applications support priorities, in which case this function returns
|
|
250
|
+
// the default stream priority.
|
|
251
|
+
virtual StreamPriorityResult GetStreamPriority(const Stream& stream) {
|
|
252
|
+
return {StreamPriority::DEFAULT, StreamPriorityFlags::NON_INCREMENTAL};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
virtual int GetStreamData(StreamData* data) = 0;
|
|
256
|
+
virtual bool StreamCommit(StreamData* data, size_t datalen) = 0;
|
|
257
|
+
|
|
258
|
+
inline Environment* env() const { return session().env(); }
|
|
259
|
+
|
|
260
|
+
inline Session& session() {
|
|
261
|
+
CHECK_NOT_NULL(session_);
|
|
262
|
+
return *session_;
|
|
263
|
+
}
|
|
264
|
+
inline const Session& session() const {
|
|
265
|
+
CHECK_NOT_NULL(session_);
|
|
266
|
+
return *session_;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private:
|
|
270
|
+
Session* session_ = nullptr;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// Create a DefaultApplication for the given session.
|
|
274
|
+
std::unique_ptr<Session::Application> CreateDefaultApplication(
|
|
275
|
+
Session* session, const Session::Application_Options& options);
|
|
276
|
+
|
|
277
|
+
} // namespace node::quic
|
|
278
|
+
|
|
279
|
+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|