summaryrefslogtreecommitdiffstats
path: root/src/network/qdns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/qdns.cpp')
-rw-r--r--src/network/qdns.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/network/qdns.cpp b/src/network/qdns.cpp
index 3cc4d76..45937fe 100644
--- a/src/network/qdns.cpp
+++ b/src/network/qdns.cpp
@@ -411,7 +411,7 @@ void QDnsAnswer::parseA()
{
if ( next != pp + 4 ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %d bytes long IN A for %s",
+ tqDebug( "QDns: saw %d bytes long IN A for %s",
next - pp, label.ascii() );
#endif
return;
@@ -424,7 +424,7 @@ void QDnsAnswer::parseA()
( answer[pp+2] << 8 ) +
( answer[pp+3] ) );
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN A %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN A %s (ttl %d)", label.ascii(),
rr->address.toString().ascii(), ttl );
#endif
}
@@ -434,7 +434,7 @@ void QDnsAnswer::parseAaaa()
{
if ( next != pp + 16 ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %d bytes long IN Aaaa for %s",
+ tqDebug( "QDns: saw %d bytes long IN Aaaa for %s",
next - pp, label.ascii() );
#endif
return;
@@ -444,7 +444,7 @@ void QDnsAnswer::parseAaaa()
rr->t = QDns::Aaaa;
rr->address = QHostAddress( answer+pp );
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN Aaaa %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN Aaaa %s (ttl %d)", label.ascii(),
rr->address.toString().ascii(), ttl );
#endif
}
@@ -455,7 +455,7 @@ void QDnsAnswer::parseMx()
{
if ( next < pp + 2 ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %d bytes long IN MX for %s",
+ tqDebug( "QDns: saw %d bytes long IN MX for %s",
next - pp, label.ascii() );
#endif
return;
@@ -467,13 +467,13 @@ void QDnsAnswer::parseMx()
rr->target = readString().lower();
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad string in MX for %s", label.ascii() );
+ tqDebug( "QDns: saw bad string in MX for %s", label.ascii() );
#endif
return;
}
rr->t = QDns::Mx;
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN MX %d %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN MX %d %s (ttl %d)", label.ascii(),
rr->priority, rr->target.ascii(), ttl );
#endif
}
@@ -483,7 +483,7 @@ void QDnsAnswer::parseSrv()
{
if ( next < pp + 6 ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %d bytes long IN SRV for %s",
+ tqDebug( "QDns: saw %d bytes long IN SRV for %s",
next - pp, label.ascii() );
#endif
return;
@@ -497,13 +497,13 @@ void QDnsAnswer::parseSrv()
rr->target = readString().lower();
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad string in SRV for %s", label.ascii() );
+ tqDebug( "QDns: saw bad string in SRV for %s", label.ascii() );
#endif
return;
}
rr->t = QDns::Srv;
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN SRV %d %d %d %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN SRV %d %d %d %s (ttl %d)", label.ascii(),
rr->priority, rr->weight, rr->port, rr->target.ascii(), ttl );
#endif
}
@@ -514,7 +514,7 @@ void QDnsAnswer::parseCname()
QString target = readString().lower();
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad cname for for %s", label.ascii() );
+ tqDebug( "QDns: saw bad cname for for %s", label.ascii() );
#endif
return;
}
@@ -523,7 +523,7 @@ void QDnsAnswer::parseCname()
rr->t = QDns::Cname;
rr->target = target;
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN CNAME %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN CNAME %s (ttl %d)", label.ascii(),
rr->target.ascii(), ttl );
#endif
}
@@ -534,7 +534,7 @@ void QDnsAnswer::parseNs()
QString target = readString().lower();
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad cname for for %s", label.ascii() );
+ tqDebug( "QDns: saw bad cname for for %s", label.ascii() );
#endif
return;
}
@@ -542,7 +542,7 @@ void QDnsAnswer::parseNs()
// parse, but ignore
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN NS %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN NS %s (ttl %d)", label.ascii(),
target.ascii(), ttl );
#endif
}
@@ -553,7 +553,7 @@ void QDnsAnswer::parsePtr()
QString target = readString().lower();
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad PTR for for %s", label.ascii() );
+ tqDebug( "QDns: saw bad PTR for for %s", label.ascii() );
#endif
return;
}
@@ -562,7 +562,7 @@ void QDnsAnswer::parsePtr()
rr->t = QDns::Ptr;
rr->target = target;
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN PTR %s (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN PTR %s (ttl %d)", label.ascii(),
rr->target.ascii(), ttl );
#endif
}
@@ -573,7 +573,7 @@ void QDnsAnswer::parseTxt()
QString text = readString(FALSE);
if ( !ok ) {
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw bad TXT for for %s", label.ascii() );
+ tqDebug( "QDns: saw bad TXT for for %s", label.ascii() );
#endif
return;
}
@@ -582,7 +582,7 @@ void QDnsAnswer::parseTxt()
rr->t = QDns::Txt;
rr->text = text;
#if defined(QDNS_DEBUG)
- qDebug( "QDns: saw %s IN TXT \"%s\" (ttl %d)", label.ascii(),
+ tqDebug( "QDns: saw %s IN TXT \"%s\" (ttl %d)", label.ascii(),
rr->text.ascii(), ttl );
#endif
}
@@ -593,7 +593,7 @@ void QDnsAnswer::parse()
// okay, do the work...
if ( (answer[2] & 0x78) != 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: answer to wrong query type (%d)", answer[1] );
+ tqDebug( "DNS Manager: answer to wrong query type (%d)", answer[1] );
#endif
ok = FALSE;
return;
@@ -605,7 +605,7 @@ void QDnsAnswer::parse()
// TC
if ( (answer[2] & 2) != 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: truncated answer; pressing on" );
+ tqDebug( "DNS Manager: truncated answer; pressing on" );
#endif
}
@@ -617,7 +617,7 @@ void QDnsAnswer::parse()
if ( (answer[3] & 0x0f) == 3 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: saw NXDomain for %s", query->l.ascii() );
+ tqDebug( "DNS Manager: saw NXDomain for %s", query->l.ascii() );
#endif
// NXDomain. cache that for one minute.
rr = new QDnsRR( query->l );
@@ -632,7 +632,7 @@ void QDnsAnswer::parse()
if ( (answer[3] & 0x0f) != 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: error code %d", answer[3] & 0x0f );
+ tqDebug( "DNS Manager: error code %d", answer[3] & 0x0f );
#endif
ok = FALSE;
return;
@@ -671,7 +671,7 @@ void QDnsAnswer::parse()
rdlength = ( answer[pp+8] << 8 ) + answer[pp+9];
if ( pp + 10 + rdlength > size ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: ran out of stuff to parse (%d+%d>%d (%d)",
+ tqDebug( "DNS Manager: ran out of stuff to parse (%d+%d>%d (%d)",
pp, rdlength, size, rrno < ancount );
#endif
// if we're still in the AN section, we should go back and
@@ -689,7 +689,7 @@ void QDnsAnswer::parse()
pp = pp + 10;
if ( clas != 1 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: class %d (not internet) for %s",
+ tqDebug( "DNS Manager: class %d (not internet) for %s",
clas, label.isNull() ? "." : label.ascii() );
#endif
} else {
@@ -723,7 +723,7 @@ void QDnsAnswer::parse()
default:
// something we don't know
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: type %d for %s", type,
+ tqDebug( "DNS Manager: type %d for %s", type,
label.isNull() ? "." : label.ascii() );
#endif
break;
@@ -750,7 +750,7 @@ void QDnsAnswer::parse()
}
if ( answers == 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: answer contained no answers" );
+ tqDebug( "DNS Manager: answer contained no answers" );
#endif
ok = ( aa && rd );
}
@@ -790,7 +790,7 @@ void QDnsAnswer::parse()
// well, it's equal, but it's not the same. so we kill it,
// but use its expiry time.
#if defined(QDNS_DEBUG)
- qDebug( "killing off old %d for %s, expire was %d",
+ tqDebug( "killing off old %d for %s, expire was %d",
older->t, older->domain->name().latin1(),
rr->expireTime );
#endif
@@ -799,7 +799,7 @@ void QDnsAnswer::parse()
rr->deleteTime = QMAX( older->deleteTime, rr->deleteTime );
older->deleteTime = 0;
#if defined(QDNS_DEBUG)
- qDebug( " adjusted expire is %d", rr->expireTime );
+ tqDebug( " adjusted expire is %d", rr->expireTime );
#endif
}
drrs->next();
@@ -808,7 +808,7 @@ void QDnsAnswer::parse()
}
#if defined(QDNS_DEBUG)
- //qDebug( "DNS Manager: ()" );
+ //tqDebug( "DNS Manager: ()" );
#endif
}
@@ -836,7 +836,7 @@ void QDnsAnswer::notify()
notified.insert( (void*)dns, (void*)42 );
if ( rrs->count() == 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: found no answers!" );
+ tqDebug( "DNS Manager: found no answers!" );
#endif
dns->d->noNames = TRUE;
((QDnsUgleHack*)dns)->ugle( TRUE );
@@ -846,7 +846,7 @@ void QDnsAnswer::notify()
((QDnsUgleHack*)dns)->ugle();
#if defined(QDNS_DEBUG)
else
- qDebug( "DNS Manager: DNS thing %s not notified for %s",
+ tqDebug( "DNS Manager: DNS thing %s not notified for %s",
dns->label().ascii(), query->l.ascii() );
#endif
}
@@ -902,7 +902,7 @@ static void cleanupDns()
QDnsManager * QDnsManager::manager()
{
if ( !globalManager ) {
- qAddPostRoutine(cleanupDns);
+ tqAddPostRoutine(cleanupDns);
new QDnsManager();
}
return globalManager;
@@ -913,7 +913,7 @@ void QDnsUgleHack::ugle( bool emitAnyway)
{
if ( emitAnyway || !isWorking() ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: status change for %s (type %d)",
+ tqDebug( "DNS Manager: status change for %s (type %d)",
label().ascii(), recordType() );
#endif
emit resultsReady();
@@ -977,9 +977,9 @@ QDnsManager::QDnsManager()
if ( !ns->current() ) {
ns->append( new QHostAddress(*h) );
#if defined(QDNS_DEBUG)
- qDebug( "using name server %s", h->toString().latin1() );
+ tqDebug( "using name server %s", h->toString().latin1() );
} else {
- qDebug( "skipping address %s", h->toString().latin1() );
+ tqDebug( "skipping address %s", h->toString().latin1() );
#endif
}
::ns->next();
@@ -1000,9 +1000,9 @@ QDnsManager::QDnsManager()
if ( !domains->current() ) {
domains->append( s );
#if defined(QDNS_DEBUG)
- qDebug( "searching domain %s", s );
+ tqDebug( "searching domain %s", s );
} else {
- qDebug( "skipping domain %s", s );
+ tqDebug( "skipping domain %s", s );
#endif
}
::domains->next();
@@ -1035,7 +1035,7 @@ void QDnsManager::cleanCache()
QDnsDomain * d;
Q_UINT32 thisSweep = now();
#if defined(QDNS_DEBUG)
- qDebug( "QDnsManager::cleanCache(: Called, time is %u, last was %u",
+ tqDebug( "QDnsManager::cleanCache(: Called, time is %u, last was %u",
thisSweep, lastSweep );
#endif
@@ -1079,12 +1079,12 @@ void QDnsManager::answer()
#endif
#if defined(QDNS_DEBUG)
#if !defined (QT_NO_IPV6)
- qDebug("DNS Manager: answer arrived: %d bytes from %s:%d", r,
+ tqDebug("DNS Manager: answer arrived: %d bytes from %s:%d", r,
useIpv4Socket ? ipv4Socket->peerAddress().toString().ascii()
: ipv6Socket->peerAddress().toString().ascii(),
useIpv4Socket ? ipv4Socket->peerPort() : ipv6Socket->peerPort() );
#else
- qDebug("DNS Manager: answer arrived: %d bytes from %s:%d", r,
+ tqDebug("DNS Manager: answer arrived: %d bytes from %s:%d", r,
ipv4Socket->peerAddress().toString().ascii(), ipv4Socket->peerPort());;
#endif
#endif
@@ -1101,7 +1101,7 @@ void QDnsManager::answer()
i++;
if ( i == queries.size() ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: bad id (0x%04x) %d", aid, i );
+ tqDebug( "DNS Manager: bad id (0x%04x) %d", aid, i );
#endif
return;
}
@@ -1110,7 +1110,7 @@ void QDnsManager::answer()
if ( ( (Q_UINT8)(a[2]) & 0x80 ) == 0 ) {
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: received a query" );
+ tqDebug( "DNS Manager: received a query" );
#endif
return;
}
@@ -1159,7 +1159,7 @@ void QDnsManager::transmitQuery( int i )
// and then get rid of the query
queries.take( i );
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: giving up on query 0x%04x", q->id );
+ tqDebug( "DNS Manager: giving up on query 0x%04x", q->id );
#endif
delete q;
QTimer::singleShot( 0, QDnsManager::manager(), SLOT(cleanCache()) );
@@ -1255,7 +1255,7 @@ void QDnsManager::transmitQuery( int i )
// and then get rid of the query
queries.take( i );
#if defined(QDNS_DEBUG)
- qDebug( "DNS Manager: no DNS server found on query 0x%04x", q->id );
+ tqDebug( "DNS Manager: no DNS server found on query 0x%04x", q->id );
#endif
delete q;
QTimer::singleShot( 1000*10, QDnsManager::manager(), SLOT(cleanCache()) );
@@ -1271,7 +1271,7 @@ void QDnsManager::transmitQuery( int i )
ipv6Socket->writeBlock( p.data(), pp, receiver, 53 );
#endif
#if defined(QDNS_DEBUG)
- qDebug( "issuing query 0x%04x (%d) about %s type %d to %s",
+ tqDebug( "issuing query 0x%04x (%d) about %s type %d to %s",
q->id, q->step, q->l.ascii(), q->t,
ns->at( q->step % ns->count() )->toString().ascii() );
#endif
@@ -1289,7 +1289,7 @@ void QDnsManager::transmitQuery( int i )
ipv6Socket->writeBlock( p.data(), pp, *server, 53 );
#endif
#if defined(QDNS_DEBUG)
- qDebug( "copying query to %s", server->toString().ascii() );
+ tqDebug( "copying query to %s", server->toString().ascii() );
#endif
}
}
@@ -1408,12 +1408,12 @@ QPtrList<QDnsRR> * QDnsDomain::cached( const QDns * r )
QString s = *it++;
nxdomain = FALSE;
#if defined(QDNS_DEBUG)
- qDebug( "looking at cache for %s (%s %d)",
+ tqDebug( "looking at cache for %s (%s %d)",
s.ascii(), r->label().ascii(), r->recordType() );
#endif
QDnsDomain * d = m->domain( s );
#if defined(QDNS_DEBUG)
- qDebug( " - found %d RRs", d && d->rrs ? d->rrs->count() : 0 );
+ tqDebug( " - found %d RRs", d && d->rrs ? d->rrs->count() : 0 );
#endif
if ( d->rrs )
d->rrs->first();
@@ -1425,7 +1425,7 @@ QPtrList<QDnsRR> * QDnsDomain::cached( const QDns * r )
// cname. if the code is ugly, that may just
// possibly be because the concept is.
#if defined(QDNS_DEBUG)
- qDebug( "found cname from %s to %s",
+ tqDebug( "found cname from %s to %s",
r->label().ascii(), rr->target.ascii() );
#endif
s = rr->target;
@@ -1472,11 +1472,11 @@ QPtrList<QDnsRR> * QDnsDomain::cached( const QDns * r )
// if we found a positive result, return quickly
if ( answer && l->count() ) {
#if defined(QDNS_DEBUG)
- qDebug( "found %d records for %s",
+ tqDebug( "found %d records for %s",
l->count(), r->label().ascii() );
l->first();
while( l->current() ) {
- qDebug( " type %d target %s address %s",
+ tqDebug( " type %d target %s address %s",
l->current()->t,
l->current()->target.latin1(),
l->current()->address.toString().latin1() );
@@ -1489,7 +1489,7 @@ QPtrList<QDnsRR> * QDnsDomain::cached( const QDns * r )
#if defined(QDNS_DEBUG)
if ( nxdomain )
- qDebug( "found NXDomain %s", s.ascii() );
+ tqDebug( "found NXDomain %s", s.ascii() );
#endif
if ( !nxdomain ) {
@@ -1539,7 +1539,7 @@ void QDnsDomain::sweep( Q_UINT32 thisSweep )
rr->deleteTime = thisSweep; // will hit next time around
#if defined(QDNS_DEBUG)
- qDebug( "QDns::sweep: %s type %d expires %u %u - %s / %s",
+ tqDebug( "QDns::sweep: %s type %d expires %u %u - %s / %s",
rr->domain->name().latin1(), rr->t,
rr->expireTime, rr->deleteTime,
rr->target.latin1(), rr->address.toString().latin1());
@@ -1775,10 +1775,10 @@ void QDns::setLabel( const QString & label )
setStartQueryTimer(); // start query the next time we enter event loop
#endif
#if defined(QDNS_DEBUG)
- qDebug( "QDns::setLabel: %d address(es) for %s", n.count(), l.ascii() );
+ tqDebug( "QDns::setLabel: %d address(es) for %s", n.count(), l.ascii() );
int i = 0;
for( i = 0; i < (int)n.count(); i++ )
- qDebug( "QDns::setLabel: %d: %s", i, n[i].ascii() );
+ tqDebug( "QDns::setLabel: %d: %s", i, n[i].ascii() );
#endif
}
@@ -1965,7 +1965,7 @@ QString QDns::toInAddrArpaDomain( const QHostAddress &address )
bool QDns::isWorking() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::isWorking (%s, %d)", l.ascii(), t );
+ tqDebug( "QDns::isWorking (%s, %d)", l.ascii(), t );
#endif
if ( t == None )
return FALSE;
@@ -2020,7 +2020,7 @@ bool QDns::isWorking() const
QValueList<QHostAddress> QDns::addresses() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::addresses (%s)", l.ascii() );
+ tqDebug( "QDns::addresses (%s)", l.ascii() );
#endif
QValueList<QHostAddress> result;
if ( t != A && t != Aaaa )
@@ -2074,7 +2074,7 @@ QValueList<QHostAddress> QDns::addresses() const
QValueList<QDns::MailServer> QDns::mailServers() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::mailServers (%s)", l.ascii() );
+ tqDebug( "QDns::mailServers (%s)", l.ascii() );
#endif
QValueList<QDns::MailServer> result;
if ( t != Mx )
@@ -2131,7 +2131,7 @@ QValueList<QDns::MailServer> QDns::mailServers() const
QValueList<QDns::Server> QDns::servers() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::servers (%s)", l.ascii() );
+ tqDebug( "QDns::servers (%s)", l.ascii() );
#endif
QValueList<QDns::Server> result;
if ( t != Srv )
@@ -2170,7 +2170,7 @@ QValueList<QDns::Server> QDns::servers() const
QStringList QDns::hostNames() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::hostNames (%s)", l.ascii() );
+ tqDebug( "QDns::hostNames (%s)", l.ascii() );
#endif
QStringList result;
if ( t != Ptr )
@@ -2208,7 +2208,7 @@ QStringList QDns::hostNames() const
QStringList QDns::texts() const
{
#if defined(QDNS_DEBUG)
- qDebug( "QDns::texts (%s)", l.ascii() );
+ tqDebug( "QDns::texts (%s)", l.ascii() );
#endif
QStringList result;
if ( t != Txt )
@@ -2475,7 +2475,7 @@ void QDns::doResInit()
last = searchList.find( separator, first );
if ( last < 0 )
last = searchList.length();
- domains->append( qstrdup( searchList.mid( first, last-first ) ) );
+ domains->append( tqstrdup( searchList.mid( first, last-first ) ) );
first = last+1;
} while( first < (int)searchList.length() );
}