1 /* 2 * Copyright 2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef NET_DATALINK_PROTOCOL_H 6 #define NET_DATALINK_PROTOCOL_H 7 8 9 #include <net_buffer.h> 10 11 12 typedef struct net_datalink_protocol { 13 struct net_datalink_protocol *next; 14 struct net_datalink_protocol_module_info *module; 15 struct net_interface *interface; 16 } net_datalink_protocol; 17 18 struct net_datalink_protocol_module_info { 19 module_info info; 20 21 status_t (*init_protocol)(struct net_interface *interface, 22 net_datalink_protocol **_protocol); 23 status_t (*uninit_protocol)(net_datalink_protocol *self); 24 25 status_t (*send_data)(net_datalink_protocol *self, 26 net_buffer *buffer); 27 28 status_t (*interface_up)(net_datalink_protocol *self); 29 void (*interface_down)(net_datalink_protocol *self); 30 31 status_t (*control)(net_datalink_protocol *self, 32 int32 op, void *argument, size_t length); 33 34 status_t (*join_multicast)(net_datalink_protocol *self, 35 const sockaddr *address); 36 status_t (*leave_multicast)(net_datalink_protocol *self, 37 const sockaddr *address); 38 }; 39 40 #endif // NET_DATALINK_PROTOCOL_H 41