LibDS
Qt-based library for controlling FRC robots
Public Slots | Signals | Private Slots | Private Member Functions | Private Attributes | List of all members
Lookup Class Reference

Performs host lookups to obtain socket-usable IP addresses. More...

#include <Lookup.h>

Inheritance diagram for Lookup:

Public Slots

void lookup (const QString &name)
 

Signals

void lookupFinished (const QString &original, const QHostAddress &address)
 

Private Slots

void clearCache ()
 
void onLookupFinished (const QHostInfo &info)
 

Private Member Functions

bool isOnCache (const QString &name)
 
QHostAddress getAddress (const QString &name)
 

Private Attributes

QList< QPair< QString, QHostAddress > > m_hosts
 

Detailed Description

Performs host lookups to obtain socket-usable IP addresses.

Member Function Documentation

void Lookup::clearCache ( )
privateslot

Removes the host list cache periodically (every 10 seconds)

QHostAddress Lookup::getAddress ( const QString &  name)
private

Returns the IP address associated with the given host name.

If the host name is not on the found hosts list, then this function will return an empty IP address (which will prompt the lookup() function to find the given host name).

Referenced by isOnCache(), and lookup().

bool Lookup::isOnCache ( const QString &  name)
private

Returns true if the given host name has already been found by the lookup mechanism(s).

References getAddress().

Referenced by lookup(), and onLookupFinished().

void Lookup::lookup ( const QString &  name)
slot

Performs a lookup of the given host name

Note
If the host name has already been found, the lookup will be canceled, but a signal will be emitted for the client to use
Warning
If the host name is empty, the lookup will be canceled

References getAddress(), and isOnCache().

Referenced by Sockets::performLookups().

void Lookup::onLookupFinished ( const QHostInfo &  info)
privateslot

Called when a lookup request is finished. This function will notify the client when a host name has been resolved into a valid IP address and will update the 'found hosts' list.

Note
If the address stored in the given host info is empty, this function will not emit a signal nor update the found hosts list.

References isOnCache().


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