![]() |
staticlib_pion
2.0.2
|
Represents a single tcp connection. More...
#include <staticlib/pion/tcp_connection.hpp>
Public Types | |
| enum | lifecycle |
| Data type for the connection's current_lifecycle state. More... | |
Public Member Functions | |
| tcp_connection (asio::io_service &io_service, ssl_context_type &ssl_context, const bool ssl_flag_in, connection_handler finished_handler_in) | |
Constructor to be used with std::make_shared | |
| tcp_connection (const tcp_connection &) | |
| Deleted copy constructor. | |
| tcp_connection & | operator= (const tcp_connection &) |
| Deleted copy assignment operator. | |
| virtual | ~tcp_connection () |
| Virtual destructor. | |
| bool | is_open () const |
| Returns true if the connection is currently open. | |
| void | close () |
| Closes the tcp socket and cancels any pending asynchronous operations. | |
| void | cancel () |
| Cancels any asynchronous operations pending on the socket. | |
| void | cancel_timer () |
| Cancels timer. | |
| template<typename AcceptHandler > | |
| void | async_accept (asio::ip::tcp::acceptor &tcp_acceptor, AcceptHandler handler) |
| Asynchronously accepts a new tcp connection. | |
| template<typename SSLHandshakeHandler > | |
| void | async_handshake_server (SSLHandshakeHandler handler) |
| Asynchronously performs server-side SSL handshake for a new connection. | |
| template<typename ReadHandler > | |
| void | async_read_some (ReadHandler handler) |
| Asynchronously reads some data into the connection's read buffer. | |
| template<typename ConstBufferSequence , typename write_handler_t > | |
| void | async_write (const ConstBufferSequence &buffers, write_handler_t handler) |
| Asynchronously writes data to the connection. | |
| void | finish () |
| This function should be called when a server has finished handling the connection. | |
| bool | get_ssl_flag () const |
| Returns true if the connection is encrypted using SSL. | |
| void | set_lifecycle (lifecycle lcycle) |
| Sets the lifecycle for the connection. | |
| bool | get_keep_alive () const |
| Returns true if the connection should be kept alive. | |
| bool | is_pipelined () const |
| Returns true if the HTTP requests are pipelined. | |
| read_buffer_type & | get_read_buffer () |
| Returns the buffer used for reading data from the TCP connection. | |
| void | save_read_pos (const char *read_ptr, const char *read_end_ptr) |
| Saves a read position bookmark. | |
| void | load_read_pos (const char *&read_ptr, const char *&read_end_ptr) const |
| Loads a read position bookmark. | |
| asio::ip::tcp::endpoint | get_remote_endpoint () const |
| Returns an ASIO endpoint for the client connection. | |
| asio::ip::address | get_remote_ip () const |
| Returns the client's IP address. | |
| unsigned short | get_remote_port () const |
| Returns the client's port number. | |
| asio::io_service & | get_io_service () |
| Returns reference to the io_service used for async operations. | |
| socket_type & | get_socket () |
| Returns non-const reference to underlying TCP socket object. | |
| ssl_socket_type & | get_ssl_socket () |
| Returns non-const reference to underlying SSL socket object. | |
| asio::io_service::strand & | get_strand () |
| Returns the strand that can be used with this connection. | |
| asio::steady_timer & | get_timer () |
| Returns the timer that can be used with this connection. | |
Represents a single tcp connection.
Data type for the connection's current_lifecycle state.
|
inline |
Constructor to be used with std::make_shared
| io_service | asio service associated with the connection |
| ssl_context | asio ssl context associated with the connection |
| ssl_flag | if true then the connection will be encrypted using SSL |
| finished_handler | function called when a server has finished handling the connection |
| staticlib::pion::tcp_connection::tcp_connection | ( | const tcp_connection & | ) |
Deleted copy constructor.
|
inlinevirtual |
Virtual destructor.
|
inline |
Asynchronously accepts a new tcp connection.
| tcp_acceptor | object used to accept new connections |
| handler | called after a new connection has been accepted |
|
inline |
Asynchronously performs server-side SSL handshake for a new connection.
| handler | called after the ssl handshake has completed |
|
inline |
Asynchronously reads some data into the connection's read buffer.
| handler | called after the read operation has completed |
|
inline |
Asynchronously writes data to the connection.
| buffers | one or more buffers containing the data to be written |
| handler | called after the data has been written |
|
inline |
Cancels any asynchronous operations pending on the socket.
|
inline |
Cancels timer.
|
inline |
Closes the tcp socket and cancels any pending asynchronous operations.
|
inline |
This function should be called when a server has finished handling the connection.
|
inline |
Returns reference to the io_service used for async operations.
|
inline |
Returns true if the connection should be kept alive.
|
inline |
Returns the buffer used for reading data from the TCP connection.
|
inline |
Returns an ASIO endpoint for the client connection.
|
inline |
Returns the client's IP address.
|
inline |
Returns the client's port number.
|
inline |
Returns non-const reference to underlying TCP socket object.
|
inline |
Returns true if the connection is encrypted using SSL.
|
inline |
Returns non-const reference to underlying SSL socket object.
|
inline |
Returns the strand that can be used with this connection.
|
inline |
Returns the timer that can be used with this connection.
|
inline |
Returns true if the connection is currently open.
|
inline |
Returns true if the HTTP requests are pipelined.
|
inline |
Loads a read position bookmark.
| read_ptr | points to the next character to be consumed in the read_buffer |
| read_end_ptr | points to the end of the read_buffer (last byte + 1) |
| tcp_connection& staticlib::pion::tcp_connection::operator= | ( | const tcp_connection & | ) |
Deleted copy assignment operator.
|
inline |
Saves a read position bookmark.
| read_ptr | points to the next character to be consumed in the read_buffer |
| read_end_ptr | points to the end of the read_buffer (last byte + 1) |
|
inline |
Sets the lifecycle for the connection.
| lcycle | lifecycle type name |
1.8.1.2