PcapPlusPlus
pcpp::IgmpV3QueryLayer Class Reference

#include <IgmpLayer.h>

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

Public Member Functions

 IgmpV3QueryLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 IgmpV3QueryLayer (const IPv4Address &multicastAddr=IPv4Address::Zero, uint8_t maxResponseTime=0, uint8_t s_qrv=0)
 
igmpv3_query_headergetIgmpV3QueryHeader ()
 
uint16_t getSourceAddressCount ()
 
IPv4Address getSourceAddressAtIndex (int index)
 
bool addSourceAddress (const IPv4Address &addr)
 
bool addSourceAddressAtIndex (const IPv4Address &addr, int index)
 
bool removeSourceAddressAtIndex (int index)
 
bool removeAllSourceAddresses ()
 
void computeCalculateFields ()
 
size_t getHeaderLen ()
 
- Public Member Functions inherited from pcpp::IgmpLayer
igmp_headergetIgmpHeader ()
 
IPv4Address getGroupAddress ()
 
void setGroupAddress (const IPv4Address &groupAddr)
 
IgmpType getType ()
 
void setType (IgmpType type)
 
void parseNextLayer ()
 
std::string toString ()
 
OsiModelLayer getOsiModelLayer ()
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer ()
 
LayergetPrevLayer ()
 
ProtocolType getProtocol ()
 
uint8_t * getData ()
 
size_t getDataLen ()
 
uint8_t * getLayerPayload ()
 
size_t getLayerPayloadSize ()
 
bool isAllocatedToPacket ()
 
void copyData (uint8_t *toArr)
 

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

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
pcpp::IgmpV3QueryLayer::IgmpV3QueryLayer ( const IPv4Address multicastAddr = IPv4Address::Zero,
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 IPv4Address::Zero 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

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
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
void pcpp::IgmpV3QueryLayer::computeCalculateFields ( )
virtual

Calculate the IGMP checksum

Implements pcpp::Layer.

size_t pcpp::IgmpV3QueryLayer::getHeaderLen ( )
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.

igmpv3_query_header* pcpp::IgmpV3QueryLayer::getIgmpV3QueryHeader ( )
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
IPv4Address pcpp::IgmpV3QueryLayer::getSourceAddressAtIndex ( int  index)

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)
uint16_t pcpp::IgmpV3QueryLayer::getSourceAddressCount ( )
Returns
The number of source addresses in this message (as extracted from the igmpv3_query_header::numOfSources field)
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
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