PcapPlusPlus  21.11
pcpp::IgmpV3ReportLayer Class Reference

#include <IgmpLayer.h>

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

Public Member Functions

 IgmpV3ReportLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 IgmpV3ReportLayer ()
 
igmpv3_report_headergetReportHeader () const
 
uint16_t getGroupRecordCount () const
 
igmpv3_group_recordgetFirstGroupRecord () const
 
igmpv3_group_recordgetNextGroupRecord (igmpv3_group_record *groupRecord) const
 
igmpv3_group_recordaddGroupRecord (uint8_t recordType, const IPv4Address &multicastAddress, const std::vector< IPv4Address > &sourceAddresses)
 
igmpv3_group_recordaddGroupRecordAtIndex (uint8_t recordType, const IPv4Address &multicastAddress, const std::vector< IPv4Address > &sourceAddresses, int index)
 
bool removeGroupRecordAtIndex (int index)
 
bool removeAllGroupRecords ()
 
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 report message

Constructor & Destructor Documentation

◆ IgmpV3ReportLayer() [1/2]

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

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

◆ IgmpV3ReportLayer() [2/2]

pcpp::IgmpV3ReportLayer::IgmpV3ReportLayer ( )
inline

A constructor that allocates a new IGMPv3 membership report with 0 group addresses

Member Function Documentation

◆ addGroupRecord()

igmpv3_group_record* pcpp::IgmpV3ReportLayer::addGroupRecord ( uint8_t  recordType,
const IPv4Address multicastAddress,
const std::vector< IPv4Address > &  sourceAddresses 
)

Add a new group record at a the end of the group record list. The igmpv3_report_header::numOfGroupRecords field will be incremented accordingly

Parameters
[in]recordTypeThe type of the new group record
[in]multicastAddressThe multicast address of the new group record
[in]sourceAddressesA vector containing all the source addresses of the new group record
Returns
The method constructs a new group record, adds it to the end of the group record list of IGMPv3 report message and returns a pointer to the new message. If something went wrong in creating or adding the new group record a NULL value is returned and an appropriate error message is printed to log

◆ addGroupRecordAtIndex()

igmpv3_group_record* pcpp::IgmpV3ReportLayer::addGroupRecordAtIndex ( uint8_t  recordType,
const IPv4Address multicastAddress,
const std::vector< IPv4Address > &  sourceAddresses,
int  index 
)

Add a new group record at a certain index of the group record list. The igmpv3_report_header::numOfGroupRecords field will be incremented accordingly

Parameters
[in]recordTypeThe type of the new group record
[in]multicastAddressThe multicast address of the new group record
[in]sourceAddressesA vector containing all the source addresses of the new group record
[in]indexThe index to add the new group address at
Returns
The method constructs a new group record, adds it to the IGMPv3 report message and returns a pointer to the new message. If something went wrong in creating or adding the new group record a NULL value is returned and an appropriate error message is printed to log

◆ computeCalculateFields()

void pcpp::IgmpV3ReportLayer::computeCalculateFields ( )
virtual

Calculate the IGMP checksum

Implements pcpp::Layer.

◆ getFirstGroupRecord()

igmpv3_group_record* pcpp::IgmpV3ReportLayer::getFirstGroupRecord ( ) const
Returns
A pointer to the first group record or NULL if no group records exist. Notice the return value is a pointer to the real data, so changes in the return value will affect the packet data

◆ getGroupRecordCount()

uint16_t pcpp::IgmpV3ReportLayer::getGroupRecordCount ( ) const
Returns
The number of group records in this message (as extracted from the igmpv3_report_header::numOfGroupRecords field)

◆ getHeaderLen()

size_t pcpp::IgmpV3ReportLayer::getHeaderLen ( ) const
inlinevirtual
Returns
The message size in bytes which include the size of the basic header + the size of the group record list

Reimplemented from pcpp::IgmpLayer.

◆ getNextGroupRecord()

igmpv3_group_record* pcpp::IgmpV3ReportLayer::getNextGroupRecord ( igmpv3_group_record groupRecord) const

Get the group record that comes next to a given group record. If "groupRecord" is NULL then NULL will be returned. If "groupRecord" is the last group record or if it is out of layer bounds NULL will be returned also. Notice the return value is a pointer to the real data casted to igmpv3_group_record type (as opposed to a copy of the option data). So changes in the return value will affect the packet data

Parameters
[in]groupRecordThe group record to start searching from
Returns
The next group record or NULL if "groupRecord" is NULL, last or out of layer bounds

◆ getReportHeader()

igmpv3_report_header* pcpp::IgmpV3ReportLayer::getReportHeader ( ) const
inline

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

Returns
A pointer to the igmpv3_report_header

◆ removeAllGroupRecords()

bool pcpp::IgmpV3ReportLayer::removeAllGroupRecords ( )

Remove all group records in the message. The igmpv3_report_header::numOfGroupRecords field will be set to 0

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

◆ removeGroupRecordAtIndex()

bool pcpp::IgmpV3ReportLayer::removeGroupRecordAtIndex ( int  index)

Remove a group record at a certain index. The igmpv3_report_header::numOfGroupRecords field will be decremented accordingly

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