rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AutoSocket Class Reference

#include <AutoSocket.h>

Collaboration diagram for AutoSocket:
Collaboration graph
[legend]

Public Types

using ssl_socket = boost::asio::ssl::stream< boost::asio::ip::tcp::socket >
 
using endpoint_type = boost::asio::ip::tcp::socket::endpoint_type
 
using socket_ptr = std::unique_ptr< ssl_socket >
 
using plain_socket = ssl_socket::next_layer_type
 
using lowest_layer_type = ssl_socket::lowest_layer_type
 
using handshake_type = ssl_socket::handshake_type
 
using error_code = boost::system::error_code
 
using callback = std::function< void(error_code)>
 

Public Member Functions

 AutoSocket (boost::asio::io_context &s, boost::asio::ssl::context &c, bool secureOnly, bool plainOnly)
 
 AutoSocket (boost::asio::io_context &s, boost::asio::ssl::context &c)
 
bool isSecure ()
 
ssl_socketSSLSocket ()
 
plain_socketPlainSocket ()
 
beast::IP::Endpoint local_endpoint ()
 
beast::IP::Endpoint remote_endpoint ()
 
lowest_layer_typelowest_layer ()
 
void swap (AutoSocket &s) noexcept
 
boost::system::error_code cancel (boost::system::error_code &ec)
 
void async_handshake (handshake_type type, callback cbFunc)
 
template<typename ShutdownHandler >
void async_shutdown (ShutdownHandler handler)
 
template<typename Seq , typename Handler >
void async_read_some (Seq const &buffers, Handler handler)
 
template<typename Seq , typename Condition , typename Handler >
void async_read_until (Seq const &buffers, Condition condition, Handler handler)
 
template<typename Allocator , typename Handler >
void async_read_until (boost::asio::basic_streambuf< Allocator > &buffers, std::string const &delim, Handler handler)
 
template<typename Allocator , typename MatchCondition , typename Handler >
void async_read_until (boost::asio::basic_streambuf< Allocator > &buffers, MatchCondition cond, Handler handler)
 
template<typename Buf , typename Handler >
void async_write (Buf const &buffers, Handler handler)
 
template<typename Allocator , typename Handler >
void async_write (boost::asio::basic_streambuf< Allocator > &buffers, Handler handler)
 
template<typename Buf , typename Condition , typename Handler >
void async_read (Buf const &buffers, Condition cond, Handler handler)
 
template<typename Allocator , typename Condition , typename Handler >
void async_read (boost::asio::basic_streambuf< Allocator > &buffers, Condition cond, Handler handler)
 
template<typename Buf , typename Handler >
void async_read (Buf const &buffers, Handler handler)
 
template<typename Seq , typename Handler >
void async_write_some (Seq const &buffers, Handler handler)
 

Protected Member Functions

void handle_autodetect (callback cbFunc, error_code const &ec, size_t bytesTransferred)
 

Private Attributes

socket_ptr mSocket
 
bool mSecure
 
std::vector< char > mBuffer
 
beast::Journal j_
 

Detailed Description

Definition at line 17 of file AutoSocket.h.

Member Typedef Documentation

◆ ssl_socket

using AutoSocket::ssl_socket = boost::asio::ssl::stream<boost::asio::ip::tcp::socket>

Definition at line 20 of file AutoSocket.h.

◆ endpoint_type

using AutoSocket::endpoint_type = boost::asio::ip::tcp::socket::endpoint_type

Definition at line 21 of file AutoSocket.h.

◆ socket_ptr

Definition at line 22 of file AutoSocket.h.

◆ plain_socket

using AutoSocket::plain_socket = ssl_socket::next_layer_type

Definition at line 23 of file AutoSocket.h.

◆ lowest_layer_type

using AutoSocket::lowest_layer_type = ssl_socket::lowest_layer_type

Definition at line 24 of file AutoSocket.h.

◆ handshake_type

using AutoSocket::handshake_type = ssl_socket::handshake_type

Definition at line 25 of file AutoSocket.h.

◆ error_code

using AutoSocket::error_code = boost::system::error_code

Definition at line 26 of file AutoSocket.h.

◆ callback

Definition at line 27 of file AutoSocket.h.

Constructor & Destructor Documentation

◆ AutoSocket() [1/2]

AutoSocket::AutoSocket ( boost::asio::io_context &  s,
boost::asio::ssl::context &  c,
bool  secureOnly,
bool  plainOnly 
)

Definition at line 30 of file AutoSocket.h.

◆ AutoSocket() [2/2]

AutoSocket::AutoSocket ( boost::asio::io_context &  s,
boost::asio::ssl::context &  c 
)

Definition at line 42 of file AutoSocket.h.

Member Function Documentation

◆ isSecure()

bool AutoSocket::isSecure ( )

Definition at line 48 of file AutoSocket.h.

◆ SSLSocket()

ssl_socket & AutoSocket::SSLSocket ( )

Definition at line 53 of file AutoSocket.h.

◆ PlainSocket()

plain_socket & AutoSocket::PlainSocket ( )

Definition at line 58 of file AutoSocket.h.

◆ local_endpoint()

beast::IP::Endpoint AutoSocket::local_endpoint ( )

Definition at line 64 of file AutoSocket.h.

◆ remote_endpoint()

beast::IP::Endpoint AutoSocket::remote_endpoint ( )

Definition at line 70 of file AutoSocket.h.

◆ lowest_layer()

lowest_layer_type & AutoSocket::lowest_layer ( )

Definition at line 76 of file AutoSocket.h.

◆ swap()

void AutoSocket::swap ( AutoSocket s)
noexcept

Definition at line 82 of file AutoSocket.h.

◆ cancel()

boost::system::error_code AutoSocket::cancel ( boost::system::error_code &  ec)

Definition at line 90 of file AutoSocket.h.

◆ async_handshake()

void AutoSocket::async_handshake ( handshake_type  type,
callback  cbFunc 
)

Definition at line 96 of file AutoSocket.h.

◆ async_shutdown()

template<typename ShutdownHandler >
void AutoSocket::async_shutdown ( ShutdownHandler  handler)

Definition at line 129 of file AutoSocket.h.

◆ async_read_some()

template<typename Seq , typename Handler >
void AutoSocket::async_read_some ( Seq const &  buffers,
Handler  handler 
)

Definition at line 152 of file AutoSocket.h.

◆ async_read_until() [1/3]

template<typename Seq , typename Condition , typename Handler >
void AutoSocket::async_read_until ( Seq const &  buffers,
Condition  condition,
Handler  handler 
)

Definition at line 162 of file AutoSocket.h.

◆ async_read_until() [2/3]

template<typename Allocator , typename Handler >
void AutoSocket::async_read_until ( boost::asio::basic_streambuf< Allocator > &  buffers,
std::string const &  delim,
Handler  handler 
)

Definition at line 174 of file AutoSocket.h.

◆ async_read_until() [3/3]

template<typename Allocator , typename MatchCondition , typename Handler >
void AutoSocket::async_read_until ( boost::asio::basic_streambuf< Allocator > &  buffers,
MatchCondition  cond,
Handler  handler 
)

Definition at line 188 of file AutoSocket.h.

◆ async_write() [1/2]

template<typename Buf , typename Handler >
void AutoSocket::async_write ( Buf const &  buffers,
Handler  handler 
)

Definition at line 202 of file AutoSocket.h.

◆ async_write() [2/2]

template<typename Allocator , typename Handler >
void AutoSocket::async_write ( boost::asio::basic_streambuf< Allocator > &  buffers,
Handler  handler 
)

Definition at line 212 of file AutoSocket.h.

◆ async_read() [1/3]

template<typename Buf , typename Condition , typename Handler >
void AutoSocket::async_read ( Buf const &  buffers,
Condition  cond,
Handler  handler 
)

Definition at line 224 of file AutoSocket.h.

◆ async_read() [2/3]

template<typename Allocator , typename Condition , typename Handler >
void AutoSocket::async_read ( boost::asio::basic_streambuf< Allocator > &  buffers,
Condition  cond,
Handler  handler 
)

Definition at line 234 of file AutoSocket.h.

◆ async_read() [3/3]

template<typename Buf , typename Handler >
void AutoSocket::async_read ( Buf const &  buffers,
Handler  handler 
)

Definition at line 247 of file AutoSocket.h.

◆ async_write_some()

template<typename Seq , typename Handler >
void AutoSocket::async_write_some ( Seq const &  buffers,
Handler  handler 
)

Definition at line 257 of file AutoSocket.h.

◆ handle_autodetect()

void AutoSocket::handle_autodetect ( callback  cbFunc,
error_code const &  ec,
size_t  bytesTransferred 
)
protected

Definition at line 267 of file AutoSocket.h.

Member Data Documentation

◆ mSocket

socket_ptr AutoSocket::mSocket
private

Definition at line 303 of file AutoSocket.h.

◆ mSecure

bool AutoSocket::mSecure
private

Definition at line 304 of file AutoSocket.h.

◆ mBuffer

std::vector<char> AutoSocket::mBuffer
private

Definition at line 305 of file AutoSocket.h.

◆ j_

beast::Journal AutoSocket::j_
private

Definition at line 306 of file AutoSocket.h.