summaryrefslogtreecommitdiffstats
path: root/ffi/include
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2018-11-22 11:21:26 +0100
committerNeal H. Walfield <neal@pep.foundation>2018-11-22 11:21:26 +0100
commitb3e594eac1216ba35c9deaf49a25f102d989bb1a (patch)
tree02babedd3944372a396c9b230498e835de7a664e /ffi/include
parent2814bf1b4275e9a58f15059e20d249c667e572d5 (diff)
ffi: Add a convenience function to convert a tag to a string.
- sq_tag_to_string.
Diffstat (limited to 'ffi/include')
-rw-r--r--ffi/include/sequoia/openpgp.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h
index 0c01f070..17c59097 100644
--- a/ffi/include/sequoia/openpgp.h
+++ b/ffi/include/sequoia/openpgp.h
@@ -367,6 +367,29 @@ typedef enum sq_tag {
SQ_TAG_PRIVATE3 = 63,
} sq_tag_t;
+static inline const char *sq_tag_to_string(sq_tag_t tag) {
+ switch (tag) {
+ case SQ_TAG_PKESK: return "PKESK";
+ case SQ_TAG_SIGNATURE: return "SIGNATURE";
+ case SQ_TAG_SKESK: return "SKESK";
+ case SQ_TAG_ONE_PASS_SIG: return "ONE PASS SIG";
+ case SQ_TAG_SECRET_KEY: return "SECRET KEY";
+ case SQ_TAG_PUBLIC_KEY: return "PUBLIC KEY";
+ case SQ_TAG_SECRET_SUBKEY: return "SECRET SUBKEY";
+ case SQ_TAG_COMPRESSED_DATA: return "COMPRESSED DATA";
+ case SQ_TAG_SED: return "SED";
+ case SQ_TAG_MARKER: return "MARKER";
+ case SQ_TAG_LITERAL: return "LITERAL";
+ case SQ_TAG_TRUST: return "TRUST";
+ case SQ_TAG_USER_ID: return "USER ID";
+ case SQ_TAG_PUBLIC_SUBKEY: return "PUBLIC SUBKEY";
+ case SQ_TAG_USER_ATTRIBUTE: return "USER ATTRIBUTE";
+ case SQ_TAG_SEIP: return "SEIP";
+ case SQ_TAG_MDC: return "MDC";
+ default: return "OTHER";
+ }
+}
+
/*/
/// Opaque types for all the Packets that Sequoia understands.
/*/