#include <connection.h>
Inheritance diagram for MSN::Connection:
Connection provides an interface and some functionality that is common to notification, switchboard and file transfer connections.
Public Member Functions | |
Connection () | |
virtual | ~Connection () |
virtual void | dispatchCommand (std::vector< std::string > &args)=0 |
Dispatch a command to its appropriate handler routines based on args. | |
std::vector< std::string > | getLine () |
Read a line from the network and split it into its components. | |
bool | isWholeLineAvailable () |
bool | bytesAvailable () |
virtual size_t | write (std::string s, bool log=true) throw (std::runtime_error) |
Write a string to the connection. | |
virtual size_t | write (std::ostringstream &s, bool log=true) throw (std::runtime_error) |
Write the contents of a stringstream to the connection. | |
virtual void | connect (const std::string &hostname, unsigned int port)=0 |
Connect ourself to hostname on port. | |
virtual void | disconnect ()=0 |
void | showError (int errorCode) |
Notify the calling library that an error with code errorCode has occured. | |
bool | isConnected () |
Is this Connection connected to a remote endpoint? | |
virtual NotificationServerConnection * | myNotificationServer ()=0 |
External Socket Hooks | |
These members should be called whenever an appropriate socket event occurs. | |
virtual void | dataArrivedOnSocket () |
New data is available on the connection. | |
virtual void | socketConnectionCompleted () |
The connection has been established. | |
virtual void | socketIsWritable () |
virtual void | errorOnSocket (int errno_) |
An error has occurred on the socket. | |
Public Attributes | |
int | sock |
The socket which connects this Connection to another computer. | |
bool | connected |
Indicates whether a connection has been established. | |
void * | user_data |
Protected Member Functions | |
void | handle_MSG (std::vector< std::string > &args) |
Process a command. | |
virtual void | handleIncomingData ()=0 |
Protected Attributes | |
int | trID |
The transaction ID of the next command to be sent. | |
std::string | readBuffer |
|
|
|
|
|
|
|
Connect ourself to hostname on port.
Implemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
New data is available on the connection.
Reimplemented in MSN::FileTransferConnection. |
|
Implemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
Dispatch a command to its appropriate handler routines based on args.
Implemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
An error has occurred on the socket.
|
|
Read a line from the network and split it into its components. MSN commands and their arguments are separated by white space. |
|
Process a
This method will read the remaining message data from the network @ and then delegates to private |
|
Implemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
Is this Connection connected to a remote endpoint?
|
|
|
|
Implemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
Notify the calling library that an error with code errorCode has occured.
|
|
The connection has been established.
Reimplemented in MSN::FileTransferConnection, MSN::NotificationServerConnection, and MSN::SwitchboardServerConnection. |
|
Reimplemented in MSN::FileTransferConnection. |
|
Write the contents of a stringstream to the connection.
|
|
Write a string to the connection.
|
|
Indicates whether a connection has been established.
|
|
|
|
The socket which connects this Connection to another computer.
|
|
The transaction ID of the next command to be sent.
|
|
|