PcapPlusPlus  19.12
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 
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 
pcpp::OsiModelLayer
OsiModelLayer
Definition: ProtocolType.h:224
pcpp::Packet
Definition: Packet.h:26
pcpp::SllLayer::setLinkLayerAddr
bool setLinkLayerAddr(uint8_t *addr, size_t addrLength)
pcpp::OsiModelDataLinkLayer
Definition: ProtocolType.h:229
Layer.h
pcpp::sll_header::packet_type
uint16_t packet_type
Definition: SllLayer.h:27
pcpp::SllLayer::computeCalculateFields
void computeCalculateFields()
MacAddress.h
pcpp::SllLayer
Definition: SllLayer.h:45
pcpp::SllLayer::getSllHeader
sll_header * getSllHeader() const
Definition: SllLayer.h:69
pcpp::SllLayer::setMacAddressAsLinkLayer
bool setMacAddressAsLinkLayer(MacAddress macAddr)
pcpp::MacAddress
Definition: MacAddress.h:27
pcpp::SllLayer::SllLayer
SllLayer(uint8_t *data, size_t dataLen, Packet *packet)
Definition: SllLayer.h:54
pcpp::SllLayer::getOsiModelLayer
OsiModelLayer getOsiModelLayer() const
Definition: SllLayer.h:105
pcpp::SLL
Definition: ProtocolType.h:136
pcpp::sll_header::link_layer_addr
uint8_t link_layer_addr[8]
Definition: SllLayer.h:35
pcpp::sll_header
Definition: SllLayer.h:21
pcpp
The main namespace for the PcapPlusPlus lib.
pcpp::SllLayer::getHeaderLen
size_t getHeaderLen() const
Definition: SllLayer.h:96
pcpp::SllLayer::parseNextLayer
void parseNextLayer()
pcpp::Layer
Definition: Layer.h:70
pcpp::sll_header::ARPHRD_type
uint16_t ARPHRD_type
Definition: SllLayer.h:29
pcpp::SllLayer::toString
std::string toString() const
pcpp::sll_header::protocol_type
uint16_t protocol_type
Definition: SllLayer.h:37
pcpp::sll_header::link_layer_addr_len
uint16_t link_layer_addr_len
Definition: SllLayer.h:31