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

« back to all changes in this revision

Viewing changes to src/modules/upnp/Manager.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
//=============================================================================
 
2
//
 
3
//   File : Manager.h
 
4
//   Creation date : Fri Aug 08 18:00:00 2008 GMT by Fabio Bas
 
5
//
 
6
//   This file is part of the KVIrc irc client distribution
 
7
//   Copyright (C) 2008 Fabio Bas (ctrlaltca at gmail dot com)
 
8
//
 
9
//   This program is FREE software. You can redistribute it and/or
 
10
//   modify it under the terms of the GNU General Public License
 
11
//   as published by the Free Software Foundation; either version 2
 
12
//   of the License, or (at your opinion) any later version.
 
13
//
 
14
//   This program is distributed in the HOPE that it will be USEFUL,
 
15
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
17
//   See the GNU General Public License for more details.
 
18
//
 
19
//   You should have received a copy of the GNU General Public License
 
20
//   along with this program. If not, write to the Free Software Foundation,
 
21
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
22
//
 
23
//   Original Copyright follows:
 
24
//=============================================================================
 
25
 
 
26
/***************************************************************************
 
27
                          Manager.h -  description
 
28
                             -------------------
 
29
    begin                : Fri Aug 05 2005
 
30
    copyright            : (C) 2005 by Diederik van der Boor
 
31
    email                : vdboor --at-- codingdomain.com
 
32
 ***************************************************************************/
 
33
 
 
34
#ifndef UPNPMANAGER_H
 
35
#define UPNPMANAGER_H
 
36
 
 
37
#include <QObject>
 
38
#include <QTimer>
 
39
 
 
40
#include "KviPointerList.h"
 
41
#include "igdcontrolpoint.h"
 
42
#include "SsdpConnection.h"
 
43
 
 
44
namespace UPnP
 
45
{
 
46
 
 
47
/**
 
48
 * The manager class is the public interface used by other networking classes.
 
49
 * It's implemented as singleton to provide easy access by other classes.
 
50
 * Devices are automatically detected at start-up, and maintained by this class.
 
51
 * Underneath, the actual work is done by the SsdpConnection and IgdControlPoint classes.
 
52
 *
 
53
 * @author Diederik van der Boor
 
54
 * @ingroup NetworkUPnP
 
55
 */
 
56
class Manager : public QObject
 
57
{
 
58
        Q_OBJECT
 
59
 
 
60
public:  // public methods
 
61
 
 
62
        // The destructor
 
63
        virtual             ~Manager();
 
64
 
 
65
        // Return the external IP address
 
66
        QString              getExternalIpAddress() const;
 
67
 
 
68
        // Return the instance of the manager class
 
69
        static Manager *     instance();
 
70
 
 
71
        // Return true if a controlable gateway is available
 
72
        bool                 isGatewayAvailable();
 
73
 
 
74
        // Add a port mapping
 
75
        void                 addPortMapping(const QString &protocol, const QString &remoteHost, int externalPort, const QString &internalClient, int internalPort, const QString &description, bool enabled = true, int leaseDuration = 0);
 
76
        // Delete a port mapping
 
77
        void                 deletePortMapping(const QString &protocol, const QString &remoteHost, int externalPort);
 
78
 
 
79
private slots:
 
80
        // The broadcast failed
 
81
        void                 slotBroadcastTimeout();
 
82
        // A device was discovered by the SSDP broadcast
 
83
        void                 slotDeviceFound(const QString &hostname, int port, const QString &rootUrl);
 
84
 
 
85
 
 
86
private:  // private methods
 
87
        // The constructor  (it's a singleton)
 
88
                                Manager();
 
89
        // Disable the copy constructor
 
90
                                Manager(const Manager &);
 
91
        // Disable the assign operator
 
92
        Manager&             operator=(const Manager&);
 
93
        // Initialize the manager, detect all devices
 
94
        void                 initialize();
 
95
 
 
96
private:
 
97
        // The active control point we're working with
 
98
        IgdControlPoint     *m_pActiveIgdControlPoint;
 
99
        // True if the broadcast failed (false during the discovery process)
 
100
        bool                 m_bBroadcastFailed;
 
101
        // True if the broadcast found a device (false during the discovery process)
 
102
        bool                 m_bBroadcastFoundIt;
 
103
        // The instance of the singleton class
 
104
        static Manager      *m_pInstance;
 
105
        // A list of all detected gateway devices
 
106
        KviPointerList<IgdControlPoint> m_lIgdControlPoints;
 
107
        // The SSDP connection to find all UPnP devices
 
108
        SsdpConnection      *m_pSsdpConnection;
 
109
        // The timer to detect a broadcast timeout
 
110
        QTimer              *m_pSsdpTimer;
 
111
};
 
112
 
 
113
 
 
114
}  // End of namespace
 
115
 
 
116
#endif