]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: add code to map DNSSEC digest types to strings and back
authorLennart Poettering <lennart@poettering.net>
Wed, 2 Dec 2015 19:56:55 +0000 (20:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 2 Dec 2015 21:50:11 +0000 (22:50 +0100)
src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-packet.h

index 7cebad22ffc3082ee4b1fb6beaac508a9a644f56..06464324d20ae604922b0a0fdb7f2dc65087fa4a 100644 (file)
@@ -1952,3 +1952,9 @@ static const char* const dnssec_algorithm_table[_DNSSEC_ALGORITHM_MAX_DEFINED] =
         [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);
index 16a38e536194b9c3656a848040843aefe5cbf0eb..b236333f61389f2ba39001807e0e67e7de63d9d9 100644 (file)
@@ -247,6 +247,16 @@ enum {
 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 */