#include <Asn1Codec.h>
|
static std::unique_ptr< Asn1Record > | decode (const uint8_t *data, size_t dataLen, bool lazy=true) |
|
Represents an ASN.1 record, as described in ITU-T Recommendation X.680: https://www.itu.int/rec/T-REC-X.680/en
https://en.wikipedia.org/wiki/ASN.1
◆ castAs()
template<class Asn1RecordType >
Asn1RecordType* pcpp::Asn1Record::castAs |
( |
| ) |
|
|
inline |
A templated method that accepts a class derived from Asn1Record as its template argument and attempts to cast the current instance to that type
- Template Parameters
-
Asn1RecordType | The type to cast to |
- Returns
- A pointer to the type after casting
◆ decode()
static std::unique_ptr<Asn1Record> pcpp::Asn1Record::decode |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLen, |
|
|
bool |
lazy = true |
|
) |
| |
|
static |
A static method to decode a byte array into an Asn1Record
- Parameters
-
data | A byte array to decode |
dataLen | The byte array length |
lazy | Use lazy decoding, set to true by default. Lazy decoding entails delaying the decoding of the record value until it is accessed |
- Returns
- A smart pointer to the decoded ASN.1 record. If the byte stream is not a valid ASN.1 record an exception is thrown
◆ encode()
std::vector<uint8_t> pcpp::Asn1Record::encode |
( |
| ) |
|
Encode this record and convert it to a byte stream
- Returns
- A vector of bytes representing the record
◆ getTagClass()
- Returns
- The ASN.1 tag class
◆ getTagType()
uint8_t pcpp::Asn1Record::getTagType |
( |
| ) |
const |
|
inline |
- Returns
- The ASN.1 tag type value
◆ getTotalLength()
size_t pcpp::Asn1Record::getTotalLength |
( |
| ) |
const |
|
inline |
- Returns
- The total length of the record
◆ getUniversalTagType()
◆ getValueLength()
size_t pcpp::Asn1Record::getValueLength |
( |
| ) |
const |
|
inline |
- Returns
- The length of the record value
◆ isConstructed()
bool pcpp::Asn1Record::isConstructed |
( |
| ) |
const |
|
inline |
- Returns
- True if it's a constructed record, or false if it's a primitive record
◆ toString()
std::string pcpp::Asn1Record::toString |
( |
| ) |
|
- Returns
- A string representation of the record