diff options
author | Stuart Stock <stuart@int08h.com> | 2017-06-17 15:17:37 -0500 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2017-06-17 15:17:37 -0500 |
commit | 13d53fec92fddae9c312d323db81bbcb97adbe21 (patch) | |
tree | a00f72390e02aec158bd46e5605c0a2b8e74773e /src/tag.rs | |
parent | fea8a33a58e302ba83f86b80c3ea556847beec44 (diff) | |
download | roughenough-13d53fec92fddae9c312d323db81bbcb97adbe21.zip |
restructuring as a proper crate
Diffstat (limited to 'src/tag.rs')
-rw-r--r-- | src/tag.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/tag.rs b/src/tag.rs new file mode 100644 index 0000000..168d81a --- /dev/null +++ b/src/tag.rs @@ -0,0 +1,41 @@ +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd)] +pub enum Tag { + CERT, + DELE, + INDX, + MAXT, + MIDP, + MINT, + NONC, + PAD, + PATH, + PUBK, + RADI, + ROOT, + SIG, + SREP, +} + +static PAD_VALUE: [u8; 4] = [b'P', b'A', b'D', 0x00]; +static SIG_VALUE: [u8; 4] = [b'S', b'I', b'G', 0xff]; + +impl Tag { + pub fn wire_value(&self) -> &'static [u8] { + match *self { + Tag::CERT => "CERT".as_bytes(), + Tag::DELE => "DELE".as_bytes(), + Tag::INDX => "INDX".as_bytes(), + Tag::MAXT => "MAXT".as_bytes(), + Tag::MIDP => "MIDP".as_bytes(), + Tag::MINT => "MINT".as_bytes(), + Tag::NONC => "NONC".as_bytes(), + Tag::PAD => PAD_VALUE.as_ref(), + Tag::PATH => "PATH".as_bytes(), + Tag::PUBK => "PUBK".as_bytes(), + Tag::RADI => "RADI".as_bytes(), + Tag::ROOT => "ROOT".as_bytes(), + Tag::SIG => SIG_VALUE.as_ref(), + Tag::SREP => "SREP".as_bytes(), + } + } +} |