INFM HIL Interface
Interface between Artery simulation and DuTs
Public Member Functions | List of all members
sim_interface::dut_connector::v2x::EthernetPacket Class Reference

A single ethernet packet, wrapper to convert between raw bytes from socket and packet from simulation More...

#include <EthernetPacket.h>

Public Member Functions

 EthernetPacket (const std::string &text_archive)
 
 EthernetPacket (std::vector< unsigned char > rawData)
 
std::string getPacketAsArchive ()
 
std::vector< unsigned char > toBytes (unsigned short ethernetFrameType)
 

Detailed Description

A single ethernet packet, wrapper to convert between raw bytes from socket and packet from simulation

Constructor & Destructor Documentation

◆ EthernetPacket() [1/2]

sim_interface::dut_connector::v2x::EthernetPacket::EthernetPacket ( const std::string &  text_archive)
explicit

Create an ethernet packet with already parsed data from map with required keys sourceMAC, destinationMAC, payload

Parameters
text_archiveboost::archive string containing sourceMAC, destinationMAC, length of payload and payload

◆ EthernetPacket() [2/2]

sim_interface::dut_connector::v2x::EthernetPacket::EthernetPacket ( std::vector< unsigned char >  rawData)
explicit

Create an ethernet packet from the raw received data (extract source and destination MAC)

Parameters
rawDataraw received data

Member Function Documentation

◆ getPacketAsArchive()

std::string sim_interface::dut_connector::v2x::EthernetPacket::getPacketAsArchive ( )

Encode bytes of payload as text archive (byte for byte)

Returns
text archive of payload

◆ toBytes()

std::vector< unsigned char > sim_interface::dut_connector::v2x::EthernetPacket::toBytes ( unsigned short  ethernetFrameType)

Convert object to byte vector of the following structure: Byte 0-5: source MAC address Byte 6-11: destination MAC address Byte 12+13: Ethernet Frame Type Rest: Payload

Parameters
ethernetFrameTypetwo bytes to set the ethernet frame type with
Returns
vector of bytes

The documentation for this class was generated from the following files: