BIND's rdataset structure is a view of some DNS records. It is polymorphic, so the details of how the records are stored can vary. For instance, the records can be held in an rdatalist, or in an rdataslab in the rbtdb.
An rdataset had a number of fields called
private1 up to
which were used by the various rdataset implementations. It was not
at all clear what these fields were for, without reading the code and
working it out from context.
This change makes the rdataset inheritance hierarchy more clear. The
polymorphic part of a
struct dns_rdataset is now a union of structs,
each of which is named after the implementation that uses it. The
fields of these structs replace the old
privateN fields. I called it
an "inheritance hierarchy" because there are implementations (SDB and
SDLZ) which inherit from the rdatalist implementation, which in turn
inherits from the generic rdataset.
Most of this change is mechanical, but there are a few extras.
In keynode.c there were a number of REQUIRE()ments that were not necessary: they had already been checked by the rdataset method dispatch code. On the other hand, In ncache.c there was a public function which needed to REQUIRE() that a generic rdataset was in fact an ncache rdataset.
I have removed lots of "reset iterator state" comments, because it
should now be clear from
target->iter = NULL where before
target->private5 = NULL could have been doing anything.
Initialization is a bit neater in a few places, using C structure literals where appropriate.
The pointer arithmetic for translating between an rdataslab header and its raw contents is now fractionally safer.