Skip to content

Commit

Permalink
quic: add quic
Browse files Browse the repository at this point in the history
Signed-off-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
jasnell committed Apr 13, 2021
1 parent 25bdd2a commit 2ebd5f3
Show file tree
Hide file tree
Showing 18 changed files with 12,931 additions and 1 deletion.
18 changes: 18 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@
'src/node_watchdog.h',
'src/node_worker.h',
'src/pipe_wrap.h',
'src/quic/quic.cc',
'src/req_wrap.h',
'src/req_wrap-inl.h',
'src/spawn_sync.h',
Expand Down Expand Up @@ -929,6 +930,23 @@
}
] ]
} ],
[ 'openssl_quic=="true"', {
'sources': [
'src/quic/buffer.cc',
'src/quic/crypto.cc',
'src/quic/endpoint.cc',
'src/quic/session.cc',
'src/quic/stream.cc',
'src/quic/buffer.h',
'src/quic/crypto.h',
'src/quic/endpoint.h',
'src/quic/qlog.h',
'src/quic/quic.h',
'src/quic/session.h',
'src/quic/stats.h',
'src/quic/stream.h'
]
}],
[ 'node_use_openssl=="true"', {
'sources': [
'src/crypto/crypto_aes.cc',
Expand Down
21 changes: 20 additions & 1 deletion src/async_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include "base_object.h"
#include "v8.h"

#if HAVE_OPENSSL
# include <openssl/crypto.h>
#endif

#include <cstdint>

namespace node {
Expand Down Expand Up @@ -103,10 +107,25 @@ namespace node {
#define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V)
#endif // HAVE_INSPECTOR

#ifdef OPENSSL_INFO_QUIC
#define NODE_ASYNC_QUIC_PROVIDER_TYPES(V) \
V(JSQUICBUFFERCONSUMER) \
V(STREAMSOURCE) \
V(STREAMBASESOURCE) \
V(QLOGSTREAM) \
V(QUICENDPOINT) \
V(QUICSENDWRAP) \
V(QUICSESSION) \
V(QUICSTREAM)
#else
#define NODE_ASYNC_QUIC_PROVIDER_TYPES(V)
#endif

#define NODE_ASYNC_PROVIDER_TYPES(V) \
NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \
NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) \
NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V)
NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) \
NODE_ASYNC_QUIC_PROVIDER_TYPES(V)

class Environment;
class DestroyParam;
Expand Down
1 change: 1 addition & 0 deletions src/node_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
V(pipe_wrap) \
V(process_wrap) \
V(process_methods) \
V(quic) \
V(report) \
V(serdes) \
V(signal_wrap) \
Expand Down
11 changes: 11 additions & 0 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void OnFatalError(const char* location, const char* message);
V(ERR_INVALID_ADDRESS, Error) \
V(ERR_INVALID_ARG_VALUE, TypeError) \
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
V(ERR_ILLEGAL_CONSTRUCTOR, Error) \
V(ERR_INVALID_ARG_TYPE, TypeError) \
V(ERR_INVALID_MODULE, Error) \
V(ERR_INVALID_THIS, TypeError) \
Expand All @@ -71,6 +72,10 @@ void OnFatalError(const char* location, const char* message);
V(ERR_MISSING_PLATFORM_FOR_WORKER, Error) \
V(ERR_NON_CONTEXT_AWARE_DISABLED, Error) \
V(ERR_OUT_OF_RANGE, RangeError) \
V(ERR_QUIC_ENDPOINT_INITIAL_PACKET_FAILURE, Error) \
V(ERR_QUIC_ENDPOINT_SEND_FAILURE, Error) \
V(ERR_QUIC_FAILURE_SETTING_SNI_CONTEXT, Error) \
V(ERR_QUIC_INTERNAL_ERROR, Error) \
V(ERR_SCRIPT_EXECUTION_INTERRUPTED, Error) \
V(ERR_SCRIPT_EXECUTION_TIMEOUT, Error) \
V(ERR_STRING_TOO_LONG, Error) \
Expand Down Expand Up @@ -144,12 +149,18 @@ ERRORS_WITH_CODE(V)
V(ERR_DLOPEN_FAILED, "DLOpen failed") \
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
"Context not associated with Node.js environment") \
V(ERR_ILLEGAL_CONSTRUCTOR, "Illegal constructor") \
V(ERR_INVALID_ADDRESS, "Invalid socket address") \
V(ERR_INVALID_MODULE, "No such module") \
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \
V(ERR_QUIC_ENDPOINT_INITIAL_PACKET_FAILURE, \
"Failure processing initial packet") \
V(ERR_QUIC_ENDPOINT_SEND_FAILURE, "Failure to send packet") \
V(ERR_QUIC_FAILURE_SETTING_SNI_CONTEXT, "Failure setting SNI context") \
V(ERR_QUIC_INTERNAL_ERROR, "Internal error: %s") \
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, \
"A message object could not be deserialized successfully in the target " \
"vm.Context") \
Expand Down
Loading

0 comments on commit 2ebd5f3

Please sign in to comment.