27 #if (BYTE_ORDER == LITTLE_ENDIAN)
49 #elif (BYTE_ORDER == BIG_ENDIAN)
192 bool removeQuery(
const std::string& queryNameToRemove,
bool exactMatch);
261 bool removeAnswer(
const std::string& answerNameToRemove,
bool exactMatch);
467 static inline bool isDnsPort(uint16_t port);
477 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen,
bool dnsOverTcp =
false);
480 DnsLayer(uint8_t* data,
size_t dataLen,
Layer* prevLayer,
Packet* packet,
size_t offsetAdjustment);
481 explicit DnsLayer(
size_t offsetAdjustment);
489 uint16_t m_OffsetAdjustment;
491 size_t getBasicHeaderSize();
492 void init(
size_t offsetAdjustment,
bool callParseResource);
493 void initNewLayer(
size_t offsetAdjustment);
498 using Layer::extendLayer;
499 bool extendLayer(
int offsetInLayer,
size_t numOfBytesToExtend,
IDnsResource* resource);
501 using Layer::shortenLayer;
502 bool shortenLayer(
int offsetInLayer,
size_t numOfBytesToShorten,
IDnsResource* resource);
505 bool exactMatch)
const;
507 void parseResources();
536 :
DnsLayer(data, dataLen, prevLayer, packet, sizeof(uint16_t))
589 size_t minSize =
sizeof(
dnshdr) + (dnsOverTcp ?
sizeof(uint16_t) : 0);
590 return data && dataLen >= minSize;
Definition: DnsLayer.h:94
DnsResource * getFirstAnswer() const
DnsLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
DnsResource * addAdditionalRecord(const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
DnsQuery * getQuery(const std::string &name, bool exactMatch) const
DnsResource * addAdditionalRecord(const std::string &name, DnsType dnsType, uint16_t customData1, uint32_t customData2, IDnsResourceData *data)
DnsResource * addAuthority(DnsResource *const copyAuthority)
static bool isDataValid(const uint8_t *data, size_t dataLen, bool dnsOverTcp=false)
Definition: DnsLayer.h:587
DnsQuery * addQuery(DnsQuery *const copyQuery)
DnsResource * getAuthority(const std::string &name, bool exactMatch) const
bool removeAdditionalRecord(DnsResource *additionalRecordToRemove)
DnsResource * addAdditionalRecord(DnsResource *const copyAdditionalRecord)
DnsResource * addAnswer(DnsResource *const copyAnswer)
bool removeQuery(const std::string &queryNameToRemove, bool exactMatch)
DnsResource * getAdditionalRecord(const std::string &name, bool exactMatch) const
size_t getQueryCount() const
DnsResource * getNextAuthority(DnsResource *authority) const
void parseNextLayer()
Definition: DnsLayer.h:437
DnsResource * getNextAnswer(DnsResource *answer) const
DnsQuery * addQuery(const std::string &name, DnsType dnsType, DnsClass dnsClass)
DnsLayer(const DnsLayer &other)
DnsQuery * getNextQuery(DnsQuery *query) const
DnsResource * getFirstAdditionalRecord() const
bool removeAuthority(const std::string &authorityNameToRemove, bool exactMatch)
OsiModelLayer getOsiModelLayer() const
Definition: DnsLayer.h:457
size_t getHeaderLen() const
Definition: DnsLayer.h:444
DnsResource * getFirstAuthority() const
bool removeQuery(DnsQuery *queryToRemove)
size_t getAuthorityCount() const
size_t getAnswerCount() const
dnshdr * getDnsHeader() const
DnsResource * addAuthority(const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
bool removeAnswer(DnsResource *answerToRemove)
DnsResource * getNextAdditionalRecord(DnsResource *additionalRecord) const
DnsQuery * getFirstQuery() const
DnsResource * addAnswer(const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
bool removeAdditionalRecord(const std::string &additionalRecordNameToRemove, bool exactMatch)
bool removeAnswer(const std::string &answerNameToRemove, bool exactMatch)
static bool isDnsPort(uint16_t port)
Definition: DnsLayer.h:574
DnsLayer & operator=(const DnsLayer &other)
std::string toString() const
bool removeAuthority(DnsResource *authorityToRemove)
size_t getAdditionalRecordCount() const
virtual void computeCalculateFields()
Definition: DnsLayer.h:452
DnsResource * getAnswer(const std::string &name, bool exactMatch) const
Definition: DnsLayer.h:526
DnsOverTcpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: DnsLayer.h:535
void computeCalculateFields()
void setTcpMessageLength(uint16_t value)
uint16_t getTcpMessageLength()
DnsOverTcpLayer()
Definition: DnsLayer.h:543
DnsOverTcpLayer(const DnsOverTcpLayer &other)
Definition: DnsLayer.h:550
Definition: DnsResource.h:138
Definition: DnsResource.h:168
Definition: DnsResourceData.h:28
Definition: DnsResource.h:30
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368
DnsClass
Definition: DnsLayerEnums.h:126
DnsResourceType
Definition: DnsLayerEnums.h:143
DnsType
Definition: DnsLayerEnums.h:15
Definition: DnsLayer.h:24
uint16_t responseCode
Definition: DnsLayer.h:40
uint16_t authoritativeAnswer
Definition: DnsLayer.h:34
uint16_t queryOrResponse
Definition: DnsLayer.h:38
uint16_t zero
Definition: DnsLayer.h:46
uint16_t transactionID
Definition: DnsLayer.h:26
uint16_t numberOfAuthority
Definition: DnsLayer.h:77
uint16_t truncation
Definition: DnsLayer.h:32
uint16_t numberOfAdditional
Definition: DnsLayer.h:79
uint16_t checkingDisabled
Definition: DnsLayer.h:42
uint16_t numberOfAnswers
Definition: DnsLayer.h:75
uint16_t authenticData
Definition: DnsLayer.h:44
uint16_t opcode
Definition: DnsLayer.h:36
uint16_t recursionAvailable
Definition: DnsLayer.h:48
uint16_t recursionDesired
Definition: DnsLayer.h:30
uint16_t numberOfQuestions
Definition: DnsLayer.h:73