~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kernel/KviIrcConnectionTargetResolver.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _KVI_IRCCONNECTIONTARGETRESOLVER_H_
 
2
#define _KVI_IRCCONNECTIONTARGETRESOLVER_H_
 
3
//=============================================================================
 
4
//
 
5
//   File : KviIrcConnectionTargetResolver.h
 
6
//   Creation date : Fri 11 May 2004 23:17: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 opinion) 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
 
 
27
#include "kvi_settings.h"
 
28
#include "KviQString.h"
 
29
 
 
30
#include <QObject>
 
31
 
 
32
class KviConsoleWindow;
 
33
class KviDnsResolver;
 
34
class KviIrcConnection;
 
35
class KviIrcConnectionTarget;
 
36
 
 
37
class QTimer;
 
38
 
 
39
class KVIRC_API KviIrcConnectionTargetResolver : public QObject
 
40
{
 
41
        friend class KviIrcLink; // upper protocol in the stack
 
42
        Q_OBJECT
 
43
protected:
 
44
        KviIrcConnectionTargetResolver(KviIrcConnection * pConnection);
 
45
        ~KviIrcConnectionTargetResolver();
 
46
public:
 
47
        enum Status { Success, Error };
 
48
        enum State { Idle, Running, Terminated };
 
49
private:
 
50
        KviIrcConnection             * m_pConnection;       // shallow, never null
 
51
        KviIrcConnectionTarget       * m_pTarget;           // shallow, never null
 
52
        KviConsoleWindow                   * m_pConsole;          // shallow, never null
 
53
        Status                         m_eStatus;
 
54
        State                          m_eState;
 
55
 
 
56
        // Auxiliary stuff
 
57
        QTimer                       * m_pStartTimer;       // timer used to start the connection
 
58
        KviDnsResolver                       * m_pProxyDns;         // the dns object for the proxy hostnames
 
59
        KviDnsResolver                       * m_pServerDns;        // the dns object for the server hostnames
 
60
 
 
61
        char                         * m_pReadBuffer;
 
62
        unsigned int                   m_uReadBufferLen;
 
63
        unsigned int                   m_uReadPackets;
 
64
 
 
65
        int                            m_iLastError;
 
66
public:
 
67
        void start(KviIrcConnectionTarget * t);
 
68
        // valid only after the terminated() signal
 
69
        Status status(){ return m_eStatus; };
 
70
        int lastError(){ return m_iLastError; };
 
71
        // causes the resolver to terminate with iLastError == KviError_operationAborted
 
72
        // the terminated() signal is emitted.
 
73
        void abort();
 
74
protected slots:
 
75
        void asyncStartResolve();
 
76
        void serverLookupTerminated(KviDnsResolver *);
 
77
        void proxyLookupTerminated(KviDnsResolver *);
 
78
private:
 
79
        void cleanup();
 
80
        void lookupProxyHostname();
 
81
        void lookupServerHostname();
 
82
        void haveServerIp();
 
83
        bool validateLocalAddress(const QString &szAddress,QString &szBuffer);
 
84
        void terminate(Status s,int iLastError);
 
85
signals:
 
86
        void terminated();
 
87
};
 
88
 
 
89
#endif //!_KVI_IRCCONNECTIONTARGETRESOLVER_H_