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 _K_PPP_MANAGER__H 9 #define _K_PPP_MANAGER__H 10 11 #include "net_module.h" 12 #include <PPPControl.h> 13 #include <PPPReportDefs.h> 14 15 16 #define PPP_INTERFACE_MODULE_NAME NETWORK_MODULES_ROOT "interfaces/ppp" 17 18 #define PPP_UNDEFINED_INTERFACE_ID 0 19 // CreateInterface() returns this value on failure 20 21 22 class KPPPInterface; 23 typedef struct ppp_interface_entry { 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 */ 36 typedef struct ppp_interface_module_info { 37 kernel_net_module_info knminfo; 38 //!< Exports needed network module functions. 39 40 ppp_interface_id (*CreateInterface)(const driver_settings *settings, 41 const driver_settings *profile = NULL, 42 ppp_interface_id parentID = PPP_UNDEFINED_INTERFACE_ID); 43 ppp_interface_id (*CreateInterfaceWithName)(const char *name, 44 const driver_settings *profile = NULL, 45 ppp_interface_id parentID = PPP_UNDEFINED_INTERFACE_ID); 46 bool (*DeleteInterface)(ppp_interface_id ID); 47 // this marks the interface for deletion 48 bool (*RemoveInterface)(ppp_interface_id ID); 49 // remove the interface from database (make sure you can delete it yourself!) 50 51 ifnet *(*RegisterInterface)(ppp_interface_id ID); 52 bool (*UnregisterInterface)(ppp_interface_id ID); 53 54 status_t (*ControlInterface)(ppp_interface_id ID, uint32 op, void *data, 55 size_t length); 56 57 int32 (*GetInterfaces)(ppp_interface_id *interfaces, int32 count, 58 ppp_interface_filter filter = PPP_REGISTERED_INTERFACES); 59 // make sure interfaces has enough space for count items 60 int32 (*CountInterfaces)(ppp_interface_filter filter = PPP_REGISTERED_INTERFACES); 61 62 void (*EnableReports)(ppp_report_type type, thread_id thread, 63 int32 flags = PPP_NO_FLAGS); 64 void (*DisableReports)(ppp_report_type type, thread_id thread); 65 bool (*DoesReport)(ppp_report_type type, thread_id thread); 66 } ppp_interface_module_info; 67 68 69 #endif 70