network_settings/vpn: Make add-on more generic.

This commit is contained in:
Alexander von Gluck IV 2019-08-06 18:07:10 -05:00
parent 87bdc2b02b
commit 68378c326e
4 changed files with 34 additions and 34 deletions

View File

@ -13,7 +13,7 @@ SubInclude HAIKU_TOP src add-ons network_settings sshd ;
SubInclude HAIKU_TOP src add-ons network_settings telnetd ;
# VPN add-ons
SubInclude HAIKU_TOP src add-ons network_settings openvpn ;
SubInclude HAIKU_TOP src add-ons network_settings vpn ;
# Other add-ons
SubInclude HAIKU_TOP src add-ons network_settings hostname ;

View File

@ -1,18 +1,18 @@
SubDir HAIKU_TOP src add-ons network_settings openvpn ;
SubDir HAIKU_TOP src add-ons network_settings vpn ;
UsePublicHeaders [ FDirName add-ons network_settings ] ;
UsePrivateHeaders app libroot kernel net shared ;
UseHeaders [ FDirName $(HAIKU_TOP) src preferences network ] : false ;
AddResources OpenVPN : OpenVPN.rdef ;
AddResources VPNInterface : VPNInterface.rdef ;
Addon OpenVPNInterface :
OpenVPNInterfaceAddOn.cpp
Addon VPNInterface :
VPNInterfaceAddOn.cpp
: be bnetapi shared <nogrist>Network [ TargetLibsupc++ ]
[ TargetLibstdc++ ] localestub
;
DoCatalogs OpenVPNInterface : x-vnd.Haiku-OpenVPNInterface :
OpenVPNInterfaceAddOn.cpp
DoCatalogs VPNInterface : x-vnd.Haiku-VPNInterface :
VPNInterfaceAddOn.cpp
;

View File

@ -1,4 +1,4 @@
resource app_signature "application/x-vnd.Haiku-OpenVPNInterface";
resource app_signature "application/x-vnd.Haiku-VPNInterface";
resource app_version {
major = 1,
@ -7,6 +7,6 @@ resource app_version {
variety = 0,
internal = 0,
short_info = "1.0.0",
long_info = "Haiku OpenVPN connection settings"
long_info = "Haiku VPNInterface connection settings"
};

View File

@ -32,34 +32,34 @@ using namespace BNetworkKit;
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "OpenVPNInterfaceAddOn"
#define B_TRANSLATION_CONTEXT "VPNInterfaceAddOn"
static const uint32 kMsgToggleService = 'tgls';
class OpenVPNInterfaceAddOn : public BNetworkSettingsAddOn {
class VPNInterfaceAddOn : public BNetworkSettingsAddOn {
public:
OpenVPNInterfaceAddOn(image_id image,
VPNInterfaceAddOn(image_id image,
BNetworkSettings& settings);
virtual ~OpenVPNInterfaceAddOn();
virtual ~VPNInterfaceAddOn();
virtual BNetworkSettingsItem*
CreateNextItem(uint32& cookie);
};
class OpenVPNInterfaceView : public InterfaceView {
class VPNInterfaceView : public InterfaceView {
public:
OpenVPNInterfaceView(BNetworkSettings& settings);
virtual ~OpenVPNInterfaceView();
VPNInterfaceView(BNetworkSettings& settings);
virtual ~VPNInterfaceView();
};
class OpenVPNInterfaceItem : public BNetworkSettingsItem {
class VPNInterfaceItem : public BNetworkSettingsItem {
public:
OpenVPNInterfaceItem(BNetworkSettings& settings);
virtual ~OpenVPNInterfaceItem();
VPNInterfaceItem(BNetworkSettings& settings);
virtual ~VPNInterfaceItem();
virtual BNetworkSettingsType
Type() const;
@ -80,14 +80,14 @@ private:
// #pragma mark -
OpenVPNInterfaceView::OpenVPNInterfaceView(BNetworkSettings& settings)
VPNInterfaceView::VPNInterfaceView(BNetworkSettings& settings)
:
InterfaceView()
{
}
OpenVPNInterfaceView::~OpenVPNInterfaceView()
VPNInterfaceView::~VPNInterfaceView()
{
}
@ -95,7 +95,7 @@ OpenVPNInterfaceView::~OpenVPNInterfaceView()
// #pragma mark -
OpenVPNInterfaceItem::OpenVPNInterfaceItem(BNetworkSettings& settings)
VPNInterfaceItem::VPNInterfaceItem(BNetworkSettings& settings)
:
fSettings(settings),
fItem(new InterfaceListItem("My Awesome VPN",
@ -105,7 +105,7 @@ OpenVPNInterfaceItem::OpenVPNInterfaceItem(BNetworkSettings& settings)
}
OpenVPNInterfaceItem::~OpenVPNInterfaceItem()
VPNInterfaceItem::~VPNInterfaceItem()
{
if (fView->Parent() == NULL)
delete fView;
@ -115,37 +115,37 @@ OpenVPNInterfaceItem::~OpenVPNInterfaceItem()
BNetworkSettingsType
OpenVPNInterfaceItem::Type() const
VPNInterfaceItem::Type() const
{
return B_NETWORK_SETTINGS_TYPE_VPN;
}
BListItem*
OpenVPNInterfaceItem::ListItem()
VPNInterfaceItem::ListItem()
{
return fItem;
}
BView*
OpenVPNInterfaceItem::View()
VPNInterfaceItem::View()
{
if (fView == NULL)
fView = new OpenVPNInterfaceView(fSettings);
fView = new VPNInterfaceView(fSettings);
return fView;
}
status_t
OpenVPNInterfaceItem::Revert()
VPNInterfaceItem::Revert()
{
return B_OK;
}
bool
OpenVPNInterfaceItem::IsRevertable()
VPNInterfaceItem::IsRevertable()
{
// TODO
return false;
@ -155,7 +155,7 @@ OpenVPNInterfaceItem::IsRevertable()
// #pragma mark -
OpenVPNInterfaceAddOn::OpenVPNInterfaceAddOn(image_id image,
VPNInterfaceAddOn::VPNInterfaceAddOn(image_id image,
BNetworkSettings& settings)
:
BNetworkSettingsAddOn(image, settings)
@ -163,16 +163,16 @@ OpenVPNInterfaceAddOn::OpenVPNInterfaceAddOn(image_id image,
}
OpenVPNInterfaceAddOn::~OpenVPNInterfaceAddOn()
VPNInterfaceAddOn::~VPNInterfaceAddOn()
{
}
BNetworkSettingsItem*
OpenVPNInterfaceAddOn::CreateNextItem(uint32& cookie)
VPNInterfaceAddOn::CreateNextItem(uint32& cookie)
{
if (cookie++ == 0)
return new OpenVPNInterfaceItem(Settings());
return new VPNInterfaceItem(Settings());
return NULL;
}
@ -185,5 +185,5 @@ extern "C"
BNetworkSettingsAddOn*
instantiate_network_settings_add_on(image_id image, BNetworkSettings& settings)
{
return new OpenVPNInterfaceAddOn(image, settings);
return new VPNInterfaceAddOn(image, settings);
}