Subject: [Patch] Add ares_gethostbyname_files() function

[Patch] Add ares_gethostbyname_files() function

From: Brad Spencer <spencer_at_starscale.com>
Date: Tue, 18 Nov 2008 23:37:35 -0400

Hi again!

First, some context: In my wanderings, I've come across the
reSIProcate SIP stack <http://www.resiprocate.org/> which, generally,
has nothing to do with c-ares, except the resiprocate source tree
contains an embedded copy of the old ares library, plus some patches.

It seems that most of the patches that have been made are in the same
direction as c-ares has been going. I suspect that most of the
functionality that resiprocate actually needs is already in c-ares
(but that hasn't been determined yet).

Since I have a toe in both libraries, I have volunteered to create
some patches for c-ares that add the few remaining pieces of
functionality that resiprocate really needs. The list is short (I'm
guessing two or three small features), and I think the features can be
implemented in ways that are generally useful to the wider audience of
c-ares users. This is the first such patch.

Today, c-ares already has embedded knowledge of how to parse the local
system's /etc/hosts file (or equivalent). This is the mechanism
behind the 'f'-style lookups (as configured by ares_init_options). It
would be ideal if users could leverage this ability to do
non-blocking, system-independent hosts-file-only (non-DNS) lookups via
c-ares. This is a need I have come across it in past work I have done
(prior to my involvement in c-ares) and it's also something
resiprocate does.

This patch adds the ares_gethostbyname_file() function, which does the
local (non-asynchronous, non-blocking) lookup described above. It is
documented within the ares_gethostbyname_file.3 man page, included in
the patch. Essentially, it's the formalization of existing
functionality.

Thoughts?

Thanks again, as always.

-- 
----------------------------------------------------------
Brad Spencer - spencer_at_starscale.com - www.starscale.com

Received on 2008-11-19