PcapPlusPlus  Next
NullLoopbackLayer.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include "Layer.h"
6 
7 namespace pcpp
8 {
9 
11 #define PCPP_BSD_AF_INET 2
13 #define PCPP_BSD_AF_NS 6
15 #define PCPP_BSD_AF_ISO 7
17 #define PCPP_BSD_AF_APPLETALK 16
19 #define PCPP_BSD_AF_IPX 23
21 #define PCPP_BSD_AF_INET6_BSD 24
23 #define PCPP_BSD_AF_INET6_FREEBSD 28
25 #define PCPP_BSD_AF_INET6_DARWIN 30
26 
31  class NullLoopbackLayer : public Layer
32  {
33  public:
39  NullLoopbackLayer(uint8_t* data, size_t dataLen, Packet* packet)
40  : Layer(data, dataLen, nullptr, packet, NULL_LOOPBACK)
41  {}
42 
47  explicit NullLoopbackLayer(uint32_t family);
48 
52  ~NullLoopbackLayer() override = default;
53 
57  uint32_t getFamily() const;
58 
63  void setFamily(uint32_t family);
64 
65  // implement abstract methods
66 
74  void parseNextLayer() override;
75 
79  size_t getHeaderLen() const override
80  {
81  return sizeof(uint32_t);
82  }
83 
87  void computeCalculateFields() override
88  {}
89 
90  std::string toString() const override;
91 
93  {
94  return OsiModelDataLinkLayer;
95  }
96  };
97 
98 } // namespace pcpp
Definition: Layer.h:69
Definition: NullLoopbackLayer.h:32
uint32_t getFamily() const
void computeCalculateFields() override
Definition: NullLoopbackLayer.h:87
NullLoopbackLayer(uint8_t *data, size_t dataLen, Packet *packet)
Definition: NullLoopbackLayer.h:39
std::string toString() const override
NullLoopbackLayer(uint32_t family)
void setFamily(uint32_t family)
size_t getHeaderLen() const override
Definition: NullLoopbackLayer.h:79
~NullLoopbackLayer() override=default
OsiModelLayer getOsiModelLayer() const override
Definition: NullLoopbackLayer.h:92
void parseNextLayer() override
Definition: Packet.h:27
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelDataLinkLayer
Definition: ProtocolType.h:368
const ProtocolType NULL_LOOPBACK
Definition: ProtocolType.h:153