8 #ifndef DIAG_CLIENT_LIB_LIB_BOOST_SUPPORT_SOCKET_TLS_TLS_SOCKET_H_
9 #define DIAG_CLIENT_LIB_LIB_BOOST_SUPPORT_SOCKET_TLS_TLS_SOCKET_H_
11 #include <boost/asio.hpp>
56 using Tcp = boost::asio::ip::tcp;
73 TlsSocket(std::string_view local_ip_address, std::uint16_t local_port_num,
119 std::uint16_t host_port_num) noexcept;
Immutable class to store received tcp message.
Wrapper class to hold boost io context required for io object( sockets)
Tls context class responsible for setting cipher suite and loading certificates.
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
TlsSocket(std::string_view local_ip_address, std::uint16_t local_port_num, TlsContext &tls_context, IoContext &io_context) noexcept
Constructs an instance of TcpSocket.
boost::system::error_code TcpErrorCodeType
Type alias for tcp error codes.
core_type::Result< TcpMessagePtr, SocketError > Read() noexcept
Function to read message from socket.
~TlsSocket() noexcept
Destruct an instance of TcpSocket.
boost::asio::ssl::stream< Tcp::socket > SslStream
Type alias for tcp socket.
boost_support::message::tcp::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
TlsSocket(const TlsSocket &other) noexcept=delete
Deleted copy assignment and copy constructor.
SslStream::lowest_layer_type & GetNativeTcpSocket()
Function to get the native tcp socket under tls socket.
SocketError
Socket error code.
core_type::Result< void, SocketError > Close() noexcept
Function to destroy the socket.
boost::asio::ip::tcp Tcp
Type alias for tcp protocol.
boost_support::message::tcp::TcpMessageConstPtr TcpMessageConstPtr
Type alias for Tcp message const pointer.
boost::asio::ip::address TcpIpAddress
Type alias for tcp ip address.
TlsSocket & operator=(const TlsSocket &other) noexcept=delete
SslStream ssl_stream_
Store the underlying tcp socket.
core_type::Result< void, SocketError > Open() noexcept
Function to open and bind the socket to provided ip address & port.
core_type::Result< void, SocketError > Connect(std::string_view host_ip_address, std::uint16_t host_port_num) noexcept
Function to connect to remote ip address and port number.
Tcp::endpoint local_endpoint_
Store the local endpoints.
Tcp::socket TcpSocket
Type alias for tcp socket.
core_type::Result< void, SocketError > Transmit(TcpMessageConstPtr tcp_message) noexcept
Function to trigger transmission.
core_type::Result< void, SocketError > Disconnect() noexcept
Function to Disconnect from host.
std::unique_ptr< TcpMessage > TcpMessagePtr
The unique pointer to TcpMessage.
std::unique_ptr< TcpMessage const > TcpMessageConstPtr
The unique pointer to const TcpMessage.
core_type::Result< T, E > Result
Class type to contains a value (of type ValueType), or an error (of type ErrorType)