JDNS
|
Performs a DNS operation using QJDnsShared. More...
#include <qjdnsshared.h>
Public Types | |
enum | Type { Query, Publish } |
Operation type. More... | |
enum | Error { ErrorNoNet, ErrorGeneric, ErrorNXDomain, ErrorTimeout, ErrorConflict } |
Request error. More... | |
Signals | |
void | resultsReady () |
Indicates that the operation has something to report. More... | |
Public Member Functions | |
QJDnsSharedRequest (QJDnsShared *jdnsShared, QObject *parent=0) | |
Constructs a new object with the given jdnsShared and parent. | |
~QJDnsSharedRequest () | |
Destroys the object. More... | |
Type | type () |
The type of operation being performed. | |
void | query (const QByteArray &name, int type) |
Perform a query operation. | |
void | publish (QJDns::PublishMode m, const QJDns::Record &record) |
Perform a publish operation. | |
void | publishUpdate (const QJDns::Record &record) |
Update a record that is currently published. | |
void | cancel () |
Cancels the current operation. | |
bool | success () const |
Indicates whether or not the operation was successful. | |
Error | error () const |
Returns the reason for error. | |
QList< QJDns::Record > | results () const |
Returns the results of the operation. | |
Friends | |
class | QJDnsShared |
class | QJDnsSharedPrivate |
class | QJDnsSharedRequestPrivate |
Performs a DNS operation using QJDnsShared.
QJDnsSharedRequest is used to perform DNS operations on a QJDnsShared object. Many requests may be performed simultaneously, such that a single QJDnsShared object can be "shared" across the application. Please see the QJDnsShared documentation for more complete information about how the overall system works.
Call query() to perform a query. Call publish() (or publishUpdate()) to make DNS records available on the local network (QJDnsShared::Multicast mode only). When the operation has something to report, the resultsReady() signal is emitted. Call success() to determine the status of the operation. If success() returns false, then the operation has failed and the reason for the failure can be determined with error(). If success() returns true, then the meaning differs depending on the type of operation being performed:
Here is how you might look up an A record:
Here is an example of publishing a record:
To update an existing record, use publishUpdate():
As a special exception, the address value can be left unspecified for A and Aaaa record types, which tells QJDnsShared to substitute the address value with the address of whatever interfaces the record gets published on. This is the preferred way to publish the IP address of your own machine, and in fact it is the only way to do so if you have multiple interfaces, because there will likely be a different IP address value for each interface (the record resolves to a different answer depending on which interface a query comes from).
When you want to unpublish, call cancel() or destroy the QJDnsSharedRequest.
Request error.
Enumerator | |
---|---|
ErrorNoNet | There are no available network interfaces to operate on. This happens if QJDnsShared::addInterface() was not called. |
ErrorGeneric | Generic error during the operation. |
ErrorNXDomain | The name looked up does not exist. |
ErrorTimeout | The operation timed out. |
ErrorConflict | Attempt to publish an already published unique record. |
Operation type.
Enumerator | |
---|---|
Query | Query operation, initiated by query() |
Publish | Publish operation, initiated by publish() or publishUpdate() |
QJDnsSharedRequest::~QJDnsSharedRequest | ( | ) |
Destroys the object.
If there is an active operation, it is cancelled.
|
signal |