INFM HIL Interface
Interface between Artery simulation and DuTs
EthernetPacket.h
1
28#ifndef SIM_TO_DUT_INTERFACE_ETHERNETPACKET_H
29#define SIM_TO_DUT_INTERFACE_ETHERNETPACKET_H
30
31#include <string>
32#include <utility>
33#include <vector>
34#include <linux/if_ether.h>
35#include <map>
36#include <boost/variant.hpp>
37
45 public:
51 explicit EthernetPacket(const std::string &text_archive);
52
58 explicit EthernetPacket(std::vector<unsigned char> rawData);
59
65 std::string getPacketAsArchive();
66
77 std::vector<unsigned char> toBytes(unsigned short ethernetFrameType);
78
79 private:
83 std::string sourceMAC;
84
88 std::string destinationMAC;
89
93 std::vector<unsigned char> payload;
94
100 void extractEthernetHeader(std::vector<unsigned char> rawData);
101
108 static std::string getHexEncodedMAC(unsigned char bytes[]);
109
116 static std::vector<unsigned char> getBytesOfHexEncodedMAC(std::string hex);
117 };
118}
119
120
121#endif //SIM_TO_DUT_INTERFACE_ETHERNETPACKET_H
A single ethernet packet, wrapper to convert between raw bytes from socket and packet from simulation
Definition: EthernetPacket.h:44
std::vector< unsigned char > toBytes(unsigned short ethernetFrameType)
Definition: EthernetPacket.cpp:73
EthernetPacket(const std::string &text_archive)
Definition: EthernetPacket.cpp:34
std::string getPacketAsArchive()
Definition: EthernetPacket.cpp:60
Definition: EthernetPacket.cpp:33