summaryrefslogtreecommitdiffstats
path: root/lanbrowsing/lisa
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
commit69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch)
tree073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /lanbrowsing/lisa
parent3467e6464beac3a162839bf7078e22e3a74d73e7 (diff)
downloadtdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz
tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lanbrowsing/lisa')
-rw-r--r--lanbrowsing/lisa/addressvalidator.cpp50
-rw-r--r--lanbrowsing/lisa/addressvalidator.h4
-rw-r--r--lanbrowsing/lisa/client.cpp16
-rw-r--r--lanbrowsing/lisa/client.h4
-rw-r--r--lanbrowsing/lisa/main.cpp4
-rw-r--r--lanbrowsing/lisa/mystring.cpp4
-rw-r--r--lanbrowsing/lisa/mystring.h4
-rw-r--r--lanbrowsing/lisa/netmanager.cpp18
-rw-r--r--lanbrowsing/lisa/netscanner.cpp24
-rw-r--r--lanbrowsing/lisa/strictmain.cpp4
10 files changed, 66 insertions, 66 deletions
diff --git a/lanbrowsing/lisa/addressvalidator.cpp b/lanbrowsing/lisa/addressvalidator.cpp
index aa292806..f4dab083 100644
--- a/lanbrowsing/lisa/addressvalidator.cpp
+++ b/lanbrowsing/lisa/addressvalidator.cpp
@@ -33,7 +33,7 @@ using namespace std;
AddressValidator::AddressValidator(const MyString& addressSpecs)
//this is 127.0.0.0
:localhostNet(htonl(0x7f000000))
-//with mask 255.255.255.0
+//with tqmask 255.255.255.0
,localhostMask(htonl(0xffffff00))
{
clearSpecs();
@@ -44,7 +44,7 @@ AddressValidator::AddressValidator(const MyString& addressSpecs)
AddressValidator::AddressValidator()
//this is 127.0.0.0
:localhostNet(htonl(0x7f000000))
- //with mask 255.255.255.0
+ //with tqmask 255.255.255.0
,localhostMask(htonl(0xffffff00))
{
clearSpecs();
@@ -74,20 +74,20 @@ void AddressValidator::setValidAddresses(MyString addressSpecs)
nextPart=addressSpecs.left(pos);
addressSpecs=addressSpecs.mid(pos+1);
dcerr<<"setValidAddresses: nextPart: "<<nextPart<<std::endl;
- if ((nextPart.contains('.')==3) && (nextPart.contains('-')==0))
+ if ((nextPart.tqcontains('.')==3) && (nextPart.tqcontains('-')==0))
{
addSpec(EXACTADDR_SPEC,inet_addr(nextPart.data()));
dcerr<<"setValidAddresses: exact addr: "
<<std::ios::hex<<inet_addr(nextPart.data())<<std::ios::dec<<std::endl;
}
- else if ((nextPart.contains('-')==1) && (nextPart.contains('.')==6))
+ else if ((nextPart.tqcontains('-')==1) && (nextPart.tqcontains('.')==6))
{
int p2=nextPart.find("-");
MyString from=nextPart.left(p2);
MyString to=nextPart.mid(p2+1);
addSpec(RANGE_SPEC,ntohl(inet_addr(from.data())),ntohl(inet_addr(to.data())));
}
- else if ((nextPart.contains('-')==4) && (nextPart.contains('.')==3))
+ else if ((nextPart.tqcontains('-')==4) && (nextPart.tqcontains('.')==3))
{
unsigned int i1=0;
unsigned int i2=0;
@@ -114,12 +114,12 @@ void AddressValidator::setValidAddresses(MyString addressSpecs)
{
pos=nextPart.find('/');
MyString netStr=nextPart.left(pos);
- MyString maskStr=nextPart.mid(pos+1);
- int mask=inet_addr(maskStr.data());
- int net= (inet_addr(netStr.data()) & mask);
- dcerr<<"setValidAddresses: net/mask: "
- <<std::ios::hex<<net<<"/"<<mask<<std::ios::dec<<std::endl;
- addSpec(NETMASK_SPEC,net,mask);
+ MyString tqmaskStr=nextPart.mid(pos+1);
+ int tqmask=inet_addr(tqmaskStr.data());
+ int net= (inet_addr(netStr.data()) & tqmask);
+ dcerr<<"setValidAddresses: net/tqmask: "
+ <<std::ios::hex<<net<<"/"<<tqmask<<std::ios::dec<<std::endl;
+ addSpec(NETMASK_SPEC,net,tqmask);
}
}
}
@@ -130,19 +130,19 @@ void AddressValidator::clearSpecs()
for (int i=0; i<MAX_SPECS; i++)
{
specs[i].address=0;
- specs[i].mask=0;
+ specs[i].tqmask=0;
specs[i].typeOfSpec=NO_SPEC;
}
}
-void AddressValidator::addSpec(int type, int address, int mask)
+void AddressValidator::addSpec(int type, int address, int tqmask)
{
for (int i=0; i<MAX_SPECS; i++)
{
if (specs[i].typeOfSpec==NO_SPEC)
{
specs[i].address=address;
- specs[i].mask=mask;
+ specs[i].tqmask=tqmask;
specs[i].typeOfSpec=type;
return;
}
@@ -155,7 +155,7 @@ int AddressValidator::isValid(int addressNBO)
<<std::ios::hex<<addressNBO<<std::ios::dec<<std::endl;
//localhost is always allowed
dcerr<<"isValid() local net: "<<
- std::ios::hex<<localhostNet<<" mask: "<<localhostMask<<" AND: "<<(addressNBO &
+ std::ios::hex<<localhostNet<<" tqmask: "<<localhostMask<<" AND: "<<(addressNBO &
localhostMask)<<std::ios::dec<<std::endl;
if ((addressNBO & localhostMask) == localhostNet)
return 1;
@@ -183,17 +183,17 @@ int AddressValidator::isValid(int addressNBO)
else if (specs[i].typeOfSpec==NETMASK_SPEC)
{
dcerr<<"isValid: ANDing "<<
- std::ios::hex<<(addressNBO & specs[i].mask)<<" "<<
+ std::ios::hex<<(addressNBO & specs[i].tqmask)<<" "<<
specs[i].address<<std::ios::dec<<std::endl;
- if ((addressNBO & specs[i].mask) == specs[i].address)
+ if ((addressNBO & specs[i].tqmask) == specs[i].address)
{
- dcerr<<"isValid: net/mask"<<std::endl;
+ dcerr<<"isValid: net/tqmask"<<std::endl;
return 1;
}
}
else if (specs[i].typeOfSpec==RANGE_SPEC)
{
- if ((ntohl(addressNBO)>=specs[i].address) && (ntohl(addressNBO)<=specs[i].mask))
+ if ((ntohl(addressNBO)>=specs[i].address) && (ntohl(addressNBO)<=specs[i].tqmask))
{
dcerr<<"isValid: range"<<std::endl;
return 1;
@@ -202,19 +202,19 @@ int AddressValidator::isValid(int addressNBO)
else if (specs[i].typeOfSpec==MULTIRANGE_SPEC)
{
unsigned int addr=ntohl(addressNBO);
- dcerr<<"isValid ntohl="<<hex<<addr<<" addr: "<<specs[i].address<<" ma: "<<specs[i].mask<<dec<<std::endl;
- unsigned int mask=0x000000ff;
+ dcerr<<"isValid ntohl="<<hex<<addr<<" addr: "<<specs[i].address<<" ma: "<<specs[i].tqmask<<dec<<std::endl;
+ unsigned int tqmask=0x000000ff;
int failure=0;
for (int j=0; j<4; j++)
{
- dcerr<<"isValid "<<hex<<"mask="<<mask<<" addr="<<(addr&mask)<<" addr="<<(specs[i].address & mask)<<" ma="<<(specs[i].mask&mask)<<std::endl;
- if (((addr & mask) < (specs[i].address & mask))
- || ((addr & mask) > (specs[i].mask & mask)))
+ dcerr<<"isValid "<<hex<<"tqmask="<<tqmask<<" addr="<<(addr&tqmask)<<" addr="<<(specs[i].address & tqmask)<<" ma="<<(specs[i].tqmask&tqmask)<<std::endl;
+ if (((addr & tqmask) < (specs[i].address & tqmask))
+ || ((addr & tqmask) > (specs[i].tqmask & tqmask)))
{
failure=1;
break;
}
- mask=mask<<8;
+ tqmask=tqmask<<8;
}
dcerr<<"isValid: multirange"<<std::endl;
if (!failure)
diff --git a/lanbrowsing/lisa/addressvalidator.h b/lanbrowsing/lisa/addressvalidator.h
index 6f1c723e..c2c332ab 100644
--- a/lanbrowsing/lisa/addressvalidator.h
+++ b/lanbrowsing/lisa/addressvalidator.h
@@ -29,7 +29,7 @@
struct AddressSpec
{
int address;
- int mask;
+ int tqmask;
int typeOfSpec;
};
@@ -48,7 +48,7 @@ class AddressValidator
int localhostNet;
int localhostMask;
MyString allowedHosts;
- void addSpec(int type, int address, int mask=0);
+ void addSpec(int type, int address, int tqmask=0);
AddressSpec specs[MAX_SPECS];
};
diff --git a/lanbrowsing/lisa/client.cpp b/lanbrowsing/lisa/client.cpp
index 21069a17..e26b2674 100644
--- a/lanbrowsing/lisa/client.cpp
+++ b/lanbrowsing/lisa/client.cpp
@@ -34,8 +34,8 @@
#define dcerr if (LISA_DEBUG==1) std::cerr<<"Client::"
-Client::Client(NetManager* parent, int socketFD, int closeOnDelete)
-:parentServer(parent)
+Client::Client(NetManager* tqparent, int socketFD, int closeOnDelete)
+:tqparentServer(tqparent)
,m_fd(socketFD)
,m_done(0)
,m_closeOnDelete(closeOnDelete)
@@ -46,7 +46,7 @@ Client::Client(NetManager* parent, int socketFD, int closeOnDelete)
}
Client::Client()
-:parentServer(0)
+:tqparentServer(0)
,m_fd(-1)
,m_done(1)
,m_closeOnDelete(1)
@@ -55,7 +55,7 @@ Client::Client()
}
Client::Client(const Client& c)
-:parentServer(c.parentServer)
+:tqparentServer(c.tqparentServer)
,m_fd(c.m_fd)
,m_creationTime(c.m_creationTime)
,m_done(c.m_done)
@@ -74,24 +74,24 @@ int Client::tryToGetInfo()
return 1;
}
dcerr<<"tryToGetInfo: calling data.getFile()"<<std::endl;
- if (!parentServer->isInformed()) return 0;
+ if (!tqparentServer->isInformed()) return 0;
//we fork now, so that writing to the client can't block the server process
/* int pid=fork();
if (pid==-1)
{
- //parent
+ //tqparent
dcerr<<"NetScanner::scan: error occurred"<<std::endl;
return 1;
}
else if (pid!=0)
{
- //parent
+ //tqparent
return 1;
};*/
//child
//this one does it all :-)
dcerr<<"tryToGetInfo: sending data to client"<<std::endl;
- parentServer->writeDataToFD(fd(),0);
+ tqparentServer->writeDataToFD(fd(),0);
close();
//exit(0);
return 1;
diff --git a/lanbrowsing/lisa/client.h b/lanbrowsing/lisa/client.h
index efcf5f86..a82289c4 100644
--- a/lanbrowsing/lisa/client.h
+++ b/lanbrowsing/lisa/client.h
@@ -23,7 +23,7 @@ class NetManager;
class Client
{
public:
- Client(NetManager* parent, int socketFD, int closeOnDelete=1);
+ Client(NetManager* tqparent, int socketFD, int closeOnDelete=1);
Client();
Client(const Client& c);
~Client();
@@ -34,7 +34,7 @@ class Client
void close();
time_t age() {return time(0)-m_creationTime;};
private:
- NetManager *parentServer;
+ NetManager *tqparentServer;
int m_fd;
//if something goes wrong close the connection after a timeout
time_t m_creationTime;
diff --git a/lanbrowsing/lisa/main.cpp b/lanbrowsing/lisa/main.cpp
index 7de59389..e75fa0c1 100644
--- a/lanbrowsing/lisa/main.cpp
+++ b/lanbrowsing/lisa/main.cpp
@@ -225,11 +225,11 @@ int main(int argc, char** argv)
}
}
- //fork and let the parent exit
+ //fork and let the tqparent exit
pid_t pid=fork();
if (pid>0)
{
- //this is the parent
+ //this is the tqparent
exit(0);
}
else if (pid<0)
diff --git a/lanbrowsing/lisa/mystring.cpp b/lanbrowsing/lisa/mystring.cpp
index 2b7af2d2..901c5db3 100644
--- a/lanbrowsing/lisa/mystring.cpp
+++ b/lanbrowsing/lisa/mystring.cpp
@@ -2,7 +2,7 @@
#include <ctype.h>
-//this one is taken from Qt/QCString
+//this one is taken from TQt/TQCString
MyString stripWhiteSpace(MyString str)
{
@@ -38,7 +38,7 @@ MyString stripWhiteSpace(MyString str)
}
//mainly taken from qcstring
-int MyString::contains(char c)
+int MyString::tqcontains(char c)
{
int count = 0;
char const *d = c_str();
diff --git a/lanbrowsing/lisa/mystring.h b/lanbrowsing/lisa/mystring.h
index 20d40e59..9e636e03 100644
--- a/lanbrowsing/lisa/mystring.h
+++ b/lanbrowsing/lisa/mystring.h
@@ -26,7 +26,7 @@ class MyString: public std::string
else return (*this);
};
- int contains(char c);
+ int tqcontains(char c);
//char & operator[] (unsigned int i) {return ((string)(*this))[i];}
//operator const char* () const {return c_str();}
const char* data() const {return c_str();}
@@ -35,7 +35,7 @@ class MyString: public std::string
void simplifyWhiteSpace();*/
};
-//taken from Qt/QCString
+//taken from TQt/TQCString
MyString stripWhiteSpace(MyString str);
#endif
diff --git a/lanbrowsing/lisa/netmanager.cpp b/lanbrowsing/lisa/netmanager.cpp
index e652ce97..43742564 100644
--- a/lanbrowsing/lisa/netmanager.cpp
+++ b/lanbrowsing/lisa/netmanager.cpp
@@ -142,11 +142,11 @@ void NetManager::configure(Config& config)
MyString netAddressStr=tmp.left(tmp.find('/'));
tmp=tmp.mid(tmp.find('/')+1);
tmp=tmp.left(tmp.find(';'));
- mdcerr<<"NetManager::readConfig: broadcastNet "<<netAddressStr<<" with mask "<<tmp<<std::endl;
+ mdcerr<<"NetManager::readConfig: broadcastNet "<<netAddressStr<<" with tqmask "<<tmp<<std::endl;
int netMask=inet_addr(tmp.c_str());
int netAddress=inet_addr(netAddressStr.c_str());
m_broadcastAddress= netAddress | (~netMask);
- mdcerr<<"NetManager::readConfig: net "<<std::ios::hex<<netAddress<<" with mask "<<netMask<<" gives "<<m_broadcastAddress<<std::endl;
+ mdcerr<<"NetManager::readConfig: net "<<std::ios::hex<<netAddress<<" with tqmask "<<netMask<<" gives "<<m_broadcastAddress<<std::endl;
//maybe this way we can avoid that all servers on the net send
//their requests synchronously, since now the refreshtime isn't
@@ -365,10 +365,10 @@ MyString NetManager::getConfigFileName()
int length=strlen(buf);
if (buf[length-1]=='\n') buf[length-1]='\0';
MyString kdeDirs(buf);
- while (kdeDirs.contains(':'))
+ while (kdeDirs.tqcontains(':'))
{
- MyString nextDir=kdeDirs.left(kdeDirs.find(':'));
- kdeDirs=kdeDirs.mid(kdeDirs.find(':')+1);
+ MyString nextDir=kdeDirs.left(kdeDirs.tqfind(':'));
+ kdeDirs=kdeDirs.mid(kdeDirs.tqfind(':')+1);
nextDir=nextDir+tmpBase;
mdcerr<<"trying to open "<<nextDir<<std::endl;
if (fileReadable(nextDir))
@@ -602,7 +602,7 @@ void NetManager::scan()
}
else if (pid!=0)
{
- //parent
+ //tqparent
::close(fileDescr[1]);
m_pipeFD=fileDescr[0];
m_childPid=pid;
@@ -617,7 +617,7 @@ void NetManager::scan()
doScan();
//in the child we don't have to call setServerServer()
//since this opens the listening socket, what has to be done
- //in the parent process
+ //in the tqparent process
m_serverServer=1;
}
else
@@ -629,7 +629,7 @@ void NetManager::scan()
doScan();
//in the child we don't have to call setServerServer()
//since this opens the listening socket, what has to be done
- //in the parent process
+ //in the tqparent process
m_serverServer=1;
}
else
@@ -639,7 +639,7 @@ void NetManager::scan()
m_serverServer=0;
}
}
- mdcerr<<" NetScanner::scan: sending information to parent process"<<std::endl;
+ mdcerr<<" NetScanner::scan: sending information to tqparent process"<<std::endl;
writeDataToFD(fileDescr[1],m_serverServer);
mdcerr<<" NetScanner::scan: closed FD: "<<::close(fileDescr[1])<<std::endl;
mdcerr<<" NetScanner::scan: exiting now"<<std::endl;
diff --git a/lanbrowsing/lisa/netscanner.cpp b/lanbrowsing/lisa/netscanner.cpp
index acf0515c..ac8f512d 100644
--- a/lanbrowsing/lisa/netscanner.cpp
+++ b/lanbrowsing/lisa/netscanner.cpp
@@ -187,17 +187,17 @@ struct in_addr NetScanner::getIPfromArray(unsigned int index)
// mdcerr<<"NetScanner::getIPFromArray: -"<<tmp<<"-"<<std::endl;
while (!tmp.isEmpty())
{
- if (tmp.contains('/'))
+ if (tmp.tqcontains('/'))
{
- //mdcerr<<"net/mask combination detected"<<std::endl;
+ //mdcerr<<"net/tqmask combination detected"<<std::endl;
MyString netStr(tmp.left(tmp.find("/")));
- MyString maskStr(tmp.mid(tmp.find("/")+1));
- unsigned int mask(IPAddress(maskStr).asInt());
- unsigned int net(IPAddress(netStr).asInt()&mask);
- if ((~mask)<indexLeft)
+ MyString tqmaskStr(tmp.mid(tmp.find("/")+1));
+ unsigned int tqmask(IPAddress(tqmaskStr).asInt());
+ unsigned int net(IPAddress(netStr).asInt()&tqmask);
+ if ((~tqmask)<indexLeft)
{
- indexLeft=indexLeft-(~mask+1);
- tmpIndex+=(~mask)+1;
+ indexLeft=indexLeft-(~tqmask+1);
+ tmpIndex+=(~tqmask)+1;
//mdcerr<<"i: "<<tmpIndex<<" left: "<<indexLeft<<std::endl;
}
else
@@ -207,7 +207,7 @@ struct in_addr NetScanner::getIPfromArray(unsigned int index)
//return string2Struct(ipInt2String(net));
}
}
- else if (tmp.contains('-')==1)
+ else if (tmp.tqcontains('-')==1)
{
//mdcerr<<"single range detected"<<std::endl;
MyString fromIPStr(tmp.left(tmp.find("-")));
@@ -233,7 +233,7 @@ struct in_addr NetScanner::getIPfromArray(unsigned int index)
}
}
- else if (tmp.contains('-')==4)
+ else if (tmp.tqcontains('-')==4)
{
//mdcerr<<"multiple range detected"<<std::endl;
int cp(tmp.find('-'));
@@ -291,7 +291,7 @@ struct in_addr NetScanner::getIPfromArray(unsigned int index)
}
}
//single IP address
- else if (tmp.contains('.')==3)
+ else if (tmp.tqcontains('.')==3)
{
//mdcerr<<"single IP address detected"<<std::endl;
//if (tmpIndex==index) return string2Struct(tmp);
@@ -316,7 +316,7 @@ void NetScanner::resetIPRange()
MyString NetScanner::getNextIPRange()
{
- if (tmpIPRange.contains(';')<1) return "";
+ if (tmpIPRange.tqcontains(';')<1) return "";
int cp(tmpIPRange.find(';'));
MyString tmp(tmpIPRange.left(cp));
tmpIPRange=tmpIPRange.mid(cp+1);
diff --git a/lanbrowsing/lisa/strictmain.cpp b/lanbrowsing/lisa/strictmain.cpp
index a948d6df..829c8f5d 100644
--- a/lanbrowsing/lisa/strictmain.cpp
+++ b/lanbrowsing/lisa/strictmain.cpp
@@ -203,11 +203,11 @@ int main(int argc, char** argv)
}
}
- //fork and let the parent exit
+ //fork and let the tqparent exit
pid_t pid=fork();
if (pid>0)
{
- //this is the parent
+ //this is the tqparent
exit(0);
}
else if (pid<0)