Files
haiku-beta6/src/add-ons/kernel/network/ppp/pap/pap.cpp
T
Waldemar Kornewald 1cea3d8564 Updated according to name changes in kernel classes.
IPCP and PAP (hopefully) make use of profiles.
Minor changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6284 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-01-25 12:57:01 +00:00

91 lines
1.7 KiB
C++

//-----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//
// Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
//-----------------------------------------------------------------------
#include <KernelExport.h>
#include <driver_settings.h>
#include <core_funcs.h>
#include <net_module.h>
#include <KPPPInterface.h>
#include <KPPPModule.h>
#include <LockerHelper.h>
#include "Protocol.h"
#define PAP_MODULE_NAME NETWORK_MODULES_ROOT "ppp/pap"
struct core_module_info *core = NULL;
status_t std_ops(int32 op, ...);
static
bool
add_to(KPPPInterface& mainInterface, KPPPInterface *subInterface,
driver_parameter *settings, ppp_module_key_type type)
{
if(type != PPP_AUTHENTICATOR_KEY_TYPE)
return B_ERROR;
PAP *pap;
bool success;
if(subInterface) {
pap = new PAP(*subInterface, settings);
success = subInterface->AddProtocol(pap);
} else {
pap = new PAP(mainInterface, settings);
success = mainInterface.AddProtocol(pap);
}
#if DEBUG
dprintf("PAP: add_to(): %s\n",
success && pap && pap->InitCheck() == B_OK ? "OK" : "ERROR");
#endif
return success && pap && pap->InitCheck() == B_OK;
}
static ppp_module_info pap_module = {
{
PAP_MODULE_NAME,
0,
std_ops
},
NULL,
add_to
};
_EXPORT
status_t
std_ops(int32 op, ...)
{
switch(op) {
case B_MODULE_INIT:
if(get_module(NET_CORE_MODULE_NAME, (module_info**) &core) != B_OK)
return B_ERROR;
return B_OK;
case B_MODULE_UNINIT:
put_module(NET_CORE_MODULE_NAME);
break;
default:
return B_ERROR;
}
return B_OK;
}
_EXPORT
module_info *modules[] = {
(module_info*) &pap_module,
NULL
};