#include <connection.h>
Public Member Functions | |
virtual void | dispatchCommand (std::vector< std::string > &args)=0 |
std::vector< std::string > | getLine () |
virtual size_t | write (std::string s, bool log=true) throw (std::runtime_error) |
virtual size_t | write (std::ostringstream &s, bool log=true) throw (std::runtime_error) |
virtual void | connect (const std::string &hostname, unsigned int port)=0 |
void | showError (int errorCode) |
bool | isConnected () |
External Socket Hooks | |
These members should be called whenever an appropriate socket event occurs. | |
virtual void | dataArrivedOnSocket () |
virtual void | socketConnectionCompleted () |
virtual void | socketIsWritable () |
virtual void | errorOnSocket (int errno_) |
Public Attributes | |
void * | sock |
bool | connected |
int | trID |
Connection provides an interface and some functionality that is common to notification, switchboard and file transfer connections.
virtual void MSN::Connection::connect | ( | const std::string & | hostname, | |
unsigned int | port | |||
) | [pure virtual] |
Connect ourself to hostname on port.
Implemented in MSN::NotificationServerConnection, MSN::Soap, and MSN::SwitchboardServerConnection.
void MSN::Connection::dataArrivedOnSocket | ( | ) | [virtual] |
New data is available on the connection.
virtual void MSN::Connection::dispatchCommand | ( | std::vector< std::string > & | args | ) | [pure virtual] |
Dispatch a command to its appropriate handler routines based on args.
args | A vector of strings containing arguments, returned from readLine. |
Implemented in MSN::NotificationServerConnection, MSN::Soap, and MSN::SwitchboardServerConnection.
void MSN::Connection::errorOnSocket | ( | int | errno_ | ) | [virtual] |
An error has occurred on the socket.
std::vector< std::string > MSN::Connection::getLine | ( | ) |
Read a line from the network and split it into its components.
MSN commands and their arguments are separated by white space.
bool MSN::Connection::isConnected | ( | ) | [inline] |
Is this Connection connected to a remote endpoint?
void MSN::Connection::showError | ( | int | errorCode | ) |
Notify the calling library that an error with code errorCode has occured.
void MSN::Connection::socketConnectionCompleted | ( | ) | [virtual] |
The connection has been established.
Reimplemented in MSN::NotificationServerConnection, MSN::Soap, and MSN::SwitchboardServerConnection.
size_t MSN::Connection::write | ( | std::ostringstream & | s, | |
bool | log = true | |||
) | throw (std::runtime_error) [virtual] |
Write the contents of a stringstream to the connection.
s | The stringstream to write. | |
log | Should we log this output to the console. |
size_t MSN::Connection::write | ( | std::string | s, | |
bool | log = true | |||
) | throw (std::runtime_error) [virtual] |
Write a string to the connection.
Indicates whether a connection has been established.
void* MSN::Connection::sock |
The socket which connects this Connection to another computer
The transaction ID of the next command to be sent.