API: Reject unknown flags
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 24 Oct 2014 20:36:36 +0000 (21:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Oct 2014 11:42:43 +0000 (11:42 +0000)
Check for unknown flags in adns_initflags, adns_queryflags, and
adns_rrtype.

This will allow us to extend the API in the future but still retain
backward-ABI-safety: new applications which pass a new flag but are
run against old adns will get an error (typically, ENOSYS).

In each case we reserve a few of the spare bits for `harmless'
extensions: flags which we decide, at the time of introduction, that
it is harmless for old implementations to ignore.

We simply provide explicit hex values for the flags.  This is easier
than listing all of the actually-defined flags, and probably no less
reliable.  Failing to add a new flag to the check as well as to the
enum will produce an obvious error (unless the `harmless' flag is used
- and those are at the top of the space to reduce that probability).

In the case of adns_rrtype, all of the external functions quickly pass
the type to adns__findtype, so we can do the check there.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>

No differences found