[Development] API review for a new QDnsResolver class

Peter Hartmann peter.hartmann at nokia.com
Fri Nov 4 10:36:29 CET 2011


On 11/03/2011 08:32 PM, ext Jeremy Lainé wrote:
>
> Le Nov 3, 2011 à 7:10 PM, Peter Hartmann a écrit :
>
>> On 11/03/2011 04:12 PM, ext Thiago Macieira wrote:
>>> (...)
>>> The DNS query is not the problem. A query is always composed of a domain name
>>> being queried, along with the DNS class (Internet, no one uses anything else
>>> for real purposes) and the record type. For the record type, it's very easy to
>>> just list all types and also say that the user can use other types from the
>>> DNS documentation. See the ns_type enum in /usr/include/arpa/nameser.h [1].
>>
>> Yes, the query is quite simple, that is why I was wondering whether we
>> need a class for it at all.
>>
>
> Probably not. In the end I ended just storing the request type and encoded query domain in QDnsReplyPrivate. I have not yet exposed it for lack of a good accessor name. Any suggestions?

How about queryType() or requestType() and queryHost() or requestHost()? 
(I wouldn't go for queryDomain() because that doesn't sound fit for 
reverse lookups). The RFC and Wikipedia etc. seem to use both 'query' 
and 'request'...

> (...)
> I changed my mind about the replies after all, I find having a single QDnsReply class works well so far (as you probably noticed, I added support for MX and TXT records). Do you see a compelling reason to change this?

I am happy with having one QDnsReply class; I think we can get pretty 
far with some special accessors for SRV and other records, and one 
generic accessor for simple (QString) and unsupported cases. Then 
whoever wants to read a currently unsupported response format needs to 
parse the response string himself, which IMO is not that bad.
We can then in the future extend the class with more special accessors 
if need be.

>
> Thanks to Shane's feedback the win32 code now compiles and passes all tests.
>
> Jeremy


-- 
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