PcapPlusPlus  23.09
pcpp::NflogLayer Class Reference

#include <NflogLayer.h>

Inheritance diagram for pcpp::NflogLayer:
pcpp::Layer pcpp::IDataContainer

Public Member Functions

 NflogLayer (uint8_t *data, size_t dataLen, Packet *packet)
 
nflog_headergetNflogHeader () const
 
uint8_t getFamily ()
 
uint8_t getVersion ()
 
uint16_t getResourceId ()
 
NflogTlv getTlvByType (NflogTlvType type) const
 
void parseNextLayer ()
 
size_t getHeaderLen () const
 
void computeCalculateFields ()
 
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
 

Static Public Member Functions

static bool isDataValid (const uint8_t *data, size_t dataLen)
 

Detailed Description

Represents an NFLOG protocol layer

Constructor & Destructor Documentation

◆ NflogLayer()

pcpp::NflogLayer::NflogLayer ( uint8_t *  data,
size_t  dataLen,
Packet packet 
)
inline

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

Parameters
[in]dataA pointer to the raw data (will be casted to ether_header)
[in]dataLenSize of the data in bytes
[in]packetA pointer to the Packet instance where layer will be stored in

Member Function Documentation

◆ computeCalculateFields()

void pcpp::NflogLayer::computeCalculateFields ( )
inlinevirtual

Does nothing for this layer

Implements pcpp::Layer.

◆ getFamily()

uint8_t pcpp::NflogLayer::getFamily ( )

Get address family of the packet. e.g. 2 for ipv4 and 10 for ipv6

Returns
an unsigned char of address family

◆ getHeaderLen()

size_t pcpp::NflogLayer::getHeaderLen ( ) const
virtual
Returns
Size of nflog_header

Implements pcpp::Layer.

◆ getNflogHeader()

nflog_header* pcpp::NflogLayer::getNflogHeader ( ) const
inline

Get a pointer to the Nflog header.

Returns
A pointer to the nflog_header

◆ getOsiModelLayer()

OsiModelLayer pcpp::NflogLayer::getOsiModelLayer ( ) const
inlinevirtual
Returns
The OSI Model layer this protocol belongs to

Implements pcpp::Layer.

◆ getResourceId()

uint16_t pcpp::NflogLayer::getResourceId ( )

Get Resource Id in packet header On one netlink socket it's possible to listen to several nflog groups; the resource ID is the nflog group for the packet

◆ getTlvByType()

NflogTlv pcpp::NflogLayer::getTlvByType ( NflogTlvType  type) const

Get a TLV object found with the input type. if no tlv is found, the internal value of the object will set to nullptr

Parameters
[in]typetype of tlv by using enum class defined as NflogTlvType
Returns
NflogTlv obtained by type

◆ getVersion()

uint8_t pcpp::NflogLayer::getVersion ( )

Get Version number inside packet header The version field is 0 for the current version of the pseudo-header

Returns
an unsigned char for version

◆ isDataValid()

static bool pcpp::NflogLayer::isDataValid ( const uint8_t *  data,
size_t  dataLen 
)
static

A static method that validates the input data

Parameters
[in]dataThe pointer to the beginning of a byte stream of an NFLOG packet
[in]dataLenThe length of the byte stream
Returns
True if the data is valid and can represent an NFLOG packet

◆ parseNextLayer()

void pcpp::NflogLayer::parseNextLayer ( )
virtual

Currently identifies the following next layers: IPv4Layer, IPv6Layer using address family Otherwise sets PayloadLayer

Implements pcpp::Layer.

◆ toString()

std::string pcpp::NflogLayer::toString ( ) const
virtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.