PcapPlusPlus  Next
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 () override
 Does nothing for this layer (IGMP layer is always last)
 
size_t getHeaderLen () const override
 
std::string toString () const override
 
OsiModelLayer getOsiModelLayer () const override
 
- Public Member Functions inherited from pcpp::Layer
 ~Layer () override
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
bool isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) 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 override
 
virtual void computeCalculateFields ()=0
 Each layer can compute field values automatically using this method. This is an abstract method.
 

Static Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from pcpp::Layer
PacketgetAttachedPacket ()
 Get a pointer to the Packet this layer is attached to (if any). More...
 
Packet const * getAttachedPacket () const
 Get a pointer to the Packet this layer is attached to (if any). More...
 
template<typename T , typename... Args>
LayerconstructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Construct the next layer in the protocol stack. No validation is performed on the data. More...
 
template<typename T , typename... Args>
LayerconstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename TFactory , typename... Args>
LayerconstructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Construct the next layer in the protocol stack using a factory functor. More...
 
template<typename TFactory , typename... Args>
LayerconstructNextLayerFromFactory (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 Construct the next layer in the protocol stack using a factory functor. More...
 
template<typename T , typename... Args>
LayertryConstructNextLayer (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 
template<typename T , typename... Args>
LayertryConstructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename T , typename TFallback , typename... Args>
LayertryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack with a fallback option. More...
 
template<typename T , typename TFallback , typename... Args>
LayertryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 
template<typename TFallback , typename TFactory , typename... Args>
LayertryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More...
 
template<typename TFallback , typename TFactory , typename... Args>
LayertryConstructNextLayerFromFactoryWithFallback (TFactory factoryFn, uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs)
 Try to construct the next layer in the protocol stack using a factory functor with a fallback option. More...
 
- Static Protected Member Functions inherited from pcpp::Layer
template<typename T >
static bool canReinterpretAs (const uint8_t *data, size_t dataLen)
 Check if the data is large enough to reinterpret as a type. More...
 

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
inlineoverridevirtual
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
inlineoverridevirtual
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

◆ 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
overridevirtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.