Network: added telnet and ftp service add-ons.
* They're old, but we still have them on our image.
This commit is contained in:
parent
33ee23acbe
commit
a6f0a92032
@ -1,5 +1,10 @@
|
||||
SubDir HAIKU_TOP src add-ons network_settings ;
|
||||
|
||||
# Interface add-ons
|
||||
SubInclude HAIKU_TOP src add-ons network_settings ipv4 ;
|
||||
SubInclude HAIKU_TOP src add-ons network_settings ipv6 ;
|
||||
|
||||
# Service add-ons
|
||||
SubInclude HAIKU_TOP src add-ons network_settings ftpd ;
|
||||
SubInclude HAIKU_TOP src add-ons network_settings sshd ;
|
||||
SubInclude HAIKU_TOP src add-ons network_settings telnetd ;
|
||||
|
165
src/add-ons/network_settings/ftpd/FTPServiceAddOn.cpp
Normal file
165
src/add-ons/network_settings/ftpd/FTPServiceAddOn.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright 2015 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, <axeld@pinc-software.de>
|
||||
*/
|
||||
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <NetworkSettings.h>
|
||||
#include <NetworkSettingsAddOn.h>
|
||||
#include <StringItem.h>
|
||||
|
||||
#include "ServiceView.h"
|
||||
|
||||
|
||||
using namespace BNetworkKit;
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "FTPServiceAddOn"
|
||||
|
||||
|
||||
class FTPServiceAddOn : public BNetworkSettingsAddOn {
|
||||
public:
|
||||
FTPServiceAddOn(image_id image,
|
||||
BNetworkSettings& settings);
|
||||
virtual ~FTPServiceAddOn();
|
||||
|
||||
virtual BNetworkSettingsItem*
|
||||
CreateNextItem(uint32& cookie);
|
||||
};
|
||||
|
||||
|
||||
class FTPServiceItem : public BNetworkSettingsItem {
|
||||
public:
|
||||
FTPServiceItem(BNetworkSettings& settings);
|
||||
virtual ~FTPServiceItem();
|
||||
|
||||
virtual BNetworkSettingsType
|
||||
Type() const;
|
||||
|
||||
virtual BListItem* ListItem();
|
||||
virtual BView* View();
|
||||
|
||||
virtual status_t Revert();
|
||||
virtual bool IsRevertable();
|
||||
|
||||
virtual void SettingsUpdated(uint32 which);
|
||||
|
||||
private:
|
||||
BNetworkSettings& fSettings;
|
||||
BStringItem* fItem;
|
||||
ServiceView* fView;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
FTPServiceItem::FTPServiceItem(BNetworkSettings& settings)
|
||||
:
|
||||
fSettings(settings),
|
||||
fItem(new BStringItem(B_TRANSLATE("FTP server"))),
|
||||
fView(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPServiceItem::~FTPServiceItem()
|
||||
{
|
||||
if (fView->Parent() == NULL)
|
||||
delete fView;
|
||||
|
||||
delete fItem;
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsType
|
||||
FTPServiceItem::Type() const
|
||||
{
|
||||
return B_NETWORK_SETTINGS_TYPE_SERVICE;
|
||||
}
|
||||
|
||||
|
||||
BListItem*
|
||||
FTPServiceItem::ListItem()
|
||||
{
|
||||
return fItem;
|
||||
}
|
||||
|
||||
|
||||
BView*
|
||||
FTPServiceItem::View()
|
||||
{
|
||||
if (fView == NULL) {
|
||||
fView = new ServiceView("ftp", "ftpd", B_TRANSLATE("FTP server"),
|
||||
B_TRANSLATE("The FTP server allows you to remotely access the "
|
||||
"files on your machine using the FTP protocol.\n\nPlease note "
|
||||
"that it is an insecure and unencrypted connection."),
|
||||
fSettings);
|
||||
}
|
||||
|
||||
return fView;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
FTPServiceItem::Revert()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
FTPServiceItem::IsRevertable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FTPServiceItem::SettingsUpdated(uint32 which)
|
||||
{
|
||||
if (fView != NULL)
|
||||
fView->SettingsUpdated(which);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
FTPServiceAddOn::FTPServiceAddOn(image_id image,
|
||||
BNetworkSettings& settings)
|
||||
:
|
||||
BNetworkSettingsAddOn(image, settings)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FTPServiceAddOn::~FTPServiceAddOn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsItem*
|
||||
FTPServiceAddOn::CreateNextItem(uint32& cookie)
|
||||
{
|
||||
if (cookie++ == 0)
|
||||
return new FTPServiceItem(Settings());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C"
|
||||
BNetworkSettingsAddOn*
|
||||
instantiate_network_settings_add_on(image_id image, BNetworkSettings& settings)
|
||||
{
|
||||
return new FTPServiceAddOn(image, settings);
|
||||
}
|
19
src/add-ons/network_settings/ftpd/Jamfile
Normal file
19
src/add-ons/network_settings/ftpd/Jamfile
Normal file
@ -0,0 +1,19 @@
|
||||
SubDir HAIKU_TOP src add-ons network_settings ftpd ;
|
||||
|
||||
UsePublicHeaders [ FDirName add-ons network_settings ] ;
|
||||
UsePrivateHeaders app libroot kernel net shared ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons network_settings sshd ] ;
|
||||
|
||||
Addon FTPService :
|
||||
FTPServiceAddOn.cpp
|
||||
ServiceView.cpp
|
||||
|
||||
: be bnetapi libshared.a <nogrist>Network [ TargetLibsupc++ ]
|
||||
[ TargetLibstdc++ ] localestub
|
||||
;
|
||||
|
||||
DoCatalogs FTPService : x-vnd.Haiku-FTPService :
|
||||
FTPServiceAddOn.cpp
|
||||
ServiceView.cpp
|
||||
;
|
19
src/add-ons/network_settings/telnetd/Jamfile
Normal file
19
src/add-ons/network_settings/telnetd/Jamfile
Normal file
@ -0,0 +1,19 @@
|
||||
SubDir HAIKU_TOP src add-ons network_settings telnetd ;
|
||||
|
||||
UsePublicHeaders [ FDirName add-ons network_settings ] ;
|
||||
UsePrivateHeaders app libroot kernel net shared ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons network_settings sshd ] ;
|
||||
|
||||
Addon TelnetService :
|
||||
TelnetServiceAddOn.cpp
|
||||
ServiceView.cpp
|
||||
|
||||
: be bnetapi libshared.a <nogrist>Network [ TargetLibsupc++ ]
|
||||
[ TargetLibstdc++ ] localestub
|
||||
;
|
||||
|
||||
DoCatalogs TelnetService : x-vnd.Haiku-TelnetService :
|
||||
TelnetServiceAddOn.cpp
|
||||
ServiceView.cpp
|
||||
;
|
166
src/add-ons/network_settings/telnetd/TelnetServiceAddOn.cpp
Normal file
166
src/add-ons/network_settings/telnetd/TelnetServiceAddOn.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright 2015 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, <axeld@pinc-software.de>
|
||||
*/
|
||||
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <NetworkSettings.h>
|
||||
#include <NetworkSettingsAddOn.h>
|
||||
#include <StringItem.h>
|
||||
|
||||
#include "ServiceView.h"
|
||||
|
||||
|
||||
using namespace BNetworkKit;
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "TelnetServiceAddOn"
|
||||
|
||||
|
||||
class TelnetServiceAddOn : public BNetworkSettingsAddOn {
|
||||
public:
|
||||
TelnetServiceAddOn(image_id image,
|
||||
BNetworkSettings& settings);
|
||||
virtual ~TelnetServiceAddOn();
|
||||
|
||||
virtual BNetworkSettingsItem*
|
||||
CreateNextItem(uint32& cookie);
|
||||
};
|
||||
|
||||
|
||||
class TelnetServiceItem : public BNetworkSettingsItem {
|
||||
public:
|
||||
TelnetServiceItem(BNetworkSettings& settings);
|
||||
virtual ~TelnetServiceItem();
|
||||
|
||||
virtual BNetworkSettingsType
|
||||
Type() const;
|
||||
|
||||
virtual BListItem* ListItem();
|
||||
virtual BView* View();
|
||||
|
||||
virtual status_t Revert();
|
||||
virtual bool IsRevertable();
|
||||
|
||||
virtual void SettingsUpdated(uint32 which);
|
||||
|
||||
private:
|
||||
BNetworkSettings& fSettings;
|
||||
BStringItem* fItem;
|
||||
ServiceView* fView;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
TelnetServiceItem::TelnetServiceItem(BNetworkSettings& settings)
|
||||
:
|
||||
fSettings(settings),
|
||||
fItem(new BStringItem(B_TRANSLATE("Telnet server"))),
|
||||
fView(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TelnetServiceItem::~TelnetServiceItem()
|
||||
{
|
||||
if (fView->Parent() == NULL)
|
||||
delete fView;
|
||||
|
||||
delete fItem;
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsType
|
||||
TelnetServiceItem::Type() const
|
||||
{
|
||||
return B_NETWORK_SETTINGS_TYPE_SERVICE;
|
||||
}
|
||||
|
||||
|
||||
BListItem*
|
||||
TelnetServiceItem::ListItem()
|
||||
{
|
||||
return fItem;
|
||||
}
|
||||
|
||||
|
||||
BView*
|
||||
TelnetServiceItem::View()
|
||||
{
|
||||
if (fView == NULL) {
|
||||
fView = new ServiceView("telnet", "telnetd",
|
||||
B_TRANSLATE("Telnet server"),
|
||||
B_TRANSLATE("The Telnet server allows you to remotely access "
|
||||
"your machine with a terminal session using the telnet "
|
||||
"protocol.\n\nPlease note that it is an insecure and "
|
||||
"unencrypted connection."), fSettings);
|
||||
}
|
||||
|
||||
return fView;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
TelnetServiceItem::Revert()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TelnetServiceItem::IsRevertable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TelnetServiceItem::SettingsUpdated(uint32 which)
|
||||
{
|
||||
if (fView != NULL)
|
||||
fView->SettingsUpdated(which);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
TelnetServiceAddOn::TelnetServiceAddOn(image_id image,
|
||||
BNetworkSettings& settings)
|
||||
:
|
||||
BNetworkSettingsAddOn(image, settings)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TelnetServiceAddOn::~TelnetServiceAddOn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsItem*
|
||||
TelnetServiceAddOn::CreateNextItem(uint32& cookie)
|
||||
{
|
||||
if (cookie++ == 0)
|
||||
return new TelnetServiceItem(Settings());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C"
|
||||
BNetworkSettingsAddOn*
|
||||
instantiate_network_settings_add_on(image_id image, BNetworkSettings& settings)
|
||||
{
|
||||
return new TelnetServiceAddOn(image, settings);
|
||||
}
|
Loading…
Reference in New Issue
Block a user