aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Alexey Uzhva2008-08-13 05:02:13 +0000
committerGravatar Alexey Uzhva2008-08-13 05:02:13 +0000
commitfe1d83a4bb10302b1a59dbcfd09260cb3ed9ef93 (patch)
tree8bf8018fd4fce8a76ea911009d5e19b028b73e4b
parentsmall cosmetic fix:) (diff)
downloadKVIrc-fe1d83a4bb10302b1a59dbcfd09260cb3ed9ef93.tar.gz
KVIrc-fe1d83a4bb10302b1a59dbcfd09260cb3ed9ef93.tar.bz2
KVIrc-fe1d83a4bb10302b1a59dbcfd09260cb3ed9ef93.zip
renamed class members, according to KVIrc code conventions
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2233 17fca916-40b9-46aa-a4ea-0a15b648b75c
-rw-r--r--src/modules/upnp/igdcontrolpoint.cpp60
-rw-r--r--src/modules/upnp/igdcontrolpoint.h12
-rw-r--r--src/modules/upnp/layer3forwardingservice.cpp12
-rw-r--r--src/modules/upnp/layer3forwardingservice.h4
-rw-r--r--src/modules/upnp/libkviupnp.cpp18
-rw-r--r--src/modules/upnp/manager.cpp60
-rw-r--r--src/modules/upnp/manager.h14
-rw-r--r--src/modules/upnp/rootservice.cpp30
-rw-r--r--src/modules/upnp/rootservice.h10
-rw-r--r--src/modules/upnp/service.cpp62
-rw-r--r--src/modules/upnp/service.h12
-rw-r--r--src/modules/upnp/ssdpconnection.cpp22
-rw-r--r--src/modules/upnp/ssdpconnection.h2
-rw-r--r--src/modules/upnp/wanconnectionservice.cpp18
-rw-r--r--src/modules/upnp/wanconnectionservice.h6
15 files changed, 169 insertions, 173 deletions
diff --git a/src/modules/upnp/igdcontrolpoint.cpp b/src/modules/upnp/igdcontrolpoint.cpp
index c05592c4d..eb3eb5346 100644
--- a/src/modules/upnp/igdcontrolpoint.cpp
+++ b/src/modules/upnp/igdcontrolpoint.cpp
@@ -48,11 +48,11 @@ namespace UPnP
// The constructor
IgdControlPoint::IgdControlPoint(const QString &hostname, int port, const QString &rootUrl)
: QObject()
-, forwardingService_(0)
-, gatewayAvailable_(false)
-, igdPort_(0)
-, rootService_(0)
-, wanConnectionService_(0)
+, m_pForwardingService(0)
+, m_bGatewayAvailable(false)
+, m_iIgdPort(0)
+, m_pRootService(0)
+, m_pWanConnectionService(0)
{
qDebug() << "CREATED UPnP::IgdControlPoint: Created control point"
<< " url='" << hostname << ":" << port << "/" << rootUrl << "'." << endl;
@@ -60,12 +60,12 @@ IgdControlPoint::IgdControlPoint(const QString &hostname, int port, const QStrin
qDebug() << "UPnP::IgdControlPoint: querying services..." << endl;
// Store device url
- igdHostname_ = hostname;
- igdPort_ = port;
+ m_szIgdHostname = hostname;
+ m_iIgdPort = port;
// Query the device for it's services
- rootService_ = new RootService(igdHostname_, igdPort_, rootUrl);
- connect(rootService_, SIGNAL(queryFinished(bool)), this, SLOT(slotDeviceQueried(bool)));
+ m_pRootService = new RootService(m_szIgdHostname, m_iIgdPort, rootUrl);
+ connect(m_pRootService, SIGNAL(queryFinished(bool)), this, SLOT(slotDeviceQueried(bool)));
}
@@ -73,11 +73,11 @@ IgdControlPoint::IgdControlPoint(const QString &hostname, int port, const QStrin
// The destructor
IgdControlPoint::~IgdControlPoint()
{
- delete rootService_;
- delete forwardingService_;
- delete wanConnectionService_;
+ delete m_pRootService;
+ delete m_pForwardingService;
+ delete m_pWanConnectionService;
- qDebug() << "DESTROYED UPnP::IgdControlPoint [host=" << igdHostname_ << ", port=" << igdPort_ << "]" << endl;
+ qDebug() << "DESTROYED UPnP::IgdControlPoint [host=" << m_szIgdHostname << ", port=" << m_iIgdPort << "]" << endl;
}
@@ -86,9 +86,9 @@ IgdControlPoint::~IgdControlPoint()
QString IgdControlPoint::getExternalIpAddress() const
{
// Do not expose wanConnectionService_;
- if(wanConnectionService_ != 0)
+ if(m_pWanConnectionService != 0)
{
- return wanConnectionService_->getExternalIpAddress();
+ return m_pWanConnectionService->getExternalIpAddress();
} else {
return QString::null;
}
@@ -98,7 +98,7 @@ QString IgdControlPoint::getExternalIpAddress() const
// Initialize the control point
void IgdControlPoint::initialize()
{
- rootService_->queryDevice();
+ m_pRootService->queryDevice();
}
@@ -106,7 +106,7 @@ void IgdControlPoint::initialize()
// Return true if a controlable gateway is available
bool IgdControlPoint::isGatewayAvailable()
{
- return gatewayAvailable_;
+ return m_bGatewayAvailable;
}
@@ -117,7 +117,7 @@ void IgdControlPoint::slotDeviceQueried(bool error)
if(! error)
{
// Get the Layer3ForwardingService from the retrieved service list
- ServiceParameters params = rootService_->getServiceByType(Layer3ForwardingType);
+ ServiceParameters params = m_pRootService->getServiceByType(Layer3ForwardingType);
if(! params.controlUrl.isNull())
{
@@ -125,9 +125,9 @@ void IgdControlPoint::slotDeviceQueried(bool error)
<< "querying service '" << params.serviceId << "' for port mapping service..." << endl;
// Call the service
- forwardingService_ = new Layer3ForwardingService(params);
- connect(forwardingService_, SIGNAL(queryFinished(bool)), this, SLOT(slotWanConnectionFound(bool)));
- forwardingService_->queryDefaultConnectionService();
+ m_pForwardingService = new Layer3ForwardingService(params);
+ connect(m_pForwardingService, SIGNAL(queryFinished(bool)), this, SLOT(slotWanConnectionFound(bool)));
+ m_pForwardingService->queryDefaultConnectionService();
} else {
qDebug() << "UPnP::IgdControlPoint: No Layer3Forwarding service found on device" << endl;
}
@@ -142,9 +142,9 @@ void IgdControlPoint::slotWanConnectionFound(bool error)
if(! error)
{
// Get the retreived service description
- QString deviceUrn = forwardingService_->getConnectionDeviceUdn();
- QString serviceId = forwardingService_->getConnectionServiceId();
- ServiceParameters params = rootService_->getServiceById(serviceId, deviceUrn);
+ QString deviceUrn = m_pForwardingService->getConnectionDeviceUdn();
+ QString serviceId = m_pForwardingService->getConnectionServiceId();
+ ServiceParameters params = m_pRootService->getServiceById(serviceId, deviceUrn);
if(! params.controlUrl.isNull())
{
@@ -152,15 +152,15 @@ void IgdControlPoint::slotWanConnectionFound(bool error)
<< "querying service '" << params.serviceId << "' for external ip address..." << endl;
// Call the service
- wanConnectionService_ = new WanConnectionService(params);
- connect(wanConnectionService_, SIGNAL(queryFinished(bool)), this, SLOT(slotWanQueryFinished(bool)));
- wanConnectionService_->queryExternalIpAddress();
+ m_pWanConnectionService = new WanConnectionService(params);
+ connect(m_pWanConnectionService, SIGNAL(queryFinished(bool)), this, SLOT(slotWanQueryFinished(bool)));
+ m_pWanConnectionService->queryExternalIpAddress();
}
}
// No longer need the forwarding service
- forwardingService_->deleteLater();
- forwardingService_ = 0;
+ m_pForwardingService->deleteLater();
+ m_pForwardingService = 0;
}
@@ -171,7 +171,7 @@ void IgdControlPoint::slotWanQueryFinished(bool error)
if(! error)
{
qDebug() << "IgdControlPoint: UPnP Gateway Device found." << endl;
- gatewayAvailable_ = true;
+ m_bGatewayAvailable = true;
} else {
// Just started, the request for the external IP failed. This should succeed, abort portation
qDebug() << "Requesting external IP address failed, leaving UPnP Gateway Device untouched." << endl;
diff --git a/src/modules/upnp/igdcontrolpoint.h b/src/modules/upnp/igdcontrolpoint.h
index 23e3b6fe9..2f1a2b627 100644
--- a/src/modules/upnp/igdcontrolpoint.h
+++ b/src/modules/upnp/igdcontrolpoint.h
@@ -81,17 +81,17 @@ private slots:
private: // private attibutes
// The forwarding service
- Layer3ForwardingService *forwardingService_;
+ Layer3ForwardingService *m_pForwardingService;
// Is a gateway available?
- bool gatewayAvailable_;
+ bool m_bGatewayAvailable;
// The host of the gateway
- QString igdHostname_;
+ QString m_szIgdHostname;
// The port of the gateway
- int igdPort_;
+ int m_iIgdPort;
// The root service
- RootService *rootService_;
+ RootService *m_pRootService;
// The wan connection service
- WanConnectionService *wanConnectionService_;
+ WanConnectionService *m_pWanConnectionService;
};
diff --git a/src/modules/upnp/layer3forwardingservice.cpp b/src/modules/upnp/layer3forwardingservice.cpp
index 08a8a59dd..8c18cc45a 100644
--- a/src/modules/upnp/layer3forwardingservice.cpp
+++ b/src/modules/upnp/layer3forwardingservice.cpp
@@ -57,7 +57,7 @@ Layer3ForwardingService::~Layer3ForwardingService()
// Get the device UDN of the default connection service
QString Layer3ForwardingService::getConnectionDeviceUdn() const
{
- return connectionDeviceUdn_;
+ return m_szConnectionDeviceUdn;
}
@@ -65,7 +65,7 @@ QString Layer3ForwardingService::getConnectionDeviceUdn() const
// Get the service ID of the default connection service
QString Layer3ForwardingService::getConnectionServiceId() const
{
- return connectionServiceId_;
+ return m_szConnectionServiceId;
}
@@ -101,9 +101,9 @@ void Layer3ForwardingService::gotActionResponse(const QString &responseType, con
if(type == "uuid")
{
// format: uuid:<id>:<class>:<ver>
- connectionDeviceUdn_ = serviceItems[i].section(':', 0, 1);
+ m_szConnectionDeviceUdn = serviceItems[i].section(':', 0, 1);
} else if(type == "urn") {
- connectionServiceId_ = serviceItems[i];
+ m_szConnectionServiceId = serviceItems[i];
} else {
qDebug() << "UPnP::Layer3ForwardingService - Unexpected section"
<< " '" << type << "' encountered in NewDefaultConnectionService value." << endl;
@@ -111,8 +111,8 @@ void Layer3ForwardingService::gotActionResponse(const QString &responseType, con
}
qDebug() << "UPnP::Layer3ForwardingService:"
- << " udn='" << connectionDeviceUdn_ << "'"
- << " serviceid='" << connectionServiceId_ << "'." << endl;
+ << " udn='" << m_szConnectionDeviceUdn << "'"
+ << " serviceid='" << m_szConnectionServiceId << "'." << endl;
} else {
qDebug() << "UPnP::Layer3ForwardingService - Unexpected response type"
<< " '" << responseType << "' encountered." << endl;
diff --git a/src/modules/upnp/layer3forwardingservice.h b/src/modules/upnp/layer3forwardingservice.h
index 9abfd567a..138b53da9 100644
--- a/src/modules/upnp/layer3forwardingservice.h
+++ b/src/modules/upnp/layer3forwardingservice.h
@@ -74,9 +74,9 @@ protected: // protected methods
private: // private attributes
// The service ID of the default connection service
- QString connectionServiceId_;
+ QString m_szConnectionServiceId;
// The device UDN of the default connection service
- QString connectionDeviceUdn_;
+ QString m_szConnectionDeviceUdn;
};
}
diff --git a/src/modules/upnp/libkviupnp.cpp b/src/modules/upnp/libkviupnp.cpp
index 6c4aa1898..f75bbfb33 100644
--- a/src/modules/upnp/libkviupnp.cpp
+++ b/src/modules/upnp/libkviupnp.cpp
@@ -35,23 +35,19 @@ UPnP::Manager* g_pManager = 0;
static bool upnp_kvs_fnc_getExternalIpAddress(KviKvsModuleFunctionCall * c)
{
- QString buffer;
-
if(g_pManager)
- buffer = g_pManager->getExternalIpAddress();
-
- c->returnValue()->setString(buffer);
+ {
+ c->returnValue()->setString(g_pManager->getExternalIpAddress());
+ }
return true;
}
static bool upnp_kvs_fnc_isGatewayAvailable(KviKvsModuleFunctionCall * c)
{
- bool avail;
-
- if(g_pManager)
- avail = g_pManager->isGatewayAvailable();
-
- c->returnValue()->setBoolean(avail);
+ if (g_pManager)
+ {
+ c->returnValue()->setBoolean(g_pManager->isGatewayAvailable());
+ }
return true;
}
diff --git a/src/modules/upnp/manager.cpp b/src/modules/upnp/manager.cpp
index 33e88ee67..2684d5f18 100644
--- a/src/modules/upnp/manager.cpp
+++ b/src/modules/upnp/manager.cpp
@@ -43,16 +43,16 @@ namespace UPnP
{
// Set the static variable
-Manager* Manager::instance_(0);
+Manager* Manager::m_pInstance(0);
// The constructor
Manager::Manager()
-: activeIgdControlPoint_(0)
-, broadcastFailed_(false)
-, broadcastFoundIt_(false)
-, ssdpConnection_(0)
-, ssdpTimer_(0)
+: m_pActiveIgdControlPoint(0)
+, m_bBroadcastFailed(false)
+, m_bBroadcastFoundIt(false)
+, m_pSsdpConnection(0)
+, m_pSsdpTimer(0)
{
}
@@ -62,9 +62,9 @@ Manager::Manager()
// The destructor
Manager::~Manager()
{
- delete ssdpTimer_;
- delete ssdpConnection_;
- instance_ = 0; // Unregister the instance
+ delete m_pSsdpTimer;
+ delete m_pSsdpConnection;
+ m_pInstance = 0; // Unregister the instance
}
@@ -76,19 +76,19 @@ void Manager::initialize()
// Create the SSDP object to detect devices
- ssdpConnection_ = new SsdpConnection();
- connect(ssdpConnection_, SIGNAL( deviceFound(const QString&,int,const QString&) ) ,
+ m_pSsdpConnection = new SsdpConnection();
+ connect(m_pSsdpConnection, SIGNAL( deviceFound(const QString&,int,const QString&) ) ,
this, SLOT( slotDeviceFound(const QString&,int,const QString&) ) );
// Create a timer
- ssdpTimer_ = new QTimer(this);
- connect(ssdpTimer_, SIGNAL(timeout()), this, SLOT(slotBroadcastTimeout()));
+ m_pSsdpTimer = new QTimer(this);
+ connect(m_pSsdpTimer, SIGNAL(timeout()), this, SLOT(slotBroadcastTimeout()));
// Start a UPnP broadcast
- broadcastFailed_ = false;
- broadcastFoundIt_ = false;
- ssdpConnection_->queryDevices();
- ssdpTimer_->start(2000, true);
+ m_bBroadcastFailed = false;
+ m_bBroadcastFoundIt = false;
+ m_pSsdpConnection->queryDevices();
+ m_pSsdpTimer->start(2000, true);
}
@@ -97,13 +97,13 @@ void Manager::initialize()
Manager * Manager::instance()
{
// Create when it's required
- if(instance_ == 0)
+ if(m_pInstance == 0)
{
- instance_ = new Manager();
- instance_->initialize();
+ m_pInstance = new Manager();
+ m_pInstance->initialize();
}
- return instance_;
+ return m_pInstance;
}
@@ -112,7 +112,7 @@ Manager * Manager::instance()
QString Manager::getExternalIpAddress() const
{
// Do not expose activeIgd_;
- return (activeIgdControlPoint_ != 0 ? activeIgdControlPoint_->getExternalIpAddress() : QString::null);
+ return (m_pActiveIgdControlPoint != 0 ? m_pActiveIgdControlPoint->getExternalIpAddress() : QString::null);
}
@@ -120,7 +120,7 @@ QString Manager::getExternalIpAddress() const
// Return true if a controlable gateway is available
bool Manager::isGatewayAvailable()
{
- return (activeIgdControlPoint_ != 0 && activeIgdControlPoint_->isGatewayAvailable());
+ return (m_pActiveIgdControlPoint != 0 && m_pActiveIgdControlPoint->isGatewayAvailable());
}
@@ -128,10 +128,10 @@ bool Manager::isGatewayAvailable()
// The broadcast failed
void Manager::slotBroadcastTimeout()
{
- if(!broadcastFoundIt_)
+ if(!m_bBroadcastFoundIt)
{
qDebug() << "UPnP::Manager: Timeout, no broadcast response received!" << endl;
- broadcastFailed_ = true;
+ m_bBroadcastFailed = true;
}
}
@@ -143,15 +143,15 @@ void Manager::slotDeviceFound(const QString &hostname, int port, const QString &
qDebug() << "UPnP::Manager: Device found, initializing IgdControlPoint to query it." << endl;
// this blocks the action of our timeout timer
- broadcastFoundIt_ = true;
+ m_bBroadcastFoundIt = true;
IgdControlPoint *controlPoint = new IgdControlPoint(hostname, port, rootUrl);
- igdControlPoints_.append(controlPoint);
+ m_lIgdControlPoints.append(controlPoint);
- if(activeIgdControlPoint_ == 0)
+ if(m_pActiveIgdControlPoint == 0)
{
- activeIgdControlPoint_ = controlPoint;
- activeIgdControlPoint_->initialize();
+ m_pActiveIgdControlPoint = controlPoint;
+ m_pActiveIgdControlPoint->initialize();
}
}
diff --git a/src/modules/upnp/manager.h b/src/modules/upnp/manager.h
index 123e9569f..db3763437 100644
--- a/src/modules/upnp/manager.h
+++ b/src/modules/upnp/manager.h
@@ -91,19 +91,19 @@ private: // private methods
private:
// The active control point we're working with
- IgdControlPoint *activeIgdControlPoint_;
+ IgdControlPoint *m_pActiveIgdControlPoint;
// True if the broadcast failed (false during the discovery process)
- bool broadcastFailed_;
+ bool m_bBroadcastFailed;
// True if the broadcast found a device (false during the discovery process)
- bool broadcastFoundIt_;
+ bool m_bBroadcastFoundIt;
// The instance of the singleton class
- static Manager *instance_;
+ static Manager *m_pInstance;
// A list of all detected gateway devices
- KviPointerList<IgdControlPoint> igdControlPoints_;
+ KviPointerList<IgdControlPoint> m_lIgdControlPoints;
// The SSDP connection to find all UPnP devices
- SsdpConnection *ssdpConnection_;
+ SsdpConnection *m_pSsdpConnection;
// The timer to detect a broadcast timeout
- QTimer *ssdpTimer_;
+ QTimer *m_pSsdpTimer;
};
diff --git a/src/modules/upnp/rootservice.cpp b/src/modules/upnp/rootservice.cpp
index 4d50bd8f4..e13a9bccf 100644
--- a/src/modules/upnp/rootservice.cpp
+++ b/src/modules/upnp/rootservice.cpp
@@ -136,8 +136,8 @@ namespace UPnP
// The contructor
RootService::RootService(const QString &hostname, int port, const QString &rootUrl)
: Service(hostname, port, rootUrl)
-, hostname_(hostname)
-, port_(port)
+, m_szHostname(hostname)
+, m_iPort(port)
{
}
@@ -157,7 +157,7 @@ void RootService::addDeviceServices(const QDomNode &device)
// Insert the given device node
// The "key" is the device/UDN tag, the value is a list of device/serviceList/service nodes
- deviceServices_.insert(XmlFunctions::getNodeValue(device, "/UDN"),
+ m_deviceServices.insert(XmlFunctions::getNodeValue(device, "/UDN"),
device.namedItem("serviceList").childNodes());
// Find all embedded device nodes
@@ -174,7 +174,7 @@ void RootService::addDeviceServices(const QDomNode &device)
// Return the device type
QString RootService::getDeviceType() const
{
- return deviceType_;
+ return m_szDeviceType;
}
@@ -183,7 +183,7 @@ QString RootService::getDeviceType() const
ServiceParameters RootService::getServiceById(const QString &serviceId) const
{
// Get a /root/device/serviceList/service/ tag
- return getServiceById(serviceId, rootUdn_);
+ return getServiceById(serviceId, m_szRootUdn);
}
@@ -192,15 +192,15 @@ ServiceParameters RootService::getServiceById(const QString &serviceId) const
ServiceParameters RootService::getServiceById(const QString &serviceId, const QString &deviceUdn) const
{
// Get a /root/device/deviceList/device/.../serviceList/service/serviceId tag
- QDomNode service = XmlFunctions::getNodeChildByKey( deviceServices_[deviceUdn], "serviceId", serviceId );
+ QDomNode service = XmlFunctions::getNodeChildByKey( m_deviceServices[deviceUdn], "serviceId", serviceId );
// Initialize a ServiceParameters struct
ServiceParameters params;
if(! service.isNull())
{
- params.hostname = hostname_;
- params.port = port_;
+ params.hostname = m_szHostname;
+ params.port = m_iPort;
params.controlUrl = XmlFunctions::getNodeValue(service, "/controlURL");
params.scpdUrl = XmlFunctions::getNodeValue(service, "/SCPDURL");
params.serviceId = XmlFunctions::getNodeValue(service, "/serviceId");
@@ -219,7 +219,7 @@ ServiceParameters RootService::getServiceById(const QString &serviceId, const QS
ServiceParameters RootService::getServiceByType(const QString &serviceType) const
{
// Get a /root/device/serviceList/service/ tag
- return getServiceByType(serviceType, rootUdn_);
+ return getServiceByType(serviceType, m_szRootUdn);
}
@@ -228,15 +228,15 @@ ServiceParameters RootService::getServiceByType(const QString &serviceType) cons
ServiceParameters RootService::getServiceByType(const QString &serviceType, const QString &deviceUdn) const
{
// Get a /root/device/deviceList/device/.../serviceList/service/serviceType tag
- QDomNode service = XmlFunctions::getNodeChildByKey( deviceServices_[deviceUdn], "serviceType", serviceType );
+ QDomNode service = XmlFunctions::getNodeChildByKey( m_deviceServices[deviceUdn], "serviceType", serviceType );
// Initialize a ServiceParameters struct
ServiceParameters params;
if(! service.isNull())
{
- params.hostname = hostname_;
- params.port = port_;
+ params.hostname = m_szHostname;
+ params.port = m_iPort;
params.controlUrl = XmlFunctions::getNodeValue(service, "/controlURL");
params.scpdUrl = XmlFunctions::getNodeValue(service, "/SCPDURL");
params.serviceId = XmlFunctions::getNodeValue(service, "/serviceId");
@@ -255,12 +255,12 @@ ServiceParameters RootService::getServiceByType(const QString &serviceType, cons
void RootService::gotInformationResponse(const QDomNode &response)
{
// Register all device UDN nodes for later
- deviceServices_.clear();
+ m_deviceServices.clear();
addDeviceServices( XmlFunctions::getNode(response, "/device") );
// Fetch the required data
- deviceType_ = XmlFunctions::getNodeValue(response, "/device/deviceType");
- rootUdn_ = XmlFunctions::getNodeValue(response, "/device/UDN");
+ m_szDeviceType = XmlFunctions::getNodeValue(response, "/device/deviceType");
+ m_szRootUdn = XmlFunctions::getNodeValue(response, "/device/UDN");
// The rootUdn_ is used to retrieve
// the /root/device/serviceList/service
diff --git a/src/modules/upnp/rootservice.h b/src/modules/upnp/rootservice.h
index ec77344a7..70ae4a074 100644
--- a/src/modules/upnp/rootservice.h
+++ b/src/modules/upnp/rootservice.h
@@ -84,15 +84,15 @@ private: // Private methods
private:
// The device type
- QString deviceType_;
+ QString m_szDeviceType;
// A collection of all services provided by the device
- QMap<QString,QDomNodeList> deviceServices_;
+ QMap<QString,QDomNodeList> m_deviceServices;
// The hostname of the device
- QString hostname_;
+ QString m_szHostname;
// The port of the device
- int port_;
+ int m_iPort;
// The udn of the root device
- QString rootUdn_;
+ QString m_szRootUdn;
};
}
diff --git a/src/modules/upnp/service.cpp b/src/modules/upnp/service.cpp
index 49548e210..3c3f903a4 100644
--- a/src/modules/upnp/service.cpp
+++ b/src/modules/upnp/service.cpp
@@ -50,28 +50,28 @@ namespace UPnP
// The constructor for information services
Service::Service(const QString &hostname, int port, const QString &informationUrl)
-: informationUrl_(informationUrl)
-, pendingRequests_(0)
+: m_szInformationUrl(informationUrl)
+, m_iPendingRequests(0)
{
- http_ = new QHttp(hostname, port);
- connect(http_, SIGNAL( requestFinished(int,bool) ) , this, SLOT( slotRequestFinished(int,bool) ) );
+ m_pHttp = new QHttp(hostname, port);
+ connect(m_pHttp, SIGNAL( requestFinished(int,bool) ) , this, SLOT( slotRequestFinished(int,bool) ) );
- qDebug() << "UPnP::Service: Created information service url='" << informationUrl_ << "'." << endl;
+ qDebug() << "UPnP::Service: Created information service url='" << m_szInformationUrl << "'." << endl;
}
// The constructor for action services
Service::Service(const ServiceParameters &params)
-: controlUrl_(params.controlUrl)
-, informationUrl_(params.scpdUrl)
-, pendingRequests_(0)
-, serviceId_(params.serviceId)
-, serviceType_(params.serviceType)
+: m_szControlUrl(params.controlUrl)
+, m_szInformationUrl(params.scpdUrl)
+, m_iPendingRequests(0)
+, m_szServiceId(params.serviceId)
+, m_szServiceType(params.serviceType)
{
- http_ = new QHttp(params.hostname, params.port);
- connect(http_, SIGNAL( requestFinished(int,bool) ) , this, SLOT( slotRequestFinished(int,bool) ) );
+ m_pHttp = new QHttp(params.hostname, params.port);
+ connect(m_pHttp, SIGNAL( requestFinished(int,bool) ) , this, SLOT( slotRequestFinished(int,bool) ) );
- qDebug() << "CREATED UPnP::Service: url='" << controlUrl_ << "' id='" << serviceId_ << "'." << endl;
+ qDebug() << "CREATED UPnP::Service: url='" << m_szControlUrl << "' id='" << m_szServiceId << "'." << endl;
}
@@ -79,9 +79,9 @@ Service::Service(const ServiceParameters &params)
// The destructor
Service::~Service()
{
- qDebug() << "DESTROYED UPnP::Service [url=" << controlUrl_ << ", id=" << serviceId_ << "]" << endl;
+ qDebug() << "DESTROYED UPnP::Service [url=" << m_szControlUrl << ", id=" << m_szServiceId << "]" << endl;
- delete http_;
+ delete m_pHttp;
}
@@ -125,7 +125,7 @@ int Service::callActionInternal(const QString &actionName, const QMap<QString,QS
QString soapMessage = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\""
" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body>"
- "<u:" + actionName + " xmlns:u=\"" + serviceType_ + "\">";
+ "<u:" + actionName + " xmlns:u=\"" + m_szServiceType + "\">";
// Do we have any arguments?
if(arguments != 0)
@@ -146,14 +146,14 @@ int Service::callActionInternal(const QString &actionName, const QMap<QString,QS
QByteArray content = soapMessage.toUtf8().data();
// Create the HTTP header
- QHttpRequestHeader header("POST", controlUrl_);
+ QHttpRequestHeader header("POST", m_szControlUrl);
header.setContentType("text/xml; charset=\"utf-8\"");
header.setContentLength(content.size());
- header.setValue("SoapAction", serviceType_ + "#" + actionName);
+ header.setValue("SoapAction", m_szServiceType + "#" + actionName);
// Send the POST request
- pendingRequests_++;
- return http_->request(header, content);
+ m_iPendingRequests++;
+ return m_pHttp->request(header, content);
}
@@ -162,12 +162,12 @@ int Service::callActionInternal(const QString &actionName, const QMap<QString,QS
// TODO: rename to downloadFile()
int Service::callInformationUrl()
{
- qDebug() << "UPnP::Service: requesting file '" << informationUrl_ << "'." << endl;
+ qDebug() << "UPnP::Service: requesting file '" << m_szInformationUrl << "'." << endl;
// Send the GET request
// TODO: User-Agent: Mozilla/4.0 (compatible; UPnP/1.0; Windows NT/5.1)
- pendingRequests_++;
- return http_->get(informationUrl_);
+ m_iPendingRequests++;
+ return m_pHttp->get(m_szInformationUrl);
}
@@ -175,7 +175,7 @@ int Service::callInformationUrl()
// Get the number of pending requests
int Service::getPendingRequests() const
{
- return pendingRequests_;
+ return m_iPendingRequests;
}
@@ -210,15 +210,15 @@ void Service::gotInformationResponse(const QDomNode &response)
// The QHttp object retrieved data.
void Service::slotRequestFinished(int id, bool error)
{
- qDebug() << "UPnP::Service: Got HTTP response for request #"<< id << ", state: " << http_->state() << ", " << http_->bytesAvailable() << " bytes." << endl;
+ qDebug() << "UPnP::Service: Got HTTP response for request #"<< id << ", state: " << m_pHttp->state() << ", " << m_pHttp->bytesAvailable() << " bytes." << endl;
if(! error)
{
// Not sure why this happens
- if(http_->bytesAvailable() > 0)
+ if(m_pHttp->bytesAvailable() > 0)
{
// Get the XML content
- QByteArray response = http_->readAll();
+ QByteArray response = m_pHttp->readAll();
QDomDocument xml;
// TODO: handle 401 Authorisation required messages
@@ -275,15 +275,15 @@ void Service::slotRequestFinished(int id, bool error)
}
// Only emit when bytes>0
- pendingRequests_--;
+ m_iPendingRequests--;
emit queryFinished(error);
} else {
- QHttpResponseHeader header = http_->lastResponse();
+ QHttpResponseHeader header = m_pHttp->lastResponse();
qDebug() << "Received zero-bytes HTTP response! Status: " << header.statusCode() << "; reason: " << header.reasonPhrase() << endl;
}
} else {
- qWarning() << "UPnP::Service - HTTP Request failed: " << http_->errorString() << endl;
- pendingRequests_--;
+ qWarning() << "UPnP::Service - HTTP Request failed: " << m_pHttp->errorString() << endl;
+ m_iPendingRequests--;
emit queryFinished(error);
}
diff --git a/src/modules/upnp/service.h b/src/modules/upnp/service.h
index c888eaebb..2d4e56d8c 100644
--- a/src/modules/upnp/service.h
+++ b/src/modules/upnp/service.h
@@ -108,17 +108,17 @@ private:
private:
// The URL to control the service
- QString controlUrl_;
+ QString m_szControlUrl;
// The HTTP requester
- QHttp *http_;
+ QHttp *m_pHttp;
// The URL to request service information
- QString informationUrl_;
+ QString m_szInformationUrl;
// The number of pending queries/actions
- int pendingRequests_;
+ int m_iPendingRequests;
// The ID of the service
- QString serviceId_;
+ QString m_szServiceId;
// The Type of the service
- QString serviceType_;
+ QString m_szServiceType;
signals:
// Called when a query completed
diff --git a/src/modules/upnp/ssdpconnection.cpp b/src/modules/upnp/ssdpconnection.cpp
index bc3e4a48a..7297453e6 100644
--- a/src/modules/upnp/ssdpconnection.cpp
+++ b/src/modules/upnp/ssdpconnection.cpp
@@ -45,16 +45,16 @@ namespace UPnP
SsdpConnection::SsdpConnection()
: QObject()
{
- socket_ = new QUdpSocket();
- connect(socket_, SIGNAL(readyRead()), this, SLOT(slotDataReceived()));
+ m_pSocket = new QUdpSocket();
+ connect(m_pSocket, SIGNAL(readyRead()), this, SLOT(slotDataReceived()));
}
SsdpConnection::~SsdpConnection()
{
- if(socket_ != 0)
+ if(m_pSocket != 0)
{
- socket_->close();
- delete socket_;
+ m_pSocket->close();
+ delete m_pSocket;
}
}
@@ -63,7 +63,7 @@ SsdpConnection::~SsdpConnection()
// Data was received by the socket
void SsdpConnection::slotDataReceived()
{
- qDebug() << "UPnP::SsdpConnection: received " << socket_->bytesAvailable() << " bytes." << endl;
+ qDebug() << "UPnP::SsdpConnection: received " << m_pSocket->bytesAvailable() << " bytes." << endl;
// Response from Diederik's Acatel router:
//
@@ -86,10 +86,10 @@ void SsdpConnection::slotDataReceived()
// Server: ZyXEL-RomPlug/4.51 UPnP/1.0 IGD/1.00
// Ext:
- while (socket_->hasPendingDatagrams()) {
+ while (m_pSocket->hasPendingDatagrams()) {
QByteArray datagram;
- datagram.resize(socket_->pendingDatagramSize());
- socket_->readDatagram(datagram.data(), datagram.size());
+ datagram.resize(m_pSocket->pendingDatagramSize());
+ m_pSocket->readDatagram(datagram.data(), datagram.size());
qDebug("Received datagram: %s\n",datagram.data());
@@ -130,7 +130,7 @@ void SsdpConnection::queryDevices(int bindPort)
"\r\n";
// Bind the socket to a certain port
- bool success = socket_->bind(bindPort);
+ bool success = m_pSocket->bind(bindPort);
if(! success)
{
qDebug() << "UPnP::SsdpConnection: Failed to bind to port " << bindPort << "." << endl;
@@ -138,7 +138,7 @@ void SsdpConnection::queryDevices(int bindPort)
// Send the data
QByteArray dataBlock = data.utf8();
- int bytesWritten = socket_->writeDatagram(dataBlock.data(), dataBlock.size(), address, 1900);
+ int bytesWritten = m_pSocket->writeDatagram(dataBlock.data(), dataBlock.size(), address, 1900);
if(bytesWritten == -1)
{
diff --git a/src/modules/upnp/ssdpconnection.h b/src/modules/upnp/ssdpconnection.h
index 88fe41aa6..446b0a8ce 100644
--- a/src/modules/upnp/ssdpconnection.h
+++ b/src/modules/upnp/ssdpconnection.h
@@ -67,7 +67,7 @@ class SsdpConnection : public QObject
void slotDataReceived();
private:
- QUdpSocket *socket_;
+ QUdpSocket *m_pSocket;
signals:
// Called when a query completed
void deviceFound(const QString &hostname, int port, const QString &rootUrl);
diff --git a/src/modules/upnp/wanconnectionservice.cpp b/src/modules/upnp/wanconnectionservice.cpp
index 53010a363..fddbde34c 100644
--- a/src/modules/upnp/wanconnectionservice.cpp
+++ b/src/modules/upnp/wanconnectionservice.cpp
@@ -40,7 +40,7 @@ namespace UPnP
// The constructor
WanConnectionService::WanConnectionService(const ServiceParameters &params)
: Service(params)
- , natEnabled_(false)
+ , m_bNatEnabled(false)
{
}
@@ -90,7 +90,7 @@ void WanConnectionService::deletePortMapping(const QString &protocol, const QStr
// Return the external IP address
QString WanConnectionService::getExternalIpAddress() const
{
- return externalIpAddress_;
+ return m_szExternalIpAddress;
}
@@ -98,7 +98,7 @@ QString WanConnectionService::getExternalIpAddress() const
// Return true if NAT is enabled
bool WanConnectionService::getNatEnabled() const
{
- return natEnabled_;
+ return m_bNatEnabled;
}
@@ -106,7 +106,7 @@ bool WanConnectionService::getNatEnabled() const
// Return the port mappings
const KviPointerList<PortMapping>& WanConnectionService::getPortMappings() const
{
- return portMappings_;
+ return m_lPortMappings;
}
@@ -121,16 +121,16 @@ void WanConnectionService::gotActionResponse(const QString &responseType, const
if(responseType == "GetExternalIPAddressResponse")
{
// Get the external IP address from the response
- externalIpAddress_ = resultValues["NewExternalIPAddress"];
+ m_szExternalIpAddress = resultValues["NewExternalIPAddress"];
- qDebug() << "UPnP::WanConnectionService: externalIp='" << externalIpAddress_ << "'." << endl;
+ qDebug() << "UPnP::WanConnectionService: externalIp='" << m_szExternalIpAddress << "'." << endl;
}
else if(responseType == "GetNATRSIPStatusResponse")
{
// Get the nat status from the response
- natEnabled_ = (resultValues["NewNATEnabled"] == "1");
+ m_bNatEnabled = (resultValues["NewNATEnabled"] == "1");
- qDebug() << "UPnP::WanConnectionService: natEnabled=" << natEnabled_ << "." << endl;
+ qDebug() << "UPnP::WanConnectionService: natEnabled=" << m_bNatEnabled << "." << endl;
}
else if(responseType == "GetGenericPortMappingEntryResponse")
{
@@ -148,7 +148,7 @@ void WanConnectionService::gotActionResponse(const QString &responseType, const
map->remoteHost = resultValues["NewRemoteHost"];
// Register the mapping
- portMappings_.append(map);
+ m_lPortMappings.append(map);
qDebug() << "UPnP::WanConnectionService - Got mapping: " << map->protocol << " " << map->remoteHost << ":" << map->externalPort
<< " to " << map->internalClient << ":" << map->internalPort
diff --git a/src/modules/upnp/wanconnectionservice.h b/src/modules/upnp/wanconnectionservice.h
index 72642d728..db0fbf382 100644
--- a/src/modules/upnp/wanconnectionservice.h
+++ b/src/modules/upnp/wanconnectionservice.h
@@ -101,11 +101,11 @@ class WanConnectionService : public Service
private: // private attributes
// The external IP address
- QString externalIpAddress_;
+ QString m_szExternalIpAddress;
// True if NAT is enabled
- bool natEnabled_;
+ bool m_bNatEnabled;
// The current port mappings
- KviPointerList<PortMapping> portMappings_;
+ KviPointerList<PortMapping> m_lPortMappings;
};
}