1/*
2 * Copyright 2003-2005, Haiku Inc.
3 * Distributed under the terms of the MIT License.
4 */
5
6#ifndef _K_PPP_MANAGER__H
7#define _K_PPP_MANAGER__H
8
9#include <module.h>
10#include <net_device.h>
11#include <PPPControl.h>
12#include <PPPReportDefs.h>
13
14#define PPP_INTERFACE_MODULE_NAME	NETWORK_MODULES_ROOT	"/ppp/ppp_manager/v1"
15
16#define PPP_UNDEFINED_INTERFACE_ID	0
17	// CreateInterface() returns this value on failure
18
19
20class KPPPInterface;
21//!	Private structure shared by PPP manager and KPPPInterface.
22typedef struct ppp_interface_entry {
23	char *name;
24	KPPPInterface *interface;
25	vint32 accessing;
26	bool deleting;
27} ppp_interface_entry;
28
29
30/*!	\brief Exported by the PPP interface manager kernel module.
31
32	You should always create interfaces using either of the CreateInterface()
33	functions. The manager keeps track of all running connections and automatically
34	deletes them when they are not needed anymore.
35*/
36typedef struct ppp_interface_module_info {
37        struct module_info info;
38
39	ppp_interface_id (*CreateInterface)(const driver_settings *settings,
40		ppp_interface_id parentID);
41	ppp_interface_id (*CreateInterfaceWithName)(const char *name,
42		ppp_interface_id parentID);
43	bool (*DeleteInterface)(ppp_interface_id ID);
44		// this marks the interface for deletion
45	bool (*RemoveInterface)(ppp_interface_id ID);
46		// remove the interface from database (make sure you can delete it yourself!)
47
48	net_device *(*RegisterInterface)(ppp_interface_id ID);
49	KPPPInterface *(*GetInterface)(ppp_interface_id ID);
50		// for accessing KPPPInterface directly
51	bool (*UnregisterInterface)(ppp_interface_id ID);
52
53	status_t (*ControlInterface)(ppp_interface_id ID, uint32 op, void *data,
54		size_t length);
55
56	int32 (*GetInterfaces)(ppp_interface_id *interfaces, int32 count,
57		ppp_interface_filter filter);
58			// make sure interfaces has enough space for count items
59	int32 (*CountInterfaces)(ppp_interface_filter filter);
60
61	void (*EnableReports)(ppp_report_type type, thread_id thread,
62		int32 flags);
63	void (*DisableReports)(ppp_report_type type, thread_id thread);
64	bool (*DoesReport)(ppp_report_type type, thread_id thread);
65} ppp_interface_module_info;
66
67
68#endif
69