typedef struct { void (*receive_frame)(conf_object_t *dev, conf_object_t *link, dbuffer_t *frame); phy_speed_t (*auto_neg_request)(conf_object_t *dev, phy_speed_t speed); void (*auto_neg_reply)(conf_object_t *dev, phy_speed_t speed); } ethernet_device_interface_t; #define ETHERNET_DEVICE_INTERFACE "ethernet_device"
This interface is implemented by Ethernet device objects that connect to ethernet-link objects. It is used by the link object to send messages to the device object.
The receive_frame function is called when a frame has been sent by another device on the link. The frame is passed as a dbuffer_t pointer that may not be modified without cloning it first.
The frame may be addressed to another device, which means that the device must be prepared to drop frames addressed to other devices, even if it has registered a MAC address. Also, the frame must not assume that it will receive all frames on the link if it has registered a MAC address, unless it tells the link it is running in promiscuous mode.
The auto_neg_request might be called when another device has requested auto-negotiation. The speed parameter contains the connection speeds that the other device supports. The return value should result of clearing the bits in speed that the device doesn't support.
The auto_neg_reply is called to return the result of a previous call to auto_negotiate in the ethernet_link interface.