xref: /haiku/headers/private/net/net_datalink_protocol.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2006-2010, 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 	struct net_domain*							domain;
17 } net_datalink_protocol;
18 
19 struct net_datalink_protocol_module_info {
20 	module_info info;
21 
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);
25 
26 	status_t	(*send_data)(net_datalink_protocol* self, 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	(*change_address)(net_datalink_protocol* self,
32 					net_interface_address* address, int32 option,
33 					const struct sockaddr* oldAddress,
34 					const struct sockaddr* newAddress);
35 
36 	status_t	(*control)(net_datalink_protocol* self, int32 option,
37 					void* argument, size_t length);
38 
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);
43 };
44 
45 
46 #endif	// NET_DATALINK_PROTOCOL_H
47