OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::OMICore Class Referenceabstract

#include <omi.hpp>

Inheritance diagram for openvpn::OMICore:
[legend]
Collaboration diagram for openvpn::OMICore:
[legend]

Classes

class  BufferThrottle
 
struct  Command
 
class  History
 
struct  LogFn
 

Public Member Functions

 OPENVPN_EXCEPTION (omi_error)
 
void stop ()
 

Protected Member Functions

 OMICore (openvpn_io::io_context &io_context_arg)
 
void log_setup (const LogFn &log)
 
void start (const OptionList &opt)
 
void start_connection_if_not_hold ()
 
void send (BufferPtr buf)
 
void send (const std::string &str)
 
bool send_ready () const
 
void async_done ()
 
void log_full (const std::string &text)
 
void log_timestamp (const time_t timestamp, const std::string &text)
 
void log_line (const std::string &line)
 
void state_line (const std::string &line)
 
void echo_line (const std::string &line)
 
bool is_errors_to_stderr () const
 
bool is_stopping () const
 
unsigned int get_bytecount () const
 
virtual bool omi_command_is_multiline (const std::string &arg0, const Option &option)=0
 
virtual bool omi_command_in (const std::string &arg0, const Command &cmd)=0
 
virtual void omi_start_connection ()=0
 
virtual void omi_done (const bool eof)=0
 
virtual void omi_sigterm ()=0
 
virtual bool omi_stop ()=0
 
virtual bool omi_is_sighup_implemented ()
 
virtual void omi_sighup ()
 

Static Protected Member Functions

static std::string get_config (const OptionList &opt)
 

Protected Attributes

openvpn_io::io_context & io_context
 

Private Types

typedef RCPtr< OMICorePtr
 

Private Member Functions

bool command_in (std::unique_ptr< Command > cmd)
 
bool is_hold_cmd (const Option &o) const
 
std::string hold_cmd (const Option &o, bool &release)
 
void hold_cycle ()
 
void hold_release ()
 
void process_bytecount_cmd (const Option &o)
 
void process_signal_cmd (const Option &o)
 
bool command_is_multiline (const Option &o)
 
bool is_sock_open () const
 
void conditional_stop (const bool eof)
 
void stop_omi_client (const bool eof, const unsigned int milliseconds)
 
void stop_omi_client (const bool eof)
 
void send_title_message ()
 
void send_password_prompt ()
 
void send_password_correct ()
 
bool process_password ()
 
bool process_in_line ()
 
void listen_tcp (const std::string &addr, const std::string &port)
 
void listen_unix (const std::string &socket_path)
 
void queue_accept ()
 
void verify_sock_peer (AsioPolySock::Base &sock)
 
void handle_accept (AsioPolySock::Base::Ptr sock, const openvpn_io::error_code &error) override
 
void connect_tcp (const std::string &addr, const std::string &port)
 
void connect_unix (const std::string &socket_path)
 
void queue_recv ()
 
void handle_recv (const openvpn_io::error_code &error, const size_t bytes_recvd, BufferPtr buf, const AsioPolySock::Base *queued_socket)
 
void process_recv ()
 
void queue_send ()
 
void handle_send (const openvpn_io::error_code &error, const size_t bytes_sent, const AsioPolySock::Base *queued_socket)
 

Static Private Member Functions

static std::string read_config (const std::string &fn)
 

Private Attributes

Acceptor::Base::Ptr acceptor
 
AsioPolySock::Base::Ptr socket
 
std::unique_ptr< AsioWorkasio_work
 
std::deque< BufferPtrcontent_out
 
std::string in_partial
 
std::unique_ptr< Commandcommand
 
BufferPtr in_buf
 
bool management_client_root = false
 
bool multiline = false
 
bool errors_to_stderr = false
 
bool recv_queued = false
 
bool password_defined = false
 
bool password_verified = false
 
std::string password
 
volatile bool stop_called = false
 
AsioTimerSafe stop_timer
 
bool hold_wait = false
 
bool hold_flag = false
 
unsigned int bytecount = 0
 
History hist_log {"log", 100}
 
History hist_state {"state", 100}
 
History hist_echo {"echo", 100}
 
std::unique_ptr< BufferThrottlecontent_out_throttle
 

Additional Inherited Members

- Public Types inherited from openvpn::Acceptor::ListenerBase
typedef RCPtr< ListenerBasePtr
 

Detailed Description

Definition at line 50 of file omi.hpp.

Member Typedef Documentation

◆ Ptr

Definition at line 428 of file omi.hpp.

Constructor & Destructor Documentation

◆ OMICore()

openvpn::OMICore::OMICore ( openvpn_io::io_context &  io_context_arg)
inlineprotected

Definition at line 220 of file omi.hpp.

Member Function Documentation

◆ async_done()

void openvpn::OMICore::async_done ( )
inlineprotected

Definition at line 352 of file omi.hpp.

◆ command_in()

bool openvpn::OMICore::command_in ( std::unique_ptr< Command cmd)
inlineprivate

Definition at line 467 of file omi.hpp.

Here is the caller graph for this function:

◆ command_is_multiline()

bool openvpn::OMICore::command_is_multiline ( const Option o)
inlineprivate

Definition at line 638 of file omi.hpp.

Here is the caller graph for this function:

◆ conditional_stop()

void openvpn::OMICore::conditional_stop ( const bool  eof)
inlineprivate

Definition at line 651 of file omi.hpp.

Here is the caller graph for this function:

◆ connect_tcp()

void openvpn::OMICore::connect_tcp ( const std::string &  addr,
const std::string &  port 
)
inlineprivate

Definition at line 888 of file omi.hpp.

Here is the caller graph for this function:

◆ connect_unix()

void openvpn::OMICore::connect_unix ( const std::string &  socket_path)
inlineprivate

Definition at line 902 of file omi.hpp.

Here is the caller graph for this function:

◆ echo_line()

void openvpn::OMICore::echo_line ( const std::string &  line)
inlineprotected

Definition at line 388 of file omi.hpp.

Here is the caller graph for this function:

◆ get_bytecount()

unsigned int openvpn::OMICore::get_bytecount ( ) const
inlineprotected

Definition at line 404 of file omi.hpp.

Here is the caller graph for this function:

◆ get_config()

static std::string openvpn::OMICore::get_config ( const OptionList opt)
inlinestaticprotected

Definition at line 244 of file omi.hpp.

Here is the caller graph for this function:

◆ handle_accept()

void openvpn::OMICore::handle_accept ( AsioPolySock::Base::Ptr  sock,
const openvpn_io::error_code &  error 
)
inlineoverrideprivatevirtual

Implements openvpn::Acceptor::ListenerBase.

Definition at line 848 of file omi.hpp.

◆ handle_recv()

void openvpn::OMICore::handle_recv ( const openvpn_io::error_code &  error,
const size_t  bytes_recvd,
BufferPtr  buf,
const AsioPolySock::Base queued_socket 
)
inlineprivate

Definition at line 932 of file omi.hpp.

◆ handle_send()

void openvpn::OMICore::handle_send ( const openvpn_io::error_code &  error,
const size_t  bytes_sent,
const AsioPolySock::Base queued_socket 
)
inlineprivate

Definition at line 991 of file omi.hpp.

◆ hold_cmd()

std::string openvpn::OMICore::hold_cmd ( const Option o,
bool &  release 
)
inlineprivate

Definition at line 563 of file omi.hpp.

Here is the caller graph for this function:

◆ hold_cycle()

void openvpn::OMICore::hold_cycle ( )
inlineprivate

Definition at line 597 of file omi.hpp.

Here is the caller graph for this function:

◆ hold_release()

void openvpn::OMICore::hold_release ( )
inlineprivate

Definition at line 606 of file omi.hpp.

Here is the caller graph for this function:

◆ is_errors_to_stderr()

bool openvpn::OMICore::is_errors_to_stderr ( ) const
inlineprotected

Definition at line 394 of file omi.hpp.

Here is the caller graph for this function:

◆ is_hold_cmd()

bool openvpn::OMICore::is_hold_cmd ( const Option o) const
inlineprivate

Definition at line 558 of file omi.hpp.

Here is the caller graph for this function:

◆ is_sock_open()

bool openvpn::OMICore::is_sock_open ( ) const
inlineprivate

Definition at line 646 of file omi.hpp.

Here is the caller graph for this function:

◆ is_stopping()

bool openvpn::OMICore::is_stopping ( ) const
inlineprotected

Definition at line 399 of file omi.hpp.

Here is the caller graph for this function:

◆ listen_tcp()

void openvpn::OMICore::listen_tcp ( const std::string &  addr,
const std::string &  port 
)
inlineprivate

Definition at line 768 of file omi.hpp.

Here is the caller graph for this function:

◆ listen_unix()

void openvpn::OMICore::listen_unix ( const std::string &  socket_path)
inlineprivate

Definition at line 797 of file omi.hpp.

Here is the caller graph for this function:

◆ log_full()

void openvpn::OMICore::log_full ( const std::string &  text)
inlineprotected

Definition at line 357 of file omi.hpp.

Here is the caller graph for this function:

◆ log_line()

void openvpn::OMICore::log_line ( const std::string &  line)
inlineprotected

Definition at line 376 of file omi.hpp.

Here is the caller graph for this function:

◆ log_setup()

void openvpn::OMICore::log_setup ( const LogFn log)
inlineprotected

Definition at line 226 of file omi.hpp.

Here is the caller graph for this function:

◆ log_timestamp()

void openvpn::OMICore::log_timestamp ( const time_t  timestamp,
const std::string &  text 
)
inlineprotected

Definition at line 370 of file omi.hpp.

◆ omi_command_in()

virtual bool openvpn::OMICore::omi_command_in ( const std::string &  arg0,
const Command cmd 
)
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ omi_command_is_multiline()

virtual bool openvpn::OMICore::omi_command_is_multiline ( const std::string &  arg0,
const Option option 
)
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ omi_done()

virtual void openvpn::OMICore::omi_done ( const bool  eof)
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ omi_is_sighup_implemented()

virtual bool openvpn::OMICore::omi_is_sighup_implemented ( )
inlineprotectedvirtual

Reimplemented in OMI.

Definition at line 416 of file omi.hpp.

Here is the caller graph for this function:

◆ omi_sighup()

virtual void openvpn::OMICore::omi_sighup ( )
inlineprotectedvirtual

Reimplemented in OMI.

Definition at line 421 of file omi.hpp.

Here is the caller graph for this function:

◆ omi_sigterm()

virtual void openvpn::OMICore::omi_sigterm ( )
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ omi_start_connection()

virtual void openvpn::OMICore::omi_start_connection ( )
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ omi_stop()

virtual bool openvpn::OMICore::omi_stop ( )
protectedpure virtual

Implemented in OMI.

Here is the caller graph for this function:

◆ OPENVPN_EXCEPTION()

openvpn::OMICore::OPENVPN_EXCEPTION ( omi_error  )

◆ process_bytecount_cmd()

void openvpn::OMICore::process_bytecount_cmd ( const Option o)
inlineprivate

Definition at line 615 of file omi.hpp.

Here is the caller graph for this function:

◆ process_in_line()

bool openvpn::OMICore::process_in_line ( )
inlineprivate

Definition at line 719 of file omi.hpp.

Here is the caller graph for this function:

◆ process_password()

bool openvpn::OMICore::process_password ( )
inlineprivate

Definition at line 697 of file omi.hpp.

Here is the caller graph for this function:

◆ process_recv()

void openvpn::OMICore::process_recv ( )
inlineprivate

Definition at line 953 of file omi.hpp.

Here is the caller graph for this function:

◆ process_signal_cmd()

void openvpn::OMICore::process_signal_cmd ( const Option o)
inlineprivate

Definition at line 621 of file omi.hpp.

Here is the caller graph for this function:

◆ queue_accept()

void openvpn::OMICore::queue_accept ( )
inlineprivate

Definition at line 829 of file omi.hpp.

Here is the caller graph for this function:

◆ queue_recv()

void openvpn::OMICore::queue_recv ( )
inlineprivate

Definition at line 919 of file omi.hpp.

Here is the caller graph for this function:

◆ queue_send()

void openvpn::OMICore::queue_send ( )
inlineprivate

Definition at line 979 of file omi.hpp.

Here is the caller graph for this function:

◆ read_config()

static std::string openvpn::OMICore::read_config ( const std::string &  fn)
inlinestaticprivate

Definition at line 760 of file omi.hpp.

Here is the caller graph for this function:

◆ send() [1/2]

void openvpn::OMICore::send ( BufferPtr  buf)
inlineprotected

Definition at line 327 of file omi.hpp.

Here is the caller graph for this function:

◆ send() [2/2]

void openvpn::OMICore::send ( const std::string &  str)
inlineprotected

Definition at line 338 of file omi.hpp.

◆ send_password_correct()

void openvpn::OMICore::send_password_correct ( )
inlineprivate

Definition at line 692 of file omi.hpp.

Here is the caller graph for this function:

◆ send_password_prompt()

void openvpn::OMICore::send_password_prompt ( )
inlineprivate

Definition at line 687 of file omi.hpp.

Here is the caller graph for this function:

◆ send_ready()

bool openvpn::OMICore::send_ready ( ) const
inlineprotected

Definition at line 344 of file omi.hpp.

◆ send_title_message()

void openvpn::OMICore::send_title_message ( )
inlineprivate

Definition at line 682 of file omi.hpp.

Here is the caller graph for this function:

◆ start()

void openvpn::OMICore::start ( const OptionList opt)
inlineprotected

Definition at line 251 of file omi.hpp.

Here is the caller graph for this function:

◆ start_connection_if_not_hold()

void openvpn::OMICore::start_connection_if_not_hold ( )
inlineprotected

Definition at line 321 of file omi.hpp.

◆ state_line()

void openvpn::OMICore::state_line ( const std::string &  line)
inlineprotected

Definition at line 382 of file omi.hpp.

Here is the caller graph for this function:

◆ stop()

void openvpn::OMICore::stop ( )
inline

Definition at line 73 of file omi.hpp.

Here is the caller graph for this function:

◆ stop_omi_client() [1/2]

void openvpn::OMICore::stop_omi_client ( const bool  eof)
inlineprivate

Definition at line 668 of file omi.hpp.

◆ stop_omi_client() [2/2]

void openvpn::OMICore::stop_omi_client ( const bool  eof,
const unsigned int  milliseconds 
)
inlineprivate

Definition at line 659 of file omi.hpp.

Here is the caller graph for this function:

◆ verify_sock_peer()

void openvpn::OMICore::verify_sock_peer ( AsioPolySock::Base sock)
inlineprivate

Definition at line 835 of file omi.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ acceptor

Acceptor::Base::Ptr openvpn::OMICore::acceptor
private

Definition at line 1028 of file omi.hpp.

◆ asio_work

std::unique_ptr<AsioWork> openvpn::OMICore::asio_work
private

Definition at line 1030 of file omi.hpp.

◆ bytecount

unsigned int openvpn::OMICore::bytecount = 0
private

Definition at line 1052 of file omi.hpp.

◆ command

std::unique_ptr<Command> openvpn::OMICore::command
private

Definition at line 1033 of file omi.hpp.

◆ content_out

std::deque<BufferPtr> openvpn::OMICore::content_out
private

Definition at line 1031 of file omi.hpp.

◆ content_out_throttle

std::unique_ptr<BufferThrottle> openvpn::OMICore::content_out_throttle
private

Definition at line 1060 of file omi.hpp.

◆ errors_to_stderr

bool openvpn::OMICore::errors_to_stderr = false
private

Definition at line 1037 of file omi.hpp.

◆ hist_echo

History openvpn::OMICore::hist_echo {"echo", 100}
private

Definition at line 1057 of file omi.hpp.

◆ hist_log

History openvpn::OMICore::hist_log {"log", 100}
private

Definition at line 1055 of file omi.hpp.

◆ hist_state

History openvpn::OMICore::hist_state {"state", 100}
private

Definition at line 1056 of file omi.hpp.

◆ hold_flag

bool openvpn::OMICore::hold_flag = false
private

Definition at line 1049 of file omi.hpp.

◆ hold_wait

bool openvpn::OMICore::hold_wait = false
private

Definition at line 1048 of file omi.hpp.

◆ in_buf

BufferPtr openvpn::OMICore::in_buf
private

Definition at line 1034 of file omi.hpp.

◆ in_partial

std::string openvpn::OMICore::in_partial
private

Definition at line 1032 of file omi.hpp.

◆ io_context

openvpn_io::io_context& openvpn::OMICore::io_context
protected

Definition at line 425 of file omi.hpp.

◆ management_client_root

bool openvpn::OMICore::management_client_root = false
private

Definition at line 1035 of file omi.hpp.

◆ multiline

bool openvpn::OMICore::multiline = false
private

Definition at line 1036 of file omi.hpp.

◆ password

std::string openvpn::OMICore::password
private

Definition at line 1041 of file omi.hpp.

◆ password_defined

bool openvpn::OMICore::password_defined = false
private

Definition at line 1039 of file omi.hpp.

◆ password_verified

bool openvpn::OMICore::password_verified = false
private

Definition at line 1040 of file omi.hpp.

◆ recv_queued

bool openvpn::OMICore::recv_queued = false
private

Definition at line 1038 of file omi.hpp.

◆ socket

AsioPolySock::Base::Ptr openvpn::OMICore::socket
private

Definition at line 1029 of file omi.hpp.

◆ stop_called

volatile bool openvpn::OMICore::stop_called = false
private

Definition at line 1044 of file omi.hpp.

◆ stop_timer

AsioTimerSafe openvpn::OMICore::stop_timer
private

Definition at line 1045 of file omi.hpp.


The documentation for this class was generated from the following file: