Prepared net_device_monitor to accept device removal events.

- Introduced public net_device_monitor.
 - Changed the link protocol to maintain a lock per instance instead of inside the FIFO. Now all of the link instance data is protected.
 - Adapted the link protocol to use net_device_monitor.
 - Introduced a private Fifo class which doesn't maintain it's own lock.
  - Maybe we should add something like a public net_protocol_implementation which maintains a fifo and a benaphore? With the fifo using the structure's lock instead of maintaining it's own.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20614 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-04-08 09:15:52 +00:00
parent ee18793052
commit e53357d57a
7 changed files with 421 additions and 228 deletions
+17 -2
View File
@@ -37,6 +37,21 @@ struct net_timer {
typedef int32 (*net_deframe_func)(struct net_device *device, struct net_buffer *buffer);
typedef status_t (*net_receive_func)(void *cookie, struct net_buffer *buffer);
enum {
B_DEVICE_GOING_UP = 1,
B_DEVICE_GOING_DOWN,
B_DEVICE_BEING_REMOVED,
};
struct net_device_monitor {
struct list_link link;
void *cookie;
status_t (*receive)(struct net_device_monitor *monitor,
struct net_buffer *buffer);
void (*event)(struct net_device_monitor *monitor, int32 event);
};
struct net_stack_module_info {
module_info info;
@@ -68,9 +83,9 @@ struct net_stack_module_info {
status_t (*unregister_device_handler)(struct net_device *device, int32 type);
status_t (*register_device_monitor)(struct net_device *device,
net_receive_func receiveFunc, void *cookie);
struct net_device_monitor *monitor);
status_t (*unregister_device_monitor)(struct net_device *device,
net_receive_func receiveFunc, void *cookie);
struct net_device_monitor *monitor);
status_t (*device_link_changed)(struct net_device *device);
status_t (*device_removed)(struct net_device *device);