diff -r 7128fabeede0 -r 807f8543d10e src/FreeformASN1ContentHandler.h --- a/src/FreeformASN1ContentHandler.h Sun Jul 25 11:53:55 2021 +0200 +++ b/src/FreeformASN1ContentHandler.h Sun Jul 25 12:09:30 2021 +0200 @@ -16,6 +16,8 @@ */ #pragma once +#include + #include #include "lib/ASN1ContentHandler.h" #include "Configuration.h" @@ -50,10 +52,27 @@ relpipe::common::type::Integer parent = r.position[r.position.size() - 2]; relpipe::common::type::Integer level = r.position.size() - 2; + relpipe::common::type::StringX pc; + relpipe::common::type::StringX tagClass; + + if (r.header) { + if (r.header->pc == PC::Primitive) pc = L"primitive"; + else if (r.header->pc == PC::Constructed) pc = L"primitive"; + else throw std::logic_error("Unexpected PC: " + std::to_string((uint8_t) r.header->pc)); // should never happen + + if (r.header->tagClass == TagClass::Universal) tagClass = L"universal"; + else if (r.header->tagClass == TagClass::ContextSpecific) tagClass = L"context"; + else if (r.header->tagClass == TagClass::Application) tagClass = L"application"; + else if (r.header->tagClass == TagClass::Private) tagClass = L"private"; + else throw std::logic_error("Unexpected TagClass: " + std::to_string((uint8_t) r.header->tagClass)); // should never happen + } + writer->writeAttribute(&id, typeid (id)); writer->writeAttribute(&parent, typeid (parent)); writer->writeAttribute(&level, typeid (level)); writer->writeAttribute(&r.event, typeid (r.event)); + // writer->writeAttribute(&pc, typeid (pc)); + writer->writeAttribute(&tagClass, typeid (tagClass)); writer->writeAttribute(&tag, typeid (tag)); } @@ -72,8 +91,8 @@ {L"parent", relpipe::writer::TypeId::INTEGER}, {L"level", relpipe::writer::TypeId::INTEGER}, {L"event", relpipe::writer::TypeId::STRING}, - //{L"pc", relpipe::writer::TypeId::STRING}, - //{L"tag_class", relpipe::writer::TypeId::STRING}, + // {L"pc", relpipe::writer::TypeId::STRING}, + {L"tag_class", relpipe::writer::TypeId::STRING}, {L"tag", relpipe::writer::TypeId::INTEGER}, }, true);