xref: /haiku/src/add-ons/kernel/network/ppp/shared/libppp/headers/PPPInterface.h (revision 67bce78b48ed6d01b5a8eef89f5694c372b7e0a1)
1 //-----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //
5 //  Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
6 //-----------------------------------------------------------------------
7 
8 #ifndef _PPP_INTERFACE__H
9 #define _PPP_INTERFACE__H
10 
11 #include <KPPPManager.h>
12 
13 class BEntry;
14 
15 
16 class PPPInterface {
17 	public:
18 		PPPInterface(ppp_interface_id ID = PPP_UNDEFINED_INTERFACE_ID);
19 		PPPInterface(const PPPInterface& copy);
20 		~PPPInterface();
21 
22 		status_t InitCheck() const;
23 
24 		//!	Returns the name of the interface description file.
25 		const char *Name() const
26 			{ return fInfo.info.name; }
27 
28 		status_t SetTo(ppp_interface_id ID);
29 		//!	Returns the unique id of this interface.
30 		ppp_interface_id ID() const
31 			{ return fID; }
32 
33 		status_t Control(uint32 op, void *data, size_t length) const;
34 
35 		status_t GetSettingsEntry(BEntry *entry) const;
36 		bool GetInterfaceInfo(ppp_interface_info_t *info) const;
37 		bool HasSettings(const driver_settings *settings) const;
38 
39 		void SetProfile(const driver_settings *profile) const;
40 
41 		bool Up() const;
42 		bool Down() const;
43 
44 		bool EnableReports(ppp_report_type type, thread_id thread,
45 			int32 flags = PPP_NO_FLAGS) const;
46 		bool DisableReports(ppp_report_type type, thread_id thread) const;
47 
48 		//!	Same as \c SetTo(copy.ID());
49 		PPPInterface& operator= (const PPPInterface& copy)
50 			{ SetTo(copy.ID()); return *this; }
51 		//!	Same as \c SetTo(ID);
52 		PPPInterface& operator= (ppp_interface_id ID)
53 			{ SetTo(ID); return *this; }
54 
55 	private:
56 		ppp_interface_id fID;
57 
58 		int fFD;
59 		ppp_interface_info_t fInfo;
60 };
61 
62 
63 #endif
64