[Development] API review for a new QDnsResolver class
Peter Hartmann
peter.hartmann at nokia.com
Thu Nov 3 15:45:31 CET 2011
On 11/03/2011 12:40 PM, ext Jeremy Lainé wrote:
> Based on some initial feedback I received regarding DNS SRV support in Qt, I have refactored my proposed code and introduced a "QDnsResolver" class which I would like to submit for API review. The point of this class is to provide a QNAM-style asynchronous API to perform DNS lookups.
>
> The resolver object itself looks like:
>
> class Q_NETWORK_EXPORT QDnsResolver : public QObject
> {
> Q_OBJECT
>
> public:
> QDnsResolver(QObject *parent = 0);
> ~QDnsResolver();
>
> QDnsReply *lookupService(const QString&serviceName, const QString&domainName);
>
> private:
> Q_DECLARE_PRIVATE(QDnsResolver)
> };
Without having looked at the code in detail, in general I like the idea
of having a low-level DNS query class in Qt.
As Thiago pointed out on IRC, it would complement QHostInfo, as the
latter class uses queries to the system to resolve the name (which might
end up in looking up the name via the hosts file, via DNS, or via other
configuration files).
>
> Currently, there is only lookupService() to perform DNS SRV record types, but it would be easy to add lookupText() for TXT records, etc.
>
> An open question: should we have multiple lookupXXX() methods, or a single lookup() which takes a QDnsRequest?
It might make sense to have a generic method for querying any type of
DNS; but then would we need a QDnsRequest class which might be overkill
if we only support SRV and maybe TXT records short term? How complex can
a DNS query possibly get so it would justify creating an own class? I am
not sure about (one generic method plus request class) vs. (several
specific methods) yet...
Peter
> (...)
--
Qt Developer Days 2011 – REGISTER NOW!
October 24 – 26, Munich
November 29 – December 1, San Francisco
Learn more and Register at http://qt.nokia.com/qtdevdays2011
More information about the Development
mailing list