Checking in ppp_up application. This app will be responsible for prompting the user before connecting and for
adding a Deskbar replicant when a connection is established. It is not finished. The Deskbar replicant is not even started...hopefully, R1 will not be released before 2005 . ;) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8185 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
296047bc9d
commit
bbcb8882e9
@ -108,6 +108,7 @@ SubInclude OBOS_TOP src apps bin rcs ;
|
||||
# Network command line tools
|
||||
SubInclude OBOS_TOP src apps bin arp ;
|
||||
SubInclude OBOS_TOP src apps bin ifconfig ;
|
||||
SubInclude OBOS_TOP src apps bin ppp_up ;
|
||||
SubInclude OBOS_TOP src apps bin pppconfig ;
|
||||
SubInclude OBOS_TOP src apps bin ping ;
|
||||
SubInclude OBOS_TOP src apps bin route ;
|
||||
|
203
src/apps/bin/ppp_up/ConnectionView.cpp
Normal file
203
src/apps/bin/ppp_up/ConnectionView.cpp
Normal file
@ -0,0 +1,203 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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 <MessageDriverSettingsUtils.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <PPPInterface.h>
|
||||
#include <settings_tools.h>
|
||||
|
||||
|
||||
static const char *kLabelConnect = "Connect";
|
||||
static const char *kLabelCancel = "Cancel";
|
||||
|
||||
static const uint32 kMsgCancel = 'CANC';
|
||||
static const uint32 kMsgConnect = 'CONN';
|
||||
|
||||
static const uint32 kDefaultButtonWidth = 80;
|
||||
|
||||
|
||||
ConnectionView::ConnectionView(BRect rect, ppp_interface_id id, thread_id thread,
|
||||
DialUpView *dun)
|
||||
: BView(rect, "ConnectionView", B_FOLLOW_NONE, 0),
|
||||
fID(id),
|
||||
fRequestThread(thread),
|
||||
fDUNView(dun),
|
||||
fConnecting(false)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
BRect rect = Bounds();
|
||||
rect.InsetBy(5, 5);
|
||||
fAuthenticationView = dun->AuthenticationView();
|
||||
fAuthenticationView->RemoveSelf();
|
||||
fAuthenticationView->MoveTo(5, 5);
|
||||
AddChild(fAuthenticationView);
|
||||
|
||||
rect.top = fAuthenticationView->Frame().bottom + 15;
|
||||
rect.bottom = rect.top + 15;
|
||||
fAttemptView = new BStringView(rect, "AttemptView", AttemptString().String());
|
||||
AddChild(fAttemptView);
|
||||
|
||||
rect.top = rect.bottom + 5;
|
||||
fStatusView = dun->StatusView();
|
||||
fStatusView->RemoveSelf();
|
||||
fStatusView->MoveTo(5, rect.top);
|
||||
AddChild(fStatusView);
|
||||
|
||||
rect.top = fStatusView->Frame().bottom + 10;
|
||||
rect.bottom = rect.top + 25;
|
||||
rect.right = rect.left + kDefaultButtonWidth;
|
||||
fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect,
|
||||
new BMessage(kMsgConnect));
|
||||
Window()->SetDefaultButton(fConnectButton);
|
||||
|
||||
rect.left = rect.right + 10;
|
||||
rect.right = rect.left + kDefaultButtonWidth;
|
||||
fCancelButton = new BButton(rect, "CancelButton", kLabelCancel,
|
||||
new BMessage(kMsgCancel));
|
||||
|
||||
AddChild(fConnectButton);
|
||||
AddChild(fCancelButton);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::AttachedToWindow()
|
||||
{
|
||||
fConnectButton->SetTarget(this);
|
||||
fCancelButton->SetTarget(this);
|
||||
|
||||
if(fDUNView->NeedsRequest() == false)
|
||||
Connect();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::MessageReceived(BMessage *message)
|
||||
{
|
||||
switch(message->what) {
|
||||
case MSG_UPDATE:
|
||||
Update();
|
||||
break;
|
||||
|
||||
case MSG_UP_FAILED:
|
||||
UpFailed();
|
||||
break;
|
||||
|
||||
case kMsgConnect:
|
||||
Connect();
|
||||
break;
|
||||
|
||||
case kMsgCancel:
|
||||
Cancel();
|
||||
break;
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::Update()
|
||||
{
|
||||
fAttemptView->SetText(AttemptString().String());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::UpFailed()
|
||||
{
|
||||
Update();
|
||||
fConnectButton->SetEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::Connect()
|
||||
{
|
||||
BMessage settings, profile;
|
||||
fDUNView->SaveSettings(&settings, &profile, true);
|
||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||
PPPInterface interface(fID);
|
||||
interface.SetProfile(temporaryProfile);
|
||||
free_driver_settings(temporaryProfile);
|
||||
|
||||
fConnectButton->SetEnabled(false);
|
||||
fConnecting = true;
|
||||
|
||||
send_data(fRequestThread, B_OK, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConnectionView::Cancel()
|
||||
{
|
||||
if(fConnecting) {
|
||||
// only disconnect if we are not connected yet
|
||||
PPPInterface interface(fID);
|
||||
ppp_interface_info_t info;
|
||||
interface.GetInterfaceInfo(&info);
|
||||
|
||||
if(info.info.phase < PPP_ESTABLISHED_PHASE) {
|
||||
interface.Down();
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
} else {
|
||||
send_data(fRequestThread, B_ERROR, NULL, 0);
|
||||
// tell requestor to cancel connection attempt
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clean up before our window quits (called by ConnectionWindow).
|
||||
void
|
||||
ConnectionView::CleanUp()
|
||||
{
|
||||
// give the "stolen" views back to make sure they are not deleted too early
|
||||
fAuthenticationView->RemoveSelf();
|
||||
fDUNView->AddChild(fAuthenticationView);
|
||||
fStatusView->RemoveSelf();
|
||||
fDUNView->AddChild(fStatusView);
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
ConnectionView::AttemptString() const
|
||||
{
|
||||
PPPInterface interface(fID);
|
||||
ppp_interface_info_t info;
|
||||
interface.GetInterfaceInfo(&info);
|
||||
BString attempt;
|
||||
attempt << "Attempt " << info.info.dialRetry << " of " <<
|
||||
info.info.dialRetriesLimit;
|
||||
|
||||
return attempt;
|
||||
}
|
66
src/apps/bin/ppp_up/ConnectionView.h
Normal file
66
src/apps/bin/ppp_up/ConnectionView.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
#define CONNECTION_VIEW__H
|
||||
|
||||
#include "DialUpView.h"
|
||||
|
||||
|
||||
#define MSG_UPDATE 'UPDT'
|
||||
// sent when status changed
|
||||
#define MSG_UP_FAILED 'UPFL'
|
||||
// sent when up failed
|
||||
|
||||
|
||||
class ConnectionView : public BView {
|
||||
friend class ConnectionWindow;
|
||||
|
||||
public:
|
||||
ConnectionView(BRect rect, ppp_interface_id id, thread_id thread,
|
||||
DialUpView *view);
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
private:
|
||||
void Update();
|
||||
void UpFailed();
|
||||
void Connect();
|
||||
void Cancel();
|
||||
void CleanUp();
|
||||
|
||||
BString AttemptString() const;
|
||||
|
||||
private:
|
||||
ppp_interface_id fID;
|
||||
thread_id fRequestThread;
|
||||
BView *fAuthenticationView, *fStatusView;
|
||||
DialUpView *fDUNView;
|
||||
BStringView *fAttemptView;
|
||||
|
||||
BButton *fConnectButton, *fCancelButton;
|
||||
bool fConnecting;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
47
src/apps/bin/ppp_up/ConnectionWindow.cpp
Normal file
47
src/apps/bin/ppp_up/ConnectionWindow.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
ConnectionWindow::ConnectionWindow(BRect frame, ppp_interface_id id,
|
||||
thread_id replyThread)
|
||||
: BWindow(frame, "Connecting...", B_MODAL_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
|
||||
{
|
||||
BRect bounds = Bounds();
|
||||
bounds.OffsetBy(bounds.Width() + 5, 0);
|
||||
DialUpView *dun = new DialUpView(bounds);
|
||||
fConnectionView = new ConnectionView(Bounds(), id, replyThread, dun);
|
||||
|
||||
AddChild(dun);
|
||||
AddChild(fConnectionView);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ConnectionWindow::QuitRequested()
|
||||
{
|
||||
fConnectionView->CleanUp();
|
||||
|
||||
return true;
|
||||
}
|
41
src/apps/bin/ppp_up/ConnectionWindow.h
Normal file
41
src/apps/bin/ppp_up/ConnectionWindow.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
#define CONNECTION_WINDOW__H
|
||||
|
||||
#include <Window.h>
|
||||
#include "ConnectionView.h"
|
||||
|
||||
|
||||
class ConnectionWindow : public BWindow {
|
||||
public:
|
||||
ConnectionWindow(BRect frame, ppp_interface_id id, thread_id replyThread);
|
||||
|
||||
virtual bool QuitRequested();
|
||||
|
||||
private:
|
||||
ConnectionView *fConnectionView;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
16
src/apps/bin/ppp_up/Jamfile
Normal file
16
src/apps/bin/ppp_up/Jamfile
Normal file
@ -0,0 +1,16 @@
|
||||
SubDir OBOS_TOP src apps bin ppp_up ;
|
||||
|
||||
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 ] ;
|
||||
|
||||
AddResources ppp_up : ppp_up.rdef ;
|
||||
|
||||
BinCommand ppp_up :
|
||||
ConnectionView.cpp
|
||||
ConnectionWindow.cpp
|
||||
PPPUpApplication.cpp
|
||||
;
|
||||
|
||||
LinkSharedOSLibs ppp_up : libdunview.a libppp.a be ;
|
34
src/apps/bin/ppp_up/PPPDeskbarReplicant.cpp
Normal file
34
src/apps/bin/ppp_up/PPPDeskbarReplicant.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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 "ConnectionWindow.h"
|
||||
|
||||
|
||||
PPPDeskbarReplicant::PPPDeskbarReplicant()
|
||||
: BView(BRect(0, 0, 15, 15), "PPPDeskbarReplicant", B_FOLLOW_NONE, 0)
|
||||
{
|
||||
BRect rect(0, 0, 300, 250);
|
||||
fWindow = new ConnectionWindow(rect, id, sender);
|
||||
fWindow->MoveTo(center_on_screen(rect, fWindow));
|
||||
fWindow->Show();
|
||||
}
|
35
src/apps/bin/ppp_up/PPPDeskbarReplicant.h
Normal file
35
src/apps/bin/ppp_up/PPPDeskbarReplicant.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
#define PPP_DESKBAR_REPLICANT__H
|
||||
|
||||
#include <View.h>
|
||||
|
||||
|
||||
class PPPDeskbarReplicant : public BView {
|
||||
public:
|
||||
PPPDeskbarReplicant();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
106
src/apps/bin/ppp_up/PPPUpApplication.cpp
Normal file
106
src/apps/bin/ppp_up/PPPUpApplication.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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 <Window.h>
|
||||
|
||||
#include "DialUpView.h"
|
||||
#include "ConnectionWindow.h"
|
||||
|
||||
|
||||
static const char *kSignature = "application/x-vnd.haiku.ppp_up";
|
||||
|
||||
extern "C" _EXPORT BView *instantiate_deskbar_item();
|
||||
|
||||
|
||||
BView*
|
||||
instantiate_deskbar_item()
|
||||
{
|
||||
// TODO: implement me!
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
status_t
|
||||
report_thread(void *data)
|
||||
{
|
||||
// TODO: add replicant when we finished connecting
|
||||
|
||||
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
|
||||
main(const char *argv[], int argc)
|
||||
{
|
||||
if(argc != 2)
|
||||
return -1;
|
||||
|
||||
const char *name = argv[1];
|
||||
|
||||
thread_id replyThread;
|
||||
ppp_interface_id id;
|
||||
receive_data(&replyThread, &id, sizeof(id));
|
||||
|
||||
new PPPUpApplication(name, id, replyThread);
|
||||
|
||||
be_app->Run();
|
||||
|
||||
delete be_app;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PPPUpApplication::PPPUpApplication(const char *name, ppp_interface_id id,
|
||||
thread_id replyThread)
|
||||
: BApplication(kSignature),
|
||||
fName(name),
|
||||
fID(id),
|
||||
fReplyThread(replyThread),
|
||||
fWindow(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PPPUpApplication::ReadyToRun()
|
||||
{
|
||||
// TODO: create report message thread (which in turn sends the reply)
|
||||
// TODO: create connection window
|
||||
}
|
7
src/apps/bin/ppp_up/README
Normal file
7
src/apps/bin/ppp_up/README
Normal file
@ -0,0 +1,7 @@
|
||||
Usage:
|
||||
ppp_up INTERFACENAME
|
||||
|
||||
The app waits until it receives a thread message containing the interface id. The sender of this message will wait for a reply that indicates that ppp_up is ready to run. The replying thread will be registered as a report message receiver (no reply timeout).
|
||||
If the interface is configured to ask the user before dialing or if the password is missing although a login is needed, ppp_up will open a request window and wait for the user to enter the login information. All changes will be saved. Actually, the login view that is presented to the user is the same as the one used in the dial-up settings (including its behaviour).
|
||||
|
||||
If a connection could be established ppp_up will add a connection status replicant to the Deskbar.
|
7
src/apps/bin/ppp_up/TODO
Normal file
7
src/apps/bin/ppp_up/TODO
Normal file
@ -0,0 +1,7 @@
|
||||
If has temporary profile:
|
||||
Open connection window and request password.
|
||||
|
||||
Add Deskbar replicant.
|
||||
|
||||
|
||||
What if preflet changes profile while connecting?
|
37
src/apps/bin/ppp_up/ppp_up.rdef
Normal file
37
src/apps/bin/ppp_up/ppp_up.rdef
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
pppinit.rdef
|
||||
*/
|
||||
|
||||
resource app_signature "application/x-vnd.haiku.ppp_up";
|
||||
|
||||
/* BEOS:APP_FLAGS :
|
||||
00000000 = SINGLE LAUNCH
|
||||
00000001 = MULTIPLE LAUNCH
|
||||
00000002 = EXCLUSIVE LAUNCH
|
||||
00000004 = BACKGROUND APP + SINGLE LAUNCH
|
||||
00000005 = BACKGROUND APP + MULTIPLE LAUNCH
|
||||
00000006 = BACKGROUND APP + EXCLUSIVE LAUNCH
|
||||
00000008 = ARGV_ONLY + SINGLE LAUNCH
|
||||
00000009 = ARGV_ONLY + MULTIPLE LAUNCH
|
||||
0000000A = ARGV_ONLY + EXCLUSIVE LAUNCH
|
||||
0000000C = ARGV_ONLY + BACKGROUND APP + SINGLE LAUNCH
|
||||
0000000D = ARGV_ONLY + BACKGROUND APP + MULTIPLE LAUNCH
|
||||
0000000E = ARGV_ONLY + BACKGROUND APP + EXCLUSIVE LAUNCH
|
||||
*/
|
||||
|
||||
resource app_flags 0x00000005;
|
||||
|
||||
resource app_version {
|
||||
major = 0,
|
||||
middle = 1,
|
||||
minor = 0,
|
||||
|
||||
/* 0 = development 1 = alpha 2 = beta
|
||||
3 = gamma 4 = golden master 5 = final */
|
||||
variety = 0,
|
||||
|
||||
internal = 0,
|
||||
|
||||
short_info = "ppp_up",
|
||||
long_info = "PPP interface GUI initialization app."
|
||||
};
|
@ -1,9 +1,24 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//
|
||||
// Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
//-----------------------------------------------------------------------
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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 <String.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user