Work in progress. Untested.
All ppp_up instances are now maintained by KPPPManager. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10113 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b1318016f9
commit
9c15eafc5d
@ -1,76 +1,134 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "ConnectionView.h"
|
#include "ConnectionView.h"
|
||||||
#include <MessageDriverSettingsUtils.h>
|
#include <MessageDriverSettingsUtils.h>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <PPPInterface.h>
|
#include <PPPInterface.h>
|
||||||
|
#include <PPPManager.h>
|
||||||
#include <settings_tools.h>
|
#include <settings_tools.h>
|
||||||
|
#include <stl_algobase.h>
|
||||||
|
// for max()
|
||||||
|
|
||||||
|
|
||||||
static const char *kLabelConnect = "Connect";
|
// GUI constants
|
||||||
static const char *kLabelCancel = "Cancel";
|
static const uint32 kDefaultButtonWidth = 80;
|
||||||
|
|
||||||
|
// message constants
|
||||||
static const uint32 kMsgCancel = 'CANC';
|
static const uint32 kMsgCancel = 'CANC';
|
||||||
static const uint32 kMsgConnect = 'CONN';
|
static const uint32 kMsgConnect = 'CONN';
|
||||||
|
|
||||||
static const uint32 kDefaultButtonWidth = 80;
|
// labels
|
||||||
|
static const char *kLabelSavePassword = "Save Password";
|
||||||
|
static const char *kLabelName = "Username: ";
|
||||||
|
static const char *kLabelPassword = "Password: ";
|
||||||
|
static const char *kLabelConnect = "Connect";
|
||||||
|
static const char *kLabelCancel = "Cancel";
|
||||||
|
|
||||||
|
// connection status strings
|
||||||
|
static const char *kTextConnecting = "Connecting...";
|
||||||
|
static const char *kTextConnectionEstablished = "Connection established.";
|
||||||
|
static const char *kTextNotConnected = "Not connected.";
|
||||||
|
static const char *kTextDeviceUpFailed = "Failed to connect.";
|
||||||
|
static const char *kTextAuthenticating = "Authenticating...";
|
||||||
|
static const char *kTextAuthenticationFailed = "Authentication failed!";
|
||||||
|
static const char *kTextConnectionLost = "Connection lost!";
|
||||||
|
|
||||||
|
|
||||||
ConnectionView::ConnectionView(BRect rect, ppp_interface_id id, thread_id thread,
|
static
|
||||||
DialUpView *dun)
|
status_t
|
||||||
|
up_thread(void *data)
|
||||||
|
{
|
||||||
|
PPPInterface *interface = static_cast<PPPInterface*>(data);
|
||||||
|
interface->Up();
|
||||||
|
delete interface;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
status_t
|
||||||
|
down_thread(void *data)
|
||||||
|
{
|
||||||
|
PPPInterface *interface = static_cast<PPPInterface*>(data);
|
||||||
|
interface->Down();
|
||||||
|
delete interface;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ConnectionView::ConnectionView(BRect rect, const char *name, ppp_interface_id id,
|
||||||
|
thread_id thread)
|
||||||
: BView(rect, "ConnectionView", B_FOLLOW_NONE, 0),
|
: BView(rect, "ConnectionView", B_FOLLOW_NONE, 0),
|
||||||
|
fInterfaceName(name),
|
||||||
fID(id),
|
fID(id),
|
||||||
fRequestThread(thread),
|
fReportThread(thread),
|
||||||
fDUNView(dun),
|
fConnecting(false),
|
||||||
fConnecting(false)
|
fKeepLabel(false),
|
||||||
|
fReplyRequested(true)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
rect.InsetBy(5, 5);
|
rect.InsetBy(5, 5);
|
||||||
fAuthenticationView = dun->AuthenticationView();
|
rect.bottom = rect.top
|
||||||
fAuthenticationView->RemoveSelf();
|
+ 25 // space for topmost control
|
||||||
fAuthenticationView->MoveTo(5, 5);
|
+ 3 * 20 // size of controls
|
||||||
AddChild(fAuthenticationView);
|
+ 3 * 5; // space beween controls and bottom of box
|
||||||
|
BBox *authenticationBox = new BBox(rect, "Authentication");
|
||||||
|
rect = authenticationBox->Bounds();
|
||||||
|
rect.InsetBy(10, 5);
|
||||||
|
rect.top = 25;
|
||||||
|
BView *authenticationView = new BView(rect, "authenticationView",
|
||||||
|
B_FOLLOW_NONE, 0);
|
||||||
|
authenticationView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
rect = authenticationView->Bounds();
|
||||||
|
rect.bottom = rect.top + 20;
|
||||||
|
fUsername = new BTextControl(rect, "username", kLabelName, NULL, NULL);
|
||||||
|
rect.top = rect.bottom + 5;
|
||||||
|
rect.bottom = rect.top + 20;
|
||||||
|
fPassword = new BTextControl(rect, "password", kLabelPassword, NULL, NULL);
|
||||||
|
fPassword->TextView()->HideTyping(true);
|
||||||
|
|
||||||
rect.top = fAuthenticationView->Frame().bottom + 15;
|
// set dividers
|
||||||
|
float width = max(StringWidth(fUsername->Label()),
|
||||||
|
StringWidth(fPassword->Label()));
|
||||||
|
fUsername->SetDivider(width + 5);
|
||||||
|
fPassword->SetDivider(width + 5);
|
||||||
|
|
||||||
|
rect.top = rect.bottom + 5;
|
||||||
|
rect.bottom = rect.top + 20;
|
||||||
|
fSavePassword = new BCheckBox(rect, "SavePassword", kLabelSavePassword, NULL);
|
||||||
|
|
||||||
|
authenticationView->AddChild(fUsername);
|
||||||
|
authenticationView->AddChild(fPassword);
|
||||||
|
authenticationView->AddChild(fSavePassword);
|
||||||
|
authenticationBox->AddChild(authenticationView);
|
||||||
|
AddChild(authenticationBox);
|
||||||
|
|
||||||
|
rect = authenticationBox->Frame();
|
||||||
|
rect.top = rect.bottom + 10;
|
||||||
rect.bottom = rect.top + 15;
|
rect.bottom = rect.top + 15;
|
||||||
fAttemptView = new BStringView(rect, "AttemptView", AttemptString().String());
|
fAttemptView = new BStringView(rect, "AttemptView", AttemptString().String());
|
||||||
AddChild(fAttemptView);
|
AddChild(fAttemptView);
|
||||||
|
|
||||||
|
// add status view
|
||||||
rect.top = rect.bottom + 5;
|
rect.top = rect.bottom + 5;
|
||||||
fStatusView = dun->StatusView();
|
rect.bottom = rect.top + 15;
|
||||||
fStatusView->RemoveSelf();
|
fStatusView = new BStringView(rect, "StatusView", "");
|
||||||
fStatusView->MoveTo(5, rect.top);
|
|
||||||
AddChild(fStatusView);
|
AddChild(fStatusView);
|
||||||
|
|
||||||
rect.top = fStatusView->Frame().bottom + 10;
|
// add "Connect" and "Cancel" buttons
|
||||||
|
rect.top = rect.bottom + 10;
|
||||||
rect.bottom = rect.top + 25;
|
rect.bottom = rect.top + 25;
|
||||||
rect.right = rect.left + kDefaultButtonWidth;
|
rect.right = rect.left + kDefaultButtonWidth;
|
||||||
fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect,
|
fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect,
|
||||||
@ -84,6 +142,13 @@ ConnectionView::ConnectionView(BRect rect, ppp_interface_id id, thread_id thread
|
|||||||
|
|
||||||
AddChild(fConnectButton);
|
AddChild(fConnectButton);
|
||||||
AddChild(fCancelButton);
|
AddChild(fCancelButton);
|
||||||
|
|
||||||
|
// initialize PTPSettings
|
||||||
|
fSettings.LoadAddons(false);
|
||||||
|
// add PPPUpAddon
|
||||||
|
fAddon = new PPPUpAddon(&fSettings.Addons(), this);
|
||||||
|
fSettings.Addons().AddPointer(DUN_TAB_ADDON_TYPE, fAddon);
|
||||||
|
fSettings.Addons().AddPointer(DUN_DELETE_ON_QUIT, fAddon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -92,8 +157,10 @@ ConnectionView::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
fConnectButton->SetTarget(this);
|
fConnectButton->SetTarget(this);
|
||||||
fCancelButton->SetTarget(this);
|
fCancelButton->SetTarget(this);
|
||||||
|
fSettings.LoadSettings(fInterfaceName.String(), false);
|
||||||
|
|
||||||
if(fDUNView->NeedsRequest() == false)
|
if(fAddon->CountAuthenticators() == 0 || fAddon->HasPassword())
|
||||||
|
// TODO: || AskBeforeDialing == true
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +169,15 @@ void
|
|||||||
ConnectionView::MessageReceived(BMessage *message)
|
ConnectionView::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
case MSG_UPDATE:
|
case MSG_UPDATE: {
|
||||||
Update();
|
UpdateStatus(message->FindInt32("code"));
|
||||||
break;
|
ppp_interface_id id;
|
||||||
|
if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) == B_OK)
|
||||||
|
fID = id;
|
||||||
|
} break;
|
||||||
|
|
||||||
case MSG_UP_FAILED:
|
case MSG_REPLY:
|
||||||
UpFailed();
|
message->SendReply(B_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgConnect:
|
case kMsgConnect:
|
||||||
@ -124,55 +194,73 @@ ConnectionView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// update authentication UI
|
||||||
void
|
void
|
||||||
ConnectionView::Update()
|
ConnectionView::Reload()
|
||||||
{
|
{
|
||||||
fAttemptView->SetText(AttemptString().String());
|
fUsername->SetText(Addon()->Username());
|
||||||
}
|
fPassword->SetText(Addon()->Password());
|
||||||
|
fSavePassword->SetValue(Addon()->HasPassword());
|
||||||
|
|
||||||
|
if(Addon()->CountAuthenticators() > 0) {
|
||||||
void
|
fUsername->SetEnabled(true);
|
||||||
ConnectionView::UpFailed()
|
fPassword->SetEnabled(true);
|
||||||
{
|
fSavePassword->SetEnabled(true);
|
||||||
Update();
|
} else {
|
||||||
fConnectButton->SetEnabled(true);
|
fUsername->SetEnabled(false);
|
||||||
|
fPassword->SetEnabled(false);
|
||||||
|
fSavePassword->SetEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionView::Connect()
|
ConnectionView::Connect()
|
||||||
{
|
{
|
||||||
|
fSettings.SaveSettingsToFile();
|
||||||
|
|
||||||
|
// update interface profile
|
||||||
BMessage settings, profile;
|
BMessage settings, profile;
|
||||||
fDUNView->SaveSettings(&settings, &profile, true);
|
fSettings.SaveSettings(&settings, &profile, true);
|
||||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||||
PPPInterface interface(fID);
|
PPPInterface *interface = new PPPInterface(PPPManager().CreateInterfaceWithName(
|
||||||
interface.SetProfile(temporaryProfile);
|
fInterfaceName.String()));
|
||||||
|
interface->SetProfile(temporaryProfile);
|
||||||
free_driver_settings(temporaryProfile);
|
free_driver_settings(temporaryProfile);
|
||||||
|
|
||||||
fConnectButton->SetEnabled(false);
|
fConnectButton->SetEnabled(false);
|
||||||
fConnecting = true;
|
fConnecting = true;
|
||||||
|
|
||||||
send_data(fRequestThread, B_OK, NULL, 0);
|
if(fReplyRequested) {
|
||||||
|
fReplyRequested = false;
|
||||||
|
send_data(fReportThread, B_OK, NULL, 0);
|
||||||
|
delete interface;
|
||||||
|
} else {
|
||||||
|
thread_id up = spawn_thread(up_thread, "up_thread", B_NORMAL_PRIORITY,
|
||||||
|
interface);
|
||||||
|
resume_thread(up);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ConnectionView::Cancel()
|
ConnectionView::Cancel()
|
||||||
{
|
{
|
||||||
if(fConnecting) {
|
if(fReplyRequested) {
|
||||||
// only disconnect if we are not connected yet
|
fReplyRequested = false;
|
||||||
PPPInterface interface(fID);
|
send_data(fReportThread, B_ERROR, NULL, 0);
|
||||||
|
// tell requestor to cancel connection attempt
|
||||||
|
} else {
|
||||||
|
PPPInterface *interface = new PPPInterface(fID);
|
||||||
ppp_interface_info_t info;
|
ppp_interface_info_t info;
|
||||||
interface.GetInterfaceInfo(&info);
|
interface->GetInterfaceInfo(&info);
|
||||||
|
|
||||||
if(info.info.phase < PPP_ESTABLISHED_PHASE) {
|
if(info.info.phase < PPP_ESTABLISHED_PHASE) {
|
||||||
interface.Down();
|
thread_id down = spawn_thread(down_thread, "up_thread", B_NORMAL_PRIORITY,
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
interface);
|
||||||
}
|
resume_thread(down);
|
||||||
} else {
|
} else
|
||||||
send_data(fRequestThread, B_ERROR, NULL, 0);
|
delete interface;
|
||||||
// tell requestor to cancel connection attempt
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,11 +269,9 @@ ConnectionView::Cancel()
|
|||||||
void
|
void
|
||||||
ConnectionView::CleanUp()
|
ConnectionView::CleanUp()
|
||||||
{
|
{
|
||||||
// give the "stolen" views back to make sure they are not deleted too early
|
// TODO: finish clean-up; (DONE?)
|
||||||
fAuthenticationView->RemoveSelf();
|
if(fReplyRequested)
|
||||||
fDUNView->AddChild(fAuthenticationView);
|
Cancel();
|
||||||
fStatusView->RemoveSelf();
|
|
||||||
fDUNView->AddChild(fStatusView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,3 +287,68 @@ ConnectionView::AttemptString() const
|
|||||||
|
|
||||||
return attempt;
|
return attempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ConnectionView::UpdateStatus(int32 code)
|
||||||
|
{
|
||||||
|
fAttemptView->SetText(AttemptString().String());
|
||||||
|
|
||||||
|
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_DOWN_SUCCESSFUL:
|
||||||
|
case PPP_REPORT_CONNECTION_LOST:
|
||||||
|
fConnectButton->SetEnabled(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fConnectButton->SetEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// maybe the status string must not be changed (codes that set fKeepLabel to false
|
||||||
|
// should still be handled)
|
||||||
|
if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only errors should set fKeepLabel to true
|
||||||
|
switch(code) {
|
||||||
|
case PPP_REPORT_GOING_UP:
|
||||||
|
fKeepLabel = false;
|
||||||
|
fStatusView->SetText(kTextConnecting);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_UP_SUCCESSFUL:
|
||||||
|
fKeepLabel = false;
|
||||||
|
fStatusView->SetText(kTextConnectionEstablished);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_UP_ABORTED:
|
||||||
|
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||||
|
fStatusView->SetText(kTextNotConnected);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||||
|
fKeepLabel = true;
|
||||||
|
fStatusView->SetText(kTextDeviceUpFailed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED:
|
||||||
|
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
|
||||||
|
fStatusView->SetText(kTextAuthenticating);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||||
|
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||||
|
fKeepLabel = true;
|
||||||
|
fStatusView->SetText(kTextAuthenticationFailed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_CONNECTION_LOST:
|
||||||
|
fKeepLabel = true;
|
||||||
|
fStatusView->SetText(kTextConnectionLost);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,65 +1,68 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef CONNECTION_VIEW__H
|
#ifndef CONNECTION_VIEW__H
|
||||||
#define CONNECTION_VIEW__H
|
#define CONNECTION_VIEW__H
|
||||||
|
|
||||||
#include "DialUpView.h"
|
#include <View.h>
|
||||||
|
#include <PPPDefs.h>
|
||||||
|
#include "PPPUpAddon.h"
|
||||||
|
#include <PTPSettings.h>
|
||||||
|
|
||||||
|
|
||||||
#define MSG_UPDATE 'UPDT'
|
#define MSG_UPDATE 'MUPD'
|
||||||
// sent when status changed
|
#define MSG_REPLY 'MRPY'
|
||||||
#define MSG_UP_FAILED 'UPFL'
|
|
||||||
// sent when up failed
|
|
||||||
|
|
||||||
|
|
||||||
class ConnectionView : public BView {
|
class ConnectionView : public BView {
|
||||||
friend class ConnectionWindow;
|
friend class ConnectionWindow;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionView(BRect rect, ppp_interface_id id, thread_id thread,
|
ConnectionView(BRect rect, const char *name, ppp_interface_id id,
|
||||||
DialUpView *view);
|
thread_id thread);
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
|
// for PPPUpAddon
|
||||||
|
PPPUpAddon *Addon() const
|
||||||
|
{ return fAddon; }
|
||||||
|
void Reload();
|
||||||
|
const char *Username() const
|
||||||
|
{ return fUsername->Text(); }
|
||||||
|
const char *Password() const
|
||||||
|
{ return fPassword->Text(); }
|
||||||
|
bool DoesSavePassword() const
|
||||||
|
{ return fSavePassword->Value(); }
|
||||||
|
|
||||||
|
bool HasTemporaryProfile() const
|
||||||
|
{ return !DoesSavePassword(); }
|
||||||
|
void IsDeviceModified(bool *settings, bool *profile) const
|
||||||
|
{ if(settings) *settings = false; if(profile) *profile = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Update();
|
|
||||||
void UpFailed();
|
|
||||||
void Connect();
|
void Connect();
|
||||||
void Cancel();
|
void Cancel();
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
BString AttemptString() const;
|
BString AttemptString() const;
|
||||||
|
void UpdateStatus(int32 code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
PPPUpAddon *fAddon;
|
||||||
|
BString fInterfaceName;
|
||||||
ppp_interface_id fID;
|
ppp_interface_id fID;
|
||||||
thread_id fRequestThread;
|
thread_id fReportThread;
|
||||||
BView *fAuthenticationView, *fStatusView;
|
|
||||||
DialUpView *fDUNView;
|
|
||||||
BStringView *fAttemptView;
|
|
||||||
|
|
||||||
|
BTextControl *fUsername, *fPassword;
|
||||||
|
BCheckBox *fSavePassword;
|
||||||
|
BStringView *fAttemptView, *fStatusView;
|
||||||
BButton *fConnectButton, *fCancelButton;
|
BButton *fConnectButton, *fCancelButton;
|
||||||
bool fConnecting;
|
|
||||||
|
bool fConnecting, fKeepLabel, fReplyRequested;
|
||||||
|
PTPSettings fSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,39 +1,23 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "ConnectionWindow.h"
|
#include "ConnectionWindow.h"
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
ConnectionWindow::ConnectionWindow(BRect frame, ppp_interface_id id,
|
|
||||||
|
ConnectionWindow::ConnectionWindow(BRect frame, const char *name, ppp_interface_id id,
|
||||||
thread_id replyThread)
|
thread_id replyThread)
|
||||||
: BWindow(frame, "Connecting...", B_MODAL_WINDOW,
|
: BWindow(frame, "", B_MODAL_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
BRect bounds = Bounds();
|
BString title("Connecting to ");
|
||||||
bounds.OffsetBy(bounds.Width() + 5, 0);
|
title << "\"" << name << "\"...";
|
||||||
DialUpView *dun = new DialUpView(bounds);
|
SetTitle(title.String());
|
||||||
fConnectionView = new ConnectionView(Bounds(), id, replyThread, dun);
|
fConnectionView = new ConnectionView(Bounds(), name, id, replyThread);
|
||||||
|
|
||||||
AddChild(dun);
|
|
||||||
AddChild(fConnectionView);
|
AddChild(fConnectionView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,5 +27,25 @@ ConnectionWindow::QuitRequested()
|
|||||||
{
|
{
|
||||||
fConnectionView->CleanUp();
|
fConnectionView->CleanUp();
|
||||||
|
|
||||||
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ConnectionWindow::UpdateStatus(BMessage& message)
|
||||||
|
{
|
||||||
|
message.what = MSG_UPDATE;
|
||||||
|
PostMessage(&message, fConnectionView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ConnectionWindow::ResponseTest()
|
||||||
|
{
|
||||||
|
// test if we dead-locked
|
||||||
|
Lock();
|
||||||
|
Unlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef CONNECTION_WINDOW__H
|
#ifndef CONNECTION_WINDOW__H
|
||||||
#define CONNECTION_WINDOW__H
|
#define CONNECTION_WINDOW__H
|
||||||
@ -29,9 +12,14 @@
|
|||||||
|
|
||||||
class ConnectionWindow : public BWindow {
|
class ConnectionWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
ConnectionWindow(BRect frame, ppp_interface_id id, thread_id replyThread);
|
ConnectionWindow(BRect frame, const char *name, ppp_interface_id id,
|
||||||
|
thread_id replyThread);
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
void RequestReply()
|
||||||
|
{ fConnectionView->fReplyRequested = true; }
|
||||||
|
void UpdateStatus(BMessage& message);
|
||||||
|
bool ResponseTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConnectionView *fConnectionView;
|
ConnectionView *fConnectionView;
|
||||||
|
@ -10,7 +10,17 @@ AddResources ppp_up : ppp_up.rdef ;
|
|||||||
BinCommand ppp_up :
|
BinCommand ppp_up :
|
||||||
ConnectionView.cpp
|
ConnectionView.cpp
|
||||||
ConnectionWindow.cpp
|
ConnectionWindow.cpp
|
||||||
|
PPPUpAddon.cpp
|
||||||
PPPUpApplication.cpp
|
PPPUpApplication.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs ppp_up : libdunview.a libppp.a be ;
|
LinkSharedOSLibs ppp_up : libptpnet.a libppp.a be ;
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
OBOSInstall install-networking
|
||||||
|
: /boot/beos/bin
|
||||||
|
: ppp_up ;
|
||||||
|
|
||||||
|
Package haiku-networkingkit-cvs :
|
||||||
|
ppp_up :
|
||||||
|
boot beos bin ;
|
||||||
|
@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "PPPDeskbarReplicant.h"
|
#include "PPPDeskbarReplicant.h"
|
||||||
#include "ConnectionWindow.h"
|
#include "ConnectionWindow.h"
|
||||||
|
@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef PPP_DESKBAR_REPLICANT__H
|
#ifndef PPP_DESKBAR_REPLICANT__H
|
||||||
#define PPP_DESKBAR_REPLICANT__H
|
#define PPP_DESKBAR_REPLICANT__H
|
||||||
|
@ -1,30 +1,15 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "DialUpView.h"
|
#include "DialUpView.h"
|
||||||
#include "ConnectionWindow.h"
|
#include "ConnectionWindow.h"
|
||||||
|
#include <KPPPUtils.h>
|
||||||
|
#include <PPPReportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
static const char *kSignature = "application/x-vnd.haiku.ppp_up";
|
static const char *kSignature = "application/x-vnd.haiku.ppp_up";
|
||||||
@ -32,6 +17,28 @@ static const char *kSignature = "application/x-vnd.haiku.ppp_up";
|
|||||||
extern "C" _EXPORT BView *instantiate_deskbar_item();
|
extern "C" _EXPORT BView *instantiate_deskbar_item();
|
||||||
|
|
||||||
|
|
||||||
|
class PPPUpApplication : public BApplication {
|
||||||
|
public:
|
||||||
|
PPPUpApplication(const char *name, ppp_interface_id id,
|
||||||
|
thread_id replyThread);
|
||||||
|
|
||||||
|
virtual void ReadyToRun();
|
||||||
|
|
||||||
|
const char *Name() const
|
||||||
|
{ return fName; }
|
||||||
|
ppp_interface_id ID() const
|
||||||
|
{ return fID; }
|
||||||
|
thread_id ReplyThread() const
|
||||||
|
{ return fReplyThread; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char *fName;
|
||||||
|
ppp_interface_id fID;
|
||||||
|
thread_id fReplyThread;
|
||||||
|
ConnectionWindow *fWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BView*
|
BView*
|
||||||
instantiate_deskbar_item()
|
instantiate_deskbar_item()
|
||||||
{
|
{
|
||||||
@ -44,29 +51,79 @@ static
|
|||||||
status_t
|
status_t
|
||||||
report_thread(void *data)
|
report_thread(void *data)
|
||||||
{
|
{
|
||||||
// TODO: add replicant when we finished connecting
|
PPPUpApplication *app = static_cast<PPPUpApplication*>(data);
|
||||||
|
|
||||||
|
// Send reply. From now on we will receive report messages.
|
||||||
|
send_data(app->ReplyThread(), 0, NULL, 0);
|
||||||
|
|
||||||
|
// get messages and open connection window when we receive a GOING_UP report
|
||||||
|
thread_id sender, me = find_thread(NULL);
|
||||||
|
int32 reportCode;
|
||||||
|
ppp_interface_id id;
|
||||||
|
ppp_report_packet report;
|
||||||
|
ConnectionWindow *window = NULL;
|
||||||
|
while(true) {
|
||||||
|
reportCode = receive_data(&sender, &report, sizeof(report));
|
||||||
|
if(reportCode == PPP_RESPONSE_TEST_CODE) {
|
||||||
|
if(!window || window->ResponseTest())
|
||||||
|
PPP_REPLY(sender, B_OK);
|
||||||
|
else
|
||||||
|
PPP_REPLY(sender, B_ERROR);
|
||||||
|
continue;
|
||||||
|
} else if(reportCode != PPP_REPORT_CODE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(report.type == PPP_DESTRUCTION_REPORT) {
|
||||||
|
id = PPP_UNDEFINED_INTERFACE_ID;
|
||||||
|
PPP_REPLY(sender, B_OK);
|
||||||
|
} else if(report.type != PPP_CONNECTION_REPORT) {
|
||||||
|
PPP_REPLY(sender, B_OK);
|
||||||
|
continue;
|
||||||
|
} else if(report.length == sizeof(ppp_interface_id))
|
||||||
|
memcpy(&id, report.data, sizeof(ppp_interface_id));
|
||||||
|
else
|
||||||
|
id = PPP_UNDEFINED_INTERFACE_ID;
|
||||||
|
|
||||||
|
// notify window
|
||||||
|
if(window && (report.type == PPP_DESTRUCTION_REPORT
|
||||||
|
|| report.type == PPP_CONNECTION_REPORT)) {
|
||||||
|
BMessage message;
|
||||||
|
message.AddInt32("code", report.type == PPP_DESTRUCTION_REPORT
|
||||||
|
? PPP_REPORT_DOWN_SUCCESSFUL : report.code);
|
||||||
|
message.AddInt32("interface", id);
|
||||||
|
window->UpdateStatus(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(report.code == PPP_REPORT_GOING_UP) {
|
||||||
|
// TODO:
|
||||||
|
// create connection window (it will send the reply for us) (DONE?)
|
||||||
|
BRect rect(150, 50, 450, 435);
|
||||||
|
if(!window) {
|
||||||
|
window = new ConnectionWindow(rect, app->Name(), app->ID(), me);
|
||||||
|
window->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
window->RequestReply();
|
||||||
|
// wait for reply from window and forward it to the kernel
|
||||||
|
thread_id tmp;
|
||||||
|
PPP_REPLY(sender, receive_data(&tmp, NULL, 0));
|
||||||
|
|
||||||
|
// PPP_REPLY(sender, B_OK);
|
||||||
|
// TODO: remove this when finished with above
|
||||||
|
} else {
|
||||||
|
if(report.code == PPP_REPORT_UP_SUCCESSFUL)
|
||||||
|
; // TODO: add deskbar replicant
|
||||||
|
|
||||||
|
PPP_REPLY(sender, PPP_OK_DISABLE_REPORTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PPPUpApplication : public BApplication {
|
|
||||||
public:
|
|
||||||
PPPUpApplication(const char *name, ppp_interface_id id,
|
|
||||||
thread_id replyThread);
|
|
||||||
|
|
||||||
virtual void ReadyToRun();
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char *fName;
|
|
||||||
ppp_interface_id fID;
|
|
||||||
thread_id fReplyThread;
|
|
||||||
ConnectionWindow *fWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(const char *argv[], int argc)
|
main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if(argc != 2)
|
if(argc != 2)
|
||||||
return -1;
|
return -1;
|
||||||
@ -78,9 +135,7 @@ main(const char *argv[], int argc)
|
|||||||
receive_data(&replyThread, &id, sizeof(id));
|
receive_data(&replyThread, &id, sizeof(id));
|
||||||
|
|
||||||
new PPPUpApplication(name, id, replyThread);
|
new PPPUpApplication(name, id, replyThread);
|
||||||
|
|
||||||
be_app->Run();
|
be_app->Run();
|
||||||
|
|
||||||
delete be_app;
|
delete be_app;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -92,8 +147,7 @@ PPPUpApplication::PPPUpApplication(const char *name, ppp_interface_id id,
|
|||||||
: BApplication(kSignature),
|
: BApplication(kSignature),
|
||||||
fName(name),
|
fName(name),
|
||||||
fID(id),
|
fID(id),
|
||||||
fReplyThread(replyThread),
|
fReplyThread(replyThread)
|
||||||
fWindow(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +155,9 @@ PPPUpApplication::PPPUpApplication(const char *name, ppp_interface_id id,
|
|||||||
void
|
void
|
||||||
PPPUpApplication::ReadyToRun()
|
PPPUpApplication::ReadyToRun()
|
||||||
{
|
{
|
||||||
// TODO: create report message thread (which in turn sends the reply)
|
// Create report message thread (which in turn sends the reply and creates
|
||||||
// TODO: create connection window
|
// the connection window). (DONE?)
|
||||||
|
thread_id reportThread = spawn_thread(report_thread, "ppp_up: report_thread",
|
||||||
|
B_NORMAL_PRIORITY, this);
|
||||||
|
resume_thread(reportThread);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
If has temporary profile:
|
|
||||||
Open connection window and request password.
|
|
||||||
|
|
||||||
Add Deskbar replicant.
|
Add Deskbar replicant.
|
||||||
|
|
||||||
|
I hope it is not too annoying that the user cannot select an alternative interface for connecting. The problem lies in the stack's concept that everything is an add-on. We cannot know if the connection-initiating packet type is supported by the alternative interface (or, we could, but we would have to load (and write) many add-ons that understand how the stack modules work).
|
||||||
|
This problem is minimised by showing the device view which allows changing the phone number for modems, for example.
|
||||||
|
|
||||||
What if preflet changes profile while connecting?
|
Add some indicator to the add-ons message that says we are ppp_up, not the preflet.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
pppinit.rdef
|
ppp_up.rdef
|
||||||
*/
|
*/
|
||||||
|
|
||||||
resource app_signature "application/x-vnd.haiku.ppp_up";
|
resource app_signature "application/x-vnd.haiku.ppp_up";
|
||||||
|
@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2003-2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user