network_settings/dialup: Fix the build.
Badly needs layouting and a lot of other fixes to get it working with the new PPP stack. But it's a start.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/dirent.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <String.h>
|
||||
@@ -14,32 +14,112 @@
|
||||
#include <Bitmap.h>
|
||||
#include <Alert.h>
|
||||
|
||||
#include <NetworkSetupAddOn.h>
|
||||
#include <NetworkSettings.h>
|
||||
#include <NetworkSettingsAddOn.h>
|
||||
#include "InterfaceListItem.h"
|
||||
|
||||
#include "DialUpView.h"
|
||||
|
||||
class AddOn : public NetworkSetupAddOn
|
||||
{
|
||||
public:
|
||||
AddOn(image_id addon_image);
|
||||
~AddOn();
|
||||
|
||||
const char * Name();
|
||||
BView * CreateView(BRect *bounds);
|
||||
using namespace BNetworkKit;
|
||||
|
||||
|
||||
class AddOn : public BNetworkSettingsAddOn {
|
||||
public:
|
||||
AddOn(image_id addon_image, BNetworkSettings& settings);
|
||||
virtual ~AddOn();
|
||||
|
||||
virtual BNetworkSettingsItem*
|
||||
CreateNextItem(uint32& cookie);
|
||||
};
|
||||
|
||||
|
||||
NetworkSetupAddOn * get_nth_addon(image_id image, int index)
|
||||
{
|
||||
if (index == 0)
|
||||
return new AddOn(image);
|
||||
return NULL;
|
||||
}
|
||||
class DialUpInterfaceItem : public BNetworkSettingsItem {
|
||||
public:
|
||||
DialUpInterfaceItem(BNetworkSettings& settings);
|
||||
virtual ~DialUpInterfaceItem();
|
||||
|
||||
virtual BNetworkSettingsType
|
||||
Type() const;
|
||||
|
||||
virtual BListItem* ListItem();
|
||||
virtual BView* View();
|
||||
|
||||
virtual status_t Revert();
|
||||
virtual bool IsRevertable();
|
||||
|
||||
private:
|
||||
BNetworkSettings& fSettings;
|
||||
BListItem* fItem;
|
||||
BView* fView;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
AddOn::AddOn(image_id image)
|
||||
: NetworkSetupAddOn(image)
|
||||
|
||||
DialUpInterfaceItem::DialUpInterfaceItem(BNetworkSettings& settings)
|
||||
:
|
||||
fSettings(settings),
|
||||
fItem(new InterfaceListItem("Dialup",
|
||||
B_NETWORK_INTERFACE_TYPE_DIAL_UP)),
|
||||
fView(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DialUpInterfaceItem::~DialUpInterfaceItem()
|
||||
{
|
||||
if (fView->Parent() == NULL)
|
||||
delete fView;
|
||||
|
||||
delete fItem;
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsType
|
||||
DialUpInterfaceItem::Type() const
|
||||
{
|
||||
return B_NETWORK_SETTINGS_TYPE_DIAL_UP;
|
||||
}
|
||||
|
||||
|
||||
BListItem*
|
||||
DialUpInterfaceItem::ListItem()
|
||||
{
|
||||
return fItem;
|
||||
}
|
||||
|
||||
|
||||
BView*
|
||||
DialUpInterfaceItem::View()
|
||||
{
|
||||
if (fView == NULL)
|
||||
fView = new DialUpView(BRect(0, 0, 100, 100)/*, fSettings*/);
|
||||
|
||||
return fView;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
DialUpInterfaceItem::Revert()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
DialUpInterfaceItem::IsRevertable()
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
AddOn::AddOn(image_id image, BNetworkSettings& settings)
|
||||
: BNetworkSettingsAddOn(image, settings)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,22 +129,22 @@ AddOn::~AddOn()
|
||||
}
|
||||
|
||||
|
||||
const char * AddOn::Name()
|
||||
BNetworkSettingsItem*
|
||||
AddOn::CreateNextItem(uint32& cookie)
|
||||
{
|
||||
return "DialUp";
|
||||
if (cookie++ == 0)
|
||||
return new DialUpInterfaceItem(Settings());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
BView * AddOn::CreateView(BRect *bounds)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C"
|
||||
BNetworkSettingsAddOn*
|
||||
instantiate_network_settings_add_on(image_id image, BNetworkSettings& settings)
|
||||
{
|
||||
BRect r = *bounds;
|
||||
|
||||
if (r.Width() < 200 || r.Height() < 400)
|
||||
r.Set(0, 0, 200, 400);
|
||||
|
||||
BView *view = new DialUpView(r);
|
||||
*bounds = view->Bounds();
|
||||
|
||||
return view;
|
||||
return new AddOn(image, settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
|
||||
BMessage parameter;
|
||||
int32 index = 0;
|
||||
const char *value;
|
||||
/* FIXME!
|
||||
if(FindMessageParameter(PPP_DIAL_ON_DEMAND_KEY, *fSettings, ¶meter, &index)
|
||||
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) {
|
||||
if(get_boolean_value(value, false))
|
||||
@@ -103,6 +104,7 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
|
||||
parameter.AddBool(MDSU_VALID, true);
|
||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
||||
}
|
||||
*/
|
||||
|
||||
if(fConnectionOptionsView)
|
||||
fConnectionOptionsView->Reload();
|
||||
@@ -135,13 +137,13 @@ ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile, bool
|
||||
BMessage parameter;
|
||||
if(fConnectionOptionsView->DoesDialOnDemand()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_DIAL_ON_DEMAND_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_DIAL_ON_DEMAND_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
|
||||
if(fConnectionOptionsView->AskBeforeDialing()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_ASK_BEFORE_DIALING_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_ASK_BEFORE_DIALING_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
}
|
||||
@@ -149,7 +151,7 @@ ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile, bool
|
||||
|
||||
if(fConnectionOptionsView->DoesAutoRedial()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef _CONNECTION_OPTIONS_ADDON__H
|
||||
#define _CONNECTION_OPTIONS_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <RadioButton.h>
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
class BMessage;
|
||||
class BView;
|
||||
class DialUpView;
|
||||
|
||||
|
||||
#define DUN_MAXIMUM_PRIORITY 50
|
||||
|
||||
@@ -57,7 +61,7 @@
|
||||
|
||||
|
||||
class DialUpAddon {
|
||||
friend class DialUpView;
|
||||
friend class DialUpView;
|
||||
|
||||
public:
|
||||
//! Constructor. The BMessage is the one passed to the \c register() function.
|
||||
|
||||
@@ -461,20 +461,20 @@ DialUpView::UpDownThread()
|
||||
BMessage settings, profile;
|
||||
SaveSettings(&settings, &profile, true);
|
||||
// save temporary profile
|
||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||
//driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||
|
||||
PPPInterface interface;
|
||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) {
|
||||
if (fWatching == PPP_UNDEFINED_INTERFACE_ID) {
|
||||
interface = fListener.Manager().InterfaceWithName(fCurrentItem->Label());
|
||||
if(interface.InitCheck() != B_OK)
|
||||
interface = fListener.Manager().CreateInterfaceWithName(
|
||||
fCurrentItem->Label(), temporaryProfile);
|
||||
fCurrentItem->Label());
|
||||
} else {
|
||||
interface = fWatching;
|
||||
interface.SetProfile(temporaryProfile);
|
||||
//interface.SetProfile(temporaryProfile);
|
||||
}
|
||||
|
||||
free_driver_settings(temporaryProfile);
|
||||
//free_driver_settings(temporaryProfile);
|
||||
|
||||
if(interface.InitCheck() != B_OK) {
|
||||
Window()->Lock();
|
||||
@@ -494,6 +494,7 @@ DialUpView::UpDownThread()
|
||||
}
|
||||
|
||||
|
||||
#define PPP_INTERFACE_SETTINGS_PATH "" // FIXME!
|
||||
void
|
||||
DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
|
||||
BDirectory *profileDirectory) const
|
||||
@@ -608,10 +609,8 @@ void
|
||||
DialUpView::UpdateStatus(int32 code)
|
||||
{
|
||||
switch(code) {
|
||||
case PPP_REPORT_UP_ABORTED:
|
||||
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||
case PPP_REPORT_CONNECTION_LOST: {
|
||||
fConnectButton->SetLabel(kLabelConnect);
|
||||
@@ -643,7 +642,6 @@ DialUpView::UpdateStatus(int32 code)
|
||||
fStatusView->SetText(kTextConnectionEstablished);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_UP_ABORTED:
|
||||
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||
fStatusView->SetText(kTextNotConnected);
|
||||
break;
|
||||
@@ -653,13 +651,11 @@ DialUpView::UpdateStatus(int32 code)
|
||||
fStatusView->SetText(kTextDeviceUpFailed);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
|
||||
case PPP_REPORT_AUTHENTICATION_REQUESTED:
|
||||
fStatusView->SetText(kTextAuthenticating);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_AUTHENTICATION_FAILED:
|
||||
fKeepLabel = true;
|
||||
fStatusView->SetText(kTextAuthenticationFailed);
|
||||
break;
|
||||
@@ -678,7 +674,7 @@ DialUpView::WatchInterface(ppp_interface_id ID)
|
||||
// This method can be used to update the interface's connection status.
|
||||
|
||||
if(fWatching != ID) {
|
||||
fListener.StopWatchingInterfaces();
|
||||
//fListener.StopWatchingInterfaces(); // FIXME
|
||||
|
||||
if(ID == PPP_UNDEFINED_INTERFACE_ID || fListener.WatchInterface(ID))
|
||||
fWatching = ID;
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
|
||||
#include <PPPInterfaceListener.h>
|
||||
|
||||
class BMenuItem;
|
||||
class BStringView;
|
||||
class BButton;
|
||||
class BPopUpMenu;
|
||||
class BMenuField;
|
||||
class BTabView;
|
||||
class GeneralAddon;
|
||||
|
||||
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
#ifndef _GENERAL_ADDON__H
|
||||
#define _GENERAL_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BBox;
|
||||
class BMenuField;
|
||||
class BMenuItem;
|
||||
class GeneralView;
|
||||
|
||||
|
||||
|
||||
@@ -28,12 +28,13 @@
|
||||
#ifndef _IPCP_ADDON__H
|
||||
#define _IPCP_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BButton;
|
||||
class IPCPView;
|
||||
|
||||
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
#define _INTERFACE_UTILS__H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
class DialUpAddon;
|
||||
class BListView;
|
||||
class BMenu;
|
||||
class BString;
|
||||
class BMenu;
|
||||
class BWindow;
|
||||
class BMessage;
|
||||
|
||||
|
||||
extern BPoint center_on_screen(BRect rect, BWindow *window = NULL);
|
||||
|
||||
@@ -2,14 +2,16 @@ SubDir HAIKU_TOP src add-ons network_settings dialup ;
|
||||
|
||||
UsePublicHeaders [ FDirName add-ons network_settings ] ;
|
||||
UsePrivateHeaders app libroot kernel net shared ;
|
||||
UsePrivateSystemHeaders ;
|
||||
UsePrivateKernelHeaders ; # FIXME: shouldn't be needed
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src preferences network ] : false ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libppp headers ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libppp headers ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] : true ;
|
||||
|
||||
# additonal headers for built-in add-ons:
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp pppoe ] ; # PPPoE
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] ; # IPCP
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp pppoe ] : true ; # PPPoE
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] : true ; # IPCP
|
||||
|
||||
AddResources DialUp : DialUpPreflet.rdef ;
|
||||
|
||||
@@ -29,12 +31,10 @@ Addon DialUpInterface :
|
||||
PPPoEAddon.cpp
|
||||
|
||||
: be shared <nogrist>Network [ TargetLibsupc++ ]
|
||||
[ TargetLibstdc++ ] localestub
|
||||
[ TargetLibstdc++ ] localestub libppp.a
|
||||
;
|
||||
|
||||
|
||||
DoCatalogs DialUpInterface : x-vnd.Haiku-DialUpInterface :
|
||||
DialUpView.cpp
|
||||
;
|
||||
|
||||
#LinkSharedOSLibs DialUp : libppp.a be ;
|
||||
|
||||
@@ -28,11 +28,13 @@
|
||||
#ifndef _PPPoE_ADDON__H
|
||||
#define _PPPoE_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BMenuField;
|
||||
class BMenuItem;
|
||||
class PPPoEView;
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
#include <Window.h>
|
||||
|
||||
class BInvoker;
|
||||
class BTextView;
|
||||
class BTextControl;
|
||||
class BButton;
|
||||
|
||||
|
||||
class TextRequestDialog : public BWindow {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user