Nothing special. Just bringing the cvs version up-to-date with my private version.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7206 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+25
-1
@@ -2,6 +2,18 @@ SubDir OBOS_TOP src servers net ;
|
||||
|
||||
UsePrivateHeaders net ;
|
||||
|
||||
# additonal headers for built-in add-ons:
|
||||
UsePrivateHeaders net ;
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libppp headers ] ;
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ;
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src tests kits net DialUpPreflet ] ;
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp pppoe ] ; # PPPoE
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp ipcp ] ; # IPCP
|
||||
|
||||
# additional sources for built-in add-ons:
|
||||
SEARCH_SOURCE += [ FDirName $(OBOS_TOP) src tests kits net DialUpPreflet ] ;
|
||||
|
||||
|
||||
Server net_server :
|
||||
NetServer.cpp
|
||||
|
||||
@@ -11,6 +23,16 @@ Server net_server :
|
||||
# built-in add-ons
|
||||
PPPServer.cpp
|
||||
|
||||
# PPPServer needs this
|
||||
DialUpView.cpp
|
||||
InterfaceUtils.cpp
|
||||
MessageDriverSettingsUtils.cpp
|
||||
TextRequestDialog.cpp
|
||||
ConnectionOptionsAddon.cpp
|
||||
GeneralAddon.cpp
|
||||
IPCPAddon.cpp
|
||||
PPPoEAddon.cpp
|
||||
|
||||
# old net_server (was a netstack tester app)
|
||||
# userland_server.c
|
||||
# userland_ipc.c
|
||||
@@ -18,5 +40,7 @@ Server net_server :
|
||||
|
||||
LinkSharedOSLibs net_server :
|
||||
be
|
||||
net
|
||||
socket
|
||||
bind
|
||||
libppp.a
|
||||
;
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
// Copyright (c) 2004 Waldemar Kornewald, [email protected]
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
#include "NetServer.h"
|
||||
#include <Application.h>
|
||||
#include <Alert.h>
|
||||
|
||||
|
||||
static const char *kSignature = "application/x-obos.net_server";
|
||||
static const char *kSignature = NET_SERVER_SIGNATURE;
|
||||
|
||||
|
||||
class NetServerApplication : public BApplication {
|
||||
|
||||
@@ -23,13 +23,18 @@ PPPServer::PPPServer()
|
||||
be_app->AddHandler(this);
|
||||
fFilter = new SimpleMessageFilter(kPPPWhatValues, this);
|
||||
be_app->AddCommonFilter(fFilter);
|
||||
fListener = new PPPInterfaceListener(this);
|
||||
fListener->WatchAllInterfaces();
|
||||
|
||||
InitInterfaces();
|
||||
}
|
||||
|
||||
|
||||
PPPServer::~PPPServer()
|
||||
{
|
||||
be_app->RemoveHandler(this);
|
||||
delete fListener;
|
||||
be_app->RemoveCommonFilter(fFilter);
|
||||
be_app->RemoveHandler(this);
|
||||
delete fFilter;
|
||||
}
|
||||
|
||||
@@ -38,11 +43,61 @@ void
|
||||
PPPServer::MessageReceived(BMessage *message)
|
||||
{
|
||||
switch(message->what) {
|
||||
// TODO: handle PPP stack messages
|
||||
case PPP_REPORT_MESSAGE:
|
||||
HandleReportMessage(message);
|
||||
break;
|
||||
|
||||
// TODO: handle requests from DialUpPreflet
|
||||
// TODO: handle
|
||||
|
||||
default:
|
||||
BHandler::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PPPServer::InitInterfaces()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PPPServer::AskBeforeDialing(ppp_interface_id id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PPPServer::HandleReportMessage(BMessage *message)
|
||||
{
|
||||
thread_id sender;
|
||||
message->FindInt32("sender", &sender);
|
||||
|
||||
ppp_interface_id id;
|
||||
if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK) {
|
||||
send_data(sender, B_OK, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int32 type, code;
|
||||
message->FindInt32("type", &type);
|
||||
message->FindInt32("code", &code);
|
||||
|
||||
if(type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED) {
|
||||
// TODO: check if we need to add this interface to our watch-list
|
||||
} else if(type == PPP_CONNECTION_REPORT) {
|
||||
switch(code) {
|
||||
case PPP_REPORT_GOING_UP: {
|
||||
if(AskBeforeDialing(id)) {
|
||||
// OpenDialRequestWindow(id, sender);
|
||||
return;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} else if(type == PPP_DESTRUCTION_REPORT) {
|
||||
// TODO: check if this interface has DOD enabled. if so: create new!
|
||||
}
|
||||
|
||||
send_data(sender, B_OK, NULL, 0);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define _PPP_SERVER__H
|
||||
|
||||
#include <Handler.h>
|
||||
#include <PPPInterfaceListener.h>
|
||||
|
||||
class SimpleMessageFilter;
|
||||
|
||||
@@ -21,8 +22,15 @@ class PPPServer : public BHandler {
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
// the SimpleMessageFilter routes ppp_server messages to this handler
|
||||
|
||||
private:
|
||||
void InitInterfaces();
|
||||
bool AskBeforeDialing(ppp_interface_id id);
|
||||
|
||||
void HandleReportMessage(BMessage *message);
|
||||
|
||||
private:
|
||||
SimpleMessageFilter *fFilter;
|
||||
PPPInterfaceListener *fListener;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user