![]() |
KVIrc 5.2.6
Developer APIs
|
Middle stack class for IRC connection. More...
#include <KviIrcLink.h>
Public Types | |
enum | State { Idle , Connecting , Connected } |
Signals | |
void | connectionFailed () |
Emitted when the connection attempt has failed. | |
Public Member Functions | |
KviIrcConnection * | connection () const |
Returns the connection object. | |
KviConsoleWindow * | console () const |
Returns the console. | |
KviIrcSocket * | socket () 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 |
KviIrcConnection * | m_pConnection |
KviConsoleWindow * | m_pConsole |
KviMexLinkFilter * | m_pLinkFilter = nullptr |
char * | m_pReadBuffer = nullptr |
KviIrcConnectionTargetResolver * | m_pResolver = nullptr |
KviIrcSocket * | m_pSocket = nullptr |
KviIrcConnectionTarget * | m_pTarget |
unsigned int | m_uReadBufferLen = 0 |
unsigned int | m_uReadPackets = 0 |
Friends | |
class | KviIrcConnection |
class | KviIrcSocket |
Middle stack class for IRC connection.
This class gets data from KviIrcSocket and pass it to KviIrcConnection
enum KviIrcLink::State |
|
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;
pConnection | The pointer to the KviIrcConnection class |
References KviIrcConnection, m_pConnection, m_pConsole, m_pTarget, and KviIrcConnection::target().
|
protected |
Destroys the IrcLink object.
References destroySocket(), KviMemory::free(), m_pReadBuffer, and m_pResolver.
|
protected |
|
protectedvirtual |
Clears the output queue.
Requests to clear the underlying packet queue.
References m_pLinkFilter, and m_pSocket.
|
inline |
Returns the connection object.
Never null
References KviIrcConnection, and m_pConnection.
Referenced by socketStateChange().
|
signal |
|
inline |
|
private |
Creates the socket.
szLinkFilterName | The source linkfilter name |
References __tr2qs, connect(), destroySocket(), KviQString::equalCI(), g_pModuleExtensionManager, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_SYSTEMWARNING, KviIrcSocket, linkFilterDestroyed(), m_pConsole, m_pLinkFilter, and m_pSocket.
Referenced by resolverTerminated().
|
private |
Destroys the socket.
References m_pLinkFilter, and m_pSocket.
Referenced by createSocket(), and ~KviIrcLink().
|
protectedslot |
Called when the link filter has been destroyed without permission :D.
This should NEVER happen (?) This is part of the KviIrcSocket management
References __tr2qs, KVI_OUT_SYSTEMWARNING, m_pConsole, and m_pLinkFilter.
Referenced by createSocket().
|
protected |
Returns the current size of the output queue.
References m_pLinkFilter, and m_pSocket.
|
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)
buffer | The buffer :) |
iLength | The length of the buffer |
References KviMemory::allocate(), KviIrcSocket::Connected, KviMemory::free(), KVI_ASSERT, m_pConnection, m_pLinkFilter, m_pReadBuffer, m_pSocket, m_uReadBufferLen, m_uReadPackets, KviMemory::move(), p, and KviMemory::reallocate().
|
privateslot |
Called when the DNS lookup has terminated.
References __tr2qs, createSocket(), KviError::getDescription(), Idle, KVI_OUT_SYSTEMERROR, m_eState, m_pConnection, m_pConsole, m_pResolver, m_pSocket, m_pTarget, KviError::Success, and KviIrcConnectionTargetResolver::Success.
Referenced by connectionFailed(), and start().
|
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)
pData | The pointer to the data packet |
References m_pLinkFilter, and m_pSocket.
|
inline |
Returns the socket.
May be null!
References KviIrcSocket, and m_pSocket.
Referenced by context_kvs_fnc_getSSLCertInfo(), dcc_kvs_get_listen_ip_address(), and socketStateChange().
|
protected |
Called at each state change.
References __tr2qs, Connected, KviIrcSocket::Connected, Connecting, KviIrcSocket::Connecting, connection(), Idle, KviIrcSocket::Idle, KVI_OUT_CONNECTION, m_eState, m_pConnection, m_pConsole, m_pSocket, KviIrcSocket::ProxyFinalHttp, KviIrcSocket::ProxyFinalV4, KviIrcSocket::ProxyFinalV5, KviIrcSocket::ProxyLogin, KviIrcSocket::ProxySelectAuthMethodV5, KviIrcSocket::ProxyUserPassV5, socket(), and KviIrcSocket::SSLHandshake.
|
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
References connect(), Connecting, m_eState, m_pConnection, m_pResolver, m_pTarget, and resolverTerminated().
|
inline |
|
friend |
References KviIrcConnection.
Referenced by connection(), KviIrcConnection, and KviIrcLink().
|
friend |
References KviIrcSocket.
Referenced by createSocket(), KviIrcSocket, and socket().
Referenced by resolverTerminated(), socketStateChange(), start(), and state().
|
private |
Referenced by connection(), KviIrcLink(), processData(), resolverTerminated(), socketStateChange(), and start().
|
private |
Referenced by console(), createSocket(), KviIrcLink(), linkFilterDestroyed(), resolverTerminated(), and socketStateChange().
|
private |
Referenced by clearOutputQueue(), createSocket(), destroySocket(), linkFilterDestroyed(), outputQueueSize(), processData(), and sendPacket().
|
private |
Referenced by processData(), and ~KviIrcLink().
|
private |
Referenced by abort(), resolverTerminated(), start(), and ~KviIrcLink().
|
private |
Referenced by abort(), clearOutputQueue(), createSocket(), destroySocket(), outputQueueSize(), processData(), resolverTerminated(), sendPacket(), socket(), and socketStateChange().
|
private |
Referenced by KviIrcLink(), resolverTerminated(), and start().
|
private |
Referenced by processData().
|
private |
Referenced by processData().