KVIrc  4.9.2
DeveloperAPIs
Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
KviIrcLink Class Reference

Middle stack class for IRC connection. More...

#include <KviIrcLink.h>

+ Inheritance diagram for KviIrcLink:

Public Types

enum  State { Idle, Connecting, Connected }
 

Signals

void connectionFailed ()
 Emitted when the connection attempt has failed. More...
 

Public Member Functions

KviIrcConnectionconnection ()
 Returns the connection object. More...
 
KviConsoleWindowconsole ()
 Returns the console. More...
 
KviIrcSocketsocket ()
 Returns the socket. More...
 
State state ()
 Returns the state of the socket. More...
 

Protected Slots

void linkFilterDestroyed ()
 Called when the link filter has been destroyed without permission :D. More...
 

Protected Member Functions

void abort ()
 Aborts any connection or attempt. More...
 
virtual void clearOutputQueue (bool bPrivateMessagesOnly)
 Clears the output queue. More...
 
 KviIrcLink (KviIrcConnection *pConnection)
 Constructs the IrcLink object. More...
 
unsigned int outputQueueSize ()
 Returns the current size of the output queue. More...
 
void processData (char *buffer, int iLength)
 Process a packet of raw data from the server. More...
 
virtual bool sendPacket (KviDataBuffer *pData)
 Sends a data packet. More...
 
void socketStateChange ()
 Called at each state change. More...
 
void start ()
 Starts a connection attempt. More...
 
 ~KviIrcLink ()
 Destroys the IrcLink object. More...
 

Private Slots

void resolverTerminated ()
 Called when the DNS lookup has terminated. More...
 

Private Member Functions

void createSocket (const QString &szLinkFilterName)
 Creates the socket. More...
 
void destroySocket ()
 Destroys the socket. More...
 

Private Attributes

State m_eState
 
KviIrcConnectionm_pConnection
 
KviConsoleWindowm_pConsole
 
KviMexLinkFilterm_pLinkFilter
 
char * m_pReadBuffer
 
KviIrcConnectionTargetResolverm_pResolver
 
KviIrcSocketm_pSocket
 
KviIrcConnectionTargetm_pTarget
 
unsigned int m_uReadBufferLen
 
unsigned int m_uReadPackets
 

Friends

class KviIrcConnection
 
class KviIrcSocket
 

Detailed Description

Middle stack class for IRC connection.

This class gets data from KviIrcSocket and pass it to KviIrcConnection

Member Enumeration Documentation

Enumerator
Idle 

Socket idling

Connecting 

Socket connecting

Connected 

Socket connected

Constructor & Destructor Documentation

KviIrcLink::KviIrcLink ( KviIrcConnection pConnection)
protected

Constructs the IrcLink object.

Only KviConsoleWindow can create this. pConsole must NOT be null; pServer is a shallow pointer: Connection makes a copy of it internally, must NOT be null; pProxy may be null if a proxy is not desired. Connection makes a copy of it internally;

Parameters
pConnectionThe pointer to the KviIrcConnection class
Returns
KviIrcLink

References KviIrcConnection::console(), Idle, m_eState, m_pConnection, m_pConsole, m_pLinkFilter, m_pReadBuffer, m_pResolver, m_pSocket, m_pTarget, m_uReadBufferLen, m_uReadPackets, and KviIrcConnection::target().

KviIrcLink::~KviIrcLink ( )
protected

Destroys the IrcLink object.

References destroySocket(), KviMemory::free(), m_pReadBuffer, and m_pResolver.

Member Function Documentation

void KviIrcLink::abort ( )
protected

Aborts any connection or attempt.

Returns
void

References KviIrcConnectionTargetResolver::abort(), KviIrcSocket::abort(), m_pResolver, and m_pSocket.

Referenced by KviIrcConnection::abort().

void KviIrcLink::clearOutputQueue ( bool  bPrivateMessagesOnly)
protectedvirtual

Clears the output queue.

Requests to clear the underlying packet queue.

References KviMexLinkFilter::clearOutputQueue(), KviIrcSocket::clearOutputQueue(), m_pLinkFilter, and m_pSocket.

Referenced by KviIrcConnection::clearOutputQueue().

KviIrcConnection* KviIrcLink::connection ( )
inline

Returns the connection object.

Never null

Returns
KviIrcConnection *

Referenced by socketStateChange().

void KviIrcLink::connectionFailed ( )
signal

Emitted when the connection attempt has failed.

Returns
void
KviConsoleWindow* KviIrcLink::console ( )
inline

Returns the console.

Never null

Returns
KviConsoleWindow *

References KviIrcSocket::m_pConsole.

Referenced by KviIrcSocket::KviIrcSocket().

void KviIrcLink::createSocket ( const QString &  szLinkFilterName)
private
void KviIrcLink::destroySocket ( )
private

Destroys the socket.

Returns
void

References KviModuleExtension::die(), m_pLinkFilter, and m_pSocket.

Referenced by createSocket(), and ~KviIrcLink().

void KviIrcLink::linkFilterDestroyed ( )
protectedslot

Called when the link filter has been destroyed without permission :D.

This should NEVER happen (?) This is part of the KviIrcSocket management

Returns
void

References __tr2qs, KVI_OUT_SYSTEMWARNING, m_pConsole, m_pLinkFilter, and KviWindow::output().

Referenced by createSocket().

unsigned int KviIrcLink::outputQueueSize ( )
protected

Returns the current size of the output queue.

Returns
unsigned int

References m_pLinkFilter, m_pSocket, KviMexLinkFilter::outputQueueSize(), and KviIrcSocket::outputQueueSize().

Referenced by KviIrcConnection::outputQueueSize().

void KviIrcLink::processData ( char *  buffer,
int  iLength 
)
protected

Process a packet of raw data from the server.

This is called by KviIrcSocket. The buffer is iLength+1 bytes long and contains a null terminator It's an interface for KviIrcSocket (lower protocol in stack)

Parameters
bufferThe buffer :)
iLengthThe length of the buffer
Returns
void

References KviMemory::allocate(), KviIrcSocket::Connected, KviMemory::free(), KviIrcConnection::incomingMessage(), KVI_ASSERT, m_pConnection, m_pLinkFilter, m_pReadBuffer, m_pSocket, m_uReadBufferLen, m_uReadPackets, KviMemory::move(), p, KviMexLinkFilter::processData(), KviMemory::reallocate(), and KviIrcSocket::state().

Referenced by KviIrcSocket::readData().

void KviIrcLink::resolverTerminated ( )
privateslot
bool KviIrcLink::sendPacket ( KviDataBuffer pData)
protectedvirtual

Sends a data packet.

This is used by KviIrcConnection::send*() This should be used to intercept the outgoing packets when implementing a new protocol. It's an interface for KviIrcConnection (upper protocol in stack)

Parameters
pDataThe pointer to the data packet
Returns
bool

References m_pLinkFilter, m_pSocket, KviMexLinkFilter::sendPacket(), and KviIrcSocket::sendPacket().

Referenced by KviIrcConnection::sendData(), and KviIrcConnection::sendFmtData().

KviIrcSocket* KviIrcLink::socket ( )
inline

Returns the socket.

May be null!

Returns
KviIrcSocket *

References m_pSocket.

Referenced by context_kvs_fnc_getSSLCertInfo(), dcc_kvs_get_listen_ip_address(), and socketStateChange().

void KviIrcLink::socketStateChange ( )
protected
void KviIrcLink::start ( )
protected

Starts a connection attempt.

It starts the server or proxy DNS lookup. The function MUST be asynchronous: it must return successfully and report any error by using m_pConnection->linkAttemptFailed() It's called internally and it's overridable

Returns
void

References connect(), Connecting, m_eState, m_pConnection, m_pResolver, m_pTarget, resolverTerminated(), and KviIrcConnectionTargetResolver::start().

Referenced by KviIrcConnection::start().

State KviIrcLink::state ( )
inline

Returns the state of the socket.

Returns
State

Friends And Related Function Documentation

friend class KviIrcConnection
friend
friend class KviIrcSocket
friend

Referenced by createSocket().

Member Data Documentation

State KviIrcLink::m_eState
private
KviIrcConnection* KviIrcLink::m_pConnection
private
KviConsoleWindow* KviIrcLink::m_pConsole
private
KviMexLinkFilter* KviIrcLink::m_pLinkFilter
private
char* KviIrcLink::m_pReadBuffer
private
KviIrcConnectionTargetResolver* KviIrcLink::m_pResolver
private
KviIrcSocket* KviIrcLink::m_pSocket
private
KviIrcConnectionTarget* KviIrcLink::m_pTarget
private
unsigned int KviIrcLink::m_uReadBufferLen
private

Referenced by KviIrcLink(), and processData().

unsigned int KviIrcLink::m_uReadPackets
private

Referenced by KviIrcLink(), and processData().


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