Coverage Report

Created: 2025-11-24 07:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/PcapPlusPlus/Packet++/header/Layer.h
Line
Count
Source
1
#pragma once
2
3
#include <stdint.h>
4
#include <stdio.h>
5
#include "ProtocolType.h"
6
#include <string>
7
#include <stdexcept>
8
#include <utility>
9
10
/// @file
11
12
/// @namespace pcpp
13
/// @brief The main namespace for the PcapPlusPlus lib
14
namespace pcpp
15
{
16
17
  /// @class IDataContainer
18
  /// An interface (virtual abstract class) that indicates an object that holds a pointer to a buffer data. The Layer
19
  /// class is an example of such object, hence it inherits this interface
20
  class IDataContainer
21
  {
22
  public:
23
    /// Get a pointer to the data
24
    /// @param[in] offset Get a pointer in a certain offset. Default is 0 - get a pointer to start of data
25
    /// @return A pointer to the data
26
    virtual uint8_t* getDataPtr(size_t offset = 0) const = 0;
27
28
2.91M
    virtual ~IDataContainer() = default;
29
  };
30
31
  class Packet;
32
33
  /// @class Layer
34
  /// Layer is the base class for all protocol layers. Each protocol supported in PcapPlusPlus has a class that
35
  /// inherits Layer.
36
  /// The protocol layer class expose all properties and methods relevant for viewing and editing protocol fields.
37
  /// For example: a pointer to a structured header (e.g tcphdr, iphdr, etc.), protocol header size, payload size,
38
  /// compute fields that can be automatically computed, print protocol data to string, etc.
39
  /// Each protocol instance is obviously part of a protocol stack (which construct a packet). This protocol stack is
40
  /// represented in PcapPlusPlus in a linked list, and each layer is an element in this list. That's why each layer
41
  /// has properties to the next and previous layer in the protocol stack. The Layer class, as a base class, is
42
  /// abstract and the user can't create an instance of it (it has a private constructor). Each layer holds a pointer
43
  /// to the relevant place in the packet. The layer sees all the data from this pointer forward until the end of the
44
  /// packet. Here is an example packet showing this concept:
45
  ///
46
  /// @code{.unparsed}
47
  /// ====================================================
48
  /// |Eth       |IPv4       |TCP       |Packet          |
49
  /// |Header    |Header     |Header    |Payload         |
50
  /// ====================================================
51
  ///
52
  /// |--------------------------------------------------|
53
  /// EthLayer data
54
  ///            |---------------------------------------|
55
  ///            IPv4Layer data
56
  ///                        |---------------------------|
57
  ///                        TcpLayer data
58
  ///                                   |----------------|
59
  ///                                   PayloadLayer data
60
  /// @endcode
61
  class Layer : public IDataContainer
62
  {
63
    friend class Packet;
64
65
  public:
66
    /// A destructor for this class. Frees the data if it was allocated by the layer constructor (see
67
    /// isAllocatedToPacket() for more info)
68
    ~Layer() override;
69
70
    /// @return A pointer to the next layer in the protocol stack or nullptr if the layer is the last one
71
    Layer* getNextLayer() const
72
55.2M
    {
73
55.2M
      return m_NextLayer;
74
55.2M
    }
75
76
    /// @return A pointer to the previous layer in the protocol stack or nullptr if the layer is the first one
77
    Layer* getPrevLayer() const
78
1.43M
    {
79
1.43M
      return m_PrevLayer;
80
1.43M
    }
81
82
    /// @return The protocol enum
83
    ProtocolType getProtocol() const
84
39.3M
    {
85
39.3M
      return m_Protocol;
86
39.3M
    }
87
88
    /// Check if the layer's protocol matches a protocol family
89
    /// @param protocolTypeFamily The protocol family to check
90
    /// @return True if the layer's protocol matches the protocol family, false otherwise
91
    bool isMemberOfProtocolFamily(ProtocolTypeFamily protocolTypeFamily) const;
92
93
    /// @return A pointer to the layer raw data. In most cases it'll be a pointer to the first byte of the header
94
    uint8_t* getData() const
95
189k
    {
96
189k
      return m_Data;
97
189k
    }
98
99
    /// @return The length in bytes of the data from the first byte of the header until the end of the packet
100
    size_t getDataLen() const
101
2.53M
    {
102
2.53M
      return m_DataLen;
103
2.53M
    }
104
105
    /// @return A pointer for the layer payload, meaning the first byte after the header
106
    uint8_t* getLayerPayload() const
107
0
    {
108
0
      return m_Data + getHeaderLen();
109
0
    }
110
111
    /// @return The size in bytes of the payload
112
    size_t getLayerPayloadSize() const
113
41.7k
    {
114
41.7k
      return m_DataLen - getHeaderLen();
115
41.7k
    }
116
117
    /// Raw data in layers can come from one of sources:
118
    /// 1. from an existing packet - this is the case when parsing packets received from files or the network. In
119
    /// this case the data was already allocated by someone else, and layer only holds the pointer to the relevant
120
    /// place inside this data
121
    /// 2. when creating packets, data is allocated when layer is created. In this case the layer is responsible for
122
    /// freeing it as well
123
    ///
124
    /// @return Returns true if the data was allocated by an external source (a packet) or false if it was allocated
125
    /// by the layer itself
126
    bool isAllocatedToPacket() const
127
2.91M
    {
128
2.91M
      return m_Packet != nullptr;
129
2.91M
    }
130
131
    /// Copy the raw data of this layer to another array
132
    /// @param[out] toArr The destination byte array
133
    void copyData(uint8_t* toArr) const;
134
135
    // implement abstract methods
136
137
    uint8_t* getDataPtr(size_t offset = 0) const override
138
75.6k
    {
139
75.6k
      return static_cast<uint8_t*>(m_Data + offset);
140
75.6k
    }
141
142
    // abstract methods
143
144
    /// Each layer is responsible for parsing the next layer
145
    virtual void parseNextLayer() = 0;
146
147
    /// @return The header length in bytes
148
    virtual size_t getHeaderLen() const = 0;
149
150
    /// Each layer can compute field values automatically using this method. This is an abstract method
151
    virtual void computeCalculateFields() = 0;
152
153
    /// @return A string representation of the layer most important data (should look like the layer description in
154
    /// Wireshark)
155
    virtual std::string toString() const = 0;
156
157
    /// @return The OSI Model layer this protocol belongs to
158
    virtual OsiModelLayer getOsiModelLayer() const = 0;
159
160
  protected:
161
    uint8_t* m_Data;
162
    size_t m_DataLen;
163
    Packet* m_Packet;
164
    ProtocolType m_Protocol;
165
    Layer* m_NextLayer;
166
    Layer* m_PrevLayer;
167
    bool m_IsAllocatedInPacket;
168
169
    Layer()
170
        : m_Data(nullptr), m_DataLen(0), m_Packet(nullptr), m_Protocol(UnknownProtocol), m_NextLayer(nullptr),
171
          m_PrevLayer(nullptr), m_IsAllocatedInPacket(false)
172
0
    {}
173
174
    Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol = UnknownProtocol)
175
2.83M
        : m_Data(data), m_DataLen(dataLen), m_Packet(packet), m_Protocol(protocol), m_NextLayer(nullptr),
176
2.83M
          m_PrevLayer(prevLayer), m_IsAllocatedInPacket(false)
177
2.83M
    {}
178
179
    // Copy c'tor
180
    Layer(const Layer& other);
181
    Layer& operator=(const Layer& other);
182
183
    void setNextLayer(Layer* nextLayer)
184
1.30M
    {
185
1.30M
      m_NextLayer = nextLayer;
186
1.30M
    }
187
    void setPrevLayer(Layer* prevLayer)
188
0
    {
189
0
      m_PrevLayer = prevLayer;
190
0
    }
191
192
    virtual bool extendLayer(int offsetInLayer, size_t numOfBytesToExtend);
193
    virtual bool shortenLayer(int offsetInLayer, size_t numOfBytesToShorten);
194
195
    bool hasNextLayer() const
196
2.28M
    {
197
2.28M
      return m_NextLayer != nullptr;
198
2.28M
    }
199
200
    /// Construct the next layer in the protocol stack. No validation is performed on the data.
201
    /// @tparam T The type of the layer to construct
202
    /// @tparam Args The types of the arguments to pass to the layer constructor
203
    /// @param[in] data The data to construct the layer from
204
    /// @param[in] dataLen The length of the data
205
    /// @param[in] packet The packet the layer belongs to
206
    /// @param[in] extraArgs Extra arguments to be forwarded to the layer constructor
207
    /// @return The constructed layer
208
    template <typename T, typename... Args>
209
    Layer* constructNextLayer(uint8_t* data, size_t dataLen, Packet* packet, Args&&... extraArgs)
210
1.20M
    {
211
1.20M
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
1.20M
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
1.20M
      setNextLayer(newLayer);
218
1.20M
      return newLayer;
219
1.20M
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
71.3k
    {
211
71.3k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
71.3k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
71.3k
      setNextLayer(newLayer);
218
71.3k
      return newLayer;
219
71.3k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::UdpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
184k
    {
211
184k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
184k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
184k
      setNextLayer(newLayer);
218
184k
      return newLayer;
219
184k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::TcpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
278k
    {
211
278k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
278k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
278k
      setNextLayer(newLayer);
218
278k
      return newLayer;
219
278k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IcmpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
20.5k
    {
211
20.5k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
20.5k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
20.5k
      setNextLayer(newLayer);
218
20.5k
      return newLayer;
219
20.5k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IPv4Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
398k
    {
211
398k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
398k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
398k
      setNextLayer(newLayer);
218
398k
      return newLayer;
219
398k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IPv6Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
39.2k
    {
211
39.2k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
39.2k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
39.2k
      setNextLayer(newLayer);
218
39.2k
      return newLayer;
219
39.2k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::GREv0Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
2.16k
    {
211
2.16k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
2.16k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
2.16k
      setNextLayer(newLayer);
218
2.16k
      return newLayer;
219
2.16k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::GREv1Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
44.6k
    {
211
44.6k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
44.6k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
44.6k
      setNextLayer(newLayer);
218
44.6k
      return newLayer;
219
44.6k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IgmpV1Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
1.47k
    {
211
1.47k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
1.47k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
1.47k
      setNextLayer(newLayer);
218
1.47k
      return newLayer;
219
1.47k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IgmpV2Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
5.11k
    {
211
5.11k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
5.11k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
5.11k
      setNextLayer(newLayer);
218
5.11k
      return newLayer;
219
5.11k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IgmpV3QueryLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
2.06k
    {
211
2.06k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
2.06k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
2.06k
      setNextLayer(newLayer);
218
2.06k
      return newLayer;
219
2.06k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::IgmpV3ReportLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
959
    {
211
959
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
959
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
959
      setNextLayer(newLayer);
218
959
      return newLayer;
219
959
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::AuthenticationHeaderLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
2.79k
    {
211
2.79k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
2.79k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
2.79k
      setNextLayer(newLayer);
218
2.79k
      return newLayer;
219
2.79k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::ESPLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
25
    {
211
25
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
25
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
25
      setNextLayer(newLayer);
218
25
      return newLayer;
219
25
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::VrrpV2Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
2.49k
    {
211
2.49k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
2.49k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
2.49k
      setNextLayer(newLayer);
218
2.49k
      return newLayer;
219
2.49k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::VrrpV3Layer, pcpp::IPAddress::AddressType>(unsigned char*, unsigned long, pcpp::Packet*, pcpp::IPAddress::AddressType&&)
Line
Count
Source
210
3.45k
    {
211
3.45k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
3.45k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
3.45k
      setNextLayer(newLayer);
218
3.45k
      return newLayer;
219
3.45k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::HttpRequestLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
4.89k
    {
211
4.89k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
4.89k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
4.89k
      setNextLayer(newLayer);
218
4.89k
      return newLayer;
219
4.89k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::HttpResponseLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
11.6k
    {
211
11.6k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
11.6k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
11.6k
      setNextLayer(newLayer);
218
11.6k
      return newLayer;
219
11.6k
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::SipRequestLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::SipResponseLayer>(unsigned char*, unsigned long, pcpp::Packet*)
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::DnsOverTcpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
16.0k
    {
211
16.0k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
16.0k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
16.0k
      setNextLayer(newLayer);
218
16.0k
      return newLayer;
219
16.0k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::TelnetLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
19.7k
    {
211
19.7k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
19.7k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
19.7k
      setNextLayer(newLayer);
218
19.7k
      return newLayer;
219
19.7k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::FtpResponseLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
865
    {
211
865
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
865
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
865
      setNextLayer(newLayer);
218
865
      return newLayer;
219
865
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::FtpRequestLayer>(unsigned char*, unsigned long, pcpp::Packet*)
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::FtpDataLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
1.05k
    {
211
1.05k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
1.05k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
1.05k
      setNextLayer(newLayer);
218
1.05k
      return newLayer;
219
1.05k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::TpktLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
4.27k
    {
211
4.27k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
4.27k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
4.27k
      setNextLayer(newLayer);
218
4.27k
      return newLayer;
219
4.27k
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::SmtpResponseLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::SmtpRequestLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::GtpV2Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::ModbusLayer>(unsigned char*, unsigned long, pcpp::Packet*)
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::ArpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
1.82k
    {
211
1.82k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
1.82k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
1.82k
      setNextLayer(newLayer);
218
1.82k
      return newLayer;
219
1.82k
    }
pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::VlanLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
210
83.1k
    {
211
83.1k
      if (hasNextLayer())
212
0
      {
213
0
        throw std::runtime_error("Next layer already exists");
214
0
      }
215
216
83.1k
      Layer* newLayer = new T(data, dataLen, this, packet, std::forward<Args>(extraArgs)...);
217
83.1k
      setNextLayer(newLayer);
218
83.1k
      return newLayer;
219
83.1k
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::PPPoESessionLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::PPPoEDiscoveryLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::MplsLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::constructNextLayer<pcpp::WakeOnLanLayer>(unsigned char*, unsigned long, pcpp::Packet*)
220
221
    /// Try to construct the next layer in the protocol stack with a fallback option.
222
    ///
223
    /// The method checks if the data is valid for the layer type T before constructing it by calling
224
    /// T::isDataValid(data, dataLen). If the data is invalid, it constructs the layer of type TFallback.
225
    ///
226
    /// @tparam T The type of the layer to construct
227
    /// @tparam TFallback The fallback layer type to construct if T fails
228
    /// @tparam Args The types of the extra arguments to pass to the layer constructor of T
229
    /// @param[in] data The data to construct the layer from
230
    /// @param[in] dataLen The length of the data
231
    /// @param[in] packet The packet the layer belongs to
232
    /// @param[in] extraArgs Extra arguments to be forwarded to the layer constructor of T
233
    /// @return The constructed layer of type T or TFallback
234
    template <typename T, typename TFallback, typename... Args>
235
    Layer* tryConstructNextLayerWithFallback(uint8_t* data, size_t dataLen, Packet* packet, Args&&... extraArgs)
236
1.07M
    {
237
1.07M
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
1.07M
      {
239
1.07M
        return m_NextLayer;
240
1.07M
      }
241
242
6.25k
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
1.07M
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::UdpLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
184k
    {
237
184k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
184k
      {
239
184k
        return m_NextLayer;
240
184k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
184k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::TcpLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
283k
    {
237
283k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
278k
      {
239
278k
        return m_NextLayer;
240
278k
      }
241
242
5.26k
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
283k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IcmpLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
20.5k
    {
237
20.5k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
20.5k
      {
239
20.5k
        return m_NextLayer;
240
20.5k
      }
241
242
41
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
20.5k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IPv4Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
399k
    {
237
399k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
398k
      {
239
398k
        return m_NextLayer;
240
398k
      }
241
242
942
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
399k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IPv6Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
39.2k
    {
237
39.2k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
39.2k
      {
239
39.2k
        return m_NextLayer;
240
39.2k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
39.2k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::GREv0Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
2.16k
    {
237
2.16k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
2.16k
      {
239
2.16k
        return m_NextLayer;
240
2.16k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
2.16k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::GREv1Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
44.6k
    {
237
44.6k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
44.6k
      {
239
44.6k
        return m_NextLayer;
240
44.6k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
44.6k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IgmpV1Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
1.47k
    {
237
1.47k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
1.47k
      {
239
1.47k
        return m_NextLayer;
240
1.47k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
1.47k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IgmpV2Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
5.11k
    {
237
5.11k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
5.11k
      {
239
5.11k
        return m_NextLayer;
240
5.11k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
5.11k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IgmpV3QueryLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
2.06k
    {
237
2.06k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
2.06k
      {
239
2.06k
        return m_NextLayer;
240
2.06k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
2.06k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::IgmpV3ReportLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
959
    {
237
959
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
959
      {
239
959
        return m_NextLayer;
240
959
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
959
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::AuthenticationHeaderLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
2.79k
    {
237
2.79k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
2.79k
      {
239
2.79k
        return m_NextLayer;
240
2.79k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
2.79k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::ESPLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
25
    {
237
25
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
25
      {
239
25
        return m_NextLayer;
240
25
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
25
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::VrrpV2Layer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
2.49k
    {
237
2.49k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
2.49k
      {
239
2.49k
        return m_NextLayer;
240
2.49k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
2.49k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::VrrpV3Layer, pcpp::PayloadLayer, pcpp::IPAddress::AddressType>(unsigned char*, unsigned long, pcpp::Packet*, pcpp::IPAddress::AddressType&&)
Line
Count
Source
236
3.45k
    {
237
3.45k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
3.45k
      {
239
3.45k
        return m_NextLayer;
240
3.45k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
3.45k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::ArpLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
1.83k
    {
237
1.83k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
1.82k
      {
239
1.82k
        return m_NextLayer;
240
1.82k
      }
241
242
12
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
1.83k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::VlanLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
236
83.1k
    {
237
83.1k
      if (tryConstructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...))
238
83.1k
      {
239
83.1k
        return m_NextLayer;
240
83.1k
      }
241
242
0
      return constructNextLayer<TFallback>(data, dataLen, packet);
243
83.1k
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::PPPoESessionLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::PPPoEDiscoveryLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::MplsLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayerWithFallback<pcpp::WakeOnLanLayer, pcpp::PayloadLayer>(unsigned char*, unsigned long, pcpp::Packet*)
244
245
    /// @brief Check if the data is large enough to reinterpret as a type
246
    ///
247
    /// The data must be non-null and at least as large as the type
248
    ///
249
    /// @tparam T The type to reinterpret as
250
    /// @param data The data to check
251
    /// @param dataLen The length of the data
252
    /// @return True if the data is large enough to reinterpret as T, false otherwise
253
    template <typename T> static bool canReinterpretAs(const uint8_t* data, size_t dataLen)
254
836k
    {
255
836k
      return data != nullptr && dataLen >= sizeof(T);
256
836k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::arphdr>(unsigned char const*, unsigned long)
Line
Count
Source
254
1.83k
    {
255
1.83k
      return data != nullptr && dataLen >= sizeof(T);
256
1.83k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::iphdr>(unsigned char const*, unsigned long)
Line
Count
Source
254
565k
    {
255
565k
      return data != nullptr && dataLen >= sizeof(T);
256
565k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::vrrp_header>(unsigned char const*, unsigned long)
Line
Count
Source
254
5.94k
    {
255
5.94k
      return data != nullptr && dataLen >= sizeof(T);
256
5.94k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::ip6_hdr>(unsigned char const*, unsigned long)
Line
Count
Source
254
91.6k
    {
255
91.6k
      return data != nullptr && dataLen >= sizeof(T);
256
91.6k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::vlan_header>(unsigned char const*, unsigned long)
Line
Count
Source
254
83.1k
    {
255
83.1k
      return data != nullptr && dataLen >= sizeof(T);
256
83.1k
    }
Unexecuted instantiation: bool pcpp::Layer::canReinterpretAs<pcpp::MplsLayer::mpls_header>(unsigned char const*, unsigned long)
bool pcpp::Layer::canReinterpretAs<pcpp::igmp_header>(unsigned char const*, unsigned long)
Line
Count
Source
254
6.58k
    {
255
6.58k
      return data != nullptr && dataLen >= sizeof(T);
256
6.58k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::igmpv3_query_header>(unsigned char const*, unsigned long)
Line
Count
Source
254
2.06k
    {
255
2.06k
      return data != nullptr && dataLen >= sizeof(T);
256
2.06k
    }
bool pcpp::Layer::canReinterpretAs<pcpp::igmpv3_report_header>(unsigned char const*, unsigned long)
Line
Count
Source
254
959
    {
255
959
      return data != nullptr && dataLen >= sizeof(T);
256
959
    }
bool pcpp::Layer::canReinterpretAs<pcpp::tpkthdr>(unsigned char const*, unsigned long)
Line
Count
Source
254
78.3k
    {
255
78.3k
      return data != nullptr && dataLen >= sizeof(T);
256
78.3k
    }
Unexecuted instantiation: bool pcpp::Layer::canReinterpretAs<pcpp::stp_tcn_bpdu>(unsigned char const*, unsigned long)
Unexecuted instantiation: bool pcpp::Layer::canReinterpretAs<pcpp::stp_conf_bpdu>(unsigned char const*, unsigned long)
Unexecuted instantiation: bool pcpp::Layer::canReinterpretAs<pcpp::rstp_conf_bpdu>(unsigned char const*, unsigned long)
Unexecuted instantiation: bool pcpp::Layer::canReinterpretAs<pcpp::mstp_conf_bpdu>(unsigned char const*, unsigned long)
257
258
  private:
259
    /// Try to construct the next layer in the protocol stack.
260
    ///
261
    /// The method checks if the data is valid for the layer type T before constructing it by calling
262
    /// T::isDataValid(data, dataLen). If the data is invalid, a nullptr is returned.
263
    ///
264
    /// @tparam T The type of the layer to construct
265
    /// @tparam Args The types of the extra arguments to pass to the layer constructor
266
    /// @param[in] data The data to construct the layer from
267
    /// @param[in] dataLen The length of the data
268
    /// @param[in] packet The packet the layer belongs to
269
    /// @param[in] extraArgs Extra arguments to be forwarded to the layer constructor
270
    /// @return The constructed layer or nullptr if the data is invalid
271
    template <typename T, typename... Args>
272
    Layer* tryConstructNextLayer(uint8_t* data, size_t dataLen, Packet* packet, Args&&... extraArgs)
273
1.07M
    {
274
1.07M
      if (T::isDataValid(data, dataLen))
275
1.07M
      {
276
1.07M
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
1.07M
      }
278
6.25k
      return nullptr;
279
1.07M
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::UdpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
184k
    {
274
184k
      if (T::isDataValid(data, dataLen))
275
184k
      {
276
184k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
184k
      }
278
0
      return nullptr;
279
184k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::TcpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
283k
    {
274
283k
      if (T::isDataValid(data, dataLen))
275
278k
      {
276
278k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
278k
      }
278
5.26k
      return nullptr;
279
283k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IcmpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
20.5k
    {
274
20.5k
      if (T::isDataValid(data, dataLen))
275
20.5k
      {
276
20.5k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
20.5k
      }
278
41
      return nullptr;
279
20.5k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IPv4Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
399k
    {
274
399k
      if (T::isDataValid(data, dataLen))
275
398k
      {
276
398k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
398k
      }
278
942
      return nullptr;
279
399k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IPv6Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
39.2k
    {
274
39.2k
      if (T::isDataValid(data, dataLen))
275
39.2k
      {
276
39.2k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
39.2k
      }
278
0
      return nullptr;
279
39.2k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::GREv0Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
2.16k
    {
274
2.16k
      if (T::isDataValid(data, dataLen))
275
2.16k
      {
276
2.16k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
2.16k
      }
278
0
      return nullptr;
279
2.16k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::GREv1Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
44.6k
    {
274
44.6k
      if (T::isDataValid(data, dataLen))
275
44.6k
      {
276
44.6k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
44.6k
      }
278
0
      return nullptr;
279
44.6k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IgmpV1Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
1.47k
    {
274
1.47k
      if (T::isDataValid(data, dataLen))
275
1.47k
      {
276
1.47k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
1.47k
      }
278
0
      return nullptr;
279
1.47k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IgmpV2Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
5.11k
    {
274
5.11k
      if (T::isDataValid(data, dataLen))
275
5.11k
      {
276
5.11k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
5.11k
      }
278
0
      return nullptr;
279
5.11k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IgmpV3QueryLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
2.06k
    {
274
2.06k
      if (T::isDataValid(data, dataLen))
275
2.06k
      {
276
2.06k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
2.06k
      }
278
0
      return nullptr;
279
2.06k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::IgmpV3ReportLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
959
    {
274
959
      if (T::isDataValid(data, dataLen))
275
959
      {
276
959
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
959
      }
278
0
      return nullptr;
279
959
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::AuthenticationHeaderLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
2.79k
    {
274
2.79k
      if (T::isDataValid(data, dataLen))
275
2.79k
      {
276
2.79k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
2.79k
      }
278
0
      return nullptr;
279
2.79k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::ESPLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
25
    {
274
25
      if (T::isDataValid(data, dataLen))
275
25
      {
276
25
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
25
      }
278
0
      return nullptr;
279
25
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::VrrpV2Layer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
2.49k
    {
274
2.49k
      if (T::isDataValid(data, dataLen))
275
2.49k
      {
276
2.49k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
2.49k
      }
278
0
      return nullptr;
279
2.49k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::VrrpV3Layer, pcpp::IPAddress::AddressType>(unsigned char*, unsigned long, pcpp::Packet*, pcpp::IPAddress::AddressType&&)
Line
Count
Source
273
3.45k
    {
274
3.45k
      if (T::isDataValid(data, dataLen))
275
3.45k
      {
276
3.45k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
3.45k
      }
278
0
      return nullptr;
279
3.45k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::ArpLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
1.83k
    {
274
1.83k
      if (T::isDataValid(data, dataLen))
275
1.82k
      {
276
1.82k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
1.82k
      }
278
12
      return nullptr;
279
1.83k
    }
pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::VlanLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Line
Count
Source
273
83.1k
    {
274
83.1k
      if (T::isDataValid(data, dataLen))
275
83.1k
      {
276
83.1k
        return constructNextLayer<T>(data, dataLen, packet, std::forward<Args>(extraArgs)...);
277
83.1k
      }
278
0
      return nullptr;
279
83.1k
    }
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::PPPoESessionLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::PPPoEDiscoveryLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::MplsLayer>(unsigned char*, unsigned long, pcpp::Packet*)
Unexecuted instantiation: pcpp::Layer* pcpp::Layer::tryConstructNextLayer<pcpp::WakeOnLanLayer>(unsigned char*, unsigned long, pcpp::Packet*)
280
  };
281
282
  inline std::ostream& operator<<(std::ostream& os, const pcpp::Layer& layer)
283
0
  {
284
0
    os << layer.toString();
285
0
    return os;
286
0
  }
287
}  // namespace pcpp