2 * Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef NET_DATALINK_PROTOCOL_H
6 #define NET_DATALINK_PROTOCOL_H
9 #include <net_buffer.h>
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 struct net_domain
* domain
;
17 } net_datalink_protocol
;
19 struct net_datalink_protocol_module_info
{
22 status_t (*init_protocol
)(net_interface
* interface
, net_domain
* domain
,
23 net_datalink_protocol
** _protocol
);
24 status_t (*uninit_protocol
)(net_datalink_protocol
* self
);
26 status_t (*send_data
)(net_datalink_protocol
* self
, net_buffer
* buffer
);
28 status_t (*interface_up
)(net_datalink_protocol
* self
);
29 void (*interface_down
)(net_datalink_protocol
* self
);
31 status_t (*change_address
)(net_datalink_protocol
* self
,
32 net_interface_address
* address
, int32 option
,
33 const struct sockaddr
* oldAddress
,
34 const struct sockaddr
* newAddress
);
36 status_t (*control
)(net_datalink_protocol
* self
, int32 option
,
37 void* argument
, size_t length
);
39 status_t (*join_multicast
)(net_datalink_protocol
* self
,
40 const struct sockaddr
* address
);
41 status_t (*leave_multicast
)(net_datalink_protocol
* self
,
42 const struct sockaddr
* address
);
46 #endif // NET_DATALINK_PROTOCOL_H