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.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/src/network/qdns.cpp b/src/network/qdns.cpp
index b1eeaa53f..1a57ae3b6 100644
--- a/src/network/qdns.cpp
+++ b/src/network/qdns.cpp
@@ -109,7 +109,7 @@ static TQ_UINT32 now()
static TQPtrList<TQHostAddress> * ns = 0;
static TQStrList * domains = 0;
-static bool ipv6support = FALSE;
+static bool ipv6support = false;
#if defined(Q_MODERN_RES_API)
#else
@@ -135,13 +135,13 @@ static int qdns_res_init()
class TQDnsPrivate {
public:
- TQDnsPrivate() : queryTimer( 0 ), noNames(FALSE)
+ TQDnsPrivate() : queryTimer( 0 ), noNames(false)
{
#if defined(Q_DNS_SYNCHRONOUS)
#if defined(Q_OS_UNIX)
noEventLoop = tqApp==0 || tqApp->loopLevel()==0;
#else
- noEventLoop = FALSE;
+ noEventLoop = false;
#endif
#endif
}
@@ -267,7 +267,7 @@ private:
TQString label;
TQDnsRR * rr;
- TQString readString(bool multipleLabels = TRUE);
+ TQString readString(bool multipleLabels = true);
void parseA();
void parseAaaa();
void parseMx();
@@ -281,7 +281,7 @@ private:
TQDnsRR::TQDnsRR( const TQString & label )
: domain( 0 ), t( TQDns::None ),
- nxdomain( FALSE ), current( FALSE ),
+ nxdomain( false ), current( false ),
expireTime( 0 ), deleteTime( 0 ),
priority( 0 ), weight( 0 ), port( 0 )
{
@@ -299,14 +299,14 @@ TQDnsRR::~TQDnsRR()
// this one just sticks in a NXDomain
TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ )
{
- ok = TRUE;
+ ok = true;
answer = 0;
size = 0;
query = query_;
pp = 0;
rrs = new TQPtrList<TQDnsRR>;
- rrs->setAutoDelete( FALSE );
+ rrs->setAutoDelete( false );
next = size;
ttl = 0;
label = TQString::null;
@@ -316,8 +316,8 @@ TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ )
newrr->t = query->t;
newrr->deleteTime = query->started + 10;
newrr->expireTime = query->started + 10;
- newrr->nxdomain = TRUE;
- newrr->current = TRUE;
+ newrr->nxdomain = true;
+ newrr->current = true;
rrs->append( newrr );
}
@@ -325,14 +325,14 @@ TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ )
TQDnsAnswer::TQDnsAnswer( const TQByteArray& answer_,
TQDnsQuery * query_ )
{
- ok = TRUE;
+ ok = true;
answer = (TQ_UINT8 *)(answer_.data());
size = (int)answer_.size();
query = query_;
pp = 0;
rrs = new TQPtrList<TQDnsRR>;
- rrs->setAutoDelete( FALSE );
+ rrs->setAutoDelete( false );
next = size;
ttl = 0;
label = TQString::null;
@@ -408,7 +408,7 @@ TQString TQDnsAnswer::readString(bool multipleLabels)
}
}
not_ok:
- ok = FALSE;
+ ok = false;
return TQString::null;
}
@@ -577,7 +577,7 @@ void TQDnsAnswer::parsePtr()
void TQDnsAnswer::parseTxt()
{
- TQString text = readString(FALSE);
+ TQString text = readString(false);
if ( !ok ) {
#if defined(TQDNS_DEBUG)
tqDebug( "TQDns: saw bad TXT for for %s", label.ascii() );
@@ -602,7 +602,7 @@ void TQDnsAnswer::parse()
#if defined(TQDNS_DEBUG)
tqDebug( "DNS Manager: answer to wrong query type (%d)", answer[1] );
#endif
- ok = FALSE;
+ ok = false;
return;
}
@@ -631,8 +631,8 @@ void TQDnsAnswer::parse()
rr->t = query->t;
rr->deleteTime = query->started + 60;
rr->expireTime = query->started + 60;
- rr->nxdomain = TRUE;
- rr->current = TRUE;
+ rr->nxdomain = true;
+ rr->current = true;
rrs->append( rr );
return;
}
@@ -641,7 +641,7 @@ void TQDnsAnswer::parse()
#if defined(TQDNS_DEBUG)
tqDebug( "DNS Manager: error code %d", answer[3] & 0x0f );
#endif
- ok = FALSE;
+ ok = false;
return;
}
@@ -745,7 +745,7 @@ void TQDnsAnswer::parse()
answers++;
rr->deleteTime = rr->expireTime;
}
- rr->current = TRUE;
+ rr->current = true;
rrs->append( rr );
}
}
@@ -766,7 +766,7 @@ void TQDnsAnswer::parse()
// by something we care about. we want to cache such As.
rrs->first();
TQDict<void> used( 17 );
- used.setAutoDelete( FALSE );
+ used.setAutoDelete( false );
while( (rr=rrs->current()) != 0 ) {
rrs->next();
if ( rr->target.length() && rr->deleteTime > 0 && rr->current )
@@ -822,7 +822,7 @@ void TQDnsAnswer::parse()
class TQDnsUgleHack: public TQDns {
public:
- void ugle( bool emitAnyway=FALSE );
+ void ugle( bool emitAnyway=false );
};
@@ -832,7 +832,7 @@ void TQDnsAnswer::notify()
return;
TQPtrDict<void> notified;
- notified.setAutoDelete( FALSE );
+ notified.setAutoDelete( false );
TQPtrDictIterator<void> it( *query->dns );
TQDns * dns;
@@ -845,8 +845,8 @@ void TQDnsAnswer::notify()
#if defined(TQDNS_DEBUG)
tqDebug( "DNS Manager: found no answers!" );
#endif
- dns->d->noNames = TRUE;
- ((TQDnsUgleHack*)dns)->ugle( TRUE );
+ dns->d->noNames = true;
+ ((TQDnsUgleHack*)dns)->ugle( true );
} else {
TQStringList n = dns->qualifiedNames();
if ( query && n.contains(query->l) )
@@ -931,13 +931,13 @@ void TQDnsUgleHack::ugle( bool emitAnyway)
TQDnsManager::TQDnsManager()
: TQDnsSocket( tqApp, "Internal DNS manager" ),
queries( TQPtrVector<TQDnsQuery>( 0 ) ),
- cache( TQDict<TQDnsDomain>( 83, FALSE ) ),
+ cache( TQDict<TQDnsDomain>( 83, false ) ),
ipv4Socket( new TQSocketDevice( TQSocketDevice::Datagram, TQSocketDevice::IPv4, 0 ) )
#if !defined (TQT_NO_IPV6)
, ipv6Socket( new TQSocketDevice( TQSocketDevice::Datagram, TQSocketDevice::IPv6, 0 ) )
#endif
{
- cache.setAutoDelete( TRUE );
+ cache.setAutoDelete( true );
globalManager = this;
TQTimer * sweepTimer = new TQTimer( this );
@@ -948,8 +948,8 @@ TQDnsManager::TQDnsManager()
TQSocketNotifier * rn4 = new TQSocketNotifier( ipv4Socket->socket(),
TQSocketNotifier::Read,
this, "dns IPv4 socket watcher" );
- ipv4Socket->setAddressReusable( FALSE );
- ipv4Socket->setBlocking( FALSE );
+ ipv4Socket->setAddressReusable( false );
+ ipv4Socket->setBlocking( false );
connect( rn4, TQ_SIGNAL(activated(int)), TQ_SLOT(answer()) );
#if !defined (TQT_NO_IPV6)
@@ -960,9 +960,9 @@ TQDnsManager::TQDnsManager()
TQSocketNotifier::Read,
this, "dns IPv6 socket watcher" );
- ipv6support = TRUE;
- ipv6Socket->setAddressReusable( FALSE );
- ipv6Socket->setBlocking( FALSE );
+ ipv6support = true;
+ ipv6Socket->setAddressReusable( false );
+ ipv6Socket->setBlocking( false );
connect( rn6, TQ_SIGNAL(activated(int)), TQ_SLOT(answer()) );
}
#endif
@@ -994,9 +994,9 @@ TQDnsManager::TQDnsManager()
delete ::ns;
::ns = ns;
- ::ns->setAutoDelete( TRUE );
+ ::ns->setAutoDelete( true );
- TQStrList * domains = new TQStrList( TRUE );
+ TQStrList * domains = new TQStrList( true );
::domains->first();
const char * s;
@@ -1017,7 +1017,7 @@ TQDnsManager::TQDnsManager()
delete ::domains;
::domains = domains;
- ::domains->setAutoDelete( TRUE );
+ ::domains->setAutoDelete( true );
}
@@ -1025,8 +1025,8 @@ TQDnsManager::~TQDnsManager()
{
if ( globalManager )
globalManager = 0;
- queries.setAutoDelete( TRUE );
- cache.setAutoDelete( TRUE );
+ queries.setAutoDelete( true );
+ cache.setAutoDelete( true );
delete ipv4Socket;
#if !defined (TQT_NO_IPV6)
delete ipv6Socket;
@@ -1037,7 +1037,7 @@ static TQ_UINT32 lastSweep = 0;
void TQDnsManager::cleanCache()
{
- bool again = FALSE;
+ bool again = false;
TQDictIterator<TQDnsDomain> it( cache );
TQDnsDomain * d;
TQ_UINT32 thisSweep = now();
@@ -1305,7 +1305,7 @@ void TQDnsManager::transmitQuery( int i )
// seconds. the graph becomes steep around that point, and the
// number of errors rises... so it seems good to retry at that
// point.
- q->start( q->step < ns->count() ? 800 : 1500, TRUE );
+ q->start( q->step < ns->count() ? 800 : 1500, true );
}
@@ -1350,7 +1350,7 @@ void TQDnsDomain::add( const TQString & label, TQDnsRR * rr )
TQDnsDomain * d = TQDnsManager::manager()->domain( label );
if ( !d->rrs ) {
d->rrs = new TQPtrList<TQDnsRR>;
- d->rrs->setAutoDelete( TRUE );
+ d->rrs->setAutoDelete( true );
}
d->rrs->append( rr );
rr->domain = d;
@@ -1370,7 +1370,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
TQDnsRR *rrTmp = new TQDnsRR( r->label() );
rrTmp->t = TQDns::A;
rrTmp->address = TQHostAddress( 0x7f000001 );
- rrTmp->current = TRUE;
+ rrTmp->current = true;
l->append( rrTmp );
return l;
}
@@ -1380,10 +1380,10 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
if ( tmp.isIPv4Address() ) {
rrTmp->t = TQDns::A;
rrTmp->address = tmp;
- rrTmp->current = TRUE;
+ rrTmp->current = true;
l->append( rrTmp );
} else {
- rrTmp->nxdomain = TRUE;
+ rrTmp->nxdomain = true;
}
return l;
}
@@ -1395,10 +1395,10 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
if ( tmp.isIPv6Address() ) {
rrTmp->t = TQDns::Aaaa;
rrTmp->address = tmp;
- rrTmp->current = TRUE;
+ rrTmp->current = true;
l->append( rrTmp );
} else {
- rrTmp->nxdomain = TRUE;
+ rrTmp->nxdomain = true;
}
return l;
}
@@ -1413,7 +1413,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
int cnamecount = 0;
while( it != end ) {
TQString s = *it++;
- nxdomain = FALSE;
+ nxdomain = false;
#if defined(TQDNS_DEBUG)
tqDebug( "looking at cache for %s (%s %d)",
s.ascii(), r->label().ascii(), r->recordType() );
@@ -1425,7 +1425,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
if ( d->rrs )
d->rrs->first();
TQDnsRR * rr;
- bool answer = FALSE;
+ bool answer = false;
while( d->rrs && (rr=d->rrs->current()) != 0 ) {
if ( rr->t == TQDns::Cname && r->recordType() != TQDns::Cname &&
!rr->nxdomain && cnamecount < 16 ) {
@@ -1448,9 +1448,9 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r )
} else {
if ( rr->t == r->recordType() ) {
if ( rr->nxdomain )
- nxdomain = TRUE;
+ nxdomain = true;
else
- answer = TRUE;
+ answer = true;
l->append( rr );
if ( rr->deleteTime <= lastSweep ) {
// we're returning something that'll be
@@ -1551,7 +1551,7 @@ void TQDnsDomain::sweep( TQ_UINT32 thisSweep )
rr->expireTime, rr->deleteTime,
rr->target.latin1(), rr->address.toString().latin1());
#endif
- if ( rr->current == FALSE ||
+ if ( rr->current == false ||
rr->t == TQDns::None ||
rr->deleteTime <= thisSweep ||
rr->expireTime <= thisSweep )
@@ -1746,7 +1746,7 @@ TQDns::~TQDns()
void TQDns::setLabel( const TQString & label )
{
l = label;
- d->noNames = FALSE;
+ d->noNames = false;
// construct a list of qualified names
n.clear();
@@ -1877,7 +1877,7 @@ void TQDns::setLabel( const TQHostAddress & address )
void TQDns::setRecordType( RecordType rr )
{
t = rr;
- d->noNames = FALSE;
+ d->noNames = false;
setStartQueryTimer(); // start query the next time we enter event loop
}
@@ -1910,7 +1910,7 @@ void TQDns::setStartQueryTimer()
d->queryTimer = new TQTimer( this );
connect( d->queryTimer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(startQuery()) );
- d->queryTimer->start( 0, TRUE );
+ d->queryTimer->start( 0, true );
}
}
@@ -1962,11 +1962,11 @@ TQString TQDns::toInAddrArpaDomain( const TQHostAddress &address )
*/
/*!
- Returns TRUE if TQDns is doing a lookup for this object (i.e. if it
+ Returns true if TQDns is doing a lookup for this object (i.e. if it
does not already have the necessary information); otherwise
- returns FALSE.
+ returns false.
- TQDns emits the resultsReady() signal when the status changes to FALSE.
+ TQDns emits the resultsReady() signal when the status changes to false.
*/
bool TQDns::isWorking() const
@@ -1975,11 +1975,11 @@ bool TQDns::isWorking() const
tqDebug( "TQDns::isWorking (%s, %d)", l.ascii(), t );
#endif
if ( t == None )
- return FALSE;
+ return false;
#if defined(Q_DNS_SYNCHRONOUS)
if ( d->noEventLoop )
- return TRUE;
+ return true;
#endif
TQPtrList<TQDnsRR> * ll = TQDnsDomain::cached( this );
@@ -1989,17 +1989,17 @@ bool TQDns::isWorking() const
queries--;
} else {
delete ll;
- return FALSE;
+ return false;
}
ll->next();
}
delete ll;
if ( queries <= 0 )
- return FALSE;
+ return false;
if ( d->noNames )
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
@@ -2392,13 +2392,13 @@ void TQDns::doResInit()
if ( ns )
delete ns;
ns = new TQPtrList<TQHostAddress>;
- ns->setAutoDelete( TRUE );
- domains = new TQStrList( TRUE );
- domains->setAutoDelete( TRUE );
+ ns->setAutoDelete( true );
+ domains = new TQStrList( true );
+ domains->setAutoDelete( true );
TQString domainName, nameServer, searchList;
- bool gotNetworkParams = FALSE;
+ bool gotNetworkParams = false;
// try the API call GetNetworkParams() first and use registry lookup only
// as a fallback
#ifdef Q_OS_TEMP
@@ -2431,7 +2431,7 @@ void TQDns::doResInit()
}
searchList = "";
separator = ' ';
- gotNetworkParams = TRUE;
+ gotNetworkParams = true;
}
delete[] finfo;
}
@@ -2551,9 +2551,9 @@ void TQDns::doResInit()
if ( ns )
return;
ns = new TQPtrList<TQHostAddress>;
- ns->setAutoDelete( TRUE );
- domains = new TQStrList( TRUE );
- domains->setAutoDelete( TRUE );
+ ns->setAutoDelete( true );
+ domains = new TQStrList( true );
+ domains->setAutoDelete( true );
// read resolv.conf manually.
TQFile resolvConf("/etc/resolv.conf");
@@ -2659,7 +2659,7 @@ void TQDns::doResInit()
TQHostAddress a;
a.setAddress( ip );
if ( ( a.isIPv4Address() || a.isIPv6Address() ) && !a.isNull() ) {
- bool first = TRUE;
+ bool first = true;
line = line.mid( n+1 );
n = 0;
while( n < line.length() && !line[(int)n].isSpace() )
@@ -2675,15 +2675,15 @@ void TQDns::doResInit()
rr->address = a;
rr->deleteTime = UINT_MAX;
rr->expireTime = UINT_MAX;
- rr->current = TRUE;
+ rr->current = true;
if ( first ) {
- first = FALSE;
+ first = false;
TQDnsRR * ptr = new TQDnsRR( TQDns::toInAddrArpaDomain( a ) );
ptr->t = TQDns::Ptr;
ptr->target = hostname;
ptr->deleteTime = UINT_MAX;
ptr->expireTime = UINT_MAX;
- ptr->current = TRUE;
+ ptr->current = true;
}
}
}