quic: start re-enabling quic with openssl 3.5 · nodejs/node@5556b15
11#pragma once
2233#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4-#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
4+55#include <memory_tracker.h>
66#include <ngtcp2/ngtcp2.h>
77#include <string>
@@ -51,7 +51,7 @@ class CID final : public MemoryRetainer {
51515252CID(const CID& other);
5353CID& operator=(const CID& other);
54-CID(CID&&) = delete;
54+DISALLOW_MOVE(CID)
55555656struct Hash final {
5757size_t operator()(const CID& cid) const;
@@ -68,14 +68,16 @@ class CID final : public MemoryRetainer {
6868operator bool() const;
6969size_t length() const;
707071+// Returns a hex-encoded string representation of the CID useful
72+// for debugging.
7173 std::string ToString() const;
72747375SET_NO_MEMORY_INFO()
7476SET_MEMORY_INFO_NAME(CID)
7577SET_SELF_SIZE(CID)
76787779template <typename T>
78-using Map = std::unordered_map<CID, T, CID::Hash>;
80+using Map = std::unordered_map<const CID, T, CID::Hash>;
79818082// A CID::Factory, as the name suggests, is used to create new CIDs.
8183// Per https://datatracker.ietf.org/doc/draft-ietf-quic-load-balancers/, QUIC
@@ -85,13 +87,13 @@ class CID final : public MemoryRetainer {
8587// but will allow user code to provide their own CID::Factory implementation.
8688class Factory;
878988-static CID kInvalid;
90+static const CID kInvalid;
89919092// The default constructor creates an empty, zero-length CID.
9193// Zero-length CIDs are not usable. We use them as a placeholder
9294// for a missing or empty CID value. This is public only because
9395// it is required for the CID::Map implementation. It should not
94-// be used. Use kInvalid instead.
96+// be used directly. Use kInvalid instead.
9597CID();
96989799private:
@@ -107,12 +109,12 @@ class CID::Factory {
107109108110// Generate a new CID. The length_hint must be between CID::kMinLength
109111// and CID::kMaxLength. The implementation can choose to ignore the length.
110-virtual CID Generate(size_t length_hint = CID::kMaxLength) const = 0;
112+virtual const CID Generate(size_t length_hint = CID::kMaxLength) const = 0;
111113112114// Generate a new CID into the given ngtcp2_cid. This variation of
113115// Generate should be used far less commonly.
114-virtual CID GenerateInto(ngtcp2_cid* cid,
115- size_t length_hint = CID::kMaxLength) const = 0;
116+virtual const CID GenerateInto(
117+ngtcp2_cid* cid, size_t length_hint = CID::kMaxLength) const = 0;
116118117119// The default random CID generator instance.
118120static const Factory& random();
@@ -123,5 +125,4 @@ class CID::Factory {
123125124126} // namespace node::quic
125127126-#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
127128#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS