From: Ian Jackson Date: Fri, 24 Oct 2014 20:36:36 +0000 (+0100) Subject: API: Reject unknown flags X-Git-Tag: adns-1.5.0-rc1~14 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/adns/commitdiff_plain/039a0566b2e321bbfcb51f667d32b5d890ee6f61?hp=039a0566b2e321bbfcb51f667d32b5d890ee6f61 API: Reject unknown flags 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 ---