#include <gridclientconnection.hpp>
Public Member Functions | |
| GridClientConnection () | |
| GridClientConnection (boost::shared_ptr< boost::asio::ssl::context > ctx) | |
| virtual | ~GridClientConnection () |
| boost::asio::io_service & | getIoService () |
| boost::asio::ip::tcp::socket & | getSocket () |
| const boost::asio::ip::tcp::socket & | getSocket () const |
| virtual void | close () |
| virtual bool | isOpen () const |
| virtual bool | isConnected (const std::string &pHost, int pPort) |
| void | setConnectionTimeout (unsigned int pConnTimeout) |
| void | setReadTimeout (unsigned int pReadTimeout) |
| void | setWriteTimeout (unsigned int pWriteTimeout) |
| void | setSslContext (boost::shared_ptr< boost::asio::ssl::context > ctx) |
| virtual void | sendPing ()=0 |
| virtual std::string | toString () const |
Protected Member Functions | |
| virtual bool | verifyCertificate (bool preverified, boost::asio::ssl::verify_context &ctx) |
| bool | isSslMode () const |
| void | resetSocket () |
Protected Attributes | |
| std::string | host |
| int | port |
| boost::asio::io_service | ioSrvc |
| boost::shared_ptr < boost::asio::ip::tcp::socket > | sock |
| boost::shared_ptr < boost::asio::ssl::stream < boost::asio::ip::tcp::socket > > | sslSock |
| boost::shared_ptr < boost::asio::ssl::context > | sslCtx |
| std::string | sessToken |
| unsigned int | connTimeout |
| unsigned int | readTimeout |
| unsigned int | writeTimeout |
| boost::mutex | mux_ |
| TGridAtomicBool | closed |
Generic connection class. Current implementations are TCP and HTTP connections.
| GridClientConnection::GridClientConnection | ( | ) |
Public constructor.
| pPool | Shared pointer to a connection pool. |
| GridClientConnection::GridClientConnection | ( | boost::shared_ptr< boost::asio::ssl::context > | ctx | ) |
Public constructor.
| pPool | Shared pointer to a connection pool. | |
| ctx | Boost SSL context. |
| GridClientConnection::~GridClientConnection | ( | ) | [virtual] |
Destructor.
Connection destructor.
| void GridClientConnection::close | ( | ) | [virtual] |
| asio::io_service & GridClientConnection::getIoService | ( | ) |
Getter method for Boost IO service.
Returns an IO service for this connection.
| asio::ip::tcp::socket & GridClientConnection::getSocket | ( | ) |
Getter method for Boost socket.
Returns an underlying socket for the connection - works both for SSL and non-SSL connections.
| const asio::ip::tcp::socket & GridClientConnection::getSocket | ( | ) | const |
Getter method for Boost socket - constant version.
Returns an underlying socket for the connection - works both for SSL and non-SSL connections - const version.
| virtual bool GridClientConnection::isConnected | ( | const std::string & | pHost, | |
| int | pPort | |||
| ) | [inline, virtual] |
Test if this connection is really connected.
| pHost | Host it should be connected to. | |
| pPort | Port it should be connected to. |
| virtual bool GridClientConnection::isOpen | ( | ) | const [inline, virtual] |
Test the state of the connection.
| bool GridClientConnection::isSslMode | ( | ) | const [inline, protected] |
Tests if this socket is SSL-based or plain.
| void GridClientConnection::resetSocket | ( | ) | [protected] |
Resets the socket state.
| virtual void GridClientConnection::sendPing | ( | ) | [pure virtual] |
Sends a ping packet to the peer.
Implemented in GridClientHttpConnection, GridClientSyncTcpConnection, and GridClientRawSyncTcpConnection.
| void GridClientConnection::setConnectionTimeout | ( | unsigned int | pConnTimeout | ) | [inline] |
Sets a new value for the connection timeout associated with this connection.
| pConnTimeout | New value for connection timeout. |
| void GridClientConnection::setReadTimeout | ( | unsigned int | pReadTimeout | ) | [inline] |
Sets a new value for the connection timeout associated with this connection.
| pConnTimeout | New value for connection timeout. |
| void GridClientConnection::setSslContext | ( | boost::shared_ptr< boost::asio::ssl::context > | ctx | ) | [inline] |
Sets a new value for the connection timeout associated with this connection.
| pConnTimeout | New value for connection timeout. |
| void GridClientConnection::setWriteTimeout | ( | unsigned int | pWriteTimeout | ) | [inline] |
Sets a new value for the connection timeout associated with this connection.
| pConnTimeout | New value for connection timeout. |
| virtual std::string GridClientConnection::toString | ( | ) | const [inline, virtual] |
Returns a string representation of this connection.
| virtual bool GridClientConnection::verifyCertificate | ( | bool | preverified, | |
| boost::asio::ssl::verify_context & | ctx | |||
| ) | [protected, virtual] |
Verifies certificate. Returns true to follow calling conventions. Throws exception in case of problems.
TGridAtomicBool GridClientConnection::closed [protected] |
Closed flag.
unsigned int GridClientConnection::connTimeout [protected] |
Connection timeout.
std::string GridClientConnection::host [protected] |
Host associated with this connection.
boost::asio::io_service GridClientConnection::ioSrvc [protected] |
Boost IO service.
boost::mutex GridClientConnection::mux_ [mutable, protected] |
Synchronization for the underlying socket.
int GridClientConnection::port [protected] |
Port associated with this connection.
unsigned int GridClientConnection::readTimeout [protected] |
Read timeout.
std::string GridClientConnection::sessToken [protected] |
Session token associated with this connection.
boost::shared_ptr<boost::asio::ip::tcp::socket> GridClientConnection::sock [protected] |
Boost socket.
boost::shared_ptr<boost::asio::ssl::context> GridClientConnection::sslCtx [protected] |
Boost SSL context.
boost::shared_ptr<boost::asio::ssl::stream<boost::asio::ip::tcp::socket> > GridClientConnection::sslSock [protected] |
Boost SSL socket.
unsigned int GridClientConnection::writeTimeout [protected] |
Write timeout.
1.7.1