summaryrefslogtreecommitdiffstats
path: root/src/upnp/upnprouter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/upnp/upnprouter.cpp')
-rw-r--r--src/upnp/upnprouter.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/upnp/upnprouter.cpp b/src/upnp/upnprouter.cpp
index 4d8f5ad..8e39f33 100644
--- a/src/upnp/upnprouter.cpp
+++ b/src/upnp/upnprouter.cpp
@@ -22,7 +22,7 @@
#include <kdebug.h>
#include <kglobal.h>
#include <kstandarddirs.h>
-#include <qstringlist.h>
+#include <ntqstringlist.h>
#include <kio/netaccess.h>
#include <kio/job.h>
#include "httprequest.h"
@@ -31,8 +31,8 @@
#include "soap.h"
#include "../functions.h"
#include <fcntl.h>
-#include <qdir.h>
-#include <qfile.h>
+#include <ntqdir.h>
+#include <ntqfile.h>
using namespace bt;
using namespace net;
@@ -52,7 +52,7 @@ namespace kt
this->scpdurl = s.scpdurl;
}
- void UPnPService::setProperty(const QString & name,const QString & value)
+ void UPnPService::setProperty(const TQString & name,const TQString & value)
{
if (name == "serviceType")
servicetype = value;
@@ -92,7 +92,7 @@ namespace kt
///////////////////////////////////////
- void UPnPDeviceDescription::setProperty(const QString & name,const QString & value)
+ void UPnPDeviceDescription::setProperty(const TQString & name,const TQString & value)
{
if (name == "friendlyName")
friendlyName = value;
@@ -108,17 +108,17 @@ namespace kt
///////////////////////////////////////
- UPnPRouter::UPnPRouter(const QString & server,const KURL & location,bool verbose) : server(server),location(location),verbose(verbose)
+ UPnPRouter::UPnPRouter(const TQString & server,const KURL & location,bool verbose) : server(server),location(location),verbose(verbose)
{
forwardedPortList = new ForwardPortList();
// make the tmp_file unique, current time * a random number should be enough
- tmp_file = QString("/tmp/tork_upnp_description-%1.xml").arg(bt::GetCurrentTime() * rand());
+ tmp_file = TQString("/tmp/tork_upnp_description-%1.xml").arg(bt::GetCurrentTime() * rand());
}
UPnPRouter::~UPnPRouter()
{
- QValueList<HTTPRequest*>::iterator i = active_reqs.begin();
+ TQValueList<HTTPRequest*>::iterator i = active_reqs.begin();
while (i != active_reqs.end())
{
(*i)->deleteLater();
@@ -128,7 +128,7 @@ namespace kt
void UPnPRouter::addService(const UPnPService & s)
{
- QValueList<UPnPService>::iterator i = services.begin();
+ TQValueList<UPnPService>::iterator i = services.begin();
while (i != services.end())
{
UPnPService & os = *i;
@@ -147,14 +147,14 @@ namespace kt
return;
}
- QString target = tmp_file;
+ TQString target = tmp_file;
// load in the file (target is always local)
UPnPDescriptionParser desc_parse;
bool ret = desc_parse.parse(target,this);
if (!ret)
{
kdDebug() << "Error parsing router description !" << endl;
- QString dest = KGlobal::dirs()->saveLocation("data","tork") + "upnp_failure";
+ TQString dest = KGlobal::dirs()->saveLocation("data","tork") + "upnp_failure";
KIO::file_copy(target,dest,-1,true,false,false);
}
else
@@ -163,7 +163,7 @@ namespace kt
debugPrintData();
}
xmlFileDownloaded(this,ret);
- remove(QFile::encodeName(target));
+ remove(TQFile::encodeName(target));
}
void UPnPRouter::downloadXMLFile()
@@ -181,7 +181,7 @@ namespace kt
kdDebug() << "Model description = " << desc.modelDescription << endl;
kdDebug() << "Model name = " << desc.modelName << endl;
kdDebug() << "Model number = " << desc.modelNumber << endl;
- for (QValueList<UPnPService>::iterator i = services.begin();i != services.end();i++)
+ for (TQValueList<UPnPService>::iterator i = services.begin();i != services.end();i++)
{
UPnPService & s = *i;
kdDebug() << "Service : " << endl;
@@ -198,14 +198,14 @@ namespace kt
// add all the arguments for the command
- QValueList<SOAP::Arg> args;
+ TQValueList<SOAP::Arg> args;
SOAP::Arg a;
a.element = "NewRemoteHost";
args.append(a);
// the external port
a.element = "NewExternalPort";
- a.value = QString::number(externalport.number);
+ a.value = TQString::number(externalport.number);
args.append(a);
// the protocol
@@ -216,9 +216,9 @@ namespace kt
// the local port
a.element = "NewInternalPort";
if (internalport.number)
- a.value = QString::number(internalport.number);
+ a.value = TQString::number(internalport.number);
else
- a.value = QString::number(externalport.number);
+ a.value = TQString::number(externalport.number);
args.append(a);
// the local IP address
@@ -232,19 +232,19 @@ namespace kt
a.element = "NewPortMappingDescription";
static Uint32 cnt = 0;
- a.value = QString("TorK UPNP %1").arg(cnt++); // TODO: change this
+ a.value = TQString("TorK UPNP %1").arg(cnt++); // TODO: change this
args.append(a);
a.element = "NewLeaseDuration";
a.value = "0";
args.append(a);
- QString action = "AddPortMapping";
- QString comm = SOAP::createCommand(action,srv->servicetype,args);
+ TQString action = "AddPortMapping";
+ TQString comm = SOAP::createCommand(action,srv->servicetype,args);
Forwarding fw = {externalport,internalport,0,srv};
// erase old forwarding if one exists
- QValueList<Forwarding>::iterator itr = fwds.begin();
+ TQValueList<Forwarding>::iterator itr = fwds.begin();
while (itr != fwds.end())
{
Forwarding & fwo = *itr;
@@ -260,7 +260,7 @@ namespace kt
//Track the forwarding request so we can know whether it was successful or not
//and keep a map of successfully forwarded ports in forwardedPorts
ForwardingRequest fwreq = {externalport,internalport,fw.pending_req};
- QValueList<ForwardingRequest>::iterator itrq = fwdreqs.begin();
+ TQValueList<ForwardingRequest>::iterator itrq = fwdreqs.begin();
while (itrq != fwdreqs.end())
{
ForwardingRequest & fwo = *itrq;
@@ -286,7 +286,7 @@ namespace kt
kdDebug() << "Forwarding port " << externalport.number << " (" << (externalport.proto == UDP ? "UDP" : "TCP") << ")" << endl;
// first find the right service
- QValueList<UPnPService>::iterator i = services.begin();
+ TQValueList<UPnPService>::iterator i = services.begin();
while (i != services.end())
{
UPnPService & s = *i;
@@ -307,14 +307,14 @@ namespace kt
const net::Port & intport,bt::WaitJob* waitjob)
{
// add all the arguments for the command
- QValueList<SOAP::Arg> args;
+ TQValueList<SOAP::Arg> args;
SOAP::Arg a;
a.element = "NewRemoteHost";
args.append(a);
// the external port
a.element = "NewExternalPort";
- a.value = QString::number(extport.number);
+ a.value = TQString::number(extport.number);
args.append(a);
// the protocol
@@ -323,12 +323,12 @@ namespace kt
args.append(a);
- QString action = "DeletePortMapping";
- QString comm = SOAP::createCommand(action,srv->servicetype,args);
+ TQString action = "DeletePortMapping";
+ TQString comm = SOAP::createCommand(action,srv->servicetype,args);
bt::HTTPRequest* r = sendSoapQuery(comm,srv->servicetype + "#" + action,srv->controlurl,waitjob != 0,false);
ForwardingRequest fwreq = {extport,intport,r};
- QValueList<ForwardingRequest>::iterator itrq = fwdreqs.begin();
+ TQValueList<ForwardingRequest>::iterator itrq = fwdreqs.begin();
while (itrq != fwdreqs.end())
{
ForwardingRequest & fwo = *itrq;
@@ -353,7 +353,7 @@ namespace kt
kdDebug() << "Undoing forward of port " << externalport.number
<< " (" << (externalport.proto == UDP ? "UDP" : "TCP") << ")" << endl;
- QValueList<Forwarding>::iterator itr = fwds.begin();
+ TQValueList<Forwarding>::iterator itr = fwds.begin();
while (itr != fwds.end())
{
Forwarding & wd = *itr;
@@ -369,14 +369,14 @@ namespace kt
}
}
- bt::HTTPRequest* UPnPRouter::sendSoapQuery(const QString & query,const QString & soapact,const QString & controlurl, bool fwd,bool at_exit)
+ bt::HTTPRequest* UPnPRouter::sendSoapQuery(const TQString & query,const TQString & soapact,const TQString & controlurl, bool fwd,bool at_exit)
{
// if port is not set, 0 will be returned
// thanks to Diego R. Brogna for spotting this bug
if (location.port()==0)
location.setPort(80);
- QString http_hdr = QString(
+ TQString http_hdr = TQString(
"POST %1 HTTP/1.1\r\n"
"HOST: %2:%3\r\n"
"Content-length: $CONTENT_LENGTH\r\n"
@@ -386,10 +386,10 @@ namespace kt
HTTPRequest* r = new HTTPRequest(http_hdr,query,location.host(),location.port(),verbose, fwd);
- connect(r,SIGNAL(replyError(bt::HTTPRequest* ,const QString& ,bool)),
- this,SLOT(onReplyError(bt::HTTPRequest* ,const QString& ,bool)));
- connect(r,SIGNAL(replyOK(bt::HTTPRequest* ,const QString& ,bool)),
- this,SLOT(onReplyOK(bt::HTTPRequest* ,const QString& ,bool)));
+ connect(r,SIGNAL(replyError(bt::HTTPRequest* ,const TQString& ,bool)),
+ this,SLOT(onReplyError(bt::HTTPRequest* ,const TQString& ,bool)));
+ connect(r,SIGNAL(replyOK(bt::HTTPRequest* ,const TQString& ,bool)),
+ this,SLOT(onReplyOK(bt::HTTPRequest* ,const TQString& ,bool)));
connect(r,SIGNAL(error(bt::HTTPRequest*, bool )),
this,SLOT(onError(bt::HTTPRequest*, bool )));
r->start();
@@ -400,7 +400,7 @@ namespace kt
void UPnPRouter::httpRequestDone(bt::HTTPRequest* r,bool erase_fwd)
{
- QValueList<Forwarding>::iterator i = fwds.begin();
+ TQValueList<Forwarding>::iterator i = fwds.begin();
while (i != fwds.end())
{
Forwarding & fw = *i;
@@ -419,11 +419,11 @@ namespace kt
r->deleteLater();
}
- void UPnPRouter::onReplyOK(bt::HTTPRequest* r,const QString & s,bool fwd)
+ void UPnPRouter::onReplyOK(bt::HTTPRequest* r,const TQString & s,bool fwd)
{
kdDebug() << "UPnPRouter : OK" << endl;
kdDebug() << "FWD : " << fwd << endl;
- QValueList<ForwardingRequest>::iterator i = fwdreqs.begin();
+ TQValueList<ForwardingRequest>::iterator i = fwdreqs.begin();
while (i != fwdreqs.end())
{
ForwardingRequest & fw = *i;
@@ -444,7 +444,7 @@ namespace kt
httpRequestDone(r,false);
}
- void UPnPRouter::onReplyError(bt::HTTPRequest* r,const QString & s,bool fwd)
+ void UPnPRouter::onReplyError(bt::HTTPRequest* r,const TQString & s,bool fwd)
{
if (verbose)
kdDebug() << "UPnPRouter : Error" << endl;