xref: /haiku/headers/private/net/net_notifications.h (revision 893988af824e65e49e55f517b157db8386e8002b)
1 /*
2  * Copyright 2008, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef NET_NOTIFICATIONS_H
6 #define NET_NOTIFICATIONS_H
7 
8 
9 #include <module.h>
10 
11 
12 #define NET_NOTIFICATIONS_MODULE_NAME "network/notifications/v1"
13 
14 namespace BPrivate {
15 	class KMessage;
16 };
17 
18 struct net_notifications_module_info {
19 	module_info info;
20 
21 	status_t (*send_notification)(const BPrivate::KMessage* event);
22 };
23 
24 // generic syscall interface
25 #define NET_NOTIFICATIONS_SYSCALLS "network/notifications"
26 
27 #define NET_NOTIFICATIONS_CONTROL_WATCHING	1
28 
29 struct net_notifications_control {
30 	uint32		flags;
31 	port_id		port;
32 	uint32		token;
33 };
34 
35 // TODO: the following part of this header should end up in a public header
36 // some day!
37 
38 #define B_NETWORK_INTERFACE_ADDED		0x01
39 #define B_NETWORK_INTERFACE_REMOVED		0x02
40 #define B_NETWORK_INTERFACE_CHANGED		0x03
41 #define B_NETWORK_DEVICE_LINK_CHANGED	0x10
42 // TODO: add routes, stack unloaded/loaded, ... events
43 
44 enum {
45 	B_WATCH_NETWORK_INTERFACE_CHANGES	= 0x000f,
46 	B_WATCH_NETWORK_LINK_CHANGES	 	= 0x00f0
47 };
48 
49 #define B_NETWORK_MONITOR				'_NTN'
50 
51 #ifndef _KERNEL_MODE
52 #	include <Messenger.h>
53 
54 status_t	start_watching_network(uint32 flags, const BMessenger& target);
55 status_t	start_watching_network(uint32 flags, const BHandler* handler,
56 				const BLooper* looper = NULL);
57 
58 status_t	stop_watching_network(const BMessenger& target);
59 status_t	stop_watching_network(const BHandler* handler,
60 				const BLooper* looper = NULL);
61 
62 #endif	// _KERNEL_MODE
63 
64 #endif	// NET_NOTIFICATIONS_H
65