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