Skip to content

Commit

Permalink
src: make minor tweaks to quic c++ for c++20
Browse files Browse the repository at this point in the history
PR-URL: #53256
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
  • Loading branch information
jasnell authored and targos committed Oct 5, 2024
1 parent 75073c5 commit 295c17c
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 77 deletions.
6 changes: 2 additions & 4 deletions src/quic/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "sessionticket.h"
#include "streams.h"

namespace node {
namespace quic {
namespace node::quic {

// An Application implements the ALPN-protocol specific semantics on behalf
// of a QUIC Session.
Expand Down Expand Up @@ -154,8 +153,7 @@ struct Session::Application::StreamData final {
std::string ToString() const;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/bindingdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#include <vector>
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

class Endpoint;
class Packet;
Expand Down Expand Up @@ -267,8 +266,7 @@ struct CallbackScope final : public CallbackScopeBase {
explicit CallbackScope(T* ptr) : CallbackScopeBase(ptr->env()), ref(ptr) {}
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/cid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "ncrypto.h"
#include "quic/defs.h"

namespace node {
namespace quic {
namespace node::quic {

// ============================================================================
// CID
Expand Down Expand Up @@ -150,6 +149,5 @@ const CID::Factory& CID::Factory::random() {
return instance;
}

} // namespace quic
} // namespace node
} // namespace node::quic
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
6 changes: 2 additions & 4 deletions src/quic/cid.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include <string>
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

// CIDS are used to identify endpoints participating in a QUIC session.
// Once created, CID instances are immutable.
Expand Down Expand Up @@ -122,8 +121,7 @@ class CID::Factory {
// of CID::Factory that implement the QUIC Load Balancers spec.
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include <string>
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

struct Path final : public ngtcp2_path {
Path(const SocketAddress& local, const SocketAddress& remote);
Expand Down Expand Up @@ -143,8 +142,7 @@ class QuicError final : public MemoryRetainer {
const ngtcp2_ccerr* ptr_ = nullptr;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <v8.h>
#include <limits>

namespace node {
namespace quic {
namespace node::quic {

#define NGTCP2_SUCCESS 0
#define NGTCP2_ERR(V) (V != NGTCP2_SUCCESS)
Expand Down Expand Up @@ -243,5 +242,4 @@ class DebugIndentScope {
static int indent_;
};

} // namespace quic
} // namespace node
} // namespace node::quic
6 changes: 2 additions & 4 deletions src/quic/endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#include "sessionticket.h"
#include "tokens.h"

namespace node {
namespace quic {
namespace node::quic {

#define ENDPOINT_CC(V) \
V(RENO, reno) \
Expand Down Expand Up @@ -453,8 +452,7 @@ class Endpoint final : public AsyncWrap, public Packet::Listener {
friend class Session;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/http3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#include "session.h"
#include "sessionticket.h"

namespace node {
namespace quic {
namespace node::quic {
namespace {

struct Http3HeadersTraits {
Expand Down Expand Up @@ -833,7 +832,6 @@ std::unique_ptr<Session::Application> createHttp3Application(
return std::make_unique<Http3Application>(session, options);
}

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
7 changes: 2 additions & 5 deletions src/quic/http3.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@

#include "session.h"

namespace node {
namespace quic {

namespace node::quic {
std::unique_ptr<Session::Application> createHttp3Application(
Session* session, const Session::Application_Options& options);

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/logstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <stream_base.h>
#include <deque>

namespace node {
namespace quic {
namespace node::quic {

// The LogStream is a utility that the QUIC impl uses to publish both QLog
// and Keylog diagnostic data (one instance for each).
Expand Down Expand Up @@ -76,8 +75,7 @@ class LogStream : public AsyncWrap, public StreamBase {
void ensure_space(size_t amt);
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "defs.h"
#include "tokens.h"

namespace node {
namespace quic {
namespace node::quic {

struct PathDescriptor {
uint32_t version;
Expand Down Expand Up @@ -147,8 +146,7 @@ class Packet final : public ReqWrap<uv_udp_send_t> {
std::shared_ptr<Data> data_;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/preferredaddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <string>
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

// PreferredAddress is a helper class used only when a client Session receives
// an advertised preferred address from a server. The helper provides
Expand Down Expand Up @@ -67,8 +66,7 @@ class PreferredAddress final {
const ngtcp2_preferred_addr* paddr_;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#include "tlscontext.h"
#include "transportparams.h"

namespace node {
namespace quic {
namespace node::quic {

class Endpoint;

Expand Down Expand Up @@ -438,8 +437,7 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
friend class TransportParams;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/sessionticket.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "data.h"
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

// A TLS 1.3 Session resumption ticket. Encapsulates both the TLS
// ticket and the encoded QUIC transport parameters. The encoded
Expand Down Expand Up @@ -103,8 +102,7 @@ class SessionTicket::AppData final {
SSL* ssl_;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include "bindingdata.h"
#include "data.h"

namespace node {
namespace quic {
namespace node::quic {

class Session;

Expand Down Expand Up @@ -227,8 +226,7 @@ class Stream : public AsyncWrap,
void Unschedule();
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/tlscontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include "defs.h"
#include "sessionticket.h"

namespace node {
namespace quic {
namespace node::quic {

class Session;
class TLSContext;
Expand Down Expand Up @@ -221,8 +220,7 @@ class TLSContext final : public MemoryRetainer,
friend class TLSSession;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/tokens.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "nbytes.h"
#include "ncrypto.h"

namespace node {
namespace quic {
namespace node::quic {

// ============================================================================
// TokenSecret
Expand Down Expand Up @@ -300,7 +299,6 @@ RegularToken::operator const char*() const {
return reinterpret_cast<const char*>(ptr_.base);
}

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
6 changes: 2 additions & 4 deletions src/quic/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "cid.h"
#include "defs.h"

namespace node {
namespace quic {
namespace node::quic {

// TokenSecrets are used to generate things like stateless reset tokens,
// retry tokens, and token packets. They are always QUIC_TOKENSECRET_LEN
Expand Down Expand Up @@ -251,8 +250,7 @@ class RegularToken final : public MemoryRetainer {
const ngtcp2_vec ptr_;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 changes: 2 additions & 4 deletions src/quic/transportparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include "data.h"
#include "tokens.h"

namespace node {
namespace quic {
namespace node::quic {

class Endpoint;
class Session;
Expand Down Expand Up @@ -160,8 +159,7 @@ class TransportParams final {
QuicError error_ = QuicError::TRANSPORT_NO_ERROR;
};

} // namespace quic
} // namespace node
} // namespace node::quic

#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

0 comments on commit 295c17c

Please sign in to comment.