PcapPlusPlus  Next
LLCLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Layer.h"
4 
6 
11 namespace pcpp
12 {
13 #pragma pack(push, 1)
18  struct llc_header
19  {
21  uint8_t dsap,
26  };
27 #pragma pack(pop)
28 
33  class LLCLayer : public Layer
34  {
35  public:
43  LLCLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
44  : Layer(data, dataLen, prevLayer, packet, LLC)
45  {}
46 
53  LLCLayer(uint8_t dsap, uint8_t ssap, uint8_t control);
54 
59  inline llc_header* getLlcHeader() const
60  {
61  return reinterpret_cast<llc_header*>(m_Data);
62  };
63 
64  // overridden methods
65 
67  void parseNextLayer() override;
68 
70  void computeCalculateFields() override
71  {}
72 
76  size_t getHeaderLen() const override
77  {
78  return sizeof(llc_header);
79  }
80 
84  std::string toString() const override;
85 
90  {
91  return OsiModelDataLinkLayer;
92  }
93 
100  static bool isDataValid(const uint8_t* data, size_t dataLen);
101  };
102 
103 } // namespace pcpp
Definition: LLCLayer.h:34
OsiModelLayer getOsiModelLayer() const override
Definition: LLCLayer.h:89
void parseNextLayer() override
Parses the next layer. Currently only STP supported as next layer.
size_t getHeaderLen() const override
Definition: LLCLayer.h:76
void computeCalculateFields() override
Does nothing for this layer.
Definition: LLCLayer.h:70
LLCLayer(uint8_t dsap, uint8_t ssap, uint8_t control)
LLCLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: LLCLayer.h:43
llc_header * getLlcHeader() const
Definition: LLCLayer.h:59
static bool isDataValid(const uint8_t *data, size_t dataLen)
std::string toString() const override
Definition: Layer.h:69
Definition: Packet.h:27
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelDataLinkLayer
Definition: ProtocolType.h:368
const ProtocolType LLC
Definition: ProtocolType.h:288
Definition: LLCLayer.h:19
uint8_t dsap
Destination Service Access Point.
Definition: LLCLayer.h:21
uint8_t control
Control Field.
Definition: LLCLayer.h:25
uint8_t ssap
Source Service Access Point.
Definition: LLCLayer.h:23