SIM_INTERFACE(ethernet_common) { void (*frame)(conf_object_t *NOTNULL obj, const frags_t *frame, eth_frame_crc_status_t crc_status); }; #define ETHERNET_COMMON_INTERFACE "ethernet_common"
This interface is implemented by objects that receive Ethernet frames, both Ethernet devices and Ethernet link endpoints.
There is a single function frame which sends an Ethernet frame, without preamble nor SFD (Start Frame Delimiter), but with a CRC field.
The crc_status parameter provides out-of-band information on
the contents of the frame with regards to the CRC field using one of the
values in the eth_frame_crc_status_t
enum:
Eth_Frame_CRC_Match
means that the frame contents are
correct. The CRC field in the frame should not be relied upon as its
computation may have been skipped for optimization, and it may contain any
value, including zero, a random value or a correctly computed CRC.Eth_Frame_CRC_Mismatch
means that the frame contents are
incorrect. The CRC field in the frame must contain a CRC that does not
match the frame contents, i.e., to send an incorrect frame on the link,
you must make sure that the CRC field will not match when computed.Eth_Frame_CRC_Unknown
means that the relation between the
frame contents and the CRC field is unknown. The relation can be
established by computing the frame's CRC and comparing it to the frame's
CRC field.typedef enum { Eth_Frame_CRC_Match, Eth_Frame_CRC_Mismatch, Eth_Frame_CRC_Unknown } eth_frame_crc_status_t;
When a device calls a link's frame function, it can set
crc_status to any of the three values. If the link receives a
Eth_Frame_CRC_Unknown
, it will compute the CRC itself to set the
status to Eth_Frame_CRC_Match
or Eth_Frame_CRC_Mismatch
.
When a link calls a device's frame
function, crc_status will be set
to either Eth_Frame_CRC_Match
or Eth_Frame_CRC_Mismatch
,
and never Eth_Frame_CRC_Unknown
.
When two devices are directly connected to each others without using a link,
the interpretation of Eth_Frame_CRC_Unknown
is up to the devices'
implementation.
frame | Cell Context |