Simplified Jamfiles a little bit.
Fixed a warning in modem. Fixed a small bug in IPCP. Added empty PPPInterfaceListener class (needed for DialUpPreflet and Deskbar add-on). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5877 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,10 +9,10 @@ UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkerne
|
|||||||
R5KernelAddon ppp : kernel network interfaces :
|
R5KernelAddon ppp : kernel network interfaces :
|
||||||
ppp.cpp
|
ppp.cpp
|
||||||
PPPManager.cpp
|
PPPManager.cpp
|
||||||
|
|
||||||
|
: libkernelppp.a
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs ppp : libkernelppp.a ;
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
OBOSInstall install-networking
|
OBOSInstall install-networking
|
||||||
: /boot/home/config/add-ons/kernel/network/interfaces
|
: /boot/home/config/add-ons/kernel/network/interfaces
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkerne
|
|||||||
|
|
||||||
|
|
||||||
R5KernelAddon ipcp : kernel network ppp :
|
R5KernelAddon ipcp : kernel network ppp :
|
||||||
|
inet_addr.c
|
||||||
|
|
||||||
ipcp.cpp
|
ipcp.cpp
|
||||||
Protocol.cpp
|
Protocol.cpp
|
||||||
inet_addr.c
|
|
||||||
|
: libkernelppp.a
|
||||||
;
|
;
|
||||||
|
|
||||||
SEARCH on [ FGristFiles inet_addr.c ] = [ FDirName $(OBOS_TOP) src kits network libnet ] ;
|
SEARCH on [ FGristFiles inet_addr.c ] = [ FDirName $(OBOS_TOP) src kits network libnet ] ;
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ IPCP::ParseSideRequests(driver_parameter *requests, ppp_side side)
|
|||||||
void
|
void
|
||||||
IPCP::UpdateAddresses()
|
IPCP::UpdateAddresses()
|
||||||
{
|
{
|
||||||
if(!Interface().IsUp() && !Interface().DoesDialOnDemand())
|
if(State() != PPP_OPENED_STATE && !Interface().DoesDialOnDemand())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
in_addr_t netmask;
|
in_addr_t netmask;
|
||||||
@@ -388,12 +388,8 @@ IPCP::UpdateAddresses()
|
|||||||
netmask = fLocalRequests.netmask;
|
netmask = fLocalRequests.netmask;
|
||||||
else if(State() != PPP_OPENED_STATE)
|
else if(State() != PPP_OPENED_STATE)
|
||||||
netmask = INADDR_BROADCAST;
|
netmask = INADDR_BROADCAST;
|
||||||
else if(IN_CLASSA(fLocalConfiguration.address))
|
|
||||||
netmask = IN_CLASSA_NET;
|
|
||||||
else if(IN_CLASSB(fLocalConfiguration.address))
|
|
||||||
netmask = IN_CLASSB_NET;
|
|
||||||
else
|
else
|
||||||
netmask = IN_CLASSC_NET;
|
netmask = 0x80000000;
|
||||||
inreq.ifra_mask.sin_addr.s_addr = netmask;
|
inreq.ifra_mask.sin_addr.s_addr = netmask;
|
||||||
inreq.ifra_mask.sin_len = sizeof(sockaddr_in);
|
inreq.ifra_mask.sin_len = sizeof(sockaddr_in);
|
||||||
|
|
||||||
@@ -403,9 +399,13 @@ IPCP::UpdateAddresses()
|
|||||||
if(in_control(NULL, SIOCSIFDSTADDR, (caddr_t) &ifreqDestination,
|
if(in_control(NULL, SIOCSIFDSTADDR, (caddr_t) &ifreqDestination,
|
||||||
Interface().Ifnet()) != B_OK)
|
Interface().Ifnet()) != B_OK)
|
||||||
printf("IPCP: UpdateAddress(): SIOCSIFDSTADDR returned error!\n");
|
printf("IPCP: UpdateAddress(): SIOCSIFDSTADDR returned error!\n");
|
||||||
if(in_control(NULL, SIOCSIFNETMASK, (caddr_t) &inreq.ifra_mask,
|
|
||||||
Interface().Ifnet()) != B_OK)
|
// the netmask is optional for PPP interfaces
|
||||||
printf("IPCP: UpdateAddress(): SIOCSIFNETMASK returned error!\n");
|
if(fLocalRequests.netmask != INADDR_ANY) {
|
||||||
|
if(in_control(NULL, SIOCSIFNETMASK, (caddr_t) &inreq.ifra_mask,
|
||||||
|
Interface().Ifnet()) != B_OK)
|
||||||
|
printf("IPCP: UpdateAddress(): SIOCSIFNETMASK returned error!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ R5KernelAddon modem : kernel network ppp :
|
|||||||
modem.cpp
|
modem.cpp
|
||||||
ModemDevice.cpp
|
ModemDevice.cpp
|
||||||
ACFCHandler.cpp
|
ACFCHandler.cpp
|
||||||
|
|
||||||
|
: libkernelppp.a
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs modem : libkernelppp.a ;
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
OBOSInstall install-networking
|
OBOSInstall install-networking
|
||||||
: /boot/home/config/add-ons/kernel/network/ppp
|
: /boot/home/config/add-ons/kernel/network/ppp
|
||||||
|
|||||||
@@ -527,5 +527,5 @@ ModemDevice::Receive(struct mbuf *packet, uint16 protocolNumber = 0)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Interface().ReceiveFromDevice(packet);
|
return Interface().ReceiveFromDevice(packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkerne
|
|||||||
R5KernelAddon pap : kernel network ppp :
|
R5KernelAddon pap : kernel network ppp :
|
||||||
pap.cpp
|
pap.cpp
|
||||||
Protocol.cpp
|
Protocol.cpp
|
||||||
|
|
||||||
|
: libkernelppp.a
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs pap : libkernelppp.a ;
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
OBOSInstall install-networking
|
OBOSInstall install-networking
|
||||||
: /boot/home/config/add-ons/kernel/network/ppp
|
: /boot/home/config/add-ons/kernel/network/ppp
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ R5KernelAddon pppoe : kernel network ppp :
|
|||||||
pppoe.cpp
|
pppoe.cpp
|
||||||
PPPoEDevice.cpp
|
PPPoEDevice.cpp
|
||||||
DiscoveryPacket.cpp
|
DiscoveryPacket.cpp
|
||||||
|
|
||||||
|
: libkernelppp.a
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs pppoe : libkernelppp.a ;
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
OBOSInstall install-networking
|
OBOSInstall install-networking
|
||||||
: /boot/home/config/add-ons/kernel/network/ppp
|
: /boot/home/config/add-ons/kernel/network/ppp
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ StaticLibrary ppp :
|
|||||||
|
|
||||||
_libppputils.cpp
|
_libppputils.cpp
|
||||||
PPPInterface.cpp
|
PPPInterface.cpp
|
||||||
|
PPPInterfaceListener.cpp
|
||||||
PPPManager.cpp
|
PPPManager.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
//----------------------------------------------------------------------
|
||||||
|
// This software is part of the OpenBeOS distribution and is covered
|
||||||
|
// by the OpenBeOS license.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Waldemar Kornewald, [email protected]
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "PPPInterfaceListener.h"
|
||||||
|
|
||||||
|
#include <Handler.h>
|
||||||
|
#include <LockerHelper.h>
|
||||||
|
|
||||||
|
|
||||||
|
PPPInterfaceListener::PPPInterfaceListener(BHandler *target)
|
||||||
|
: fTarget(target)
|
||||||
|
{
|
||||||
|
Construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PPPInterfaceListener::PPPInterfaceListener(const PPPInterfaceListener& copy)
|
||||||
|
: fTarget(copy.Target())
|
||||||
|
{
|
||||||
|
Construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PPPInterfaceListener::~PPPInterfaceListener()
|
||||||
|
{
|
||||||
|
// TODO: send exit code to thread
|
||||||
|
// int32 tmp;
|
||||||
|
// wait_for_thread(fReportThread, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
PPPInterfaceListener::InitCheck() const
|
||||||
|
{
|
||||||
|
if(fReportThread < 0)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
return Manager()->InitCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PPPInterfaceListener::SetTarget(BHandler *target)
|
||||||
|
{
|
||||||
|
LockerHelper locker(fLock);
|
||||||
|
|
||||||
|
target = fTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PPPInterfaceListener::Construct()
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
// create report thread and register it as a receiver using PPPManager
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
//----------------------------------------------------------------------
|
||||||
|
// This software is part of the OpenBeOS distribution and is covered
|
||||||
|
// by the OpenBeOS license.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Waldemar Kornewald, [email protected]
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _PPP_INTERFACE_LISTENER__H
|
||||||
|
#define _PPP_INTERFACE_LISTENER__H
|
||||||
|
|
||||||
|
#include <PPPManager.h>
|
||||||
|
#include <Locker.h>
|
||||||
|
|
||||||
|
class BHandler;
|
||||||
|
|
||||||
|
|
||||||
|
#define PPP_REPORT_MESSAGE 'P3RM'
|
||||||
|
// the what field of report messages
|
||||||
|
|
||||||
|
|
||||||
|
class PPPInterfaceListener {
|
||||||
|
public:
|
||||||
|
PPPInterfaceListener(BHandler *target);
|
||||||
|
PPPInterfaceListener(const PPPInterfaceListener& copy);
|
||||||
|
~PPPInterfaceListener();
|
||||||
|
|
||||||
|
status_t InitCheck() const;
|
||||||
|
|
||||||
|
BHandler *Target() const
|
||||||
|
{ return fTarget; }
|
||||||
|
void SetTarget(BHandler *target);
|
||||||
|
|
||||||
|
const PPPManager *Manager() const
|
||||||
|
{ return &fManager; }
|
||||||
|
|
||||||
|
PPPInterfaceListener& operator= (const PPPInterfaceListener& copy)
|
||||||
|
{ SetTarget(copy.Target()); return *this; }
|
||||||
|
// all interface listeners have the same number of interfaces
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Construct();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BHandler *fTarget;
|
||||||
|
thread_id fReportThread;
|
||||||
|
|
||||||
|
PPPManager fManager;
|
||||||
|
BLocker fLock;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user