◐ Shell
clean mode source ↗

quic: update more of the quic to the new compile guard · nodejs/node@b91a934

11

#pragma once

2233

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

4-

#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC

5465

#include <base_object.h>

76

#include <env.h>

@@ -26,32 +25,32 @@ class Packet;

2625

// The FunctionTemplates the BindingData will store for us.

2726

#define QUIC_CONSTRUCTORS(V) \

2827

V(endpoint) \

28+

V(http3application) \

2929

V(logstream) \

3030

V(packet) \

3131

V(session) \

3232

V(stream) \

33-

V(udp) \

34-

V(http3application)

33+

V(udp)

35343635

// The callbacks are persistent v8::Function references that are set in the

3736

// quic::BindingState used to communicate data and events back out to the JS

3837

// environment. They are set once from the JavaScript side when the

3938

// internalBinding('quic') is first loaded.

4039

#define QUIC_JS_CALLBACKS(V) \

4140

V(endpoint_close, EndpointClose) \

42-

V(session_new, SessionNew) \

4341

V(session_close, SessionClose) \

4442

V(session_datagram, SessionDatagram) \

4543

V(session_datagram_status, SessionDatagramStatus) \

4644

V(session_handshake, SessionHandshake) \

45+

V(session_new, SessionNew) \

46+

V(session_path_validation, SessionPathValidation) \

4747

V(session_ticket, SessionTicket) \

4848

V(session_version_negotiation, SessionVersionNegotiation) \

49-

V(session_path_validation, SessionPathValidation) \

49+

V(stream_blocked, StreamBlocked) \

5050

V(stream_close, StreamClose) \

5151

V(stream_created, StreamCreated) \

52-

V(stream_reset, StreamReset) \

5352

V(stream_headers, StreamHeaders) \

54-

V(stream_blocked, StreamBlocked) \

53+

V(stream_reset, StreamReset) \

5554

V(stream_trailers, StreamTrailers)

56555756

// The various JS strings the implementation uses.

@@ -64,10 +63,10 @@ class Packet;

6463

V(application_provider, "provider") \

6564

V(bbr, "bbr") \

6665

V(ca, "ca") \

67-

V(certs, "certs") \

6866

V(cc_algorithm, "cc") \

69-

V(crl, "crl") \

67+

V(certs, "certs") \

7068

V(ciphers, "ciphers") \

69+

V(crl, "crl") \

7170

V(cubic, "cubic") \

7271

V(disable_stateless_reset, "disableStatelessReset") \

7372

V(enable_connect_protocol, "enableConnectProtocol") \

@@ -114,8 +113,8 @@ class Packet;

114113

V(qpack_max_dtable_capacity, "qpackMaxDTableCapacity") \

115114

V(reject_unauthorized, "rejectUnauthorized") \

116115

V(reno, "reno") \

117-

V(retry_token_expiration, "retryTokenExpiration") \

118116

V(reset_token_secret, "resetTokenSecret") \

117+

V(retry_token_expiration, "retryTokenExpiration") \

119118

V(rx_loss, "rxDiagnosticLoss") \

120119

V(servername, "servername") \

121120

V(session, "Session") \

@@ -150,6 +149,9 @@ class BindingData final

150149

static void RegisterExternalReferences(ExternalReferenceRegistry* registry);

151150152151

static BindingData& Get(Environment* env);

152+

static inline BindingData& Get(Realm* realm) {

153+

return Get(realm->env());

154+

}

153155154156

BindingData(Realm* realm, v8::Local<v8::Object> object);

155157

DISALLOW_COPY_AND_MOVE(BindingData)

@@ -179,6 +181,7 @@ class BindingData final

179181180182

bool in_ngtcp2_callback_scope = false;

181183

bool in_nghttp3_callback_scope = false;

184+

size_t current_ngtcp2_memory_ = 0;

182185183186

// The following set up various storage and accessors for common strings,

184187

// construction templates, and callbacks stored on the BindingData. These

@@ -205,8 +208,6 @@ class BindingData final

205208

QUIC_JS_CALLBACKS(V)

206209

#undef V

207210208-

size_t current_ngtcp2_memory_ = 0;

209-210211

#define V(name) v8::Global<v8::FunctionTemplate> name##_constructor_template_;

211212

QUIC_CONSTRUCTORS(V)

212213

#undef V

@@ -229,15 +230,15 @@ void IllegalConstructor(const v8::FunctionCallbackInfo<v8::Value>& args);

229230

// The ngtcp2 and nghttp3 callbacks have certain restrictions

230231

// that forbid re-entry. We provide the following scopes for

231232

// use in those to help protect against it.

232-

struct NgTcp2CallbackScope {

233+

struct NgTcp2CallbackScope final {

233234

Environment* env;

234235

explicit NgTcp2CallbackScope(Environment* env);

235236

DISALLOW_COPY_AND_MOVE(NgTcp2CallbackScope)

236237

~NgTcp2CallbackScope();

237238

static bool in_ngtcp2_callback(Environment* env);

238239

};

239240240-

struct NgHttp3CallbackScope {

241+

struct NgHttp3CallbackScope final {

241242

Environment* env;

242243

explicit NgHttp3CallbackScope(Environment* env);

243244

DISALLOW_COPY_AND_MOVE(NgHttp3CallbackScope)

@@ -268,5 +269,4 @@ struct CallbackScope final : public CallbackScopeBase {

268269269270

} // namespace node::quic

270271271-

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC

272272

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS