PcapPlusPlus
pcpp::IDnsResource Class Referenceabstract

#include <DnsLayer.h>

Inheritance diagram for pcpp::IDnsResource:
pcpp::DnsQuery pcpp::DnsResource

Public Types

enum  ResourceType { DnsQuery = 0, DnsAnswer = 1, DnsAuthority = 2, DnsAdditional = 3 }
 

Public Member Functions

DnsType getDnsType ()
 
void setDnsType (DnsType newType)
 
DnsClass getDnsClass ()
 
void setDnsClass (DnsClass newClass)
 
std::string getName ()
 
bool setName (const std::string &newName)
 
virtual size_t getSize ()=0
 
virtual ResourceType getType ()=0
 

Detailed Description

An abstract class for representing all types of DNS records. This class gives access to all available record data such as DNS type, class, name, type of record, etc. The DnsLayer holds an instance of (inherited type of) this class for each DNS record in the DNS packet

Member Enumeration Documentation

◆ ResourceType

An enum for representing the 4 types of possible DNS records

Enumerator
DnsQuery 

DNS query record

DnsAnswer 

DNS answer record

DnsAuthority 

DNS authority record

DnsAdditional 

DNS additional record

Member Function Documentation

◆ getDnsClass()

DnsClass pcpp::IDnsResource::getDnsClass ( )
Returns
The DNS class of this record

◆ getDnsType()

DnsType pcpp::IDnsResource::getDnsType ( )
Returns
The DNS type of this record

◆ getName()

std::string pcpp::IDnsResource::getName ( )
inline
Returns
The name of this record

◆ getSize()

virtual size_t pcpp::IDnsResource::getSize ( )
pure virtual
Returns
The total size in bytes of this record

Implemented in pcpp::DnsResource, and pcpp::DnsQuery.

◆ getType()

virtual ResourceType pcpp::IDnsResource::getType ( )
pure virtual
Returns
The type of this record (query, answer, authority, additional)

Implemented in pcpp::DnsResource, and pcpp::DnsQuery.

◆ setDnsClass()

void pcpp::IDnsResource::setDnsClass ( DnsClass  newClass)

Set DNS class for this record

Parameters
[in]newClassThe class to set

◆ setDnsType()

void pcpp::IDnsResource::setDnsType ( DnsType  newType)

Set DNS type for this record

Parameters
[in]newTypeThe type to set

◆ setName()

bool pcpp::IDnsResource::setName ( const std::string &  newName)

Set the name of this record. Note the new name can be shorter or longer of the old name, so this method can cause the packet to be shorten or extended

Parameters
[in]newNameThe name to set