PcapPlusPlus
19.12
|
#include <DnsResource.h>
Public Member Functions | |
DnsType | getDnsType () const |
void | setDnsType (DnsType newType) |
DnsClass | getDnsClass () const |
void | setDnsClass (DnsClass newClass) |
std::string | getName () const |
size_t | getNameOffset () const |
bool | setName (const std::string &newName) |
virtual size_t | getSize () const =0 |
virtual DnsResourceType | getType () const =0 |
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
DnsClass pcpp::IDnsResource::getDnsClass | ( | ) | const |
DnsType pcpp::IDnsResource::getDnsType | ( | ) | const |
|
inline |
|
inline |
|
pure virtual |
Implemented in pcpp::DnsResource, and pcpp::DnsQuery.
|
pure virtual |
Implemented in pcpp::DnsResource, and pcpp::DnsQuery.
void pcpp::IDnsResource::setDnsClass | ( | DnsClass | newClass | ) |
Set DNS class for this record
[in] | newClass | The class to set |
void pcpp::IDnsResource::setDnsType | ( | DnsType | newType | ) |
Set DNS type for this record
[in] | newType | The type to set |
bool pcpp::IDnsResource::setName | ( | const std::string & | newName | ) |
Set the name of this record. The input name can be a standard hostname (e.g 'google.com'), or it may contain a pointer to another string in the packet (as explained here: http://www.zytrax.com/books/dns/ch15/#name). The pointer is used to reduce the DNS packet size and avoid unnecessary duplications. In case you want to use a pointer in your string you should use the following format: 'some.domain.#{offset}' where '#{offset}' is a the offset from the start of the layer. For example: if the string 'yahoo.com' already appears in offset 12 in the packet and you want to set the name of the current record to 'my.subdomain.yahoo.com' you may use the following string: 'my.subdomain.#12'. This will result in writing 'my.subdomain' and a pointer to offset 12.
Please notice the new name can be shorter or longer of the old name, so this method can cause the packet to be shorten or extended
[in] | newName | The name to set |