From b99db6aa82bcdba086ec51c292415b1a2bdb8cf7 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 17:44:39 -0500 Subject: Reactivate strongswan VPN plugin --- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/strongswan/AUTHORS | 2 + .../vpn-plugins/strongswan/CMakeLists.txt | 14 ++ tdenetworkmanager/vpn-plugins/strongswan/authors | 1 - .../strongswan/knetworkmanager_strongswan.desktop | 21 -- .../strongswan/src/knetworkmanager-strongswan.cpp | 234 ------------------ .../strongswan/src/knetworkmanager-strongswan.h | 99 -------- .../strongswan/src/tdenetman-strongswan.cpp | 267 +++++++++++++++++++++ .../strongswan/src/tdenetman-strongswan.h | 103 ++++++++ .../strongswan/tdenetman_strongswan.desktop | 21 ++ 10 files changed, 408 insertions(+), 356 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/AUTHORS create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/authors delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop (limited to 'tdenetworkmanager') diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt index 2643aad..d5f6e8e 100644 --- a/tdenetworkmanager/vpn-plugins/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -11,5 +11,5 @@ add_subdirectory( openvpn ) add_subdirectory( pptp ) -# add_subdirectory( strongswan ) +add_subdirectory( strongswan ) add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS new file mode 100644 index 0000000..242ed99 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS @@ -0,0 +1,2 @@ +Timothy Pearson +Thomas Kallenberg , diff --git a/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt new file mode 100644 index 0000000..05b45b3 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_strongswan.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/strongswan/authors b/tdenetworkmanager/vpn-plugins/strongswan/authors deleted file mode 100644 index 06c50d3..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/authors +++ /dev/null @@ -1 +0,0 @@ -Thomas Kallenberg , diff --git a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop deleted file mode 100644 index 2ea51d3..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop +++ /dev/null @@ -1,21 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_strongswan -X-NetworkManager-Services=strongswan -X-TDE-PluginInfo-Author=Thomas Kallenberg -X-TDE-PluginInfo-Email=tkallenb@hsr.ch -X-TDE-PluginInfo-Name=knetworkmanager_strongswan -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=StrongSwan -Name[xx]=xxStrongSwanxx -Comment=StrongSwan -Comment[xx]=xxStrongSwanxx - diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp deleted file mode 100644 index 7abe62d..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-strongswan.cpp - A NetworkManager frontend for TDE - * - * Author: Thomas Kallenberg , - * - * Strongly based on the Code of Helmut Schaa - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-strongswan.h" - -typedef KGenericFactory StrongswanPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan")); - - -StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args) - : VPNPlugin(parent, name, args) -{ - KLocale* loc = KGlobal::locale(); - loc->insertCatalogue("NetworkManager-strongswan"); -} - -StrongswanPlugin::~StrongswanPlugin() -{ - -} - -VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent) -{ - return new StrongswanConfig(parent); -} - -VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent) -{ - return new StrongswanAuthentication(parent); -} - - -StrongswanConfig::StrongswanConfig(TQWidget* parent) - : VPNConfigWidget(parent) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _strongswanWidget = new StrongswanConfigWidget(this); - layout->addWidget(_strongswanWidget); - - /* TODO not sure if we need this here */ - this->languageChange(); -} - -StrongswanConfig::~StrongswanConfig() -{ - -} - -void StrongswanConfig::languageChange() -{ - -} - - // usercert agent password userkey -StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop) -{ - if (prop == 0) - return psk; - else if (prop == 1) - return key; - else if (prop == 2) - return agent; - return UNKNOWN; -} - -int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) -{ - switch(connType) - { - case psk: - return 0; - case key: - return 1; - case agent: - return 2; - default: - return -1; - } - return -1; -} - -void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap& properties) -{ - // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - TQString entry = it.key(); - TQString value = it.data(); - - if (entry == "gateway") - { - _strongswanWidget->gateway->setText(value); - } - else if (entry == "certificate") - { - _strongswanWidget->certificate->setURL(value); - } - else if (entry == "username") - { - _strongswanWidget->username->setText(value); - } - else if (entry == "method") - { - StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); - _strongswanWidget->authtype->setCurrentItem(type); - } - // Options - else if (entry == "chkUDPenc") - { - _strongswanWidget->chkUDPenc->setChecked(value == "true"); - } - else if (entry == "chkIPcomp") - { - _strongswanWidget->chkIPcomp->setChecked(value == "true"); - } - else if (entry == "chkIPinner") - { - _strongswanWidget->chkIPinner->setChecked(value == "true"); - } - } -} - -TQMap StrongswanConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - - strlist.insert("gateway", TQString(_strongswanWidget->gateway->text())); - strlist.insert("certificate", TQString(_strongswanWidget->certificate->url())); - strlist.insert("username", TQString(_strongswanWidget->username->text())); - strlist.insert("method", - TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem()))); - - if (_strongswanWidget->chkUDPenc->isChecked()) - strlist.insert("encap", TQString("yes")); - - if (_strongswanWidget->chkIPcomp->isChecked()) - strlist.insert("ipcomp", TQString("yes")); - - if (_strongswanWidget->chkIPinner->isChecked()) - strlist.insert("virtual", TQString("yes")); - - return strlist; -} - -TQStringList StrongswanConfig::getVPNRoutes() -{ - TQStringList strlist; - /*if(_strongswanWidget->chkIPAdresses->isChecked()) - { - strlist = TQStringList::split(" ", _strongswanWidget->routes->text()); - } - */ - return strlist; - -} - -bool StrongswanConfig::hasChanged() -{ - return true; -} - -bool StrongswanConfig::isValid(TQStringList& err_msg) -{ - bool retval = true; - if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "") - { - err_msg.append(i18n("At least the gateway and group has to be supplied.")); - retval = false; - } - return retval; -} - -StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name) - : VPNAuthenticationWidget(parent, name) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _strongswanAuth = new StrongswanAuthenticationWidget(this); - layout->addWidget(_strongswanAuth); -} - -StrongswanAuthentication::~StrongswanAuthentication() -{ - -} - -TQMap StrongswanAuthentication::getPasswords() -{ - TQMap pwds; - pwds.insert("user", TQString(_strongswanAuth->username->text())); - pwds.insert("password", TQString(_strongswanAuth->password->password())); - return pwds; -} - -void StrongswanAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { - _strongswanAuth->password->erase(); - _strongswanAuth->password->insert(value); - } -} \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h deleted file mode 100644 index 341d25d..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-strongswan.h - A NetworkManager frontend for TDE - * - * Author: Thomas Kallenberg , - * - * Strongly based on the Code of Helmut Schaa - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_STRONGSWAN_H -#define KNETWORKMANAGER_STRONGSWAN_H - -#include -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "strongswanprop.h" -#include "strongswanauth.h" - -class StrongswanPlugin : public VPNPlugin -{ - Q_OBJECT - - public: - StrongswanPlugin(TQObject*, const char*, const TQStringList&); - ~StrongswanPlugin(); - - VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); - VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); -}; - -class StrongswanConnectionType -{ - public: - enum CONNECTIONTYPE - { - UNKNOWN = -1 - , psk = 0 - , key - , agent - }; - - static CONNECTIONTYPE mapString2ConnectionType(int string); - static int mapConnectionType2String(CONNECTIONTYPE connectionType); -}; - -class StrongswanConfig : public VPNConfigWidget -{ - Q_OBJECT - - public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap getVPNProperties(); - TQStringList getVPNRoutes(); - bool hasChanged(); - bool isValid(TQStringList& ); - - StrongswanConfig(TQWidget* parent); - ~StrongswanConfig(); - - private: - StrongswanConfigWidget* _strongswanWidget; - - protected slots: - void languageChange(); -}; - -class StrongswanAuthentication : public VPNAuthenticationWidget -{ - Q_OBJECT - - public: - StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~StrongswanAuthentication(); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); - - private: - StrongswanAuthenticationWidget* _strongswanAuth; -}; - -#endif /* KNETWORKMANAGER_STRONGSWAN_H */ diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp new file mode 100644 index 0000000..a0826bd --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp @@ -0,0 +1,267 @@ +/*************************************************************************** + * + * knetworkmanager-strongswan.cpp - A NetworkManager frontend for TDE + * + * Author: Thomas Kallenberg , + * + * Strongly based on the Code of Helmut Schaa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-strongswan.h" + +typedef KGenericFactory StrongswanPluginFactory; +K_EXPORT_COMPONENT_FACTORY( tdenetman_strongswan, StrongswanPluginFactory("tdenetman_strongswan")); + + +StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + KLocale* loc = KGlobal::locale(); + loc->insertCatalogue("NetworkManager-strongswan"); +} + +StrongswanPlugin::~StrongswanPlugin() +{ + +} + +VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new StrongswanConfig(parent); +} + +VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new StrongswanAuthentication(parent); +} + + +StrongswanConfig::StrongswanConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _strongswanWidget = new StrongswanConfigWidget(this); + layout->addWidget(_strongswanWidget); + + /* TODO not sure if we need this here */ + this->languageChange(); +} + +StrongswanConfig::~StrongswanConfig() +{ + +} + +void StrongswanConfig::languageChange() +{ + +} + +// usercert agent password userkey +StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop) +{ + if (prop == 0) + return psk; + else if (prop == 1) + return key; + else if (prop == 2) + return agent; + return UNKNOWN; +} + +int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) +{ + switch(connType) + { + case psk: + return 0; + case key: + return 1; + case agent: + return 2; + default: + return -1; + } + return -1; +} + +void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) +{ + m_vpnProperties = properties; + m_vpnSecrets = secrets; + + // fill up our inputfields (only textfields atm) + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "gateway") + { + _strongswanWidget->gateway->setText(value); + } + else if (entry == "certificate") + { + _strongswanWidget->certificate->setURL(value); + } + else if (entry == "username") + { + _strongswanWidget->username->setText(value); + } + else if (entry == "method") + { + StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); + _strongswanWidget->authtype->setCurrentItem(type); + } + // Options + else if (entry == "chkUDPenc") + { + _strongswanWidget->chkUDPenc->setChecked(value == "true"); + } + else if (entry == "chkIPcomp") + { + _strongswanWidget->chkIPcomp->setChecked(value == "true"); + } + else if (entry == "chkIPinner") + { + _strongswanWidget->chkIPinner->setChecked(value == "true"); + } + } +} + +TDENetworkSettingsMap StrongswanConfig::getVPNProperties() +{ + // Build a list of properties + m_vpnProperties.insert("gateway", TQString(_strongswanWidget->gateway->text())); + m_vpnProperties.insert("certificate", TQString(_strongswanWidget->certificate->url())); + m_vpnProperties.insert("username", TQString(_strongswanWidget->username->text())); + m_vpnProperties.insert("method", TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem()))); + + if (_strongswanWidget->chkUDPenc->isChecked()) { + m_vpnProperties.insert("encap", TQString("yes")); + } + else { + m_vpnProperties.remove("encap"); + } + + if (_strongswanWidget->chkIPcomp->isChecked()) { + m_vpnProperties.insert("ipcomp", TQString("yes")); + } + else { + m_vpnProperties.remove("ipcomp"); + } + + if (_strongswanWidget->chkIPinner->isChecked()) { + m_vpnProperties.insert("virtual", TQString("yes")); + } + else { + m_vpnProperties.remove("virtual"); + } + + return m_vpnProperties; +} + +TDENetworkSettingsMap StrongswanConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList StrongswanConfig::getVPNRoutes() +{ + TDENetworkSingleRouteConfigurationList ret; +#if 0 + TQStringList strlist; + if(_strongswanWidget->chkIPAdresses->isChecked()) { + strlist = TQStringList::split(" ", _strongswanWidget->routes->text()); + } + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } +#endif + + return ret; + +} + +bool StrongswanConfig::hasChanged() +{ + return true; +} + +bool StrongswanConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "") + { + err_msg.append(i18n("At least the gateway and group has to be supplied.")); + retval = false; + } + return retval; +} + +StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _strongswanAuth = new StrongswanAuthenticationWidget(this); + layout->addWidget(_strongswanAuth); +} + +StrongswanAuthentication::~StrongswanAuthentication() +{ + +} + +TDENetworkSettingsMap StrongswanAuthentication::getPasswords() +{ + TQMap pwds; + pwds.insert("user", TQString(_strongswanAuth->username->text())); + pwds.insert("password", TQString(_strongswanAuth->password->password())); + return pwds; +} + +void StrongswanAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { + _strongswanAuth->password->erase(); + _strongswanAuth->password->insert(secrets["password"]); + } +} + +#include "tdenetman-strongswan.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h new file mode 100644 index 0000000..c1229ab --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * + * knetworkmanager-strongswan.h - A NetworkManager frontend for TDE + * + * Author: Thomas Kallenberg , + * + * Strongly based on the Code of Helmut Schaa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#ifndef KNETWORKMANAGER_STRONGSWAN_H +#define KNETWORKMANAGER_STRONGSWAN_H + +#include +#include +#include +#include + +#include "tdenetman-vpnplugin.h" +#include "strongswanprop.h" +#include "strongswanauth.h" + +class StrongswanPlugin : public VPNPlugin +{ + Q_OBJECT + + public: + StrongswanPlugin(TQObject*, const char*, const TQStringList&); + ~StrongswanPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class StrongswanConnectionType +{ + public: + enum CONNECTIONTYPE + { + UNKNOWN = -1 + , psk = 0 + , key + , agent + }; + + static CONNECTIONTYPE mapString2ConnectionType(int string); + static int mapConnectionType2String(CONNECTIONTYPE connectionType); +}; + +class StrongswanConfig : public VPNConfigWidget +{ + Q_OBJECT + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList& ); + + StrongswanConfig(TQWidget* parent); + ~StrongswanConfig(); + + private: + StrongswanConfigWidget* _strongswanWidget; + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + + protected slots: + void languageChange(); +}; + +class StrongswanAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~StrongswanAuthentication(); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + + private: + StrongswanAuthenticationWidget* _strongswanAuth; +}; + +#endif /* KNETWORKMANAGER_STRONGSWAN_H */ diff --git a/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop new file mode 100644 index 0000000..7026d04 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_strongswan +X-NetworkManager-Services=strongswan +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_strongswan +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=StrongSwan +Name[xx]=xxStrongSwanxx +Comment=StrongSwan +Comment[xx]=xxStrongSwanxx + -- cgit v1.2.3