KVIrc
4.9.2
DeveloperAPIs
|
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. More... | |
Public Member Functions | |
KviIrcConnection * | connection () |
Returns the connection object. More... | |
KviConsoleWindow * | console () |
Returns the console. More... | |
KviIrcSocket * | socket () |
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 |
KviIrcConnection * | m_pConnection |
KviConsoleWindow * | m_pConsole |
KviMexLinkFilter * | m_pLinkFilter |
char * | m_pReadBuffer |
KviIrcConnectionTargetResolver * | m_pResolver |
KviIrcSocket * | m_pSocket |
KviIrcConnectionTarget * | m_pTarget |
unsigned int | m_uReadBufferLen |
unsigned int | m_uReadPackets |
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::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().
|
protected |
Destroys the IrcLink object.
References destroySocket(), KviMemory::free(), m_pReadBuffer, and m_pResolver.
|
protected |
Aborts any connection or attempt.
References KviIrcConnectionTargetResolver::abort(), KviIrcSocket::abort(), m_pResolver, and m_pSocket.
Referenced by KviIrcConnection::abort().
|
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().
|
inline |
Returns the connection object.
Never null
Referenced by socketStateChange().
|
signal |
Emitted when the connection attempt has failed.
|
inline |
Returns the console.
Never null
References KviIrcSocket::m_pConsole.
Referenced by KviIrcSocket::KviIrcSocket().
|
private |
Creates the socket.
szLinkFilterName | The source linkfilter name |
References __tr2qs, KviModuleExtensionManager::allocateExtension(), connect(), destroySocket(), KviQString::equalCI(), g_pModuleExtensionManager, KVI_OUT_SYSTEMMESSAGE, KVI_OUT_SYSTEMWARNING, KviIrcSocket, linkFilterDestroyed(), m_pConsole, m_pLinkFilter, m_pSocket, and KviWindow::output().
Referenced by resolverTerminated().
|
private |
Destroys the socket.
References KviModuleExtension::die(), 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, m_pLinkFilter, and KviWindow::output().
Referenced by createSocket().
|
protected |
Returns the current size of the output queue.
References m_pLinkFilter, m_pSocket, KviMexLinkFilter::outputQueueSize(), and KviIrcSocket::outputQueueSize().
Referenced by KviIrcConnection::outputQueueSize().
|
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(), 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().
|
privateslot |
Called when the DNS lookup has terminated.
References __tr2qs, KviIrcConnectionTarget::bindAddress(), createSocket(), KviError::getDescription(), Idle, KVI_OUT_SYSTEMERROR, KviIrcConnectionTargetResolver::lastError(), KviIrcConnection::linkAttemptFailed(), KviIrcServer::linkFilter(), m_eState, m_pConnection, m_pConsole, m_pResolver, m_pSocket, m_pTarget, KviWindow::output(), KviIrcConnectionTarget::proxy(), KviIrcConnectionTarget::server(), KviIrcSocket::startConnection(), KviIrcConnectionTargetResolver::status(), KviError::Success, and KviIrcConnectionTargetResolver::Success.
Referenced by 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, m_pSocket, KviMexLinkFilter::sendPacket(), and KviIrcSocket::sendPacket().
Referenced by KviIrcConnection::sendData(), and KviIrcConnection::sendFmtData().
|
inline |
Returns the socket.
May be null!
References 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, KviIrcSocket::lastError(), KviIrcConnection::linkAttemptFailed(), KviIrcConnection::linkEstablished(), KviIrcConnection::linkTerminated(), m_eState, m_pConnection, m_pConsole, m_pSocket, KviWindow::output(), KviWindow::outputNoFmt(), KviIrcSocket::ProxyFinalHttp, KviIrcSocket::ProxyFinalV4, KviIrcSocket::ProxyFinalV5, KviIrcSocket::ProxyLogin, KviIrcSocket::ProxySelectAuthMethodV5, KviIrcSocket::ProxyUserPassV5, socket(), KviIrcSocket::SSLHandshake, and KviIrcSocket::state().
Referenced by KviIrcSocket::setState().
|
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, resolverTerminated(), and KviIrcConnectionTargetResolver::start().
Referenced by KviIrcConnection::start().
|
inline |
Returns the state of the socket.
|
friend |
|
friend |
Referenced by createSocket().
|
private |
Referenced by KviIrcLink(), resolverTerminated(), socketStateChange(), and start().
|
private |
Referenced by KviIrcLink(), processData(), resolverTerminated(), socketStateChange(), and start().
|
private |
Referenced by createSocket(), KviIrcLink(), linkFilterDestroyed(), resolverTerminated(), and socketStateChange().
|
private |
Referenced by clearOutputQueue(), createSocket(), destroySocket(), KviIrcLink(), linkFilterDestroyed(), outputQueueSize(), processData(), and sendPacket().
|
private |
Referenced by KviIrcLink(), processData(), and ~KviIrcLink().
|
private |
Referenced by abort(), KviIrcLink(), resolverTerminated(), start(), and ~KviIrcLink().
|
private |
Referenced by abort(), clearOutputQueue(), createSocket(), destroySocket(), KviIrcLink(), outputQueueSize(), processData(), resolverTerminated(), sendPacket(), and socketStateChange().
|
private |
Referenced by KviIrcLink(), resolverTerminated(), and start().
|
private |
Referenced by KviIrcLink(), and processData().
|
private |
Referenced by KviIrcLink(), and processData().