Logo Search packages:      
Sourcecode: kmess version File versions  Download package

MsnSocketTcp Class Reference
[network]

#include <msnsockettcp.h>

Inheritance diagram for MsnSocketTcp:

MsnSocketBase

List of all members.


Detailed Description

Basic I/O functionality for the MSN server protocol over a TCP connection.

The class provides the following facilities:

Data from the server is handled by the slotSocketDataReceived() slot. This method buffers and processes the data, until a complete command or payload message is received. Then a signal with the full message contents is forwarded to MsnConnection, which manages it. This class only handles the parsing of socket input, the handling the commands happens in the MsnConnection class.

Author:
Mike K. Bennett

Valerio Pilo <valerio@kmess.org>

Definition at line 50 of file msnsockettcp.h.


Public Types

enum  ErrorType {
  ERROR_UNKNOWN = 0, ERROR_CONNECTING, ERROR_CONNECTING_GATEWAY, ERROR_DROP,
  ERROR_DATA, ERROR_CONNECTION_TIME_LIMIT, ERROR_CONNECTION_OTHER, ERROR_AUTH_TIME_LIMIT,
  ERROR_AUTH_LOGIN, ERROR_AUTH_COMPUTATION, ERROR_USER, ERROR_SERVER,
  ERROR_INTERNAL, ERROR_SOAP_UNKNOWN, ERROR_SOAP_RESPONSE, ERROR_SOAP_TIME_LIMIT,
  ERROR_SOAP_AUTHENTICATION, ERROR_SOAP_TOOMANYREDIRECTS
}
 Types of errors with connection sockets. More...
enum  ServerType { SERVER_NOTIFICATION, SERVER_SWITCHBOARD }
 Type of server that will be connected from this socket. More...

Signals

void connected ()
void dataReceived (const QStringList &commandLine, const QByteArray &payloadData)
void disconnected ()
void error (QString error, MsnSocketBase::ErrorType type)
void pingSent ()
void statusMessage (QString message, bool isError)

Public Member Functions

void connectToServer (const QString &server=QString(), const quint16 port=0)
 Connect to the given server via the socket.
void disconnectFromServer (bool isTransfer=false)
 Disconnect from the server.
QStringList getAcceptedPayloadCommands ()
 Return which payload commands are accepted by this connection.
QString getLocalIp () const
 Return the local IP address of the socket.
virtual ServerType getServerType () const
 Return the type of server connection managed by the socket.
bool isConnected () const
 Return whether or the socket is connected.
bool isErrorCommand (const QString &command) const
 Test whether the given command is an error.
virtual bool isPayloadCommand (const QString &command) const
 Test whether the given command is a payload command.
 MsnSocketTcp (ServerType serverType)
 The constructor.
virtual void setAcceptedPayloadCommands (QStringList commandList)
 Specify which accepted commands carry payload data for this connection.
void setSendPings (bool sendPings)
qint64 writeBinaryData (const QByteArray &data)
qint64 writeData (const QString &data)
virtual ~MsnSocketTcp ()
 The destructor.

Protected Slots

virtual void proxyAuthenticate (const QNetworkProxy &proxy, QAuthenticator *authenticator)

Protected Attributes

bool connected_
ServerType serverType_

Private Slots

void slotConnected ()
 Called when the connection has been successfully opened.
void slotDisconnected ()
 Called when the connection has been closed.
void slotHostFound ()
 Called when the server's IP address has been found.
void slotLoginFailed ()
 Called when the connection did not complete within a time limit.
void slotSendPing ()
void slotSocketDataReceived ()
 Called when data is received from the server.
void slotSocketError (QAbstractSocket::SocketError errorCode)
 Detect socket errors.

Private Attributes

QStringList acceptedPayloadCommands_
QTimer connectionTimer_
int missedPings_
QStringList nextPayloadCommand_
int nextPayloadSize_
bool pingReceived_
QTimer pingTimer_
bool sendPings_
QTcpSocket * socket_

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index