--- a/src/lib/ASN1ContentHandler.h Sat Jul 03 18:56:15 2021 +0200
+++ b/src/lib/ASN1ContentHandler.h Sat Jul 03 20:17:17 2021 +0200
@@ -32,6 +32,25 @@
class ASN1ContentHandler {
public:
+ enum class TagClass : uint8_t {
+ Universal = 0,
+ Application = 1,
+ ContextSpecific = 2,
+ Private = 3
+ };
+
+ enum class PC : uint8_t {
+ Primitive = 0,
+ Constructed = 1
+ };
+
+ class Header {
+ public:
+ TagClass tagClass;
+ PC pc;
+ uint64_t tag;
+ };
+
enum class CollectionType : uint64_t {
Constructed, // TODO: special event?
Sequence = 16,
--- a/src/lib/BasicASN1Reader.h Sat Jul 03 18:56:15 2021 +0200
+++ b/src/lib/BasicASN1Reader.h Sat Jul 03 20:17:17 2021 +0200
@@ -37,18 +37,6 @@
bool started = false;
- enum class TagClass : uint8_t {
- Universal = 0,
- Application = 1,
- ContextSpecific = 2,
- Private = 3
- };
-
- enum class PC : uint8_t {
- Primitive = 0,
- Constructed = 1
- };
-
enum UniversalType : uint64_t {
EndOfContent = 0x00,
Boolean = 0x01,
@@ -89,11 +77,8 @@
RelativeObjectIdentifierIRI = 0x24,
};
- class Header {
+ class BasicHeader : public ASN1ContentHandler::Header {
public:
- TagClass tagClass;
- PC pc;
- uint64_t tag;
bool definiteLength;
size_t length;
};
@@ -118,8 +103,11 @@
}
}
- Header readHeader() {
- Header h;
+ BasicHeader readHeader() {
+ using TagClass = ASN1ContentHandler::TagClass;
+ using PC = ASN1ContentHandler::PC;
+
+ BasicHeader h;
memset(&h, 0, sizeof (h)); // TODO: remove, not needed
@@ -164,8 +152,11 @@
}
void readNext() {
+ using TagClass = ASN1ContentHandler::TagClass;
+ using PC = ASN1ContentHandler::PC;
+
checkRemainingItems();
- Header typeHeader = readHeader();
+ BasicHeader typeHeader = readHeader();
// commit(); // TODO: commit here and recover later instead of rollback?
if (!started) {