* libppp: [PPPManager]: Added ControlModule() method.

* PPPoE: fixed GET_INTERFACES ioctl()
* PPP interface: fixed path generation for controlling PPP modules (a '/' was missing).
And some minor changes I do not remember anymore.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7119 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald
2004-03-30 10:58:54 +00:00
parent 8a8389eed0
commit 53a2aa40d5
8 changed files with 35 additions and 16 deletions
@@ -419,12 +419,11 @@ PPPManager::Control(uint32 op, void *data, size_t length)
return B_ERROR; return B_ERROR;
char name[B_PATH_NAME_LENGTH]; char name[B_PATH_NAME_LENGTH];
strcpy(name, PPP_MODULES_PATH); sprintf(name, "%s/%s", PPP_MODULES_PATH, args->name);
strcat(name, args->name);
ppp_module_info *module; ppp_module_info *module;
if(get_module(name, (module_info**) &module) != B_OK if(get_module(name, (module_info**) &module) != B_OK
|| !module->control) || !module->control)
return B_ERROR; return B_NAME_NOT_FOUND;
return module->control(args->op, args->data, args->length); return module->control(args->op, args->data, args->length);
} break; } break;
+1 -1
View File
@@ -1,3 +1,3 @@
- add CHAP - add CHAP
- add ISDN (CAPI) - add ISDN (CAPI)
- add PPP over TCP/IP (this is a virtual device that uses TCP/IP to connect to some other PPP server on the net) - add PPTP (this is a virtual device that uses TCP/IP to connect to some other PPP server on the net)
+1 -1
View File
@@ -37,7 +37,7 @@ extern struct core_module_info *core;
#if DEBUG #if DEBUG
// defined in ModemDevice.cpp // defined in ModemDevice.cpp
void dump_packet(struct mbuf *packet); extern void dump_packet(struct mbuf *packet);
#endif // DEBUG #endif // DEBUG
+6 -6
View File
@@ -29,7 +29,7 @@ class PPPoEDevice;
#define PPPoE_VERSION 0x1 #define PPPoE_VERSION 0x1
#define PPPoE_TYPE 0x1 #define PPPoE_TYPE 0x1
#define PPPoE_INTERFACE_KEY "interface" #define PPPoE_INTERFACE_KEY "Interface"
#define PPPoE_AC_NAME_KEY "ACName" #define PPPoE_AC_NAME_KEY "ACName"
#define PPPoE_SERVICE_NAME_KEY "ServiceName" #define PPPoE_SERVICE_NAME_KEY "ServiceName"
@@ -62,14 +62,14 @@ typedef struct complete_pppoe_header {
// defined in pppoe.cpp // defined in pppoe.cpp
ifnet *FindPPPoEInterface(const char *name); extern ifnet *FindPPPoEInterface(const char *name);
uint32 NewHostUniq(); extern uint32 NewHostUniq();
void add_device(PPPoEDevice *device); extern void add_device(PPPoEDevice *device);
void remove_device(PPPoEDevice *device); extern void remove_device(PPPoEDevice *device);
#if DEBUG #if DEBUG
// defined in PPPoEDevice.cpp // defined in PPPoEDevice.cpp
void dump_packet(struct mbuf *packet); extern void dump_packet(struct mbuf *packet);
#endif // DEBUG #endif // DEBUG
+2 -1
View File
@@ -1,2 +1,3 @@
- add support for server mode - add support for server mode
- add service-query support (for userland preflet) - test service-query feature
- test if AC and Service settings specifications are handled correctly
@@ -243,12 +243,13 @@ control(uint32 op, void *data, size_t length)
ifnet *current = get_interfaces(); ifnet *current = get_interfaces();
for(; current; current = current->if_next) { for(; current; current = current->if_next) {
if(current->if_type == IFT_ETHER && current->name) { if(current->if_type == IFT_ETHER && current->if_name) {
if(position + strlen(current->name) + 1 > length) if(position + strlen(current->if_name) + 1 > length)
return B_NO_MEMORY; return B_NO_MEMORY;
strcpy(names + position, current->name); strcpy(names + position, current->if_name);
position += strlen(current->name) + 1; position += strlen(current->if_name);
names[position++] = 0;
++count; ++count;
} }
} }
@@ -55,6 +55,22 @@ PPPManager::Control(uint32 op, void *data, size_t length) const
} }
status_t
PPPManager::ControlModule(const char *name, uint32 op, void *data,
size_t length) const
{
if(!name)
return B_ERROR;
control_net_module_args args;
args.name = name;
args.op = op;
args.data = data;
args.length = length;
return Control(PPPC_CONTROL_MODULE, &args, sizeof(args));
}
ppp_interface_id ppp_interface_id
PPPManager::CreateInterface(const driver_settings *settings, PPPManager::CreateInterface(const driver_settings *settings,
const driver_settings *profile = NULL) const const driver_settings *profile = NULL) const
@@ -24,6 +24,8 @@ class PPPManager {
status_t InitCheck() const; status_t InitCheck() const;
status_t Control(uint32 op, void *data, size_t length) const; status_t Control(uint32 op, void *data, size_t length) const;
status_t ControlModule(const char *name, uint32 op, void *data,
size_t length) const;
ppp_interface_id CreateInterface(const driver_settings *settings, ppp_interface_id CreateInterface(const driver_settings *settings,
const driver_settings *profile = NULL) const; const driver_settings *profile = NULL) const;