PcapPlusPlus  21.05
pcpp::GenericDnsResourceData Class Reference

#include <DnsResourceData.h>

Inheritance diagram for pcpp::GenericDnsResourceData:
pcpp::IDnsResourceData

Public Member Functions

 GenericDnsResourceData (uint8_t *dataPtr, size_t dataLen)
 
 GenericDnsResourceData (const std::string &dataAsHexString)
 
 GenericDnsResourceData (const GenericDnsResourceData &other)
 
bool operator== (const GenericDnsResourceData &other) const
 
std::string toString () const
 
bool toByteArr (uint8_t *arr, size_t &arrLength, IDnsResource *dnsResource) const
 
- Public Member Functions inherited from pcpp::IDnsResourceData
virtual ~IDnsResourceData ()
 
template<class IDnsResourceDataType >
bool isTypeOf () const
 
template<class IDnsResourceDataType >
IDnsResourceDataType * castAs ()
 

Detailed Description

A class that represents generic DNS RR data which cannot be represented in any of the other classes. It stores the DNS RR data as byte array

Constructor & Destructor Documentation

◆ GenericDnsResourceData() [1/3]

pcpp::GenericDnsResourceData::GenericDnsResourceData ( uint8_t *  dataPtr,
size_t  dataLen 
)

A c'tor for this class

Parameters
[in]dataPtrA byte array that contains the raw data (as it written in the DNS packet). The data will be copied from this byte array to the object
[in]dataLenThe byte array size

◆ GenericDnsResourceData() [2/3]

pcpp::GenericDnsResourceData::GenericDnsResourceData ( const std::string &  dataAsHexString)

A c'tor for this class

Parameters
[in]dataAsHexStringA hex string that represents the DNS RR data

◆ GenericDnsResourceData() [3/3]

pcpp::GenericDnsResourceData::GenericDnsResourceData ( const GenericDnsResourceData other)

A copy c'tor for this class

Parameters
[in]otherThe instance to copy from

Member Function Documentation

◆ operator==()

bool pcpp::GenericDnsResourceData::operator== ( const GenericDnsResourceData other) const

Equality operator overload for this class that compares the raw data stored in each object

Parameters
[in]otherThe object to compare with
Returns
True if data is the same in both objects, meaning byte streams are equal, false otherwise

◆ toByteArr()

bool pcpp::GenericDnsResourceData::toByteArr ( uint8_t *  arr,
size_t &  arrLength,
IDnsResource dnsResource 
) const
virtual

Convert the DNS RR data into a byte array

Parameters
[out]arrA pointer to a pre-allocated byte array where the result will be written to
[out]arrLengthA reference to a 2-byte number where the result array length will be written to
[in]dnsResourceA pointer to a DNS resource object where this DNS RR data will be stored
Returns
True if the DNS RR data was successfully converted into a byte array and written to the given array or false if stored DNS RR data is invalid or if it could not be written to the given array

Implements pcpp::IDnsResourceData.

◆ toString()

std::string pcpp::GenericDnsResourceData::toString ( ) const
virtual
Returns
A string that represents the current DNS RR data

Implements pcpp::IDnsResourceData.