Commit ff76ae59 authored by Daniel Salzman's avatar Daniel Salzman

zone-keys: replace duplicate constants with library macros

parent d716d2e7
......@@ -27,14 +27,6 @@
dynarray_define(keyptr, zone_key_t *, DYNARRAY_VISIBILITY_PUBLIC)
const uint16_t DNSKEY_FLAGS_KSK = 257;
const uint16_t DNSKEY_FLAGS_ZSK = 256;
uint16_t dnskey_flags(bool is_ksk)
{
return is_ksk ? DNSKEY_FLAGS_KSK : DNSKEY_FLAGS_ZSK;
}
void normalize_generate_flags(kdnssec_generate_flags_t *flags)
{
if (!(*flags & DNSKEY_GENERATE_KSK) && !(*flags & DNSKEY_GENERATE_ZSK)) {
......
......@@ -52,15 +52,21 @@ typedef struct {
/*!
* \brief Flags determining key type
*/
extern const uint16_t DNSKEY_FLAGS_KSK;
extern const uint16_t DNSKEY_FLAGS_ZSK;
uint16_t dnskey_flags(bool is_ksk);
enum {
DNSKEY_FLAGS_KSK = KNOT_DNSKEY_FLAG_ZONE | KNOT_DNSKEY_FLAG_SEP,
DNSKEY_FLAGS_ZSK = KNOT_DNSKEY_FLAG_ZONE,
};
inline static uint16_t dnskey_flags(bool is_ksk)
{
return is_ksk ? DNSKEY_FLAGS_KSK : DNSKEY_FLAGS_ZSK;
}
typedef enum {
DNSKEY_GENERATE_KSK = (1 << 0), // KSK flag in metadata
DNSKEY_GENERATE_ZSK = (1 << 1), // ZSK flag in metadata
DNSKEY_GENERATE_SEP_SPEC = (1 << 2), // not (SEP bit set iff KSK)
DNSKEY_GENERATE_SEP_ON = (1 << 3), // SEP bit set on
DNSKEY_GENERATE_KSK = (1 << 0), // KSK flag in metadata
DNSKEY_GENERATE_ZSK = (1 << 1), // ZSK flag in metadata
DNSKEY_GENERATE_SEP_SPEC = (1 << 2), // not (SEP bit set iff KSK)
DNSKEY_GENERATE_SEP_ON = (1 << 3), // SEP bit set on
} kdnssec_generate_flags_t;
void normalize_generate_flags(kdnssec_generate_flags_t *flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment