123         static std::unique_ptr<Asn1Record> 
decode(
const uint8_t* data, 
size_t dataLen, 
bool lazy = 
true);
 
  138             return m_IsConstructed;
 
  154             return m_ValueLength;
 
  160             return m_TotalLength;
 
  170         template <
class Asn1RecordType> Asn1RecordType* 
castAs()
 
  172             auto result = 
dynamic_cast<Asn1RecordType*
>(
this);
 
  173             if (result == 
nullptr)
 
  175                 throw std::bad_cast();
 
  184         bool m_IsConstructed = 
false;
 
  185         uint8_t m_TagType = 0;
 
  187         size_t m_ValueLength = 0;
 
  188         size_t m_TotalLength = 0;
 
  190         uint8_t* m_EncodedValue = 
nullptr;
 
  194         static Asn1Record* decodeInternal(
const uint8_t* data, 
size_t dataLen, 
bool lazy);
 
  196         virtual void decodeValue(uint8_t* data, 
bool lazy) = 0;
 
  197         virtual std::vector<uint8_t> encodeValue() 
const = 0;
 
  199         static Asn1Record* decodeTagAndCreateRecord(
const uint8_t* data, 
size_t dataLen, uint8_t& tagLen);
 
  200         uint8_t decodeLength(
const uint8_t* data, 
size_t dataLen);
 
  201         void decodeValueIfNeeded();
 
  204         std::vector<uint8_t> encodeLength() 
const;
 
  206         virtual std::vector<std::string> toStringList();
 
  240             decodeValueIfNeeded();
 
  247         void decodeValue(uint8_t* data, 
bool lazy) 
override;
 
  248         std::vector<uint8_t> encodeValue() 
const override;
 
  251         uint8_t* m_Value = 
nullptr;
 
  268                                        const std::vector<Asn1Record*>& subRecords);
 
  281             decodeValueIfNeeded();
 
  288         void decodeValue(uint8_t* data, 
bool lazy) 
override;
 
  289         std::vector<uint8_t> encodeValue() 
const override;
 
  291         std::vector<std::string> toStringList() 
override;
 
  293         template <
typename Iterator> 
void init(
Asn1TagClass tagClass, uint8_t tagType, Iterator begin, Iterator end)
 
  296             m_TagClass = tagClass;
 
  297             m_IsConstructed = 
true;
 
  299             size_t recordValueLength = 0;
 
  300             for (Iterator recordIter = begin; recordIter != end; ++recordIter)
 
  302                 auto encodedRecord = (*recordIter)->encode();
 
  303                 auto copyRecord = 
Asn1Record::decode(encodedRecord.data(), encodedRecord.size(), 
false);
 
  304                 m_SubRecords.pushBack(std::move(copyRecord));
 
  305                 recordValueLength += encodedRecord.size();
 
  308             m_ValueLength = recordValueLength;
 
  309             m_TotalLength = recordValueLength + 1 + (m_ValueLength < 128 ? 1 : 2);
 
  313         PointerVector<Asn1Record> m_SubRecords;
 
  380             decodeValueIfNeeded();
 
  387         void decodeValue(uint8_t* data, 
bool lazy) 
override;
 
  388         std::vector<uint8_t> encodeValue() 
const override;
 
  390         std::vector<std::string> toStringList() 
override;
 
  393         uint32_t m_Value = 0;
 
  430             decodeValueIfNeeded();
 
  435         void decodeValue(uint8_t* data, 
bool lazy) 
override;
 
  436         std::vector<uint8_t> encodeValue() 
const override;
 
  438         std::vector<std::string> toStringList() 
override;
 
  442         bool m_IsPrintable = 
true;
 
  461             decodeValueIfNeeded();
 
  466         void decodeValue(uint8_t* data, 
bool lazy) 
override;
 
  467         std::vector<uint8_t> encodeValue() 
const override;
 
  469         std::vector<std::string> toStringList() 
override;
 
  474         bool m_Value = 
false;
 
  488         void decodeValue(uint8_t* data, 
bool lazy)
 override 
  490         std::vector<uint8_t> encodeValue()
 const override 
Definition: Asn1Codec.h:450
Asn1BooleanRecord(bool value)
bool getValue()
Definition: Asn1Codec.h:459
Definition: Asn1Codec.h:259
PointerVector< Asn1Record > & getSubRecords()
Definition: Asn1Codec.h:279
Asn1ConstructedRecord(Asn1TagClass tagClass, uint8_t tagType, const PointerVector< Asn1Record > &subRecords)
Asn1ConstructedRecord(Asn1TagClass tagClass, uint8_t tagType, const std::vector< Asn1Record * > &subRecords)
Definition: Asn1Codec.h:399
Asn1EnumeratedRecord(uint32_t value)
Definition: Asn1Codec.h:215
const uint8_t * getValue()
Definition: Asn1Codec.h:238
Asn1GenericRecord(Asn1TagClass tagClass, bool isConstructed, uint8_t tagType, const uint8_t *value, size_t valueLen)
Asn1GenericRecord(Asn1TagClass tagClass, bool isConstructed, uint8_t tagType, const std::string &value)
Definition: Asn1Codec.h:369
Asn1IntegerRecord(uint32_t value)
uint32_t getValue()
Definition: Asn1Codec.h:378
Definition: Asn1Codec.h:480
Asn1NullRecord()
A constructor to create a record of type Null.
Definition: Asn1Codec.h:414
Asn1OctetStringRecord(const std::string &value)
std::string getValue()
Definition: Asn1Codec.h:428
Asn1OctetStringRecord(const uint8_t *value, size_t valueLength)
Definition: Asn1Codec.h:358
Definition: Asn1Codec.h:114
uint8_t getTagType() const
Definition: Asn1Codec.h:146
std::vector< uint8_t > encode()
bool isConstructed() const
Definition: Asn1Codec.h:136
Asn1UniversalTagType getUniversalTagType() const
Asn1TagClass getTagClass() const
Definition: Asn1Codec.h:130
size_t getTotalLength() const
Definition: Asn1Codec.h:158
Asn1RecordType * castAs()
Definition: Asn1Codec.h:170
size_t getValueLength() const
Definition: Asn1Codec.h:152
static std::unique_ptr< Asn1Record > decode(const uint8_t *data, size_t dataLen, bool lazy=true)
Definition: Asn1Codec.h:319
Asn1SequenceRecord(const PointerVector< Asn1Record > &subRecords)
Asn1SequenceRecord(const std::vector< Asn1Record * > &subRecords)
Definition: Asn1Codec.h:338
Asn1SetRecord(const PointerVector< Asn1Record > &subRecords)
Asn1SetRecord(const std::vector< Asn1Record * > &subRecords)
Definition: PointerVector.h:50
The main namespace for the PcapPlusPlus lib.
Asn1TagClass
An enum for representing ASN.1 tag class.
Definition: Asn1Codec.h:17
@ ContextSpecific
The Context-Specific tag class.
@ Private
The Private tag class.
@ Universal
The Universal tag class.
@ Application
The Application tag class.
Asn1UniversalTagType
An enum for representing ASN.1 Universal tag types.
Definition: Asn1Codec.h:30
@ BitString
The universal tag type for Bit String.
@ Enumerated
The universal tag type for Enumerated.
@ ObjectIdentifierIRI
The universal tag type for Object Identifier Internationalized Resource Identifier (IRI)
@ ObjectDescriptor
The universal tag type for Object Descriptor.
@ TimeOfDay
The universal tag type for Time of Day.
@ GraphicString
The universal tag type for GraphicString.
@ UTCTime
The universal tag type for UTC time.
@ Boolean
The universal tag type for Boolean.
@ EmbeddedPDV
The universal tag type for Embedded-PDV.
@ OctetString
The universal tag type for Octet String.
@ UniversalString
The universal tag type for UniversalString.
@ Sequence
The universal tag type Sequence.
@ Date
The universal tag type for Date.
@ RelativeObjectIdentifierIRI
The universal tag type for Relative Object Identifier Internationalized Resource Identifier (IRI)
@ PrintableString
The universal tag type for Printable String.
@ CharacterString
The universal tag type for CharacterString.
@ RelativeObjectIdentifier
The universal tag type for Relative Object Identifier.
@ Set
The universal tag type for Set.
@ ObjectIdentifier
The universal tag type for Object Identifier.
@ IA5String
The universal tag type for IA5String.
@ VideotexString
The universal tag type for Videotex String.
@ NotApplicable
A non-applicable value.
@ Real
The universal tag type for Real.
@ DateTime
The universal tag type for Date-Time.
@ EndOfContent
The reserved identifier for the End-of-Contents marker in an indefinite length encoding.
@ Reserved
A reserved value.
@ Integer
The universal tag type for Integer.
@ Time
The universal tag type for Time.
@ External
The universal tag type for External.
@ BMPString
The universal tag type for BMPString.
@ UTF8String
The universal tag type for UTF8 String.
@ Null
The universal tag type for Null.
@ GeneralizedTime
The universal tag type for Generalized time.
@ T61String
The universal tag type for T61String.
@ Duration
The universal tag type for Duration.
@ VisibleString
The universal tag type for VisibleString.
@ GeneralString
The universal tag type for GeneralString.
@ NumericString
The universal tag type for Numeric String.