PcapPlusPlus  Next
pcpp::Asn1ObjectIdentifier Class Reference

#include <Asn1Codec.h>

Public Member Functions

 Asn1ObjectIdentifier (const uint8_t *data, size_t dataLen)
 
 Asn1ObjectIdentifier (const std::string &oidString)
 
const std::vector< uint32_t > & getComponents () const
 
bool operator== (const Asn1ObjectIdentifier &other) const
 
bool operator!= (const Asn1ObjectIdentifier &other) const
 
std::string toString () const
 
std::vector< uint8_t > toBytes () const
 

Detailed Description

Represents an ASN.1 Object Identifier (OID).

Constructor & Destructor Documentation

◆ Asn1ObjectIdentifier() [1/2]

pcpp::Asn1ObjectIdentifier::Asn1ObjectIdentifier ( const uint8_t *  data,
size_t  dataLen 
)
explicit

Construct an OID from an encoded byte buffer

Parameters
[in]dataThe byte buffer of the encoded OID data
[in]dataLenThe byte buffer size

◆ Asn1ObjectIdentifier() [2/2]

pcpp::Asn1ObjectIdentifier::Asn1ObjectIdentifier ( const std::string &  oidString)
explicit

Construct an OID from its string representation (e.g., "1.2.840.113549").

Parameters
[in]oidStringThe string representation of the OID
Exceptions
std::invalid_argumentif the string is malformed or contains invalid components

Member Function Documentation

◆ getComponents()

const std::vector<uint32_t>& pcpp::Asn1ObjectIdentifier::getComponents ( ) const
inline
Returns
A const reference to the internal vector of components

◆ operator!=()

bool pcpp::Asn1ObjectIdentifier::operator!= ( const Asn1ObjectIdentifier other) const
inline

Inequality operator to compare two OIDs

Parameters
[in]otherAnother Asn1ObjectIdentifier instance

◆ operator==()

bool pcpp::Asn1ObjectIdentifier::operator== ( const Asn1ObjectIdentifier other) const
inline

Equality operator to compare two OIDs

Parameters
[in]otherAnother Asn1ObjectIdentifier instance

◆ toBytes()

std::vector<uint8_t> pcpp::Asn1ObjectIdentifier::toBytes ( ) const

Encode the OID to a byte buffer

Returns
A byte buffer containing the encoded OID value

◆ toString()

std::string pcpp::Asn1ObjectIdentifier::toString ( ) const

Convert the OID to its string representation (e.g., "1.2.840.113549")

Returns
A string representing the OID