1 /* 2 * Copyright 2003-2005, Haiku Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _PPP_INTERFACE__H 7 #define _PPP_INTERFACE__H 8 9 #include <KPPPManager.h> 10 #include <String.h> 11 12 class BEntry; 13 14 15 class PPPInterface { 16 public: 17 PPPInterface(ppp_interface_id ID = PPP_UNDEFINED_INTERFACE_ID); 18 PPPInterface(const PPPInterface& copy); 19 ~PPPInterface(); 20 21 status_t InitCheck() const; 22 23 //! Returns the name of the interface description file. 24 const char *Name() const 25 { return fName.String(); } 26 27 status_t SetTo(ppp_interface_id ID); 28 //! Returns the unique id of this interface. 29 ppp_interface_id ID() const 30 { return fID; } 31 32 status_t Control(uint32 op, void *data, size_t length) const; 33 34 bool SetUsername(const char *username) const; 35 bool SetPassword(const char *password) const; 36 bool SetAskBeforeConnecting(bool askBeforeConnecting) const; 37 38 status_t GetSettingsEntry(BEntry *entry) const; 39 bool GetInterfaceInfo(ppp_interface_info_t *info) const; 40 bool GetStatistics(ppp_statistics *statistics) const; 41 bool HasSettings(const driver_settings *settings) const; 42 43 bool ControlDevice(ppp_device_info_t *info) const; 44 bool ControlProtocol(ppp_protocol_info_t *info, uint32 protocolindex, uint32 procotolOP) const; 45 bool ControlOptionHandler(ppp_simple_handler_info_t *info, uint32 handlerindex, uint32 handlerOP) const; 46 bool ControlLCPExtension(ppp_simple_handler_info_t *info, uint32 LCPExtensionindex, uint32 LCPExtensionOP) const; 47 bool ControlChild(void *info, uint32 childindex, uint32 childOP) const; 48 49 bool Up() const; 50 bool Down() const; 51 52 bool EnableReports(ppp_report_type type, thread_id thread, 53 int32 flags = PPP_NO_FLAGS) const; 54 bool DisableReports(ppp_report_type type, thread_id thread) const; 55 56 //! Same as \c SetTo(copy.ID()); 57 PPPInterface& operator= (const PPPInterface& copy) 58 { SetTo(copy.ID()); return *this; } 59 //! Same as \c SetTo(ID); 60 PPPInterface& operator= (ppp_interface_id ID) 61 { SetTo(ID); return *this; } 62 63 private: 64 ppp_interface_id fID; 65 int fFD; 66 BString fName; 67 }; 68 69 70 #endif 71