KVIrc  4.9.2
DeveloperAPIs
KviIrcLink.h
Go to the documentation of this file.
1 #ifndef _KVI_IRCLINK_H_
2 #define _KVI_IRCLINK_H_
3 //=============================================================================
4 //
5 // File : KviIrcLink.h
6 // Creation date : Mon 03 May 2004 01:45:42 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
33 #include "kvi_settings.h"
34 #include "KviQString.h"
35 
36 #include <QObject>
37 
38 class KviConsoleWindow;
39 class KviIrcServer;
40 class KviProxy;
41 class KviIrcSocket;
42 class KviDnsResolver;
43 class KviIrcConnection;
46 class KviDataBuffer;
47 class KviMexLinkFilter;
48 
55 class KVIRC_API KviIrcLink : public QObject
56 {
57  friend class KviIrcConnection; // upper protocol in the stack
58  friend class KviIrcSocket; // lower protocol in the stack
59  Q_OBJECT
60 public:
64  enum State
65  {
66  Idle,
69  };
70 
71 protected:
84  KviIrcLink(KviIrcConnection * pConnection);
85 
89  ~KviIrcLink();
90 
91 private:
92  KviIrcConnection * m_pConnection; // shallow, never null
93  KviIrcConnectionTarget * m_pTarget; // shallow, never null
94  KviConsoleWindow * m_pConsole; // shallow, never null
95  KviIrcSocket * m_pSocket; // owned, may be null!
96  KviMexLinkFilter * m_pLinkFilter; // owned, may be null!
97 
99 
101  unsigned int m_uReadBufferLen;
102  unsigned int m_uReadPackets;
103 
105 public:
112  KviIrcSocket * socket() { return m_pSocket; };
113 
120  KviIrcConnection * connection() { return m_pConnection; };
121 
129 
134  State state() { return m_eState; };
135 protected:
146  virtual bool sendPacket(KviDataBuffer * pData);
147 
153  virtual void clearOutputQueue(bool bPrivateMessagesOnly);
154 
159  unsigned int outputQueueSize();
160 
165  void abort();
166 
167 protected:
177  void start();
178 
179 protected:
190  void processData(char * buffer, int iLength);
191 
196  void socketStateChange();
197 protected slots:
205  void linkFilterDestroyed();
206 
207 private:
212  void destroySocket();
213 
219  void createSocket(const QString & szLinkFilterName);
220 signals:
225  void connectionFailed();
226 private slots:
231  void resolverTerminated();
232 };
233 
234 #endif //_KVI_IRCLINK_H_
m_pSocket
Definition: KvsObject_socket.cpp:314
Definition: KviIrcSocket.h:97
Definition: KviConsoleWindow.h:75
The class which manages the irc servers.
Definition: KviIrcServer.h:51
#define KVIRC_API
Definition: kvi_settings.h:128
An abstraction of a connection to an IRC server.
Definition: KviIrcConnection.h:95
void clearOutputQueue(bool bPrivateMessagesOnly)
Clears the output queue.
Definition: KviIrcSocket.cpp:175
Definition: KviDataBuffer.h:30
Definition: KviProxy.h:37
unsigned int outputQueueSize()
Returns the current size of the output queue.
Definition: KviIrcSocket.cpp:183
The KviDnsResolver class.
Definition: KviDnsResolver.h:93
void abort()
Aborts the connection.
Definition: KviIrcSocket.cpp:1576
bool sendPacket(KviDataBuffer *pData)
Returns true if the packet is sent to the socket.
Definition: KviIrcSocket.cpp:1970
KviConsoleWindow * m_pConsole
Definition: KviIrcSocket.h:109
Definition: KviIrcConnectionTargetResolver.h:51
Definition: KviMexLinkFilter.h:34
This file contains compile time settings.
Definition: KviIrcConnectionTarget.h:35
This class is the lowest level of the KVIrc networking stack.
Definition: KviIrcSocket.h:71
Helper functions for the QString class.