xref: /haiku/src/add-ons/kernel/network/ppp/shared/libppp/headers/PPPManager.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 /*
2  * Copyright 2003-2005, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _PPP_MANAGER__H
7 #define _PPP_MANAGER__H
8 
9 #include <KPPPManager.h>
10 #include <String.h>
11 
12 
13 class PPPManager {
14 	private:
15 		// copies are not allowed/needed
16 		PPPManager(const PPPManager& copy);
17 		PPPManager& operator= (const PPPManager& copy);
18 
19 	public:
20 		PPPManager();
21 		~PPPManager();
22 
23 		static bool SetDefaultInterface(const BString name);
24 		static BString DefaultInterface();
25 		static bool GetSettingsDirectory(BDirectory *settingsDirectory);
26 
27 		status_t InitCheck() const;
28 
29 		status_t Control(uint32 op, void *data, size_t length) const;
30 		status_t ControlModule(const char *name, uint32 op, void *data,
31 			size_t length) const;
32 
33 		ppp_interface_id CreateInterface(const driver_settings *settings) const;
34 		ppp_interface_id CreateInterfaceWithName(const char *name) const;
35 		bool DeleteInterface(ppp_interface_id ID) const;
36 
37 		ppp_interface_id *Interfaces(int32 *count,
38 			ppp_interface_filter filter = PPP_REGISTERED_INTERFACES) const;
39 				// the user is responsible for deleting the returned array!
40 		int32 GetInterfaces(ppp_interface_id *interfaces, int32 count,
41 			ppp_interface_filter filter = PPP_REGISTERED_INTERFACES) const;
42 				// make sure interfaces has enough space for count items
43 		ppp_interface_id InterfaceWithSettings(const driver_settings *settings) const;
44 		ppp_interface_id InterfaceWithUnit(int32 if_unit) const;
45 		ppp_interface_id InterfaceWithName(const char *name) const;
46 		int32 CountInterfaces(ppp_interface_filter filter =
47 			PPP_REGISTERED_INTERFACES) const;
48 
49 		bool EnableReports(ppp_report_type type, thread_id thread,
50 			int32 flags = PPP_NO_FLAGS) const;
51 		bool DisableReports(ppp_report_type type, thread_id thread) const;
52 
53 	private:
54 		int fFD;
55 };
56 
57 
58 #endif
59