summaryrefslogtreecommitdiffstats
path: root/src/upnp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-07-27 16:57:53 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-27 18:48:46 +0200
commit7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931 (patch)
tree4655c7263ca5c64d23d10167cb459dd9cb253815 /src/upnp
parent88ea2b6cd4382627fb6efca9cc54825aee881d1e (diff)
downloadtork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.tar.gz
tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.zip
Initial TQt conversion
Diffstat (limited to 'src/upnp')
-rw-r--r--src/upnp/exitoperation.h4
-rw-r--r--src/upnp/forwardportlist.h4
-rw-r--r--src/upnp/httprequest.cpp14
-rw-r--r--src/upnp/httprequest.h12
-rw-r--r--src/upnp/portlist.h4
-rw-r--r--src/upnp/soap.cpp12
-rw-r--r--src/upnp/soap.h12
-rw-r--r--src/upnp/upnpdescriptionparser.cpp42
-rw-r--r--src/upnp/upnpdescriptionparser.h2
-rw-r--r--src/upnp/upnpmcastsocket.cpp46
-rw-r--r--src/upnp/upnpmcastsocket.h10
-rw-r--r--src/upnp/upnprouter.cpp78
-rw-r--r--src/upnp/upnprouter.h72
13 files changed, 156 insertions, 156 deletions
diff --git a/src/upnp/exitoperation.h b/src/upnp/exitoperation.h
index edaa2fa..4a27911 100644
--- a/src/upnp/exitoperation.h
+++ b/src/upnp/exitoperation.h
@@ -20,7 +20,7 @@
#ifndef KTEXITOPERATION_H
#define KTEXITOPERATION_H
-#include <qobject.h>
+#include <ntqobject.h>
#include <kio/job.h>
namespace kt
@@ -35,7 +35,7 @@ namespace kt
* ExitOperation's can be used in combination with a WaitJob, to wait for a certain amount of time
* to give serveral ExitOperation's the time time to finish up.
*/
- class ExitOperation : public QObject
+ class ExitOperation : public TQObject
{
Q_OBJECT
public:
diff --git a/src/upnp/forwardportlist.h b/src/upnp/forwardportlist.h
index 2a27f59..5f8f9f7 100644
--- a/src/upnp/forwardportlist.h
+++ b/src/upnp/forwardportlist.h
@@ -20,7 +20,7 @@
#ifndef FORWARDPORTLIST_H
#define FORWARDPORTLIST_H
-#include <qvaluelist.h>
+#include <ntqvaluelist.h>
#include "../constants.h"
#include "portlist.h"
@@ -67,7 +67,7 @@ namespace net
* List of ports which are currently being used.
*
*/
- class ForwardPortList : public QValueList<ForwardPort>
+ class ForwardPortList : public TQValueList<ForwardPort>
{
ForwardPortListener* lst;
public:
diff --git a/src/upnp/httprequest.cpp b/src/upnp/httprequest.cpp
index 5a612b0..bb411ca 100644
--- a/src/upnp/httprequest.cpp
+++ b/src/upnp/httprequest.cpp
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qstringlist.h>
+#include <ntqstringlist.h>
#include "httprequest.h"
#include "../functions.h"
#include <kdebug.h>
@@ -27,10 +27,10 @@
namespace bt
{
- HTTPRequest::HTTPRequest(const QString & hdr,const QString & payload,const QString & host,Uint16 port,bool verbose, bool fwd) : hdr(hdr),payload(payload),verbose(verbose),fwd(fwd)
+ HTTPRequest::HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host,Uint16 port,bool verbose, bool fwd) : hdr(hdr),payload(payload),verbose(verbose),fwd(fwd)
{
KSocks::self()->disableSocks();
- sock = new KNetwork::KStreamSocket(host,QString::number(port),this,0);
+ sock = new KNetwork::KStreamSocket(host,TQString::number(port),this,0);
sock->enableRead(true);
sock->enableWrite(true);
sock->setTimeout(30000);
@@ -57,9 +57,9 @@ namespace bt
void HTTPRequest::onConnect(const KResolverEntry&)
{
payload = payload.replace("$LOCAL_IP",sock->localAddress().nodeName());
- hdr = hdr.replace("$CONTENT_LENGTH",QString::number(payload.length()));
+ hdr = hdr.replace("$CONTENT_LENGTH",TQString::number(payload.length()));
- QString req = hdr + payload;
+ TQString req = hdr + payload;
/* if (verbose)
{
KdDebug() << "Sending " << endl;
@@ -80,8 +80,8 @@ namespace bt
Array<char> data(ba);
ba = sock->readBlock(data,ba);
- QString strdata((const char*)data);
- QStringList sl = QStringList::split("\r\n",strdata,false);
+ TQString strdata((const char*)data);
+ TQStringList sl = TQStringList::split("\r\n",strdata,false);
/* if (verbose)
{
diff --git a/src/upnp/httprequest.h b/src/upnp/httprequest.h
index 9832da8..8c4496b 100644
--- a/src/upnp/httprequest.h
+++ b/src/upnp/httprequest.h
@@ -20,7 +20,7 @@
#ifndef BTHTTPREQUEST_H
#define BTHTTPREQUEST_H
-#include <qobject.h>
+#include <ntqobject.h>
#include <kurl.h>
#include <kstreamsocket.h>
#include "exitoperation.h"
@@ -50,7 +50,7 @@ namespace bt
* @param port THe port
* @param verbose Print traffic to the log
*/
- HTTPRequest(const QString & hdr,const QString & payload,const QString & host,
+ HTTPRequest(const TQString & hdr,const TQString & payload,const TQString & host,
Uint16 port,bool verbose, bool fwd);
virtual ~HTTPRequest();
@@ -58,21 +58,21 @@ namespace bt
* Open a connetion and send the request.
*/
void start();
- QString showPayload(){return payload;};
+ TQString showPayload(){return payload;};
signals:
/**
* An OK reply was sent.
* @param r The sender of the request
* @param data The data of the reply
*/
- void replyOK(bt::HTTPRequest* r,const QString & data, bool fwd);
+ void replyOK(bt::HTTPRequest* r,const TQString & data, bool fwd);
/**
* Anything else but an 200 OK was sent.
* @param r The sender of the request
* @param data The data of the reply
*/
- void replyError(bt::HTTPRequest* r,const QString & data, bool fwd);
+ void replyError(bt::HTTPRequest* r,const TQString & data, bool fwd);
/**
* No reply was sent and an error or timeout occurred.
@@ -89,7 +89,7 @@ namespace bt
private:
KNetwork::KStreamSocket* sock;
- QString hdr,payload;
+ TQString hdr,payload;
bool verbose,fwd;
};
diff --git a/src/upnp/portlist.h b/src/upnp/portlist.h
index 5063b78..378127e 100644
--- a/src/upnp/portlist.h
+++ b/src/upnp/portlist.h
@@ -20,7 +20,7 @@
#ifndef NETPORTLIST_H
#define NETPORTLIST_H
-#include <qvaluelist.h>
+#include <ntqvaluelist.h>
#include "../constants.h"
namespace net
@@ -69,7 +69,7 @@ namespace net
* List of ports which are currently being used.
*
*/
- class PortList : public QValueList<Port>
+ class PortList : public TQValueList<Port>
{
PortListener* lst;
public:
diff --git a/src/upnp/soap.cpp b/src/upnp/soap.cpp
index b155b55..c44ab1e 100644
--- a/src/upnp/soap.cpp
+++ b/src/upnp/soap.cpp
@@ -22,9 +22,9 @@
namespace kt
{
- QString SOAP::createCommand(const QString & action,const QString & service)
+ TQString SOAP::createCommand(const TQString & action,const TQString & service)
{
- QString comm = QString("<?xml version=\"1.0\"?>\r\n"
+ TQString comm = TQString("<?xml version=\"1.0\"?>\r\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<SOAP-ENV:Body>"
"<m:%1 xmlns:m=\"%2\"/>"
@@ -34,20 +34,20 @@ namespace kt
return comm;
}
- QString SOAP::createCommand(const QString & action,const QString & service,const QValueList<Arg> & args)
+ TQString SOAP::createCommand(const TQString & action,const TQString & service,const TQValueList<Arg> & args)
{
- QString comm = QString("<?xml version=\"1.0\"?>\r\n"
+ TQString comm = TQString("<?xml version=\"1.0\"?>\r\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<SOAP-ENV:Body>"
"<m:%1 xmlns:m=\"%2\">").arg(action).arg(service);
- for (QValueList<Arg>::const_iterator i = args.begin();i != args.end();i++)
+ for (TQValueList<Arg>::const_iterator i = args.begin();i != args.end();i++)
{
const Arg & a = *i;
comm += "<" + a.element + ">" + a.value + "</" + a.element + ">";
}
- comm += QString("</m:%1></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n").arg(action);
+ comm += TQString("</m:%1></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n").arg(action);
return comm;
}
}
diff --git a/src/upnp/soap.h b/src/upnp/soap.h
index c11e2ed..cb766f0 100644
--- a/src/upnp/soap.h
+++ b/src/upnp/soap.h
@@ -20,8 +20,8 @@
#ifndef KTSOAP_H
#define KTSOAP_H
-#include <qvaluelist.h>
-#include <qstring.h>
+#include <ntqvaluelist.h>
+#include <ntqstring.h>
namespace kt
{
@@ -39,12 +39,12 @@ namespace kt
* @param service The name of the service
* @return The command
*/
- static QString createCommand(const QString & action,const QString & service);
+ static TQString createCommand(const TQString & action,const TQString & service);
struct Arg
{
- QString element;
- QString value;
+ TQString element;
+ TQString value;
};
/**
@@ -54,7 +54,7 @@ namespace kt
* @param args Arguments for command
* @return The command
*/
- static QString createCommand(const QString & action,const QString & service,const QValueList<Arg> & args);
+ static TQString createCommand(const TQString & action,const TQString & service,const TQValueList<Arg> & args);
};
}
diff --git a/src/upnp/upnpdescriptionparser.cpp b/src/upnp/upnpdescriptionparser.cpp
index f27b6cd..7b40db7 100644
--- a/src/upnp/upnpdescriptionparser.cpp
+++ b/src/upnp/upnpdescriptionparser.cpp
@@ -17,8 +17,8 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qxml.h>
-#include <qvaluestack.h>
+#include <ntqxml.h>
+#include <ntqvaluestack.h>
// #include <util/fileops.h>
#include <kdebug.h>
// #include <torrent/globals.h>
@@ -30,17 +30,17 @@ using namespace bt;
namespace kt
{
- class XMLContentHandler : public QXmlDefaultHandler
+ class XMLContentHandler : public TQXmlDefaultHandler
{
enum Status
{
TOPLEVEL,ROOT,DEVICE,SERVICE,FIELD,OTHER
};
- QString tmp;
+ TQString tmp;
UPnPRouter* router;
UPnPService curr_service;
- QValueStack<Status> status_stack;
+ TQValueStack<Status> status_stack;
public:
XMLContentHandler(UPnPRouter* router);
virtual ~XMLContentHandler();
@@ -48,13 +48,13 @@ namespace kt
bool startDocument();
bool endDocument();
- bool startElement(const QString &, const QString & localName, const QString &,
- const QXmlAttributes & atts);
- bool endElement(const QString & , const QString & localName, const QString & );
- bool characters(const QString & ch);
+ bool startElement(const TQString &, const TQString & localName, const TQString &,
+ const TQXmlAttributes & atts);
+ bool endElement(const TQString & , const TQString & localName, const TQString & );
+ bool characters(const TQString & ch);
- bool interestingDeviceField(const QString & name);
- bool interestingServiceField(const QString & name);
+ bool interestingDeviceField(const TQString & name);
+ bool interestingServiceField(const TQString & name);
};
@@ -65,17 +65,17 @@ namespace kt
UPnPDescriptionParser::~UPnPDescriptionParser()
{}
- bool UPnPDescriptionParser::parse(const QString & file,UPnPRouter* router)
+ bool UPnPDescriptionParser::parse(const TQString & file,UPnPRouter* router)
{
bool ret = true;
{
- QFile fptr(file);
+ TQFile fptr(file);
if (!fptr.open(IO_ReadOnly))
return false;
- QXmlInputSource input(&fptr);
+ TQXmlInputSource input(&fptr);
XMLContentHandler chandler(router);
- QXmlSimpleReader reader;
+ TQXmlSimpleReader reader;
reader.setContentHandler(&chandler);
ret = reader.parse(&input,false);
@@ -111,21 +111,21 @@ namespace kt
return true;
}
- bool XMLContentHandler::interestingDeviceField(const QString & name)
+ bool XMLContentHandler::interestingDeviceField(const TQString & name)
{
return name == "friendlyName" || name == "manufacturer" || name == "modelDescription" ||
name == "modelName" || name == "modelNumber";
}
- bool XMLContentHandler::interestingServiceField(const QString & name)
+ bool XMLContentHandler::interestingServiceField(const TQString & name)
{
return name == "serviceType" || name == "serviceId" || name == "SCPDURL" ||
name == "controlURL" || name == "eventSubURL";
}
- bool XMLContentHandler::startElement(const QString &, const QString & localName, const QString &,
- const QXmlAttributes & )
+ bool XMLContentHandler::startElement(const TQString &, const TQString & localName, const TQString &,
+ const TQXmlAttributes & )
{
tmp = "";
switch (status_stack.top())
@@ -172,7 +172,7 @@ namespace kt
return true;
}
- bool XMLContentHandler::endElement(const QString & , const QString & localName, const QString & )
+ bool XMLContentHandler::endElement(const TQString & , const TQString & localName, const TQString & )
{
switch (status_stack.top())
{
@@ -208,7 +208,7 @@ namespace kt
}
- bool XMLContentHandler::characters(const QString & ch)
+ bool XMLContentHandler::characters(const TQString & ch)
{
if (ch.length() > 0)
{
diff --git a/src/upnp/upnpdescriptionparser.h b/src/upnp/upnpdescriptionparser.h
index 5d4bf1e..2aaacfe 100644
--- a/src/upnp/upnpdescriptionparser.h
+++ b/src/upnp/upnpdescriptionparser.h
@@ -41,7 +41,7 @@ namespace kt
* @param router The router off the xml description
* @return true upon success
*/
- bool parse(const QString & file,UPnPRouter* router);
+ bool parse(const TQString & file,UPnPRouter* router);
};
}
diff --git a/src/upnp/upnpmcastsocket.cpp b/src/upnp/upnpmcastsocket.cpp
index 48159c2..70853de 100644
--- a/src/upnp/upnpmcastsocket.cpp
+++ b/src/upnp/upnpmcastsocket.cpp
@@ -27,13 +27,13 @@
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
-#include <qstringlist.h>
+#include <ntqstringlist.h>
#include <ksocketdevice.h>
#include <ksocketaddress.h>
/*#include <util/log.h>
#include <torrent/globals.h>*/
-#include <qfile.h>
-#include <qtextstream.h>
+#include <ntqfile.h>
+#include <ntqtextstream.h>
#include "upnpmcastsocket.h"
@@ -47,14 +47,14 @@ namespace kt
UPnPMCastSocket::UPnPMCastSocket(bool verbose) : verbose(verbose)
{
routers.setAutoDelete(true);
- QObject::connect(this,SIGNAL(readyRead()),this,SLOT(onReadyRead()));
- QObject::connect(this,SIGNAL(gotError(int)),this,SLOT(onError(int)));
+ TQObject::connect(this,SIGNAL(readyRead()),this,SLOT(onReadyRead()));
+ TQObject::connect(this,SIGNAL(gotError(int)),this,SLOT(onError(int)));
setAddressReuseable(true);
setFamily(KNetwork::KResolver::IPv4Family);
setBlocking(true);
for (Uint32 i = 0;i < 10;i++)
{
- if (!bind(QString::null,QString::number(1900 + i)))
+ if (!bind(TQString::null,TQString::number(1900 + i)))
kdDebug() << "Cannot bind to UDP port 1900" << endl;
else
break;
@@ -67,8 +67,8 @@ namespace kt
UPnPMCastSocket::~UPnPMCastSocket()
{
leaveUPnPMCastGroup();
- QObject::disconnect(this,SIGNAL(readyRead()),this,SLOT(onReadyRead()));
- QObject::disconnect(this,SIGNAL(gotError(int)),this,SLOT(onError(int)));
+ TQObject::disconnect(this,SIGNAL(readyRead()),this,SLOT(onReadyRead()));
+ TQObject::disconnect(this,SIGNAL(gotError(int)),this,SLOT(onError(int)));
}
void UPnPMCastSocket::discover()
@@ -135,14 +135,14 @@ namespace kt
if (verbose)
{
kdDebug() << "Received : " << endl;
- kdDebug() << QString(p.data()) << endl;
+ kdDebug() << TQString(p.data()) << endl;
}
// try to make a router of it
UPnPRouter* r = parseResponse(p.data());
if (r)
{
- QObject::connect(r,SIGNAL(xmlFileDownloaded( UPnPRouter*, bool )),
+ TQObject::connect(r,SIGNAL(xmlFileDownloaded( UPnPRouter*, bool )),
this,SLOT(onXmlFileDownloaded( UPnPRouter*, bool )));
// download it's xml file
@@ -150,10 +150,10 @@ namespace kt
}
}
- UPnPRouter* UPnPMCastSocket::parseResponse(const QByteArray & arr)
+ UPnPRouter* UPnPMCastSocket::parseResponse(const TQByteArray & arr)
{
- QStringList lines = QStringList::split("\r\n",QString(arr),false);
- QString server;
+ TQStringList lines = TQStringList::split("\r\n",TQString(arr),false);
+ TQString server;
KURL location;
@@ -163,7 +163,7 @@ namespace kt
// first read first line and see if contains a HTTP 200 OK message
- QString line = lines.first();
+ TQString line = lines.first();
if (!line.contains("HTTP"))
{
// it is either a 200 OK or a NOTIFY
@@ -225,9 +225,9 @@ namespace kt
kdDebug() << "UPnPMCastSocket Error : " << errorString() << endl;
}
- void UPnPMCastSocket::saveRouters(const QString & file)
+ void UPnPMCastSocket::saveRouters(const TQString & file)
{
- QFile fptr(file);
+ TQFile fptr(file);
if (!fptr.open(IO_WriteOnly))
{
kdDebug() << "Cannot open file " << file << " : " << fptr.errorString() << endl;
@@ -236,8 +236,8 @@ namespace kt
// file format is simple : 2 lines per router,
// one containing the server, the other the location
- QTextStream fout(&fptr);
- bt::PtrMap<QString,UPnPRouter>::iterator i = routers.begin();
+ TQTextStream fout(&fptr);
+ bt::PtrMap<TQString,UPnPRouter>::iterator i = routers.begin();
while (i != routers.end())
{
UPnPRouter* r = i->second;
@@ -247,9 +247,9 @@ namespace kt
}
}
- void UPnPMCastSocket::loadRouters(const QString & file)
+ void UPnPMCastSocket::loadRouters(const TQString & file)
{
- QFile fptr(file);
+ TQFile fptr(file);
if (!fptr.open(IO_ReadOnly))
{
kdDebug() << "Cannot open file " << file << " : " << fptr.errorString() << endl;
@@ -258,18 +258,18 @@ namespace kt
// file format is simple : 2 lines per router,
// one containing the server, the other the location
- QTextStream fin(&fptr);
+ TQTextStream fin(&fptr);
while (!fin.atEnd())
{
- QString server, location;
+ TQString server, location;
server = fin.readLine();
location = fin.readLine();
if (!routers.contains(server))
{
UPnPRouter* r = new UPnPRouter(server,location);
// download it's xml file
- QObject::connect(r,SIGNAL(xmlFileDownloaded( UPnPRouter*, bool )),this,SLOT(onXmlFileDownloaded( UPnPRouter*, bool )));
+ TQObject::connect(r,SIGNAL(xmlFileDownloaded( UPnPRouter*, bool )),this,SLOT(onXmlFileDownloaded( UPnPRouter*, bool )));
r->downloadXMLFile();
}
}
diff --git a/src/upnp/upnpmcastsocket.h b/src/upnp/upnpmcastsocket.h
index be75f4b..23007fe 100644
--- a/src/upnp/upnpmcastsocket.h
+++ b/src/upnp/upnpmcastsocket.h
@@ -48,13 +48,13 @@ namespace kt
Uint32 getNumDevicesDiscovered() const {return routers.count();}
/// Find a router using it's server name
- UPnPRouter* findDevice(const QString & name) {return routers.find(name);}
+ UPnPRouter* findDevice(const TQString & name) {return routers.find(name);}
/// Save all routers to a file (for convenience at startup)
- void saveRouters(const QString & file);
+ void saveRouters(const TQString & file);
/// Load all routers from a file
- void loadRouters(const QString & file);
+ void loadRouters(const TQString & file);
public slots:
/**
@@ -76,14 +76,14 @@ namespace kt
void discovered(kt::UPnPRouter* router);
public:
- UPnPRouter* parseResponse(const QByteArray & arr);
+ UPnPRouter* parseResponse(const TQByteArray & arr);
private:
void joinUPnPMCastGroup();
void leaveUPnPMCastGroup();
private:
- bt::PtrMap<QString,UPnPRouter> routers;
+ bt::PtrMap<TQString,UPnPRouter> routers;
bool verbose;
};
}
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;
diff --git a/src/upnp/upnprouter.h b/src/upnp/upnprouter.h
index f685620..8ae321e 100644
--- a/src/upnp/upnprouter.h
+++ b/src/upnp/upnprouter.h
@@ -20,12 +20,12 @@
#ifndef KTUPNPROUTER_H
#define KTUPNPROUTER_H
-#include <qtimer.h>
+#include <ntqtimer.h>
#include <kio/job.h>
-#include <qvaluelist.h>
+#include <ntqvaluelist.h>
#include "exitoperation.h"
#include <kurl.h>
-#include <qstringlist.h>
+#include <ntqstringlist.h>
#include <kstreamsocket.h>
#include "portlist.h"
#include "forwardportlist.h"
@@ -71,8 +71,8 @@ namespace bt
void operationFinished(kt::ExitOperation* op);
private:
- QTimer timer;
- QValueList<kt::ExitOperation*> exit_ops;
+ TQTimer timer;
+ TQValueList<kt::ExitOperation*> exit_ops;
};
void SynchronousWait(Uint32 millis);
@@ -103,11 +103,11 @@ namespace kt
*/
struct UPnPService
{
- QString serviceid;
- QString servicetype;
- QString controlurl;
- QString eventsuburl;
- QString scpdurl;
+ TQString serviceid;
+ TQString servicetype;
+ TQString controlurl;
+ TQString eventsuburl;
+ TQString scpdurl;
UPnPService();
UPnPService(const UPnPService & s);
@@ -117,7 +117,7 @@ namespace kt
* @param name Name of the property (matches to variable names)
* @param value Value of the property
*/
- void setProperty(const QString & name,const QString & value);
+ void setProperty(const TQString & name,const TQString & value);
/**
* Set all strings to empty.
@@ -140,18 +140,18 @@ namespace kt
*/
struct UPnPDeviceDescription
{
- QString friendlyName;
- QString manufacturer;
- QString modelDescription;
- QString modelName;
- QString modelNumber;
+ TQString friendlyName;
+ TQString manufacturer;
+ TQString modelDescription;
+ TQString modelName;
+ TQString modelNumber;
/**
* Set a property of the description
* @param name Name of the property (matches to variable names)
* @param value Value of the property
*/
- void setProperty(const QString & name,const QString & value);
+ void setProperty(const TQString & name,const TQString & value);
};
/**
@@ -160,7 +160,7 @@ namespace kt
* Class representing a UPnP enabled router. This class is also used to communicate
* with the router.
*/
- class UPnPRouter : public QObject
+ class UPnPRouter : public TQObject
{
Q_OBJECT
@@ -181,14 +181,14 @@ namespace kt
};
private:
- QString server;
- QString tmp_file;
+ TQString server;
+ TQString tmp_file;
KURL location;
UPnPDeviceDescription desc;
- QValueList<UPnPService> services;
- QValueList<Forwarding> fwds;
- QValueList<ForwardingRequest> fwdreqs;
- QValueList<bt::HTTPRequest*> active_reqs;
+ TQValueList<UPnPService> services;
+ TQValueList<Forwarding> fwds;
+ TQValueList<ForwardingRequest> fwdreqs;
+ TQValueList<bt::HTTPRequest*> active_reqs;
net::ForwardPortList* forwardedPortList;
public:
@@ -198,11 +198,11 @@ namespace kt
* @param location The location of it's xml description file
* @param verbose Print lots of debug info
*/
- UPnPRouter(const QString & server,const KURL & location,bool verbose = false);
+ UPnPRouter(const TQString & server,const KURL & location,bool verbose = false);
virtual ~UPnPRouter();
/// Get the name of the server
- QString getServer() const {return server;}
+ TQString getServer() const {return server;}
/// Get the location of it's xml description
KURL getLocation() const {return location;}
@@ -256,14 +256,14 @@ namespace kt
void debugPrintData();
- QValueList<ForwardingRequest>::iterator beginReqMappings() {return fwdreqs.begin();}
- QValueList<ForwardingRequest>::iterator endReqMappings() {return fwdreqs.end();}
- QValueList<Forwarding>::iterator beginPortMappings() {return fwds.begin();}
- QValueList<Forwarding>::iterator endPortMappings() {return fwds.end();}
+ TQValueList<ForwardingRequest>::iterator beginReqMappings() {return fwdreqs.begin();}
+ TQValueList<ForwardingRequest>::iterator endReqMappings() {return fwdreqs.end();}
+ TQValueList<Forwarding>::iterator beginPortMappings() {return fwds.begin();}
+ TQValueList<Forwarding>::iterator endPortMappings() {return fwds.end();}
net::ForwardPortList* forwardedPorts() {return forwardedPortList;}
private slots:
- void onReplyOK(bt::HTTPRequest* r,const QString &,bool);
- void onReplyError(bt::HTTPRequest* r,const QString &,bool);
+ void onReplyOK(bt::HTTPRequest* r,const TQString &,bool);
+ void onReplyError(bt::HTTPRequest* r,const TQString &,bool);
void onError(bt::HTTPRequest* r,bool);
void downloadFinished(KIO::Job* j);
@@ -282,13 +282,13 @@ namespace kt
*/
void xmlFileDownloaded(UPnPRouter* r,bool success);
- void replyOK(kt::UPnPRouter*,bt::HTTPRequest* ,const QString &,bool);
- void replyError(kt::UPnPRouter*,bt::HTTPRequest* ,const QString &,bool);
+ void replyOK(kt::UPnPRouter*,bt::HTTPRequest* ,const TQString &,bool);
+ void replyError(kt::UPnPRouter*,bt::HTTPRequest* ,const TQString &,bool);
private:
- QValueList<UPnPService>::iterator findPortForwardingService();
+ TQValueList<UPnPService>::iterator findPortForwardingService();
- bt::HTTPRequest* sendSoapQuery(const QString & query,const QString & soapact,const QString & controlurl,bool fwd, bool at_exit = false );
+ bt::HTTPRequest* sendSoapQuery(const TQString & query,const TQString & soapact,const TQString & controlurl,bool fwd, bool at_exit = false );
bool verbose;
void forward(UPnPService* srv,const net::Port & externalport,const net::Port & internalport = net::Port());