Solid
internetgateway.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2010 Paulo Romulo Alves Barros <paulo.romulo@kdemail.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) version 3, or any 00008 later version accepted by the membership of KDE e.V. (or its 00009 successor approved by the membership of KDE e.V.), which shall 00010 act as a proxy defined in Section 6 of version 3 of the license. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #include "internetgateway.h" 00022 #include "internetgateway_p.h" 00023 00024 #include "soliddefs_p.h" 00025 00026 #include <solid/ifaces/internetgateway.h> 00027 00028 namespace Solid 00029 { 00030 00031 InternetGateway::InternetGateway(QObject* backendObject) : 00032 DeviceInterface(*new InternetGatewayPrivate(), backendObject) 00033 { 00034 connect(backendObject, 00035 SIGNAL(portMappingAdded(const QString&, qint16, const NetworkProtocol&, qint16, const QString&)), 00036 this, 00037 SIGNAL(portMappingAdded(const QString&, qint16, const NetworkProtocol&, qint16, const QString&))); 00038 00039 connect(backendObject, 00040 SIGNAL(portMappingDeleted(const QString&, qint16, const NetworkProtocol&)), 00041 this, 00042 SIGNAL(portMappingDeleted(const QString&, qint16, const NetworkProtocol&))); 00043 00044 connect(backendObject, 00045 SIGNAL(enabledForInternet(bool)), 00046 this, 00047 SIGNAL(enabledForInternet(bool))); 00048 } 00049 00050 InternetGateway::InternetGateway(InternetGatewayPrivate& dd, QObject* backendObject) 00051 : DeviceInterface(dd, backendObject) 00052 { 00053 connect(backendObject, 00054 SIGNAL(portMappingAdded(const QString&, qint16, const NetworkProtocol&, qint16, const QString&)), 00055 this, 00056 SIGNAL(portMappingAdded(const QString&, qint16, const NetworkProtocol&, qint16, const QString&))); 00057 00058 connect(backendObject, 00059 SIGNAL(portMappingDeleted(const QString&, qint16, const NetworkProtocol&)), 00060 this, 00061 SIGNAL(portMappingDeleted(const QString&, qint16, const NetworkProtocol&))); 00062 00063 connect(backendObject, 00064 SIGNAL(enabledForInternet(bool)), 00065 this, 00066 SIGNAL(enabledForInternet(bool))); 00067 } 00068 00069 InternetGateway::~InternetGateway() 00070 { 00071 } 00072 00073 void InternetGateway::requestCurrentConnections() const 00074 { 00075 Q_D(const InternetGateway); 00076 00077 SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), requestCurrentConnections()); 00078 } 00079 00080 QStringList InternetGateway::currentConnections() const 00081 { 00082 Q_D(const InternetGateway); 00083 00084 return_SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), QStringList(), currentConnections()); 00085 } 00086 00087 void InternetGateway::addPortMapping(const QString& remoteHost, qint16 externalPort, const NetworkProtocol& mappingProtocol, 00088 qint16 internalPort, const QString& internalClient) 00089 { 00090 Q_D(const InternetGateway); 00091 00092 SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), 00093 addPortMapping(remoteHost, externalPort, mappingProtocol, internalPort, internalClient)); 00094 } 00095 00096 void InternetGateway::deletePortMapping(const QString& remoteHost, qint16 externalPort, const NetworkProtocol& mappingProtocol) 00097 { 00098 Q_D(const InternetGateway); 00099 00100 SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), 00101 deletePortMapping(remoteHost, externalPort, mappingProtocol)); 00102 } 00103 00104 InternetGateway::InternetStatus InternetGateway::isEnabledForInternet() const 00105 { 00106 Q_D(const InternetGateway); 00107 00108 return_SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), InternetGateway::UnknownStatus, isEnabledForInternet()); 00109 } 00110 00111 void InternetGateway::setEnabledForInternet(bool enabled) 00112 { 00113 Q_D(const InternetGateway); 00114 00115 SOLID_CALL(Ifaces::InternetGateway*, d->backendObject(), setEnabledForInternet(enabled)); 00116 } 00117 00118 }
KDE 4.6 API Reference