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:
Waldemar Kornewald
2004-04-15 16:05:40 +00:00
parent 6c3f95cd4b
commit 0a628cf2fc
4 changed files with 93 additions and 5 deletions
+58 -3
View File
@@ -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);
}