14#ifndef OPENVPN_TRANSPORT_CLIENT_TCPCLI_H
15#define OPENVPN_TRANSPORT_CLIENT_TCPCLI_H
22#ifdef OPENVPN_TLS_LINK
23#include <openvpn/transport/tlslink.hpp>
43#ifdef OPENVPN_TLS_LINK
78#ifdef OPENVPN_TLS_LINK
79 typedef TLSLink<openvpn_io::ip::tcp, Client *, false> LinkImplTLS;
120 return impl->send_queue_empty();
133 return impl->send_queue_size();
141 impl->reset_align_adjust(align_adjust);
165 return socket.native_handle();
183 Client(openvpn_io::io_context &io_context_arg,
212 return impl->send(buf);
221 return impl->send(buf);
245 std::ostringstream os;
246 os <<
"Transport error on '" <<
server_host <<
": " << error;
274 config->remote_list->set_endpoint_range(results);
279 std::ostringstream os;
297 if (
config->socket_protect)
308 socket.set_option(openvpn_io::ip::tcp::no_delay(
true));
312 self->start_impl_(error); });
322#ifdef OPENVPN_TLS_LINK
326 SSLLib::SSLAPI::Config::Ptr ssl_conf;
327 ssl_conf.reset(
new SSLLib::SSLAPI::Config());
329 ssl_conf->set_local_cert_enabled(
false);
330 ssl_conf->set_frame(
config->frame);
331 ssl_conf->set_rng(
new SSLLib::RandomAPI());
333 if (!
config->tls_ca.empty())
335 ssl_conf->load_ca(
config->tls_ca,
true);
342 ssl_conf->set_flags(
flags);
343 ssl_factory = ssl_conf->new_factory();
349 config->free_list_max_size,
359 config->free_list_max_size,
363#ifdef OPENVPN_GREMLIN
368 impl->set_raw_mode(
true);
373 std::ostringstream os;
396#ifdef OPENVPN_TLS_LINK
#define OPENVPN_ASYNC_HANDLER
void async_resolve_cancel()
typename RESOLVER_TYPE::results_type results_type
virtual void async_resolve_name(const std::string &host, const std::string &port)
static Addr from_asio(const openvpn_io::ip::address &addr)
std::string to_string() const
void reset() noexcept
Points this RCPtr<T> to nullptr safely.
void process_push(const OptionList &opt)
RemoteList::Ptr remote_list
RCPtr< ClientConfig > Ptr
size_t free_list_max_size
TransportClient::Ptr new_transport_client_obj(openvpn_io::io_context &io_context, TransportClientParent *parent) override
void process_push(const OptionList &opt) override
SocketProtect * socket_protect
LinkImpl::Base::protocol::endpoint server_endpoint
void transport_start() override
openvpn_io::ip::tcp::resolver resolver
void transport_stop_requeueing() override
void start_impl_(const openvpn_io::error_code &error)
openvpn_io::io_context & io_context
bool send(BufferAllocated &buf)
bool transport_has_send_queue() override
bool send_const(const Buffer &cbuf)
size_t transport_send_queue_size() override
void tcp_write_queue_needs_send()
void transport_reparent(TransportClientParent *parent_arg) override
IP::Addr server_endpoint_addr() const override
TCPLink< openvpn_io::ip::tcp, Client *, false > LinkImpl
void tcp_error_handler(const char *error)
openvpn_io::detail::socket_type native_handle() override
openvpn_io::ip::tcp::socket socket
bool tcp_read_handler(BufferAllocated &buf)
void server_endpoint_info(std::string &host, std::string &port, std::string &proto, std::string &ip_addr) const override
Client(openvpn_io::io_context &io_context_arg, ClientConfig *config_arg, TransportClientParent *parent_arg)
bool transport_send_queue_empty() override
TransportClientParent * parent
bool transport_send_const(const Buffer &buf) override
void resolve_callback(const openvpn_io::error_code &error, results_type results) override
unsigned short server_endpoint_port() const override
void reset_align_adjust(const size_t align_adjust) override
Protocol transport_protocol() const override
bool transport_send(BufferAllocated &buf) override
LinkCommon< Protocol, ReadHandler, RAW_MODE_ONLY > Base
#define OPENVPN_LOG(args)
virtual void transport_connecting()=0
virtual void transport_pre_resolve()=0
virtual void transport_error(const Error::Type fatal_err, const std::string &err_text)=0
virtual bool transport_is_openvpn_protocol()=0
virtual void transport_wait()=0
virtual void transport_recv(BufferAllocated &buf)=0
virtual void transport_needs_send()=0
RCPtr< TransportClient > Ptr