PcapPlusPlus  21.11
SllLayer.h
Go to the documentation of this file.
1 #ifndef PACKETPP_SLL_LAYER
2 #define PACKETPP_SLL_LAYER
3 
4 #include "MacAddress.h"
5 #include "Layer.h"
6 
8 
13 namespace pcpp
14 {
15 
20 #pragma pack(push, 1)
21  struct sll_header
22  {
27  uint16_t packet_type;
29  uint16_t ARPHRD_type;
35  uint8_t link_layer_addr[8];
37  uint16_t protocol_type;
38  };
39 #pragma pack(pop)
40 
45  class SllLayer : public Layer
46  {
47  public:
54  SllLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, NULL, packet) { m_Protocol = SLL; }
55 
61  SllLayer(uint16_t packetType, uint16_t ARPHRDType);
62 
63  ~SllLayer() {}
64 
69  sll_header* getSllHeader() const { return (sll_header*)m_Data; }
70 
77  bool setLinkLayerAddr(uint8_t* addr, size_t addrLength);
78 
84  bool setMacAddressAsLinkLayer(MacAddress macAddr);
85 
91  void parseNextLayer();
92 
96  size_t getHeaderLen() const { return sizeof(sll_header); }
97 
101  void computeCalculateFields();
102 
103  std::string toString() const;
104 
106  };
107 
108 } // namespace pcpp
109 
110 #endif /* PACKETPP_SLL_LAYER */
111 
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:258
size_t getHeaderLen() const
Definition: SllLayer.h:96
Definition: ProtocolType.h:263
Definition: Layer.h:70
Definition: Packet.h:26
uint16_t ARPHRD_type
Definition: SllLayer.h:29
const ProtocolType SLL
Definition: ProtocolType.h:138
OsiModelLayer getOsiModelLayer() const
Definition: SllLayer.h:105
uint16_t link_layer_addr_len
Definition: SllLayer.h:31
SllLayer(uint8_t *data, size_t dataLen, Packet *packet)
Definition: SllLayer.h:54
uint16_t protocol_type
Definition: SllLayer.h:37
Definition: SllLayer.h:45
uint8_t link_layer_addr[8]
Definition: SllLayer.h:35
uint16_t packet_type
Definition: SllLayer.h:27
Definition: SllLayer.h:21
sll_header * getSllHeader() const
Definition: SllLayer.h:69
Definition: MacAddress.h:28