haiku/headers/private/net/net_notifications.h
Axel Dörfler d68ffdedc0 * More or less completed the network notification module - it does not remove
old invalid user listeners yet, though (ie. if a team dies).
* Implemented userland network monitor functions.
* Added a few notifications to the network stack, even though this part isn't
  complete yet (especially notify_interface_changed()).
* Added optional debug output to the notifications module.
* Added the module to the image, it basically works now (tested).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-27 20:48:28 +00:00

65 lines
1.5 KiB
C++

/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef NET_NOTIFICATIONS_H
#define NET_NOTIFICATIONS_H
#include <module.h>
#define NET_NOTIFICATIONS_MODULE_NAME "network/notifications/v1"
namespace BPrivate {
class KMessage;
};
struct net_notifications_module_info {
module_info info;
status_t (*send_notification)(const BPrivate::KMessage* event);
};
// generic syscall interface
#define NET_NOTIFICATIONS_SYSCALLS "network/notifications"
#define NET_NOTIFICATIONS_CONTROL_WATCHING 1
struct net_notifications_control {
uint32 flags;
port_id port;
uint32 token;
};
// TODO: the following part of this header should end up in a public header
// some day!
#define B_NETWORK_INTERFACE_ADDED 0x01
#define B_NETWORK_INTERFACE_REMOVED 0x02
#define B_NETWORK_INTERFACE_CHANGED 0x03
#define B_NETWORK_DEVICE_LINK_CHANGED 0x10
// TODO: add routes, stack unloaded/loaded, ... events
enum {
B_WATCH_NETWORK_INTERFACE_CHANGES = 0x000f,
B_WATCH_NETWORK_LINK_CHANGES = 0x00f0
};
#define B_NETWORK_MONITOR '_NTN'
#ifndef _KERNEL_MODE
# include <Messenger.h>
status_t start_watching_network(uint32 flags, const BMessenger& target);
status_t start_watching_network(uint32 flags, const BHandler* handler,
const BLooper* looper = NULL);
status_t stop_watching_network(const BMessenger& target);
status_t stop_watching_network(const BHandler* handler,
const BLooper* looper = NULL);
#endif // _KERNEL_MODE
#endif // NET_NOTIFICATIONS_H