chiark / gitweb /
src/: Lay the groundwork for variably-sized record structures.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 31 May 2014 23:13:20 +0000 (00:13 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 13 Jun 2014 08:57:41 +0000 (09:57 +0100)
commitb5c41613ef9980fd9ce395dd85c2af10c21079be
treeac9014dd978e1bb5930806a6efc4103581045310
parentc37d270aba4917429f1377e1148613b48d06aaaa
src/: Lay the groundwork for variably-sized record structures.

All records in a particular answer are going to be the same size: that's
not going to change.  The case we're dealing with here is that we're
going to want to include new information (e.g., new kinds of address
families) which will make the structures larger -- and would break old
binary clients.

The plan is for new clients to encode a flag saying that they understand
the extended structure in the type field (implicitly, through a header-
file change).  But all of this means that just dredging `typei->rrsz'
out of the typeinfo structure isn't going to cut it any more, so we add
a type hook to compute the right size, and make sure that we use it by
renaming the slot containing the fixed value.  Most places in the code
can avoid having to call the hook by grabbing the record size from the
answer structure.

This involves adding an extra parameter to the postsort hook, which
otherwise might not be able to determine the right size for itself.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
src/general.c
src/internal.h
src/query.c
src/reply.c
src/types.c