Moved the starting of the network stack into the driver (from the socket module)

to allow other protocols (like TCP) using the socket module.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19399 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-11-30 17:56:17 +00:00
parent 5131b5bcf6
commit 41c6726359
2 changed files with 17 additions and 4 deletions

View File

@ -20,6 +20,8 @@
#include <string.h>
#define NET_STARTER_MODULE_NAME "network/stack/starter/v1"
// debugging macros
#define LOGID "net_stack_driver: "
#define ERROR(format, args...) dprintf(LOGID "ERROR: " format, ## args)
@ -161,9 +163,17 @@ net_stack_open(const char *name, uint32 flags, void **_cookie)
if (atomic_add(&sOpenCount, 1) == 0) {
// When we're opened for the first time, we'll try to load the
// networking stack
status_t status = get_module(NET_SOCKET_MODULE_NAME, (module_info **)&sSocket);
module_info *module;
status_t status = get_module(NET_STARTER_MODULE_NAME, &module);
if (status < B_OK) {
ERROR("Can't load network stack module: %ld\n", status);
return status;
}
status = get_module(NET_SOCKET_MODULE_NAME, (module_info **)&sSocket);
if (status < B_OK) {
ERROR("Can't load " NET_SOCKET_MODULE_NAME " module: %ld\n", status);
put_module(NET_STARTER_MODULE_NAME);
return status;
}
}
@ -217,6 +227,7 @@ net_stack_free_cookie(void *_cookie)
// stack again (it will only be actually unloaded in case there is
// no interface defined)
put_module(NET_SOCKET_MODULE_NAME);
put_module(NET_STARTER_MODULE_NAME);
}
return B_OK;

View File

@ -892,12 +892,14 @@ socket_std_ops(int32 op, ...)
switch (op) {
case B_MODULE_INIT:
{
// TODO: this is currently done in the net_stack driver
// initialize the main stack if not done so already
module_info *module;
return get_module(NET_STARTER_MODULE_NAME, &module);
//module_info *module;
//return get_module(NET_STARTER_MODULE_NAME, &module);
}
case B_MODULE_UNINIT:
return put_module(NET_STARTER_MODULE_NAME);
//return put_module(NET_STARTER_MODULE_NAME);
return B_OK;
default:
return B_ERROR;