KVIrc  4.9.2
DeveloperAPIs
WanConnectionService.h
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // File : WanConnectionService.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 option) 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  WanConnectionService.h - description
28  -------------------
29  begin : Mon Jul 25 2005
30  copyright : (C) 2005 by Diederik van der Boor
31  email : vdboor --at-- codingdomain.com
32  ***************************************************************************/
33 
34 #ifndef UPNP_WANCONNECTIONSERVICE_H
35 #define UPNP_WANCONNECTIONSERVICE_H
36 
37 #include "Service.h"
38 #include "KviPointerList.h"
39 
40 namespace UPnP
41 {
42 
43  struct PortMapping
44  {
45  QString protocol;
46  QString remoteHost;
48  QString internalClient;
51  QString description;
52  bool enabled;
53  };
54 
66  {
67  public: // public methods
68  // The constructor
70  // The destructor
71  virtual ~WanConnectionService();
72 
73  // Add a port mapping
74  void addPortMapping(const QString & protocol, const QString & remoteHost, int externalPort,
75  const QString & internalClient, int internalPort, const QString & description,
76  bool enabled = true, int leaseDuration = 0);
77  // Delete a port mapping
78  void deletePortMapping(const QString & protocol, const QString & remoteHost, int externalPort);
79 
80  // Return the external IP address
81  QString getExternalIpAddress() const;
82  // Return true if NAT is enabled
83  bool getNatEnabled() const;
84  // Return the port mappings
86 
87  // Query for the external IP address
89  // Query for the Nat status
90  void queryNatEnabled();
91  // Query for a port mapping entry
92  void queryPortMappingEntry(int index);
93 
94  protected: // protected methods
95  // The control point received a response to callAction()
96  virtual void gotActionResponse(const QString & responseType, const QMap<QString, QString> & resultValues);
97 
98  private: // private attributes
99  // The external IP address
101  // True if NAT is enabled
103  // The current port mappings
105  };
106 }
107 
108 #endif
const KviPointerList< PortMapping > & getPortMappings() const
Definition: WanConnectionService.cpp:90
QString remoteHost
Definition: WanConnectionService.h:46
Definition: WanConnectionService.h:65
KviPointerList< PortMapping > m_lPortMappings
Definition: WanConnectionService.h:104
Definition: WanConnectionService.h:43
Definition: Service.h:68
bool getNatEnabled() const
Definition: WanConnectionService.cpp:84
int internalPort
Definition: WanConnectionService.h:49
bool enabled
Definition: WanConnectionService.h:52
QString internalClient
Definition: WanConnectionService.h:48
Definition: Service.h:47
WanConnectionService(const ServiceParameters &params)
Definition: WanConnectionService.cpp:41
void addPortMapping(const QString &protocol, const QString &remoteHost, int externalPort, const QString &internalClient, int internalPort, const QString &description, bool enabled=true, int leaseDuration=0)
Definition: WanConnectionService.cpp:51
int leaseDuration
Definition: WanConnectionService.h:50
virtual void gotActionResponse(const QString &responseType, const QMap< QString, QString > &resultValues)
Definition: WanConnectionService.cpp:96
QString protocol
Definition: WanConnectionService.h:45
C++ Template based double linked pointer list class.
A template double linked list of pointers.
Definition: KviPointerList.h:55
void queryNatEnabled()
Definition: WanConnectionService.cpp:160
QString description
Definition: WanConnectionService.h:51
QString getExternalIpAddress() const
Definition: WanConnectionService.cpp:78
void queryExternalIpAddress()
Definition: WanConnectionService.cpp:154
void deletePortMapping(const QString &protocol, const QString &remoteHost, int externalPort)
Definition: WanConnectionService.cpp:68
bool m_bNatEnabled
Definition: WanConnectionService.h:102
void queryPortMappingEntry(int index)
Definition: WanConnectionService.cpp:166
QString m_szExternalIpAddress
Definition: WanConnectionService.h:100
int externalPort
Definition: WanConnectionService.h:47