mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-19 19:52:15 +02:00
streamline overriding virtual function syntax
In the code base three different syntaxes for overriding virtual member functions could be found: 1) virtual ... override 2) virtual ... 3) ... override This converts all of them to the third syntax, as recommended by the ISO C++ core guidelines in C.128 Signed-off-by: Heiko Hund <heiko@openvpn.net>
This commit is contained in:
parent
e4368fd83e
commit
8c8e96e138
@ -167,7 +167,7 @@ class MySessionStats : public SessionStats
|
||||
parent = nullptr;
|
||||
}
|
||||
|
||||
virtual void error(const size_t err, const std::string *text = nullptr)
|
||||
void error(const size_t err, const std::string *text = nullptr) override
|
||||
{
|
||||
if (err < Error::N_ERRORS)
|
||||
{
|
||||
@ -196,7 +196,7 @@ class MyClientEvents : public ClientEvent::Queue
|
||||
{
|
||||
}
|
||||
|
||||
virtual void add_event(ClientEvent::Base::Ptr event) override
|
||||
void add_event(ClientEvent::Base::Ptr event) override
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
@ -326,7 +326,7 @@ class MyReconnectNotify : public ReconnectNotify
|
||||
parent = nullptr;
|
||||
}
|
||||
|
||||
virtual bool pause_on_connection_timeout()
|
||||
bool pause_on_connection_timeout() override
|
||||
{
|
||||
if (parent)
|
||||
return parent->pause_on_connection_timeout();
|
||||
@ -351,7 +351,7 @@ class MyRemoteOverride : public RemoteList::RemoteOverride
|
||||
parent = nullptr;
|
||||
}
|
||||
|
||||
virtual RemoteList::Item::Ptr get() override
|
||||
RemoteList::Item::Ptr get() override
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
|
@ -43,9 +43,9 @@ class NamedPipe : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
{
|
||||
// create the named pipe
|
||||
const HANDLE h = ::CreateNamedPipeA(
|
||||
@ -101,7 +101,7 @@ class NamedPipe : public Base
|
||||
}
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
handle.close();
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ struct TCP : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
{
|
||||
AsioPolySock::TCP::Ptr sock(new AsioPolySock::TCP(io_context, acceptor_index));
|
||||
acceptor.async_accept(sock->socket,
|
||||
@ -45,7 +45,7 @@ struct TCP : public Base
|
||||
{ listener->handle_accept(std::move(sock), error); });
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
#ifdef OPENVPN_DEBUG_ACCEPT
|
||||
OPENVPN_LOG("ACCEPTOR CLOSE " << local_endpoint);
|
||||
|
@ -39,9 +39,9 @@ struct Unix : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
void async_accept(ListenerBase *listener,
|
||||
const size_t acceptor_index,
|
||||
openvpn_io::io_context &io_context) override
|
||||
{
|
||||
AsioPolySock::Unix::Ptr sock(new AsioPolySock::Unix(io_context, acceptor_index));
|
||||
acceptor.async_accept(sock->socket,
|
||||
@ -49,7 +49,7 @@ struct Unix : public Base
|
||||
{ listener->handle_accept(std::move(sock), error); });
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
acceptor.close();
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ inline CFTypeRef dict_index(const DICT &dict, const KEY &key)
|
||||
|
||||
struct cppstring_error : public std::exception
|
||||
{
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return "cppstring_error";
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class CFException : public std::exception
|
||||
set_errtxt(text, status);
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return errtxt.c_str();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace openvpn {
|
||||
class iOSActiveInterface : public ReachabilityInterface
|
||||
{
|
||||
public:
|
||||
virtual Status reachable() const
|
||||
Status reachable() const override
|
||||
{
|
||||
if (ei.iface_up("en0"))
|
||||
return ReachableViaWiFi;
|
||||
@ -42,7 +42,7 @@ class iOSActiveInterface : public ReachabilityInterface
|
||||
return NotReachable;
|
||||
}
|
||||
|
||||
virtual bool reachableVia(const std::string &net_type) const
|
||||
bool reachableVia(const std::string &net_type) const override
|
||||
{
|
||||
const Status r = reachable();
|
||||
if (net_type == "cellular")
|
||||
@ -53,7 +53,7 @@ class iOSActiveInterface : public ReachabilityInterface
|
||||
return r != NotReachable;
|
||||
}
|
||||
|
||||
virtual std::string to_string() const
|
||||
std::string to_string() const override
|
||||
{
|
||||
switch (reachable())
|
||||
{
|
||||
|
@ -52,12 +52,12 @@ class MacLifeCycle : public ClientLifeCycle, MacSleep, ReachabilityTracker
|
||||
stop_thread();
|
||||
}
|
||||
|
||||
virtual bool network_available()
|
||||
bool network_available() override
|
||||
{
|
||||
return net_up();
|
||||
}
|
||||
|
||||
virtual void start(NotifyCallback *nc_arg)
|
||||
void start(NotifyCallback *nc_arg) override
|
||||
{
|
||||
if (!thread && nc_arg)
|
||||
{
|
||||
@ -66,7 +66,7 @@ class MacLifeCycle : public ClientLifeCycle, MacSleep, ReachabilityTracker
|
||||
}
|
||||
}
|
||||
|
||||
virtual void stop()
|
||||
void stop() override
|
||||
{
|
||||
stop_thread();
|
||||
}
|
||||
@ -217,21 +217,21 @@ class MacLifeCycle : public ClientLifeCycle, MacSleep, ReachabilityTracker
|
||||
schedule_action_timer(1);
|
||||
}
|
||||
|
||||
virtual void notify_sleep()
|
||||
void notify_sleep() override
|
||||
{
|
||||
OPENVPN_LOG("MacLifeCycle SLEEP");
|
||||
state.sleep = true;
|
||||
schedule_action_timer(0);
|
||||
}
|
||||
|
||||
virtual void notify_wakeup()
|
||||
void notify_wakeup() override
|
||||
{
|
||||
OPENVPN_LOG("MacLifeCycle WAKEUP");
|
||||
state.sleep = false;
|
||||
schedule_action_timer(1);
|
||||
}
|
||||
|
||||
virtual void reachability_tracker_event(const ReachabilityBase &rb, SCNetworkReachabilityFlags flags)
|
||||
void reachability_tracker_event(const ReachabilityBase &rb, SCNetworkReachabilityFlags flags) override
|
||||
{
|
||||
if (rb.vtype() == ReachabilityBase::Internet)
|
||||
{
|
||||
|
@ -224,12 +224,12 @@ class ReachabilityViaInternet : public ReachabilityBase
|
||||
reach.reset(SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (struct sockaddr *)&addr));
|
||||
}
|
||||
|
||||
virtual Type vtype() const
|
||||
Type vtype() const override
|
||||
{
|
||||
return Internet;
|
||||
}
|
||||
|
||||
virtual Status vstatus(const SCNetworkReachabilityFlags flags) const
|
||||
Status vstatus(const SCNetworkReachabilityFlags flags) const override
|
||||
{
|
||||
return status_from_flags(flags);
|
||||
}
|
||||
@ -292,12 +292,12 @@ class ReachabilityViaWiFi : public ReachabilityBase
|
||||
reach.reset(SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (struct sockaddr *)&addr));
|
||||
}
|
||||
|
||||
virtual Type vtype() const
|
||||
Type vtype() const override
|
||||
{
|
||||
return WiFi;
|
||||
}
|
||||
|
||||
virtual Status vstatus(const SCNetworkReachabilityFlags flags) const
|
||||
Status vstatus(const SCNetworkReachabilityFlags flags) const override
|
||||
{
|
||||
return status_from_flags(flags);
|
||||
}
|
||||
@ -348,7 +348,7 @@ class Reachability : public ReachabilityInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual Status reachable() const
|
||||
Status reachable() const override
|
||||
{
|
||||
if (reachableViaWiFi())
|
||||
return ReachableViaWiFi;
|
||||
@ -358,7 +358,7 @@ class Reachability : public ReachabilityInterface
|
||||
return NotReachable;
|
||||
}
|
||||
|
||||
virtual bool reachableVia(const std::string &net_type) const
|
||||
bool reachableVia(const std::string &net_type) const override
|
||||
{
|
||||
if (net_type == "cellular")
|
||||
return reachableViaCellular();
|
||||
@ -368,7 +368,7 @@ class Reachability : public ReachabilityInterface
|
||||
return reachableViaWiFi() || reachableViaCellular();
|
||||
}
|
||||
|
||||
virtual std::string to_string() const
|
||||
std::string to_string() const override
|
||||
{
|
||||
std::string ret;
|
||||
if (internet)
|
||||
|
@ -38,25 +38,25 @@
|
||||
|
||||
#define OPENVPN_DIGEST_CONTEXT(TYPE) CC_##TYPE##_CTX TYPE##_ctx
|
||||
|
||||
#define OPENVPN_DIGEST_ALG_CLASS(TYPE) \
|
||||
class DigestAlgorithm##TYPE : public DigestAlgorithm \
|
||||
{ \
|
||||
public: \
|
||||
DigestAlgorithm##TYPE() \
|
||||
{ \
|
||||
} \
|
||||
virtual int init(DigestCTX &ctx) const \
|
||||
{ \
|
||||
return CC_##TYPE##_Init(&ctx.u.TYPE##_ctx); \
|
||||
} \
|
||||
virtual int update(DigestCTX &ctx, const unsigned char *data, size_t size) const \
|
||||
{ \
|
||||
return CC_##TYPE##_Update(&ctx.u.TYPE##_ctx, data, size); \
|
||||
} \
|
||||
virtual int final(DigestCTX &ctx, unsigned char *md) const \
|
||||
{ \
|
||||
return CC_##TYPE##_Final(md, &ctx.u.TYPE##_ctx); \
|
||||
} \
|
||||
#define OPENVPN_DIGEST_ALG_CLASS(TYPE) \
|
||||
class DigestAlgorithm##TYPE : public DigestAlgorithm \
|
||||
{ \
|
||||
public: \
|
||||
DigestAlgorithm##TYPE() \
|
||||
{ \
|
||||
} \
|
||||
int init(DigestCTX &ctx) const override \
|
||||
{ \
|
||||
return CC_##TYPE##_Init(&ctx.u.TYPE##_ctx); \
|
||||
} \
|
||||
int update(DigestCTX &ctx, const unsigned char *data, size_t size) const override \
|
||||
{ \
|
||||
return CC_##TYPE##_Update(&ctx.u.TYPE##_ctx, data, size); \
|
||||
} \
|
||||
int final(DigestCTX &ctx, unsigned char *md) const override \
|
||||
{ \
|
||||
return CC_##TYPE##_Final(md, &ctx.u.TYPE##_ctx); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OPENVPN_DIGEST_ALG_DECLARE(TYPE) const DigestAlgorithm##TYPE alg_##TYPE;
|
||||
|
@ -92,27 +92,27 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
OPENVPN_THROW(ssl_context_error, "AppleSSLContext: identity '" << subject_match << "' undefined");
|
||||
}
|
||||
|
||||
virtual SSLFactoryAPI::Ptr new_factory()
|
||||
SSLFactoryAPI::Ptr new_factory() override
|
||||
{
|
||||
return SSLFactoryAPI::Ptr(new AppleSSLContext(this));
|
||||
}
|
||||
|
||||
virtual void set_mode(const Mode &mode_arg)
|
||||
void set_mode(const Mode &mode_arg) override
|
||||
{
|
||||
mode = mode_arg;
|
||||
}
|
||||
|
||||
virtual const Mode &get_mode() const
|
||||
const Mode &get_mode() const override
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
virtual void set_frame(const Frame::Ptr &frame_arg)
|
||||
void set_frame(const Frame::Ptr &frame_arg) override
|
||||
{
|
||||
frame = frame_arg;
|
||||
}
|
||||
|
||||
virtual void load(const OptionList &opt, const unsigned int lflags)
|
||||
void load(const OptionList &opt, const unsigned int lflags) override
|
||||
{
|
||||
// client/server
|
||||
if (lflags & LF_PARSE_MODE)
|
||||
@ -125,87 +125,87 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
}
|
||||
}
|
||||
|
||||
virtual void set_external_pki_callback(ExternalPKIBase *external_pki_arg, const std::string &alias)
|
||||
void set_external_pki_callback(ExternalPKIBase *external_pki_arg, const std::string &alias) override
|
||||
{
|
||||
not_implemented("set_external_pki_callback");
|
||||
}
|
||||
|
||||
virtual void set_private_key_password(const std::string &pwd)
|
||||
void set_private_key_password(const std::string &pwd) override
|
||||
{
|
||||
return not_implemented("set_private_key_password");
|
||||
}
|
||||
|
||||
virtual void load_ca(const std::string &ca_txt, bool strict)
|
||||
void load_ca(const std::string &ca_txt, bool strict) override
|
||||
{
|
||||
return not_implemented("load_ca");
|
||||
}
|
||||
|
||||
virtual void load_crl(const std::string &crl_txt)
|
||||
void load_crl(const std::string &crl_txt) override
|
||||
{
|
||||
return not_implemented("load_crl");
|
||||
}
|
||||
|
||||
virtual void load_cert(const std::string &cert_txt)
|
||||
void load_cert(const std::string &cert_txt) override
|
||||
{
|
||||
return not_implemented("load_cert");
|
||||
}
|
||||
|
||||
virtual void load_cert(const std::string &cert_txt, const std::string &extra_certs_txt)
|
||||
void load_cert(const std::string &cert_txt, const std::string &extra_certs_txt) override
|
||||
{
|
||||
return not_implemented("load_cert");
|
||||
}
|
||||
|
||||
virtual void load_private_key(const std::string &key_txt)
|
||||
void load_private_key(const std::string &key_txt) override
|
||||
{
|
||||
return not_implemented("load_private_key");
|
||||
}
|
||||
|
||||
virtual void load_dh(const std::string &dh_txt)
|
||||
void load_dh(const std::string &dh_txt) override
|
||||
{
|
||||
return not_implemented("load_dh");
|
||||
}
|
||||
|
||||
virtual void set_debug_level(const int debug_level)
|
||||
void set_debug_level(const int debug_level) override
|
||||
{
|
||||
return not_implemented("set_debug_level");
|
||||
}
|
||||
|
||||
virtual void set_flags(const unsigned int flags_arg)
|
||||
void set_flags(const unsigned int flags_arg) override
|
||||
{
|
||||
return not_implemented("set_flags");
|
||||
}
|
||||
|
||||
virtual void set_ns_cert_type(const NSCert::Type ns_cert_type_arg)
|
||||
void set_ns_cert_type(const NSCert::Type ns_cert_type_arg) override
|
||||
{
|
||||
return not_implemented("set_ns_cert_type");
|
||||
}
|
||||
|
||||
virtual void set_remote_cert_tls(const KUParse::TLSWebType wt)
|
||||
void set_remote_cert_tls(const KUParse::TLSWebType wt) override
|
||||
{
|
||||
return not_implemented("set_remote_cert_tls");
|
||||
}
|
||||
|
||||
virtual void set_tls_remote(const std::string &tls_remote_arg)
|
||||
void set_tls_remote(const std::string &tls_remote_arg) override
|
||||
{
|
||||
return not_implemented("set_tls_remote");
|
||||
}
|
||||
|
||||
virtual void set_tls_version_min(const TLSVersion::Type tvm)
|
||||
void set_tls_version_min(const TLSVersion::Type tvm) override
|
||||
{
|
||||
return not_implemented("set_tls_version_min");
|
||||
}
|
||||
|
||||
virtual void set_local_cert_enabled(const bool v)
|
||||
void set_local_cert_enabled(const bool v) override
|
||||
{
|
||||
return not_implemented("set_local_cert_enabled");
|
||||
}
|
||||
|
||||
virtual void set_enable_renegotiation(const bool v)
|
||||
void set_enable_renegotiation(const bool v) override
|
||||
{
|
||||
return not_implemented("set_enable_renegotiation");
|
||||
}
|
||||
|
||||
virtual void set_rng(const StrongRandomAPI::Ptr &rng_arg)
|
||||
void set_rng(const StrongRandomAPI::Ptr &rng_arg) override
|
||||
{
|
||||
return not_implemented("set_rng");
|
||||
}
|
||||
@ -230,12 +230,12 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
public:
|
||||
typedef RCPtr<SSL> Ptr;
|
||||
|
||||
virtual void start_handshake()
|
||||
void start_handshake() override
|
||||
{
|
||||
SSLHandshake(ssl);
|
||||
}
|
||||
|
||||
virtual ssize_t write_cleartext_unbuffered(const void *data, const size_t size)
|
||||
ssize_t write_cleartext_unbuffered(const void *data, const size_t size) override
|
||||
{
|
||||
size_t actual = 0;
|
||||
const OSStatus status = SSLWrite(ssl, data, size, &actual);
|
||||
@ -250,7 +250,7 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
return actual;
|
||||
}
|
||||
|
||||
virtual ssize_t read_cleartext(void *data, const size_t capacity)
|
||||
ssize_t read_cleartext(void *data, const size_t capacity) override
|
||||
{
|
||||
if (!overflow)
|
||||
{
|
||||
@ -270,13 +270,13 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
throw ssl_ciphertext_in_overflow();
|
||||
}
|
||||
|
||||
virtual bool read_cleartext_ready() const
|
||||
bool read_cleartext_ready() const override
|
||||
{
|
||||
// fixme: need to detect data buffered at SSL layer
|
||||
return !ct_in.empty();
|
||||
}
|
||||
|
||||
virtual void write_ciphertext(const BufferPtr &buf)
|
||||
void write_ciphertext(const BufferPtr &buf) override
|
||||
{
|
||||
if (ct_in.size() < MAX_CIPHERTEXT_IN)
|
||||
ct_in.write_buf(buf);
|
||||
@ -284,22 +284,22 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
overflow = true;
|
||||
}
|
||||
|
||||
virtual bool read_ciphertext_ready() const
|
||||
bool read_ciphertext_ready() const override
|
||||
{
|
||||
return !ct_out.empty();
|
||||
}
|
||||
|
||||
virtual BufferPtr read_ciphertext()
|
||||
BufferPtr read_ciphertext() override
|
||||
{
|
||||
return ct_out.read_buf();
|
||||
}
|
||||
|
||||
virtual std::string ssl_handshake_details() const // fixme -- code me
|
||||
std::string ssl_handshake_details() const override // fixme -- code me
|
||||
{
|
||||
return "[AppleSSL not implemented]";
|
||||
}
|
||||
|
||||
virtual const AuthCert::Ptr &auth_cert() const
|
||||
const AuthCert::Ptr &auth_cert() const override
|
||||
{
|
||||
OPENVPN_THROW(ssl_context_error, "AppleSSL::SSL: auth_cert() not implemented");
|
||||
}
|
||||
@ -438,18 +438,18 @@ class AppleSSLContext : public SSLFactoryAPI
|
||||
/////// start of main class implementation
|
||||
|
||||
// create a new SSL instance
|
||||
virtual SSLAPI::Ptr ssl()
|
||||
SSLAPI::Ptr ssl() override
|
||||
{
|
||||
return SSL::Ptr(new SSL(*this));
|
||||
}
|
||||
|
||||
// like ssl() above but verify hostname against cert CommonName and/or SubjectAltName
|
||||
virtual SSLAPI::Ptr ssl(const std::string &hostname)
|
||||
SSLAPI::Ptr ssl(const std::string &hostname) override
|
||||
{
|
||||
OPENVPN_THROW(ssl_context_error, "AppleSSLContext: ssl session with CommonName and/or SubjectAltName verification not implemented");
|
||||
}
|
||||
|
||||
virtual const Mode &mode() const
|
||||
const Mode &mode() const override
|
||||
{
|
||||
return config_->mode;
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ class AppleRandom : public StrongRandomAPI
|
||||
|
||||
AppleRandom() = default;
|
||||
|
||||
virtual std::string name() const
|
||||
std::string name() const override
|
||||
{
|
||||
return "AppleRandom";
|
||||
}
|
||||
|
||||
// Fill buffer with random bytes
|
||||
virtual void rand_bytes(unsigned char *buf, size_t size)
|
||||
void rand_bytes(unsigned char *buf, size_t size) override
|
||||
{
|
||||
if (!rndbytes(buf, size))
|
||||
throw rand_error_apple("rand_bytes");
|
||||
@ -54,7 +54,7 @@ class AppleRandom : public StrongRandomAPI
|
||||
|
||||
// Like rand_bytes, but don't throw exception.
|
||||
// Return true on successs, false on fail.
|
||||
virtual bool rand_bytes_noexcept(unsigned char *buf, size_t size)
|
||||
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
|
||||
{
|
||||
return rndbytes(buf, size);
|
||||
}
|
||||
|
@ -133,20 +133,20 @@ struct TCP : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
socket.async_send(buf, std::move(callback));
|
||||
}
|
||||
|
||||
virtual void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
socket.async_receive(buf, std::move(callback));
|
||||
}
|
||||
|
||||
#if !defined(OPENVPN_POLYSOCK_SUPPORTS_ALT_ROUTING)
|
||||
virtual std::string remote_endpoint_str() const override
|
||||
std::string remote_endpoint_str() const override
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -159,7 +159,7 @@ struct TCP : public Base
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool remote_ip_port(IP::Addr &addr, unsigned int &port) const override
|
||||
bool remote_ip_port(IP::Addr &addr, unsigned int &port) const override
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -173,18 +173,18 @@ struct TCP : public Base
|
||||
}
|
||||
}
|
||||
|
||||
virtual void non_blocking(const bool state) override
|
||||
void non_blocking(const bool state) override
|
||||
{
|
||||
socket.non_blocking(state);
|
||||
}
|
||||
|
||||
virtual void tcp_nodelay() override
|
||||
void tcp_nodelay() override
|
||||
{
|
||||
socket.set_option(openvpn_io::ip::tcp::no_delay(true));
|
||||
}
|
||||
|
||||
#if !defined(OPENVPN_PLATFORM_WIN)
|
||||
virtual void set_cloexec() override
|
||||
void set_cloexec() override
|
||||
{
|
||||
const int fd = socket.native_handle();
|
||||
if (fd >= 0)
|
||||
@ -192,7 +192,7 @@ struct TCP : public Base
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void shutdown(const unsigned int flags) override
|
||||
void shutdown(const unsigned int flags) override
|
||||
{
|
||||
if (flags & SHUTDOWN_SEND)
|
||||
socket.shutdown(openvpn_io::ip::tcp::socket::shutdown_send);
|
||||
@ -200,34 +200,34 @@ struct TCP : public Base
|
||||
socket.shutdown(openvpn_io::ip::tcp::socket::shutdown_receive);
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
|
||||
virtual bool is_open() const override
|
||||
bool is_open() const override
|
||||
{
|
||||
return socket.is_open();
|
||||
}
|
||||
|
||||
virtual bool is_local() const override
|
||||
bool is_local() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual openvpn_io::detail::socket_type native_handle() override
|
||||
openvpn_io::detail::socket_type native_handle() override
|
||||
{
|
||||
return socket.native_handle();
|
||||
}
|
||||
|
||||
#if defined(OPENVPN_POLYSOCK_SUPPORTS_ALT_ROUTING)
|
||||
virtual std::string remote_endpoint_str() const override
|
||||
std::string remote_endpoint_str() const override
|
||||
{
|
||||
const char *proto = (socket.alt_routing_enabled() ? "TCP ALT " : "TCP ");
|
||||
return proto + socket.to_string();
|
||||
}
|
||||
|
||||
virtual bool alt_routing_enabled() const override
|
||||
bool alt_routing_enabled() const override
|
||||
{
|
||||
return socket.alt_routing_enabled();
|
||||
}
|
||||
@ -252,39 +252,39 @@ struct Unix : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
socket.async_send(buf, std::move(callback));
|
||||
}
|
||||
|
||||
virtual void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
socket.async_receive(buf, std::move(callback));
|
||||
}
|
||||
|
||||
virtual std::string remote_endpoint_str() const override
|
||||
std::string remote_endpoint_str() const override
|
||||
{
|
||||
return "LOCAL";
|
||||
}
|
||||
|
||||
virtual bool remote_ip_port(IP::Addr &, unsigned int &) const override
|
||||
bool remote_ip_port(IP::Addr &, unsigned int &) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void non_blocking(const bool state) override
|
||||
void non_blocking(const bool state) override
|
||||
{
|
||||
socket.non_blocking(state);
|
||||
}
|
||||
|
||||
virtual bool peercreds(SockOpt::Creds &cr) override
|
||||
bool peercreds(SockOpt::Creds &cr) override
|
||||
{
|
||||
return SockOpt::peercreds(socket.native_handle(), cr);
|
||||
}
|
||||
|
||||
virtual void set_cloexec() override
|
||||
void set_cloexec() override
|
||||
{
|
||||
const int fd = socket.native_handle();
|
||||
if (fd >= 0)
|
||||
@ -295,7 +295,7 @@ struct Unix : public Base
|
||||
// shutdown() throws "socket is not connected" exception
|
||||
// on macos if another side has called close() - this behavior
|
||||
// breaks communication with agent, and hence disabled
|
||||
virtual void shutdown(const unsigned int flags) override
|
||||
void shutdown(const unsigned int flags) override
|
||||
{
|
||||
if (flags & SHUTDOWN_SEND)
|
||||
socket.shutdown(openvpn_io::ip::tcp::socket::shutdown_send);
|
||||
@ -304,22 +304,22 @@ struct Unix : public Base
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
socket.close();
|
||||
}
|
||||
|
||||
virtual bool is_open() const override
|
||||
bool is_open() const override
|
||||
{
|
||||
return socket.is_open();
|
||||
}
|
||||
|
||||
virtual bool is_local() const override
|
||||
bool is_local() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual openvpn_io::detail::socket_type native_handle() override
|
||||
openvpn_io::detail::socket_type native_handle() override
|
||||
{
|
||||
return socket.native_handle();
|
||||
}
|
||||
@ -340,43 +340,43 @@ struct NamedPipe : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_send(const openvpn_io::const_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
handle.async_write_some(buf, std::move(callback));
|
||||
}
|
||||
|
||||
virtual void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
void async_receive(const openvpn_io::mutable_buffer &buf,
|
||||
Function<void(const openvpn_io::error_code &, const size_t)> &&callback) override
|
||||
{
|
||||
handle.async_read_some(buf, std::move(callback));
|
||||
}
|
||||
|
||||
virtual std::string remote_endpoint_str() const override
|
||||
std::string remote_endpoint_str() const override
|
||||
{
|
||||
return "NAMED_PIPE";
|
||||
}
|
||||
|
||||
virtual bool remote_ip_port(IP::Addr &, unsigned int &) const override
|
||||
bool remote_ip_port(IP::Addr &, unsigned int &) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void non_blocking(const bool state) override
|
||||
void non_blocking(const bool state) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
handle.close();
|
||||
}
|
||||
|
||||
virtual bool is_open() const override
|
||||
bool is_open() const override
|
||||
{
|
||||
return handle.is_open();
|
||||
}
|
||||
|
||||
virtual bool is_local() const override
|
||||
bool is_local() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class BufferException : public std::exception
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
if (!msg_.empty())
|
||||
return msg_.c_str();
|
||||
@ -1052,13 +1052,13 @@ class BufferAllocatedType : public BufferType<T>, public RC<R>
|
||||
* @param min_capacity The minimum capacity for the buffer.
|
||||
* @param flags The flags to set for the buffer.
|
||||
*/
|
||||
virtual void reset_impl(const size_t min_capacity, const unsigned int flags) override;
|
||||
void reset_impl(const size_t min_capacity, const unsigned int flags) override;
|
||||
|
||||
/**
|
||||
* @brief Resizes the buffer to the specified new capacity.
|
||||
* @param new_capacity The new capacity for the buffer.
|
||||
*/
|
||||
virtual void resize(const size_t new_capacity) override;
|
||||
void resize(const size_t new_capacity) override;
|
||||
|
||||
/**
|
||||
* @brief Reallocates the buffer to the specified new capacity.
|
||||
|
@ -39,21 +39,21 @@ class BufferStream : public std::streambuf
|
||||
protected:
|
||||
#if 0 // not implemented yet
|
||||
// input
|
||||
virtual std::streamsize showmanyc();
|
||||
virtual std::streamsize xsgetn(char* s, std::streamsize n);
|
||||
virtual int underflow();
|
||||
virtual int uflow();
|
||||
virtual int pbackfail(int c = EOF);
|
||||
std::streamsize showmanyc() override;
|
||||
std::streamsize xsgetn(char* s, std::streamsize n) override;
|
||||
int underflow() override;
|
||||
int uflow() override;
|
||||
int pbackfail(int c = EOF) override;
|
||||
#endif
|
||||
|
||||
// output
|
||||
virtual std::streamsize xsputn(const char *s, std::streamsize n)
|
||||
std::streamsize xsputn(const char *s, std::streamsize n) override
|
||||
{
|
||||
buf.write((unsigned char *)s, (size_t)n);
|
||||
return n;
|
||||
}
|
||||
|
||||
virtual int overflow(int c = EOF)
|
||||
int overflow(int c = EOF) override
|
||||
{
|
||||
if (c != EOF)
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ class EmulateExcludeRouteFactoryImpl : public EmulateExcludeRouteFactory
|
||||
}
|
||||
|
||||
private:
|
||||
virtual EmulateExcludeRoute::Ptr new_obj() const
|
||||
EmulateExcludeRoute::Ptr new_obj() const override
|
||||
{
|
||||
return EmulateExcludeRoute::Ptr(new EmulateExcludeRouteImpl(exclude_server_address_));
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ struct UnsupportedFeature : public Base
|
||||
std::string reason;
|
||||
bool critical;
|
||||
|
||||
virtual std::string render() const
|
||||
std::string render() const override
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "name: " << name << ", reason: " << reason << ", critical: " << critical;
|
||||
@ -403,7 +403,7 @@ struct Connected : public Base
|
||||
std::string client_ip;
|
||||
std::string tun_name;
|
||||
|
||||
virtual std::string render() const
|
||||
std::string render() const override
|
||||
{
|
||||
std::ostringstream out;
|
||||
// eg. "godot@foo.bar.gov:443 (1.2.3.4) via TCPv4 on tun0/5.5.1.1"
|
||||
@ -436,7 +436,7 @@ struct ReasonBase : public Base
|
||||
{
|
||||
}
|
||||
|
||||
virtual std::string render() const
|
||||
std::string render() const override
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class PushedOptionsFilter : public OptionList::FilterBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool filter(const Option &opt)
|
||||
bool filter(const Option &opt) override
|
||||
{
|
||||
return filter_(opt) == Accept ? true : false;
|
||||
}
|
||||
|
@ -148,10 +148,10 @@ class UnixCommandAgent : public TunBuilderSetup::Factory
|
||||
}
|
||||
|
||||
private:
|
||||
virtual int establish(const TunBuilderCapture &pull, // defined by TunBuilderSetup::Base
|
||||
TunBuilderSetup::Config *tbs_config,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
int establish(const TunBuilderCapture &pull, // defined by TunBuilderSetup::Base
|
||||
TunBuilderSetup::Config *tbs_config,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
{
|
||||
os << "SetupClient: transmitting tun setup list to " << config->uds_name << std::endl;
|
||||
|
||||
@ -223,7 +223,7 @@ class UnixCommandAgent : public TunBuilderSetup::Factory
|
||||
return tun_fd.release();
|
||||
}
|
||||
|
||||
virtual void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
{
|
||||
os << "SetupClient: transmitting tun destroy request to " << config->uds_name << std::endl;
|
||||
|
||||
@ -293,7 +293,7 @@ class UnixCommandAgent : public TunBuilderSetup::Factory
|
||||
Config::Ptr config;
|
||||
};
|
||||
|
||||
virtual TunBuilderSetup::Base::Ptr new_setup_obj() override
|
||||
TunBuilderSetup::Base::Ptr new_setup_obj() override
|
||||
{
|
||||
if (config)
|
||||
return new SetupClient(config);
|
||||
|
@ -200,11 +200,11 @@ class WinCommandAgent : public TunWin::SetupFactory
|
||||
return tap_;
|
||||
}
|
||||
|
||||
virtual HANDLE establish(const TunBuilderCapture &pull,
|
||||
const std::wstring &openvpn_app_path,
|
||||
Stop *stop,
|
||||
std::ostream &os,
|
||||
TunWin::RingBuffer::Ptr ring_buffer) override // TunWin::SetupBase
|
||||
HANDLE establish(const TunBuilderCapture &pull,
|
||||
const std::wstring &openvpn_app_path,
|
||||
Stop *stop,
|
||||
std::ostream &os,
|
||||
TunWin::RingBuffer::Ptr ring_buffer) override // TunWin::SetupBase
|
||||
{
|
||||
os << "SetupClient: transmitting tun setup list to " << config->npserv << std::endl;
|
||||
|
||||
@ -260,19 +260,19 @@ class WinCommandAgent : public TunWin::SetupFactory
|
||||
return tap;
|
||||
}
|
||||
|
||||
virtual void l2_finish(const TunBuilderCapture &pull,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
void l2_finish(const TunBuilderCapture &pull,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
{
|
||||
throw ovpnagent("l2_finish not implemented");
|
||||
}
|
||||
|
||||
virtual bool l2_ready(const TunBuilderCapture &pull) override
|
||||
bool l2_ready(const TunBuilderCapture &pull) override
|
||||
{
|
||||
throw ovpnagent("l2_ready not implemented");
|
||||
}
|
||||
|
||||
virtual void confirm() override
|
||||
void confirm() override
|
||||
{
|
||||
confirm_event.signal_event();
|
||||
}
|
||||
@ -288,7 +288,7 @@ class WinCommandAgent : public TunWin::SetupFactory
|
||||
}
|
||||
}
|
||||
|
||||
virtual void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
{
|
||||
os << "SetupClient: signaling tun destroy event" << std::endl;
|
||||
service_process.close();
|
||||
@ -350,7 +350,7 @@ class WinCommandAgent : public TunWin::SetupFactory
|
||||
Win::DestroyEvent destroy_event;
|
||||
};
|
||||
|
||||
virtual TunWin::SetupBase::Ptr new_setup_obj(openvpn_io::io_context &io_context, TunWin::Type tun_type, bool allow_local_dns_resolvers) override
|
||||
TunWin::SetupBase::Ptr new_setup_obj(openvpn_io::io_context &io_context, TunWin::Type tun_type, bool allow_local_dns_resolvers) override
|
||||
{
|
||||
if (config)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ class ActionList : public std::vector<Action::Ptr>, public DestructorBase
|
||||
halt_ = true;
|
||||
}
|
||||
|
||||
virtual void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
{
|
||||
if (enable_destroy_)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ class Exception : public std::exception
|
||||
: err_(std::move(err))
|
||||
{
|
||||
}
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return err_.c_str();
|
||||
}
|
||||
@ -82,28 +82,28 @@ class Exception : public std::exception
|
||||
};
|
||||
|
||||
// define a simple custom exception class with no extra info
|
||||
#define OPENVPN_SIMPLE_EXCEPTION(C) \
|
||||
class C : public std::exception \
|
||||
{ \
|
||||
public: \
|
||||
virtual const char *what() const noexcept \
|
||||
{ \
|
||||
return #C OPENVPN_FILE_LINE; \
|
||||
} \
|
||||
#define OPENVPN_SIMPLE_EXCEPTION(C) \
|
||||
class C : public std::exception \
|
||||
{ \
|
||||
public: \
|
||||
const char *what() const noexcept override \
|
||||
{ \
|
||||
return #C OPENVPN_FILE_LINE; \
|
||||
} \
|
||||
}
|
||||
|
||||
// define a simple custom exception class with no extra info that inherits from a custom base
|
||||
#define OPENVPN_SIMPLE_EXCEPTION_INHERIT(B, C) \
|
||||
class C : public B \
|
||||
{ \
|
||||
public: \
|
||||
C() : B(#C OPENVPN_FILE_LINE) \
|
||||
{ \
|
||||
} \
|
||||
virtual const char *what() const noexcept \
|
||||
{ \
|
||||
return #C OPENVPN_FILE_LINE; \
|
||||
} \
|
||||
#define OPENVPN_SIMPLE_EXCEPTION_INHERIT(B, C) \
|
||||
class C : public B \
|
||||
{ \
|
||||
public: \
|
||||
C() : B(#C OPENVPN_FILE_LINE) \
|
||||
{ \
|
||||
} \
|
||||
const char *what() const noexcept override \
|
||||
{ \
|
||||
return #C OPENVPN_FILE_LINE; \
|
||||
} \
|
||||
}
|
||||
|
||||
// define a custom exception class that allows extra info
|
||||
|
@ -1349,7 +1349,7 @@ class RCWeak<RCImpl>::NotifyItem : public NotifyBase
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void call() noexcept override
|
||||
void call() noexcept override
|
||||
{
|
||||
callable();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ struct RedirectBase
|
||||
|
||||
struct RedirectStdFD : public RedirectBase
|
||||
{
|
||||
virtual void redirect() noexcept override
|
||||
void redirect() noexcept override
|
||||
{
|
||||
// stdin
|
||||
if (in.defined())
|
||||
@ -87,7 +87,7 @@ struct RedirectStdFD : public RedirectBase
|
||||
close();
|
||||
}
|
||||
|
||||
virtual void close() override
|
||||
void close() override
|
||||
{
|
||||
in.close();
|
||||
out.close();
|
||||
|
@ -200,13 +200,13 @@ class RunContext : public RunContextBase
|
||||
log_history.reset(new std::vector<RunContextLogEntry>());
|
||||
}
|
||||
|
||||
virtual void disable_log_history() override
|
||||
void disable_log_history() override
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
log_history.reset();
|
||||
}
|
||||
|
||||
virtual std::vector<RunContextLogEntry> add_log_observer(const unsigned int unit) override
|
||||
std::vector<RunContextLogEntry> add_log_observer(const unsigned int unit) override
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
auto lu = std::find(log_observers.begin(), log_observers.end(), unit);
|
||||
@ -276,7 +276,7 @@ class RunContext : public RunContextBase
|
||||
OPENVPN_LOG(thread_name << " thread exception: " << e.what());
|
||||
}
|
||||
|
||||
virtual void log(const std::string &str) override
|
||||
void log(const std::string &str) override
|
||||
{
|
||||
time_t now;
|
||||
const std::string ts = date_time_store_time_t(now);
|
||||
@ -300,7 +300,7 @@ class RunContext : public RunContextBase
|
||||
}
|
||||
|
||||
// called from main or worker thread
|
||||
virtual void cancel() override
|
||||
void cancel() override
|
||||
{
|
||||
if (halt)
|
||||
return;
|
||||
@ -349,7 +349,7 @@ class RunContext : public RunContextBase
|
||||
stats = stats_arg;
|
||||
}
|
||||
|
||||
virtual Stop *async_stop() override
|
||||
Stop *async_stop() override
|
||||
{
|
||||
return async_stop_;
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ class CompressNull : public Compress
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
}
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -49,12 +49,12 @@ class CompressStub : public Compress
|
||||
OVPN_LOG_INFO("Comp-stub init swap=" << support_swap_arg);
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "stub";
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -67,7 +67,7 @@ class CompressStub : public Compress
|
||||
buf.push_front(NO_COMPRESS);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -112,12 +112,12 @@ class CompressStubV2 : public Compress
|
||||
OVPN_LOG_INFO("Comp-stubV2 init");
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "stubv2";
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -127,7 +127,7 @@ class CompressStubV2 : public Compress
|
||||
v2_push(buf, OVPN_COMPv2_NONE);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
|
@ -133,12 +133,12 @@ class CompressLZ4 : public CompressLZ4Base
|
||||
OVPN_LOG_INFO("LZ4 init asym=" << asym_arg);
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "lz4";
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -157,7 +157,7 @@ class CompressLZ4 : public CompressLZ4Base
|
||||
do_swap(buf, NO_COMPRESS_SWAP);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -192,12 +192,12 @@ class CompressLZ4v2 : public CompressLZ4Base
|
||||
OVPN_LOG_INFO("LZ4v2 init asym=" << asym_arg);
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "lz4v2";
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -216,7 +216,7 @@ class CompressLZ4v2 : public CompressLZ4Base
|
||||
v2_push(buf, OVPN_COMPv2_NONE);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
|
@ -60,7 +60,7 @@ class CompressLZO : public Compress
|
||||
throw lzo_init_failed();
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "lzo";
|
||||
}
|
||||
@ -82,7 +82,7 @@ class CompressLZO : public Compress
|
||||
buf.swap(work);
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -132,7 +132,7 @@ class CompressLZO : public Compress
|
||||
buf.push_front(NO_COMPRESS);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
|
@ -55,7 +55,7 @@ class CompressLZOAsym : public Compress
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "lzo-asym";
|
||||
}
|
||||
@ -77,7 +77,7 @@ class CompressLZOAsym : public Compress
|
||||
buf.swap(work);
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -90,7 +90,7 @@ class CompressLZOAsym : public Compress
|
||||
buf.push_front(NO_COMPRESS);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
|
@ -45,12 +45,12 @@ class CompressSnappy : public Compress
|
||||
OVPN_LOG_INFO("SNAPPY init asym=" << asym_arg);
|
||||
}
|
||||
|
||||
virtual const char *name() const
|
||||
const char *name() const override
|
||||
{
|
||||
return "snappy";
|
||||
}
|
||||
|
||||
virtual void compress(BufferAllocated &buf, const bool hint)
|
||||
void compress(BufferAllocated &buf, const bool hint) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
@ -87,7 +87,7 @@ class CompressSnappy : public Compress
|
||||
do_swap(buf, NO_COMPRESS_SWAP);
|
||||
}
|
||||
|
||||
virtual void decompress(BufferAllocated &buf)
|
||||
void decompress(BufferAllocated &buf) override
|
||||
{
|
||||
// skip null packets
|
||||
if (!buf.size())
|
||||
|
@ -157,7 +157,7 @@ class CryptoContextCHM : public CryptoDCContext
|
||||
{
|
||||
}
|
||||
|
||||
virtual CryptoDCInstance::Ptr new_obj(const unsigned int key_id)
|
||||
CryptoDCInstance::Ptr new_obj(const unsigned int key_id) override
|
||||
{
|
||||
/* The check if the data channel cipher is valid is moved here, so encap_overhead
|
||||
* can be called and calculated for the OCC strings even if we do not allow the cipher
|
||||
@ -171,7 +171,7 @@ class CryptoContextCHM : public CryptoDCContext
|
||||
}
|
||||
|
||||
// cipher/HMAC/key info
|
||||
virtual Info crypto_info()
|
||||
Info crypto_info() override
|
||||
{
|
||||
Info ret;
|
||||
ret.cipher_alg = cipher;
|
||||
@ -182,7 +182,7 @@ class CryptoContextCHM : public CryptoDCContext
|
||||
|
||||
// Info for ProtoContext::link_mtu_adjust
|
||||
|
||||
virtual size_t encap_overhead() const
|
||||
size_t encap_overhead() const override
|
||||
{
|
||||
return CryptoAlgs::size(digest) + // HMAC
|
||||
CryptoAlgs::iv_length(cipher) + // Cipher IV
|
||||
|
@ -51,9 +51,9 @@ class CryptoDCSelect : public CryptoDCFactory
|
||||
{
|
||||
}
|
||||
|
||||
virtual CryptoDCContext::Ptr new_obj(const CryptoAlgs::Type cipher,
|
||||
const CryptoAlgs::Type digest,
|
||||
const CryptoAlgs::KeyDerivation method)
|
||||
CryptoDCContext::Ptr new_obj(const CryptoAlgs::Type cipher,
|
||||
const CryptoAlgs::Type digest,
|
||||
const CryptoAlgs::KeyDerivation method) override
|
||||
{
|
||||
const CryptoAlgs::Alg &alg = CryptoAlgs::get(cipher);
|
||||
if (alg.flags() & CryptoAlgs::CBC_HMAC)
|
||||
|
@ -199,30 +199,30 @@ class CryptoOvpnHMACInstance : public OvpnHMACInstance
|
||||
{
|
||||
}
|
||||
|
||||
virtual void init(const StaticKey &key)
|
||||
void init(const StaticKey &key) override
|
||||
{
|
||||
ovpn_hmac.init(digest, key);
|
||||
}
|
||||
|
||||
virtual size_t output_size() const
|
||||
size_t output_size() const override
|
||||
{
|
||||
return ovpn_hmac.output_size();
|
||||
}
|
||||
|
||||
virtual void ovpn_hmac_gen(unsigned char *data,
|
||||
const size_t data_size,
|
||||
const size_t l1,
|
||||
const size_t l2,
|
||||
const size_t l3)
|
||||
void ovpn_hmac_gen(unsigned char *data,
|
||||
const size_t data_size,
|
||||
const size_t l1,
|
||||
const size_t l2,
|
||||
const size_t l3) override
|
||||
{
|
||||
ovpn_hmac.ovpn_hmac_gen(data, data_size, l1, l2, l3);
|
||||
}
|
||||
|
||||
virtual bool ovpn_hmac_cmp(const unsigned char *data,
|
||||
const size_t data_size,
|
||||
const size_t l1,
|
||||
const size_t l2,
|
||||
const size_t l3)
|
||||
bool ovpn_hmac_cmp(const unsigned char *data,
|
||||
const size_t data_size,
|
||||
const size_t l1,
|
||||
const size_t l2,
|
||||
const size_t l3) override
|
||||
{
|
||||
return ovpn_hmac.ovpn_hmac_cmp(data, data_size, l1, l2, l3);
|
||||
}
|
||||
@ -241,12 +241,12 @@ class CryptoOvpnHMACContext : public OvpnHMACContext
|
||||
{
|
||||
}
|
||||
|
||||
virtual size_t size() const
|
||||
size_t size() const override
|
||||
{
|
||||
return CryptoAlgs::size(digest);
|
||||
}
|
||||
|
||||
virtual OvpnHMACInstance::Ptr new_obj()
|
||||
OvpnHMACInstance::Ptr new_obj() override
|
||||
{
|
||||
return new CryptoOvpnHMACInstance<CRYPTO_API>(digest);
|
||||
}
|
||||
@ -259,7 +259,7 @@ template <typename CRYPTO_API>
|
||||
class CryptoOvpnHMACFactory : public OvpnHMACFactory
|
||||
{
|
||||
public:
|
||||
virtual OvpnHMACContext::Ptr new_obj(const CryptoAlgs::Type digest_type)
|
||||
OvpnHMACContext::Ptr new_obj(const CryptoAlgs::Type digest_type) override
|
||||
{
|
||||
return new CryptoOvpnHMACContext<CRYPTO_API>(digest_type);
|
||||
}
|
||||
|
@ -270,22 +270,22 @@ class CryptoTLSCryptContext : public TLSCryptContext
|
||||
{
|
||||
}
|
||||
|
||||
virtual size_t digest_size() const
|
||||
size_t digest_size() const override
|
||||
{
|
||||
return CryptoAlgs::size(digest);
|
||||
}
|
||||
|
||||
virtual size_t cipher_key_size() const
|
||||
size_t cipher_key_size() const override
|
||||
{
|
||||
return CryptoAlgs::key_length(cipher);
|
||||
}
|
||||
|
||||
virtual TLSCryptInstance::Ptr new_obj_send()
|
||||
TLSCryptInstance::Ptr new_obj_send() override
|
||||
{
|
||||
return new CryptoTLSCryptInstance<CRYPTO_API>(libctx, digest, cipher, CRYPTO_API::CipherContext::ENCRYPT);
|
||||
}
|
||||
|
||||
virtual TLSCryptInstance::Ptr new_obj_recv()
|
||||
TLSCryptInstance::Ptr new_obj_recv() override
|
||||
{
|
||||
return new CryptoTLSCryptInstance<CRYPTO_API>(libctx, digest, cipher, CRYPTO_API::CipherContext::DECRYPT);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class ClientConfig : public DCO,
|
||||
transport.remote_list->process_push(opt);
|
||||
}
|
||||
|
||||
virtual void finalize(const bool disconnected) override
|
||||
void finalize(const bool disconnected) override
|
||||
{
|
||||
#if defined(ENABLE_OVPNDCOWIN)
|
||||
if (disconnected)
|
||||
@ -97,8 +97,7 @@ class ClientConfig : public DCO,
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual TunClientFactory::Ptr
|
||||
new_tun_factory(const DCO::TunConfig &conf, const OptionList &opt) override
|
||||
TunClientFactory::Ptr new_tun_factory(const DCO::TunConfig &conf, const OptionList &opt) override
|
||||
{
|
||||
tun = conf;
|
||||
|
||||
@ -122,20 +121,18 @@ class ClientConfig : public DCO,
|
||||
return TunClientFactory::Ptr(this);
|
||||
}
|
||||
|
||||
virtual TransportClientFactory::Ptr
|
||||
new_transport_factory(const DCO::TransportConfig &conf) override
|
||||
TransportClientFactory::Ptr new_transport_factory(const DCO::TransportConfig &conf) override
|
||||
{
|
||||
transport = conf;
|
||||
return TransportClientFactory::Ptr(this);
|
||||
}
|
||||
|
||||
virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
|
||||
virtual TransportClient::Ptr
|
||||
new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent) override;
|
||||
TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent) override;
|
||||
|
||||
static DCO::Ptr new_controller(TunBuilderBase *tb)
|
||||
{
|
||||
@ -160,33 +157,33 @@ class Client : public TransportClient,
|
||||
public:
|
||||
// transport methods
|
||||
|
||||
virtual bool transport_send_queue_empty() override
|
||||
bool transport_send_queue_empty() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool transport_has_send_queue() override
|
||||
bool transport_has_send_queue() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual size_t transport_send_queue_size() override
|
||||
size_t transport_send_queue_size() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void reset_align_adjust(const size_t align_adjust) override
|
||||
void reset_align_adjust(const size_t align_adjust) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_stop_requeueing() override
|
||||
void transport_stop_requeueing() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void server_endpoint_info(std::string &host,
|
||||
std::string &port,
|
||||
std::string &proto,
|
||||
std::string &ip_addr) const override
|
||||
void server_endpoint_info(std::string &host,
|
||||
std::string &port,
|
||||
std::string &proto,
|
||||
std::string &ip_addr) const override
|
||||
{
|
||||
host = server_host;
|
||||
port = server_port;
|
||||
@ -196,24 +193,23 @@ class Client : public TransportClient,
|
||||
ip_addr = addr.to_string();
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
stop_();
|
||||
}
|
||||
|
||||
// tun methods
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool
|
||||
tun_send(BufferAllocated &buf) override // return true if send succeeded
|
||||
bool tun_send(BufferAllocated &buf) override // return true if send succeeded
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
if (state->vpn_ip4_addr.specified())
|
||||
return state->vpn_ip4_addr.to_string();
|
||||
@ -221,7 +217,7 @@ class Client : public TransportClient,
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
if (state->vpn_ip6_addr.specified())
|
||||
return state->vpn_ip6_addr.to_string();
|
||||
@ -229,7 +225,7 @@ class Client : public TransportClient,
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw4() const override
|
||||
std::string vpn_gw4() const override
|
||||
{
|
||||
if (state->vpn_ip4_gw.specified())
|
||||
return state->vpn_ip4_gw.to_string();
|
||||
@ -237,7 +233,7 @@ class Client : public TransportClient,
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw6() const override
|
||||
std::string vpn_gw6() const override
|
||||
{
|
||||
if (state->vpn_ip6_gw.specified())
|
||||
return state->vpn_ip6_gw.to_string();
|
||||
@ -261,7 +257,7 @@ class Client : public TransportClient,
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_reparent(TransportClientParent *parent_arg) override
|
||||
void transport_reparent(TransportClientParent *parent_arg) override
|
||||
{
|
||||
transport_parent = parent_arg;
|
||||
}
|
||||
|
@ -56,41 +56,41 @@ class Instance : public CryptoDCInstance
|
||||
|
||||
// Initialization
|
||||
|
||||
virtual unsigned int defined() const override
|
||||
unsigned int defined() const override
|
||||
{
|
||||
return CIPHER_DEFINED | HMAC_DEFINED | EXPLICIT_EXIT_NOTIFY_DEFINED;
|
||||
}
|
||||
|
||||
virtual void init_cipher(StaticKey &&encrypt_key,
|
||||
StaticKey &&decrypt_key) override
|
||||
void init_cipher(StaticKey &&encrypt_key,
|
||||
StaticKey &&decrypt_key) override
|
||||
{
|
||||
info.encrypt_cipher = std::move(encrypt_key);
|
||||
info.decrypt_cipher = std::move(decrypt_key);
|
||||
}
|
||||
|
||||
virtual void init_hmac(StaticKey &&encrypt_key,
|
||||
StaticKey &&decrypt_key) override
|
||||
void init_hmac(StaticKey &&encrypt_key,
|
||||
StaticKey &&decrypt_key) override
|
||||
{
|
||||
info.encrypt_hmac = std::move(encrypt_key);
|
||||
info.decrypt_hmac = std::move(decrypt_key);
|
||||
}
|
||||
|
||||
virtual void init_pid(const int send_form,
|
||||
const int recv_mode,
|
||||
const int recv_form,
|
||||
const char *recv_name,
|
||||
const int recv_unit,
|
||||
const SessionStats::Ptr &recv_stats_arg) override
|
||||
void init_pid(const int send_form,
|
||||
const int recv_mode,
|
||||
const int recv_form,
|
||||
const char *recv_name,
|
||||
const int recv_unit,
|
||||
const SessionStats::Ptr &recv_stats_arg) override
|
||||
{
|
||||
info.tcp_linear = (recv_mode == PacketIDReceive::TCP_MODE);
|
||||
}
|
||||
|
||||
virtual void init_remote_peer_id(const int remote_peer_id) override
|
||||
void init_remote_peer_id(const int remote_peer_id) override
|
||||
{
|
||||
info.remote_peer_id = remote_peer_id;
|
||||
}
|
||||
|
||||
virtual bool consider_compression(const CompressContext &comp_ctx) override
|
||||
bool consider_compression(const CompressContext &comp_ctx) override
|
||||
{
|
||||
info.comp_ctx = comp_ctx;
|
||||
return false;
|
||||
@ -98,12 +98,12 @@ class Instance : public CryptoDCInstance
|
||||
|
||||
// Rekeying
|
||||
|
||||
virtual void rekey(const RekeyType type) override
|
||||
void rekey(const RekeyType type) override
|
||||
{
|
||||
rcv->rekey(type, info);
|
||||
}
|
||||
|
||||
virtual void explicit_exit_notify() override
|
||||
void explicit_exit_notify() override
|
||||
{
|
||||
rcv->explicit_exit_notify();
|
||||
}
|
||||
@ -112,12 +112,12 @@ class Instance : public CryptoDCInstance
|
||||
// should never be reached.
|
||||
|
||||
// returns true if packet ID is close to wrapping
|
||||
virtual bool encrypt(BufferAllocated &buf, const PacketID::time_t now, const unsigned char *op32) override
|
||||
bool encrypt(BufferAllocated &buf, const PacketID::time_t now, const unsigned char *op32) override
|
||||
{
|
||||
throw korekey_error("encrypt");
|
||||
}
|
||||
|
||||
virtual Error::Type decrypt(BufferAllocated &buf, const PacketID::time_t now, const unsigned char *op32) override
|
||||
Error::Type decrypt(BufferAllocated &buf, const PacketID::time_t now, const unsigned char *op32) override
|
||||
{
|
||||
throw korekey_error("decrypt");
|
||||
}
|
||||
@ -144,21 +144,21 @@ class Context : public CryptoDCContext
|
||||
Key::validate(cipher, digest);
|
||||
}
|
||||
|
||||
virtual CryptoDCInstance::Ptr new_obj(const unsigned int key_id) override
|
||||
CryptoDCInstance::Ptr new_obj(const unsigned int key_id) override
|
||||
{
|
||||
return new Instance(rcv, dc_context_delegate, key_id, frame);
|
||||
}
|
||||
|
||||
// Info for ProtoContext::options_string
|
||||
|
||||
virtual Info crypto_info() override
|
||||
Info crypto_info() override
|
||||
{
|
||||
return dc_context_delegate->crypto_info();
|
||||
}
|
||||
|
||||
// Info for ProtoContext::link_mtu_adjust
|
||||
|
||||
virtual size_t encap_overhead() const override
|
||||
size_t encap_overhead() const override
|
||||
{
|
||||
return dc_context_delegate->encap_overhead();
|
||||
}
|
||||
@ -181,9 +181,9 @@ class Factory : public CryptoDCFactory
|
||||
{
|
||||
}
|
||||
|
||||
virtual CryptoDCContext::Ptr new_obj(const CryptoAlgs::Type cipher,
|
||||
const CryptoAlgs::Type digest,
|
||||
const CryptoAlgs::KeyDerivation key_method) override
|
||||
CryptoDCContext::Ptr new_obj(const CryptoAlgs::Type cipher,
|
||||
const CryptoAlgs::Type digest,
|
||||
const CryptoAlgs::KeyDerivation key_method) override
|
||||
{
|
||||
return new Context(cipher, digest, key_method, *dc_factory_delegate, rcv, frame);
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ class OvpnDcoClient : public Client,
|
||||
return GeNLImpl::available();
|
||||
}
|
||||
|
||||
virtual void tun_start(const OptionList &opt,
|
||||
TransportClient &transcli,
|
||||
CryptoDCSettings &dc_settings) override
|
||||
void tun_start(const OptionList &opt,
|
||||
TransportClient &transcli,
|
||||
CryptoDCSettings &dc_settings) override
|
||||
{
|
||||
// extract peer ID from pushed options
|
||||
try
|
||||
@ -143,12 +143,12 @@ class OvpnDcoClient : public Client,
|
||||
tun_parent->tun_connected();
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
return "ovpn-dco";
|
||||
}
|
||||
|
||||
virtual IP::Addr server_endpoint_addr() const override
|
||||
IP::Addr server_endpoint_addr() const override
|
||||
{
|
||||
if (transport)
|
||||
return transport->server_endpoint_addr();
|
||||
@ -156,7 +156,7 @@ class OvpnDcoClient : public Client,
|
||||
return IP::Addr();
|
||||
}
|
||||
|
||||
virtual unsigned short server_endpoint_port() const override
|
||||
unsigned short server_endpoint_port() const override
|
||||
{
|
||||
if (transport)
|
||||
return transport->server_endpoint_port();
|
||||
@ -164,12 +164,12 @@ class OvpnDcoClient : public Client,
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual Protocol transport_protocol() const override
|
||||
Protocol transport_protocol() const override
|
||||
{
|
||||
return transport->transport_protocol();
|
||||
}
|
||||
|
||||
virtual void transport_start() override
|
||||
void transport_start() override
|
||||
{
|
||||
TransportClientFactory::Ptr transport_factory;
|
||||
|
||||
@ -199,12 +199,12 @@ class OvpnDcoClient : public Client,
|
||||
transport->transport_start();
|
||||
}
|
||||
|
||||
virtual bool transport_send_const(const Buffer &buf) override
|
||||
bool transport_send_const(const Buffer &buf) override
|
||||
{
|
||||
return transport->transport_send_const(buf);
|
||||
}
|
||||
|
||||
virtual bool transport_send(BufferAllocated &buf) override
|
||||
bool transport_send(BufferAllocated &buf) override
|
||||
{
|
||||
OPENVPN_THROW(dcocli_error,
|
||||
"Non-const send expected for data channel only, but "
|
||||
@ -291,12 +291,12 @@ class OvpnDcoClient : public Client,
|
||||
last_delta = last_stats - old_stats;
|
||||
}
|
||||
|
||||
virtual void resolve_callback(const openvpn_io::error_code &error,
|
||||
results_type results) override
|
||||
void resolve_callback(const openvpn_io::error_code &error,
|
||||
results_type results) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void stop_() override
|
||||
void stop_() override
|
||||
{
|
||||
if (!halt)
|
||||
{
|
||||
@ -329,8 +329,8 @@ class OvpnDcoClient : public Client,
|
||||
}
|
||||
}
|
||||
|
||||
virtual void rekey(const CryptoDCInstance::RekeyType rktype,
|
||||
const KoRekey::Info &rkinfo) override
|
||||
void rekey(const CryptoDCInstance::RekeyType rktype,
|
||||
const KoRekey::Info &rkinfo) override
|
||||
{
|
||||
if (halt)
|
||||
return;
|
||||
@ -420,7 +420,7 @@ class OvpnDcoClient : public Client,
|
||||
}
|
||||
}
|
||||
|
||||
virtual void transport_recv(BufferAllocated &buf) override
|
||||
void transport_recv(BufferAllocated &buf) override
|
||||
{
|
||||
transport_parent->transport_recv(buf);
|
||||
}
|
||||
@ -512,55 +512,55 @@ class OvpnDcoClient : public Client,
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void transport_needs_send() override
|
||||
void transport_needs_send() override
|
||||
{
|
||||
transport_parent->transport_needs_send();
|
||||
}
|
||||
|
||||
virtual void transport_error(const Error::Type fatal_err,
|
||||
const std::string &err_text) override
|
||||
void transport_error(const Error::Type fatal_err,
|
||||
const std::string &err_text) override
|
||||
{
|
||||
transport_parent->transport_error(fatal_err, err_text);
|
||||
}
|
||||
|
||||
virtual void proxy_error(const Error::Type fatal_err,
|
||||
const std::string &err_text) override
|
||||
void proxy_error(const Error::Type fatal_err,
|
||||
const std::string &err_text) override
|
||||
{
|
||||
transport_parent->proxy_error(fatal_err, err_text);
|
||||
}
|
||||
|
||||
virtual bool transport_is_openvpn_protocol() override
|
||||
bool transport_is_openvpn_protocol() override
|
||||
{
|
||||
return transport_parent->transport_is_openvpn_protocol();
|
||||
}
|
||||
|
||||
virtual void transport_pre_resolve() override
|
||||
void transport_pre_resolve() override
|
||||
{
|
||||
transport_parent->transport_pre_resolve();
|
||||
}
|
||||
|
||||
virtual void transport_wait_proxy() override
|
||||
void transport_wait_proxy() override
|
||||
{
|
||||
transport_parent->transport_wait_proxy();
|
||||
}
|
||||
|
||||
virtual void transport_wait() override
|
||||
void transport_wait() override
|
||||
{
|
||||
transport_parent->transport_wait();
|
||||
}
|
||||
|
||||
virtual void transport_connecting() override
|
||||
void transport_connecting() override
|
||||
{
|
||||
transport_parent->transport_connecting();
|
||||
}
|
||||
|
||||
virtual bool is_keepalive_enabled() const override
|
||||
bool is_keepalive_enabled() const override
|
||||
{
|
||||
return transport_parent->is_keepalive_enabled();
|
||||
}
|
||||
|
||||
virtual void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout) override
|
||||
void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout) override
|
||||
{
|
||||
transport_parent->disable_keepalive(keepalive_ping, keepalive_timeout);
|
||||
}
|
||||
@ -669,7 +669,7 @@ class OvpnDcoClient : public Client,
|
||||
});
|
||||
}
|
||||
|
||||
virtual SessionStats::DCOTransportSource::Data dco_transport_stats_delta() override
|
||||
SessionStats::DCOTransportSource::Data dco_transport_stats_delta() override
|
||||
{
|
||||
if (halt)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ class ErrorCode : public ExceptionCode
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return err_.c_str();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class WebException : public std::exception
|
||||
return error_;
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return formatted.c_str();
|
||||
}
|
||||
|
@ -219,85 +219,85 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
{
|
||||
}
|
||||
|
||||
virtual SSLFactoryAPI::Ptr new_factory()
|
||||
SSLFactoryAPI::Ptr new_factory() override
|
||||
{
|
||||
return SSLFactoryAPI::Ptr(new MbedTLSContext(this));
|
||||
}
|
||||
|
||||
virtual void set_mode(const Mode &mode_arg)
|
||||
void set_mode(const Mode &mode_arg) override
|
||||
{
|
||||
mode = mode_arg;
|
||||
}
|
||||
|
||||
virtual const Mode &get_mode() const
|
||||
const Mode &get_mode() const override
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
// if this callback is defined, no private key needs to be loaded
|
||||
virtual void set_external_pki_callback(ExternalPKIBase *external_pki_arg, const std::string &alias)
|
||||
void set_external_pki_callback(ExternalPKIBase *external_pki_arg, const std::string &alias) override
|
||||
{
|
||||
external_pki = external_pki_arg;
|
||||
external_pki_alias = alias;
|
||||
}
|
||||
|
||||
virtual void set_session_ticket_handler(TLSSessionTicketBase *session_ticket_handler_arg)
|
||||
void set_session_ticket_handler(TLSSessionTicketBase *session_ticket_handler_arg) override
|
||||
{
|
||||
// fixme -- this method should be implemented for server-side TLS session resumption tickets
|
||||
throw MbedTLSException("set_session_ticket_handler not implemented");
|
||||
}
|
||||
|
||||
virtual void set_client_session_tickets(const bool v)
|
||||
void set_client_session_tickets(const bool v) override
|
||||
{
|
||||
// fixme -- this method should be implemented for client-side TLS session resumption tickets
|
||||
throw MbedTLSException("set_client_session_tickets not implemented");
|
||||
}
|
||||
|
||||
virtual void enable_legacy_algorithms(const bool v)
|
||||
void enable_legacy_algorithms(const bool v) override
|
||||
{
|
||||
// We ignore the request to enable legacy as we do not have a runtime
|
||||
// configuration for this
|
||||
}
|
||||
|
||||
virtual void set_sni_handler(SNI::HandlerBase *sni_handler)
|
||||
void set_sni_handler(SNI::HandlerBase *sni_handler) override
|
||||
{
|
||||
// fixme -- this method should be implemented on the server-side for SNI
|
||||
throw MbedTLSException("set_sni_handler not implemented");
|
||||
}
|
||||
|
||||
virtual void set_sni_name(const std::string &sni_name_arg)
|
||||
void set_sni_name(const std::string &sni_name_arg) override
|
||||
{
|
||||
// fixme -- this method should be implemented on the client-side for SNI
|
||||
throw MbedTLSException("set_sni_name not implemented");
|
||||
}
|
||||
|
||||
virtual void set_private_key_password(const std::string &pwd)
|
||||
void set_private_key_password(const std::string &pwd) override
|
||||
{
|
||||
priv_key_pwd = pwd;
|
||||
}
|
||||
|
||||
virtual void load_ca(const std::string &ca_txt, bool strict)
|
||||
void load_ca(const std::string &ca_txt, bool strict) override
|
||||
{
|
||||
MbedTLSPKI::X509Cert::Ptr c = new MbedTLSPKI::X509Cert();
|
||||
c->parse(ca_txt, "ca", strict);
|
||||
ca_chain = c;
|
||||
}
|
||||
|
||||
virtual void load_crl(const std::string &crl_txt)
|
||||
void load_crl(const std::string &crl_txt) override
|
||||
{
|
||||
MbedTLSPKI::X509CRL::Ptr c = new MbedTLSPKI::X509CRL();
|
||||
c->parse(crl_txt);
|
||||
crl_chain = c;
|
||||
}
|
||||
|
||||
virtual void load_cert(const std::string &cert_txt)
|
||||
void load_cert(const std::string &cert_txt) override
|
||||
{
|
||||
MbedTLSPKI::X509Cert::Ptr c = new MbedTLSPKI::X509Cert();
|
||||
c->parse(cert_txt, "cert", true);
|
||||
crt_chain = c;
|
||||
}
|
||||
|
||||
virtual void load_cert(const std::string &cert_txt, const std::string &extra_certs_txt)
|
||||
void load_cert(const std::string &cert_txt, const std::string &extra_certs_txt) override
|
||||
{
|
||||
MbedTLSPKI::X509Cert::Ptr c = new MbedTLSPKI::X509Cert();
|
||||
c->parse(cert_txt, "cert", true);
|
||||
@ -306,7 +306,7 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
crt_chain = c;
|
||||
}
|
||||
|
||||
virtual void load_private_key(const std::string &key_txt)
|
||||
void load_private_key(const std::string &key_txt) override
|
||||
{
|
||||
MbedTLSPKI::PKContext::Ptr p = new MbedTLSPKI::PKContext();
|
||||
auto *mbedrng = get_mbed_random_class();
|
||||
@ -314,114 +314,114 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
priv_key = p;
|
||||
}
|
||||
|
||||
virtual void load_dh(const std::string &dh_txt)
|
||||
void load_dh(const std::string &dh_txt) override
|
||||
{
|
||||
MbedTLSPKI::DH::Ptr mydh = new MbedTLSPKI::DH();
|
||||
mydh->parse(dh_txt, "server-config");
|
||||
dh = mydh;
|
||||
}
|
||||
|
||||
virtual std::string extract_ca() const
|
||||
std::string extract_ca() const override
|
||||
{
|
||||
if (!ca_chain)
|
||||
return std::string();
|
||||
return ca_chain->extract();
|
||||
}
|
||||
|
||||
virtual std::string extract_crl() const
|
||||
std::string extract_crl() const override
|
||||
{
|
||||
if (!crl_chain)
|
||||
return std::string();
|
||||
return crl_chain->extract();
|
||||
}
|
||||
|
||||
virtual std::string extract_cert() const
|
||||
std::string extract_cert() const override
|
||||
{
|
||||
if (!crt_chain)
|
||||
return std::string();
|
||||
return crt_chain->extract();
|
||||
}
|
||||
|
||||
virtual std::vector<std::string> extract_extra_certs() const
|
||||
std::vector<std::string> extract_extra_certs() const override
|
||||
{
|
||||
if (!crt_chain)
|
||||
return std::vector<std::string>();
|
||||
return crt_chain->extract_extra_certs();
|
||||
}
|
||||
|
||||
virtual std::string extract_private_key() const
|
||||
std::string extract_private_key() const override
|
||||
{
|
||||
if (!priv_key)
|
||||
return std::string();
|
||||
return priv_key->extract();
|
||||
}
|
||||
|
||||
virtual std::string extract_dh() const
|
||||
std::string extract_dh() const override
|
||||
{
|
||||
if (!dh)
|
||||
return std::string();
|
||||
return dh->extract();
|
||||
}
|
||||
|
||||
virtual PKType::Type private_key_type() const
|
||||
PKType::Type private_key_type() const override
|
||||
{
|
||||
if (!priv_key)
|
||||
return PKType::PK_NONE;
|
||||
return priv_key->key_type();
|
||||
}
|
||||
|
||||
virtual size_t private_key_length() const
|
||||
size_t private_key_length() const override
|
||||
{
|
||||
if (!priv_key)
|
||||
return 0;
|
||||
return priv_key->key_length();
|
||||
}
|
||||
|
||||
virtual void set_frame(const Frame::Ptr &frame_arg)
|
||||
void set_frame(const Frame::Ptr &frame_arg) override
|
||||
{
|
||||
frame = frame_arg;
|
||||
}
|
||||
|
||||
virtual void set_debug_level(const int debug_level)
|
||||
void set_debug_level(const int debug_level) override
|
||||
{
|
||||
ssl_debug_level = debug_level;
|
||||
}
|
||||
|
||||
virtual void set_flags(const unsigned int flags_arg)
|
||||
void set_flags(const unsigned int flags_arg) override
|
||||
{
|
||||
flags = flags_arg;
|
||||
}
|
||||
|
||||
virtual void set_ns_cert_type(const NSCert::Type ns_cert_type_arg)
|
||||
void set_ns_cert_type(const NSCert::Type ns_cert_type_arg) override
|
||||
{
|
||||
ns_cert_type = ns_cert_type_arg;
|
||||
}
|
||||
|
||||
virtual void set_remote_cert_tls(const KUParse::TLSWebType wt)
|
||||
void set_remote_cert_tls(const KUParse::TLSWebType wt) override
|
||||
{
|
||||
KUParse::remote_cert_tls(wt, ku, eku);
|
||||
}
|
||||
|
||||
virtual void set_tls_remote(const std::string &tls_remote_arg)
|
||||
void set_tls_remote(const std::string &tls_remote_arg) override
|
||||
{
|
||||
tls_remote = tls_remote_arg;
|
||||
}
|
||||
|
||||
virtual void set_tls_version_min(const TLSVersion::Type tvm)
|
||||
void set_tls_version_min(const TLSVersion::Type tvm) override
|
||||
{
|
||||
tls_version_min = tvm;
|
||||
}
|
||||
|
||||
virtual void set_tls_version_max(const TLSVersion::Type tvm)
|
||||
void set_tls_version_max(const TLSVersion::Type tvm) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void set_tls_version_min_override(const std::string &override)
|
||||
void set_tls_version_min_override(const std::string &override) override
|
||||
{
|
||||
TLSVersion::apply_override(tls_version_min, override);
|
||||
}
|
||||
|
||||
virtual void set_tls_cert_profile(const TLSCertProfile::Type type)
|
||||
void set_tls_cert_profile(const TLSCertProfile::Type type) override
|
||||
{
|
||||
tls_cert_profile = type;
|
||||
}
|
||||
@ -443,58 +443,58 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
tls_groups = groups;
|
||||
}
|
||||
|
||||
virtual void set_tls_cert_profile_override(const std::string &override)
|
||||
void set_tls_cert_profile_override(const std::string &override) override
|
||||
{
|
||||
TLSCertProfile::apply_override(tls_cert_profile, override);
|
||||
}
|
||||
|
||||
virtual void set_local_cert_enabled(const bool v)
|
||||
void set_local_cert_enabled(const bool v) override
|
||||
{
|
||||
local_cert_enabled = v;
|
||||
}
|
||||
|
||||
virtual void set_x509_track(X509Track::ConfigSet x509_track_config_arg)
|
||||
void set_x509_track(X509Track::ConfigSet x509_track_config_arg) override
|
||||
{
|
||||
x509_track_config = std::move(x509_track_config_arg);
|
||||
}
|
||||
|
||||
virtual void set_rng(const StrongRandomAPI::Ptr &rng_arg)
|
||||
void set_rng(const StrongRandomAPI::Ptr &rng_arg) override
|
||||
{
|
||||
rng = rng_arg;
|
||||
}
|
||||
|
||||
virtual std::string validate_cert(const std::string &cert_txt) const
|
||||
std::string validate_cert(const std::string &cert_txt) const override
|
||||
{
|
||||
MbedTLSPKI::X509Cert::Ptr cert = new MbedTLSPKI::X509Cert(cert_txt, "validation cert", true);
|
||||
return cert_txt; // fixme -- implement parse/re-render semantics
|
||||
}
|
||||
|
||||
virtual std::string validate_cert_list(const std::string &certs_txt) const
|
||||
std::string validate_cert_list(const std::string &certs_txt) const override
|
||||
{
|
||||
MbedTLSPKI::X509Cert::Ptr cert = new MbedTLSPKI::X509Cert(certs_txt, "validation cert list", true);
|
||||
return certs_txt; // fixme -- implement parse/re-render semantics
|
||||
}
|
||||
|
||||
virtual std::string validate_private_key(const std::string &key_txt) const
|
||||
std::string validate_private_key(const std::string &key_txt) const override
|
||||
{
|
||||
auto *mbedrng = get_mbed_random_class();
|
||||
MbedTLSPKI::PKContext::Ptr pkey = new MbedTLSPKI::PKContext(key_txt, "validation", "", *mbedrng);
|
||||
return key_txt; // fixme -- implement parse/re-render semantics
|
||||
}
|
||||
|
||||
virtual std::string validate_dh(const std::string &dh_txt) const
|
||||
std::string validate_dh(const std::string &dh_txt) const override
|
||||
{
|
||||
MbedTLSPKI::DH::Ptr dh = new MbedTLSPKI::DH(dh_txt, "validation");
|
||||
return dh_txt; // fixme -- implement parse/re-render semantics
|
||||
}
|
||||
|
||||
virtual std::string validate_crl(const std::string &crl_txt) const
|
||||
std::string validate_crl(const std::string &crl_txt) const override
|
||||
{
|
||||
MbedTLSPKI::X509CRL::Ptr crl = new MbedTLSPKI::X509CRL(crl_txt);
|
||||
return crl_txt; // fixme -- implement parse/re-render semantics
|
||||
}
|
||||
|
||||
virtual void load(const OptionList &opt, const unsigned int lflags)
|
||||
void load(const OptionList &opt, const unsigned int lflags) override
|
||||
{
|
||||
// client/server
|
||||
if (lflags & LF_PARSE_MODE)
|
||||
@ -599,7 +599,7 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
}
|
||||
|
||||
#ifdef OPENVPN_JSON_INTERNAL
|
||||
virtual SSLConfigAPI::Ptr json_override(const Json::Value &root, const bool load_cert_key) const
|
||||
SSLConfigAPI::Ptr json_override(const Json::Value &root, const bool load_cert_key) const override
|
||||
{
|
||||
throw MbedTLSException("json_override not implemented");
|
||||
}
|
||||
@ -692,12 +692,12 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
public:
|
||||
typedef RCPtr<SSL> Ptr;
|
||||
|
||||
virtual void start_handshake() override
|
||||
void start_handshake() override
|
||||
{
|
||||
mbedtls_ssl_handshake(ssl);
|
||||
}
|
||||
|
||||
virtual ssize_t write_cleartext_unbuffered(const void *data, const size_t size) override
|
||||
ssize_t write_cleartext_unbuffered(const void *data, const size_t size) override
|
||||
{
|
||||
const int status = mbedtls_ssl_write(ssl, (const unsigned char *)data, size);
|
||||
if (status < 0)
|
||||
@ -713,7 +713,7 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
return status;
|
||||
}
|
||||
|
||||
virtual ssize_t read_cleartext(void *data, const size_t capacity) override
|
||||
ssize_t read_cleartext(void *data, const size_t capacity) override
|
||||
{
|
||||
if (!overflow)
|
||||
{
|
||||
@ -736,12 +736,12 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
throw ssl_ciphertext_in_overflow();
|
||||
}
|
||||
|
||||
virtual bool read_cleartext_ready() const override
|
||||
bool read_cleartext_ready() const override
|
||||
{
|
||||
return !ct_in.empty() || mbedtls_ssl_get_bytes_avail(ssl);
|
||||
}
|
||||
|
||||
virtual void write_ciphertext(const BufferPtr &buf) override
|
||||
void write_ciphertext(const BufferPtr &buf) override
|
||||
{
|
||||
if (ct_in.size() < MAX_CIPHERTEXT_IN)
|
||||
ct_in.write_buf(buf);
|
||||
@ -749,7 +749,7 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
overflow = true;
|
||||
}
|
||||
|
||||
virtual void write_ciphertext_unbuffered(const unsigned char *data, const size_t size) override
|
||||
void write_ciphertext_unbuffered(const unsigned char *data, const size_t size) override
|
||||
{
|
||||
if (ct_in.size() < MAX_CIPHERTEXT_IN)
|
||||
ct_in.write(data, size);
|
||||
@ -757,17 +757,17 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
overflow = true;
|
||||
}
|
||||
|
||||
virtual bool read_ciphertext_ready() const override
|
||||
bool read_ciphertext_ready() const override
|
||||
{
|
||||
return !ct_out.empty();
|
||||
}
|
||||
|
||||
virtual BufferPtr read_ciphertext() override
|
||||
BufferPtr read_ciphertext() override
|
||||
{
|
||||
return ct_out.read_buf();
|
||||
}
|
||||
|
||||
virtual std::string ssl_handshake_details() const override
|
||||
std::string ssl_handshake_details() const override
|
||||
{
|
||||
if (ssl)
|
||||
{
|
||||
@ -779,22 +779,22 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual bool export_keying_material(const std::string &label, unsigned char *, size_t size) override
|
||||
bool export_keying_material(const std::string &label, unsigned char *, size_t size) override
|
||||
{
|
||||
return false; // not implemented in our mbed TLS implementation
|
||||
}
|
||||
|
||||
virtual bool did_full_handshake() override
|
||||
bool did_full_handshake() override
|
||||
{
|
||||
return false; // fixme -- not implemented
|
||||
}
|
||||
|
||||
virtual const AuthCert::Ptr &auth_cert() const override
|
||||
const AuthCert::Ptr &auth_cert() const override
|
||||
{
|
||||
return authcert;
|
||||
}
|
||||
|
||||
virtual void mark_no_cache() override
|
||||
void mark_no_cache() override
|
||||
{
|
||||
// fixme -- this method should be implemented for client-side TLS session resumption tickets
|
||||
}
|
||||
@ -1194,7 +1194,7 @@ class MbedTLSContext : public SSLFactoryAPI
|
||||
/////// start of main class implementation
|
||||
|
||||
// create a new SSL instance
|
||||
virtual SSLAPI::Ptr ssl() override
|
||||
SSLAPI::Ptr ssl() override
|
||||
{
|
||||
return SSL::Ptr(new SSL(this, nullptr));
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class MbedTLSException : public ExceptionCode
|
||||
}
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return errtxt.c_str();
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class MbedTLSRandom : public StrongRandomAPI
|
||||
}
|
||||
|
||||
// Random algorithm name
|
||||
virtual std::string name() const
|
||||
std::string name() const override
|
||||
{
|
||||
const std::string n = "mbedTLS-CTR_DRBG";
|
||||
if (entropy)
|
||||
@ -79,7 +79,7 @@ class MbedTLSRandom : public StrongRandomAPI
|
||||
}
|
||||
|
||||
// Fill buffer with random bytes
|
||||
virtual void rand_bytes(unsigned char *buf, size_t size)
|
||||
void rand_bytes(unsigned char *buf, size_t size) override
|
||||
{
|
||||
const int errnum = rndbytes(buf, size);
|
||||
if (errnum < 0)
|
||||
@ -88,7 +88,7 @@ class MbedTLSRandom : public StrongRandomAPI
|
||||
|
||||
// Like rand_bytes, but don't throw exception.
|
||||
// Return true on successs, false on fail.
|
||||
virtual bool rand_bytes_noexcept(unsigned char *buf, size_t size)
|
||||
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
|
||||
{
|
||||
return rndbytes(buf, size) >= 0;
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ class OMICore : public Acceptor::ListenerBase
|
||||
}
|
||||
|
||||
// despite its name, this method handles both accept and connect events
|
||||
virtual void handle_accept(AsioPolySock::Base::Ptr sock, const openvpn_io::error_code &error) override
|
||||
void handle_accept(AsioPolySock::Base::Ptr sock, const openvpn_io::error_code &error) override
|
||||
{
|
||||
if (stop_called)
|
||||
return;
|
||||
|
@ -74,16 +74,16 @@ class Client : public ClientAPI::OpenVPNClient
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool pause_on_connection_timeout() override
|
||||
bool pause_on_connection_timeout() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void event(const ClientAPI::Event &ev) override;
|
||||
virtual void log(const ClientAPI::LogInfo &msg) override;
|
||||
virtual void external_pki_cert_request(ClientAPI::ExternalPKICertRequest &certreq) override;
|
||||
virtual void external_pki_sign_request(ClientAPI::ExternalPKISignRequest &signreq) override;
|
||||
virtual void acc_event(const openvpn::ClientAPI::AppCustomControlMessageEvent &event) override;
|
||||
void event(const ClientAPI::Event &ev) override;
|
||||
void log(const ClientAPI::LogInfo &msg) override;
|
||||
void external_pki_cert_request(ClientAPI::ExternalPKICertRequest &certreq) override;
|
||||
void external_pki_sign_request(ClientAPI::ExternalPKISignRequest &signreq) override;
|
||||
void acc_event(const openvpn::ClientAPI::AppCustomControlMessageEvent &event) override;
|
||||
|
||||
OMI *parent;
|
||||
};
|
||||
@ -147,7 +147,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
OMICore::start(opt);
|
||||
}
|
||||
|
||||
virtual void log(const ClientAPI::LogInfo &msg) override
|
||||
void log(const ClientAPI::LogInfo &msg) override
|
||||
{
|
||||
openvpn_io::post(io_context, [this, msg]()
|
||||
{ log_msg(msg); });
|
||||
@ -257,7 +257,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool omi_command_is_multiline(const std::string &arg0, const Option &o) override
|
||||
bool omi_command_is_multiline(const std::string &arg0, const Option &o) override
|
||||
{
|
||||
if (arg0 == "rsa-sig")
|
||||
return true;
|
||||
@ -265,7 +265,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
}
|
||||
|
||||
private:
|
||||
virtual bool omi_command_in(const std::string &arg0, const Command &cmd) override
|
||||
bool omi_command_in(const std::string &arg0, const Command &cmd) override
|
||||
{
|
||||
switch (arg0.at(0))
|
||||
{
|
||||
@ -306,7 +306,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void omi_done(const bool eof) override
|
||||
void omi_done(const bool eof) override
|
||||
{
|
||||
// OPENVPN_LOG("OMI DONE eof=" << eof);
|
||||
}
|
||||
@ -332,7 +332,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual void omi_start_connection() override
|
||||
void omi_start_connection() override
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -655,7 +655,7 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool omi_stop() override
|
||||
bool omi_stop() override
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
@ -716,19 +716,19 @@ class OMI : public OMICore, public ClientAPI::LogReceiver
|
||||
} });
|
||||
}
|
||||
|
||||
virtual void omi_sigterm() override
|
||||
void omi_sigterm() override
|
||||
{
|
||||
if (client)
|
||||
set_final_error(gen_state_msg(true, "EXITING", "exit-with-notification"));
|
||||
stop();
|
||||
}
|
||||
|
||||
virtual bool omi_is_sighup_implemented() override
|
||||
bool omi_is_sighup_implemented() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void omi_sighup() override
|
||||
void omi_sighup() override
|
||||
{
|
||||
if (client)
|
||||
client->reconnect(1);
|
||||
|
@ -795,7 +795,7 @@ class OpenSSLContext : public SSLFactoryAPI
|
||||
return ssl_handshake_details(ssl);
|
||||
}
|
||||
|
||||
virtual bool export_keying_material(const std::string &label, unsigned char *dest, size_t size) override
|
||||
bool export_keying_material(const std::string &label, unsigned char *dest, size_t size) override
|
||||
{
|
||||
return SSL_get_session(ssl) && SSL_export_keying_material(ssl, dest, size, label.c_str(), label.size(), nullptr, 0, 0) == 1;
|
||||
}
|
||||
@ -805,7 +805,7 @@ class OpenSSLContext : public SSLFactoryAPI
|
||||
@return true if we did a full SSL handshake/negotiation or if the handshake attempt failed with an exception.
|
||||
@return false for cached, reused, or persisted sessions or if previously called on this session.
|
||||
*/
|
||||
virtual bool did_full_handshake() override
|
||||
bool did_full_handshake() override
|
||||
{
|
||||
if (called_did_full_handshake)
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ class OpenSSLException : public ExceptionCode
|
||||
init_ssl_error(ssl_error, error_text.c_str());
|
||||
}
|
||||
|
||||
virtual const char *what() const noexcept
|
||||
const char *what() const noexcept override
|
||||
{
|
||||
return errtxt.c_str();
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ class OpenSSLRandom : public StrongRandomAPI
|
||||
|
||||
OpenSSLRandom() = default;
|
||||
|
||||
virtual std::string name() const
|
||||
std::string name() const override
|
||||
{
|
||||
return "OpenSSLRandom";
|
||||
}
|
||||
|
||||
// Fill buffer with random bytes
|
||||
virtual void rand_bytes(unsigned char *buf, size_t size)
|
||||
void rand_bytes(unsigned char *buf, size_t size) override
|
||||
{
|
||||
if (!rndbytes(buf, size))
|
||||
throw rand_error_openssl("rand_bytes");
|
||||
@ -55,7 +55,7 @@ class OpenSSLRandom : public StrongRandomAPI
|
||||
|
||||
// Like rand_bytes, but don't throw exception.
|
||||
// Return true on successs, false on fail.
|
||||
virtual bool rand_bytes_noexcept(unsigned char *buf, size_t size)
|
||||
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
|
||||
{
|
||||
return rndbytes(buf, size);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class MySessionStats : public SessionStats
|
||||
public:
|
||||
typedef RCPtr<MySessionStats> Ptr;
|
||||
|
||||
virtual void error(const size_t err_type, const std::string *text = nullptr) override
|
||||
void error(const size_t err_type, const std::string *text = nullptr) override
|
||||
{
|
||||
OPENVPN_LOG(Error::name(err_type));
|
||||
}
|
||||
@ -323,7 +323,7 @@ class MyListener : public WS::Server::Listener
|
||||
}
|
||||
|
||||
private:
|
||||
virtual bool allow_client(AsioPolySock::Base &sock) override
|
||||
bool allow_client(AsioPolySock::Base &sock) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -364,7 +364,7 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
generate_reply_headers(ci);
|
||||
}
|
||||
|
||||
virtual void http_request_received() override
|
||||
void http_request_received() override
|
||||
{
|
||||
// alloc output buffer
|
||||
std::ostringstream os;
|
||||
@ -460,13 +460,13 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
}
|
||||
}
|
||||
|
||||
virtual void http_content_in(BufferAllocated &buf) override
|
||||
void http_content_in(BufferAllocated &buf) override
|
||||
{
|
||||
if (buf.defined())
|
||||
in.emplace_back(new BufferAllocated(std::move(buf)));
|
||||
}
|
||||
|
||||
virtual BufferPtr http_content_out() override
|
||||
BufferPtr http_content_out() override
|
||||
{
|
||||
BufferPtr ret;
|
||||
ret.swap(out);
|
||||
@ -475,7 +475,7 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
|
||||
// Normally true is returned, however return false if we
|
||||
// are planning to send the tun file descriptor to the client.
|
||||
virtual bool http_out_eof() override
|
||||
bool http_out_eof() override
|
||||
{
|
||||
// OPENVPN_LOG("HTTP output EOF send_fd=" << send_fd());
|
||||
return !send_fd.defined();
|
||||
@ -484,7 +484,7 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
// After HTTP reply has been transmitted, wait for client to
|
||||
// send a 't' message. On receipt, reply with a 'T' message
|
||||
// that bundles the tun file descriptor.
|
||||
virtual void http_pipeline_peek(BufferAllocated &buf) override
|
||||
void http_pipeline_peek(BufferAllocated &buf) override
|
||||
{
|
||||
// OPENVPN_LOG("HTTP PIPELINE PEEK send_fd=" << send_fd() << " CONTENT=" << buf_to_string(buf));
|
||||
if (send_fd.defined())
|
||||
@ -502,7 +502,7 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool http_stop(const int status, const std::string &description) override
|
||||
bool http_stop(const int status, const std::string &description) override
|
||||
{
|
||||
OPENVPN_LOG("INSTANCE STOP : " << WS::Server::Status::error_str(status) << " : " << description);
|
||||
|
||||
@ -538,7 +538,7 @@ class MyClientFactory : public WS::Server::Listener::Client::Factory
|
||||
public:
|
||||
typedef RCPtr<MyClientFactory> Ptr;
|
||||
|
||||
virtual WS::Server::Listener::Client::Ptr new_client(WS::Server::Listener::Client::Initializer &ci) override
|
||||
WS::Server::Listener::Client::Ptr new_client(WS::Server::Listener::Client::Initializer &ci) override
|
||||
{
|
||||
return new MyClientInstance(ci);
|
||||
}
|
||||
@ -584,7 +584,7 @@ class ServerThread : public ServerThreadBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual void thread_safe_stop() override
|
||||
void thread_safe_stop() override
|
||||
{
|
||||
if (!halt)
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ class MySessionStats : public SessionStats
|
||||
public:
|
||||
typedef RCPtr<MySessionStats> Ptr;
|
||||
|
||||
virtual void error(const size_t err_type, const std::string *text = nullptr) override
|
||||
void error(const size_t err_type, const std::string *text = nullptr) override
|
||||
{
|
||||
OPENVPN_LOG(openvpn::Error::name(err_type));
|
||||
}
|
||||
@ -511,7 +511,7 @@ class MyListener : public WS::Server::Listener
|
||||
TunWin::RingBuffer::Ptr ring_buffer;
|
||||
|
||||
private:
|
||||
virtual bool allow_client(AsioPolySock::Base &sock) override
|
||||
bool allow_client(AsioPolySock::Base &sock) override
|
||||
{
|
||||
AsioPolySock::NamedPipe *np = dynamic_cast<AsioPolySock::NamedPipe *>(&sock);
|
||||
if (np)
|
||||
@ -570,7 +570,7 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
generate_reply_headers(ci);
|
||||
}
|
||||
|
||||
virtual void http_request_received() override
|
||||
void http_request_received() override
|
||||
{
|
||||
// alloc output buffer
|
||||
std::ostringstream os;
|
||||
@ -813,26 +813,26 @@ class MyClientInstance : public WS::Server::Listener::Client
|
||||
}
|
||||
}
|
||||
|
||||
virtual void http_content_in(BufferAllocated &buf) override
|
||||
void http_content_in(BufferAllocated &buf) override
|
||||
{
|
||||
if (buf.defined())
|
||||
in.emplace_back(new BufferAllocated(std::move(buf)));
|
||||
}
|
||||
|
||||
virtual BufferPtr http_content_out() override
|
||||
BufferPtr http_content_out() override
|
||||
{
|
||||
BufferPtr ret;
|
||||
ret.swap(out);
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual bool http_out_eof() override
|
||||
bool http_out_eof() override
|
||||
{
|
||||
// OPENVPN_LOG("HTTP output EOF");
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool http_stop(const int status, const std::string &description) override
|
||||
bool http_stop(const int status, const std::string &description) override
|
||||
{
|
||||
if (status != WS::Server::Status::E_SUCCESS)
|
||||
{
|
||||
@ -890,7 +890,7 @@ class MyClientFactory : public WS::Server::Listener::Client::Factory
|
||||
public:
|
||||
typedef RCPtr<MyClientFactory> Ptr;
|
||||
|
||||
virtual WS::Server::Listener::Client::Ptr new_client(WS::Server::Listener::Client::Initializer &ci) override
|
||||
WS::Server::Listener::Client::Ptr new_client(WS::Server::Listener::Client::Initializer &ci) override
|
||||
{
|
||||
return new MyClientInstance(ci);
|
||||
}
|
||||
@ -904,7 +904,7 @@ class MyService : public Win::Service
|
||||
{
|
||||
}
|
||||
|
||||
virtual void service_work(DWORD argc, LPWSTR *argv) override
|
||||
void service_work(DWORD argc, LPWSTR *argv) override
|
||||
{
|
||||
if (is_service())
|
||||
{
|
||||
@ -968,7 +968,7 @@ class MyService : public Win::Service
|
||||
|
||||
// Called by service control manager in another thread
|
||||
// to signal the service_work() method to exit.
|
||||
virtual void service_stop() override
|
||||
void service_stop() override
|
||||
{
|
||||
openvpn_io::post(*io_context, [this]()
|
||||
{
|
||||
|
@ -48,13 +48,13 @@ class DevURand : public StrongRandomAPI
|
||||
}
|
||||
|
||||
// Random algorithm name
|
||||
virtual std::string name() const
|
||||
std::string name() const override
|
||||
{
|
||||
return "DevURand";
|
||||
}
|
||||
|
||||
// Fill buffer with random bytes
|
||||
virtual void rand_bytes(unsigned char *buf, size_t size)
|
||||
void rand_bytes(unsigned char *buf, size_t size) override
|
||||
{
|
||||
if (!rndbytes(buf, size))
|
||||
throw dev_urand_error("rand_bytes failed");
|
||||
@ -62,7 +62,7 @@ class DevURand : public StrongRandomAPI
|
||||
|
||||
// Like rand_bytes, but don't throw exception.
|
||||
// Return true on successs, false on fail.
|
||||
virtual bool rand_bytes_noexcept(unsigned char *buf, size_t size)
|
||||
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
|
||||
{
|
||||
return rndbytes(buf, size);
|
||||
}
|
||||
|
@ -56,13 +56,13 @@ class MTRand : public WeakRandomAPI
|
||||
}
|
||||
|
||||
// Random algorithm name
|
||||
virtual std::string name() const
|
||||
std::string name() const override
|
||||
{
|
||||
return "MTRand";
|
||||
}
|
||||
|
||||
// Fill buffer with random bytes
|
||||
virtual void rand_bytes(unsigned char *buf, size_t size)
|
||||
void rand_bytes(unsigned char *buf, size_t size) override
|
||||
{
|
||||
if (!rndbytes(buf, size))
|
||||
throw mtrand_error("rand_bytes failed");
|
||||
@ -70,7 +70,7 @@ class MTRand : public WeakRandomAPI
|
||||
|
||||
// Like rand_bytes, but don't throw exception.
|
||||
// Return true on successs, false on fail.
|
||||
virtual bool rand_bytes_noexcept(unsigned char *buf, size_t size)
|
||||
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
|
||||
{
|
||||
return rndbytes(buf, size);
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ class ServerProto
|
||||
preval.reset(new ProtoContext::TLSAuthPreValidate(c, true));
|
||||
}
|
||||
|
||||
virtual TransportClientInstance::Recv::Ptr new_client_instance() override;
|
||||
TransportClientInstance::Recv::Ptr new_client_instance() override;
|
||||
|
||||
virtual bool validate_initial_packet(const BufferAllocated &net_buf) override
|
||||
bool validate_initial_packet(const BufferAllocated &net_buf) override
|
||||
{
|
||||
if (preval)
|
||||
{
|
||||
@ -119,21 +119,21 @@ class ServerProto
|
||||
public:
|
||||
typedef RCPtr<Session> Ptr;
|
||||
|
||||
virtual bool defined() const override
|
||||
bool defined() const override
|
||||
{
|
||||
return defined_();
|
||||
}
|
||||
|
||||
virtual TunClientInstance::Recv *override_tun(TunClientInstance::Send *tun) override
|
||||
TunClientInstance::Recv *override_tun(TunClientInstance::Send *tun) override
|
||||
{
|
||||
TunLink::send.reset(tun);
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual void start(const TransportClientInstance::Send::Ptr &parent,
|
||||
const PeerAddr::Ptr &addr,
|
||||
const int local_peer_id,
|
||||
const ProtoSessionID cookie_psid = ProtoSessionID()) override
|
||||
void start(const TransportClientInstance::Send::Ptr &parent,
|
||||
const PeerAddr::Ptr &addr,
|
||||
const int local_peer_id,
|
||||
const ProtoSessionID cookie_psid = ProtoSessionID()) override
|
||||
{
|
||||
TransportLink::send = parent;
|
||||
peer_addr = addr;
|
||||
@ -149,7 +149,7 @@ class ServerProto
|
||||
housekeeping_schedule.init(Time::Duration::binary_ms(512), Time::Duration::binary_ms(1024));
|
||||
}
|
||||
|
||||
virtual PeerStats stats_poll() override
|
||||
PeerStats stats_poll() override
|
||||
{
|
||||
if (TransportLink::send)
|
||||
return TransportLink::send->stats_poll();
|
||||
@ -157,12 +157,12 @@ class ServerProto
|
||||
return PeerStats();
|
||||
}
|
||||
|
||||
virtual bool should_preserve_session_id() override
|
||||
bool should_preserve_session_id() override
|
||||
{
|
||||
return preserve_session_id;
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
if (!halt)
|
||||
{
|
||||
@ -200,7 +200,7 @@ class ServerProto
|
||||
}
|
||||
|
||||
// called with OpenVPN-encapsulated packets from transport layer
|
||||
virtual bool transport_recv(BufferAllocated &buf) override
|
||||
bool transport_recv(BufferAllocated &buf) override
|
||||
{
|
||||
bool ret = false;
|
||||
if (!proto_context.primary_defined())
|
||||
@ -258,13 +258,13 @@ class ServerProto
|
||||
}
|
||||
|
||||
// called with cleartext IP packets from routing layer
|
||||
virtual void tun_recv(BufferAllocated &buf) override
|
||||
void tun_recv(BufferAllocated &buf) override
|
||||
{
|
||||
// fixme -- code me
|
||||
}
|
||||
|
||||
// Return true if keepalive parameter(s) are enabled.
|
||||
virtual bool is_keepalive_enabled() const override
|
||||
bool is_keepalive_enabled() const override
|
||||
{
|
||||
return proto_context.is_keepalive_enabled();
|
||||
}
|
||||
@ -272,8 +272,8 @@ class ServerProto
|
||||
// Disable keepalive for rest of session, but fetch
|
||||
// the keepalive parameters (in seconds).
|
||||
// Also, allow the management layer to override parameters.
|
||||
virtual void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout) override
|
||||
void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout) override
|
||||
{
|
||||
proto_context.disable_keepalive(keepalive_ping, keepalive_timeout);
|
||||
if (ManLink::send)
|
||||
@ -281,7 +281,7 @@ class ServerProto
|
||||
}
|
||||
|
||||
// override the data channel factory
|
||||
virtual void override_dc_factory(const CryptoDCFactory::Ptr &dc_factory) override
|
||||
void override_dc_factory(const CryptoDCFactory::Ptr &dc_factory) override
|
||||
{
|
||||
proto_context.dc_settings().set_factory(dc_factory);
|
||||
}
|
||||
@ -313,7 +313,7 @@ class ServerProto
|
||||
}
|
||||
|
||||
// proto base class calls here for control channel network sends
|
||||
virtual void control_net_send(const Buffer &net_buf) override
|
||||
void control_net_send(const Buffer &net_buf) override
|
||||
{
|
||||
OPENVPN_LOG_SERVPROTO(instance_name() << " : Transport SEND[" << net_buf.size() << "] " << client_endpoint_render() << ' ' << proto_context.dump_packet(net_buf));
|
||||
if (TransportLink::send)
|
||||
@ -325,10 +325,10 @@ class ServerProto
|
||||
|
||||
// Called on server with credentials and peer info provided by client.
|
||||
// Should be overriden by derived class if credentials are required.
|
||||
virtual void server_auth(const std::string &username,
|
||||
const SafeString &password,
|
||||
const std::string &peer_info,
|
||||
const AuthCert::Ptr &auth_cert) override
|
||||
void server_auth(const std::string &username,
|
||||
const SafeString &password,
|
||||
const std::string &peer_info,
|
||||
const AuthCert::Ptr &auth_cert) override
|
||||
{
|
||||
constexpr size_t MAX_USERNAME_SIZE = 256;
|
||||
constexpr size_t MAX_PASSWORD_SIZE = 16384;
|
||||
@ -343,7 +343,7 @@ class ServerProto
|
||||
}
|
||||
|
||||
// proto base class calls here for app-level control-channel messages received
|
||||
virtual void control_recv(BufferPtr &&app_bp) override
|
||||
void control_recv(BufferPtr &&app_bp) override
|
||||
{
|
||||
const std::string msg = ProtoContext::template read_control_string<std::string>(*app_bp);
|
||||
if (!Unicode::is_valid_utf8(msg, Unicode::UTF8_NO_CTRL))
|
||||
@ -380,13 +380,13 @@ class ServerProto
|
||||
* IV_PROTO_REQUEST_PUSH instead waiting for an explicit PUSH_REQUEST */
|
||||
}
|
||||
|
||||
virtual void auth_failed(const std::string &reason,
|
||||
const std::string &client_reason) override
|
||||
void auth_failed(const std::string &reason,
|
||||
const std::string &client_reason) override
|
||||
{
|
||||
push_halt_restart_msg(HaltRestart::AUTH_FAILED, reason, client_reason);
|
||||
}
|
||||
|
||||
virtual void relay(const IP::Addr &target, const int port) override
|
||||
void relay(const IP::Addr &target, const int port) override
|
||||
{
|
||||
if (halt || disconnect_type == DT_HALT_RESTART)
|
||||
return;
|
||||
@ -412,7 +412,7 @@ class ServerProto
|
||||
set_housekeeping_timer();
|
||||
}
|
||||
|
||||
virtual void push_reply(std::vector<BufferPtr> &&push_msgs) override
|
||||
void push_reply(std::vector<BufferPtr> &&push_msgs) override
|
||||
{
|
||||
if (halt || (disconnect_type >= DT_RELAY_TRANSITION) || !proto_context.primary_defined())
|
||||
return;
|
||||
@ -442,7 +442,7 @@ class ServerProto
|
||||
}
|
||||
}
|
||||
|
||||
virtual TunClientInstance::NativeHandle tun_native_handle() override
|
||||
TunClientInstance::NativeHandle tun_native_handle() override
|
||||
{
|
||||
if (get_tun())
|
||||
return TunLink::send->tun_native_handle();
|
||||
@ -450,9 +450,9 @@ class ServerProto
|
||||
return TunClientInstance::NativeHandle();
|
||||
}
|
||||
|
||||
virtual void push_halt_restart_msg(const HaltRestart::Type type,
|
||||
const std::string &reason,
|
||||
const std::string &client_reason) override
|
||||
void push_halt_restart_msg(const HaltRestart::Type type,
|
||||
const std::string &reason,
|
||||
const std::string &client_reason) override
|
||||
{
|
||||
if (halt || disconnect_type == DT_HALT_RESTART)
|
||||
return;
|
||||
@ -542,7 +542,7 @@ class ServerProto
|
||||
set_housekeeping_timer();
|
||||
}
|
||||
|
||||
virtual void schedule_disconnect(const unsigned int seconds) override
|
||||
void schedule_disconnect(const unsigned int seconds) override
|
||||
{
|
||||
if (halt || disconnect_type == DT_HALT_RESTART)
|
||||
return;
|
||||
@ -551,7 +551,7 @@ class ServerProto
|
||||
set_housekeeping_timer();
|
||||
}
|
||||
|
||||
virtual void schedule_auth_pending_timeout(const unsigned int seconds) override
|
||||
void schedule_auth_pending_timeout(const unsigned int seconds) override
|
||||
{
|
||||
if (halt || (disconnect_type >= DT_RELAY_TRANSITION) || !seconds)
|
||||
return;
|
||||
@ -561,7 +561,7 @@ class ServerProto
|
||||
set_housekeeping_timer();
|
||||
}
|
||||
|
||||
virtual void post_cc_msg(BufferPtr &&msg) override
|
||||
void post_cc_msg(BufferPtr &&msg) override
|
||||
{
|
||||
if (halt || !proto_context.primary_defined())
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ class PsidCookieImpl : public PsidCookie
|
||||
|
||||
virtual ~PsidCookieImpl() = default;
|
||||
|
||||
virtual Intercept intercept(ConstBuffer &pkt_buf, const PsidCookieAddrInfoBase &pcaib) override
|
||||
Intercept intercept(ConstBuffer &pkt_buf, const PsidCookieAddrInfoBase &pcaib) override
|
||||
{
|
||||
// tls auth enabled is the only config we handle
|
||||
if (not_tls_auth_mode_)
|
||||
@ -123,14 +123,14 @@ class PsidCookieImpl : public PsidCookie
|
||||
return Intercept::EARLY_DROP; // bad op field
|
||||
}
|
||||
|
||||
virtual ProtoSessionID get_cookie_psid() override
|
||||
ProtoSessionID get_cookie_psid() override
|
||||
{
|
||||
ProtoSessionID ret_val = cookie_psid_;
|
||||
cookie_psid_.reset();
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
virtual void provide_psid_cookie_transport(PsidCookieTransportBase::Ptr pctb) override
|
||||
void provide_psid_cookie_transport(PsidCookieTransportBase::Ptr pctb) override
|
||||
{
|
||||
pctb_ = std::move(pctb);
|
||||
}
|
||||
|
@ -274,35 +274,35 @@ class CryptoTLSPRFInstance : public TLSPRFInstance
|
||||
{
|
||||
}
|
||||
|
||||
virtual void self_randomize(StrongRandomAPI &rng)
|
||||
void self_randomize(StrongRandomAPI &rng) override
|
||||
{
|
||||
self.randomize(rng);
|
||||
}
|
||||
|
||||
virtual void self_write(Buffer &buf)
|
||||
void self_write(Buffer &buf) override
|
||||
{
|
||||
self.write(buf);
|
||||
}
|
||||
|
||||
virtual void peer_read(Buffer &buf)
|
||||
void peer_read(Buffer &buf) override
|
||||
{
|
||||
peer.read(buf);
|
||||
}
|
||||
|
||||
virtual bool peer_read_complete(BufferComplete &bc)
|
||||
bool peer_read_complete(BufferComplete &bc) override
|
||||
{
|
||||
return peer.read_complete(bc);
|
||||
}
|
||||
|
||||
virtual void erase()
|
||||
void erase() override
|
||||
{
|
||||
self.erase();
|
||||
peer.erase();
|
||||
}
|
||||
|
||||
virtual void generate_key_expansion(OpenVPNStaticKey &dest,
|
||||
const ProtoSessionID &psid_self,
|
||||
const ProtoSessionID &psid_peer) const
|
||||
void generate_key_expansion(OpenVPNStaticKey &dest,
|
||||
const ProtoSessionID &psid_self,
|
||||
const ProtoSessionID &psid_peer) const override
|
||||
{
|
||||
self.generate_key_expansion(dest, peer, psid_self, psid_peer);
|
||||
}
|
||||
@ -316,7 +316,7 @@ template <typename CRYPTO_API>
|
||||
class CryptoTLSPRFFactory : public TLSPRFFactory
|
||||
{
|
||||
public:
|
||||
virtual TLSPRFInstance::Ptr new_obj(const bool self_is_server)
|
||||
TLSPRFInstance::Ptr new_obj(const bool self_is_server) override
|
||||
{
|
||||
return new CryptoTLSPRFInstance<CRYPTO_API>(self_is_server);
|
||||
}
|
||||
|
@ -231,8 +231,8 @@ class ClientConfig : public TransportClientFactory
|
||||
return new ClientConfig;
|
||||
}
|
||||
|
||||
virtual TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent);
|
||||
TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent) override;
|
||||
|
||||
private:
|
||||
ClientConfig()
|
||||
@ -370,12 +370,12 @@ class Client : public TransportClient, AsyncResolvableTCP
|
||||
{
|
||||
}
|
||||
|
||||
virtual void bytes_exceeded()
|
||||
void bytes_exceeded() override
|
||||
{
|
||||
OPENVPN_THROW_EXCEPTION("HTTP proxy response too large (> " << max_bytes << " bytes)");
|
||||
}
|
||||
|
||||
virtual void lines_exceeded()
|
||||
void lines_exceeded() override
|
||||
{
|
||||
OPENVPN_THROW_EXCEPTION("HTTP proxy response too large (> " << max_lines << " lines)");
|
||||
}
|
||||
|
@ -57,53 +57,53 @@ class TransportRelayFactory : public TransportClientFactory
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void transport_start() override
|
||||
void transport_start() override
|
||||
{
|
||||
}
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
}
|
||||
virtual bool transport_send_const(const Buffer &buf) override
|
||||
bool transport_send_const(const Buffer &buf) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool transport_send(BufferAllocated &buf) override
|
||||
bool transport_send(BufferAllocated &buf) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool transport_send_queue_empty() override
|
||||
bool transport_send_queue_empty() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool transport_has_send_queue() override
|
||||
bool transport_has_send_queue() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual size_t transport_send_queue_size() override
|
||||
size_t transport_send_queue_size() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void transport_stop_requeueing() override
|
||||
void transport_stop_requeueing() override
|
||||
{
|
||||
}
|
||||
virtual void reset_align_adjust(const size_t align_adjust) override
|
||||
void reset_align_adjust(const size_t align_adjust) override
|
||||
{
|
||||
}
|
||||
virtual void transport_reparent(TransportClientParent *parent) override
|
||||
void transport_reparent(TransportClientParent *parent) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual IP::Addr server_endpoint_addr() const override
|
||||
IP::Addr server_endpoint_addr() const override
|
||||
{
|
||||
return endpoint_;
|
||||
}
|
||||
|
||||
virtual Protocol transport_protocol() const override
|
||||
Protocol transport_protocol() const override
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
virtual void server_endpoint_info(std::string &host, std::string &port, std::string &proto, std::string &ip_addr) const override
|
||||
void server_endpoint_info(std::string &host, std::string &port, std::string &proto, std::string &ip_addr) const override
|
||||
{
|
||||
host = host_;
|
||||
port = port_;
|
||||
@ -129,52 +129,52 @@ class TransportRelayFactory : public TransportClientFactory
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void transport_recv(BufferAllocated &buf)
|
||||
void transport_recv(BufferAllocated &buf) override
|
||||
{
|
||||
}
|
||||
virtual void transport_needs_send()
|
||||
void transport_needs_send() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_error(const Error::Type fatal_err, const std::string &err_text)
|
||||
void transport_error(const Error::Type fatal_err, const std::string &err_text) override
|
||||
{
|
||||
OPENVPN_LOG("TransportRelayFactory: Transport Error in null parent: " << Error::name(fatal_err) << " : " << err_text);
|
||||
}
|
||||
|
||||
virtual void proxy_error(const Error::Type fatal_err, const std::string &err_text)
|
||||
void proxy_error(const Error::Type fatal_err, const std::string &err_text) override
|
||||
{
|
||||
OPENVPN_LOG("TransportRelayFactory: Proxy Error in null parent: " << Error::name(fatal_err) << " : " << err_text);
|
||||
}
|
||||
|
||||
// Return true if we are transporting OpenVPN protocol
|
||||
virtual bool transport_is_openvpn_protocol()
|
||||
bool transport_is_openvpn_protocol() override
|
||||
{
|
||||
return is_openvpn_protocol;
|
||||
}
|
||||
|
||||
// progress notifications
|
||||
virtual void transport_pre_resolve()
|
||||
void transport_pre_resolve() override
|
||||
{
|
||||
}
|
||||
virtual void transport_wait_proxy()
|
||||
void transport_wait_proxy() override
|
||||
{
|
||||
}
|
||||
virtual void transport_wait()
|
||||
void transport_wait() override
|
||||
{
|
||||
}
|
||||
virtual void transport_connecting()
|
||||
void transport_connecting() override
|
||||
{
|
||||
}
|
||||
|
||||
// Return true if keepalive parameter(s) are enabled.
|
||||
virtual bool is_keepalive_enabled() const
|
||||
bool is_keepalive_enabled() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Disable keepalive for rest of session, but fetch
|
||||
// the keepalive parameters (in seconds).
|
||||
virtual void disable_keepalive(unsigned int &keepalive_ping, unsigned int &keepalive_timeout)
|
||||
void disable_keepalive(unsigned int &keepalive_ping, unsigned int &keepalive_timeout) override
|
||||
{
|
||||
keepalive_ping = 0;
|
||||
keepalive_timeout = 0;
|
||||
@ -183,8 +183,8 @@ class TransportRelayFactory : public TransportClientFactory
|
||||
bool is_openvpn_protocol;
|
||||
};
|
||||
|
||||
virtual TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent) override
|
||||
TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context,
|
||||
TransportClientParent *parent) override
|
||||
{
|
||||
// io_context MUST stay consistent
|
||||
if (&io_context != &io_context_)
|
||||
@ -194,7 +194,7 @@ class TransportRelayFactory : public TransportClientFactory
|
||||
return transport_;
|
||||
}
|
||||
|
||||
virtual bool is_relay() override
|
||||
bool is_relay() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ struct DelayedQueue : public RC<thread_unsafe_refcount>
|
||||
{
|
||||
}
|
||||
|
||||
virtual void call()
|
||||
void call() override
|
||||
{
|
||||
func();
|
||||
}
|
||||
|
||||
virtual const Time &fire_time()
|
||||
const Time &fire_time() override
|
||||
{
|
||||
return fire;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class Client : public TunClient
|
||||
typedef Tun<Client *> TunImpl;
|
||||
|
||||
public:
|
||||
virtual void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
{
|
||||
if (!impl)
|
||||
{
|
||||
@ -210,12 +210,12 @@ class Client : public TunClient
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool tun_send(BufferAllocated &buf) override
|
||||
bool tun_send(BufferAllocated &buf) override
|
||||
{
|
||||
return send(buf);
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
if (impl)
|
||||
return impl->name();
|
||||
@ -223,7 +223,7 @@ class Client : public TunClient
|
||||
return "UNDEF_TUN";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
if (state->vpn_ip4_addr.specified())
|
||||
return state->vpn_ip4_addr.to_string();
|
||||
@ -231,7 +231,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
if (state->vpn_ip6_addr.specified())
|
||||
return state->vpn_ip6_addr.to_string();
|
||||
@ -239,7 +239,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw4() const override
|
||||
std::string vpn_gw4() const override
|
||||
{
|
||||
if (state->vpn_ip4_gw.specified())
|
||||
return state->vpn_ip4_gw.to_string();
|
||||
@ -247,7 +247,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw6() const override
|
||||
std::string vpn_gw6() const override
|
||||
{
|
||||
if (state->vpn_ip6_gw.specified())
|
||||
return state->vpn_ip6_gw.to_string();
|
||||
@ -260,13 +260,13 @@ class Client : public TunClient
|
||||
return state->mtu;
|
||||
}
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
if (tun_persist)
|
||||
tun_persist->set_disconnect();
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
stop_();
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ class ClientConfig : public TunClientFactory
|
||||
return new ClientConfig;
|
||||
}
|
||||
|
||||
virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli);
|
||||
TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
|
||||
private:
|
||||
ClientConfig()
|
||||
@ -56,7 +56,7 @@ class Client : public TunClient
|
||||
friend class ClientConfig; // calls constructor
|
||||
|
||||
public:
|
||||
virtual void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
{
|
||||
#ifdef TUN_NULL_EXIT
|
||||
throw ErrorCode(Error::TUN_SETUP_FAILED, true, "TUN_NULL_EXIT");
|
||||
@ -66,24 +66,24 @@ class Client : public TunClient
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual bool tun_send(BufferAllocated &buf) override
|
||||
bool tun_send(BufferAllocated &buf) override
|
||||
{
|
||||
config->stats->inc_stat(SessionStats::TUN_BYTES_OUT, buf.size());
|
||||
config->stats->inc_stat(SessionStats::TUN_PACKETS_OUT, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
return "TUN_NULL";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@ -93,11 +93,11 @@ class Client : public TunClient
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,9 @@ class ClientConfig : public TunClientFactory
|
||||
return new ClientConfig;
|
||||
}
|
||||
|
||||
virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli);
|
||||
TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
|
||||
TunBuilderSetup::Base::Ptr new_setup_obj()
|
||||
{
|
||||
@ -135,7 +135,7 @@ class Client : public TunClient
|
||||
typedef Tun<Client *> TunImpl;
|
||||
|
||||
public:
|
||||
virtual void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
{
|
||||
if (!impl)
|
||||
{
|
||||
@ -245,12 +245,12 @@ class Client : public TunClient
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool tun_send(BufferAllocated &buf) override
|
||||
bool tun_send(BufferAllocated &buf) override
|
||||
{
|
||||
return send(buf);
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
if (impl)
|
||||
return impl->name();
|
||||
@ -258,7 +258,7 @@ class Client : public TunClient
|
||||
return "UNDEF_TUN";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
if (state->vpn_ip4_addr.specified())
|
||||
return state->vpn_ip4_addr.to_string();
|
||||
@ -266,7 +266,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
if (state->vpn_ip6_addr.specified())
|
||||
return state->vpn_ip6_addr.to_string();
|
||||
@ -274,7 +274,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw4() const override
|
||||
std::string vpn_gw4() const override
|
||||
{
|
||||
if (state->vpn_ip4_gw.specified())
|
||||
return state->vpn_ip4_gw.to_string();
|
||||
@ -282,7 +282,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw6() const override
|
||||
std::string vpn_gw6() const override
|
||||
{
|
||||
if (state->vpn_ip6_gw.specified())
|
||||
return state->vpn_ip6_gw.to_string();
|
||||
@ -295,11 +295,11 @@ class Client : public TunClient
|
||||
return state->mtu;
|
||||
}
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
stop_();
|
||||
}
|
||||
|
@ -116,12 +116,12 @@ class ClientConfig : public TunClientFactory
|
||||
return new ClientConfig;
|
||||
}
|
||||
|
||||
virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli);
|
||||
TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
|
||||
// return true if layer 2 tunnels are supported
|
||||
virtual bool layer_2_supported() const
|
||||
bool layer_2_supported() const override
|
||||
{
|
||||
#if defined(MAC_TUNTAP_FALLBACK)
|
||||
return false; // change to true after TAP support is added
|
||||
@ -131,7 +131,7 @@ class ClientConfig : public TunClientFactory
|
||||
}
|
||||
|
||||
// called just prior to transmission of Disconnect event
|
||||
virtual void finalize(const bool disconnected)
|
||||
void finalize(const bool disconnected) override
|
||||
{
|
||||
if (disconnected)
|
||||
tun_persist.reset();
|
||||
@ -146,7 +146,7 @@ class Client : public TunClient
|
||||
typedef Tun<Client *, TunPersist> TunImpl;
|
||||
|
||||
public:
|
||||
virtual void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
{
|
||||
if (!impl)
|
||||
{
|
||||
@ -263,12 +263,12 @@ class Client : public TunClient
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool tun_send(BufferAllocated &buf) override
|
||||
bool tun_send(BufferAllocated &buf) override
|
||||
{
|
||||
return send(buf);
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
if (impl)
|
||||
return impl->name();
|
||||
@ -276,7 +276,7 @@ class Client : public TunClient
|
||||
return "UNDEF_TUN";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
if (state->vpn_ip4_addr.specified())
|
||||
return state->vpn_ip4_addr.to_string();
|
||||
@ -284,7 +284,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
if (state->vpn_ip6_addr.specified())
|
||||
return state->vpn_ip6_addr.to_string();
|
||||
@ -292,7 +292,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw4() const override
|
||||
std::string vpn_gw4() const override
|
||||
{
|
||||
if (state->vpn_ip4_gw.specified())
|
||||
return state->vpn_ip4_gw.to_string();
|
||||
@ -300,7 +300,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw6() const override
|
||||
std::string vpn_gw6() const override
|
||||
{
|
||||
if (state->vpn_ip6_gw.specified())
|
||||
return state->vpn_ip6_gw.to_string();
|
||||
@ -313,11 +313,11 @@ class Client : public TunClient
|
||||
return state->mtu;
|
||||
}
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
stop_();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class Setup : public TunBuilderSetup::Base
|
||||
bool add_bypass_routes_on_establish = false;
|
||||
|
||||
#ifdef HAVE_JSON
|
||||
virtual Json::Value to_json() override
|
||||
Json::Value to_json() override
|
||||
{
|
||||
Json::Value root(Json::objectValue);
|
||||
root["iface_name"] = Json::Value(iface_name);
|
||||
@ -75,7 +75,7 @@ class Setup : public TunBuilderSetup::Base
|
||||
return root;
|
||||
};
|
||||
|
||||
virtual void from_json(const Json::Value &root, const std::string &title) override
|
||||
void from_json(const Json::Value &root, const std::string &title) override
|
||||
{
|
||||
json::assert_dict(root, title);
|
||||
json::to_string(root, iface_name, "iface_name", title);
|
||||
@ -93,10 +93,10 @@ class Setup : public TunBuilderSetup::Base
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual int establish(const TunBuilderCapture &pull, // defined by TunBuilderSetup::Base
|
||||
TunBuilderSetup::Config *config,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
int establish(const TunBuilderCapture &pull, // defined by TunBuilderSetup::Base
|
||||
TunBuilderSetup::Config *config,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
{
|
||||
// get configuration
|
||||
Config *conf = dynamic_cast<Config *>(config);
|
||||
@ -160,7 +160,7 @@ class Setup : public TunBuilderSetup::Base
|
||||
return fd;
|
||||
}
|
||||
|
||||
virtual void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
{
|
||||
if (remove_cmds)
|
||||
{
|
||||
|
@ -63,14 +63,14 @@ class MacDNSWatchdog : public RC<thread_unsafe_refcount>
|
||||
{
|
||||
}
|
||||
|
||||
virtual void execute(std::ostream &os)
|
||||
void execute(std::ostream &os) override
|
||||
{
|
||||
os << to_string() << std::endl;
|
||||
if (parent)
|
||||
parent->setdns(config, flags);
|
||||
}
|
||||
|
||||
virtual std::string to_string() const
|
||||
std::string to_string() const override
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "MacDNSAction: FLAGS=";
|
||||
|
@ -83,17 +83,17 @@ class ClientConfig : public TunClientFactory
|
||||
return new ClientConfig;
|
||||
}
|
||||
|
||||
virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &io_context,
|
||||
TunClientParent &parent,
|
||||
TransportClient *transcli) override;
|
||||
|
||||
virtual void finalize(const bool disconnected) override
|
||||
void finalize(const bool disconnected) override
|
||||
{
|
||||
if (disconnected)
|
||||
tun_persist.reset();
|
||||
}
|
||||
|
||||
virtual bool layer_2_supported() const override
|
||||
bool layer_2_supported() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Client : public TunClient
|
||||
self->tun_start(opt, transcli, c); });
|
||||
}
|
||||
|
||||
virtual void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
void tun_start(const OptionList &opt, TransportClient &transcli, CryptoDCSettings &) override
|
||||
{
|
||||
if (!impl)
|
||||
{
|
||||
@ -208,12 +208,12 @@ class Client : public TunClient
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool tun_send(BufferAllocated &buf) override
|
||||
bool tun_send(BufferAllocated &buf) override
|
||||
{
|
||||
return send(buf);
|
||||
}
|
||||
|
||||
virtual std::string tun_name() const override
|
||||
std::string tun_name() const override
|
||||
{
|
||||
if (impl)
|
||||
return impl->name();
|
||||
@ -221,7 +221,7 @@ class Client : public TunClient
|
||||
return "UNDEF_TUN";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip4() const override
|
||||
std::string vpn_ip4() const override
|
||||
{
|
||||
if (state->vpn_ip4_addr.specified())
|
||||
return state->vpn_ip4_addr.to_string();
|
||||
@ -229,7 +229,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_ip6() const override
|
||||
std::string vpn_ip6() const override
|
||||
{
|
||||
if (state->vpn_ip6_addr.specified())
|
||||
return state->vpn_ip6_addr.to_string();
|
||||
@ -237,7 +237,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw4() const override
|
||||
std::string vpn_gw4() const override
|
||||
{
|
||||
if (state->vpn_ip4_gw.specified())
|
||||
return state->vpn_ip4_gw.to_string();
|
||||
@ -245,7 +245,7 @@ class Client : public TunClient
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string vpn_gw6() const override
|
||||
std::string vpn_gw6() const override
|
||||
{
|
||||
if (state->vpn_ip6_gw.specified())
|
||||
return state->vpn_ip6_gw.to_string();
|
||||
@ -258,11 +258,11 @@ class Client : public TunClient
|
||||
return state->mtu;
|
||||
}
|
||||
|
||||
virtual void set_disconnect() override
|
||||
void set_disconnect() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
stop_();
|
||||
}
|
||||
|
@ -131,11 +131,11 @@ class Setup : public SetupBase
|
||||
}
|
||||
|
||||
// Set up the TAP device
|
||||
virtual HANDLE establish(const TunBuilderCapture &pull,
|
||||
const std::wstring &openvpn_app_path,
|
||||
Stop *stop,
|
||||
std::ostream &os,
|
||||
RingBuffer::Ptr ring_buffer) override // defined by SetupBase
|
||||
HANDLE establish(const TunBuilderCapture &pull,
|
||||
const std::wstring &openvpn_app_path,
|
||||
Stop *stop,
|
||||
std::ostream &os,
|
||||
RingBuffer::Ptr ring_buffer) override // defined by SetupBase
|
||||
{
|
||||
// close out old remove cmds, if they exist
|
||||
destroy(os);
|
||||
@ -185,7 +185,7 @@ class Setup : public SetupBase
|
||||
// the adapter properties matches the data given in pull.
|
||||
// This method is usually called once per second until it
|
||||
// returns true.
|
||||
virtual bool l2_ready(const TunBuilderCapture &pull) override
|
||||
bool l2_ready(const TunBuilderCapture &pull) override
|
||||
{
|
||||
const unsigned int route_delay = 5;
|
||||
if (l2_state)
|
||||
@ -208,9 +208,9 @@ class Setup : public SetupBase
|
||||
|
||||
// Finish the layer 2 configuration, should be called
|
||||
// after l2_ready() returns true.
|
||||
virtual void l2_finish(const TunBuilderCapture &pull,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
void l2_finish(const TunBuilderCapture &pull,
|
||||
Stop *stop,
|
||||
std::ostream &os) override
|
||||
{
|
||||
std::unique_ptr<L2State> l2s(std::move(l2_state));
|
||||
if (l2s)
|
||||
@ -222,7 +222,7 @@ class Setup : public SetupBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
void destroy(std::ostream &os) override // defined by DestructorBase
|
||||
{
|
||||
// l2_state
|
||||
l2_state.reset();
|
||||
|
@ -1345,17 +1345,17 @@ class HTTPCore : public Base, public TransportClientParent
|
||||
|
||||
// TransportClientParent methods
|
||||
|
||||
virtual bool transport_is_openvpn_protocol()
|
||||
bool transport_is_openvpn_protocol() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void transport_recv(BufferAllocated &buf)
|
||||
void transport_recv(BufferAllocated &buf) override
|
||||
{
|
||||
tcp_read_handler(buf);
|
||||
}
|
||||
|
||||
virtual void transport_needs_send()
|
||||
void transport_needs_send() override
|
||||
{
|
||||
tcp_write_queue_needs_send();
|
||||
}
|
||||
@ -1369,39 +1369,39 @@ class HTTPCore : public Base, public TransportClientParent
|
||||
return os.str();
|
||||
}
|
||||
|
||||
virtual void transport_error(const Error::Type fatal_err, const std::string &err_text)
|
||||
void transport_error(const Error::Type fatal_err, const std::string &err_text) override
|
||||
{
|
||||
return error_handler(Status::E_TRANSPORT, err_fmt(fatal_err, err_text));
|
||||
}
|
||||
|
||||
virtual void proxy_error(const Error::Type fatal_err, const std::string &err_text)
|
||||
void proxy_error(const Error::Type fatal_err, const std::string &err_text) override
|
||||
{
|
||||
return error_handler(Status::E_PROXY, err_fmt(fatal_err, err_text));
|
||||
}
|
||||
|
||||
virtual void transport_pre_resolve()
|
||||
void transport_pre_resolve() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_wait_proxy()
|
||||
void transport_wait_proxy() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_wait()
|
||||
void transport_wait() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool is_keepalive_enabled() const
|
||||
bool is_keepalive_enabled() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout)
|
||||
void disable_keepalive(unsigned int &keepalive_ping,
|
||||
unsigned int &keepalive_timeout) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void transport_connecting()
|
||||
void transport_connecting() override
|
||||
{
|
||||
do_connect(false);
|
||||
}
|
||||
@ -1477,7 +1477,7 @@ class HTTPDelegate : public HTTPCore
|
||||
return parent_;
|
||||
}
|
||||
|
||||
virtual Host http_host()
|
||||
Host http_host() override
|
||||
{
|
||||
if (parent_)
|
||||
return parent_->http_host(*this);
|
||||
@ -1485,7 +1485,7 @@ class HTTPDelegate : public HTTPCore
|
||||
throw http_delegate_error("http_host");
|
||||
}
|
||||
|
||||
virtual Request http_request()
|
||||
Request http_request() override
|
||||
{
|
||||
if (parent_)
|
||||
return parent_->http_request(*this);
|
||||
@ -1493,7 +1493,7 @@ class HTTPDelegate : public HTTPCore
|
||||
throw http_delegate_error("http_request");
|
||||
}
|
||||
|
||||
virtual ContentInfo http_content_info()
|
||||
ContentInfo http_content_info() override
|
||||
{
|
||||
if (parent_)
|
||||
return parent_->http_content_info(*this);
|
||||
@ -1501,7 +1501,7 @@ class HTTPDelegate : public HTTPCore
|
||||
throw http_delegate_error("http_content_info");
|
||||
}
|
||||
|
||||
virtual BufferPtr http_content_out()
|
||||
BufferPtr http_content_out() override
|
||||
{
|
||||
if (parent_)
|
||||
return parent_->http_content_out(*this);
|
||||
@ -1509,7 +1509,7 @@ class HTTPDelegate : public HTTPCore
|
||||
throw http_delegate_error("http_content_out");
|
||||
}
|
||||
|
||||
virtual void http_content_out_needed()
|
||||
void http_content_out_needed() override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_content_out_needed(*this);
|
||||
@ -1517,43 +1517,43 @@ class HTTPDelegate : public HTTPCore
|
||||
throw http_delegate_error("http_content_out_needed");
|
||||
}
|
||||
|
||||
virtual void http_headers_received()
|
||||
void http_headers_received() override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_headers_received(*this);
|
||||
}
|
||||
|
||||
virtual void http_headers_sent(const Buffer &buf)
|
||||
void http_headers_sent(const Buffer &buf) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_headers_sent(*this, buf);
|
||||
}
|
||||
|
||||
virtual void http_mutate_resolver_results(results_type &results)
|
||||
void http_mutate_resolver_results(results_type &results) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_mutate_resolver_results(*this, results);
|
||||
}
|
||||
|
||||
virtual void http_content_in(BufferAllocated &buf)
|
||||
void http_content_in(BufferAllocated &buf) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_content_in(*this, buf);
|
||||
}
|
||||
|
||||
virtual void http_done(const int status, const std::string &description)
|
||||
void http_done(const int status, const std::string &description) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_done(*this, status, description);
|
||||
}
|
||||
|
||||
virtual void http_keepalive_close(const int status, const std::string &description)
|
||||
void http_keepalive_close(const int status, const std::string &description) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_keepalive_close(*this, status, description);
|
||||
}
|
||||
|
||||
virtual void http_post_connect(AsioPolySock::Base &sock)
|
||||
void http_post_connect(AsioPolySock::Base &sock) override
|
||||
{
|
||||
if (parent_)
|
||||
parent_->http_post_connect(*this, sock);
|
||||
|
@ -796,7 +796,7 @@ class Listener : public ProxyListener
|
||||
{
|
||||
}
|
||||
|
||||
virtual void start() override
|
||||
void start() override
|
||||
{
|
||||
if (halt)
|
||||
return;
|
||||
@ -920,7 +920,7 @@ class Listener : public ProxyListener
|
||||
}
|
||||
}
|
||||
|
||||
virtual void stop() override
|
||||
void stop() override
|
||||
{
|
||||
if (halt)
|
||||
return;
|
||||
@ -1016,7 +1016,7 @@ class Listener : public ProxyListener
|
||||
throttle_timer_wait();
|
||||
}
|
||||
|
||||
virtual void handle_accept(AsioPolySock::Base::Ptr sock, const openvpn_io::error_code &error) override
|
||||
void handle_accept(AsioPolySock::Base::Ptr sock, const openvpn_io::error_code &error) override
|
||||
{
|
||||
if (halt)
|
||||
return;
|
||||
|
@ -285,7 +285,7 @@ class Client : public ClientBase
|
||||
|
||||
|
||||
private:
|
||||
virtual void event(const ClientAPI::Event &ev) override
|
||||
void event(const ClientAPI::Event &ev) override
|
||||
{
|
||||
std::cout << date_time() << " EVENT: " << ev.name;
|
||||
if (!ev.info.empty())
|
||||
@ -374,7 +374,7 @@ class Client : public ClientBase
|
||||
@brief Handles ACC messages
|
||||
@param acev The current ACC event
|
||||
*/
|
||||
virtual void acc_event(const ClientAPI::AppCustomControlMessageEvent &acev) override
|
||||
void acc_event(const ClientAPI::AppCustomControlMessageEvent &acev) override
|
||||
{
|
||||
if (acev.protocol == "internal:supported_protocols")
|
||||
{
|
||||
@ -467,13 +467,13 @@ class Client : public ClientBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual void log(const ClientAPI::LogInfo &log) override
|
||||
void log(const ClientAPI::LogInfo &log) override
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(log_mutex);
|
||||
std::cout << date_time() << ' ' << log.text << std::flush;
|
||||
}
|
||||
|
||||
virtual void clock_tick() override
|
||||
void clock_tick() override
|
||||
{
|
||||
const ClockTickAction action = clock_tick_action;
|
||||
clock_tick_action = CT_UNDEF;
|
||||
@ -505,7 +505,7 @@ class Client : public ClientBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual void external_pki_cert_request(ClientAPI::ExternalPKICertRequest &certreq) override
|
||||
void external_pki_cert_request(ClientAPI::ExternalPKICertRequest &certreq) override
|
||||
{
|
||||
if (certreq.alias == "epki" && !epki_cert.empty())
|
||||
{
|
||||
@ -682,7 +682,7 @@ class Client : public ClientBase
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void external_pki_sign_request(ClientAPI::ExternalPKISignRequest &signreq) override
|
||||
void external_pki_sign_request(ClientAPI::ExternalPKISignRequest &signreq) override
|
||||
{
|
||||
#if defined(USE_MBEDTLS)
|
||||
if (epki_ctx.defined())
|
||||
@ -765,18 +765,18 @@ class Client : public ClientBase
|
||||
return self->rng->rand_bytes_noexcept(data, len) ? 0 : -1; // using -1 as a general-purpose mbed TLS error code
|
||||
}
|
||||
|
||||
virtual bool pause_on_connection_timeout() override
|
||||
bool pause_on_connection_timeout() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef OPENVPN_REMOTE_OVERRIDE
|
||||
virtual bool remote_override_enabled() override
|
||||
bool remote_override_enabled() override
|
||||
{
|
||||
return !remote_override_cmd.empty();
|
||||
}
|
||||
|
||||
virtual void remote_override(ClientAPI::RemoteOverride &ro) override
|
||||
void remote_override(ClientAPI::RemoteOverride &ro) override
|
||||
{
|
||||
RedirectPipe::InOut pio;
|
||||
Argv argv;
|
||||
|
@ -76,7 +76,7 @@ class MySessionStats : public SessionStats
|
||||
std::memset(errors, 0, sizeof(errors));
|
||||
}
|
||||
|
||||
virtual void error(const size_t err_type, const std::string *text = NULL)
|
||||
void error(const size_t err_type, const std::string *text = NULL) override
|
||||
{
|
||||
if (err_type < Error::N_ERRORS)
|
||||
++errors[err_type];
|
||||
|
@ -592,7 +592,7 @@ class TestProtoClient : public TestProto
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void client_auth(Buffer &buf)
|
||||
void client_auth(Buffer &buf) override
|
||||
{
|
||||
const std::string username("foo");
|
||||
const std::string password("bar");
|
||||
@ -620,10 +620,10 @@ class TestProtoServer : public TestProto
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void server_auth(const std::string &username,
|
||||
const SafeString &password,
|
||||
const std::string &peer_info,
|
||||
const AuthCert::Ptr &auth_cert)
|
||||
void server_auth(const std::string &username,
|
||||
const SafeString &password,
|
||||
const std::string &peer_info,
|
||||
const AuthCert::Ptr &auth_cert) override
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "**** AUTHENTICATE " << username << '/' << password << " PEER INFO:" << std::endl;
|
||||
@ -830,7 +830,7 @@ class MySessionStats : public SessionStats
|
||||
std::memset(errors, 0, sizeof(errors));
|
||||
}
|
||||
|
||||
virtual void error(const size_t err_type, const std::string *text = nullptr)
|
||||
void error(const size_t err_type, const std::string *text = nullptr) override
|
||||
{
|
||||
if (err_type < Error::N_ERRORS)
|
||||
++errors[err_type];
|
||||
@ -1175,7 +1175,7 @@ int test_retry(const int thread_num, const int n_retries, bool use_tls_ekm)
|
||||
class ProtoUnitTest : public testing::Test
|
||||
{
|
||||
// Sets up the test fixture.
|
||||
virtual void SetUp()
|
||||
void SetUp() override
|
||||
{
|
||||
#if defined(USE_MBEDTLS)
|
||||
mbedtls_debug_set_threshold(1);
|
||||
@ -1191,7 +1191,7 @@ class ProtoUnitTest : public testing::Test
|
||||
}
|
||||
|
||||
// Tears down the test fixture.
|
||||
virtual void TearDown()
|
||||
void TearDown() override
|
||||
{
|
||||
#if defined(USE_MBEDTLS)
|
||||
mbedtls_debug_set_threshold(4);
|
||||
|
@ -60,12 +60,12 @@ class StaticSinkBase : public RC<thread_unsafe_refcount>
|
||||
class StaticSink : public StaticSinkBase
|
||||
{
|
||||
public:
|
||||
virtual void init(StaticKey &&key)
|
||||
void init(StaticKey &&key) override
|
||||
{
|
||||
k = std::move(key);
|
||||
}
|
||||
|
||||
virtual std::string dump()
|
||||
std::string dump() override
|
||||
{
|
||||
return k.render_hex();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user