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 :
|
||||
ppp.cpp
|
||||
PPPManager.cpp
|
||||
|
||||
: libkernelppp.a
|
||||
;
|
||||
|
||||
LinkSharedOSLibs ppp : libkernelppp.a ;
|
||||
|
||||
# Installation
|
||||
OBOSInstall install-networking
|
||||
: /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 :
|
||||
inet_addr.c
|
||||
|
||||
ipcp.cpp
|
||||
Protocol.cpp
|
||||
inet_addr.c
|
||||
|
||||
: libkernelppp.a
|
||||
;
|
||||
|
||||
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
|
||||
IPCP::UpdateAddresses()
|
||||
{
|
||||
if(!Interface().IsUp() && !Interface().DoesDialOnDemand())
|
||||
if(State() != PPP_OPENED_STATE && !Interface().DoesDialOnDemand())
|
||||
return;
|
||||
|
||||
in_addr_t netmask;
|
||||
@@ -388,12 +388,8 @@ IPCP::UpdateAddresses()
|
||||
netmask = fLocalRequests.netmask;
|
||||
else if(State() != PPP_OPENED_STATE)
|
||||
netmask = INADDR_BROADCAST;
|
||||
else if(IN_CLASSA(fLocalConfiguration.address))
|
||||
netmask = IN_CLASSA_NET;
|
||||
else if(IN_CLASSB(fLocalConfiguration.address))
|
||||
netmask = IN_CLASSB_NET;
|
||||
else
|
||||
netmask = IN_CLASSC_NET;
|
||||
netmask = 0x80000000;
|
||||
inreq.ifra_mask.sin_addr.s_addr = netmask;
|
||||
inreq.ifra_mask.sin_len = sizeof(sockaddr_in);
|
||||
|
||||
@@ -403,9 +399,13 @@ IPCP::UpdateAddresses()
|
||||
if(in_control(NULL, SIOCSIFDSTADDR, (caddr_t) &ifreqDestination,
|
||||
Interface().Ifnet()) != B_OK)
|
||||
printf("IPCP: UpdateAddress(): SIOCSIFDSTADDR returned error!\n");
|
||||
if(in_control(NULL, SIOCSIFNETMASK, (caddr_t) &inreq.ifra_mask,
|
||||
Interface().Ifnet()) != B_OK)
|
||||
printf("IPCP: UpdateAddress(): SIOCSIFNETMASK returned error!\n");
|
||||
|
||||
// the netmask is optional for PPP interfaces
|
||||
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
|
||||
ModemDevice.cpp
|
||||
ACFCHandler.cpp
|
||||
|
||||
: libkernelppp.a
|
||||
;
|
||||
|
||||
LinkSharedOSLibs modem : libkernelppp.a ;
|
||||
|
||||
# Installation
|
||||
OBOSInstall install-networking
|
||||
: /boot/home/config/add-ons/kernel/network/ppp
|
||||
|
||||
@@ -527,5 +527,5 @@ ModemDevice::Receive(struct mbuf *packet, uint16 protocolNumber = 0)
|
||||
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 :
|
||||
pap.cpp
|
||||
Protocol.cpp
|
||||
|
||||
: libkernelppp.a
|
||||
;
|
||||
|
||||
LinkSharedOSLibs pap : libkernelppp.a ;
|
||||
|
||||
# Installation
|
||||
OBOSInstall install-networking
|
||||
: /boot/home/config/add-ons/kernel/network/ppp
|
||||
|
||||
@@ -12,10 +12,10 @@ R5KernelAddon pppoe : kernel network ppp :
|
||||
pppoe.cpp
|
||||
PPPoEDevice.cpp
|
||||
DiscoveryPacket.cpp
|
||||
|
||||
: libkernelppp.a
|
||||
;
|
||||
|
||||
LinkSharedOSLibs pppoe : libkernelppp.a ;
|
||||
|
||||
# Installation
|
||||
OBOSInstall install-networking
|
||||
: /boot/home/config/add-ons/kernel/network/ppp
|
||||
|
||||
@@ -13,5 +13,6 @@ StaticLibrary ppp :
|
||||
|
||||
_libppputils.cpp
|
||||
PPPInterface.cpp
|
||||
PPPInterfaceListener.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