PcapPlusPlus  20.08+
pcpp::DnsOverTcpLayer Class Reference

#include <DnsLayer.h>

Inheritance diagram for pcpp::DnsOverTcpLayer:
pcpp::DnsLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 DnsOverTcpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 DnsOverTcpLayer ()
 DnsOverTcpLayer (const DnsOverTcpLayer &other)
uint16_t getTcpMessageLength ()
void setTcpMessageLength (uint16_t value)
void computeCalculateFields ()
- Public Member Functions inherited from pcpp::DnsLayer
 DnsLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 DnsLayer ()
 DnsLayer (const DnsLayer &other)
DnsLayeroperator= (const DnsLayer &other)
dnshdrgetDnsHeader () const
DnsQuerygetQuery (const std::string &name, bool exactMatch) const
DnsQuerygetFirstQuery () const
DnsQuerygetNextQuery (DnsQuery *query) const
size_t getQueryCount () const
DnsQueryaddQuery (const std::string &name, DnsType dnsType, DnsClass dnsClass)
DnsQueryaddQuery (DnsQuery *const copyQuery)
bool removeQuery (const std::string &queryNameToRemove, bool exactMatch)
bool removeQuery (DnsQuery *queryToRemove)
DnsResourcegetAnswer (const std::string &name, bool exactMatch) const
DnsResourcegetFirstAnswer () const
DnsResourcegetNextAnswer (DnsResource *answer) const
size_t getAnswerCount () const
DnsResourceaddAnswer (const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
DnsResourceaddAnswer (DnsResource *const copyAnswer)
bool removeAnswer (const std::string &answerNameToRemove, bool exactMatch)
bool removeAnswer (DnsResource *answerToRemove)
DnsResourcegetAuthority (const std::string &name, bool exactMatch) const
DnsResourcegetFirstAuthority () const
DnsResourcegetNextAuthority (DnsResource *authority) const
size_t getAuthorityCount () const
DnsResourceaddAuthority (const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
DnsResourceaddAuthority (DnsResource *const copyAuthority)
bool removeAuthority (const std::string &authorityNameToRemove, bool exactMatch)
bool removeAuthority (DnsResource *authorityToRemove)
DnsResourcegetAdditionalRecord (const std::string &name, bool exactMatch) const
DnsResourcegetFirstAdditionalRecord () const
DnsResourcegetNextAdditionalRecord (DnsResource *additionalRecord) const
size_t getAdditionalRecordCount () const
DnsResourceaddAdditionalRecord (const std::string &name, DnsType dnsType, DnsClass dnsClass, uint32_t ttl, IDnsResourceData *data)
DnsResourceaddAdditionalRecord (const std::string &name, DnsType dnsType, uint16_t customData1, uint32_t customData2, IDnsResourceData *data)
DnsResourceaddAdditionalRecord (DnsResource *const copyAdditionalRecord)
bool removeAdditionalRecord (const std::string &additionalRecordNameToRemove, bool exactMatch)
bool removeAdditionalRecord (DnsResource *additionalRecordToRemove)
void parseNextLayer ()
size_t getHeaderLen () const
std::string toString () const
OsiModelLayer getOsiModelLayer () const
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
LayergetNextLayer () const
LayergetPrevLayer () const
ProtocolType getProtocol () const
uint8_t * getData () const
size_t getDataLen () const
uint8_t * getLayerPayload () const
size_t getLayerPayloadSize () const
bool isAllocatedToPacket () const
void copyData (uint8_t *toArr) const
uint8_t * getDataPtr (size_t offset=0) const

Additional Inherited Members

- Static Public Member Functions inherited from pcpp::DnsLayer
static bool isDnsPort (uint16_t port)
static bool isDataValid (const uint8_t *data, size_t dataLen, bool dnsOverTcp=false)

Detailed Description

Represents the DNS over TCP layer. DNS over TCP is described here: https://tools.ietf.org/html/rfc7766 . It is very similar to DNS over UDP, except for one field: TCP message length which is added in the beginning of the message before the other DNS data properties. The rest of the data is similar.

Note: DNS over TCP can spread over more than one packet, but this implementation doesn't support this use-case and assumes the whole message fits in a single packet.

Constructor & Destructor Documentation

◆ DnsOverTcpLayer() [1/3]

pcpp::DnsOverTcpLayer::DnsOverTcpLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 

A constructor that creates the layer from an existing packet raw data

[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

◆ DnsOverTcpLayer() [2/3]

pcpp::DnsOverTcpLayer::DnsOverTcpLayer ( )

A constructor that creates an empty DNS layer: all members of dnshdr are set to 0 and layer will contain no records

◆ DnsOverTcpLayer() [3/3]

pcpp::DnsOverTcpLayer::DnsOverTcpLayer ( const DnsOverTcpLayer other)

A copy constructor for this layer

Member Function Documentation

◆ computeCalculateFields()

void pcpp::DnsOverTcpLayer::computeCalculateFields ( )

Calculate the TCP message length field

Reimplemented from pcpp::DnsLayer.

◆ getTcpMessageLength()

uint16_t pcpp::DnsOverTcpLayer::getTcpMessageLength ( )
The value of the TCP message length as described in https://tools.ietf.org/html/rfc7766#section-8

◆ setTcpMessageLength()

void pcpp::DnsOverTcpLayer::setTcpMessageLength ( uint16_t  value)

Set the TCP message length value as described in https://tools.ietf.org/html/rfc7766#section-8

[in]valueThe value to set