From 3646265d1562aac07f3b8c25ddadcf2b9b602f5d Mon Sep 17 00:00:00 2001 From: Leonard Ossa Date: Tue, 25 Jun 2024 18:45:07 +0200 Subject: [PATCH] Refactor nested namespace to C++17 style Signed-off-by: Leonard Ossa --- openvpn/acceptor/base.hpp | 6 ++---- openvpn/acceptor/namedpipe.hpp | 6 ++---- openvpn/acceptor/tcp.hpp | 6 ++---- openvpn/acceptor/unix.hpp | 6 ++---- openvpn/addr/addrlist.hpp | 6 ++---- openvpn/addr/addrpair.hpp | 6 ++---- openvpn/addr/addrspacesplit.hpp | 6 ++---- openvpn/addr/ip.hpp | 12 +++++------- openvpn/addr/iperr.hpp | 8 ++------ openvpn/addr/pool.hpp | 6 ++---- openvpn/addr/randaddr.hpp | 6 ++---- openvpn/addr/range.hpp | 6 ++---- openvpn/addr/regex.hpp | 6 ++---- openvpn/addr/regex_static.hpp | 6 ++---- openvpn/addr/route.hpp | 6 ++---- openvpn/apple/cf/cf.hpp | 6 ++---- openvpn/apple/cf/cfhelper.hpp | 6 ++---- openvpn/apple/cf/cfhost.hpp | 4 +--- openvpn/apple/cf/cfrunloop.hpp | 6 ++---- openvpn/apple/cf/cfsec.hpp | 6 ++---- openvpn/apple/cf/cfsocket.hpp | 4 +--- openvpn/apple/cf/cfstream.hpp | 6 ++---- openvpn/apple/cf/cftimer.hpp | 4 +--- openvpn/apple/macver.hpp | 6 ++---- openvpn/apple/scdynstore.hpp | 6 ++---- openvpn/applecrypto/crypto/cipher.hpp | 6 ++---- openvpn/applecrypto/crypto/digest.hpp | 6 ++---- openvpn/applecrypto/crypto/hmac.hpp | 6 ++---- openvpn/asio/asioboundsock.hpp | 6 ++---- openvpn/asio/asiopolysock.hpp | 6 ++---- openvpn/auth/validatecreds.hpp | 6 ++---- openvpn/aws/awsca.hpp | 6 ++---- openvpn/aws/awscreds.hpp | 6 ++---- openvpn/aws/awshttp.hpp | 6 ++---- openvpn/aws/awspc.hpp | 6 ++---- openvpn/aws/awsrest.hpp | 6 ++---- openvpn/aws/awsroute.hpp | 6 ++---- openvpn/buffer/buffmt.hpp | 6 ++---- openvpn/buffer/bufhex.hpp | 6 ++---- openvpn/buffer/bufip.hpp | 6 ++---- openvpn/client/cliconstants.hpp | 6 ++---- openvpn/client/clievent.hpp | 6 ++---- openvpn/common/endian.hpp | 6 ++---- openvpn/common/endian64.hpp | 6 ++---- openvpn/common/hostlist.hpp | 6 ++---- openvpn/common/hostport.hpp | 6 ++---- openvpn/common/jsonfile.hpp | 6 ++---- openvpn/common/jsonhelper.hpp | 6 ++---- openvpn/common/jsonhelperfmt.hpp | 6 ++---- openvpn/common/memneq.hpp | 6 ++---- openvpn/common/msfind.hpp | 6 ++---- openvpn/common/ostream_containers.hpp | 7 ++----- openvpn/common/path.hpp | 6 ++---- openvpn/common/peercred.hpp | 6 ++---- openvpn/common/pipe.hpp | 6 ++---- openvpn/common/sfinae.hpp | 6 ++---- openvpn/common/sockopt.hpp | 6 ++---- openvpn/common/string.hpp | 7 ++----- openvpn/common/stringtempl.hpp | 6 ++---- openvpn/common/stringtempl2.hpp | 6 ++---- openvpn/common/strneq.hpp | 6 ++---- openvpn/common/unicode-impl.hpp | 4 +--- openvpn/common/unicode.hpp | 6 ++---- openvpn/common/userpass.hpp | 6 ++---- openvpn/common/wstring.hpp | 7 ++----- openvpn/compress/lzoasym_impl.hpp | 6 ++---- openvpn/crypto/cryptoalgs.hpp | 6 ++---- openvpn/crypto/definitions.hpp | 6 ++---- openvpn/crypto/selftest.hpp | 6 ++---- openvpn/dco/dcocli.hpp | 6 ++---- openvpn/dco/key.hpp | 6 ++---- openvpn/dco/kocrypto.hpp | 6 ++---- openvpn/dco/korekey.hpp | 6 ++---- openvpn/dco/ovpndcokocrypto.hpp | 6 ++---- openvpn/error/error.hpp | 6 ++---- openvpn/http/header.hpp | 6 ++---- openvpn/http/headredact.hpp | 6 ++---- openvpn/http/htmlskip.hpp | 6 ++---- openvpn/http/method.hpp | 8 ++------ openvpn/http/parseutil.hpp | 8 ++------ openvpn/http/reply.hpp | 6 ++---- openvpn/http/request.hpp | 6 ++---- openvpn/http/status.hpp | 8 ++------ openvpn/http/urlencode.hpp | 6 ++---- openvpn/http/urlparm.hpp | 6 ++---- openvpn/http/urlparse.hpp | 6 ++---- openvpn/http/validate_uri.hpp | 6 ++---- openvpn/http/webexcept.hpp | 6 ++---- openvpn/init/initprocess.hpp | 6 ++---- openvpn/ip/csum.hpp | 6 ++---- openvpn/ip/ipcommon.hpp | 6 ++---- openvpn/log/logdatetime.hpp | 6 ++---- openvpn/log/logthread_class.hpp | 6 ++---- openvpn/mbedtls/crypto/cipher.hpp | 6 ++---- openvpn/mbedtls/crypto/cipheraead.hpp | 6 ++---- openvpn/mbedtls/crypto/digest.hpp | 6 ++---- openvpn/mbedtls/crypto/hmac.hpp | 6 ++---- openvpn/mbedtls/crypto/tls1prf.hpp | 6 ++---- openvpn/mbedtls/pki/dh.hpp | 6 ++---- openvpn/mbedtls/pki/pkctx.hpp | 6 ++---- openvpn/mbedtls/pki/x509cert.hpp | 6 ++---- openvpn/mbedtls/pki/x509certinfo.hpp | 6 ++---- openvpn/mbedtls/pki/x509crl.hpp | 6 ++---- openvpn/mbedtls/util/pkcs1.hpp | 8 ++------ openvpn/openssl/bio/bio_memq_dgram.hpp | 6 ++---- openvpn/openssl/bio/bio_memq_stream.hpp | 6 ++---- openvpn/openssl/crypto/cipher.hpp | 6 ++---- openvpn/openssl/crypto/cipheraead.hpp | 6 ++---- openvpn/openssl/crypto/digest.hpp | 6 ++---- openvpn/openssl/crypto/hmac-compat.hpp | 6 ++---- openvpn/openssl/crypto/mac.hpp | 6 ++---- openvpn/openssl/crypto/tls1prf.hpp | 6 ++---- openvpn/openssl/pki/crl.hpp | 6 ++---- openvpn/openssl/pki/dh-compat.hpp | 6 ++---- openvpn/openssl/pki/dh.hpp | 6 ++---- openvpn/openssl/pki/pkey.hpp | 6 ++---- openvpn/openssl/pki/x509certinfo.hpp | 6 ++---- openvpn/openssl/pki/x509store.hpp | 6 ++---- openvpn/openssl/sign/pkcs7verify.hpp | 6 ++---- openvpn/openssl/sign/verify.hpp | 6 ++---- openvpn/openssl/ssl/tlsver.hpp | 6 ++---- openvpn/pki/pkcs1.hpp | 8 ++------ openvpn/pki/pktype.hpp | 6 ++---- openvpn/pki/x509track.hpp | 6 ++---- openvpn/proxy/httpdigest.hpp | 6 ++---- openvpn/proxy/ntlm.hpp | 6 ++---- openvpn/proxy/proxyauth.hpp | 6 ++---- openvpn/server/listenlist.hpp | 6 ++---- openvpn/server/manage.hpp | 12 ++++-------- openvpn/server/servhalt.hpp | 6 ++---- openvpn/server/vpnservpool.hpp | 6 ++---- openvpn/ssl/kuparse.hpp | 6 ++---- openvpn/ssl/nscert.hpp | 6 ++---- openvpn/ssl/peerinfo.hpp | 6 ++---- openvpn/ssl/sni_handler.hpp | 6 ++---- openvpn/ssl/sslchoose.hpp | 6 ++---- openvpn/ssl/sslconsts.hpp | 6 ++---- openvpn/ssl/tls_cert_profile.hpp | 6 ++---- openvpn/ssl/tls_remote.hpp | 6 ++---- openvpn/transport/client/extern/config.hpp | 6 ++---- openvpn/transport/client/extern/fw.hpp | 6 ++---- openvpn/transport/client/httpcli.hpp | 6 ++---- openvpn/transport/client/tcpcli.hpp | 6 ++---- openvpn/transport/client/udpcli.hpp | 6 ++---- openvpn/transport/gremlin.hpp | 6 ++---- openvpn/transport/tcplink.hpp | 6 ++---- openvpn/transport/tcplinkbase.hpp | 6 ++---- openvpn/transport/tcplinkcommon.hpp | 6 ++---- openvpn/transport/udplink.hpp | 6 ++---- openvpn/tun/builder/client.hpp | 6 ++---- openvpn/tun/builder/rgwflags.hpp | 6 ++---- openvpn/tun/builder/setup.hpp | 6 ++---- openvpn/tun/client/tunnull.hpp | 6 ++---- openvpn/tun/extern/config.hpp | 6 ++---- openvpn/tun/linux/client/sitnl.hpp | 6 ++---- openvpn/tun/linux/client/tuncli.hpp | 6 ++---- openvpn/tun/linux/client/tuniproute.hpp | 6 ++---- openvpn/tun/linux/client/tunnetlink.hpp | 6 ++---- openvpn/tun/linux/client/tunsetup.hpp | 6 ++---- openvpn/tun/mac/client/tuncli.hpp | 6 ++---- openvpn/tun/mac/client/tunsetup.hpp | 6 ++---- openvpn/tun/mac/tunutil.hpp | 8 ++------ openvpn/tun/mac/utun.hpp | 8 ++------ openvpn/tun/server/tunbase.hpp | 6 ++---- openvpn/tun/win/client/clientconfig.hpp | 6 ++---- openvpn/tun/win/client/setupbase.hpp | 6 ++---- openvpn/tun/win/client/tuncli.hpp | 6 ++---- openvpn/tun/win/client/tunsetup.hpp | 6 ++---- openvpn/tun/win/client/wintun.hpp | 6 ++---- openvpn/tun/win/dns.hpp | 6 ++---- openvpn/tun/win/nrpt.hpp | 6 ++---- openvpn/tun/win/ringbuffer.hpp | 6 ++---- openvpn/tun/win/tunutil.hpp | 6 ++---- openvpn/tun/win/wfp.hpp | 6 ++---- openvpn/tun/win/winproxy.hpp | 6 ++---- openvpn/win/call.hpp | 6 ++---- openvpn/win/console.hpp | 8 ++------ openvpn/win/event.hpp | 6 ++---- openvpn/win/handle.hpp | 8 ++------ openvpn/win/handlecomm.hpp | 8 ++------ openvpn/win/impersonate.hpp | 6 ++---- openvpn/win/logfile.hpp | 6 ++---- openvpn/win/logutil.hpp | 8 ++------ openvpn/win/modname.hpp | 6 ++---- openvpn/win/netutil.hpp | 6 ++---- openvpn/win/npinfo.hpp | 6 ++---- openvpn/win/reg.hpp | 6 ++---- openvpn/win/scoped_handle.hpp | 6 ++---- openvpn/win/secattr.hpp | 6 ++---- openvpn/win/unicode.hpp | 6 ++---- openvpn/win/winerr.hpp | 6 ++---- openvpn/win/winsvc.hpp | 6 ++---- openvpn/ws/chunked.hpp | 6 ++---- openvpn/ws/httpcli.hpp | 8 ++------ openvpn/ws/httpcliset.hpp | 6 ++---- openvpn/ws/httpcommon.hpp | 6 ++---- openvpn/ws/httpcreds.hpp | 6 ++---- openvpn/ws/httpserv.hpp | 8 ++------ openvpn/ws/httpvpn.hpp | 6 ++---- openvpn/ws/resolver_results.hpp | 6 ++---- openvpn/ws/websocket.hpp | 6 ++---- 201 files changed, 403 insertions(+), 838 deletions(-) diff --git a/openvpn/acceptor/base.hpp b/openvpn/acceptor/base.hpp index 6e85904e7..6153258eb 100644 --- a/openvpn/acceptor/base.hpp +++ b/openvpn/acceptor/base.hpp @@ -39,8 +39,7 @@ #define OPENVPN_ACCEPTOR_LISTENER_BASE_RC RC #endif -namespace openvpn { -namespace Acceptor { +namespace openvpn::Acceptor { struct ListenerBase : public OPENVPN_ACCEPTOR_LISTENER_BASE_RC { @@ -91,5 +90,4 @@ struct Set : public std::vector } }; -} // namespace Acceptor -} // namespace openvpn +} // namespace openvpn::Acceptor diff --git a/openvpn/acceptor/namedpipe.hpp b/openvpn/acceptor/namedpipe.hpp index c7e9326b9..b093e84a7 100644 --- a/openvpn/acceptor/namedpipe.hpp +++ b/openvpn/acceptor/namedpipe.hpp @@ -25,8 +25,7 @@ #include #include -namespace openvpn { -namespace Acceptor { +namespace openvpn::Acceptor { class NamedPipe : public Base { @@ -113,5 +112,4 @@ class NamedPipe : public Base Win::SecurityAttributes sa; }; -} // namespace Acceptor -} // namespace openvpn +} // namespace openvpn::Acceptor diff --git a/openvpn/acceptor/tcp.hpp b/openvpn/acceptor/tcp.hpp index 35442880f..7932de979 100644 --- a/openvpn/acceptor/tcp.hpp +++ b/openvpn/acceptor/tcp.hpp @@ -24,8 +24,7 @@ #include #include -namespace openvpn { -namespace Acceptor { +namespace openvpn::Acceptor { struct TCP : public Base { @@ -93,5 +92,4 @@ struct TCP : public Base openvpn_io::ip::tcp::acceptor acceptor; }; -} // namespace Acceptor -} // namespace openvpn +} // namespace openvpn::Acceptor diff --git a/openvpn/acceptor/unix.hpp b/openvpn/acceptor/unix.hpp index 37da9423b..abddce2d7 100644 --- a/openvpn/acceptor/unix.hpp +++ b/openvpn/acceptor/unix.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace Acceptor { +namespace openvpn::Acceptor { struct Unix : public Base { @@ -76,5 +75,4 @@ struct Unix : public Base openvpn_io::basic_socket_acceptor acceptor; }; -} // namespace Acceptor -} // namespace openvpn +} // namespace openvpn::Acceptor diff --git a/openvpn/addr/addrlist.hpp b/openvpn/addr/addrlist.hpp index 136e9e6d9..30a59803f 100644 --- a/openvpn/addr/addrlist.hpp +++ b/openvpn/addr/addrlist.hpp @@ -25,8 +25,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { // A list of unique IP addresses class AddrList : public std::vector, public RC @@ -59,7 +58,6 @@ class AddrList : public std::vector, public RC } #endif }; -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #endif diff --git a/openvpn/addr/addrpair.hpp b/openvpn/addr/addrpair.hpp index 1d93c28e4..190288b06 100644 --- a/openvpn/addr/addrpair.hpp +++ b/openvpn/addr/addrpair.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { // AddrMaskPair is basically an object that combines an IP address (v4 or v6) // with a netmask or prefix length. @@ -218,7 +217,6 @@ struct AddrMaskPair } }; OPENVPN_OSTREAM(AddrMaskPair, to_string) -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #endif diff --git a/openvpn/addr/addrspacesplit.hpp b/openvpn/addr/addrspacesplit.hpp index 81a6d9912..ba46e0369 100644 --- a/openvpn/addr/addrspacesplit.hpp +++ b/openvpn/addr/addrspacesplit.hpp @@ -27,8 +27,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { class AddressSpaceSplitter : public RouteList { public: @@ -108,5 +107,4 @@ class AddressSpaceSplitter : public RouteList return type; } }; -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP diff --git a/openvpn/addr/ip.hpp b/openvpn/addr/ip.hpp index 8a8763ba5..61f4eecad 100644 --- a/openvpn/addr/ip.hpp +++ b/openvpn/addr/ip.hpp @@ -37,14 +37,13 @@ #define OPENVPN_IP_THROW(ERR) throw openvpn::IP::ip_exception(ERR) -namespace openvpn { -// This is our fundamental IP address class that handles IPv4 or IPv6 -// IP addresses. It is implemented as a discriminated union of IPv4::Addr -// and IPv6::Addr. -namespace IP { +namespace openvpn::IP { OPENVPN_EXCEPTION(ip_exception); +// This is our fundamental IP address class that handles IPv4 or IPv6 +// IP addresses. It is implemented as a discriminated union of IPv4::Addr +// and IPv6::Addr. class Addr { public: @@ -1132,8 +1131,7 @@ class Addr }; OPENVPN_OSTREAM(Addr, to_string) -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #ifdef USE_OPENVPN_HASH OPENVPN_HASH_METHOD(openvpn::IP::Addr, hashval); diff --git a/openvpn/addr/iperr.hpp b/openvpn/addr/iperr.hpp index c00009243..b42851d5e 100644 --- a/openvpn/addr/iperr.hpp +++ b/openvpn/addr/iperr.hpp @@ -31,9 +31,7 @@ #include #endif -namespace openvpn { -namespace IP { -namespace internal { +namespace openvpn::IP::internal { #ifndef OPENVPN_LEGACY_TITLE_ABSTRACTION @@ -112,6 +110,4 @@ inline std::string format_error(const std::string &ipstr, const char *title, con } #endif -} // namespace internal -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP::internal diff --git a/openvpn/addr/pool.hpp b/openvpn/addr/pool.hpp index 8416617fc..49a72abb6 100644 --- a/openvpn/addr/pool.hpp +++ b/openvpn/addr/pool.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { // Maintain a pool of IP addresses. // A should be IP::Addr, IPv4::Addr, or IPv6::Addr. @@ -163,7 +162,6 @@ class PoolType }; typedef PoolType Pool; -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #endif diff --git a/openvpn/addr/randaddr.hpp b/openvpn/addr/randaddr.hpp index a787a0038..956d7ffaf 100644 --- a/openvpn/addr/randaddr.hpp +++ b/openvpn/addr/randaddr.hpp @@ -25,8 +25,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { inline IPv4::Addr random_addr_v4(RandomAPI &prng) { @@ -64,5 +63,4 @@ inline Route random_subnet(const Route &templ, & Addr::netmask_from_prefix_len(templ.addr.version(), prefix_len), prefix_len); } -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP diff --git a/openvpn/addr/range.hpp b/openvpn/addr/range.hpp index 3e5e35a1b..17549ba89 100644 --- a/openvpn/addr/range.hpp +++ b/openvpn/addr/range.hpp @@ -30,8 +30,7 @@ #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { // Denote a range of IP addresses with a start and extent, // where A represents an address class. @@ -157,7 +156,6 @@ class RangePartitionType typedef RangeType Range; typedef RangePartitionType RangePartition; -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #endif diff --git a/openvpn/addr/regex.hpp b/openvpn/addr/regex.hpp index 9b23d6737..c01772f42 100644 --- a/openvpn/addr/regex.hpp +++ b/openvpn/addr/regex.hpp @@ -27,8 +27,7 @@ #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { inline std::string v4_regex() { const std::string ipv4seg = "(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])"; @@ -55,7 +54,6 @@ inline std::string v6_regex() ")"; // clang-format on } -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #endif diff --git a/openvpn/addr/regex_static.hpp b/openvpn/addr/regex_static.hpp index 9896a9db9..e86deab1c 100644 --- a/openvpn/addr/regex_static.hpp +++ b/openvpn/addr/regex_static.hpp @@ -27,8 +27,7 @@ #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { inline const std::regex re_v4(v4_regex(), std::regex_constants::ECMAScript | std::regex_constants::nosubs); inline const std::regex re_v6(v6_regex(), std::regex_constants::ECMAScript | std::regex_constants::nosubs); @@ -46,5 +45,4 @@ inline bool is_ip_address(const std::string &host) { return is_ipv4_address(host) || is_ipv6_address(host); } -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP diff --git a/openvpn/addr/route.hpp b/openvpn/addr/route.hpp index 76c02d1da..e33947cba 100644 --- a/openvpn/addr/route.hpp +++ b/openvpn/addr/route.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace IP { +namespace openvpn::IP { // Basic route object template class RouteType @@ -433,8 +432,7 @@ inline Route route_from_string(const std::string &rtstr, #endif -} // namespace IP -} // namespace openvpn +} // namespace openvpn::IP #ifdef USE_OPENVPN_HASH OPENVPN_HASH_METHOD(openvpn::IP::Route, hash_value); diff --git a/openvpn/apple/cf/cf.hpp b/openvpn/apple/cf/cf.hpp index c4afd86da..888beb867 100644 --- a/openvpn/apple/cf/cf.hpp +++ b/openvpn/apple/cf/cf.hpp @@ -55,8 +55,7 @@ return cls(); \ } -namespace openvpn { -namespace CF { +namespace openvpn::CF { enum Rule { CREATE, // create rule @@ -471,7 +470,6 @@ inline Data plist(CFTypeRef obj) nullptr)); } -} // namespace CF -} // namespace openvpn +} // namespace openvpn::CF #endif // OPENVPN_APPLECRYPTO_CF_CF_H diff --git a/openvpn/apple/cf/cfhelper.hpp b/openvpn/apple/cf/cfhelper.hpp index 3f079d29c..4b2e2bb74 100644 --- a/openvpn/apple/cf/cfhelper.hpp +++ b/openvpn/apple/cf/cfhelper.hpp @@ -29,8 +29,7 @@ // defined in cf.hpp. They add additional convenience methods, such as dictionary // lookup. -namespace openvpn { -namespace CF { +namespace openvpn::CF { // essentially a vector of void *, used as source for array and dictionary constructors typedef BufferAllocatedType SrcList; @@ -256,6 +255,5 @@ inline void array_append_index(MutableArray &array, CFIndex value) Number num = number_from_index(value); arrayAppendValue(array(), num()); } -} // namespace CF -} // namespace openvpn +} // namespace openvpn::CF #endif diff --git a/openvpn/apple/cf/cfhost.hpp b/openvpn/apple/cf/cfhost.hpp index ff2da75f2..c77411092 100644 --- a/openvpn/apple/cf/cfhost.hpp +++ b/openvpn/apple/cf/cfhost.hpp @@ -24,10 +24,8 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(Host, host_cast, CFHostRef, CFHostGetTypeID) } -} // namespace openvpn #endif diff --git a/openvpn/apple/cf/cfrunloop.hpp b/openvpn/apple/cf/cfrunloop.hpp index 45ff19852..594162629 100644 --- a/openvpn/apple/cf/cfrunloop.hpp +++ b/openvpn/apple/cf/cfrunloop.hpp @@ -24,11 +24,9 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(RunLoop, runloop_cast, CFRunLoopRef, CFRunLoopGetTypeID) OPENVPN_CF_WRAP(RunLoopSource, runloop_source_cast, CFRunLoopSourceRef, CFRunLoopSourceGetTypeID); -} // namespace CF -} // namespace openvpn +} // namespace openvpn::CF #endif diff --git a/openvpn/apple/cf/cfsec.hpp b/openvpn/apple/cf/cfsec.hpp index 0a5d23039..94760adf1 100644 --- a/openvpn/apple/cf/cfsec.hpp +++ b/openvpn/apple/cf/cfsec.hpp @@ -40,8 +40,7 @@ // Define C++ wrappings for Apple security-related objects. -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(Cert, cert_cast, SecCertificateRef, SecCertificateGetTypeID) OPENVPN_CF_WRAP(Key, key_cast, SecKeyRef, SecKeyGetTypeID) OPENVPN_CF_WRAP(Identity, identity_cast, SecIdentityRef, SecIdentityGetTypeID) @@ -51,8 +50,7 @@ OPENVPN_CF_WRAP(Trust, trust_cast, SecTrustRef, SecTrustGetTypeID) OPENVPN_CF_WRAP(Keychain, keychain_cast, SecKeychainRef, SecKeychainGetTypeID) OPENVPN_CF_WRAP(Access, access_cast, SecAccessRef, SecAccessGetTypeID) #endif -} // namespace CF +} // namespace openvpn::CF -} // namespace openvpn #endif // OPENVPN_APPLECRYPTO_CF_CFSEC_H diff --git a/openvpn/apple/cf/cfsocket.hpp b/openvpn/apple/cf/cfsocket.hpp index 0ee0d0442..95105d235 100644 --- a/openvpn/apple/cf/cfsocket.hpp +++ b/openvpn/apple/cf/cfsocket.hpp @@ -24,10 +24,8 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(Socket, socket_cast, CFSocketRef, CFSocketGetTypeID) } -} // namespace openvpn #endif diff --git a/openvpn/apple/cf/cfstream.hpp b/openvpn/apple/cf/cfstream.hpp index b7f00650b..67d0471e0 100644 --- a/openvpn/apple/cf/cfstream.hpp +++ b/openvpn/apple/cf/cfstream.hpp @@ -24,11 +24,9 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(ReadStream, read_stream_cast, CFReadStreamRef, CFReadStreamGetTypeID) OPENVPN_CF_WRAP(WriteStream, write_stream_cast, CFWriteStreamRef, CFWriteStreamGetTypeID) -} // namespace CF -} // namespace openvpn +} // namespace openvpn::CF #endif diff --git a/openvpn/apple/cf/cftimer.hpp b/openvpn/apple/cf/cftimer.hpp index f2ad62418..09d7ed29d 100644 --- a/openvpn/apple/cf/cftimer.hpp +++ b/openvpn/apple/cf/cftimer.hpp @@ -24,10 +24,8 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(Timer, timer_cast, CFRunLoopTimerRef, CFRunLoopTimerGetTypeID) } -} // namespace openvpn #endif diff --git a/openvpn/apple/macver.hpp b/openvpn/apple/macver.hpp index 1c7d05202..279a36a97 100644 --- a/openvpn/apple/macver.hpp +++ b/openvpn/apple/macver.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace Mac { +namespace openvpn::Mac { class Version : public AppleVersion { public: @@ -70,7 +69,6 @@ class Version : public AppleVersion init(std::string(str, size)); } }; -} // namespace Mac -} // namespace openvpn +} // namespace openvpn::Mac #endif diff --git a/openvpn/apple/scdynstore.hpp b/openvpn/apple/scdynstore.hpp index 74c36f0a9..53c67a986 100644 --- a/openvpn/apple/scdynstore.hpp +++ b/openvpn/apple/scdynstore.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace CF { +namespace openvpn::CF { OPENVPN_CF_WRAP(DynamicStore, dynamic_store_cast, SCDynamicStoreRef, SCDynamicStoreGetTypeID) template @@ -46,7 +45,6 @@ inline Dict DynamicStoreCopyDict(const DynamicStore &ds, const KEY &key) else return CF::empty_dict(); } -} // namespace CF -} // namespace openvpn +} // namespace openvpn::CF #endif diff --git a/openvpn/applecrypto/crypto/cipher.hpp b/openvpn/applecrypto/crypto/cipher.hpp index 0da139df8..a24eec59b 100644 --- a/openvpn/applecrypto/crypto/cipher.hpp +++ b/openvpn/applecrypto/crypto/cipher.hpp @@ -38,8 +38,7 @@ #include #include -namespace openvpn { -namespace AppleCrypto { +namespace openvpn::AppleCrypto { class CipherContext { CipherContext(const CipherContext &) = delete; @@ -205,7 +204,6 @@ class CipherContext const CryptoAlgs::Alg *cinfo; CCCryptorRef cref; }; -} // namespace AppleCrypto -} // namespace openvpn +} // namespace openvpn::AppleCrypto #endif diff --git a/openvpn/applecrypto/crypto/digest.hpp b/openvpn/applecrypto/crypto/digest.hpp index db0d593cb..51010a33a 100644 --- a/openvpn/applecrypto/crypto/digest.hpp +++ b/openvpn/applecrypto/crypto/digest.hpp @@ -65,8 +65,7 @@ #define OPENVPN_DIGEST_INFO_DECLARE_NO_HMAC(TYPE) const DigestInfo info_##TYPE(CryptoAlgs::TYPE, &alg_##TYPE, DigestInfo::NO_HMAC_ALG) -namespace openvpn { -namespace AppleCrypto { +namespace openvpn::AppleCrypto { typedef CC_SHA256_CTX CC_SHA224_CTX; typedef CC_SHA512_CTX CC_SHA384_CTX; @@ -270,8 +269,7 @@ class DigestContext const DigestAlgorithm *meth; DigestCTX ctx; }; -} // namespace AppleCrypto -} // namespace openvpn +} // namespace openvpn::AppleCrypto #undef OPENVPN_DIGEST_CONTEXT #undef OPENVPN_DIGEST_ALG_CLASS diff --git a/openvpn/applecrypto/crypto/hmac.hpp b/openvpn/applecrypto/crypto/hmac.hpp index 3c7d50830..4c0b532e6 100644 --- a/openvpn/applecrypto/crypto/hmac.hpp +++ b/openvpn/applecrypto/crypto/hmac.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace AppleCrypto { +namespace openvpn::AppleCrypto { class HMACContext { HMACContext(const HMACContext &) = delete; @@ -141,7 +140,6 @@ class HMACContext unsigned char key_[MAX_HMAC_KEY_SIZE]; CCHmacContext ctx; }; -} // namespace AppleCrypto -} // namespace openvpn +} // namespace openvpn::AppleCrypto #endif diff --git a/openvpn/asio/asioboundsock.hpp b/openvpn/asio/asioboundsock.hpp index 9498b667b..4d7b88efc 100644 --- a/openvpn/asio/asioboundsock.hpp +++ b/openvpn/asio/asioboundsock.hpp @@ -31,8 +31,7 @@ #include #include -namespace openvpn { -namespace AsioBoundSocket { +namespace openvpn::AsioBoundSocket { typedef openvpn_io::basic_stream_socket SocketBase; @@ -149,7 +148,6 @@ class Socket : public SocketBase Proto v6; }; -} // namespace AsioBoundSocket -} // namespace openvpn +} // namespace openvpn::AsioBoundSocket #endif diff --git a/openvpn/asio/asiopolysock.hpp b/openvpn/asio/asiopolysock.hpp index 5ead503f4..f37e5ad53 100644 --- a/openvpn/asio/asiopolysock.hpp +++ b/openvpn/asio/asiopolysock.hpp @@ -46,8 +46,7 @@ #include #endif -namespace openvpn { -namespace AsioPolySock { +namespace openvpn::AsioPolySock { // for shutdown() enum ShutdownFlags { @@ -385,7 +384,6 @@ struct NamedPipe : public Base openvpn_io::windows::stream_handle handle; }; #endif -} // namespace AsioPolySock -} // namespace openvpn +} // namespace openvpn::AsioPolySock #endif diff --git a/openvpn/auth/validatecreds.hpp b/openvpn/auth/validatecreds.hpp index 476eaf7a9..195fcbd70 100644 --- a/openvpn/auth/validatecreds.hpp +++ b/openvpn/auth/validatecreds.hpp @@ -24,12 +24,11 @@ #include -namespace openvpn { // Validate authentication credential. // Must be UTF-8. // Other checks on size and content below. // We don't check that the credential is non-empty. -namespace ValidateCreds { +namespace openvpn::ValidateCreds { enum Type { @@ -66,7 +65,6 @@ static bool is_valid(const Type type, const STRING &cred, const bool strict) } return Unicode::is_valid_utf8(cred, max_len_flags); } -} // namespace ValidateCreds -} // namespace openvpn +} // namespace openvpn::ValidateCreds #endif diff --git a/openvpn/aws/awsca.hpp b/openvpn/aws/awsca.hpp index 977f56056..6c0b6dec8 100644 --- a/openvpn/aws/awsca.hpp +++ b/openvpn/aws/awsca.hpp @@ -26,8 +26,7 @@ #include #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { inline std::string api_ca() { // paths are copied from https://golang.org/src/crypto/x509/root_linux.go @@ -46,5 +45,4 @@ inline std::string api_ca() } throw file_unix_error("No CA certificate files found in system paths"); } -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS diff --git a/openvpn/aws/awscreds.hpp b/openvpn/aws/awscreds.hpp index ae7d40479..683b0007c 100644 --- a/openvpn/aws/awscreds.hpp +++ b/openvpn/aws/awscreds.hpp @@ -25,8 +25,7 @@ #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { struct Creds { Creds() @@ -64,5 +63,4 @@ struct Creds std::string secret_key; std::string token; }; -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS diff --git a/openvpn/aws/awshttp.hpp b/openvpn/aws/awshttp.hpp index 6a08e990a..8b6b962c6 100644 --- a/openvpn/aws/awshttp.hpp +++ b/openvpn/aws/awshttp.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { class HTTPContext { public: @@ -127,7 +126,6 @@ class HTTPContext #endif int debug_level_; }; -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS #endif diff --git a/openvpn/aws/awspc.hpp b/openvpn/aws/awspc.hpp index 9d650ff7b..9ff88b561 100644 --- a/openvpn/aws/awspc.hpp +++ b/openvpn/aws/awspc.hpp @@ -40,8 +40,7 @@ #include #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { class PCQuery : public RC { @@ -609,5 +608,4 @@ class PCQuery : public RC Json::Value awspc_req; bool pending = false; }; -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS diff --git a/openvpn/aws/awsrest.hpp b/openvpn/aws/awsrest.hpp index 42f136839..04714ceb4 100644 --- a/openvpn/aws/awsrest.hpp +++ b/openvpn/aws/awsrest.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { class REST { public: @@ -248,5 +247,4 @@ class REST } }; }; -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS diff --git a/openvpn/aws/awsroute.hpp b/openvpn/aws/awsroute.hpp index 029935735..d4ced4a2c 100644 --- a/openvpn/aws/awsroute.hpp +++ b/openvpn/aws/awsroute.hpp @@ -56,8 +56,7 @@ #include #include -namespace openvpn { -namespace AWS { +namespace openvpn::AWS { class Route { public: @@ -601,5 +600,4 @@ class Route return "ec2." + instance_info.region + ".amazonaws.com"; } }; -} // namespace AWS -} // namespace openvpn +} // namespace openvpn::AWS diff --git a/openvpn/buffer/buffmt.hpp b/openvpn/buffer/buffmt.hpp index 1aa806bca..b14c5fe50 100644 --- a/openvpn/buffer/buffmt.hpp +++ b/openvpn/buffer/buffmt.hpp @@ -28,8 +28,7 @@ #include #include -namespace openvpn { -namespace BufferFormat { +namespace openvpn::BufferFormat { template class UnsignedDecimal @@ -127,5 +126,4 @@ class Hex T value_; }; -} // namespace BufferFormat -} // namespace openvpn +} // namespace openvpn::BufferFormat diff --git a/openvpn/buffer/bufhex.hpp b/openvpn/buffer/bufhex.hpp index 106bcf9c5..043458ccf 100644 --- a/openvpn/buffer/bufhex.hpp +++ b/openvpn/buffer/bufhex.hpp @@ -26,8 +26,7 @@ #include #include -namespace openvpn { -namespace BufHex { +namespace openvpn::BufHex { OPENVPN_EXCEPTION(buf_hex); @@ -56,7 +55,6 @@ inline T parse(const std::string &hex, const std::string &title) return obj; } -} // namespace BufHex -} // namespace openvpn +} // namespace openvpn::BufHex #endif diff --git a/openvpn/buffer/bufip.hpp b/openvpn/buffer/bufip.hpp index fd00c0373..cec4ea3e9 100644 --- a/openvpn/buffer/bufip.hpp +++ b/openvpn/buffer/bufip.hpp @@ -28,8 +28,7 @@ #include #include // for ntohs -namespace openvpn { -namespace BufferFormat { +namespace openvpn::BufferFormat { static inline void ipv4(Buffer &buf, const std::uint32_t addr) // addr is big-endian { @@ -150,5 +149,4 @@ static inline void ipv6(Buffer &buf, const void *addr) buf_append_string(buf, "::"); } } -} // namespace BufferFormat -} // namespace openvpn +} // namespace openvpn::BufferFormat diff --git a/openvpn/client/cliconstants.hpp b/openvpn/client/cliconstants.hpp index ac446c421..3d8657634 100644 --- a/openvpn/client/cliconstants.hpp +++ b/openvpn/client/cliconstants.hpp @@ -24,8 +24,7 @@ // Various sanity checks for different limits on OpenVPN clients -namespace openvpn { -namespace ProfileParseLimits { +namespace openvpn::ProfileParseLimits { enum { MAX_PROFILE_SIZE = 262144, // maximum size of an OpenVPN configuration file @@ -36,7 +35,6 @@ enum TERM_OVERHEAD = 16, // bytes overhead of one argument in an option, for accounting purposes MAX_SERVER_LIST_SIZE = 4096, // maximum server list size, i.e. "setenv SERVER ..." }; -} // namespace ProfileParseLimits -} // namespace openvpn +} // namespace openvpn::ProfileParseLimits #endif diff --git a/openvpn/client/clievent.hpp b/openvpn/client/clievent.hpp index 93b55c643..b87c688a0 100644 --- a/openvpn/client/clievent.hpp +++ b/openvpn/client/clievent.hpp @@ -38,8 +38,7 @@ #include #endif -namespace openvpn { -namespace ClientEvent { +namespace openvpn::ClientEvent { enum Type { // normal events including disconnected, connected, and other transitional events @@ -686,7 +685,6 @@ class Queue : public RC virtual void add_event(Base::Ptr event) = 0; }; -} // namespace ClientEvent -} // namespace openvpn +} // namespace openvpn::ClientEvent #endif // OPENVPN_CLIENT_CLIEVENT_H diff --git a/openvpn/common/endian.hpp b/openvpn/common/endian.hpp index d410a1e43..57f05ad37 100644 --- a/openvpn/common/endian.hpp +++ b/openvpn/common/endian.hpp @@ -23,8 +23,7 @@ #include -namespace openvpn { -namespace Endian { +namespace openvpn::Endian { #if defined(OPENVPN_LITTLE_ENDIAN) inline size_t e16(const size_t v) { @@ -78,5 +77,4 @@ inline size_t e2(const size_t v) #else #error One of OPENVPN_LITTLE_ENDIAN or OPENVPN_BIG_ENDIAN must be defined #endif -} // namespace Endian -} // namespace openvpn +} // namespace openvpn::Endian diff --git a/openvpn/common/endian64.hpp b/openvpn/common/endian64.hpp index e8887ca58..effdbbf22 100644 --- a/openvpn/common/endian64.hpp +++ b/openvpn/common/endian64.hpp @@ -25,8 +25,7 @@ #include -namespace openvpn { -namespace Endian { +namespace openvpn::Endian { #ifdef __MINGW32__ inline std::uint64_t mingw_bswap64(const std::uint64_t val) { @@ -56,5 +55,4 @@ inline std::uint64_t rev64(const std::uint64_t value) return value; #endif /* OPENVPN_LITTLE_ENDIAN */ } -} // namespace Endian -} // namespace openvpn +} // namespace openvpn::Endian diff --git a/openvpn/common/hostlist.hpp b/openvpn/common/hostlist.hpp index 459e3e8e4..a71cbc7e2 100644 --- a/openvpn/common/hostlist.hpp +++ b/openvpn/common/hostlist.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace HostList { +namespace openvpn::HostList { struct Host { @@ -157,7 +156,6 @@ class Iterator private: int index; }; -} // namespace HostList -} // namespace openvpn +} // namespace openvpn::HostList #endif diff --git a/openvpn/common/hostport.hpp b/openvpn/common/hostport.hpp index 1173727c4..c6b7db7cc 100644 --- a/openvpn/common/hostport.hpp +++ b/openvpn/common/hostport.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace HostPort { +namespace openvpn::HostPort { OPENVPN_EXCEPTION(host_port_error); inline bool is_valid_port(const unsigned int port) @@ -147,7 +146,6 @@ inline bool split_host_port(const std::string &str, return is_valid_host(host) && is_valid_port(port, port_save); } -} // namespace HostPort -} // namespace openvpn +} // namespace openvpn::HostPort #endif diff --git a/openvpn/common/jsonfile.hpp b/openvpn/common/jsonfile.hpp index 293d92884..5dc3b2de0 100644 --- a/openvpn/common/jsonfile.hpp +++ b/openvpn/common/jsonfile.hpp @@ -24,8 +24,7 @@ #include #include -namespace openvpn { -namespace json { +namespace openvpn::json { inline Json::Value read_fast(const std::string &fn, const bool optional = true, @@ -72,5 +71,4 @@ inline void write_fast(const std::string &fn, format_compact(root, *bp); write_binary_unix(fn, mode, mtime_ns, *bp); } -} // namespace json -} // namespace openvpn +} // namespace openvpn::json diff --git a/openvpn/common/jsonhelper.hpp b/openvpn/common/jsonhelper.hpp index 404acf5bd..aeb5025a4 100644 --- a/openvpn/common/jsonhelper.hpp +++ b/openvpn/common/jsonhelper.hpp @@ -39,8 +39,7 @@ #error no JSON library available #endif -namespace openvpn { -namespace json { +namespace openvpn::json { OPENVPN_EXCEPTION(json_parse); @@ -958,5 +957,4 @@ inline Json::Value dict_result(Json::Value jr) return jret; } } -} // namespace json -} // namespace openvpn +} // namespace openvpn::json diff --git a/openvpn/common/jsonhelperfmt.hpp b/openvpn/common/jsonhelperfmt.hpp index 15982a383..9b68730ca 100644 --- a/openvpn/common/jsonhelperfmt.hpp +++ b/openvpn/common/jsonhelperfmt.hpp @@ -25,8 +25,7 @@ #include -namespace openvpn { -namespace json { +namespace openvpn::json { // format name.title but omit .title if title is empty template @@ -54,5 +53,4 @@ inline std::string fmt_name_cast(const TITLE &title) return "element." + StringTempl::to_string(title); } -} // namespace json -} // namespace openvpn +} // namespace openvpn::json diff --git a/openvpn/common/memneq.hpp b/openvpn/common/memneq.hpp index ff24c6d72..dd1bdd314 100644 --- a/openvpn/common/memneq.hpp +++ b/openvpn/common/memneq.hpp @@ -65,8 +65,7 @@ extern "C" void _ReadWriteBarrier(); #define OPENVPN_INCR_VOID_PTR(var, incr) (var) = static_cast(var) + (incr) -namespace openvpn { -namespace crypto { +namespace openvpn::crypto { /** * memneq - Compare two areas of memory in constant time * @@ -103,5 +102,4 @@ inline bool memneq(const void *a, const void *b, size_t size) return bool(diff); } #endif -} // namespace crypto -} // namespace openvpn +} // namespace openvpn::crypto diff --git a/openvpn/common/msfind.hpp b/openvpn/common/msfind.hpp index b96eb30dd..736eaee7b 100644 --- a/openvpn/common/msfind.hpp +++ b/openvpn/common/msfind.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace MSF { +namespace openvpn::MSF { template class Iter : public ITERATOR @@ -86,5 +85,4 @@ inline auto iter(ITERATOR i) { return Iter(std::move(i)); } -} // namespace MSF -} // namespace openvpn +} // namespace openvpn::MSF diff --git a/openvpn/common/ostream_containers.hpp b/openvpn/common/ostream_containers.hpp index 647ecbc49..9d18a0178 100644 --- a/openvpn/common/ostream_containers.hpp +++ b/openvpn/common/ostream_containers.hpp @@ -30,9 +30,7 @@ #include -namespace openvpn { - -namespace C2os { +namespace openvpn::C2os { /** * @brief New typename for holding the underlying container type @@ -141,5 +139,4 @@ inline std::ostream &operator<<(std::ostream &os, const PtrContainer &contain return os; } -} // namespace C2os -} // namespace openvpn +} // namespace openvpn::C2os diff --git a/openvpn/common/path.hpp b/openvpn/common/path.hpp index 20e1d2401..2d913a9a7 100644 --- a/openvpn/common/path.hpp +++ b/openvpn/common/path.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace path { +namespace openvpn::path { // Directory separators. The first char in dirsep is the primary // separator for the platform, while subsequent chars are also @@ -202,7 +201,6 @@ inline std::string join(const std::string &p1, const std::string &p2, Args... ar return join(join(p1, p2), args...); } -} // namespace path -} // namespace openvpn +} // namespace openvpn::path #endif // OPENVPN_COMMON_STRING_H diff --git a/openvpn/common/peercred.hpp b/openvpn/common/peercred.hpp index 672931806..864cf92a4 100644 --- a/openvpn/common/peercred.hpp +++ b/openvpn/common/peercred.hpp @@ -33,8 +33,7 @@ #include #endif -namespace openvpn { -namespace SockOpt { +namespace openvpn::SockOpt { struct Creds { @@ -87,7 +86,6 @@ inline bool peercreds(const int fd, Creds &cr) #endif } -} // namespace SockOpt -} // namespace openvpn +} // namespace openvpn::SockOpt #endif diff --git a/openvpn/common/pipe.hpp b/openvpn/common/pipe.hpp index 2b0af3cd9..bd2c6a7ab 100644 --- a/openvpn/common/pipe.hpp +++ b/openvpn/common/pipe.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace Pipe { +namespace openvpn::Pipe { class SD { public: @@ -143,7 +142,6 @@ inline void make_pipe(ScopedFD &read, ScopedFD &write) read.reset(fd[0]); write.reset(fd[1]); } -} // namespace Pipe -} // namespace openvpn +} // namespace openvpn::Pipe #endif diff --git a/openvpn/common/sfinae.hpp b/openvpn/common/sfinae.hpp index 07969b33f..50b0f513c 100644 --- a/openvpn/common/sfinae.hpp +++ b/openvpn/common/sfinae.hpp @@ -21,8 +21,7 @@ #pragma once -namespace openvpn { -namespace SFINAE { +namespace openvpn::SFINAE { template struct Rank : Rank @@ -33,5 +32,4 @@ struct Rank<0> { }; -} // namespace SFINAE -} // namespace openvpn +} // namespace openvpn::SFINAE diff --git a/openvpn/common/sockopt.hpp b/openvpn/common/sockopt.hpp index cad81c629..86cd1597d 100644 --- a/openvpn/common/sockopt.hpp +++ b/openvpn/common/sockopt.hpp @@ -35,8 +35,7 @@ #include -namespace openvpn { -namespace SockOpt { +namespace openvpn::SockOpt { #ifdef SO_REUSEPORT // set SO_REUSEPORT for inter-thread load balancing @@ -77,8 +76,7 @@ static inline void set_nonblock(const int fd) if (::fcntl(fd, F_SETFL, O_NONBLOCK) < 0) throw Exception("error setting socket to non-blocking mode"); } -} // namespace SockOpt -} // namespace openvpn +} // namespace openvpn::SockOpt #endif #endif diff --git a/openvpn/common/string.hpp b/openvpn/common/string.hpp index b8c454e48..e20b1af38 100644 --- a/openvpn/common/string.hpp +++ b/openvpn/common/string.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace string { +namespace openvpn::string { // case insensitive compare functions inline int strcasecmp(const char *s1, const char *s2) @@ -691,8 +690,6 @@ inline std::string remove_char(const std::string &str, const char remove) return ret; } -} // namespace string - -} // namespace openvpn +} // namespace openvpn::string #endif // OPENVPN_COMMON_STRING_H diff --git a/openvpn/common/stringtempl.hpp b/openvpn/common/stringtempl.hpp index 0360ce05c..058136ac7 100644 --- a/openvpn/common/stringtempl.hpp +++ b/openvpn/common/stringtempl.hpp @@ -32,8 +32,7 @@ #include // for std::nullptr_t #include -namespace openvpn { -namespace StringTempl { +namespace openvpn::StringTempl { // empty @@ -88,7 +87,6 @@ inline const char *to_cstring(const char *str) { return str; } -} // namespace StringTempl -} // namespace openvpn +} // namespace openvpn::StringTempl #endif diff --git a/openvpn/common/stringtempl2.hpp b/openvpn/common/stringtempl2.hpp index f03c38ee8..56203181c 100644 --- a/openvpn/common/stringtempl2.hpp +++ b/openvpn/common/stringtempl2.hpp @@ -27,8 +27,7 @@ #include -namespace openvpn { -namespace StringTempl { +namespace openvpn::StringTempl { // empty @@ -64,5 +63,4 @@ inline std::string to_string(T value) return std::to_string(value); } -} // namespace StringTempl -} // namespace openvpn +} // namespace openvpn::StringTempl diff --git a/openvpn/common/strneq.hpp b/openvpn/common/strneq.hpp index 2a3a41f8f..ba14795f0 100644 --- a/openvpn/common/strneq.hpp +++ b/openvpn/common/strneq.hpp @@ -24,8 +24,7 @@ #include #include -namespace openvpn { -namespace crypto { +namespace openvpn::crypto { // Compare strings in a way that is more resistant to timing attacks. // s1 should be the string provided by the user, while s2 is the @@ -60,5 +59,4 @@ inline bool str_neq(const std::string &s1, const std::string &s2) { return str_neq(s1.c_str(), s2.c_str()); } -} // namespace crypto -} // namespace openvpn +} // namespace openvpn::crypto diff --git a/openvpn/common/unicode-impl.hpp b/openvpn/common/unicode-impl.hpp index 445859ecf..59cae42e5 100644 --- a/openvpn/common/unicode-impl.hpp +++ b/openvpn/common/unicode-impl.hpp @@ -24,8 +24,7 @@ #ifndef OPENVPN_COMMON_UNICODE_IMPL_H #define OPENVPN_COMMON_UNICODE_IMPL_H -namespace openvpn { - namespace Unicode { +namespace openvpn::Unicode { /* --------------------------------------------------------------------- Conversions between UTF32, UTF-16, and UTF-8. Header file. @@ -648,7 +647,6 @@ namespace openvpn { similarly unrolled loops. --------------------------------------------------------------------- */ - } } #endif diff --git a/openvpn/common/unicode.hpp b/openvpn/common/unicode.hpp index 86c02577c..133edd124 100644 --- a/openvpn/common/unicode.hpp +++ b/openvpn/common/unicode.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace Unicode { +namespace openvpn::Unicode { OPENVPN_SIMPLE_EXCEPTION(unicode_src_overflow); OPENVPN_SIMPLE_EXCEPTION(unicode_dest_overflow); @@ -300,7 +299,6 @@ class UTF8Iterator const unsigned char *str; size_t size; }; -} // namespace Unicode -} // namespace openvpn +} // namespace openvpn::Unicode #endif diff --git a/openvpn/common/userpass.hpp b/openvpn/common/userpass.hpp index 5665c6480..52a403c77 100644 --- a/openvpn/common/userpass.hpp +++ b/openvpn/common/userpass.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace UserPass { +namespace openvpn::UserPass { OPENVPN_EXCEPTION(creds_error); @@ -211,7 +210,6 @@ inline void parse_file(const std::string &path, throw creds_error(path + " : password empty"); } -} // namespace UserPass -} // namespace openvpn +} // namespace openvpn::UserPass #endif diff --git a/openvpn/common/wstring.hpp b/openvpn/common/wstring.hpp index 53e358c96..690d883a9 100644 --- a/openvpn/common/wstring.hpp +++ b/openvpn/common/wstring.hpp @@ -27,8 +27,7 @@ #include #include -namespace openvpn { -namespace wstring { +namespace openvpn::wstring { /** * @brief Convert a UTF-8 string to UTF-16 @@ -117,6 +116,4 @@ inline std::wstring pack_string_vector(const std::vector &strvec) } #endif // #ifdef _WIN32 - -} // namespace wstring -} // namespace openvpn +} diff --git a/openvpn/compress/lzoasym_impl.hpp b/openvpn/compress/lzoasym_impl.hpp index 86bb8e0ba..3678662f3 100644 --- a/openvpn/compress/lzoasym_impl.hpp +++ b/openvpn/compress/lzoasym_impl.hpp @@ -66,8 +66,7 @@ goto assert_fail; \ } -namespace openvpn { -namespace lzo_asym_impl { +namespace openvpn::lzo_asym_impl { // Return status values enum { @@ -351,8 +350,7 @@ inline int lzo1x_decompress_safe(const unsigned char *input, input_too_large: return LZOASYM_E_INPUT_TOO_LARGE; } -} // namespace lzo_asym_impl -} // namespace openvpn +} // namespace openvpn::lzo_asym_impl #undef LZOASYM_CHECK_INPUT_OVERFLOW #undef LZOASYM_CHECK_OUTPUT_OVERFLOW diff --git a/openvpn/crypto/cryptoalgs.hpp b/openvpn/crypto/cryptoalgs.hpp index 2769d4881..2860bbae9 100644 --- a/openvpn/crypto/cryptoalgs.hpp +++ b/openvpn/crypto/cryptoalgs.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace CryptoAlgs { +namespace openvpn::CryptoAlgs { OPENVPN_EXCEPTION(crypto_alg); OPENVPN_SIMPLE_EXCEPTION(crypto_alg_index); @@ -390,7 +389,6 @@ inline bool use_cipher_digest(const Type type) const Alg &alg = get(type); return alg.mode() != AEAD; } -} // namespace CryptoAlgs -} // namespace openvpn +} // namespace openvpn::CryptoAlgs #endif diff --git a/openvpn/crypto/definitions.hpp b/openvpn/crypto/definitions.hpp index aa9324747..e7f224c2d 100644 --- a/openvpn/crypto/definitions.hpp +++ b/openvpn/crypto/definitions.hpp @@ -28,8 +28,7 @@ /* We need to define this very early and in its own small header file so we * can ensure that these definitions are always available */ -namespace openvpn { -namespace SSLLib { +namespace openvpn::SSLLib { #if defined(USE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L using Ctx = OSSL_LIB_CTX *; @@ -37,5 +36,4 @@ using Ctx = OSSL_LIB_CTX *; using Ctx = void *; #endif -} // namespace SSLLib -} // namespace openvpn +} // namespace openvpn::SSLLib diff --git a/openvpn/crypto/selftest.hpp b/openvpn/crypto/selftest.hpp index fd2bb1051..27d8584ce 100644 --- a/openvpn/crypto/selftest.hpp +++ b/openvpn/crypto/selftest.hpp @@ -43,8 +43,7 @@ #include #endif -namespace openvpn { -namespace SelfTest { +namespace openvpn::SelfTest { inline std::string crypto_self_test() { std::string ret; @@ -59,7 +58,6 @@ inline std::string crypto_self_test() #endif return ret; } -} // namespace SelfTest -} // namespace openvpn +} // namespace openvpn::SelfTest #endif // OPENVPN_CRYPTO_CRYPTO_H diff --git a/openvpn/dco/dcocli.hpp b/openvpn/dco/dcocli.hpp index 0e21c6bc1..3aadce74d 100644 --- a/openvpn/dco/dcocli.hpp +++ b/openvpn/dco/dcocli.hpp @@ -64,8 +64,7 @@ // client-side DCO (Data Channel Offload) module for Linux/kovpn -namespace openvpn { -namespace DCOTransport { +namespace openvpn::DCOTransport { enum { OVPN_PEER_ID_UNDEF = 0x00FFFFFF, @@ -353,5 +352,4 @@ ClientConfig::new_tun_client_obj(openvpn_io::io_context &io_context, cli->tun_parent = &parent; return TunClient::Ptr(cli); } -} // namespace DCOTransport -} // namespace openvpn +} // namespace openvpn::DCOTransport diff --git a/openvpn/dco/key.hpp b/openvpn/dco/key.hpp index 728828c57..91b2022b4 100644 --- a/openvpn/dco/key.hpp +++ b/openvpn/dco/key.hpp @@ -22,8 +22,7 @@ #pragma once -namespace openvpn { -namespace KoRekey { +namespace openvpn::KoRekey { struct KeyDirection { @@ -42,5 +41,4 @@ struct KeyConfig unsigned int cipher_alg; }; -} // namespace KoRekey -} // namespace openvpn \ No newline at end of file +} // namespace openvpn::KoRekey \ No newline at end of file diff --git a/openvpn/dco/kocrypto.hpp b/openvpn/dco/kocrypto.hpp index 1e2b9e024..a0b0a7249 100644 --- a/openvpn/dco/kocrypto.hpp +++ b/openvpn/dco/kocrypto.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace KoRekey { +namespace openvpn::KoRekey { OPENVPN_EXCEPTION(korekey_error); @@ -138,8 +137,7 @@ class Key std::memset(dest + NONCE_TAIL_SIZE, 0, dest_size - NONCE_TAIL_SIZE); } }; -} // namespace KoRekey -} // namespace openvpn +} // namespace openvpn::KoRekey #ifdef ENABLE_KOVPN #include diff --git a/openvpn/dco/korekey.hpp b/openvpn/dco/korekey.hpp index 6f86b54de..abefb5e80 100644 --- a/openvpn/dco/korekey.hpp +++ b/openvpn/dco/korekey.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace KoRekey { +namespace openvpn::KoRekey { class Receiver : public virtual RC { @@ -195,7 +194,6 @@ class Factory : public CryptoDCFactory Frame::Ptr frame; }; -} // namespace KoRekey -} // namespace openvpn +} // namespace openvpn::KoRekey #endif diff --git a/openvpn/dco/ovpndcokocrypto.hpp b/openvpn/dco/ovpndcokocrypto.hpp index 216174a7f..3955578ff 100644 --- a/openvpn/dco/ovpndcokocrypto.hpp +++ b/openvpn/dco/ovpndcokocrypto.hpp @@ -24,8 +24,7 @@ #pragma once -namespace openvpn { -namespace KoRekey { +namespace openvpn::KoRekey { /** * @brief Parses key information into format consumed by ovpn-dco. @@ -103,5 +102,4 @@ class OvpnDcoKey : public Key struct KeyConfig kc; }; -} // namespace KoRekey -} // namespace openvpn +} // namespace openvpn::KoRekey diff --git a/openvpn/error/error.hpp b/openvpn/error/error.hpp index 765bcb0a0..970878ea0 100644 --- a/openvpn/error/error.hpp +++ b/openvpn/error/error.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace Error { +namespace openvpn::Error { enum Type { @@ -199,7 +198,6 @@ inline const char *name(const size_t type) else return "UNKNOWN_ERROR_TYPE"; } -} // namespace Error -} // namespace openvpn +} // namespace openvpn::Error #endif // OPENVPN_ERROR_ERROR_H diff --git a/openvpn/http/header.hpp b/openvpn/http/header.hpp index 9195efbb7..a5f6d2d48 100644 --- a/openvpn/http/header.hpp +++ b/openvpn/http/header.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { struct Header { @@ -111,7 +110,6 @@ struct HeaderList : public std::vector
} }; -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP #endif diff --git a/openvpn/http/headredact.hpp b/openvpn/http/headredact.hpp index b4904c14f..7989a2f7c 100644 --- a/openvpn/http/headredact.hpp +++ b/openvpn/http/headredact.hpp @@ -24,8 +24,7 @@ #include #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { inline std::string headers_redact(const std::string &headers) { @@ -65,5 +64,4 @@ inline std::string headers_redact(const std::string &headers) #endif } -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP diff --git a/openvpn/http/htmlskip.hpp b/openvpn/http/htmlskip.hpp index 1ecffcf5a..a32ac9d18 100644 --- a/openvpn/http/htmlskip.hpp +++ b/openvpn/http/htmlskip.hpp @@ -36,8 +36,7 @@ #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { class HTMLSkip { @@ -283,7 +282,6 @@ class HTMLSkip unsigned long bytes; }; -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP #endif diff --git a/openvpn/http/method.hpp b/openvpn/http/method.hpp index 0f29287ff..78580ddbf 100644 --- a/openvpn/http/method.hpp +++ b/openvpn/http/method.hpp @@ -22,9 +22,7 @@ #ifndef OPENVPN_HTTP_METHOD_H #define OPENVPN_HTTP_METHOD_H -namespace openvpn { -namespace HTTP { -namespace Method { +namespace openvpn::HTTP::Method { enum Type { OTHER, @@ -41,8 +39,6 @@ Type parse(const std::string &methstr) else return OTHER; } -} // namespace Method -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP::Method #endif diff --git a/openvpn/http/parseutil.hpp b/openvpn/http/parseutil.hpp index 70a9b4312..6bf06993b 100644 --- a/openvpn/http/parseutil.hpp +++ b/openvpn/http/parseutil.hpp @@ -30,9 +30,7 @@ #ifndef OPENVPN_HTTP_PARSEUTIL_H #define OPENVPN_HTTP_PARSEUTIL_H -namespace openvpn { -namespace HTTP { -namespace Util { +namespace openvpn::HTTP::Util { // Check if a byte is an HTTP character. inline bool is_char(const unsigned char c) @@ -95,8 +93,6 @@ inline bool is_escaped(const unsigned char c) return false; return true; } -} // namespace Util -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP::Util #endif diff --git a/openvpn/http/reply.hpp b/openvpn/http/reply.hpp index 2b7d964ed..4873c87b2 100644 --- a/openvpn/http/reply.hpp +++ b/openvpn/http/reply.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { struct Reply { @@ -404,7 +403,6 @@ struct ReplyType typedef Reply State; typedef ReplyParser Parser; }; -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP #endif diff --git a/openvpn/http/request.hpp b/openvpn/http/request.hpp index df594ad7c..0d8125257 100644 --- a/openvpn/http/request.hpp +++ b/openvpn/http/request.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { struct Request { @@ -399,7 +398,6 @@ struct RequestType typedef Request State; typedef RequestParser Parser; }; -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP #endif diff --git a/openvpn/http/status.hpp b/openvpn/http/status.hpp index 1599825ab..33bcc4d97 100644 --- a/openvpn/http/status.hpp +++ b/openvpn/http/status.hpp @@ -24,9 +24,7 @@ // HTTP status codes -namespace openvpn { -namespace HTTP { -namespace Status { +namespace openvpn::HTTP::Status { enum { OK = 200, @@ -73,8 +71,6 @@ inline const char *to_string(const int status) return ""; } } -} // namespace Status -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP::Status #endif diff --git a/openvpn/http/urlencode.hpp b/openvpn/http/urlencode.hpp index 88c9c15a0..6d646ab7a 100644 --- a/openvpn/http/urlencode.hpp +++ b/openvpn/http/urlencode.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace URL { +namespace openvpn::URL { OPENVPN_EXCEPTION(url_error); inline std::string encode(const std::string &str) @@ -115,7 +114,6 @@ inline std::vector decode_path(std::string path) i = decode(i); return list; } -} // namespace URL -} // namespace openvpn +} // namespace openvpn::URL #endif diff --git a/openvpn/http/urlparm.hpp b/openvpn/http/urlparm.hpp index d8f6d3c96..aa893e94e 100644 --- a/openvpn/http/urlparm.hpp +++ b/openvpn/http/urlparm.hpp @@ -31,8 +31,7 @@ #include #include -namespace openvpn { -namespace URL { +namespace openvpn::URL { OPENVPN_EXCEPTION(url_parameter_error); struct Parm @@ -208,7 +207,6 @@ class ParmList : public std::vector std::string request_; }; -} // namespace URL -} // namespace openvpn +} // namespace openvpn::URL #endif diff --git a/openvpn/http/urlparse.hpp b/openvpn/http/urlparse.hpp index d95d53d9e..5fce1c27c 100644 --- a/openvpn/http/urlparse.hpp +++ b/openvpn/http/urlparse.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace URL { +namespace openvpn::URL { OPENVPN_EXCEPTION(url_parse_error); class Parse @@ -269,7 +268,6 @@ class Parse } }; -} // namespace URL -} // namespace openvpn +} // namespace openvpn::URL #endif diff --git a/openvpn/http/validate_uri.hpp b/openvpn/http/validate_uri.hpp index 623718fdb..b0e82af98 100644 --- a/openvpn/http/validate_uri.hpp +++ b/openvpn/http/validate_uri.hpp @@ -23,8 +23,7 @@ #include -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { inline bool is_valid_uri_char(const unsigned char c) { return c >= 0x21 && c <= 0x7E; @@ -48,5 +47,4 @@ inline void validate_uri(const std::string &uri, const std::string &title) } } -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP diff --git a/openvpn/http/webexcept.hpp b/openvpn/http/webexcept.hpp index 76ff28e5b..5c329c31c 100644 --- a/openvpn/http/webexcept.hpp +++ b/openvpn/http/webexcept.hpp @@ -36,8 +36,7 @@ throw exc(status, _ovpn_exc.str()); \ } while (0) -namespace openvpn { -namespace HTTP { +namespace openvpn::HTTP { class WebException : public std::exception { public: @@ -74,7 +73,6 @@ class WebException : public std::exception const std::string error_; const std::string formatted; }; -} // namespace HTTP -} // namespace openvpn +} // namespace openvpn::HTTP #endif diff --git a/openvpn/init/initprocess.hpp b/openvpn/init/initprocess.hpp index afdef5188..edae90de4 100644 --- a/openvpn/init/initprocess.hpp +++ b/openvpn/init/initprocess.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace InitProcess { +namespace openvpn::InitProcess { class Init { private: @@ -93,5 +92,4 @@ class Init } }; -} // namespace InitProcess -} // namespace openvpn +} // namespace openvpn::InitProcess diff --git a/openvpn/ip/csum.hpp b/openvpn/ip/csum.hpp index 9a3bd7817..8cf132d65 100644 --- a/openvpn/ip/csum.hpp +++ b/openvpn/ip/csum.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace IPChecksum { +namespace openvpn::IPChecksum { inline std::uint16_t fold(std::uint32_t sum) { @@ -170,5 +169,4 @@ inline std::uint16_t checksum(const void *data, const size_t size) { return cfold(compute(data, size)); } -} // namespace IPChecksum -} // namespace openvpn +} // namespace openvpn::IPChecksum diff --git a/openvpn/ip/ipcommon.hpp b/openvpn/ip/ipcommon.hpp index 9c8de6f4e..e64a3c20b 100644 --- a/openvpn/ip/ipcommon.hpp +++ b/openvpn/ip/ipcommon.hpp @@ -25,8 +25,7 @@ #include // for std::uint32_t, uint16_t, uint8_t -namespace openvpn { -namespace IPCommon { +namespace openvpn::IPCommon { enum { @@ -48,5 +47,4 @@ inline unsigned int version(const std::uint8_t version_len_prio) return (version_len_prio >> 4) & 0x0F; } -} // namespace IPCommon -} // namespace openvpn +} // namespace openvpn::IPCommon diff --git a/openvpn/log/logdatetime.hpp b/openvpn/log/logdatetime.hpp index 2c0964a11..c452b9fb5 100644 --- a/openvpn/log/logdatetime.hpp +++ b/openvpn/log/logdatetime.hpp @@ -38,8 +38,7 @@ #define OPENVPN_LOG_STRING(str) OPENVPN_LOG_STREAM << date_time() << ' ' << (str) // no-op constructs normally used with logthread.hpp -namespace openvpn { -namespace Log { +namespace openvpn::Log { struct Context { struct Wrapper @@ -49,5 +48,4 @@ struct Context { } }; -} // namespace Log -} // namespace openvpn +} // namespace openvpn::Log diff --git a/openvpn/log/logthread_class.hpp b/openvpn/log/logthread_class.hpp index 047d207a3..241e600e6 100644 --- a/openvpn/log/logthread_class.hpp +++ b/openvpn/log/logthread_class.hpp @@ -27,8 +27,7 @@ #error OPENVPN_LOG_CLASS must be defined #endif -namespace openvpn { -namespace Log { +namespace openvpn::Log { #ifdef OPENVPN_LOG_GLOBAL // OPENVPN_LOG uses global object pointer @@ -105,5 +104,4 @@ struct Context return global_log; } }; -} // namespace Log -} // namespace openvpn +} // namespace openvpn::Log diff --git a/openvpn/mbedtls/crypto/cipher.hpp b/openvpn/mbedtls/crypto/cipher.hpp index 2ba93b17e..e43ef0b3c 100644 --- a/openvpn/mbedtls/crypto/cipher.hpp +++ b/openvpn/mbedtls/crypto/cipher.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace MbedTLSCrypto { +namespace openvpn::MbedTLSCrypto { class CipherContextCommon { public: @@ -239,7 +238,6 @@ class CipherContext } } }; -} // namespace MbedTLSCrypto -} // namespace openvpn +} // namespace openvpn::MbedTLSCrypto #endif diff --git a/openvpn/mbedtls/crypto/cipheraead.hpp b/openvpn/mbedtls/crypto/cipheraead.hpp index b6eb4548a..90f6e0ebf 100644 --- a/openvpn/mbedtls/crypto/cipheraead.hpp +++ b/openvpn/mbedtls/crypto/cipheraead.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace MbedTLSCrypto { +namespace openvpn::MbedTLSCrypto { class CipherContextAEAD : public CipherContextCommon { CipherContextAEAD(const CipherContextAEAD &) = delete; @@ -187,5 +186,4 @@ class CipherContextAEAD : public CipherContextCommon } } }; -} // namespace MbedTLSCrypto -} // namespace openvpn +} // namespace openvpn::MbedTLSCrypto diff --git a/openvpn/mbedtls/crypto/digest.hpp b/openvpn/mbedtls/crypto/digest.hpp index 12ec56c6a..f0eac9c00 100644 --- a/openvpn/mbedtls/crypto/digest.hpp +++ b/openvpn/mbedtls/crypto/digest.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace MbedTLSCrypto { +namespace openvpn::MbedTLSCrypto { class HMACContext; class DigestContext @@ -167,7 +166,6 @@ class DigestContext bool initialized; mbedtls_md_context_t ctx; }; -} // namespace MbedTLSCrypto -} // namespace openvpn +} // namespace openvpn::MbedTLSCrypto #endif diff --git a/openvpn/mbedtls/crypto/hmac.hpp b/openvpn/mbedtls/crypto/hmac.hpp index 98e14ec0f..207e12fc5 100644 --- a/openvpn/mbedtls/crypto/hmac.hpp +++ b/openvpn/mbedtls/crypto/hmac.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace MbedTLSCrypto { +namespace openvpn::MbedTLSCrypto { class HMACContext { HMACContext(const HMACContext &) = delete; @@ -135,7 +134,6 @@ class HMACContext bool initialized; mbedtls_md_context_t ctx; }; -} // namespace MbedTLSCrypto -} // namespace openvpn +} // namespace openvpn::MbedTLSCrypto #endif diff --git a/openvpn/mbedtls/crypto/tls1prf.hpp b/openvpn/mbedtls/crypto/tls1prf.hpp index 530a4c884..1cd01e12b 100644 --- a/openvpn/mbedtls/crypto/tls1prf.hpp +++ b/openvpn/mbedtls/crypto/tls1prf.hpp @@ -23,8 +23,7 @@ #include -namespace openvpn { -namespace MbedTLSCrypto { +namespace openvpn::MbedTLSCrypto { class TLS1PRF { public: @@ -141,5 +140,4 @@ class TLS1PRF #endif }; -} // namespace MbedTLSCrypto -} // namespace openvpn +} // namespace openvpn::MbedTLSCrypto diff --git a/openvpn/mbedtls/pki/dh.hpp b/openvpn/mbedtls/pki/dh.hpp index a31fc08b7..f4c63f236 100644 --- a/openvpn/mbedtls/pki/dh.hpp +++ b/openvpn/mbedtls/pki/dh.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace MbedTLSPKI { +namespace openvpn::MbedTLSPKI { class DH : public RC { @@ -122,7 +121,6 @@ class DH : public RC mbedtls_dhm_context *dhc; std::string pem_dhc; }; -} // namespace MbedTLSPKI -} // namespace openvpn +} // namespace openvpn::MbedTLSPKI #endif diff --git a/openvpn/mbedtls/pki/pkctx.hpp b/openvpn/mbedtls/pki/pkctx.hpp index 100d720f7..142f62b63 100644 --- a/openvpn/mbedtls/pki/pkctx.hpp +++ b/openvpn/mbedtls/pki/pkctx.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace MbedTLSPKI { +namespace openvpn::MbedTLSPKI { class PKContext : public RC { @@ -174,6 +173,5 @@ class PKContext : public RC mbedtls_pk_context *ctx; }; -} // namespace MbedTLSPKI -} // namespace openvpn +} // namespace openvpn::MbedTLSPKI #endif diff --git a/openvpn/mbedtls/pki/x509cert.hpp b/openvpn/mbedtls/pki/x509cert.hpp index c1c74f7b7..ef9a14f1d 100644 --- a/openvpn/mbedtls/pki/x509cert.hpp +++ b/openvpn/mbedtls/pki/x509cert.hpp @@ -39,8 +39,7 @@ #include #include -namespace openvpn { -namespace MbedTLSPKI { +namespace openvpn::MbedTLSPKI { class X509Cert : public RC { @@ -176,7 +175,6 @@ class X509Cert : public RC constexpr static const char *begin_cert = "-----BEGIN CERTIFICATE-----\n"; constexpr static const char *end_cert = "-----END CERTIFICATE-----\n"; }; -} // namespace MbedTLSPKI -} // namespace openvpn +} // namespace openvpn::MbedTLSPKI #endif diff --git a/openvpn/mbedtls/pki/x509certinfo.hpp b/openvpn/mbedtls/pki/x509certinfo.hpp index 667818db5..90cd094d2 100644 --- a/openvpn/mbedtls/pki/x509certinfo.hpp +++ b/openvpn/mbedtls/pki/x509certinfo.hpp @@ -34,8 +34,7 @@ #define MBEDTLS_MAX_SUBJECT_LENGTH 256 -namespace openvpn { -namespace MbedTLSPKI { +namespace openvpn::MbedTLSPKI { /** * Retrieve the complete X.509 Certificate Subject field @@ -138,5 +137,4 @@ static std::string x509_get_common_name(const mbedtls_x509_crt *cert) : std::string("")); } -} // namespace MbedTLSPKI -} // namespace openvpn +} // namespace openvpn::MbedTLSPKI diff --git a/openvpn/mbedtls/pki/x509crl.hpp b/openvpn/mbedtls/pki/x509crl.hpp index c5eeecdf8..0ee78869e 100644 --- a/openvpn/mbedtls/pki/x509crl.hpp +++ b/openvpn/mbedtls/pki/x509crl.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace MbedTLSPKI { +namespace openvpn::MbedTLSPKI { class X509CRL : public RC { @@ -117,7 +116,6 @@ class X509CRL : public RC mbedtls_x509_crl *chain; std::string pem_chain; }; -} // namespace MbedTLSPKI -} // namespace openvpn +} // namespace openvpn::MbedTLSPKI #endif diff --git a/openvpn/mbedtls/util/pkcs1.hpp b/openvpn/mbedtls/util/pkcs1.hpp index fe4b1373c..5508e97f6 100644 --- a/openvpn/mbedtls/util/pkcs1.hpp +++ b/openvpn/mbedtls/util/pkcs1.hpp @@ -24,9 +24,7 @@ #include -namespace openvpn { -namespace PKCS1 { -namespace DigestPrefix { +namespace openvpn::PKCS1::DigestPrefix { class MbedTLSParse : public Parse { @@ -62,8 +60,6 @@ class MbedTLSParse : public Parse } } }; -} // namespace DigestPrefix -} // namespace PKCS1 -} // namespace openvpn +} // namespace openvpn::PKCS1::DigestPrefix #endif diff --git a/openvpn/openssl/bio/bio_memq_dgram.hpp b/openvpn/openssl/bio/bio_memq_dgram.hpp index e2015569e..1a4b21010 100644 --- a/openvpn/openssl/bio/bio_memq_dgram.hpp +++ b/openvpn/openssl/bio/bio_memq_dgram.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace bmq_dgram { +namespace openvpn::bmq_dgram { class MemQ : public MemQDgram { @@ -268,7 +267,6 @@ MemQ() { bio_memq_internal::free_bio_method(); } -} // namespace bmq_dgram -} // namespace openvpn +} // namespace openvpn::bmq_dgram #endif // OPENVPN_OPENSSL_BIO_BIO_MEMQ_DGRAM_H diff --git a/openvpn/openssl/bio/bio_memq_stream.hpp b/openvpn/openssl/bio/bio_memq_stream.hpp index b2d091618..143fd2b5b 100644 --- a/openvpn/openssl/bio/bio_memq_stream.hpp +++ b/openvpn/openssl/bio/bio_memq_stream.hpp @@ -37,8 +37,7 @@ #include -namespace openvpn { -namespace bmq_stream { +namespace openvpn::bmq_stream { class MemQ : public MemQStream { @@ -235,5 +234,4 @@ inline const MemQ *const_memq_from_bio(const BIO *b) else return nullptr; } -} // namespace bmq_stream -} // namespace openvpn +} // namespace openvpn::bmq_stream diff --git a/openvpn/openssl/crypto/cipher.hpp b/openvpn/openssl/crypto/cipher.hpp index ea7854e4d..7cd9b06ac 100644 --- a/openvpn/openssl/crypto/cipher.hpp +++ b/openvpn/openssl/crypto/cipher.hpp @@ -37,8 +37,7 @@ #include #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class CipherContext { /* In OpenSSL 3.0 the method that returns EVP_CIPHER, the cipher needs to be @@ -219,7 +218,6 @@ class CipherContext EVP_CIPHER_CTX *ctx = nullptr; }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto #endif diff --git a/openvpn/openssl/crypto/cipheraead.hpp b/openvpn/openssl/crypto/cipheraead.hpp index 935564621..7b2809c78 100644 --- a/openvpn/openssl/crypto/cipheraead.hpp +++ b/openvpn/openssl/crypto/cipheraead.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class CipherContextAEAD { /* In OpenSSL 3.0 the method that returns EVP_CIPHER, the cipher needs to be @@ -273,5 +272,4 @@ class CipherContextAEAD EVP_CIPHER_CTX *ctx = nullptr; }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto diff --git a/openvpn/openssl/crypto/digest.hpp b/openvpn/openssl/crypto/digest.hpp index be7c4dfed..12b48286e 100644 --- a/openvpn/openssl/crypto/digest.hpp +++ b/openvpn/openssl/crypto/digest.hpp @@ -41,8 +41,7 @@ #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class HMACContext; class DigestContext @@ -133,7 +132,6 @@ class DigestContext using EVP_MD_CTX_unique_ptr = std::unique_ptr; EVP_MD_CTX_unique_ptr ctx{nullptr, ::EVP_MD_CTX_free}; }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto #endif diff --git a/openvpn/openssl/crypto/hmac-compat.hpp b/openvpn/openssl/crypto/hmac-compat.hpp index 423edd4f7..bc3827dc8 100644 --- a/openvpn/openssl/crypto/hmac-compat.hpp +++ b/openvpn/openssl/crypto/hmac-compat.hpp @@ -33,8 +33,7 @@ #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class HMACContext { public: @@ -148,7 +147,6 @@ class HMACContext HMAC_CTX *ctx = nullptr; }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto #endif diff --git a/openvpn/openssl/crypto/mac.hpp b/openvpn/openssl/crypto/mac.hpp index 52d33e17c..1e014b8d5 100644 --- a/openvpn/openssl/crypto/mac.hpp +++ b/openvpn/openssl/crypto/mac.hpp @@ -39,8 +39,7 @@ #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class HMACContext { HMACContext(const HMACContext &) = delete; @@ -171,7 +170,6 @@ class HMACContext uint8_t key[EVP_MAX_MD_SIZE]; EVP_MAC_CTX *ctx = nullptr; }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto #endif \ No newline at end of file diff --git a/openvpn/openssl/crypto/tls1prf.hpp b/openvpn/openssl/crypto/tls1prf.hpp index a3e87583f..a0403283d 100644 --- a/openvpn/openssl/crypto/tls1prf.hpp +++ b/openvpn/openssl/crypto/tls1prf.hpp @@ -31,8 +31,7 @@ #include -namespace openvpn { -namespace OpenSSLCrypto { +namespace openvpn::OpenSSLCrypto { class TLS1PRF { @@ -123,5 +122,4 @@ class TLS1PRF #endif }; -} // namespace OpenSSLCrypto -} // namespace openvpn +} // namespace openvpn::OpenSSLCrypto diff --git a/openvpn/openssl/pki/crl.hpp b/openvpn/openssl/pki/crl.hpp index f3e5b21b0..4270bd489 100644 --- a/openvpn/openssl/pki/crl.hpp +++ b/openvpn/openssl/pki/crl.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { class CRL { @@ -172,5 +171,4 @@ class CRLList : public std::vector return ret; } }; -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI diff --git a/openvpn/openssl/pki/dh-compat.hpp b/openvpn/openssl/pki/dh-compat.hpp index 8148114c4..a6edee982 100644 --- a/openvpn/openssl/pki/dh-compat.hpp +++ b/openvpn/openssl/pki/dh-compat.hpp @@ -39,8 +39,7 @@ #define CHECKED_PTR_OF(type, p) ((char *)(1 ? p : (type *)0)) #endif -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { namespace DH_private { // defined outside of DH class to avoid symbol collision in way @@ -167,5 +166,4 @@ class DH ::DH *dh_; }; -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI diff --git a/openvpn/openssl/pki/dh.hpp b/openvpn/openssl/pki/dh.hpp index 55d3bc6b3..920715fc1 100644 --- a/openvpn/openssl/pki/dh.hpp +++ b/openvpn/openssl/pki/dh.hpp @@ -36,8 +36,7 @@ #else -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { @@ -169,6 +168,5 @@ class DH ::EVP_PKEY *dh_; }; -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI #endif \ No newline at end of file diff --git a/openvpn/openssl/pki/pkey.hpp b/openvpn/openssl/pki/pkey.hpp index 625d20348..bc9f39a6c 100644 --- a/openvpn/openssl/pki/pkey.hpp +++ b/openvpn/openssl/pki/pkey.hpp @@ -37,8 +37,7 @@ #include #include -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { class PKey { @@ -231,5 +230,4 @@ class PKey ::EVP_PKEY *pkey_; std::string priv_key_pwd; }; -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI diff --git a/openvpn/openssl/pki/x509certinfo.hpp b/openvpn/openssl/pki/x509certinfo.hpp index ca1b60820..bacc92769 100644 --- a/openvpn/openssl/pki/x509certinfo.hpp +++ b/openvpn/openssl/pki/x509certinfo.hpp @@ -37,8 +37,7 @@ #include "openvpn/common/hexstr.hpp" #include "openvpn/common/uniqueptr.hpp" -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { /** * Retrieve the complete X.509 Certificate Subject field @@ -264,5 +263,4 @@ static inline std::vector x509_get_fingerprint(const ::X509 *cert) return fingerprint; } -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI diff --git a/openvpn/openssl/pki/x509store.hpp b/openvpn/openssl/pki/x509store.hpp index b9eaa3324..beb79df8e 100644 --- a/openvpn/openssl/pki/x509store.hpp +++ b/openvpn/openssl/pki/x509store.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace OpenSSLPKI { +namespace openvpn::OpenSSLPKI { class X509Store { @@ -100,5 +99,4 @@ class X509Store ::X509_STORE *x509_store_; }; -} // namespace OpenSSLPKI -} // namespace openvpn +} // namespace openvpn::OpenSSLPKI diff --git a/openvpn/openssl/sign/pkcs7verify.hpp b/openvpn/openssl/sign/pkcs7verify.hpp index 6f32c9a94..775bcec4a 100644 --- a/openvpn/openssl/sign/pkcs7verify.hpp +++ b/openvpn/openssl/sign/pkcs7verify.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace OpenSSLSign { +namespace openvpn::OpenSSLSign { /* * Verify PKCS7 signature. * On success, return. @@ -85,7 +84,6 @@ inline void verify_pkcs7(const std::list &certs, if (PKCS7_verify(p7, x509_stack, nullptr, in, nullptr, PKCS7_NOVERIFY) != 1) throw OpenSSLException("OpenSSLSign::verify_pkcs7: verification failed"); } -} // namespace OpenSSLSign -} // namespace openvpn +} // namespace openvpn::OpenSSLSign #endif diff --git a/openvpn/openssl/sign/verify.hpp b/openvpn/openssl/sign/verify.hpp index f8856a3ea..b1353e2df 100644 --- a/openvpn/openssl/sign/verify.hpp +++ b/openvpn/openssl/sign/verify.hpp @@ -39,8 +39,7 @@ #include -namespace openvpn { -namespace OpenSSLSign { +namespace openvpn::OpenSSLSign { /* * Verify signature. * On success, return. @@ -94,7 +93,6 @@ inline void verify(const OpenSSLPKI::X509 &cert, if (EVP_VerifyFinal(md_ctx, binsig.c_data(), numeric_cast(binsig.length()), pkey) != 1) throw OpenSSLException("OpenSSLSign::verify: verification failed"); } -} // namespace OpenSSLSign -} // namespace openvpn +} // namespace openvpn::OpenSSLSign #endif diff --git a/openvpn/openssl/ssl/tlsver.hpp b/openvpn/openssl/ssl/tlsver.hpp index 6a3ecbd18..02586a275 100644 --- a/openvpn/openssl/ssl/tlsver.hpp +++ b/openvpn/openssl/ssl/tlsver.hpp @@ -25,8 +25,7 @@ #include -namespace openvpn { -namespace TLSVersion { +namespace openvpn::TLSVersion { inline int toTLSVersion(const Type version) { @@ -51,5 +50,4 @@ inline int toTLSVersion(const Type version) #endif } } -} // namespace TLSVersion -} // namespace openvpn +} // namespace openvpn::TLSVersion diff --git a/openvpn/pki/pkcs1.hpp b/openvpn/pki/pkcs1.hpp index 04708dba2..2f4ae7380 100644 --- a/openvpn/pki/pkcs1.hpp +++ b/openvpn/pki/pkcs1.hpp @@ -27,10 +27,8 @@ #include #include -namespace openvpn { -namespace PKCS1 { // from http://www.ietf.org/rfc/rfc3447.txt -namespace DigestPrefix { // CONST GLOBAL +namespace openvpn::PKCS1::DigestPrefix { // CONST GLOBAL namespace { // clang-format off const unsigned char MD2[] = { @@ -144,8 +142,6 @@ class Parse const T none_, md2_, md5_, sha1_, sha256_, sha384_, sha512_; }; -} // namespace DigestPrefix -} // namespace PKCS1 -} // namespace openvpn +} // namespace openvpn::PKCS1::DigestPrefix #endif diff --git a/openvpn/pki/pktype.hpp b/openvpn/pki/pktype.hpp index ea268898d..37425eb7b 100644 --- a/openvpn/pki/pktype.hpp +++ b/openvpn/pki/pktype.hpp @@ -23,8 +23,7 @@ // private key types -namespace openvpn { -namespace PKType { +namespace openvpn::PKType { enum Type { @@ -36,5 +35,4 @@ enum Type PK_ECDSA, }; -} // namespace PKType -} // namespace openvpn +} // namespace openvpn::PKType diff --git a/openvpn/pki/x509track.hpp b/openvpn/pki/x509track.hpp index a4dd0955f..88a2f19f1 100644 --- a/openvpn/pki/x509track.hpp +++ b/openvpn/pki/x509track.hpp @@ -31,8 +31,7 @@ #include #include -namespace openvpn { -namespace X509Track { +namespace openvpn::X509Track { enum Type { @@ -229,7 +228,6 @@ struct Set : public std::vector } }; -} // namespace X509Track -} // namespace openvpn +} // namespace openvpn::X509Track #endif diff --git a/openvpn/proxy/httpdigest.hpp b/openvpn/proxy/httpdigest.hpp index cb0380778..fb12673ea 100644 --- a/openvpn/proxy/httpdigest.hpp +++ b/openvpn/proxy/httpdigest.hpp @@ -29,8 +29,7 @@ #include -namespace openvpn { -namespace HTTPProxy { +namespace openvpn::HTTPProxy { class Digest { @@ -107,7 +106,6 @@ class Digest return h2.final_hex(); } }; -} // namespace HTTPProxy -} // namespace openvpn +} // namespace openvpn::HTTPProxy #endif diff --git a/openvpn/proxy/ntlm.hpp b/openvpn/proxy/ntlm.hpp index 850cbfce4..58f5a1098 100644 --- a/openvpn/proxy/ntlm.hpp +++ b/openvpn/proxy/ntlm.hpp @@ -40,8 +40,7 @@ #include #include -namespace openvpn { -namespace HTTPProxy { +namespace openvpn::HTTPProxy { class NTLM { @@ -227,7 +226,6 @@ class NTLM throw Exception("split_domain_username failed"); } }; -} // namespace HTTPProxy -} // namespace openvpn +} // namespace openvpn::HTTPProxy #endif diff --git a/openvpn/proxy/proxyauth.hpp b/openvpn/proxy/proxyauth.hpp index 43e1fc192..b2736ee2e 100644 --- a/openvpn/proxy/proxyauth.hpp +++ b/openvpn/proxy/proxyauth.hpp @@ -28,8 +28,7 @@ #include #include -namespace openvpn { -namespace HTTPProxy { +namespace openvpn::HTTPProxy { // parse the Proxy-Authenticate HTTP header class ProxyAuthenticate : public RC @@ -83,7 +82,6 @@ class ProxyAuthenticate : public RC } } }; -} // namespace HTTPProxy -} // namespace openvpn +} // namespace openvpn::HTTPProxy #endif diff --git a/openvpn/server/listenlist.hpp b/openvpn/server/listenlist.hpp index ad1a5e852..7052dd4ce 100644 --- a/openvpn/server/listenlist.hpp +++ b/openvpn/server/listenlist.hpp @@ -37,8 +37,7 @@ #include #include -namespace openvpn { -namespace Listen { +namespace openvpn::Listen { struct Item { enum SSLMode @@ -340,7 +339,6 @@ class List : public std::vector #endif } }; -} // namespace Listen -} // namespace openvpn +} // namespace openvpn::Listen #endif diff --git a/openvpn/server/manage.hpp b/openvpn/server/manage.hpp index e5a9d452d..8f1e7f6a6 100644 --- a/openvpn/server/manage.hpp +++ b/openvpn/server/manage.hpp @@ -41,20 +41,17 @@ #include -namespace openvpn { -namespace AuthStatus { +namespace openvpn::AuthStatus { // Auth constants enum Type : unsigned char; -} // namespace AuthStatus -} // namespace openvpn +} // namespace openvpn::AuthStatus // used by ipma_notify() struct ovpn_tun_head_ipma; -namespace openvpn { -namespace ManClientInstance { +namespace openvpn::ManClientInstance { // Base class for the per-client-instance state of the ManServer. // Each client instance uses this class to send data to the man layer. @@ -182,7 +179,6 @@ struct Factory : public RC virtual Send::Ptr new_man_obj(Recv *instance) = 0; }; -} // namespace ManClientInstance -} // namespace openvpn +} // namespace openvpn::ManClientInstance #endif diff --git a/openvpn/server/servhalt.hpp b/openvpn/server/servhalt.hpp index 1877296c1..2808eb0d2 100644 --- a/openvpn/server/servhalt.hpp +++ b/openvpn/server/servhalt.hpp @@ -23,8 +23,7 @@ #include -namespace openvpn { -namespace HaltRestart { +namespace openvpn::HaltRestart { enum Type { HALT, // disconnect @@ -55,5 +54,4 @@ inline std::string to_string(Type type) return "HaltRestart_?"; } } -} // namespace HaltRestart -} // namespace openvpn +} // namespace openvpn::HaltRestart diff --git a/openvpn/server/vpnservpool.hpp b/openvpn/server/vpnservpool.hpp index e2c0e30f2..b6352f9ff 100644 --- a/openvpn/server/vpnservpool.hpp +++ b/openvpn/server/vpnservpool.hpp @@ -37,8 +37,7 @@ #include #include -namespace openvpn { -namespace VPNServerPool { +namespace openvpn::VPNServerPool { OPENVPN_EXCEPTION(vpn_serv_pool_error); @@ -154,7 +153,6 @@ class IP46AutoRelease : public IP46, public RC Pool *pool; }; -} // namespace VPNServerPool -} // namespace openvpn +} // namespace openvpn::VPNServerPool #endif diff --git a/openvpn/ssl/kuparse.hpp b/openvpn/ssl/kuparse.hpp index e4e46503a..231551e5d 100644 --- a/openvpn/ssl/kuparse.hpp +++ b/openvpn/ssl/kuparse.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace KUParse { +namespace openvpn::KUParse { enum TLSWebType { TLS_WEB_NONE, @@ -136,7 +135,6 @@ inline void remote_cert_eku(const OptionList &opt, if (o) eku = o->get(1, 256); } -} // namespace KUParse -} // namespace openvpn +} // namespace openvpn::KUParse #endif diff --git a/openvpn/ssl/nscert.hpp b/openvpn/ssl/nscert.hpp index cef32deb6..e98cd7351 100644 --- a/openvpn/ssl/nscert.hpp +++ b/openvpn/ssl/nscert.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace NSCert { +namespace openvpn::NSCert { enum Type { NONE, @@ -59,7 +58,6 @@ inline Type ns_cert_type(const OptionList &opt, const std::string &relay_prefix) } return NONE; } -} // namespace NSCert -} // namespace openvpn +} // namespace openvpn::NSCert #endif diff --git a/openvpn/ssl/peerinfo.hpp b/openvpn/ssl/peerinfo.hpp index 6646e97e4..1ca5bace2 100644 --- a/openvpn/ssl/peerinfo.hpp +++ b/openvpn/ssl/peerinfo.hpp @@ -40,8 +40,7 @@ #include #endif -namespace openvpn { -namespace PeerInfo { +namespace openvpn::PeerInfo { OPENVPN_EXCEPTION(peer_info_error); @@ -171,7 +170,6 @@ struct Set : public std::vector, public RCCopyable #include -namespace openvpn { -namespace SNI { +namespace openvpn::SNI { // Abstract base class used to provide an SNI handler class HandlerBase @@ -53,5 +52,4 @@ class HandlerBase } }; -} // namespace SNI -} // namespace openvpn +} // namespace openvpn::SNI diff --git a/openvpn/ssl/sslchoose.hpp b/openvpn/ssl/sslchoose.hpp index 16e09eaf3..035d865c9 100644 --- a/openvpn/ssl/sslchoose.hpp +++ b/openvpn/ssl/sslchoose.hpp @@ -55,8 +55,7 @@ #include #endif -namespace openvpn { -namespace SSLLib { +namespace openvpn::SSLLib { #if defined(USE_MBEDTLS) #define SSL_LIB_NAME "MbedTLS" typedef MbedTLSCryptoAPI CryptoAPI; @@ -87,7 +86,6 @@ typedef OpenSSLPEM PEMAPI; #else #error no SSL library defined #endif -} // namespace SSLLib -} // namespace openvpn +} // namespace openvpn::SSLLib #endif diff --git a/openvpn/ssl/sslconsts.hpp b/openvpn/ssl/sslconsts.hpp index bba080814..53fb03a80 100644 --- a/openvpn/ssl/sslconsts.hpp +++ b/openvpn/ssl/sslconsts.hpp @@ -22,8 +22,7 @@ #ifndef OPENVPN_SSL_SSLCONSTS_H #define OPENVPN_SSL_SSLCONSTS_H -namespace openvpn { -namespace SSLConst { +namespace openvpn::SSLConst { // Special return values from SSL read/write methods enum @@ -83,7 +82,6 @@ inline unsigned int ssl_flags(const unsigned int flags) { return flags & (LAST - 1); } -} // namespace SSLConst -} // namespace openvpn +} // namespace openvpn::SSLConst #endif diff --git a/openvpn/ssl/tls_cert_profile.hpp b/openvpn/ssl/tls_cert_profile.hpp index 27df4f9bc..71edfe6b5 100644 --- a/openvpn/ssl/tls_cert_profile.hpp +++ b/openvpn/ssl/tls_cert_profile.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace TLSCertProfile { +namespace openvpn::TLSCertProfile { enum Type { UNDEF = 0, @@ -140,7 +139,6 @@ inline void apply_override(Type &type, const std::string &override) throw option_error(ERR_INVALID_OPTION_CRYPTO, "tls-cert-profile: unrecognized override string"); // OPENVPN_LOG("*** tls-cert-profile before=" << to_string(orig) << " override=" << override << " after=" << to_string(type)); } -} // namespace TLSCertProfile -} // namespace openvpn +} // namespace openvpn::TLSCertProfile #endif diff --git a/openvpn/ssl/tls_remote.hpp b/openvpn/ssl/tls_remote.hpp index 1833acba6..e2a2d4d7c 100644 --- a/openvpn/ssl/tls_remote.hpp +++ b/openvpn/ssl/tls_remote.hpp @@ -29,8 +29,7 @@ #include -namespace openvpn { -namespace TLSRemote { +namespace openvpn::TLSRemote { inline bool test(const std::string &tls_remote, const std::string &subject, const std::string &common_name) { return tls_remote == subject || string::starts_with(common_name, tls_remote); @@ -94,7 +93,6 @@ inline std::string sanitize_common_name(const std::string &str) } return ret; } -} // namespace TLSRemote -} // namespace openvpn +} // namespace openvpn::TLSRemote #endif diff --git a/openvpn/transport/client/extern/config.hpp b/openvpn/transport/client/extern/config.hpp index a497994ab..b564d256f 100644 --- a/openvpn/transport/client/extern/config.hpp +++ b/openvpn/transport/client/extern/config.hpp @@ -27,8 +27,7 @@ #include #include -namespace openvpn { -namespace ExternalTransport { +namespace openvpn::ExternalTransport { struct Config { Protocol protocol; @@ -39,7 +38,6 @@ struct Config SessionStats::Ptr stats; SocketProtect *socket_protect = nullptr; }; -} // namespace ExternalTransport -} // namespace openvpn +} // namespace openvpn::ExternalTransport #endif diff --git a/openvpn/transport/client/extern/fw.hpp b/openvpn/transport/client/extern/fw.hpp index 213119277..1d6b98db6 100644 --- a/openvpn/transport/client/extern/fw.hpp +++ b/openvpn/transport/client/extern/fw.hpp @@ -26,8 +26,7 @@ #include #endif -namespace openvpn { -namespace ExternalTransport { +namespace openvpn::ExternalTransport { #ifdef OPENVPN_EXTERNAL_TRANSPORT_FACTORY struct Config; struct Factory @@ -42,6 +41,5 @@ struct Factory { }; #endif -} // namespace ExternalTransport -} // namespace openvpn +} // namespace openvpn::ExternalTransport #endif diff --git a/openvpn/transport/client/httpcli.hpp b/openvpn/transport/client/httpcli.hpp index 3ab114545..1600bd8db 100644 --- a/openvpn/transport/client/httpcli.hpp +++ b/openvpn/transport/client/httpcli.hpp @@ -55,8 +55,7 @@ #include #include -namespace openvpn { -namespace HTTPProxyTransport { +namespace openvpn::HTTPProxyTransport { enum AuthMethod { @@ -1102,7 +1101,6 @@ inline TransportClient::Ptr ClientConfig::new_transport_client_obj(openvpn_io::i { return TransportClient::Ptr(new Client(io_context, this, parent)); } -} // namespace HTTPProxyTransport -} // namespace openvpn +} // namespace openvpn::HTTPProxyTransport #endif diff --git a/openvpn/transport/client/tcpcli.hpp b/openvpn/transport/client/tcpcli.hpp index 42aaa9465..4d61d1430 100644 --- a/openvpn/transport/client/tcpcli.hpp +++ b/openvpn/transport/client/tcpcli.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace TCPTransport { +namespace openvpn::TCPTransport { class ClientConfig : public TransportClientFactory { @@ -414,7 +413,6 @@ inline TransportClient::Ptr ClientConfig::new_transport_client_obj(openvpn_io::i { return TransportClient::Ptr(new Client(io_context, this, parent)); } -} // namespace TCPTransport -} // namespace openvpn +} // namespace openvpn::TCPTransport #endif diff --git a/openvpn/transport/client/udpcli.hpp b/openvpn/transport/client/udpcli.hpp index 22b03890c..5454314e4 100644 --- a/openvpn/transport/client/udpcli.hpp +++ b/openvpn/transport/client/udpcli.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace UDPTransport { +namespace openvpn::UDPTransport { class ClientConfig : public TransportClientFactory { @@ -349,7 +348,6 @@ inline TransportClient::Ptr ClientConfig::new_transport_client_obj(openvpn_io::i { return TransportClient::Ptr(new Client(io_context, this, parent)); } -} // namespace UDPTransport -} // namespace openvpn +} // namespace openvpn::UDPTransport #endif diff --git a/openvpn/transport/gremlin.hpp b/openvpn/transport/gremlin.hpp index f135610ab..16390a2b1 100644 --- a/openvpn/transport/gremlin.hpp +++ b/openvpn/transport/gremlin.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace Gremlin { +namespace openvpn::Gremlin { OPENVPN_EXCEPTION(gremlin_error); @@ -219,7 +218,6 @@ class SendRecvQueue DelayedQueue::Ptr recv; bool tcp; }; -} // namespace Gremlin -} // namespace openvpn +} // namespace openvpn::Gremlin #endif diff --git a/openvpn/transport/tcplink.hpp b/openvpn/transport/tcplink.hpp index fe6736cac..ab47ce63d 100644 --- a/openvpn/transport/tcplink.hpp +++ b/openvpn/transport/tcplink.hpp @@ -44,8 +44,7 @@ #include #endif -namespace openvpn { -namespace TCPTransport { +namespace openvpn::TCPTransport { template class TCPLink : public LinkCommon SPtr; @@ -34,5 +33,4 @@ class LinkBase : public RC virtual void start() = 0; virtual void stop() = 0; }; -} // namespace TCPTransport -} // namespace openvpn +} // namespace openvpn::TCPTransport diff --git a/openvpn/transport/tcplinkcommon.hpp b/openvpn/transport/tcplinkcommon.hpp index 88927f316..359f0063f 100644 --- a/openvpn/transport/tcplinkcommon.hpp +++ b/openvpn/transport/tcplinkcommon.hpp @@ -37,8 +37,7 @@ #define OPENVPN_LOG_TCPLINK_VERBOSE(x) #endif -namespace openvpn { -namespace TCPTransport { +namespace openvpn::TCPTransport { template std::unique_ptr gremlin; #endif }; -} // namespace UDPTransport -} // namespace openvpn +} // namespace openvpn::UDPTransport #endif diff --git a/openvpn/tun/builder/client.hpp b/openvpn/tun/builder/client.hpp index 0ce840220..3cf318e08 100644 --- a/openvpn/tun/builder/client.hpp +++ b/openvpn/tun/builder/client.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace TunBuilderClient { +namespace openvpn::TunBuilderClient { OPENVPN_EXCEPTION(tun_builder_error); @@ -336,7 +335,6 @@ inline TunClient::Ptr ClientConfig::new_tun_client_obj(openvpn_io::io_context &i return TunClient::Ptr(new Client(io_context, this, parent)); } -} // namespace TunBuilderClient -} // namespace openvpn +} // namespace openvpn::TunBuilderClient #endif diff --git a/openvpn/tun/builder/rgwflags.hpp b/openvpn/tun/builder/rgwflags.hpp index 9e9bfbc2f..fe47d30a8 100644 --- a/openvpn/tun/builder/rgwflags.hpp +++ b/openvpn/tun/builder/rgwflags.hpp @@ -22,15 +22,13 @@ #ifndef OPENVPN_TUN_BUILDER_RGWFLAGS_H #define OPENVPN_TUN_BUILDER_RGWFLAGS_H -namespace openvpn { -namespace RGWFlags { +namespace openvpn::RGWFlags { // These flags are passed as the flags argument to TunBuilderBase::tun_builder_reroute_gw // NOTE: must not collide with RG_x flags in rgopt.hpp. enum { EmulateExcludeRoutes = (1 << 16), }; -} // namespace RGWFlags -} // namespace openvpn +} // namespace openvpn::RGWFlags #endif diff --git a/openvpn/tun/builder/setup.hpp b/openvpn/tun/builder/setup.hpp index 16fe98dd3..f09f85351 100644 --- a/openvpn/tun/builder/setup.hpp +++ b/openvpn/tun/builder/setup.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace TunBuilderSetup { +namespace openvpn::TunBuilderSetup { struct Config { #ifdef HAVE_JSON @@ -55,7 +54,6 @@ struct Factory : public RC virtual Base::Ptr new_setup_obj() = 0; }; -} // namespace TunBuilderSetup -} // namespace openvpn +} // namespace openvpn::TunBuilderSetup #endif diff --git a/openvpn/tun/client/tunnull.hpp b/openvpn/tun/client/tunnull.hpp index 7d2ef0919..fd15e0900 100644 --- a/openvpn/tun/client/tunnull.hpp +++ b/openvpn/tun/client/tunnull.hpp @@ -26,8 +26,7 @@ #include -namespace openvpn { -namespace TunNull { +namespace openvpn::TunNull { class ClientConfig : public TunClientFactory { @@ -122,7 +121,6 @@ inline TunClient::Ptr ClientConfig::new_tun_client_obj(openvpn_io::io_context &i return TunClient::Ptr(new Client(io_context, this, parent)); } -} // namespace TunNull -} // namespace openvpn +} // namespace openvpn::TunNull #endif // OPENVPN_TUN_CLIENT_TUNNULL_H diff --git a/openvpn/tun/extern/config.hpp b/openvpn/tun/extern/config.hpp index 34a6efcfc..304d194c5 100644 --- a/openvpn/tun/extern/config.hpp +++ b/openvpn/tun/extern/config.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace ExternalTun { +namespace openvpn::ExternalTun { struct Config { TunProp::Config tun_prop; @@ -40,6 +39,5 @@ struct Config Stop *stop = nullptr; bool tun_persist = false; }; -} // namespace ExternalTun -} // namespace openvpn +} // namespace openvpn::ExternalTun #endif diff --git a/openvpn/tun/linux/client/sitnl.hpp b/openvpn/tun/linux/client/sitnl.hpp index d896d6ce4..11a3dc851 100644 --- a/openvpn/tun/linux/client/sitnl.hpp +++ b/openvpn/tun/linux/client/sitnl.hpp @@ -45,8 +45,7 @@ #endif #endif -namespace openvpn { -namespace TunNetlink { +namespace openvpn::TunNetlink { #define SNDBUF_SIZE (1024 * 2) #define RCVBUF_SIZE (1024 * 4) @@ -1380,5 +1379,4 @@ class SITNL metric); } }; -} // namespace TunNetlink -} // namespace openvpn +} // namespace openvpn::TunNetlink diff --git a/openvpn/tun/linux/client/tuncli.hpp b/openvpn/tun/linux/client/tuncli.hpp index 68d68d780..5c6ee20fb 100644 --- a/openvpn/tun/linux/client/tuncli.hpp +++ b/openvpn/tun/linux/client/tuncli.hpp @@ -32,8 +32,7 @@ #include #include -namespace openvpn { -namespace TunLinux { +namespace openvpn::TunLinux { struct PacketFrom { @@ -370,7 +369,6 @@ inline TunClient::Ptr ClientConfig::new_tun_client_obj(openvpn_io::io_context &i return TunClient::Ptr(new Client(io_context, this, parent)); } -} // namespace TunLinux -} // namespace openvpn +} // namespace openvpn::TunLinux #endif // OPENVPN_TUN_LINUX_CLIENT_TUNCLI_H diff --git a/openvpn/tun/linux/client/tuniproute.hpp b/openvpn/tun/linux/client/tuniproute.hpp index 7415cc9c6..08bded44f 100644 --- a/openvpn/tun/linux/client/tuniproute.hpp +++ b/openvpn/tun/linux/client/tuniproute.hpp @@ -45,8 +45,7 @@ #include #include -namespace openvpn { -namespace TunIPRoute { +namespace openvpn::TunIPRoute { using namespace openvpn::TunLinuxSetup; @@ -352,5 +351,4 @@ struct TunMethods add_del_route(address, 128, gw.v6.addr().to_string(), gw.dev(), R_ADD_SYS, rtvec, create, destroy); } }; -} // namespace TunIPRoute -} // namespace openvpn +} // namespace openvpn::TunIPRoute diff --git a/openvpn/tun/linux/client/tunnetlink.hpp b/openvpn/tun/linux/client/tunnetlink.hpp index c6f2b39b9..bed7ac477 100644 --- a/openvpn/tun/linux/client/tunnetlink.hpp +++ b/openvpn/tun/linux/client/tunnetlink.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace TunNetlink { +namespace openvpn::TunNetlink { using namespace openvpn::TunLinuxSetup; @@ -858,5 +857,4 @@ struct TunMethods destroy); } }; -} // namespace TunNetlink -} // namespace openvpn +} // namespace openvpn::TunNetlink diff --git a/openvpn/tun/linux/client/tunsetup.hpp b/openvpn/tun/linux/client/tunsetup.hpp index a1f874cce..f2d002b01 100644 --- a/openvpn/tun/linux/client/tunsetup.hpp +++ b/openvpn/tun/linux/client/tunsetup.hpp @@ -47,8 +47,7 @@ #include #include -namespace openvpn { -namespace TunLinuxSetup { +namespace openvpn::TunLinuxSetup { OPENVPN_EXCEPTION(tun_linux_error); OPENVPN_EXCEPTION(tun_open_error); @@ -264,7 +263,6 @@ class Setup : public TunBuilderSetup::Base std::string tun_iface_name; // used to skip tun-based default gw when add bypass route }; -} // namespace TunLinuxSetup -} // namespace openvpn +} // namespace openvpn::TunLinuxSetup #endif // OPENVPN_TUN_LINUX_CLIENT_TUNCLI_H diff --git a/openvpn/tun/mac/client/tuncli.hpp b/openvpn/tun/mac/client/tuncli.hpp index 35e37c051..793c92b7b 100644 --- a/openvpn/tun/mac/client/tuncli.hpp +++ b/openvpn/tun/mac/client/tuncli.hpp @@ -43,8 +43,7 @@ #include #endif -namespace openvpn { -namespace TunMac { +namespace openvpn::TunMac { OPENVPN_EXCEPTION(tun_mac_error); @@ -388,7 +387,6 @@ inline TunClient::Ptr ClientConfig::new_tun_client_obj(openvpn_io::io_context &i return TunClient::Ptr(new Client(io_context, this, parent)); } -} // namespace TunMac -} // namespace openvpn +} // namespace openvpn::TunMac #endif diff --git a/openvpn/tun/mac/client/tunsetup.hpp b/openvpn/tun/mac/client/tunsetup.hpp index a36410c04..6896d7a0d 100644 --- a/openvpn/tun/mac/client/tunsetup.hpp +++ b/openvpn/tun/mac/client/tunsetup.hpp @@ -50,8 +50,7 @@ #include #endif -namespace openvpn { -namespace TunMac { +namespace openvpn::TunMac { class Setup : public TunBuilderSetup::Base { public: @@ -504,7 +503,6 @@ class Setup : public TunBuilderSetup::Base } } }; -} // namespace TunMac -} // namespace openvpn +} // namespace openvpn::TunMac #endif diff --git a/openvpn/tun/mac/tunutil.hpp b/openvpn/tun/mac/tunutil.hpp index da7e63f68..86c582dc9 100644 --- a/openvpn/tun/mac/tunutil.hpp +++ b/openvpn/tun/mac/tunutil.hpp @@ -36,9 +36,7 @@ #include #include -namespace openvpn { -namespace TunMac { -namespace Util { +namespace openvpn::TunMac::Util { OPENVPN_EXCEPTION(tun_mac_util); inline int tuntap_open(const Layer &layer, std::string &name) @@ -69,8 +67,6 @@ inline int tuntap_open(const Layer &layer, std::string &name) throw tun_mac_util(std::string("error opening Mac ") + layer.dev_type() + " device"); } -} // namespace Util -} // namespace TunMac -} // namespace openvpn +} // namespace openvpn::TunMac::Util #endif diff --git a/openvpn/tun/mac/utun.hpp b/openvpn/tun/mac/utun.hpp index 6d2a99c09..2b444eecb 100644 --- a/openvpn/tun/mac/utun.hpp +++ b/openvpn/tun/mac/utun.hpp @@ -48,9 +48,7 @@ #include #include -namespace openvpn { -namespace TunMac { -namespace UTun { +namespace openvpn::TunMac::UTun { OPENVPN_EXCEPTION(utun_error); // Open specific utun device unit and return fd. @@ -108,8 +106,6 @@ inline int utun_open(std::string &name) } throw utun_error("cannot open available utun device"); } -} // namespace UTun -} // namespace TunMac -} // namespace openvpn +} // namespace openvpn::TunMac::UTun #endif diff --git a/openvpn/tun/server/tunbase.hpp b/openvpn/tun/server/tunbase.hpp index b6dd96681..2c649b212 100644 --- a/openvpn/tun/server/tunbase.hpp +++ b/openvpn/tun/server/tunbase.hpp @@ -33,8 +33,7 @@ #include #include -namespace openvpn { -namespace TunClientInstance { +namespace openvpn::TunClientInstance { typedef Function PostCloseFunc; @@ -116,7 +115,6 @@ struct Factory : public RC virtual Send::Ptr new_tun_obj(Recv *parent) = 0; }; -} // namespace TunClientInstance -} // namespace openvpn +} // namespace openvpn::TunClientInstance #endif diff --git a/openvpn/tun/win/client/clientconfig.hpp b/openvpn/tun/win/client/clientconfig.hpp index 068608269..ddcda6c96 100644 --- a/openvpn/tun/win/client/clientconfig.hpp +++ b/openvpn/tun/win/client/clientconfig.hpp @@ -28,8 +28,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { // These types manage the underlying TAP driver HANDLE typedef openvpn_io::windows::stream_handle TAPStream; @@ -99,5 +98,4 @@ class ClientConfig : public TunClientFactory return true; } }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/client/setupbase.hpp b/openvpn/tun/win/client/setupbase.hpp index c16c3620b..e0e06049b 100644 --- a/openvpn/tun/win/client/setupbase.hpp +++ b/openvpn/tun/win/client/setupbase.hpp @@ -37,8 +37,7 @@ #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { struct SetupBase : public DestructorBase { typedef RCPtr Ptr; @@ -86,7 +85,6 @@ struct SetupFactory : public RC bool allow_local_dns_resolvers) = 0; // clang-format on }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin #endif diff --git a/openvpn/tun/win/client/tuncli.hpp b/openvpn/tun/win/client/tuncli.hpp index a682f5e12..842044a5d 100644 --- a/openvpn/tun/win/client/tuncli.hpp +++ b/openvpn/tun/win/client/tuncli.hpp @@ -43,8 +43,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { OPENVPN_EXCEPTION(tun_win_error); @@ -423,7 +422,6 @@ inline TunClient::Ptr ClientConfig::new_tun_client_obj(openvpn_io::io_context &i throw tun_win_error("unsupported tun driver"); } -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin #endif diff --git a/openvpn/tun/win/client/tunsetup.hpp b/openvpn/tun/win/client/tunsetup.hpp index ce07851f5..6bc81def8 100644 --- a/openvpn/tun/win/client/tunsetup.hpp +++ b/openvpn/tun/win/client/tunsetup.hpp @@ -61,8 +61,7 @@ #define TUNWINDOWS Util::TunIPHELPER #endif -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { class Setup : public SetupBase { public: @@ -909,5 +908,4 @@ class Setup : public SetupBase bool allow_local_dns_resolvers = false; DWORD process_id_ = 0; }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/client/wintun.hpp b/openvpn/tun/win/client/wintun.hpp index e4faf01ef..c659ee3e6 100644 --- a/openvpn/tun/win/client/wintun.hpp +++ b/openvpn/tun/win/client/wintun.hpp @@ -6,8 +6,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { class WintunClient : public TunClient { @@ -320,5 +319,4 @@ class WintunClient : public TunClient RingBuffer::Ptr ring_buffer; }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/dns.hpp b/openvpn/tun/win/dns.hpp index 95c804542..60c0d976b 100644 --- a/openvpn/tun/win/dns.hpp +++ b/openvpn/tun/win/dns.hpp @@ -60,8 +60,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { /** * @brief Manage DNS search suffixes for Windows @@ -546,5 +545,4 @@ class Dns using DNS = Dns; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/nrpt.hpp b/openvpn/tun/win/nrpt.hpp index 26b1ceaf2..14682db9b 100644 --- a/openvpn/tun/win/nrpt.hpp +++ b/openvpn/tun/win/nrpt.hpp @@ -55,8 +55,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { /** * @brief Manage NRPT rules for Windows @@ -509,5 +508,4 @@ class Nrpt using NRPT = Nrpt; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/ringbuffer.hpp b/openvpn/tun/win/ringbuffer.hpp index 8c060a93f..709640f40 100644 --- a/openvpn/tun/win/ringbuffer.hpp +++ b/openvpn/tun/win/ringbuffer.hpp @@ -41,8 +41,7 @@ #define WINTUN_MAX_PACKET_SIZE 0xffff #define WINTUN_PACKET_ALIGN 4 -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { struct TUN_RING { std::atomic_ulong head; @@ -176,5 +175,4 @@ class RingBuffer : public RC TUN_RING *send_ring_ = nullptr; TUN_RING *receive_ring_ = nullptr; }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/tunutil.hpp b/openvpn/tun/win/tunutil.hpp index b54e360e3..65438657a 100644 --- a/openvpn/tun/win/tunutil.hpp +++ b/openvpn/tun/win/tunutil.hpp @@ -72,8 +72,7 @@ #include #include -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { enum Type { TapWindows6, @@ -1444,5 +1443,4 @@ class AddRoute4Cmd : public Action }; } // namespace TunIPHELPER } // namespace Util -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/wfp.hpp b/openvpn/tun/win/wfp.hpp index 022206323..187c90961 100644 --- a/openvpn/tun/win/wfp.hpp +++ b/openvpn/tun/win/wfp.hpp @@ -141,8 +141,7 @@ DEFINE_GUID( #endif -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { /** * @brief Add WFP rules to block traffic from escaping the VPN @@ -554,5 +553,4 @@ class WFP : public RC EngineHandle engineHandle; }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/tun/win/winproxy.hpp b/openvpn/tun/win/winproxy.hpp index 1866d965f..f863c7e8b 100644 --- a/openvpn/tun/win/winproxy.hpp +++ b/openvpn/tun/win/winproxy.hpp @@ -32,8 +32,7 @@ using namespace openvpn::Win; -namespace openvpn { -namespace TunWin { +namespace openvpn::TunWin { class WinProxySettings : public ProxySettings { public: @@ -181,5 +180,4 @@ class WinProxySettings : public ProxySettings const char *delete_value_str = "DeleteValue"; const DWORD delete_value_dword = 0xCAFEBABE; }; -} // namespace TunWin -} // namespace openvpn +} // namespace openvpn::TunWin diff --git a/openvpn/win/call.hpp b/openvpn/win/call.hpp index dc4715942..da32b52eb 100644 --- a/openvpn/win/call.hpp +++ b/openvpn/win/call.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { OPENVPN_EXCEPTION(win_call); @@ -149,7 +148,6 @@ inline std::string call(const std::string &cmd) return out; } -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/console.hpp b/openvpn/win/console.hpp index 87b20755b..de4d7fcce 100644 --- a/openvpn/win/console.hpp +++ b/openvpn/win/console.hpp @@ -28,9 +28,7 @@ #include #include -namespace openvpn { -namespace Win { -namespace Console { +namespace openvpn::Win::Console { class Input { @@ -160,8 +158,6 @@ class Title bool old_title_defined; std::string old_title; }; -} // namespace Console -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win::Console #endif diff --git a/openvpn/win/event.hpp b/openvpn/win/event.hpp index f5a1169a8..139e6a648 100644 --- a/openvpn/win/event.hpp +++ b/openvpn/win/event.hpp @@ -31,8 +31,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { // Wrap a standard Windows Event object class Event @@ -102,7 +101,6 @@ struct DestroyEvent : public Event } }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/handle.hpp b/openvpn/win/handle.hpp index d5e96cebc..f8f49a1ad 100644 --- a/openvpn/win/handle.hpp +++ b/openvpn/win/handle.hpp @@ -26,9 +26,7 @@ #include -namespace openvpn { -namespace Win { -namespace Handle { +namespace openvpn::Win::Handle { inline HANDLE undefined() { return INVALID_HANDLE_VALUE; @@ -38,8 +36,6 @@ inline bool defined(HANDLE handle) { return handle != nullptr && handle != INVALID_HANDLE_VALUE; } -} // namespace Handle -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win::Handle #endif diff --git a/openvpn/win/handlecomm.hpp b/openvpn/win/handlecomm.hpp index 6d26db8e4..0124e84d5 100644 --- a/openvpn/win/handlecomm.hpp +++ b/openvpn/win/handlecomm.hpp @@ -26,9 +26,7 @@ #include #include -namespace openvpn { -namespace Win { -namespace HandleComm { +namespace openvpn::Win::HandleComm { OPENVPN_EXCEPTION(handle_comm); @@ -74,6 +72,4 @@ inline HANDLE receive_handle(const std::string &remote_handle_hex, return local_handle; } -} // namespace HandleComm -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win::HandleComm diff --git a/openvpn/win/impersonate.hpp b/openvpn/win/impersonate.hpp index 5de8f0242..425dc5cfd 100644 --- a/openvpn/win/impersonate.hpp +++ b/openvpn/win/impersonate.hpp @@ -27,8 +27,7 @@ #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { class Impersonate { @@ -216,5 +215,4 @@ class Impersonate bool local_system_ = false; bool impersonated = false; }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/logfile.hpp b/openvpn/win/logfile.hpp index 85fc998e2..23aedaeb0 100644 --- a/openvpn/win/logfile.hpp +++ b/openvpn/win/logfile.hpp @@ -24,8 +24,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { class LogFile : public LogBase { @@ -50,5 +49,4 @@ class LogFile : public LogBase Log::Context log_context; // must be initialized last }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/logutil.hpp b/openvpn/win/logutil.hpp index f6757f763..aa65db219 100644 --- a/openvpn/win/logutil.hpp +++ b/openvpn/win/logutil.hpp @@ -32,9 +32,7 @@ #include #include -namespace openvpn { -namespace Win { -namespace LogUtil { +namespace openvpn::Win::LogUtil { inline void log(const HANDLE file, const std::string &str) { @@ -75,6 +73,4 @@ inline ScopedHANDLE create_file(const std::string &fn, return file; } -} // namespace LogUtil -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win::LogUtil diff --git a/openvpn/win/modname.hpp b/openvpn/win/modname.hpp index ba3e1ec84..89f60d078 100644 --- a/openvpn/win/modname.hpp +++ b/openvpn/win/modname.hpp @@ -34,8 +34,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { inline std::wstring module_name() { @@ -75,7 +74,6 @@ inline std::string omiclient_path() return strbuf; } -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/netutil.hpp b/openvpn/win/netutil.hpp index ccd3f4861..1543b2813 100644 --- a/openvpn/win/netutil.hpp +++ b/openvpn/win/netutil.hpp @@ -26,8 +26,7 @@ #include #include "openvpn/win/reg.hpp" -namespace openvpn { -namespace Win { +namespace openvpn::Win { struct NetApi { @@ -150,5 +149,4 @@ static bool dhcp_enabled_on_itf(typename REG::Key &itf_key) return !error && dhcp ? true : false; } -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/npinfo.hpp b/openvpn/win/npinfo.hpp index fe670d27f..3ae1068cb 100644 --- a/openvpn/win/npinfo.hpp +++ b/openvpn/win/npinfo.hpp @@ -35,8 +35,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { struct NamedPipeImpersonate { OPENVPN_EXCEPTION(named_pipe_impersonate); @@ -190,5 +189,4 @@ struct NamedPipePeerInfoServer : public NamedPipePeerInfoCS } }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/reg.hpp b/openvpn/win/reg.hpp index 231e0d6e6..2035cdfa8 100644 --- a/openvpn/win/reg.hpp +++ b/openvpn/win/reg.hpp @@ -28,8 +28,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { template static void check_reg_error(DWORD status, const std::string &key) @@ -410,5 +409,4 @@ struct Reg } }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/scoped_handle.hpp b/openvpn/win/scoped_handle.hpp index 1cbbfcf48..e25dcacee 100644 --- a/openvpn/win/scoped_handle.hpp +++ b/openvpn/win/scoped_handle.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { class ScopedHANDLE { ScopedHANDLE(const ScopedHANDLE &) = delete; @@ -124,7 +123,6 @@ class ScopedHANDLE HANDLE handle; }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/secattr.hpp b/openvpn/win/secattr.hpp index 34b97f47d..d07470305 100644 --- a/openvpn/win/secattr.hpp +++ b/openvpn/win/secattr.hpp @@ -29,8 +29,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { struct SecurityAttributes { @@ -65,5 +64,4 @@ struct SecurityAttributes SECURITY_ATTRIBUTES sa; }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/win/unicode.hpp b/openvpn/win/unicode.hpp index 2126068c9..f3db6320b 100644 --- a/openvpn/win/unicode.hpp +++ b/openvpn/win/unicode.hpp @@ -30,8 +30,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { typedef std::unique_ptr UTF16; typedef std::unique_ptr UTF8; @@ -91,6 +90,5 @@ inline char *utf8(wchar_t *str) throw win_utf16(); return ret.release(); } -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/winerr.hpp b/openvpn/win/winerr.hpp index 9db89a2b1..d6a063b77 100644 --- a/openvpn/win/winerr.hpp +++ b/openvpn/win/winerr.hpp @@ -28,8 +28,7 @@ #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { struct Error : public openvpn_io::error_code { Error(const DWORD err) @@ -45,7 +44,6 @@ struct LastError : public Error { } }; -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win #endif diff --git a/openvpn/win/winsvc.hpp b/openvpn/win/winsvc.hpp index 40f8defd9..0928ffaab 100644 --- a/openvpn/win/winsvc.hpp +++ b/openvpn/win/winsvc.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace Win { +namespace openvpn::Win { class Service { public: @@ -415,5 +414,4 @@ class Service }; Service *Service::service = nullptr; // GLOBAL -} // namespace Win -} // namespace openvpn +} // namespace openvpn::Win diff --git a/openvpn/ws/chunked.hpp b/openvpn/ws/chunked.hpp index ca217e055..57e73ed73 100644 --- a/openvpn/ws/chunked.hpp +++ b/openvpn/ws/chunked.hpp @@ -26,8 +26,7 @@ #include #include -namespace openvpn { -namespace WS { +namespace openvpn::WS { class ChunkedHelper { enum State @@ -184,5 +183,4 @@ class ChunkedHelper State state; size_t size; }; -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS diff --git a/openvpn/ws/httpcli.hpp b/openvpn/ws/httpcli.hpp index 5bea1bc8a..04335ddbf 100644 --- a/openvpn/ws/httpcli.hpp +++ b/openvpn/ws/httpcli.hpp @@ -97,9 +97,7 @@ #include #endif -namespace openvpn { -namespace WS { -namespace Client { +namespace openvpn::WS::Client { OPENVPN_EXCEPTION(http_client_exception); @@ -1564,6 +1562,4 @@ class HTTPDelegate : public HTTPCore private: PARENT *parent_; }; -} // namespace Client -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS::Client diff --git a/openvpn/ws/httpcliset.hpp b/openvpn/ws/httpcliset.hpp index 0cb86810b..c10258332 100644 --- a/openvpn/ws/httpcliset.hpp +++ b/openvpn/ws/httpcliset.hpp @@ -49,8 +49,7 @@ #define OPENVPN_HTTP_CLISET_RC RC #endif -namespace openvpn { -namespace WS { +namespace openvpn::WS { class ClientSet : public RC { @@ -1030,5 +1029,4 @@ class ClientSet : public RC std::map clients; }; -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS diff --git a/openvpn/ws/httpcommon.hpp b/openvpn/ws/httpcommon.hpp index 5745a948d..25a20ecda 100644 --- a/openvpn/ws/httpcommon.hpp +++ b/openvpn/ws/httpcommon.hpp @@ -40,8 +40,7 @@ #include #include -namespace openvpn { -namespace WS { +namespace openvpn::WS { OPENVPN_EXCEPTION(http_exception); template #include -namespace openvpn { -namespace WS { +namespace openvpn::WS { struct Creds { OPENVPN_EXCEPTION(web_creds_error); @@ -165,5 +164,4 @@ struct Creds std::string username; std::string password; }; -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS diff --git a/openvpn/ws/httpserv.hpp b/openvpn/ws/httpserv.hpp index 7b74a4a59..31b89770a 100644 --- a/openvpn/ws/httpserv.hpp +++ b/openvpn/ws/httpserv.hpp @@ -80,9 +80,7 @@ #define OPENVPN_HTTP_SERV_RC RC #endif -namespace openvpn { -namespace WS { -namespace Server { +namespace openvpn::WS::Server { OPENVPN_EXCEPTION(http_server_exception); @@ -1131,6 +1129,4 @@ class Listener : public ProxyListener ClientMap clients; }; -} // namespace Server -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS::Server diff --git a/openvpn/ws/httpvpn.hpp b/openvpn/ws/httpvpn.hpp index 0ca7c0b68..8d093bfcc 100644 --- a/openvpn/ws/httpvpn.hpp +++ b/openvpn/ws/httpvpn.hpp @@ -14,8 +14,7 @@ #include #include -namespace openvpn { -namespace WS { +namespace openvpn::WS { // Helper class for HTTP client and server connections // to strongly bind to a VPN client tunnel interface. @@ -179,5 +178,4 @@ class ViaVPN : public RC GatewayType gw_type; }; -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS diff --git a/openvpn/ws/resolver_results.hpp b/openvpn/ws/resolver_results.hpp index c9e39c02b..b11a081f3 100644 --- a/openvpn/ws/resolver_results.hpp +++ b/openvpn/ws/resolver_results.hpp @@ -26,8 +26,7 @@ #include #include -namespace openvpn { -namespace WS { +namespace openvpn::WS { // These methods become no-ops unless building with a patched Asio. // Define ASIO_RESOLVER_RESULTS_DATA_REQUIRED to force an error if these methods @@ -88,5 +87,4 @@ inline void filter_by_ip_version(RESULTS &results, const IP::Addr::Version ip_ve #endif -} // namespace WS -} // namespace openvpn +} // namespace openvpn::WS diff --git a/openvpn/ws/websocket.hpp b/openvpn/ws/websocket.hpp index 2b716e7c6..17f0144b8 100644 --- a/openvpn/ws/websocket.hpp +++ b/openvpn/ws/websocket.hpp @@ -36,8 +36,7 @@ #include #include -namespace openvpn { -namespace WebSocket { +namespace openvpn::WebSocket { OPENVPN_EXCEPTION(websocket_error); @@ -556,5 +555,4 @@ class PerRequest : public RC } // namespace Server -} // namespace WebSocket -} // namespace openvpn +} // namespace openvpn::WebSocket