ArnLib  4.0.x
Active Registry Network
ArnZeroConfLookup Class Reference

Lookup a host. More...

#include <ArnZeroConf.hpp>

Inheritance diagram for ArnZeroConfLookup:
Collaboration diagram for ArnZeroConfLookup:

Signals

void lookuped (int id)
 Indicate successfull lookup of host. More...
 
void lookupError (int id, int code)
 Indicate unsuccessfull lookup of host. More...
 

Public Member Functions

 ArnZeroConfLookup (QObject *parent=arnNullptr)
 Standard constructor of an ArnZeroConfLookup object. More...
 
 ArnZeroConfLookup (const QString &hostName, QObject *parent=arnNullptr)
 Constructor of an ArnZeroConfLookup object. More...
 
virtual ~ArnZeroConfLookup ()
 Destructor of an ArnZeroConfLookup object. More...
 
int id () const
 Returns the id number for this lookup. More...
 
void setId (int id)
 Sets the id number for this this lookup. More...
 
QString host () const
 Returns the host name for this Lookup. More...
 
void setHost (const QString &host)
 Set the host name for this Lookup. More...
 
QHostAddress hostAddr () const
 Returns the host address for this Lookup. More...
 
void lookup (bool forceMulticast=false)
 Lookup the host address. More...
 
void releaseLookup ()
 Release the lookup. More...
 
- Public Member Functions inherited from ArnZeroConfB
 ArnZeroConfB (QObject *parent=arnNullptr)
 
virtual ~ArnZeroConfB ()
 
QAbstractSocket::SocketType socketType () const
 Returns the socket type for this Zero Config. More...
 
void setSocketType (QAbstractSocket::SocketType type)
 Sets the socket type for this Zero Config. More...
 
QString serviceType () const
 Returns the service type for this Zero Config. More...
 
void setServiceType (const QString &type)
 Returns the service type for this Zero Config. More...
 
QString domain () const
 Returns the domain for this Zero Config. More...
 
void setDomain (const QString &domain)
 Sets the domain for this Zero Config. More...
 
ArnZeroConf::State state () const
 Returns the current state of the service. More...
 
QString fullServiceType () const
 Returns the full service type for this Zero Config. More...
 

Static Public Member Functions

static bool isForceQtDnsLookup ()
 Return Force using Qt for DNS lookup. More...
 
static void setForceQtDnsLookup (bool isForceQtDnsLookup)
 Set Force using Qt for DNS lookup. More...
 

Friends

class ArnZeroConfIntern
 

Detailed Description

Lookup a host.

About Zero Config

This class handles lookup of a host. It can be booth Multicast and Unicast DNS lookup.

Example usage

ArnZeroConfLookup* ds = new ArnZeroConfLookup("myhost.local", this);
ds->setId( myId); // Optional id, later used in the signals
connect( ds, SIGNAL(lookupError(int,int)), this, SLOT(onLookupError(int,int)));
connect( ds, SIGNAL(lookuped(int)), this, SLOT(onLookuped(int)));
ds->lookup();
void XXX::onLookuped( int id)
{
ArnZeroConfLookup* ds = qobject_cast<ArnZeroConfLookup*>( sender());
QString hostName = ds->host();
QHostAddress hostIp = ds->hostAddr();
ds->deleteLater();
}

Definition at line 783 of file ArnZeroConf.hpp.

Constructor & Destructor Documentation

◆ ArnZeroConfLookup() [1/2]

ArnZeroConfLookup::ArnZeroConfLookup ( QObject *  parent = arnNullptr)

Standard constructor of an ArnZeroConfLookup object.

Parameters
[in]parent

Definition at line 690 of file ArnZeroConf.cpp.

◆ ArnZeroConfLookup() [2/2]

ArnZeroConfLookup::ArnZeroConfLookup ( const QString &  hostName,
QObject *  parent = arnNullptr 
)

Constructor of an ArnZeroConfLookup object.

All needed parameters for a lookup of a host.

Parameters
[in]hostNamethe name of the host.
[in]parent

Definition at line 697 of file ArnZeroConf.cpp.

◆ ~ArnZeroConfLookup()

ArnZeroConfLookup::~ArnZeroConfLookup ( )
virtual

Destructor of an ArnZeroConfLookup object.

If the lookup is ongoing, it will be released.

Definition at line 706 of file ArnZeroConf.cpp.

Member Function Documentation

◆ host()

QString ArnZeroConfLookup::host ( ) const
inline

Returns the host name for this Lookup.

Returns
current host name
See also
setHost()

Definition at line 824 of file ArnZeroConf.hpp.

◆ hostAddr()

QHostAddress ArnZeroConfLookup::hostAddr ( ) const
inline

Returns the host address for this Lookup.

Returns
current host adress

Definition at line 838 of file ArnZeroConf.hpp.

◆ id()

int ArnZeroConfLookup::id ( ) const

Returns the id number for this lookup.

Return values
theid number
See also
setId()

Definition at line 716 of file ArnZeroConf.cpp.

◆ isForceQtDnsLookup()

bool ArnZeroConfLookup::isForceQtDnsLookup ( )
static

Return Force using Qt for DNS lookup.

Return values
trueif Force using Qt for DNS lookup
See also
setForceQtDnsLookup()

Definition at line 875 of file ArnZeroConf.cpp.

◆ lookup()

void ArnZeroConfLookup::lookup ( bool  forceMulticast = false)

Lookup the host address.

Tries to lookup the host address necessary to establish a connection.

Result is indicated by lookuped() and lookupError() signals.

Parameters
[in]forceMulticastwhen true, ArnZeroConfLookup will use a mDns request to lookup the host address, even if the host name is a unicast address, i.e. outside the local network.
See also
lookuped()
lookupError()

Definition at line 728 of file ArnZeroConf.cpp.

◆ lookuped

void ArnZeroConfLookup::lookuped ( int  id)
signal

Indicate successfull lookup of host.

Parameters
[in]idis the id number for this lookup
See also
lookup()

◆ lookupError

void ArnZeroConfLookup::lookupError ( int  id,
int  code 
)
signal

Indicate unsuccessfull lookup of host.

Parameters
[in]idis the id number for this lookup
[in]codeerror code.
See also
lookup()

◆ releaseLookup()

void ArnZeroConfLookup::releaseLookup ( )

Release the lookup.

Any lookup attempts in progress will be aborted.

Definition at line 784 of file ArnZeroConf.cpp.

◆ setForceQtDnsLookup()

void ArnZeroConfLookup::setForceQtDnsLookup ( bool  isForceQtDnsLookup)
static

Set Force using Qt for DNS lookup.

If mDns lookup doesn't work for a platform, try force using Qt:s built in DNS-lookup.

This is a global setting for all instances of ArnZeroConfLookup.

Parameters
[in]isForceQtDnsLookup
See also
isForceQtDnsLookup()

Definition at line 881 of file ArnZeroConf.cpp.

◆ setHost()

void ArnZeroConfLookup::setHost ( const QString &  host)
inline

Set the host name for this Lookup.

Usually hostname contain domain, e.g. "myserver.local" but it can also be "myserver".

Parameters
[in]hostis the current host name (se above)
See also
host()

Definition at line 832 of file ArnZeroConf.hpp.

◆ setId()

void ArnZeroConfLookup::setId ( int  id)

Sets the id number for this this lookup.

This id can be used to identify different lookup:s when using a common handler.

When not set, it will be automatically asigned during lookup().

Parameters
[in]idthe id number
See also
id()

Definition at line 722 of file ArnZeroConf.cpp.

Friends And Related Function Documentation

◆ ArnZeroConfIntern

friend class ArnZeroConfIntern
friend

Definition at line 785 of file ArnZeroConf.hpp.


The documentation for this class was generated from the following files: