PcapPlusPlus  22.11
pcpp::IgmpLayer Class Reference

#include <IgmpLayer.h>

Inheritance diagram for pcpp::IgmpLayer:
pcpp::Layer pcpp::IDataContainer pcpp::IgmpV1Layer pcpp::IgmpV2Layer pcpp::IgmpV3QueryLayer pcpp::IgmpV3ReportLayer

Public Member Functions

igmp_headergetIgmpHeader () const
 
IPv4Address getGroupAddress () const
 
void setGroupAddress (const IPv4Address &groupAddr)
 
IgmpType getType () const
 
void setType (IgmpType type)
 
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
 
virtual void computeCalculateFields ()=0
 

Static Public Member Functions

static ProtocolType getIGMPVerFromData (uint8_t *data, size_t dataLen, bool &isQuery)
 

Detailed Description

A base class for all IGMP (Internet Group Management Protocol) protocol classes. This is an abstract class and cannot be instantiated, only its child classes can be instantiated. The inherited classes represent the different versions of the protocol: IGMPv1, IGMPv2 and IGMPv3

Member Function Documentation

◆ getGroupAddress()

IPv4Address pcpp::IgmpLayer::getGroupAddress ( ) const
inline
Returns
The IPv4 multicast address stored igmp_header::groupAddress

◆ getHeaderLen()

size_t pcpp::IgmpLayer::getHeaderLen ( ) const
inlinevirtual
Returns
Size of IGMP header = 8B

Implements pcpp::Layer.

Reimplemented in pcpp::IgmpV3ReportLayer, and pcpp::IgmpV3QueryLayer.

◆ getIgmpHeader()

igmp_header* pcpp::IgmpLayer::getIgmpHeader ( ) const
inline

Get a pointer to the raw IGMPv1/IGMPv2 header. Notice this points directly to the data, so every change will change the actual packet data

Returns
A pointer to the igmp_header

◆ getIGMPVerFromData()

static ProtocolType pcpp::IgmpLayer::getIGMPVerFromData ( uint8_t *  data,
size_t  dataLen,
bool &  isQuery 
)
static

A static method that gets raw IGMP data (byte stream) and returns the IGMP version of this IGMP message

Parameters
[in]dataThe IGMP raw data (byte stream)
[in]dataLenRaw data length
[out]isQueryReturn true if IGMP message type is IgmpType_MembershipQuery and false otherwise
Returns
One of the values IGMPv1, IGMPv2, IGMPv3 according to detected IGMP version or UnknownProtocol if couldn't detect IGMP version

◆ getOsiModelLayer()

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

Implements pcpp::Layer.

◆ getType()

IgmpType pcpp::IgmpLayer::getType ( ) const
Returns
IGMP type set in igmp_header::type as IgmpType enum. Notice that if igmp_header::type contains a value that doesn't appear in the IgmpType enum, IgmpType_Unknown will be returned

◆ parseNextLayer()

void pcpp::IgmpLayer::parseNextLayer ( )
inlinevirtual

Does nothing for this layer (IGMP layer is always last)

Implements pcpp::Layer.

◆ setGroupAddress()

void pcpp::IgmpLayer::setGroupAddress ( const IPv4Address groupAddr)

Set the IPv4 multicast address

Parameters
[in]groupAddrThe IPv4 address to set

◆ setType()

void pcpp::IgmpLayer::setType ( IgmpType  type)

Set IGMP type (will be written to igmp_header::type field)

Parameters
[in]typeThe type to set

◆ toString()

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

Implements pcpp::Layer.