[bind10-dev] DNS packet API: the name object
Shane Kerr
shane at isc.org
Wed Aug 12 12:38:56 UTC 2009
Evan,
On Tue, 2009-08-11 at 23:27 +0000, Evan Hunt wrote:
> > Maybe we can begin with absolute names only and see if we really need
> > to support non-absolute ones as part of the API.
>
> As far as I can see, you can just flag whether a name is absolute or
> relative by adding a boolean to the data structure, without altering
> the internal data representation in any other way; I wouldn't expect it
> to burden the API design too much.
The problem is that relative names need context before they can actually
mean anything. This class has methods to compare names, but those won't
work without knowing the absolute name. For example:
Name a("example.com");
Name b("example.com.");
cout << "a == b => " << (a == b) << endl;
What happens here? Are they equal or not? While we could probably come
up with answers, I don't think we need to bother.
I do wonder if we need to define a canonical form for names:
string canonical(void) const;
I'd rather see a class designed to handle relative names if these are
needed, rather than maintain even a simple boolean which doesn't
actually add value.
> Writing code to parse a zone master file, where every name that doesn't
> end in a dot is supposed to be relative to $ORIGIN, seems like it would be
> simpler if the name class understood the idea of "relative names".
I think simply using:
if not ownername.endswith("."):
ownername = ownername + origin
After pulling the ownername out of the zone file is probably a nicer
approach.
--
Shane
More information about the bind10-dev
mailing list