Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ Improvements

Bug fixes

* Changed the `FromStr` impl for `SecurityAlgorithm` to also accept
mnemonics. This also means that these are now accepted by the zonefile
parser. ([#656])

Other changes


[#641]: https://github.com/NLnetLabs/domain/pull/641
[#656]: https://github.com/NLnetLabs/domain/pull/656
[@soywod]: https://github.com/soywod


Expand Down
11 changes: 9 additions & 2 deletions src/base/iana/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

//------------ Class ---------------------------------------------------------

int_enum! {
use crate::base::iana::macros::FromStrError;
use crate::base::iana::macros::IanaEnum;

iana_enum! {
/// DNS CLASSes.
///
/// The domain name space is partitioned into separate classes for different
Expand All @@ -25,6 +28,11 @@ int_enum! {
/// [DNS CLASSes IANA registry]: http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
=>
Class, u16;
display_mnemonic_fallback_prefix_integer,
parse_from_mnemonic_or_prefix_integer,
serialize_to_mnemonic_fallback_prefix_integer,
deserialize_from_mnemonic_or_prefix_integer,
"CLASS";

/// Internet (IN).
///
Expand Down Expand Up @@ -56,7 +64,6 @@ int_enum! {
(ANY => 0xFF, "*")
}

int_enum_str_with_prefix!(Class, "CLASS", b"CLASS", u16, "unknown class");
int_enum_zonefile_fmt_with_prefix!(Class, "CLASS");

//============ Tests =========================================================
Expand Down
11 changes: 9 additions & 2 deletions src/base/iana/digestalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

//------------ DigestAlgorithm -----------------------------------------------

int_enum! {
use crate::base::iana::macros::FromStrError;
use crate::base::iana::macros::IanaEnum;

iana_enum! {
/// Delegation signer digest algorithm numbers.
///
/// These numbers are used in the DS resource record to specify how the
Expand All @@ -14,6 +17,11 @@ int_enum! {
/// [IANA registration]: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml#ds-rr-types-1
=>
DigestAlgorithm, u8;
display_integer,
parse_from_integer,
serialize_to_integer,
deserialize_from_integer,
"";

/// Specifies that the SHA-1 hash function is used.
///
Expand Down Expand Up @@ -42,7 +50,6 @@ int_enum! {
(SHA384 => 4, "SHA-384")
}

int_enum_str_decimal!(DigestAlgorithm, u8);
int_enum_zonefile_fmt_decimal!(DigestAlgorithm, "digest type");

//============ Tests =========================================================
Expand Down
Empty file added src/base/iana/iana_trait.rs
Empty file.
19 changes: 15 additions & 4 deletions src/base/iana/ipseckey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

//------------ IpseckeyAlgorithm ---------------------------------------------

int_enum! {
use crate::base::iana::macros::FromStrError;
use crate::base::iana::macros::IanaEnum;

iana_enum! {
/// IPSECKEY Algorithms.
///
/// This type identifies the public key's cryptographic algorithm of the
Expand All @@ -18,6 +21,11 @@ int_enum! {
/// [IANA registration]: https://www.iana.org/assignments/ipseckey-rr-parameters/ipseckey-rr-parameters.xhtml#ipseckey-rr-parameters-1
=>
IpseckeyAlgorithm, u8;
display_integer,
parse_from_mnemonic_or_integer,
serialize_to_integer,
deserialize_from_integer,
"";

/// Specified that no Public key is present.
(NONE => 0, "NONE")
Expand All @@ -35,12 +43,11 @@ int_enum! {
(EDDSA => 4, "EdDSA")
}

int_enum_str_decimal!(IpseckeyAlgorithm, u8);
int_enum_zonefile_fmt_decimal!(IpseckeyAlgorithm, "ipseckey algorithm");

//------------ IpseckeyGateway -----------------------------------------------

int_enum! {
iana_enum! {
/// IPSECKEY Gateway Types.
///
/// This type indicates the format of the information that is stored in
Expand All @@ -53,6 +60,11 @@ int_enum! {
/// [IANA registration]: https://www.iana.org/assignments/ipseckey-rr-parameters/ipseckey-rr-parameters.xhtml#ipseckey-rr-parameters-2
=>
IpseckeyGatewayType, u8;
display_integer,
parse_from_mnemonic_or_integer,
serialize_to_integer,
deserialize_from_integer,
"";

/// Specified that No gateway is present.
(NONE => 0, "NONE")
Expand All @@ -67,5 +79,4 @@ int_enum! {
(NAME => 3, "NAME")
}

int_enum_str_decimal!(IpseckeyGatewayType, u8);
int_enum_zonefile_fmt_decimal!(IpseckeyGatewayType, "ipseckey gateway type");
Loading