libmsn 4.2.1
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
MSN::Connection Class Reference

#include <connection.h>

Inheritance diagram for MSN::Connection:
MSN::NotificationServerConnection MSN::Soap MSN::SwitchboardServerConnection

List of all members.

Public Member Functions

virtual void dispatchCommand (std::vector< std::string > &args)=0
std::vector< std::string > getLine ()
bool isWholeLineAvailable ()
bool bytesAvailable ()
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
virtual void disconnect ()=0
void showError (int errorCode)
bool isConnected ()
virtual
NotificationServerConnection
myNotificationServer ()=0
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

Protected Member Functions

virtual void handleIncomingData ()=0

Protected Attributes

std::string readBuffer

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:
argsA 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::string  s,
bool  log = true 
) throw (std::runtime_error) [virtual]

Write a string to the connection.

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:
sThe stringstream to write.
logShould 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.


Member Data Documentation

Indicates whether a connection has been established.

The socket which connects this Connection to another computer

Deprecated:
In the future, this member will be made private. Any functions that access this member should be converted to member functions of a subclass.

The transaction ID of the next command to be sent.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Enumerator