typedef void (*ethernet_link_snoop_t)(lang_void *user_data, conf_object_t *clock, const frags_t *packet, eth_frame_crc_status_t crc_status);
SIM_INTERFACE(ethernet_snoop) { conf_object_t *(*attach)(conf_object_t *NOTNULL link, conf_object_t *clock, ethernet_link_snoop_t snoop_fun, lang_void *user_data); }; #define ETHERNET_SNOOP_INTERFACE "ethernet_snoop"
This interface is implemented by Ethernet link objects. It is used to attach snoop functions to the link. The snoop function will receive all traffic going over the link.
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.
attach | Global Context |