#include <TCPAuthClient.hpp>
Inheritance diagram for Ionflux::Tools::TCPAuthClient:
Public Member Functions | |
TCPAuthClient () | |
Constructor. | |
TCPAuthClient (bool initInteractive) | |
Constructor. | |
TCPAuthClient (const std::string &initUsername, const std::string &initPassword, bool initInteractive) | |
Constructor. | |
virtual | ~TCPAuthClient () |
Destructor. | |
virtual void | onMessage (TCPRemotePeer &peer) |
Event handler for received messages. | |
virtual void | onInvalidMessage (TCPRemotePeer &peer) |
Event handler for invalid messages. | |
virtual void | broadcast (const std::string &bytes) |
Broadcast bytes. | |
virtual bool | addConnection (const std::string &host, int port, const std::string &connUser, const std::string &connPass) |
Add connection. | |
virtual void | setUsername (const std::string &newUsername) |
Set username. | |
virtual void | setPassword (const std::string &newPassword) |
Set password. | |
virtual void | setCurrentMsgID (unsigned int newCurrentMsgID) |
Set current Message ID. | |
virtual std::string | getUsername () |
Get username. | |
virtual void | getPassword (std::string &target) |
Get password. | |
virtual unsigned int | getCurrentMsgID () |
Get current Message ID. | |
Static Public Attributes | |
static const std::string | MAGIC_WORD = "IFTA" |
Magic word. | |
static const unsigned int | AUTH_VERSION = 0x000001L |
Protocol version. | |
static const unsigned int | AUTH_VERSION_UPPER = 0x000001L |
Protocol version (upper boundary). | |
static const unsigned int | AUTH_VERSION_LOWER = 0x000001L |
Protocol version (lower boundary). | |
static const int | MSGID_HELLO = 101 |
Message type ID: HELLO. | |
static const int | MSGID_WELCOME = 201 |
Message type ID: WELCOME. | |
static const int | MSGID_AUTH = 102 |
Message type ID: AUTH. | |
static const int | MSGID_AUTH_OK = 202 |
Message type ID: AUTH_OK. | |
static const int | MSGID_AUTH_FAILED = 401 |
Message type ID: AUTH_FAILED. | |
static const int | PS_WAIT_WELCOME = 1 |
Protocol state: Wait for WELCOME. | |
static const int | PS_WAIT_AUTH_RESULT = 2 |
Protocol state: Wait for AUTH result. | |
static const int | PS_AUTH_OK = 3 |
Protocol state: Authentication succeeded. | |
Protected Member Functions | |
virtual void | onConnect (TCPRemotePeer &peer) |
Event handler for new connections. | |
virtual void | onAuthMessage (TCPRemotePeer &peer) |
Event handler for authenticated messages. | |
virtual void | onAuthOK (TCPRemotePeer &peer) |
Event handler for successful authentication. | |
virtual void | onAuthFailed (TCPRemotePeer &peer) |
Event handler for failed authentication. | |
Protected Attributes | |
std::string | username |
Username. | |
std::string | password |
Password. | |
unsigned int | currentMsgID |
Current Message ID. |
A Message based TCP client supporting a simple authentication protocol.
See misc/ifta.txt for a specification of the authentication protocol.
|
Constructor. Construct new TCPAuthClient object. |
|
Constructor. Construct new TCPAuthClient object.
|
|
Constructor. Construct new TCPAuthClient object.
|
|
Destructor. Destruct TCPAuthClient object. |
|
Add connection. Attempts to establish a connection to the specified host and port. On success, the new connection will be maintained by the TCP client.
|
|
Broadcast bytes. Sends the specified byte string to all connected peers.
Reimplemented from Ionflux::Tools::TCPMessageClient. |
|
Get current Message ID.
|
|
Get password.
|
|
Get username.
|
|
Event handler for failed authentication. This is called when authentication with a peer has failed.
|
|
Event handler for authenticated messages. This is called whenever a message is received from an authenticated peer. The received message will be available from TCPRemotePeer::getMessage().
|
|
Event handler for successful authentication. This is called when authentication with a peer has succeeded.
|
|
Event handler for new connections. This is called by the main loop whenever a connection to a peer is successfully established.
Reimplemented from Ionflux::Tools::TCPMessageClient. |
|
Event handler for invalid messages. This is called whenever an invalid message is received from a peer.
Reimplemented from Ionflux::Tools::TCPMessageClient. |
|
Event handler for received messages. This is called whenever a valid message is received from a peer. The received message will be available from TCPRemotePeer::getMessage().
Reimplemented from Ionflux::Tools::TCPMessageClient. |
|
Set current Message ID. Set new value of current Message ID.
|
|
Set password. Set new value of password.
|
|
Set username. Set new value of username.
|
|
Protocol version.
|
|
Protocol version (lower boundary).
|
|
Protocol version (upper boundary).
|
|
Current Message ID.
|
|
Magic word.
|
|
Message type ID: AUTH.
|
|
Message type ID: AUTH_FAILED.
|
|
Message type ID: AUTH_OK.
|
|
Message type ID: HELLO.
|
|
Message type ID: WELCOME.
|
|
Password.
|
|
Protocol state: Authentication succeeded.
|
|
Protocol state: Wait for AUTH result.
|
|
Protocol state: Wait for WELCOME.
|
|
Username.
|