MSN::Connection Class Reference

#include <connection.h>

Inheritance diagram for MSN::Connection:

Inheritance graph
[legend]

List of all members.

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


Detailed Description

An abstract base class that represents a connection to another computer.

Connection provides an interface and some functionality that is common to notification, switchboard and file transfer connections.


Member Function Documentation

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.

Parameters:
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.

Parameters:
s The stringstream to write.
log Should we log this output to the console.
write will buffer the output if a connection has not yet been established. In this case, the data will be written as soon as a connection is established.

size_t MSN::Connection::write ( std::string  s,
bool  log = true 
) throw (std::runtime_error) [virtual]

Write a string to the connection.


Member Data Documentation

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.


Generated on Tue Nov 10 15:24:27 2009 for libmsn by  doxygen 1.5.9