KVIrc 5.2.4
Developer APIs
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.
 

Public Member Functions

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

Protected Slots

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

Protected Member Functions

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

Private Slots

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

Private Member Functions

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

Private Attributes

State m_eState = Idle
 
KviIrcConnectionm_pConnection
 
KviConsoleWindowm_pConsole
 
KviMexLinkFilterm_pLinkFilter = nullptr
 
char * m_pReadBuffer = nullptr
 
KviIrcConnectionTargetResolverm_pResolver = nullptr
 
KviIrcSocketm_pSocket = nullptr
 
KviIrcConnectionTargetm_pTarget
 
unsigned int m_uReadBufferLen = 0
 
unsigned int m_uReadPackets = 0
 

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

◆ State

Enumerator
Idle 

Socket idling

Connecting 

Socket connecting

Connected 

Socket connected

Constructor & Destructor Documentation

◆ KviIrcLink()

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(), m_pConnection, m_pConsole, m_pTarget, and KviIrcConnection::target().

◆ ~KviIrcLink()

KviIrcLink::~KviIrcLink ( )
protected

Destroys the IrcLink object.

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

Member Function Documentation

◆ abort()

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().

◆ clearOutputQueue()

void KviIrcLink::clearOutputQueue ( bool  bPrivateMessagesOnly)
protectedvirtual

Clears the output queue.

Requests to clear the underlying packet queue.

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

Referenced by KviIrcConnection::clearOutputQueue().

◆ connection()

KviIrcConnection * KviIrcLink::connection ( ) const
inline

Returns the connection object.

Never null

Returns
KviIrcConnection *

Referenced by socketStateChange().

◆ connectionFailed

void KviIrcLink::connectionFailed ( )
signal

Emitted when the connection attempt has failed.

Returns
void

◆ console()

KviConsoleWindow * KviIrcLink::console ( ) const
inline

Returns the console.

Never null

Returns
KviConsoleWindow *

Referenced by KviIrcSocket::KviIrcSocket().

◆ createSocket()

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

◆ destroySocket()

void KviIrcLink::destroySocket ( )
private

Destroys the socket.

Returns
void

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

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

◆ linkFilterDestroyed

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().

◆ outputQueueSize()

unsigned int KviIrcLink::outputQueueSize ( )
protected

Returns the current size of the output queue.

Returns
unsigned int

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

Referenced by KviIrcConnection::outputQueueSize().

◆ processData()

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().

◆ resolverTerminated

void KviIrcLink::resolverTerminated ( )
privateslot

◆ sendPacket()

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, KviIrcSocket::sendPacket(), and KviMexLinkFilter::sendPacket().

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

◆ socket()

KviIrcSocket * KviIrcLink::socket ( ) const
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().

◆ socketStateChange()

void KviIrcLink::socketStateChange ( )
protected

◆ start()

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()

State KviIrcLink::state ( ) const
inline

Returns the state of the socket.

Returns
State

Friends And Related Symbol Documentation

◆ KviIrcConnection

friend class KviIrcConnection
friend

◆ KviIrcSocket

friend class KviIrcSocket
friend

Referenced by createSocket().

Member Data Documentation

◆ m_eState

State KviIrcLink::m_eState = Idle
private

◆ m_pConnection

KviIrcConnection* KviIrcLink::m_pConnection
private

◆ m_pConsole

KviConsoleWindow* KviIrcLink::m_pConsole
private

◆ m_pLinkFilter

KviMexLinkFilter* KviIrcLink::m_pLinkFilter = nullptr
private

◆ m_pReadBuffer

char* KviIrcLink::m_pReadBuffer = nullptr
private

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

◆ m_pResolver

KviIrcConnectionTargetResolver* KviIrcLink::m_pResolver = nullptr
private

◆ m_pSocket

KviIrcSocket* KviIrcLink::m_pSocket = nullptr
private

◆ m_pTarget

KviIrcConnectionTarget* KviIrcLink::m_pTarget
private

◆ m_uReadBufferLen

unsigned int KviIrcLink::m_uReadBufferLen = 0
private

Referenced by processData().

◆ m_uReadPackets

unsigned int KviIrcLink::m_uReadPackets = 0
private

Referenced by processData().


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