typedef enum { Eth_Probe_Port_A = 0, Eth_Probe_Port_B = 1 } eth_probe_side_t;
typedef void (*ethernet_probe_snoop_t)(lang_void *user_data, conf_object_t *probe, eth_probe_side_t to_side, const frags_t *frame, eth_frame_crc_status_t crc_status);
SIM_INTERFACE(ethernet_probe) { void (*attach_snooper)(conf_object_t *NOTNULL probe, ethernet_probe_snoop_t snoop_fun, lang_void *user_data); void (*attach_probe)(conf_object_t *NOTNULL probe, ethernet_probe_snoop_t snoop_fun, lang_void *user_data); void (*detach)(conf_object_t *NOTNULL probe); void (*send_frame)(conf_object_t *NOTNULL probe, eth_probe_side_t to_side, const frags_t *frame, eth_frame_crc_status_t crc_status); }; #define ETHERNET_PROBE_INTERFACE "ethernet_probe"
This interface is implemented by eth-probe objects. Once a probe has been inserted between a device and an Ethernet link, the functions of this interface can be used to setup callbacks:
This interface should only be used for inspection, and never as part of the actual simulation. The snoop functions must not affect the simulation in any way.
The clock parameter tells the link on which clock to post the events that call the snoop function. The snoop function will be called at the delivery time of the network packet, which means that it will be called at the same time as any Ethernet devices attached to the same clock that receives packets from the same link.
Snooped frames with a matching CRC will contain the correct frame check sequence.
The user_data parameter is passed to the snoop function every time it is called.