#include <connectionbase.h>
Inherited by ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS.
Inheritance diagram for ConnectionBase:

Public Member Functions | |
| ConnectionBase (ConnectionDataHandler *cdh) | |
| virtual | ~ConnectionBase () |
| virtual ConnectionError | connect ()=0 |
| virtual ConnectionError | recv (int timeout=-1)=0 |
| virtual bool | send (const std::string &data)=0 |
| virtual ConnectionError | receive ()=0 |
| virtual void | disconnect ()=0 |
| virtual void | cleanup () |
| ConnectionState | state () const |
| void | registerConnectionDataHandler (ConnectionDataHandler *cdh) |
| void | setServer (const std::string &server, int port=-1) |
| const std::string & | server () const |
| int | port () const |
| virtual int | localPort () const |
| virtual const std::string | localInterface () const |
| virtual void | getStatistics (long int &totalIn, long int &totalOut)=0 |
| virtual ConnectionBase * | newInstance () const =0 |
Protected Attributes | |
| ConnectionDataHandler * | m_handler |
| ConnectionState | m_state |
| std::string | m_server |
| int | m_port |
You should not need to use this class directly.
Definition at line 34 of file connectionbase.h.
|
|
Constructor.
Definition at line 42 of file connectionbase.h. |
|
|
Virtual destructor. Definition at line 49 of file connectionbase.h. |
|
|
This function is called after a disconnect to clean up internal state. It is also called by ConnectionBase's destructor. Reimplemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS. Definition at line 89 of file connectionbase.h. |
|
|
Used to initiate the connection.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPClient, ConnectionTCPServer, and ConnectionTLS. |
|
|
Disconnects an established connection. NOOP if no active connection exists. Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS. |
|
||||||||||||
|
Returns current connection statistics.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS. |
|
|
Returns the locally bound IP address.
Reimplemented in ConnectionTCPBase. Definition at line 133 of file connectionbase.h. |
|
|
Returns the local port.
Reimplemented in ConnectionTCPBase. Definition at line 127 of file connectionbase.h. |
|
|
This function returns a new instance of the current ConnectionBase-derived object. The idea is to be able to 'clone' ConnectionBase-derived objects without knowing of what type they are exactly.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPClient, ConnectionTCPServer, ConnectionTLS, and ConnectionTLSServer. |
|
|
Returns the currently set port.
Definition at line 121 of file connectionbase.h. |
|
|
Use this function to put the connection into 'receive mode', i.e. this function returns only when the connection is terminated.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS. |
|
|
Use this periodically to receive data from the socket.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPClient, ConnectionTCPServer, and ConnectionTLS. |
|
|
Use this function to register a new ConnectionDataHandler. There can be only one ConnectionDataHandler at any one time.
Definition at line 102 of file connectionbase.h. |
|
|
Use this function to send a string of data over the wire. The function returns only after all data has been sent.
Implemented in ConnectionBOSH, ConnectionHTTPProxy, ConnectionSOCKS5Proxy, ConnectionTCPBase, and ConnectionTLS. |
|
|
Returns the currently set server/IP.
Definition at line 115 of file connectionbase.h. |
|
||||||||||||
|
Sets the server to connect to.
Reimplemented in ConnectionHTTPProxy. Definition at line 109 of file connectionbase.h. |
|
|
Returns the current connection state.
Definition at line 95 of file connectionbase.h. |
|
|
A handler for incoming data and connect/disconnect events. Definition at line 152 of file connectionbase.h. |
|
|
Holds the port to connect to. Definition at line 161 of file connectionbase.h. |
|
|
Holds the server's name/address. Definition at line 158 of file connectionbase.h. |
|
|
Holds the current connection state. Definition at line 155 of file connectionbase.h. |
1.4.1