[fpc-pascal] netdb and DNS queries for MX, TXT, and other resource types
Michael Van Canneyt
michael at freepascal.org
Wed Sep 16 10:43:54 CEST 2020
On Wed, 16 Sep 2020, Noel Duffy via fpc-pascal wrote:
> I'm in need of a library to perform DNS lookups for a range of different
> resource types such as MX, TXT, PTR and so on. At first I thought that netdb
> would do the job, but it turns out that it only supports direct A and AAA
> lookups. However, the code actually has the ability to query all resource
> types, but the module's API doesn't expose this functionality. The functions
> Query and BuildQuery, and the types TQueryData and TRRData are not made
> available to callers.
>
> cnetdb is similar in that it exposes just a subset of what libresolv
> provides. There's no interface to things like res_nquery, for instance. While
> it's theoretically possible for me to interface directly to libresolv, in
> reality the API is a horrible hairball of C macros and pointers and this is
> not a path I want to go down.
>
> Is it intended that netdb will be capable of querying all resource types? It
> appears that most of the work is already done, with the only major pieces
> missing the parsing of the additional resource records and the exposure of
> additional functions for the public API.
It was intended, but in practice I just added the records I needed.
If you feel like adding new records, I'll gladly accept patches.
Michael.
More information about the fpc-pascal
mailing list