PcapPlusPlus  21.05
pcpp::IgmpV3QueryLayer Class Reference

#include <IgmpLayer.h>

Inheritance diagram for pcpp::IgmpV3QueryLayer:
pcpp::IgmpLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 IgmpV3QueryLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 IgmpV3QueryLayer (const IPv4Address &multicastAddr=IPv4Address(), uint8_t maxResponseTime=0, uint8_t s_qrv=0)
 
igmpv3_query_headergetIgmpV3QueryHeader () const
 
uint16_t getSourceAddressCount () const
 
IPv4Address getSourceAddressAtIndex (int index) const
 
bool addSourceAddress (const IPv4Address &addr)
 
bool addSourceAddressAtIndex (const IPv4Address &addr, int index)
 
bool removeSourceAddressAtIndex (int index)
 
bool removeAllSourceAddresses ()
 
void computeCalculateFields ()
 
size_t getHeaderLen () const
 
- Public Member Functions inherited from pcpp::IgmpLayer
igmp_headergetIgmpHeader () const
 
IPv4Address getGroupAddress () const
 
void setGroupAddress (const IPv4Address &groupAddr)
 
IgmpType getType () const
 
void setType (IgmpType type)
 
void parseNextLayer ()
 
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::IgmpLayer
static ProtocolType getIGMPVerFromData (uint8_t *data, size_t dataLen, bool &isQuery)
 

Detailed Description

Represents an IGMPv3 (Internet Group Management Protocol ver 3) membership query message

Constructor & Destructor Documentation

◆ IgmpV3QueryLayer() [1/2]

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

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

Parameters
[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

◆ IgmpV3QueryLayer() [2/2]

pcpp::IgmpV3QueryLayer::IgmpV3QueryLayer ( const IPv4Address multicastAddr = IPv4Address(),
uint8_t  maxResponseTime = 0,
uint8_t  s_qrv = 0 
)

A constructor that allocates a new IGMPv3 membership query

Parameters
[in]multicastAddrThe multicast address to set. This is an optional parameter and has a default value of unspecified/zero IPv4 address if not provided
[in]maxResponseTimeThe max response time to set. This is an optional parameter and has a default value of 0 if not provided
[in]s_qrvA 1-byte value representing the value in Suppress Router-side Processing Flag + Querier's Robustness Variable (igmpv3_query_header::s_qrv field). This is an optional parameter and has a default value of 0 if not provided

Member Function Documentation

◆ addSourceAddress()

bool pcpp::IgmpV3QueryLayer::addSourceAddress ( const IPv4Address addr)

Add a new source address at the end of the source address list. The igmpv3_query_header::numOfSources field will be incremented accordingly

Parameters
[in]addrThe IPv4 source address to add
Returns
True if source address was added successfully or false otherwise. If false is returned an appropriate error message will be printed to log

◆ addSourceAddressAtIndex()

bool pcpp::IgmpV3QueryLayer::addSourceAddressAtIndex ( const IPv4Address addr,
int  index 
)

Add a new source address at a certain index of the source address list. The igmpv3_query_header::numOfSources field will be incremented accordingly

Parameters
[in]addrThe IPv4 source address to add
[in]indexThe index to add the new source address at
Returns
True if source address was added successfully or false otherwise. If false is returned an appropriate error message will be printed to log

◆ computeCalculateFields()

void pcpp::IgmpV3QueryLayer::computeCalculateFields ( )
virtual

Calculate the IGMP checksum

Implements pcpp::Layer.

◆ getHeaderLen()

size_t pcpp::IgmpV3QueryLayer::getHeaderLen ( ) const
virtual
Returns
The message size in bytes which include the size of the basic header + the size of the source address list

Reimplemented from pcpp::IgmpLayer.

◆ getIgmpV3QueryHeader()

igmpv3_query_header* pcpp::IgmpV3QueryLayer::getIgmpV3QueryHeader ( ) const
inline

Get a pointer to the raw IGMPv3 membership query header. Notice this points directly to the data, so every change will change the actual packet data

Returns
A pointer to the igmpv3_query_header

◆ getSourceAddressAtIndex()

IPv4Address pcpp::IgmpV3QueryLayer::getSourceAddressAtIndex ( int  index) const

Get the IPV4 source address in a certain index

Parameters
[in]indexThe requested index of the source address
Returns
The IPv4 source address, or IPv4Address::Zero if index is out of bounds (of the message or of the layer)

◆ getSourceAddressCount()

uint16_t pcpp::IgmpV3QueryLayer::getSourceAddressCount ( ) const
Returns
The number of source addresses in this message (as extracted from the igmpv3_query_header::numOfSources field)

◆ removeAllSourceAddresses()

bool pcpp::IgmpV3QueryLayer::removeAllSourceAddresses ( )

Remove all source addresses in the message. The igmpv3_query_header::numOfSources field will be set to 0

Returns
True if all source addresses were cleared successfully or false otherwise. If false is returned an appropriate error message will be printed to log

◆ removeSourceAddressAtIndex()

bool pcpp::IgmpV3QueryLayer::removeSourceAddressAtIndex ( int  index)

Remove a source address at a certain index. The igmpv3_query_header::numOfSources field will be decremented accordingly

Parameters
[in]indexThe index of the source address to be removed
Returns
True if source address was removed successfully or false otherwise. If false is returned an appropriate error message will be printed to log