resolved: move algorithm/digest definitions into resolved-dns-rr.h
After all, they are for flags and parameters of RRs and already relevant when dealing with RRs outside of the serialization concept.
This commit is contained in:
parent
2a32632159
commit
8730bccfc5
|
@ -1962,25 +1962,3 @@ static const char* const dns_protocol_table[_DNS_PROTOCOL_MAX] = {
|
|||
[DNS_PROTOCOL_LLMNR] = "llmnr",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dns_protocol, DnsProtocol);
|
||||
|
||||
static const char* const dnssec_algorithm_table[_DNSSEC_ALGORITHM_MAX_DEFINED] = {
|
||||
[DNSSEC_ALGORITHM_RSAMD5] = "RSAMD5",
|
||||
[DNSSEC_ALGORITHM_DH] = "DH",
|
||||
[DNSSEC_ALGORITHM_DSA] = "DSA",
|
||||
[DNSSEC_ALGORITHM_ECC] = "ECC",
|
||||
[DNSSEC_ALGORITHM_RSASHA1] = "RSASHA1",
|
||||
[DNSSEC_ALGORITHM_DSA_NSEC3_SHA1] = "DSA-NSEC3-SHA1",
|
||||
[DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1] = "RSASHA1-NSEC3-SHA1",
|
||||
[DNSSEC_ALGORITHM_RSASHA256] = "RSASHA256",
|
||||
[DNSSEC_ALGORITHM_RSASHA512] = "RSASHA512",
|
||||
[DNSSEC_ALGORITHM_INDIRECT] = "INDIRECT",
|
||||
[DNSSEC_ALGORITHM_PRIVATEDNS] = "PRIVATEDNS",
|
||||
[DNSSEC_ALGORITHM_PRIVATEOID] = "PRIVATEOID",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dnssec_algorithm, int);
|
||||
|
||||
static const char* const dnssec_digest_table[_DNSSEC_DIGEST_MAX_DEFINED] = {
|
||||
[DNSSEC_DIGEST_SHA1] = "SHA1",
|
||||
[DNSSEC_DIGEST_SHA256] = "SHA256",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dnssec_digest, int);
|
||||
|
|
|
@ -225,40 +225,6 @@ DnsProtocol dns_protocol_from_string(const char *s) _pure_;
|
|||
#define LLMNR_MULTICAST_IPV4_ADDRESS ((struct in_addr) { .s_addr = htobe32(224U << 24 | 252U) })
|
||||
#define LLMNR_MULTICAST_IPV6_ADDRESS ((struct in6_addr) { .s6_addr = { 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03 } })
|
||||
|
||||
#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
|
||||
#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
|
||||
|
||||
/* http://tools.ietf.org/html/rfc4034#appendix-A.1 and
|
||||
* https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
|
||||
enum {
|
||||
DNSSEC_ALGORITHM_RSAMD5 = 1,
|
||||
DNSSEC_ALGORITHM_DH,
|
||||
DNSSEC_ALGORITHM_DSA,
|
||||
DNSSEC_ALGORITHM_ECC,
|
||||
DNSSEC_ALGORITHM_RSASHA1,
|
||||
DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
|
||||
DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
|
||||
DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
|
||||
DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
|
||||
DNSSEC_ALGORITHM_INDIRECT = 252,
|
||||
DNSSEC_ALGORITHM_PRIVATEDNS,
|
||||
DNSSEC_ALGORITHM_PRIVATEOID,
|
||||
_DNSSEC_ALGORITHM_MAX_DEFINED
|
||||
};
|
||||
|
||||
const char* dnssec_algorithm_to_string(int i) _const_;
|
||||
int dnssec_algorithm_from_string(const char *s) _pure_;
|
||||
|
||||
/* https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
|
||||
enum {
|
||||
DNSSEC_DIGEST_SHA1 = 1,
|
||||
DNSSEC_DIGEST_SHA256 = 2,
|
||||
_DNSSEC_DIGEST_MAX_DEFINED
|
||||
};
|
||||
|
||||
const char *dnssec_digest_to_string(int i) _const_;
|
||||
int dnssec_digest_from_string(const char *s) _pure_;
|
||||
|
||||
static inline uint64_t SD_RESOLVED_FLAGS_MAKE(DnsProtocol protocol, int family) {
|
||||
|
||||
/* Converts a protocol + family into a flags field as used in queries */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "hexdecoct.h"
|
||||
#include "resolved-dns-packet.h"
|
||||
#include "resolved-dns-rr.h"
|
||||
#include "string-table.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
|
@ -1096,3 +1097,25 @@ bool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b) {
|
|||
|
||||
return dns_txt_item_equal(a->items_next, b->items_next);
|
||||
}
|
||||
|
||||
static const char* const dnssec_algorithm_table[_DNSSEC_ALGORITHM_MAX_DEFINED] = {
|
||||
[DNSSEC_ALGORITHM_RSAMD5] = "RSAMD5",
|
||||
[DNSSEC_ALGORITHM_DH] = "DH",
|
||||
[DNSSEC_ALGORITHM_DSA] = "DSA",
|
||||
[DNSSEC_ALGORITHM_ECC] = "ECC",
|
||||
[DNSSEC_ALGORITHM_RSASHA1] = "RSASHA1",
|
||||
[DNSSEC_ALGORITHM_DSA_NSEC3_SHA1] = "DSA-NSEC3-SHA1",
|
||||
[DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1] = "RSASHA1-NSEC3-SHA1",
|
||||
[DNSSEC_ALGORITHM_RSASHA256] = "RSASHA256",
|
||||
[DNSSEC_ALGORITHM_RSASHA512] = "RSASHA512",
|
||||
[DNSSEC_ALGORITHM_INDIRECT] = "INDIRECT",
|
||||
[DNSSEC_ALGORITHM_PRIVATEDNS] = "PRIVATEDNS",
|
||||
[DNSSEC_ALGORITHM_PRIVATEOID] = "PRIVATEOID",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dnssec_algorithm, int);
|
||||
|
||||
static const char* const dnssec_digest_table[_DNSSEC_DIGEST_MAX_DEFINED] = {
|
||||
[DNSSEC_DIGEST_SHA1] = "SHA1",
|
||||
[DNSSEC_DIGEST_SHA256] = "SHA256",
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(dnssec_digest, int);
|
||||
|
|
|
@ -41,6 +41,37 @@ enum {
|
|||
_DNS_CLASS_INVALID = -1
|
||||
};
|
||||
|
||||
/* DNSKEY RR flags */
|
||||
#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
|
||||
#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
|
||||
|
||||
/* DNSSEC algorithm identifiers, see
|
||||
* http://tools.ietf.org/html/rfc4034#appendix-A.1 and
|
||||
* https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
|
||||
enum {
|
||||
DNSSEC_ALGORITHM_RSAMD5 = 1,
|
||||
DNSSEC_ALGORITHM_DH,
|
||||
DNSSEC_ALGORITHM_DSA,
|
||||
DNSSEC_ALGORITHM_ECC,
|
||||
DNSSEC_ALGORITHM_RSASHA1,
|
||||
DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
|
||||
DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
|
||||
DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
|
||||
DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
|
||||
DNSSEC_ALGORITHM_INDIRECT = 252,
|
||||
DNSSEC_ALGORITHM_PRIVATEDNS,
|
||||
DNSSEC_ALGORITHM_PRIVATEOID,
|
||||
_DNSSEC_ALGORITHM_MAX_DEFINED
|
||||
};
|
||||
|
||||
/* DNSSEC digest identifiers, see
|
||||
* https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
|
||||
enum {
|
||||
DNSSEC_DIGEST_SHA1 = 1,
|
||||
DNSSEC_DIGEST_SHA256 = 2,
|
||||
_DNSSEC_DIGEST_MAX_DEFINED
|
||||
};
|
||||
|
||||
struct DnsResourceKey {
|
||||
unsigned n_ref;
|
||||
uint16_t class, type;
|
||||
|
@ -222,3 +253,9 @@ const char *dns_class_to_string(uint16_t type);
|
|||
int dns_class_from_string(const char *name, uint16_t *class);
|
||||
|
||||
extern const struct hash_ops dns_resource_key_hash_ops;
|
||||
|
||||
const char* dnssec_algorithm_to_string(int i) _const_;
|
||||
int dnssec_algorithm_from_string(const char *s) _pure_;
|
||||
|
||||
const char *dnssec_digest_to_string(int i) _const_;
|
||||
int dnssec_digest_from_string(const char *s) _pure_;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "alloc-util.h"
|
||||
#include "resolved-dns-dnssec.h"
|
||||
#include "resolved-dns-packet.h"
|
||||
#include "resolved-dns-rr.h"
|
||||
#include "string-util.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue