I want to write a DNS resolver to support e-mail blacklisting. I'll need to
do DNS and reverse DNS lookups. I'll be writing in C++.
I've been reading the appropriate RFCs (1034 and 1035) as well as some
relevant tutorials. I can use NSLOOKUP to walk myself through the relevant
servers to find the information I want. So I'm reasonably clear on the
higher-level architecture.
I've found the DnsQuery() function which looks quite useful except it
indicates Win2K and forward. I need support on WinNT. Win9x/WinME support
would be a plus, but not at all mandatory.
Do I have other options that I'm missing?
Suppose I'm willing to write winsock and do this strictly via TCP: how do I
find the local machine's DNS server to start the process? I know that it's
specified under Network | Properties | Protocol | TCP/IP | Properties. But
how do I get this information programatically in a version-independent
manner?
Can anyone suggest any good materials for an overview of this subject or
some sample code? I've been poking around in MSDN and the Platform SDK
docs. without too much luck.
TIA,
--
TFM3
Note: Spam-resistant e-mail address
The local machine's DNS server is listed in the registry and can also be
obtained via the IP Helper APIs as I remember it. The latter is the more
portable method of discovery. DNS queries are actually pretty simple but
most queries are done via UDP (though TCP is supported by the RFC). If you
don't have a profit motivation then Unix based NSLookup and DNS server
source should be available for download, they should use the Berkeley
interfaces and they are adequate for DNS queries, though if you are
replacing the resolver for the whole host you might benefit from WinSock's
overlapped I/O capabilities in preference to polling with select().
There's a thread on this group with a description I posted on how to do MX
lookups. This was derived from a NSLookup clone I developed from scratch
for another platform that didn't have NSLookup. FWIW, I spent very little
time on the query/response engine and resolver and the overwhelming majority
of my time implementing the console UI. So, in my experience, the parts you
are asking about are fairly easy.
> I want to write a DNS resolver to support e-mail blacklisting. I'll need to
> do DNS and reverse DNS lookups. I'll be writing in C++.
[quoted text clipped - 26 lines]
>
> Note: Spam-resistant e-mail address
Thomas Mooney - 17 Nov 2003 19:21 GMT
David,
Thanks for the response. It was quite helpful. I found the IP Helper API
to locate the DNS server and googled up the older post on doing the MX
lookup. There was lots of informative stuff there as well.
Thanks again,
--
TFM3
Note: Spam-resistant e-mail address
> The local machine's DNS server is listed in the registry and can also be
> obtained via the IP Helper APIs as I remember it. The latter is the more
[quoted text clipped - 12 lines]
> of my time implementing the console UI. So, in my experience, the parts you
> are asking about are fairly easy.
<snipped my original questions for brevity>