Skip to content

Commit e032d07

Browse files
committed
quic: add quic
Signed-off-by: James M Snell <jasnell@gmail.com>
1 parent 5788fdb commit e032d07

18 files changed

+12931
-1
lines changed

node.gyp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@
764764
'src/node_watchdog.h',
765765
'src/node_worker.h',
766766
'src/pipe_wrap.h',
767+
'src/quic/quic.cc',
767768
'src/req_wrap.h',
768769
'src/req_wrap-inl.h',
769770
'src/spawn_sync.h',
@@ -929,6 +930,23 @@
929930
}
930931
] ]
931932
} ],
933+
[ 'openssl_quic=="true"', {
934+
'sources': [
935+
'src/quic/buffer.cc',
936+
'src/quic/crypto.cc',
937+
'src/quic/endpoint.cc',
938+
'src/quic/session.cc',
939+
'src/quic/stream.cc',
940+
'src/quic/buffer.h',
941+
'src/quic/crypto.h',
942+
'src/quic/endpoint.h',
943+
'src/quic/qlog.h',
944+
'src/quic/quic.h',
945+
'src/quic/session.h',
946+
'src/quic/stats.h',
947+
'src/quic/stream.h'
948+
]
949+
}],
932950
[ 'node_use_openssl=="true"', {
933951
'sources': [
934952
'src/crypto/crypto_aes.cc',

src/async_wrap.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#include "base_object.h"
2828
#include "v8.h"
2929

30+
#if HAVE_OPENSSL
31+
# include <openssl/crypto.h>
32+
#endif
33+
3034
#include <cstdint>
3135

3236
namespace node {
@@ -103,10 +107,25 @@ namespace node {
103107
#define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V)
104108
#endif // HAVE_INSPECTOR
105109

110+
#ifdef OPENSSL_INFO_QUIC
111+
#define NODE_ASYNC_QUIC_PROVIDER_TYPES(V) \
112+
V(JSQUICBUFFERCONSUMER) \
113+
V(STREAMSOURCE) \
114+
V(STREAMBASESOURCE) \
115+
V(QLOGSTREAM) \
116+
V(QUICENDPOINT) \
117+
V(QUICSENDWRAP) \
118+
V(QUICSESSION) \
119+
V(QUICSTREAM)
120+
#else
121+
#define NODE_ASYNC_QUIC_PROVIDER_TYPES(V)
122+
#endif
123+
106124
#define NODE_ASYNC_PROVIDER_TYPES(V) \
107125
NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \
108126
NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) \
109-
NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V)
127+
NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) \
128+
NODE_ASYNC_QUIC_PROVIDER_TYPES(V)
110129

111130
class Environment;
112131
class DestroyParam;

src/node_binding.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
V(pipe_wrap) \
6666
V(process_wrap) \
6767
V(process_methods) \
68+
V(quic) \
6869
V(report) \
6970
V(serdes) \
7071
V(signal_wrap) \

src/node_errors.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void OnFatalError(const char* location, const char* message);
5959
V(ERR_INVALID_ADDRESS, Error) \
6060
V(ERR_INVALID_ARG_VALUE, TypeError) \
6161
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
62+
V(ERR_ILLEGAL_CONSTRUCTOR, Error) \
6263
V(ERR_INVALID_ARG_TYPE, TypeError) \
6364
V(ERR_INVALID_MODULE, Error) \
6465
V(ERR_INVALID_THIS, TypeError) \
@@ -71,6 +72,10 @@ void OnFatalError(const char* location, const char* message);
7172
V(ERR_MISSING_PLATFORM_FOR_WORKER, Error) \
7273
V(ERR_NON_CONTEXT_AWARE_DISABLED, Error) \
7374
V(ERR_OUT_OF_RANGE, RangeError) \
75+
V(ERR_QUIC_ENDPOINT_INITIAL_PACKET_FAILURE, Error) \
76+
V(ERR_QUIC_ENDPOINT_SEND_FAILURE, Error) \
77+
V(ERR_QUIC_FAILURE_SETTING_SNI_CONTEXT, Error) \
78+
V(ERR_QUIC_INTERNAL_ERROR, Error) \
7479
V(ERR_SCRIPT_EXECUTION_INTERRUPTED, Error) \
7580
V(ERR_SCRIPT_EXECUTION_TIMEOUT, Error) \
7681
V(ERR_STRING_TOO_LONG, Error) \
@@ -144,12 +149,18 @@ ERRORS_WITH_CODE(V)
144149
V(ERR_DLOPEN_FAILED, "DLOpen failed") \
145150
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
146151
"Context not associated with Node.js environment") \
152+
V(ERR_ILLEGAL_CONSTRUCTOR, "Illegal constructor") \
147153
V(ERR_INVALID_ADDRESS, "Invalid socket address") \
148154
V(ERR_INVALID_MODULE, "No such module") \
149155
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \
150156
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
151157
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
152158
V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \
159+
V(ERR_QUIC_ENDPOINT_INITIAL_PACKET_FAILURE, \
160+
"Failure processing initial packet") \
161+
V(ERR_QUIC_ENDPOINT_SEND_FAILURE, "Failure to send packet") \
162+
V(ERR_QUIC_FAILURE_SETTING_SNI_CONTEXT, "Failure setting SNI context") \
163+
V(ERR_QUIC_INTERNAL_ERROR, "Internal error: %s") \
153164
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, \
154165
"A message object could not be deserialized successfully in the target " \
155166
"vm.Context") \

0 commit comments

Comments
 (0)