mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-19 19:52:15 +02:00
Refactor nested namespace to C++17 style
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
This commit is contained in:
parent
a89b6cb184
commit
3646265d15
@ -39,8 +39,7 @@
|
||||
#define OPENVPN_ACCEPTOR_LISTENER_BASE_RC RC<thread_unsafe_refcount>
|
||||
#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<Item>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Acceptor
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::Acceptor
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include <openvpn/win/scoped_handle.hpp>
|
||||
#include <openvpn/win/secattr.hpp>
|
||||
|
||||
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
|
||||
|
@ -24,8 +24,7 @@
|
||||
#include <openvpn/acceptor/base.hpp>
|
||||
#include <openvpn/ssl/sslconsts.hpp>
|
||||
|
||||
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
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
#include <openvpn/acceptor/base.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace Acceptor {
|
||||
namespace openvpn::Acceptor {
|
||||
|
||||
struct Unix : public Base
|
||||
{
|
||||
@ -76,5 +75,4 @@ struct Unix : public Base
|
||||
openvpn_io::basic_socket_acceptor<openvpn_io::local::stream_protocol> acceptor;
|
||||
};
|
||||
|
||||
} // namespace Acceptor
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::Acceptor
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include <openvpn/common/rc.hpp>
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace IP {
|
||||
namespace openvpn::IP {
|
||||
|
||||
// A list of unique IP addresses
|
||||
class AddrList : public std::vector<IP::Addr>, public RC<thread_unsafe_refcount>
|
||||
@ -59,7 +58,6 @@ class AddrList : public std::vector<IP::Addr>, public RC<thread_unsafe_refcount>
|
||||
}
|
||||
#endif
|
||||
};
|
||||
} // namespace IP
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::IP
|
||||
|
||||
#endif
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <openvpn/common/split.hpp>
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
|
||||
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
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/addr/route.hpp>
|
||||
|
||||
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
|
||||
|
@ -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);
|
||||
|
@ -31,9 +31,7 @@
|
||||
#include <openvpn/common/stringtempl2.hpp>
|
||||
#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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
#include <openvpn/addr/range.hpp>
|
||||
|
||||
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<IP::Addr> Pool;
|
||||
} // namespace IP
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::IP
|
||||
|
||||
#endif
|
||||
|
@ -25,8 +25,7 @@
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/random/randapi.hpp>
|
||||
|
||||
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
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
|
||||
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<IP::Addr> Range;
|
||||
typedef RangePartitionType<IP::Addr> RangePartition;
|
||||
} // namespace IP
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::IP
|
||||
|
||||
#endif
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
#include <openvpn/addr/regex.hpp>
|
||||
|
||||
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
|
||||
|
@ -36,8 +36,7 @@
|
||||
#include <openvpn/common/hash.hpp>
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace IP {
|
||||
namespace openvpn::IP {
|
||||
// Basic route object
|
||||
template <typename ADDR>
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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<CFTypeRef, thread_unsafe_refcount> 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
|
||||
|
@ -24,10 +24,8 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace CF {
|
||||
namespace openvpn::CF {
|
||||
OPENVPN_CF_WRAP(Host, host_cast, CFHostRef, CFHostGetTypeID)
|
||||
}
|
||||
} // namespace openvpn
|
||||
|
||||
#endif
|
||||
|
@ -24,11 +24,9 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -24,10 +24,8 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace CF {
|
||||
namespace openvpn::CF {
|
||||
OPENVPN_CF_WRAP(Socket, socket_cast, CFSocketRef, CFSocketGetTypeID)
|
||||
}
|
||||
} // namespace openvpn
|
||||
|
||||
#endif
|
||||
|
@ -24,11 +24,9 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
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
|
||||
|
@ -24,10 +24,8 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace CF {
|
||||
namespace openvpn::CF {
|
||||
OPENVPN_CF_WRAP(Timer, timer_cast, CFRunLoopTimerRef, CFRunLoopTimerGetTypeID)
|
||||
}
|
||||
} // namespace openvpn
|
||||
|
||||
#endif
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/common/number.hpp>
|
||||
#include <openvpn/apple/ver.hpp>
|
||||
|
||||
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
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
#include <openvpn/apple/cf/cf.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace CF {
|
||||
namespace openvpn::CF {
|
||||
OPENVPN_CF_WRAP(DynamicStore, dynamic_store_cast, SCDynamicStoreRef, SCDynamicStoreGetTypeID)
|
||||
|
||||
template <typename RET, typename KEY>
|
||||
@ -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
|
||||
|
@ -38,8 +38,7 @@
|
||||
#include <openvpn/crypto/cryptoalgs.hpp>
|
||||
#include <openvpn/apple/cf/error.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/applecrypto/crypto/digest.hpp>
|
||||
|
||||
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
|
||||
|
@ -31,8 +31,7 @@
|
||||
#include <openvpn/addr/ip.hpp>
|
||||
#include <openvpn/common/to_string.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace AsioBoundSocket {
|
||||
namespace openvpn::AsioBoundSocket {
|
||||
|
||||
typedef openvpn_io::basic_stream_socket<openvpn_io::ip::tcp> SocketBase;
|
||||
|
||||
@ -149,7 +148,6 @@ class Socket : public SocketBase
|
||||
Proto<IPv6::Addr> v6;
|
||||
};
|
||||
|
||||
} // namespace AsioBoundSocket
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::AsioBoundSocket
|
||||
|
||||
#endif
|
||||
|
@ -46,8 +46,7 @@
|
||||
#include <openvpn/common/peercred.hpp>
|
||||
#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
|
||||
|
@ -24,12 +24,11 @@
|
||||
|
||||
#include <openvpn/common/unicode.hpp>
|
||||
|
||||
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
|
||||
|
@ -26,8 +26,7 @@
|
||||
#include <openvpn/common/fileunix.hpp>
|
||||
#include <openvpn/common/stat.hpp>
|
||||
|
||||
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
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/aws/awsca.hpp>
|
||||
#include <openvpn/ssl/sslchoose.hpp>
|
||||
|
||||
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
|
||||
|
@ -40,8 +40,7 @@
|
||||
#include <openvpn/openssl/sign/pkcs7verify.hpp>
|
||||
#include <openvpn/ssl/sslchoose.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace AWS {
|
||||
namespace openvpn::AWS {
|
||||
|
||||
class PCQuery : public RC<thread_unsafe_refcount>
|
||||
{
|
||||
@ -609,5 +608,4 @@ class PCQuery : public RC<thread_unsafe_refcount>
|
||||
Json::Value awspc_req;
|
||||
bool pending = false;
|
||||
};
|
||||
} // namespace AWS
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::AWS
|
||||
|
@ -36,8 +36,7 @@
|
||||
#include <openvpn/crypto/digestapi.hpp>
|
||||
#include <openvpn/aws/awscreds.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace AWS {
|
||||
namespace openvpn::AWS {
|
||||
class REST
|
||||
{
|
||||
public:
|
||||
@ -248,5 +247,4 @@ class REST
|
||||
}
|
||||
};
|
||||
};
|
||||
} // namespace AWS
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::AWS
|
||||
|
@ -56,8 +56,7 @@
|
||||
#include <openvpn/aws/awspc.hpp>
|
||||
#include <openvpn/aws/awsrest.hpp>
|
||||
|
||||
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
|
||||
|
@ -28,8 +28,7 @@
|
||||
#include <openvpn/buffer/buffer.hpp>
|
||||
#include <openvpn/common/hexstr.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace BufferFormat {
|
||||
namespace openvpn::BufferFormat {
|
||||
|
||||
template <typename T>
|
||||
class UnsignedDecimal
|
||||
@ -127,5 +126,4 @@ class Hex
|
||||
T value_;
|
||||
};
|
||||
|
||||
} // namespace BufferFormat
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::BufferFormat
|
||||
|
@ -26,8 +26,7 @@
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/buffer/buffer.hpp>
|
||||
|
||||
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
|
||||
|
@ -28,8 +28,7 @@
|
||||
#include <openvpn/buffer/buffmt.hpp>
|
||||
#include <openvpn/common/socktypes.hpp> // 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
|
||||
|
@ -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
|
||||
|
@ -38,8 +38,7 @@
|
||||
#include <openvpn/common/jsonhelper.hpp>
|
||||
#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<thread_unsafe_refcount>
|
||||
|
||||
virtual void add_event(Base::Ptr event) = 0;
|
||||
};
|
||||
} // namespace ClientEvent
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::ClientEvent
|
||||
|
||||
#endif // OPENVPN_CLIENT_CLIEVENT_H
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include <openvpn/common/endian_platform.hpp>
|
||||
|
||||
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
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <openvpn/common/endian_platform.hpp>
|
||||
|
||||
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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/common/hostport.hpp>
|
||||
#include <openvpn/random/randapi.hpp>
|
||||
|
||||
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
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <openvpn/common/options.hpp>
|
||||
#include <openvpn/common/unicode.hpp>
|
||||
|
||||
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
|
||||
|
@ -24,8 +24,7 @@
|
||||
#include <openvpn/common/jsonhelper.hpp>
|
||||
#include <openvpn/common/fileatomic.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <openvpn/common/stringtempl2.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace json {
|
||||
namespace openvpn::json {
|
||||
|
||||
// format name.title but omit .title if title is empty
|
||||
template <typename NAME, typename TITLE>
|
||||
@ -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
|
||||
|
@ -65,8 +65,7 @@ extern "C" void _ReadWriteBarrier();
|
||||
|
||||
#define OPENVPN_INCR_VOID_PTR(var, incr) (var) = static_cast<const unsigned char *>(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
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace openvpn {
|
||||
namespace MSF {
|
||||
namespace openvpn::MSF {
|
||||
|
||||
template <typename ITERATOR>
|
||||
class Iter : public ITERATOR
|
||||
@ -86,5 +85,4 @@ inline auto iter(ITERATOR i)
|
||||
{
|
||||
return Iter<ITERATOR>(std::move(i));
|
||||
}
|
||||
} // namespace MSF
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::MSF
|
||||
|
@ -30,9 +30,7 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
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<C> &contain
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace C2os
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::C2os
|
||||
|
@ -30,8 +30,7 @@
|
||||
#include <openvpn/common/platform.hpp>
|
||||
#include <openvpn/common/string.hpp>
|
||||
|
||||
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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <sys/ucred.h>
|
||||
#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
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <openvpn/common/strerror.hpp>
|
||||
#include <openvpn/buffer/buflist.hpp>
|
||||
|
||||
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
|
||||
|
@ -21,8 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace openvpn {
|
||||
namespace SFINAE {
|
||||
namespace openvpn::SFINAE {
|
||||
|
||||
template <int I>
|
||||
struct Rank : Rank<I - 1>
|
||||
@ -33,5 +32,4 @@ struct Rank<0>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace SFINAE
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::SFINAE
|
||||
|
@ -35,8 +35,7 @@
|
||||
|
||||
#include <openvpn/common/exception.hpp>
|
||||
|
||||
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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/common/platform.hpp>
|
||||
#include <openvpn/common/size.hpp>
|
||||
|
||||
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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <cstddef> // for std::nullptr_t
|
||||
#include <utility>
|
||||
|
||||
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
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
#include <openvpn/common/stringtempl.hpp>
|
||||
|
||||
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
|
||||
|
@ -24,8 +24,7 @@
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -35,8 +35,7 @@
|
||||
#include <openvpn/common/unicode-impl.hpp>
|
||||
#include <openvpn/buffer/buffer.hpp>
|
||||
|
||||
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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/common/string.hpp>
|
||||
#include <openvpn/common/file.hpp>
|
||||
|
||||
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
|
||||
|
@ -27,8 +27,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
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<std::string> &strvec)
|
||||
}
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
||||
} // namespace wstring
|
||||
} // namespace openvpn
|
||||
}
|
||||
|
@ -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 @@ assert_fail:
|
||||
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
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <openvpn/common/arraysize.hpp>
|
||||
#include <openvpn/crypto/definitions.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -43,8 +43,7 @@
|
||||
#include <openvpn/mbedtls/util/selftest.hpp>
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
} // namespace openvpn::KoRekey
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/crypto/cryptodc.hpp>
|
||||
#include <openvpn/crypto/bs64_data_limit.hpp>
|
||||
|
||||
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 <openvpn/kovpn/kovpnkocrypto.hpp>
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
#include <openvpn/dco/kocrypto.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace KoRekey {
|
||||
namespace openvpn::KoRekey {
|
||||
|
||||
class Receiver : public virtual RC<thread_unsafe_refcount>
|
||||
{
|
||||
@ -195,7 +194,6 @@ class Factory : public CryptoDCFactory
|
||||
Frame::Ptr frame;
|
||||
};
|
||||
|
||||
} // namespace KoRekey
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::KoRekey
|
||||
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
#include <openvpn/common/arraysize.hpp>
|
||||
|
||||
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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/common/exception.hpp>
|
||||
#include <openvpn/common/string.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace HTTP {
|
||||
namespace openvpn::HTTP {
|
||||
|
||||
struct Header
|
||||
{
|
||||
@ -111,7 +110,6 @@ struct HeaderList : public std::vector<Header>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace HTTP
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::HTTP
|
||||
|
||||
#endif
|
||||
|
@ -24,8 +24,7 @@
|
||||
#include <string>
|
||||
#include <regex>
|
||||
|
||||
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
|
||||
|
@ -36,8 +36,7 @@
|
||||
|
||||
#include <openvpn/buffer/buffer.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/http/header.hpp>
|
||||
#include <openvpn/http/parseutil.hpp>
|
||||
|
||||
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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/http/header.hpp>
|
||||
#include <openvpn/http/parseutil.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/common/unicode.hpp>
|
||||
#include <openvpn/http/parseutil.hpp>
|
||||
|
||||
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<std::string> decode_path(std::string path)
|
||||
i = decode(i);
|
||||
return list;
|
||||
}
|
||||
} // namespace URL
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::URL
|
||||
|
||||
#endif
|
||||
|
@ -31,8 +31,7 @@
|
||||
#include <openvpn/http/webexcept.hpp>
|
||||
#include <openvpn/common/string.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace URL {
|
||||
namespace openvpn::URL {
|
||||
OPENVPN_EXCEPTION(url_parameter_error);
|
||||
|
||||
struct Parm
|
||||
@ -208,7 +207,6 @@ class ParmList : public std::vector<Parm>
|
||||
std::string request_;
|
||||
};
|
||||
|
||||
} // namespace URL
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::URL
|
||||
|
||||
#endif
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/http/validate_uri.hpp>
|
||||
#include <openvpn/http/parseutil.hpp>
|
||||
|
||||
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
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include <openvpn/common/exception.hpp>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -33,8 +33,7 @@
|
||||
#include <openvpn/init/cryptoinit.hpp>
|
||||
#include <openvpn/init/engineinit.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace InitProcess {
|
||||
namespace openvpn::InitProcess {
|
||||
class Init
|
||||
{
|
||||
private:
|
||||
@ -93,5 +92,4 @@ class Init
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace InitProcess
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::InitProcess
|
||||
|
@ -29,8 +29,7 @@
|
||||
#include <openvpn/common/socktypes.hpp>
|
||||
#include <openvpn/common/size.hpp>
|
||||
|
||||
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
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#include <cstdint> // 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -35,8 +35,7 @@
|
||||
#include <openvpn/crypto/cryptoalgs.hpp>
|
||||
#include <openvpn/ssl/sslapi.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace MbedTLSCrypto {
|
||||
namespace openvpn::MbedTLSCrypto {
|
||||
class CipherContextCommon
|
||||
{
|
||||
public:
|
||||
@ -239,7 +238,6 @@ class CipherContext
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace MbedTLSCrypto
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::MbedTLSCrypto
|
||||
|
||||
#endif
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <openvpn/crypto/cryptoalgs.hpp>
|
||||
#include <openvpn/mbedtls/crypto/cipher.hpp>
|
||||
|
||||
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
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <openvpn/crypto/cryptoalgs.hpp>
|
||||
#include <openvpn/mbedtls/mbedtls_compat.hpp>
|
||||
|
||||
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
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <openvpn/mbedtls/crypto/digest.hpp>
|
||||
#include <openvpn/mbedtls/mbedtls_compat.hpp>
|
||||
|
||||
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
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include <mbedtls/ssl.h>
|
||||
|
||||
namespace openvpn {
|
||||
namespace MbedTLSCrypto {
|
||||
namespace openvpn::MbedTLSCrypto {
|
||||
class TLS1PRF
|
||||
{
|
||||
public:
|
||||
@ -141,5 +140,4 @@ class TLS1PRF
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace MbedTLSCrypto
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::MbedTLSCrypto
|
||||
|
@ -35,8 +35,7 @@
|
||||
#include <openvpn/common/rc.hpp>
|
||||
#include <openvpn/mbedtls/util/error.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace MbedTLSPKI {
|
||||
namespace openvpn::MbedTLSPKI {
|
||||
|
||||
class DH : public RC<thread_unsafe_refcount>
|
||||
{
|
||||
@ -122,7 +121,6 @@ class DH : public RC<thread_unsafe_refcount>
|
||||
mbedtls_dhm_context *dhc;
|
||||
std::string pem_dhc;
|
||||
};
|
||||
} // namespace MbedTLSPKI
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::MbedTLSPKI
|
||||
|
||||
#endif
|
||||
|
@ -36,8 +36,7 @@
|
||||
#include <openvpn/mbedtls/util/error.hpp>
|
||||
#include <openvpn/mbedtls/util/rand.hpp>
|
||||
|
||||
namespace openvpn {
|
||||
namespace MbedTLSPKI {
|
||||
namespace openvpn::MbedTLSPKI {
|
||||
|
||||
class PKContext : public RC<thread_unsafe_refcount>
|
||||
{
|
||||
@ -174,6 +173,5 @@ class PKContext : public RC<thread_unsafe_refcount>
|
||||
mbedtls_pk_context *ctx;
|
||||
};
|
||||
|
||||
} // namespace MbedTLSPKI
|
||||
} // namespace openvpn
|
||||
} // namespace openvpn::MbedTLSPKI
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user