parent
2d50217489
commit
6b4b40b1e1
@ -1,41 +0,0 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2012 Timothy Pearson
|
||||
# kb9vqf (AT) pearsoncomputing (DOT) net
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/tdenetworkmanager/src
|
||||
${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings
|
||||
${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets
|
||||
${TDE_INCLUDE_DIR}
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${DBUS_TQT_INCLUDE_DIRS}
|
||||
${NM_UTIL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
##### tdenetwork-connection-settings ############
|
||||
|
||||
set( target tdenetwork-connection-settings )
|
||||
|
||||
set( ${target}_SRCS
|
||||
knetworkmanager-connection_setting.cpp
|
||||
knetworkmanager-connection_setting_info.cpp knetworkmanager-connection_setting_ipv4.cpp
|
||||
knetworkmanager-connection_setting_wired.cpp knetworkmanager-connection_setting_wireless.cpp
|
||||
knetworkmanager-connection_setting_wireless_security.cpp
|
||||
knetworkmanager-connection_setting_8021x.cpp knetworkmanager-connection_setting_vpn.cpp
|
||||
knetworkmanager-connection_setting_serial.cpp knetworkmanager-connection_setting_cdma.cpp
|
||||
knetworkmanager-connection_setting_gsm.cpp knetworkmanager-connection_setting_ppp.cpp
|
||||
)
|
||||
|
||||
tde_add_library( ${target} STATIC_PIC AUTOMOC
|
||||
SOURCES ${${target}_SRCS}
|
||||
)
|
@ -1,106 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting.h"
|
||||
#include "tdenetman-connection.h"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class ConnectionSetting
|
||||
*/
|
||||
ConnectionSetting::ConnectionSetting(Connection* conn, TQString type, const char* name, bool enabled)
|
||||
: TQObject(conn, name)
|
||||
{
|
||||
_type = type;
|
||||
_enabled = enabled;
|
||||
_conn = conn;
|
||||
}
|
||||
|
||||
ConnectionSetting::ConnectionSetting(const ConnectionSetting& setting)
|
||||
: TQObject()
|
||||
{
|
||||
_type = setting.getType();
|
||||
_enabled = setting.getEnabled();
|
||||
_conn = setting.getConnection();
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
ConnectionSetting::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
kdDebug() << "ConnectionSetting::toSecretsMap" << endl;
|
||||
return SettingsMap();
|
||||
}
|
||||
|
||||
bool
|
||||
ConnectionSetting::fromSecretsMap(const SettingsMap& /*map*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ConnectionSetting::getEnabled(void) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TQString
|
||||
ConnectionSetting::getType(void) const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
Connection*
|
||||
ConnectionSetting::getConnection(void) const
|
||||
{
|
||||
return _conn;
|
||||
}
|
||||
|
||||
bool
|
||||
ConnectionSetting::hasSecrets(void) const
|
||||
{
|
||||
return !(toSecretsMap(false).isEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
ConnectionSetting::emitValidityChanged()
|
||||
{
|
||||
emit validityChanged();
|
||||
}
|
||||
|
||||
#include "tdenetman-connection_setting.moc"
|
@ -1,94 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_H
|
||||
|
||||
#include <tqmap.h>
|
||||
#include <tqobject.h>
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
/*
|
||||
Annotation: hopefully we can convert these to
|
||||
TQMap<TQString, TQVariant> when switching to TQt4
|
||||
*/
|
||||
typedef TQMap<TQString, TQT_DBusData> SettingsMap;
|
||||
|
||||
class Connection;
|
||||
|
||||
// the base class for all settings
|
||||
class ConnectionSetting : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConnectionSetting(Connection* conn, TQString type, const char* name = 0, bool enabled = true);
|
||||
ConnectionSetting(const ConnectionSetting&);
|
||||
|
||||
// serialize the setting to a map
|
||||
virtual SettingsMap toMap() const = 0;
|
||||
|
||||
// serialize the secrets to a map
|
||||
virtual SettingsMap toSecretsMap(bool withSettings = true) const;
|
||||
|
||||
// initialize setting from a settingsmap
|
||||
virtual void fromMap(const SettingsMap&) = 0;
|
||||
|
||||
// set secrtes from a secretsmap
|
||||
virtual bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
// return whether this setting should be used or not
|
||||
virtual bool getEnabled(void) const;
|
||||
|
||||
// return whether this setting is valid or not
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
// return the settings type
|
||||
TQString getType(void) const;
|
||||
|
||||
// return the connection this setting belongs to
|
||||
Connection* getConnection(void) const;
|
||||
|
||||
// return whether the setting has secrets or not
|
||||
virtual bool hasSecrets(void) const;
|
||||
|
||||
signals:
|
||||
void validityChanged();
|
||||
|
||||
protected:
|
||||
void emitValidityChanged();
|
||||
|
||||
// parent-connection
|
||||
Connection* _conn;
|
||||
|
||||
private:
|
||||
TQString _type;
|
||||
bool _enabled;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_H */
|
@ -1,380 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_8021x.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_8021x.h"
|
||||
#include "tdenetman-accesspoint.h"
|
||||
#include "tdenetman-connection_setting_wireless.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "sha1.h"
|
||||
#include "md5.h"
|
||||
|
||||
#define WPA_PMK_LEN 32
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class IEEE8021x
|
||||
*/
|
||||
IEEE8021x::IEEE8021x(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_802_1X_SETTING_NAME)
|
||||
, _eap(EAP_PHASE1_NONE)
|
||||
, _identity(TQString())
|
||||
, _anonIdentity(TQString())
|
||||
, _caPath(TQString())
|
||||
, _phase1PeapVer(TQString())
|
||||
, _phase1PeapLabel(TQString())
|
||||
, _phase1FastProvisioning(TQString())
|
||||
, _eapPhase2(EAP_PHASE2_AUTH_NONE)
|
||||
, _phase2AuthEAP(TQString())
|
||||
, _phase2CaPath(TQString())
|
||||
, _useSystemCaCert(false)
|
||||
{
|
||||
// init eap map
|
||||
_eapMap[EAP_NONE] = TQString();
|
||||
_eapMap[EAP_LEAP] = "leap";
|
||||
_eapMap[EAP_MD5] = "md5";
|
||||
_eapMap[EAP_PAP] = "pap";
|
||||
_eapMap[EAP_CHAP] = "chap";
|
||||
_eapMap[EAP_MSCHAP] = "mschap";
|
||||
_eapMap[EAP_MSCHAPV2] = "mschapv2";
|
||||
_eapMap[EAP_FAST] = "fast";
|
||||
_eapMap[EAP_PSK] = "psk";
|
||||
_eapMap[EAP_PAX] = "pax";
|
||||
_eapMap[EAP_SAKE] = "sake";
|
||||
_eapMap[EAP_GPSK] = "gpsk";
|
||||
_eapMap[EAP_TLS] = "tls";
|
||||
_eapMap[EAP_PEAP] = "peap";
|
||||
_eapMap[EAP_TTLS] = "ttls";
|
||||
_eapMap[EAP_SIM] = "sim";
|
||||
_eapMap[EAP_GTC] = "gtc";
|
||||
_eapMap[EAP_OTP] = "otp";
|
||||
}
|
||||
|
||||
TQString
|
||||
IEEE8021x::getIdentity(void) const
|
||||
{
|
||||
return _identity;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setIdentity(const TQString & identity)
|
||||
{
|
||||
_identity = identity;
|
||||
}
|
||||
|
||||
TQString
|
||||
IEEE8021x::getAnonIdentity(void) const
|
||||
{
|
||||
return _anonIdentity;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setAnonIdentity(const TQString & identity)
|
||||
{
|
||||
_anonIdentity = identity;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setPassword(const TQString& pwd)
|
||||
{
|
||||
_password = pwd;
|
||||
}
|
||||
|
||||
TQString
|
||||
IEEE8021x::getPassword(void) const
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
|
||||
bool
|
||||
IEEE8021x::getUseSystemCaCert(void) const
|
||||
{
|
||||
return _useSystemCaCert;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setUseSystemCaCert(bool use)
|
||||
{
|
||||
_useSystemCaCert = use;
|
||||
}
|
||||
|
||||
IEEE8021x::EAP_PHASE1
|
||||
IEEE8021x::getEAP(void) const
|
||||
{
|
||||
return _eap;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setEAP(EAP_PHASE1 eap)
|
||||
{
|
||||
_eap = eap;
|
||||
}
|
||||
|
||||
IEEE8021x::EAP_PHASE2
|
||||
IEEE8021x::getPhase2EAP(void) const
|
||||
{
|
||||
return _eapPhase2;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::setPhase2EAP(EAP_PHASE2 eap)
|
||||
{
|
||||
_eapPhase2 = eap;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
IEEE8021x::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// EAP
|
||||
TQString eap = _eapMap[(EAP)_eap];
|
||||
if (!eap.isEmpty())
|
||||
{
|
||||
TQValueList<TQT_DBusData> eap_methods;
|
||||
eap_methods.append(TQT_DBusData::fromString(eap));
|
||||
map.insert(NM_SETTING_802_1X_EAP, TQT_DBusData::fromTQValueList(eap_methods));
|
||||
}
|
||||
// Phase2 EAP
|
||||
if (_eapPhase2 != EAP_PHASE2_AUTH_NONE)
|
||||
{
|
||||
map.insert(NM_SETTING_802_1X_PHASE2_AUTH, TQT_DBusData::fromString(_eapMap[(EAP)_eapPhase2]));
|
||||
}
|
||||
|
||||
if (!_identity.isEmpty())
|
||||
map.insert(NM_SETTING_802_1X_IDENTITY, TQT_DBusData::fromString(_identity));
|
||||
|
||||
if (!_anonIdentity.isEmpty())
|
||||
map.insert(NM_SETTING_802_1X_ANONYMOUS_IDENTITY, TQT_DBusData::fromString(_anonIdentity));
|
||||
|
||||
// FIXME
|
||||
/*
|
||||
if (!_caCert.isNull())
|
||||
map.insert("ca-cert", TQT_DBusData::fromString(_caCert));
|
||||
*/
|
||||
|
||||
if (!_caPath.isEmpty())
|
||||
map.insert(NM_SETTING_802_1X_CA_PATH, TQT_DBusData::fromString(_caPath));
|
||||
|
||||
if (!eap.isEmpty())
|
||||
map.insert(NM_SETTING_802_1X_SYSTEM_CA_CERTS, TQT_DBusData::fromBool(_useSystemCaCert));
|
||||
|
||||
//FIXME
|
||||
/*
|
||||
if (!_clientCert.isNull())
|
||||
map.insert("client-cert", TQT_DBusData::fromString(_clientCert));
|
||||
|
||||
if (!_privateKey.isNull())
|
||||
map.insert("private-key", TQT_DBusData::fromString(_privateKey));
|
||||
*/
|
||||
|
||||
if (!_phase1PeapVer.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE1_PEAPVER, TQT_DBusData::fromString(_phase1PeapVer));
|
||||
|
||||
if (!_phase1PeapLabel.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE1_PEAPLABEL, TQT_DBusData::fromString(_phase1PeapLabel));
|
||||
|
||||
if (!_phase1FastProvisioning.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, TQT_DBusData::fromString(_phase1FastProvisioning));
|
||||
|
||||
if (!_phase2AuthEAP.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE2_AUTHEAP, TQT_DBusData::fromString(_phase2AuthEAP));
|
||||
|
||||
// FIXME
|
||||
/*
|
||||
if (!_phase2CaCert.isNull())
|
||||
map.insert("phase2-ca-cert", TQVariant(_phase2CaCert));
|
||||
*/
|
||||
|
||||
if (!_phase2CaPath.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE2_CA_PATH, TQT_DBusData::fromString(_phase2CaPath));
|
||||
|
||||
// FIXME
|
||||
/*
|
||||
if (!_phase2ClientCert.isNull())
|
||||
map.insert("phase2-client-cert", TQVariant(_phase2ClientCert));
|
||||
|
||||
if (!_phase2PrivateKey.isNull())
|
||||
map.insert("phase2-private-key", TQVariant(_phase2PrivateKey));
|
||||
*/
|
||||
|
||||
if(!_password.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(""));
|
||||
/*
|
||||
899 g_hash_table_insert (hash, "password", string_to_gvalue (self->password));
|
||||
900 if (self->pin)
|
||||
901 g_hash_table_insert (hash, "pin", string_to_gvalue (self->pin));
|
||||
902 if (self->eappsk)
|
||||
903 g_hash_table_insert (hash, "eappsk", string_to_gvalue (self->eappsk));
|
||||
904 if (self->private_key_passwd)
|
||||
905 g_hash_table_insert (hash, "private-key-passwd", string_to_gvalue (self->private_key_passwd));
|
||||
906 if (self->phase2_private_key_passwd)
|
||||
907 g_hash_table_insert (hash, "phase2-private-key-passwd", string_to_gvalue (self->phase2_private_key_passwd));
|
||||
*/
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
IEEE8021x::fromMap(const SettingsMap& map)
|
||||
{
|
||||
kdDebug() << "IEEE8021x::fromMap" << endl;
|
||||
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if(it.key() == NM_SETTING_802_1X_EAP)
|
||||
{
|
||||
TQValueList<TQT_DBusData> eap_methods = it.data().toTQValueList();
|
||||
if (!eap_methods.isEmpty())
|
||||
{
|
||||
TQString eap = eap_methods.first().toString();
|
||||
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
|
||||
if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
|
||||
setEAP((EAP_PHASE1)it2.key());
|
||||
}
|
||||
else
|
||||
{
|
||||
// older version of NM used TQString instead of TQValueList<TQString>
|
||||
TQString eap = it.data().toString();
|
||||
if (!eap.isEmpty())
|
||||
{
|
||||
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
|
||||
if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
|
||||
setEAP((EAP_PHASE1)it2.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTH)
|
||||
{
|
||||
TQString eapPhase2 = it.data().toString();
|
||||
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
|
||||
if (_eapMap.end() != (it2 = _eapMap.findData(eapPhase2)))
|
||||
setPhase2EAP((EAP_PHASE2)it2.key());
|
||||
}
|
||||
else if (it.key() == NM_SETTING_802_1X_IDENTITY)
|
||||
_identity = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_ANONYMOUS_IDENTITY)
|
||||
_anonIdentity = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_CA_PATH)
|
||||
_caPath = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPVER)
|
||||
_phase1PeapVer = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPLABEL)
|
||||
_phase1PeapLabel = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING)
|
||||
_phase1FastProvisioning = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTHEAP)
|
||||
_phase2AuthEAP = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE2_CA_PATH)
|
||||
_phase2CaPath = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_SYSTEM_CA_CERTS)
|
||||
_useSystemCaCert = it.data().toBool();
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
IEEE8021x::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
kdDebug() << "IEEE8021x::toSecretsMap" << endl;
|
||||
// first serialize the settings if needed
|
||||
if (with_settings)
|
||||
map = toMap();
|
||||
|
||||
// add password
|
||||
if (!_password.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(_password));
|
||||
|
||||
if (!_privateKeyPasswd.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PRIVATE_KEY, TQT_DBusData::fromString(_privateKeyPasswd));
|
||||
|
||||
if (!_phase2PrivateKeyPasswd.isNull())
|
||||
map.insert(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, TQT_DBusData::fromString(_phase2PrivateKeyPasswd));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
IEEE8021x::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
kdDebug() << "IEEE8021x::fromMap" << endl;
|
||||
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_802_1X_PASSWORD)
|
||||
_password = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PRIVATE_KEY)
|
||||
_privateKeyPasswd = it.data().toString();
|
||||
else if (it.key() == NM_SETTING_802_1X_PHASE2_PRIVATE_KEY)
|
||||
_phase2PrivateKeyPasswd = it.data().toString();
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
IEEE8021x::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TQValueList<IEEE8021x::EAP_PHASE2>
|
||||
IEEE8021x::getAllowedPhase2Methods() const
|
||||
{
|
||||
TQValueList<EAP_PHASE2> phase2;
|
||||
// TODO : not sure if this is correct, jsut copied from nm-applet
|
||||
switch(_eap)
|
||||
{
|
||||
case EAP_PHASE1_TTLS:
|
||||
phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
|
||||
phase2.append(EAP_PHASE2_AUTH_MSCHAP);
|
||||
phase2.append(EAP_PHASE2_AUTH_CHAP);
|
||||
phase2.append(EAP_PHASE2_AUTH_PAP);
|
||||
break;
|
||||
case EAP_PHASE1_PEAP:
|
||||
phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
|
||||
phase2.append(EAP_PHASE2_AUTH_MD5);
|
||||
break;
|
||||
default:
|
||||
phase2.append(EAP_PHASE2_AUTH_NONE);
|
||||
}
|
||||
return phase2;
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_8021x.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_8021X_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
#include "qbidirectionalmap.h"
|
||||
/* NM */
|
||||
#include <nm-setting-8021x.h>
|
||||
#include <nm-setting-wireless.h>
|
||||
|
||||
|
||||
class AccessPoint;
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
// setting for 802.1x parameters
|
||||
class IEEE8021x : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
|
||||
enum EAP
|
||||
{
|
||||
EAP_NONE = 0
|
||||
, EAP_LEAP
|
||||
, EAP_MD5
|
||||
, EAP_PAP
|
||||
, EAP_CHAP
|
||||
, EAP_MSCHAP
|
||||
, EAP_MSCHAPV2
|
||||
, EAP_FAST
|
||||
, EAP_PSK
|
||||
, EAP_PAX
|
||||
, EAP_SAKE
|
||||
, EAP_GPSK
|
||||
, EAP_TLS
|
||||
, EAP_PEAP
|
||||
, EAP_TTLS
|
||||
, EAP_SIM
|
||||
, EAP_GTC
|
||||
, EAP_OTP
|
||||
};
|
||||
|
||||
enum EAP_PHASE1
|
||||
{
|
||||
EAP_PHASE1_NONE = EAP_NONE
|
||||
, EAP_PHASE1_LEAP = EAP_LEAP
|
||||
, EAP_PHASE1_MD5 = EAP_MD5
|
||||
, EAP_PHASE1_TLS = EAP_TLS
|
||||
, EAP_PHASE1_PEAP = EAP_PEAP
|
||||
, EAP_PHASE1_TTLS = EAP_TTLS
|
||||
, EAP_PHASE1_SIM = EAP_SIM
|
||||
, EAP_PHASE1_FAST = EAP_FAST
|
||||
};
|
||||
|
||||
enum EAP_PHASE2
|
||||
{
|
||||
EAP_PHASE2_AUTH_NONE = EAP_NONE
|
||||
, EAP_PHASE2_AUTH_PAP = EAP_PAP
|
||||
, EAP_PHASE2_AUTH_CHAP = EAP_CHAP
|
||||
, EAP_PHASE2_AUTH_MSCHAP = EAP_MSCHAP
|
||||
, EAP_PHASE2_AUTH_MSCHAPV2 = EAP_MSCHAPV2
|
||||
, EAP_PHASE2_AUTH_GTC = EAP_GTC
|
||||
, EAP_PHASE2_AUTH_OTP = EAP_OTP
|
||||
, EAP_PHASE2_AUTH_MD5 = EAP_MD5
|
||||
, EAP_PHASE2_AUTH_TLS = EAP_TLS
|
||||
};
|
||||
|
||||
enum EAP_PHASE2_AUTH_EAP
|
||||
{
|
||||
EAP_PHASE2_AUTH_EAP_NONE = EAP_NONE
|
||||
, EAP_PHASE2_AUTH_EAP_MD5 = EAP_MD5
|
||||
, EAP_PHASE2_AUTH_EAP_MSCHAPV2 = EAP_MSCHAPV2
|
||||
, EAP_PHASE2_AUTH_EAP_OTP = EAP_OTP
|
||||
, EAP_PHASE2_AUTH_EAP_GTC = EAP_GTC
|
||||
, EAP_PHASE2_AUTH_EAP_TLS = EAP_TLS
|
||||
};
|
||||
|
||||
enum PEAPVER
|
||||
{
|
||||
PEAPVER_0 = 0
|
||||
, PEAPVER_1
|
||||
};
|
||||
|
||||
IEEE8021x(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
// FIXME
|
||||
// multiple EAP methods are allowed
|
||||
EAP_PHASE1 getEAP(void) const;
|
||||
void setEAP(EAP_PHASE1);
|
||||
|
||||
EAP_PHASE2 getPhase2EAP(void) const;
|
||||
void setPhase2EAP(EAP_PHASE2);
|
||||
|
||||
TQString getIdentity(void) const;
|
||||
void setIdentity(const TQString&);
|
||||
|
||||
TQString getAnonIdentity(void) const;
|
||||
void setAnonIdentity(const TQString&);
|
||||
|
||||
TQString getPassword(void) const;
|
||||
void setPassword(const TQString&);
|
||||
|
||||
// FIXME
|
||||
// ca cert
|
||||
|
||||
TQString getCaPath(void) const;
|
||||
void setCaPath(TQString);
|
||||
|
||||
bool getUseSystemCaCert(void) const;
|
||||
void setUseSystemCaCert(bool);
|
||||
|
||||
//FIXME
|
||||
// client cert
|
||||
|
||||
// FIXME
|
||||
// private key
|
||||
|
||||
PEAPVER getPhase1PeapVer(void) const;
|
||||
void setPhase1PeapVer(PEAPVER);
|
||||
|
||||
// get a list of allowed phase2 methods
|
||||
TQValueList<EAP_PHASE2> getAllowedPhase2Methods() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
// settigs
|
||||
EAP_PHASE1 _eap;
|
||||
EAP_PHASE2 _eapPhase2;
|
||||
|
||||
TQString _identity;
|
||||
TQString _anonIdentity;
|
||||
TQByteArray _caCert;
|
||||
bool _useSystemCaCert;
|
||||
TQString _caPath;
|
||||
TQByteArray _clientCert;
|
||||
TQByteArray _privateKey;
|
||||
TQString _phase1PeapVer;
|
||||
TQString _phase1PeapLabel;
|
||||
TQString _phase1FastProvisioning;
|
||||
TQString _phase2AuthEAP;
|
||||
TQByteArray _phase2CaCert;
|
||||
TQString _phase2CaPath;
|
||||
TQByteArray _phase2ClientCert;
|
||||
TQByteArray _phase2PrivateKey;
|
||||
|
||||
// secrets
|
||||
TQString _password;
|
||||
TQString _privateKeyPasswd;
|
||||
TQString _phase2PrivateKeyPasswd;
|
||||
|
||||
// map the different eap types (enum EAP) to their string representation
|
||||
TQBiDirectionalMap<EAP, TQString> _eapMap;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */
|
@ -1,138 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "tdenetman-connection_setting_cdma.h"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class CDMA
|
||||
*/
|
||||
CDMA::CDMA(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_CDMA_SETTING_NAME), _number("#777")
|
||||
{
|
||||
}
|
||||
|
||||
void CDMA::setNumber(const TQString& number)
|
||||
{
|
||||
_number = number;
|
||||
}
|
||||
|
||||
TQString CDMA::getNumber() const
|
||||
{
|
||||
return _number;
|
||||
}
|
||||
|
||||
void CDMA::setUsername(const TQString& username)
|
||||
{
|
||||
_username = username;
|
||||
}
|
||||
|
||||
TQString CDMA::getUsername() const
|
||||
{
|
||||
return _username;
|
||||
}
|
||||
|
||||
void CDMA::setPassword(const TQString& password)
|
||||
{
|
||||
_password = password;
|
||||
}
|
||||
|
||||
TQString CDMA::getPassword() const
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
|
||||
bool
|
||||
CDMA::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
CDMA::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
map.insert(NM_SETTING_CDMA_NUMBER, TQT_DBusData::fromString(_number));
|
||||
map.insert(NM_SETTING_CDMA_USERNAME, TQT_DBusData::fromString(_username));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
CDMA::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// first serialize the settings if needed
|
||||
if (with_settings)
|
||||
map = toMap();
|
||||
|
||||
map.insert(NM_SETTING_CDMA_PASSWORD, TQT_DBusData::fromString(_password));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
CDMA::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_CDMA_PASSWORD)
|
||||
setPassword(it.data().toString());
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CDMA::fromMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_CDMA_NUMBER)
|
||||
setNumber(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_CDMA_USERNAME)
|
||||
setUsername(it.data().toString());
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_cdma.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_CDMA_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-cdma.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class Connection;
|
||||
|
||||
// serial setting
|
||||
class CDMA : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
CDMA(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
void fromMap(const SettingsMap&);
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
bool isValid() const;
|
||||
bool useSetting();
|
||||
|
||||
void setNumber(const TQString&);
|
||||
TQString getNumber() const;
|
||||
|
||||
void setUsername(const TQString&);
|
||||
TQString getUsername() const;
|
||||
|
||||
void setPassword(const TQString&);
|
||||
TQString getPassword() const;
|
||||
|
||||
private:
|
||||
TQString _number;
|
||||
TQString _username;
|
||||
TQString _password;
|
||||
};
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */
|
@ -1,251 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_gsm.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "tdenetman-connection_setting_gsm.h"
|
||||
|
||||
/* network-manager headers */
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#if !defined(NM_CHECK_VERSION)
|
||||
#define NM_CHECK_VERSION(x,y,z) 0
|
||||
#endif
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class GSM
|
||||
*/
|
||||
GSM::GSM(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_GSM_SETTING_NAME), _number("*99#"), _network_type(-1), _band(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void GSM::setNumber(const TQString& number)
|
||||
{
|
||||
_number = number;
|
||||
}
|
||||
|
||||
TQString GSM::getNumber() const
|
||||
{
|
||||
return _number;
|
||||
}
|
||||
|
||||
void GSM::setUsername(const TQString& username)
|
||||
{
|
||||
_username = username;
|
||||
}
|
||||
|
||||
TQString GSM::getUsername() const
|
||||
{
|
||||
return _username;
|
||||
}
|
||||
|
||||
void GSM::setPassword(const TQString& password)
|
||||
{
|
||||
_password = password;
|
||||
}
|
||||
|
||||
TQString GSM::getPassword() const
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
|
||||
void GSM::setPin(const TQString& pin)
|
||||
{
|
||||
_pin = pin;
|
||||
}
|
||||
|
||||
TQString GSM::getPin() const
|
||||
{
|
||||
return _pin;
|
||||
}
|
||||
|
||||
void GSM::setPuk(const TQString& puk)
|
||||
{
|
||||
_puk = puk;
|
||||
}
|
||||
|
||||
TQString GSM::getPuk() const
|
||||
{
|
||||
return _puk;
|
||||
}
|
||||
|
||||
void GSM::setAPN(const TQString& apn)
|
||||
{
|
||||
_apn = apn;
|
||||
}
|
||||
|
||||
TQString GSM::getAPN() const
|
||||
{
|
||||
return _apn;
|
||||
}
|
||||
|
||||
void GSM::setNetworkID(const TQString& id)
|
||||
{
|
||||
_network_id = id;
|
||||
}
|
||||
|
||||
TQString GSM::getNetworkID() const
|
||||
{
|
||||
return _network_id;
|
||||
}
|
||||
|
||||
void GSM::setNetworkType(int type)
|
||||
{
|
||||
_network_type = type;
|
||||
}
|
||||
|
||||
int GSM::getNetworkType() const
|
||||
{
|
||||
return _network_type;
|
||||
}
|
||||
|
||||
void GSM::setBand(int band)
|
||||
{
|
||||
_band = band;
|
||||
}
|
||||
|
||||
int GSM::getBand() const
|
||||
{
|
||||
return _band;
|
||||
}
|
||||
|
||||
bool
|
||||
GSM::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
GSM::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
if (!_number.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_NUMBER, TQT_DBusData::fromString(_number));
|
||||
}
|
||||
if (!_username.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_USERNAME, TQT_DBusData::fromString(_username));
|
||||
}
|
||||
if (!_apn.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_APN, TQT_DBusData::fromString(_apn));
|
||||
}
|
||||
if (!_network_id.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_NETWORK_ID, TQT_DBusData::fromString(_network_id));
|
||||
}
|
||||
map.insert(NM_SETTING_GSM_NETWORK_TYPE, TQT_DBusData::fromInt32(_network_type));
|
||||
#if NM_CHECK_VERSION(0,8,992)
|
||||
#else
|
||||
map.insert(NM_SETTING_GSM_BAND, TQT_DBusData::fromInt32(_band));
|
||||
#endif
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
GSM::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// first serialize the settings if needed
|
||||
if (with_settings)
|
||||
map = toMap();
|
||||
|
||||
if (!_password.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_PASSWORD, TQT_DBusData::fromString(_password));
|
||||
}
|
||||
if (!_pin.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_PIN, TQT_DBusData::fromString(_pin));
|
||||
}
|
||||
#if NM_CHECK_VERSION(0,8,992)
|
||||
#else
|
||||
if (!_puk.isEmpty()) {
|
||||
map.insert(NM_SETTING_GSM_PUK, TQT_DBusData::fromString(_puk));
|
||||
}
|
||||
#endif
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
GSM::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
// TODO: add all secrets
|
||||
if (it.key() == NM_SETTING_GSM_PASSWORD)
|
||||
setPassword(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_GSM_PIN)
|
||||
setPin(it.data().toString());
|
||||
#if NM_CHECK_VERSION(0,8,992)
|
||||
#else
|
||||
else if (it.key() == NM_SETTING_GSM_PUK)
|
||||
setPuk(it.data().toString());
|
||||
#endif
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown secret: " << it.key() << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GSM::fromMap(const SettingsMap& map)
|
||||
{
|
||||
// TODO: add all attributes
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_GSM_NUMBER)
|
||||
setNumber(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_GSM_USERNAME)
|
||||
setUsername(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_GSM_APN)
|
||||
setAPN(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_GSM_NETWORK_ID)
|
||||
setNetworkID(it.data().toString());
|
||||
else if (it.key() == NM_SETTING_GSM_NETWORK_TYPE)
|
||||
setNetworkType(it.data().toUInt32());
|
||||
#if NM_CHECK_VERSION(0,8,992)
|
||||
#else
|
||||
else if (it.key() == NM_SETTING_GSM_BAND)
|
||||
setBand(it.data().toUInt32());
|
||||
#endif
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_gsm.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_GSM_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-gsm.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class Connection;
|
||||
|
||||
// serial setting
|
||||
class GSM : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
GSM(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
void fromMap(const SettingsMap&);
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
bool isValid() const;
|
||||
bool useSetting();
|
||||
|
||||
void setNumber(const TQString&);
|
||||
TQString getNumber() const;
|
||||
|
||||
void setUsername(const TQString&);
|
||||
TQString getUsername() const;
|
||||
|
||||
void setPassword(const TQString&);
|
||||
TQString getPassword() const;
|
||||
|
||||
void setAPN(const TQString&);
|
||||
TQString getAPN() const;
|
||||
|
||||
void setNetworkID(const TQString&);
|
||||
TQString getNetworkID() const;
|
||||
|
||||
void setNetworkType(int);
|
||||
int getNetworkType() const;
|
||||
|
||||
void setBand(int);
|
||||
int getBand() const;
|
||||
|
||||
void setPin(const TQString&);
|
||||
TQString getPin() const;
|
||||
|
||||
void setPuk(const TQString&);
|
||||
TQString getPuk() const;
|
||||
|
||||
private:
|
||||
TQString _number;
|
||||
TQString _username;
|
||||
TQString _password;
|
||||
TQString _apn;
|
||||
TQString _network_id;
|
||||
int _network_type;
|
||||
int _band;
|
||||
TQString _pin;
|
||||
TQString _puk;
|
||||
};
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */
|
@ -1,163 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_info.h"
|
||||
#include "tdenetman-accesspoint.h"
|
||||
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class Info
|
||||
*/
|
||||
Info::Info(Connection* conn, TQString devtype, const TQString& name, bool autoconnect)
|
||||
: ConnectionSetting(conn, NM_SETTING_CONNECTION_SETTING_NAME)
|
||||
{
|
||||
_name = name;
|
||||
_devtype = devtype;
|
||||
_autoconnect = autoconnect;
|
||||
}
|
||||
|
||||
TQString
|
||||
Info::getDevType() const
|
||||
{
|
||||
return _devtype;
|
||||
}
|
||||
|
||||
void
|
||||
Info::setDevType(const TQString& devtype)
|
||||
{
|
||||
_devtype = devtype;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQString
|
||||
Info::getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void
|
||||
Info::setName(const TQString& name)
|
||||
{
|
||||
_name = name;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
Info::getAutoconnect() const
|
||||
{
|
||||
return _autoconnect;
|
||||
}
|
||||
|
||||
void
|
||||
Info::setAutoconnect(bool autoconnect)
|
||||
{
|
||||
_autoconnect = autoconnect;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQDateTime
|
||||
Info::getTimestamp() const
|
||||
{
|
||||
return _timestamp;
|
||||
}
|
||||
|
||||
void
|
||||
Info::setTimestamp(const TQDateTime& dt)
|
||||
{
|
||||
_timestamp = dt;
|
||||
}
|
||||
|
||||
TQString
|
||||
Info::getUUID() const
|
||||
{
|
||||
return _uuid;
|
||||
}
|
||||
|
||||
void
|
||||
Info::setUUID(const TQString& uuid)
|
||||
{
|
||||
_uuid = uuid;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
Info::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
map.insert(NM_SETTING_CONNECTION_ID, TQT_DBusData::fromString(_name));
|
||||
map.insert(NM_SETTING_CONNECTION_TYPE, TQT_DBusData::fromString(_devtype));
|
||||
map.insert(NM_SETTING_CONNECTION_AUTOCONNECT, TQT_DBusData::fromBool(_autoconnect));
|
||||
map.insert(NM_SETTING_CONNECTION_UUID, TQT_DBusData::fromString(_uuid));
|
||||
|
||||
if (!_timestamp.isNull())
|
||||
map.insert(NM_SETTING_CONNECTION_TIMESTAMP, TQT_DBusData::fromUInt32(_timestamp.toTime_t()));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
Info::fromMap(const SettingsMap& map)
|
||||
{
|
||||
SettingsMap::ConstIterator it;
|
||||
|
||||
if ((it = map.find(NM_SETTING_CONNECTION_ID)) != map.end())
|
||||
_name = it.data().toString();
|
||||
|
||||
if ((it = map.find(NM_SETTING_CONNECTION_TYPE)) != map.end())
|
||||
_devtype = it.data().toString();
|
||||
|
||||
if ((it = map.find(NM_SETTING_CONNECTION_AUTOCONNECT)) != map.end())
|
||||
_autoconnect = it.data().toBool();
|
||||
|
||||
if ((it = map.find(NM_SETTING_CONNECTION_TIMESTAMP)) != map.end())
|
||||
_timestamp.setTime_t(it.data().toUInt32());
|
||||
|
||||
if ((it = map.find(NM_SETTING_CONNECTION_UUID)) != map.end())
|
||||
_uuid = it.data().toString();
|
||||
}
|
||||
|
||||
bool
|
||||
Info::isValid() const
|
||||
{
|
||||
// name is essential
|
||||
if (_name.isEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_INFO_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
#include <tqdatetime.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-connection.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
// info setting
|
||||
class Info : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
Info(Connection* conn, TQString devtype = TQString(), const TQString& name = TQString(), bool autoconnect = false);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
TQString getDevType() const;
|
||||
void setDevType(const TQString&);
|
||||
|
||||
TQString getName() const;
|
||||
void setName(const TQString&);
|
||||
|
||||
bool getAutoconnect() const;
|
||||
void setAutoconnect(bool);
|
||||
|
||||
TQDateTime getTimestamp() const;
|
||||
void setTimestamp(const TQDateTime&);
|
||||
|
||||
TQString getUUID() const;
|
||||
void setUUID(const TQString&);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
TQString _name;
|
||||
TQString _devtype;
|
||||
bool _autoconnect;
|
||||
TQDateTime _timestamp;
|
||||
TQString _uuid;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_H */
|
@ -1,318 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_ipv4.h"
|
||||
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
// reverse order the bytes
|
||||
TQ_UINT32 swap32(TQ_UINT32 x)
|
||||
{
|
||||
TQ_UINT32 ret = 0;
|
||||
|
||||
TQ_UINT8* from = (TQ_UINT8*) &x;
|
||||
TQ_UINT8* to = (TQ_UINT8*) &ret;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
to[3-i] = from[i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
class IPv4
|
||||
*/
|
||||
IPv4::IPv4(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_IP4_CONFIG_SETTING_NAME)
|
||||
{
|
||||
_method = METHOD_DHCP;
|
||||
_ignore_auto_dns = false;
|
||||
_ignore_auto_routes = false;
|
||||
}
|
||||
|
||||
TQValueList<IPv4Address> IPv4::getAddresses() const
|
||||
{
|
||||
return _addresses;
|
||||
}
|
||||
|
||||
void IPv4::setAddresses(const TQValueList<IPv4Address> & adr)
|
||||
{
|
||||
_addresses = adr;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQValueList<TQHostAddress> IPv4::getDNS() const
|
||||
{
|
||||
return _dns;
|
||||
}
|
||||
|
||||
void IPv4::setDNS(const TQValueList<TQHostAddress>& dns)
|
||||
{
|
||||
_dns = dns;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQStringList IPv4::getDNSSearch() const
|
||||
{
|
||||
return _dns_search;
|
||||
}
|
||||
|
||||
void IPv4::setDNSSearch(const TQStringList & dnsSearch)
|
||||
{
|
||||
_dns_search = dnsSearch;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
void
|
||||
IPv4::setMethod(IPV4METHOD method)
|
||||
{
|
||||
_method = method;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
IPv4::IPV4METHOD
|
||||
IPv4::getMethod() const
|
||||
{
|
||||
return _method;
|
||||
}
|
||||
|
||||
void
|
||||
IPv4::setIgnoreAutoDNS(bool ignore)
|
||||
{
|
||||
_ignore_auto_dns = ignore;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
IPv4::getIgnoreAutoDNS() const
|
||||
{
|
||||
return _ignore_auto_dns;
|
||||
}
|
||||
|
||||
void
|
||||
IPv4::setIgnoreAutoRoutes(bool ignore)
|
||||
{
|
||||
_ignore_auto_routes = ignore;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
IPv4::getIgnoreAutoRoutes() const
|
||||
{
|
||||
return _ignore_auto_routes;
|
||||
}
|
||||
|
||||
bool
|
||||
IPv4::isValid() const
|
||||
{
|
||||
if (_method == METHOD_MANUAL)
|
||||
{
|
||||
// only check the manual settings
|
||||
|
||||
// at least one address has to be specified
|
||||
if (_addresses.empty())
|
||||
return false;
|
||||
|
||||
// check every address
|
||||
for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
|
||||
{
|
||||
if ((*it).address.isNull())
|
||||
return false;
|
||||
if ((*it).netmask.isNull())
|
||||
return false;
|
||||
// no need to check gateway as it is optional
|
||||
}
|
||||
|
||||
// check DNS addresses but may be empty
|
||||
for (TQValueList<TQHostAddress>::ConstIterator it = _dns.begin(); it != _dns.end(); ++it)
|
||||
{
|
||||
if ((*it).isNull())
|
||||
return false;
|
||||
}
|
||||
|
||||
// don't check DNS Search because it is optional ...
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
IPv4::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
if (_method == METHOD_DHCP)
|
||||
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_AUTO));
|
||||
else if (_method == METHOD_AUTOIP)
|
||||
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL));
|
||||
else if (_method == METHOD_SHARED)
|
||||
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_SHARED));
|
||||
else if (_method == METHOD_MANUAL)
|
||||
{
|
||||
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_MANUAL));
|
||||
|
||||
// DNS search
|
||||
if (_dns_search.size() > 0)
|
||||
{
|
||||
TQValueList<TQT_DBusData> dns_search;
|
||||
TQStringList::ConstIterator it = _dns_search.begin();
|
||||
for(;it != _dns_search.end(); ++it)
|
||||
dns_search.append(TQT_DBusData::fromString(*it));
|
||||
|
||||
map.insert(NM_SETTING_IP4_CONFIG_DNS_SEARCH, TQT_DBusData::fromTQValueList(dns_search));
|
||||
}
|
||||
|
||||
// DNS addresses
|
||||
if (_dns.size() > 0)
|
||||
{
|
||||
TQValueList<TQT_DBusData> dns;
|
||||
TQValueList<TQHostAddress>::ConstIterator it_dns = _dns.begin();
|
||||
// the strange swap32 is needed as NM reads the address exactly the other way round as TQt
|
||||
for(;it_dns != _dns.end(); ++it_dns)
|
||||
dns.append(TQT_DBusData::fromUInt32(swap32((*it_dns).toIPv4Address())));
|
||||
|
||||
map.insert(NM_SETTING_IP4_CONFIG_DNS, TQT_DBusData::fromTQValueList(dns));
|
||||
}
|
||||
|
||||
// IP's
|
||||
if (_addresses.size() > 0)
|
||||
{
|
||||
TQValueList<TQT_DBusData> ips;
|
||||
for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
|
||||
{
|
||||
TQValueList<TQT_DBusData> cur_ip;
|
||||
cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).address.toIPv4Address())));
|
||||
cur_ip.append(TQT_DBusData::fromUInt32(toCIDRSuffix((*it).netmask)));
|
||||
if (!(*it).gateway.isNull())
|
||||
cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).gateway.toIPv4Address())));
|
||||
ips.append(TQT_DBusData::fromTQValueList(cur_ip));
|
||||
}
|
||||
map.insert(NM_SETTING_IP4_CONFIG_ADDRESSES, TQT_DBusData::fromTQValueList(ips));
|
||||
}
|
||||
}
|
||||
map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TQT_DBusData::fromBool(_ignore_auto_routes));
|
||||
map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TQT_DBusData::fromBool(_ignore_auto_dns));
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
IPv4::fromMap(const SettingsMap& map)
|
||||
{
|
||||
SettingsMap::ConstIterator it;
|
||||
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_METHOD)) != map.end())
|
||||
{
|
||||
if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_AUTO || it.data().toString() == "dhcp")
|
||||
_method = METHOD_DHCP;
|
||||
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL || it.data().toString() == "autoip")
|
||||
_method = METHOD_AUTOIP;
|
||||
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_SHARED)
|
||||
_method = METHOD_SHARED;
|
||||
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|
||||
_method = METHOD_MANUAL;
|
||||
}
|
||||
|
||||
// DNS search
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS_SEARCH)) != map.end())
|
||||
{
|
||||
TQValueList<TQT_DBusData> dns_search = it.data().toTQValueList();
|
||||
for (TQValueList<TQT_DBusData>::Iterator it = dns_search.begin(); it != dns_search.end(); ++it)
|
||||
{
|
||||
_dns_search.append( (*it).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// DNS addresses
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS)) != map.end())
|
||||
{
|
||||
TQValueList<TQT_DBusData> dns = it.data().toTQValueList();
|
||||
for (TQValueList<TQT_DBusData>::Iterator it = dns.begin(); it != dns.end(); ++it)
|
||||
{
|
||||
_dns.append( TQHostAddress(swap32((*it).toUInt32())) );
|
||||
}
|
||||
}
|
||||
|
||||
// IP's
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_ADDRESSES)) != map.end())
|
||||
{
|
||||
TQValueList<TQT_DBusData> ips = it.data().toTQValueList();
|
||||
for (TQValueList<TQT_DBusData>::Iterator it2 = ips.begin(); it2 != ips.end(); ++it2)
|
||||
{
|
||||
TQValueList<TQT_DBusData> cur_ip = (*it2).toTQValueList();
|
||||
IPv4Address address;
|
||||
|
||||
address.address = swap32(cur_ip[0].toUInt32());
|
||||
|
||||
if (cur_ip[1].toUInt32() >= 0 && cur_ip[1].toUInt32() <= 32)
|
||||
address.netmask = fromCIDRSuffix(cur_ip[1].toUInt32());
|
||||
else
|
||||
address.netmask = swap32(cur_ip[1].toUInt32());
|
||||
|
||||
if (cur_ip.size() > 2)
|
||||
address.gateway = swap32(cur_ip[2].toUInt32());
|
||||
|
||||
_addresses.append(address);
|
||||
}
|
||||
}
|
||||
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)) != map.end())
|
||||
_ignore_auto_routes = it.data().toBool();
|
||||
|
||||
if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)) != map.end())
|
||||
_ignore_auto_dns = it.data().toBool();
|
||||
}
|
||||
|
||||
TQ_UINT32 IPv4::toCIDRSuffix(const TQHostAddress& adr) const
|
||||
{
|
||||
TQ_UINT32 netmask = adr.toIPv4Address();
|
||||
TQ_UINT32 suffix = 0;
|
||||
while (netmask > 0)
|
||||
{
|
||||
suffix++;
|
||||
netmask = netmask << 1;
|
||||
}
|
||||
return suffix;
|
||||
}
|
||||
|
||||
TQHostAddress IPv4::fromCIDRSuffix(TQ_UINT32 suffix)
|
||||
{
|
||||
TQ_UINT32 netmask = 0xFFFFFFFF;
|
||||
netmask = netmask << (32 - suffix);
|
||||
return TQHostAddress(netmask);
|
||||
}
|
||||
|
@ -1,112 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_IPV4_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-ip4-config.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class Connection;
|
||||
|
||||
class IPv4Address
|
||||
{
|
||||
public:
|
||||
TQHostAddress address;
|
||||
TQHostAddress netmask;
|
||||
TQHostAddress gateway;
|
||||
};
|
||||
|
||||
// ipv4 setting
|
||||
class IPv4 : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
enum IPV4METHOD
|
||||
{
|
||||
METHOD_DHCP = 1
|
||||
, METHOD_AUTO = METHOD_DHCP // DHCP is obsolete now
|
||||
, METHOD_AUTOIP
|
||||
, METHOD_LINK_LOCAL = METHOD_AUTOIP // AUTOIP is obsolete now
|
||||
, METHOD_MANUAL
|
||||
, METHOD_SHARED
|
||||
};
|
||||
|
||||
IPv4(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
void addAddress(const IPv4Address&);
|
||||
void removeAddress(const IPv4Address&);
|
||||
|
||||
TQValueList<IPv4Address> getAddresses() const;
|
||||
void setAddresses(const TQValueList<IPv4Address>&);
|
||||
|
||||
TQValueList<TQHostAddress> getDNS() const;
|
||||
void setDNS(const TQValueList<TQHostAddress>&);
|
||||
|
||||
TQStringList getDNSSearch() const;
|
||||
void setDNSSearch(const TQStringList&);
|
||||
|
||||
void setMethod(IPV4METHOD);
|
||||
IPV4METHOD getMethod() const;
|
||||
|
||||
void setIgnoreAutoDNS(bool);
|
||||
bool getIgnoreAutoDNS() const;
|
||||
|
||||
void setIgnoreAutoRoutes(bool);
|
||||
bool getIgnoreAutoRoutes() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
bool useSetting();
|
||||
|
||||
TQ_UINT32 toCIDRSuffix(const TQHostAddress&) const;
|
||||
TQHostAddress fromCIDRSuffix(TQ_UINT32 suffix);
|
||||
|
||||
private:
|
||||
TQValueList<TQHostAddress> _dns;
|
||||
TQStringList _dns_search;
|
||||
TQValueList<IPv4Address> _addresses;
|
||||
IPV4METHOD _method;
|
||||
bool _ignore_auto_dns;
|
||||
bool _ignore_auto_routes;
|
||||
|
||||
// TODO routes, dhcp-client-id, dhcp-hostname
|
||||
};
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H */
|
@ -1,376 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_ppp.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-ppp.h>
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "tdenetman-connection_setting_ppp.h"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class PPP
|
||||
*/
|
||||
PPP::PPP(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_PPP_SETTING_NAME),
|
||||
_noauth(false),
|
||||
_refuse_eap(false),
|
||||
_refuse_pap(false),
|
||||
_refuse_chap(false),
|
||||
_refuse_mschap(false),
|
||||
_refuse_mschapv2(false),
|
||||
_nobsdcomp(false),
|
||||
_nodeflate(false),
|
||||
_novjcomp(false),
|
||||
_require_mppe(false),
|
||||
_require_mppe_128(false),
|
||||
_mppe_stateful(false),
|
||||
_require_mppc(false),
|
||||
_crtscts(false),
|
||||
_baud(0),
|
||||
_mru(0),
|
||||
_mtu(0),
|
||||
_lcp_echo_failure(0),
|
||||
_lcp_echo_interval(0)
|
||||
{
|
||||
// set defaults
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getNoAuth() const
|
||||
{
|
||||
return _noauth;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setNoAuth(bool noauth)
|
||||
{
|
||||
_noauth = noauth;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRefuseEAP() const
|
||||
{
|
||||
return _refuse_eap;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRefuseEAP(bool refuse_eap)
|
||||
{
|
||||
_refuse_eap = refuse_eap;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRefusePAP() const
|
||||
{
|
||||
return _refuse_pap;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRefusePAP(bool refuse_pap)
|
||||
{
|
||||
_refuse_pap = refuse_pap;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRefuseChap() const
|
||||
{
|
||||
return _refuse_chap;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRefuseChap(bool refuse_chap)
|
||||
{
|
||||
_refuse_chap = refuse_chap;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRefuseMSChap() const
|
||||
{
|
||||
return _refuse_mschap;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRefuseMSChap(bool refuse_mschap)
|
||||
{
|
||||
_refuse_mschap = refuse_mschap;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRefuseMSChapV2() const
|
||||
{
|
||||
return _refuse_mschapv2;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRefuseMSChapV2(bool refuse_mschapv2)
|
||||
{
|
||||
_refuse_mschapv2 = refuse_mschapv2;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getNoBSDComp() const
|
||||
{
|
||||
return _nobsdcomp;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setNoBSDComp(bool nobsdcomp)
|
||||
{
|
||||
_nobsdcomp = nobsdcomp;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getNoDeflate() const
|
||||
{
|
||||
return _nodeflate;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setNoDeflate(bool nodeflate)
|
||||
{
|
||||
_nodeflate = nodeflate;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getNoVJComp() const
|
||||
{
|
||||
return _novjcomp;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setNoVJComp(bool novjcomp)
|
||||
{
|
||||
_novjcomp = novjcomp;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRequireMPPE() const
|
||||
{
|
||||
return _require_mppe;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRequireMPPE(bool require_mppe)
|
||||
{
|
||||
_require_mppe = require_mppe;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRequireMPPE128() const
|
||||
{
|
||||
return _require_mppe_128;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRequireMPPE128(bool require_mppe_128)
|
||||
{
|
||||
_require_mppe_128 = require_mppe_128;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getMPPEStateful() const
|
||||
{
|
||||
return _mppe_stateful;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setMPPEStateful(bool b)
|
||||
{
|
||||
_mppe_stateful = b;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getRequireMPPC() const
|
||||
{
|
||||
return _require_mppc;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setRequireMPPC(bool b)
|
||||
{
|
||||
_require_mppc = b;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::getCRTSCTS() const
|
||||
{
|
||||
return _crtscts;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setCRTSCTS(bool b)
|
||||
{
|
||||
_crtscts = b;
|
||||
}
|
||||
|
||||
TQ_INT32
|
||||
PPP::getBaud() const
|
||||
{
|
||||
return _baud;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setBaud(TQ_INT32 i)
|
||||
{
|
||||
_baud = i;
|
||||
}
|
||||
|
||||
TQ_INT32
|
||||
PPP::getMRU() const
|
||||
{
|
||||
return _mru;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setMRU(TQ_INT32 i)
|
||||
{
|
||||
_mru = i;
|
||||
}
|
||||
|
||||
TQ_INT32
|
||||
PPP::getMTU() const
|
||||
{
|
||||
return _mtu;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setMTU(TQ_INT32 i)
|
||||
{
|
||||
_mtu = i;
|
||||
}
|
||||
|
||||
TQ_INT32
|
||||
PPP::getLCPEchoFailure() const
|
||||
{
|
||||
return _lcp_echo_failure;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setLCPEchoFailure(TQ_INT32 i)
|
||||
{
|
||||
_lcp_echo_failure = i;
|
||||
}
|
||||
|
||||
TQ_INT32
|
||||
PPP::getLCPEchoInterval() const
|
||||
{
|
||||
return _lcp_echo_interval;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::setLCPEchoInterval(TQ_INT32 i)
|
||||
{
|
||||
_lcp_echo_interval = i;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
PPP::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// TODO
|
||||
map.insert(NM_SETTING_PPP_NOAUTH, TQT_DBusData::fromBool(_noauth));
|
||||
map.insert(NM_SETTING_PPP_REFUSE_EAP, TQT_DBusData::fromBool(_refuse_eap));
|
||||
map.insert(NM_SETTING_PPP_REFUSE_PAP, TQT_DBusData::fromBool(_refuse_pap));
|
||||
map.insert(NM_SETTING_PPP_REFUSE_CHAP, TQT_DBusData::fromBool(_refuse_chap));
|
||||
map.insert(NM_SETTING_PPP_REFUSE_MSCHAP, TQT_DBusData::fromBool(_refuse_mschap));
|
||||
map.insert(NM_SETTING_PPP_NOBSDCOMP, TQT_DBusData::fromBool(_nobsdcomp));
|
||||
map.insert(NM_SETTING_PPP_NODEFLATE, TQT_DBusData::fromBool(_nodeflate));
|
||||
map.insert(NM_SETTING_PPP_NO_VJ_COMP, TQT_DBusData::fromBool(_novjcomp));
|
||||
map.insert(NM_SETTING_PPP_REQUIRE_MPPE, TQT_DBusData::fromBool(_require_mppe));
|
||||
map.insert(NM_SETTING_PPP_REQUIRE_MPPE_128, TQT_DBusData::fromBool(_require_mppe_128));
|
||||
map.insert(NM_SETTING_PPP_MPPE_STATEFUL, TQT_DBusData::fromBool(_mppe_stateful));
|
||||
map.insert(NM_SETTING_PPP_CRTSCTS, TQT_DBusData::fromBool(_crtscts));
|
||||
map.insert(NM_SETTING_PPP_BAUD, TQT_DBusData::fromUInt32(_baud));
|
||||
map.insert(NM_SETTING_PPP_MRU, TQT_DBusData::fromUInt32(_mru));
|
||||
map.insert(NM_SETTING_PPP_MTU, TQT_DBusData::fromUInt32(_mtu));
|
||||
map.insert(NM_SETTING_PPP_LCP_ECHO_FAILURE, TQT_DBusData::fromUInt32(_lcp_echo_failure));
|
||||
map.insert(NM_SETTING_PPP_LCP_ECHO_INTERVAL, TQT_DBusData::fromUInt32(_lcp_echo_interval));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
PPP::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// first serialize the settings if needed
|
||||
if (with_settings)
|
||||
map = toMap();
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
PPP::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
// TODO
|
||||
/*if (it.key() == NM_SETTING_PPP_PASSWORD)
|
||||
setPassword(it.data().toString());
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PPP::fromMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
if (it.key() == NM_SETTING_PPP_NUMBER)
|
||||
setNumber(it.data().toString());
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_ppp.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_PPP_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class Connection;
|
||||
|
||||
// serial setting
|
||||
class PPP : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
PPP(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
void fromMap(const SettingsMap&);
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
bool isValid() const;
|
||||
bool useSetting();
|
||||
|
||||
bool getNoAuth() const;
|
||||
void setNoAuth(bool);
|
||||
|
||||
bool getRefuseEAP() const;
|
||||
void setRefuseEAP(bool);
|
||||
|
||||
bool getRefusePAP() const;
|
||||
void setRefusePAP(bool);
|
||||
|
||||
bool getRefuseChap() const;
|
||||
void setRefuseChap(bool);
|
||||
|
||||
bool getRefuseMSChap() const;
|
||||
void setRefuseMSChap(bool);
|
||||
|
||||
bool getRefuseMSChapV2() const;
|
||||
void setRefuseMSChapV2(bool);
|
||||
|
||||
bool getNoBSDComp() const;
|
||||
void setNoBSDComp(bool);
|
||||
|
||||
bool getNoDeflate() const;
|
||||
void setNoDeflate(bool);
|
||||
|
||||
bool getNoVJComp() const;
|
||||
void setNoVJComp(bool);
|
||||
|
||||
bool getRequireMPPE() const;
|
||||
void setRequireMPPE(bool);
|
||||
|
||||
bool getRequireMPPE128() const;
|
||||
void setRequireMPPE128(bool);
|
||||
|
||||
bool getMPPEStateful() const;
|
||||
void setMPPEStateful(bool);
|
||||
|
||||
bool getRequireMPPC() const;
|
||||
void setRequireMPPC(bool);
|
||||
|
||||
bool getCRTSCTS() const;
|
||||
void setCRTSCTS(bool);
|
||||
|
||||
TQ_INT32 getBaud() const;
|
||||
void setBaud(TQ_INT32);
|
||||
|
||||
TQ_INT32 getMRU() const;
|
||||
void setMRU(TQ_INT32);
|
||||
|
||||
TQ_INT32 getMTU() const;
|
||||
void setMTU(TQ_INT32);
|
||||
|
||||
TQ_INT32 getLCPEchoFailure() const;
|
||||
void setLCPEchoFailure(TQ_INT32);
|
||||
|
||||
TQ_INT32 getLCPEchoInterval() const;
|
||||
void setLCPEchoInterval(TQ_INT32);
|
||||
|
||||
private:
|
||||
bool _noauth;
|
||||
bool _refuse_eap;
|
||||
bool _refuse_pap;
|
||||
bool _refuse_chap;
|
||||
bool _refuse_mschap;
|
||||
bool _refuse_mschapv2;
|
||||
bool _nobsdcomp;
|
||||
bool _nodeflate;
|
||||
bool _novjcomp;
|
||||
bool _require_mppe;
|
||||
bool _require_mppe_128;
|
||||
bool _mppe_stateful;
|
||||
bool _require_mppc;
|
||||
bool _crtscts;
|
||||
TQ_UINT32 _baud;
|
||||
TQ_UINT32 _mru;
|
||||
TQ_UINT32 _mtu;
|
||||
TQ_UINT32 _lcp_echo_failure;
|
||||
TQ_UINT32 _lcp_echo_interval;
|
||||
};
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_H */
|
@ -1,168 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "tdenetman-connection_setting_serial.h"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class Serial
|
||||
*/
|
||||
Serial::Serial(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_SERIAL_SETTING_NAME),
|
||||
_baud( 115200 ),
|
||||
_bits( 8 ),
|
||||
_parity( PARITY_NONE ),
|
||||
_stopBits( 1 ),
|
||||
_sendDelay( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
void Serial::setBaud(TQ_UINT32 baud)
|
||||
{
|
||||
_baud = baud;
|
||||
}
|
||||
|
||||
TQ_UINT32 Serial::getBaud() const
|
||||
{
|
||||
return _baud;
|
||||
}
|
||||
|
||||
void Serial::setBits(TQ_UINT32 bits)
|
||||
{
|
||||
if (bits >= 5 && bits <= 8)
|
||||
_bits = bits;
|
||||
else
|
||||
kdWarning() << k_funcinfo << "bits property not accepted" << endl;
|
||||
}
|
||||
|
||||
TQ_UINT32 Serial::getBits() const
|
||||
{
|
||||
return _bits;
|
||||
}
|
||||
|
||||
void Serial::setParity(PARITY_MODE parity)
|
||||
{
|
||||
_parity = parity;
|
||||
}
|
||||
|
||||
Serial::PARITY_MODE Serial::getParity() const
|
||||
{
|
||||
return _parity;
|
||||
}
|
||||
|
||||
void Serial::setStopBits(TQ_UINT32 stopBits)
|
||||
{
|
||||
if (stopBits >= 1 && stopBits <= 2)
|
||||
_stopBits = stopBits;
|
||||
else
|
||||
kdWarning() << k_funcinfo << "stopbits property: wrong value" << endl;
|
||||
}
|
||||
|
||||
TQ_UINT32 Serial::getStopBits() const
|
||||
{
|
||||
return _stopBits;
|
||||
}
|
||||
|
||||
void Serial::setSendDelay(TQ_UINT64 delay)
|
||||
{
|
||||
_sendDelay = delay;
|
||||
}
|
||||
|
||||
TQ_UINT64 Serial::getSendDelay() const
|
||||
{
|
||||
return _sendDelay;
|
||||
}
|
||||
|
||||
bool
|
||||
Serial::isValid() const
|
||||
{
|
||||
// serial setting without ppp setting is not valid
|
||||
if (!(getConnection()->getSetting(NM_SETTING_PPP_SETTING_NAME)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
Serial::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
map.insert(NM_SETTING_SERIAL_BAUD, TQT_DBusData::fromUInt32(_baud));
|
||||
map.insert(NM_SETTING_SERIAL_BITS, TQT_DBusData::fromUInt32(_bits));
|
||||
|
||||
if (_parity == PARITY_NONE)
|
||||
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('n'));
|
||||
else if (_parity == PARITY_EVEN)
|
||||
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('e'));
|
||||
else if (_parity == PARITY_ODD)
|
||||
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('o'));
|
||||
|
||||
map.insert(NM_SETTING_SERIAL_STOPBITS, TQT_DBusData::fromUInt32(_stopBits));
|
||||
map.insert(NM_SETTING_SERIAL_SEND_DELAY, TQT_DBusData::fromUInt64(_sendDelay));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
Serial::fromMap(const SettingsMap& map)
|
||||
{
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_SERIAL_BAUD)
|
||||
setBaud(it.data().toUInt32());
|
||||
else if (it.key() == NM_SETTING_SERIAL_BITS)
|
||||
setBits(it.data().toUInt32());
|
||||
else if (it.key() == NM_SETTING_SERIAL_PARITY)
|
||||
{
|
||||
if (it.data().toByte() == 'n')
|
||||
_parity = PARITY_NONE;
|
||||
else if (it.data().toByte() == 'e')
|
||||
_parity = PARITY_EVEN;
|
||||
else if (it.data().toByte() == 'o')
|
||||
_parity = PARITY_ODD;
|
||||
}
|
||||
else if (it.key() == NM_SETTING_SERIAL_STOPBITS)
|
||||
setStopBits(it.data().toUInt32());
|
||||
else if (it.key() == NM_SETTING_SERIAL_SEND_DELAY)
|
||||
setSendDelay(it.data().toUInt64());
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_serial.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_SERIAL_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-ppp.h>
|
||||
#include <nm-setting-serial.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class Connection;
|
||||
|
||||
// serial setting
|
||||
class Serial : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
enum PARITY_MODE
|
||||
{
|
||||
PARITY_NONE = 0
|
||||
, PARITY_EVEN
|
||||
, PARITY_ODD
|
||||
};
|
||||
|
||||
Serial(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
bool isValid() const;
|
||||
bool useSetting();
|
||||
|
||||
void setBaud(TQ_UINT32);
|
||||
TQ_UINT32 getBaud() const;
|
||||
|
||||
void setBits(TQ_UINT32);
|
||||
TQ_UINT32 getBits() const;
|
||||
|
||||
void setParity(PARITY_MODE);
|
||||
PARITY_MODE getParity() const;
|
||||
|
||||
void setStopBits(TQ_UINT32);
|
||||
TQ_UINT32 getStopBits() const;
|
||||
|
||||
void setSendDelay(TQ_UINT64);
|
||||
TQ_UINT64 getSendDelay() const;
|
||||
|
||||
private:
|
||||
TQ_UINT32 _baud;
|
||||
TQ_UINT32 _bits;
|
||||
PARITY_MODE _parity;
|
||||
TQ_UINT32 _stopBits;
|
||||
TQ_UINT64 _sendDelay;
|
||||
};
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H */
|
@ -1,206 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_vpn.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_vpn.h"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class VPN
|
||||
*/
|
||||
VPN::VPN(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_VPN_SETTING_NAME)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TQString VPN::getUserName() const
|
||||
{
|
||||
return _userName;
|
||||
}
|
||||
|
||||
void VPN::setUserName(const TQString& u)
|
||||
{
|
||||
_userName = u;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQString VPN::getServiceType() const
|
||||
{
|
||||
return _serviceType;
|
||||
}
|
||||
|
||||
void VPN::setServiceType(const TQString& s)
|
||||
{
|
||||
_serviceType = s;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQValueList<TQString> VPN::getRoutes() const
|
||||
{
|
||||
return _routes;
|
||||
}
|
||||
|
||||
void VPN::setRoutes(const TQValueList<TQString>& r)
|
||||
{
|
||||
_routes = r;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
void VPN::setData(TQMap<TQString, TQString> data)
|
||||
{
|
||||
_data = data;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQMap<TQString, TQString> VPN::getData() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
void VPN::setSecrets(const TQMap<TQString, TQString>& data)
|
||||
{
|
||||
_secrets = data;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQMap<TQString, TQString> VPN::getSecrets() const
|
||||
{
|
||||
return _secrets;
|
||||
}
|
||||
|
||||
|
||||
SettingsMap
|
||||
VPN::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
map.insert(NM_SETTING_VPN_SERVICE_TYPE, TQT_DBusData::fromString(_serviceType));
|
||||
map.insert(NM_SETTING_VPN_USER_NAME, TQT_DBusData::fromString(_userName));
|
||||
|
||||
if (!_routes.isEmpty())
|
||||
{
|
||||
TQValueList<TQT_DBusData> list;
|
||||
for (TQValueList<TQString>::ConstIterator it = _routes.begin(); it != _routes.end(); ++it)
|
||||
{
|
||||
list.append(TQT_DBusData::fromString(*it));
|
||||
}
|
||||
}
|
||||
|
||||
// NM expects a String/String map -> convert
|
||||
TQT_DBusDataMap<TQString> data;
|
||||
|
||||
for (TQMap<TQString, TQString>::ConstIterator it = _data.begin(); it != _data.end(); ++it)
|
||||
{
|
||||
data.insert(it.key(), TQT_DBusData::fromString(it.data()));
|
||||
}
|
||||
|
||||
map.insert(NM_SETTING_VPN_DATA, TQT_DBusData::fromStringKeyMap(data));
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
VPN::fromMap(const SettingsMap& map)
|
||||
{
|
||||
SettingsMap::ConstIterator it;
|
||||
|
||||
if ((it = map.find(NM_SETTING_VPN_SERVICE_TYPE)) != map.end())
|
||||
_serviceType = it.data().toString();
|
||||
|
||||
if ((it = map.find(NM_SETTING_VPN_USER_NAME)) != map.end())
|
||||
_userName = it.data().toString();
|
||||
|
||||
TQT_DBusDataMap<TQString> data;
|
||||
_data.clear();
|
||||
|
||||
if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
|
||||
{
|
||||
data = it.data().toStringKeyMap();
|
||||
for (TQMap<TQString, TQT_DBusData>::ConstIterator it = data.begin(); it != data.end(); ++it)
|
||||
{
|
||||
_data.insert(it.key(), it.data().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
VPN::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// NM does not want the settings too
|
||||
/* if (with_settings)
|
||||
map = toMap();*/
|
||||
|
||||
// copy all secrets into the map
|
||||
for (TQMap<TQString, TQString>::ConstIterator it = _secrets.begin(); it != _secrets.end(); ++it)
|
||||
map.insert(it.key(), TQT_DBusData::fromString(it.data()));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
VPN::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
/* SettingsMap::ConstIterator it;
|
||||
TQT_DBusDataMap<TQString> data;
|
||||
|
||||
if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
|
||||
{
|
||||
data = it.data().toStringKeyMap();
|
||||
_data = data.toTQMap();
|
||||
}*/
|
||||
// FIXME
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
VPN::isValid() const
|
||||
{
|
||||
// name is essential
|
||||
if (_userName.isEmpty() || _serviceType.isEmpty())
|
||||
return false;
|
||||
|
||||
// data is essential
|
||||
if (_data.isEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_vpn.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_VPN_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_VPN_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
#include <tqdatetime.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
#include "tdenetman-connection_setting.h"
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-vpn.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
// info setting
|
||||
class VPN : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
VPN(Connection* conn);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
TQString getUserName() const;
|
||||
void setUserName(const TQString&);
|
||||
|
||||
TQString getServiceType() const;
|
||||
void setServiceType(const TQString&);
|
||||
|
||||
TQValueList<TQString> getRoutes() const;
|
||||
void setRoutes(const TQValueList<TQString>&);
|
||||
|
||||
TQMap<TQString, TQString> getData() const;
|
||||
void setData(TQMap<TQString, TQString> data);
|
||||
|
||||
// Ugh, that is ugly
|
||||
TQMap<TQString, TQString> getSecrets() const;
|
||||
void setSecrets(const TQMap<TQString, TQString>& secrets);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
TQString _userName;
|
||||
TQString _serviceType;
|
||||
TQValueList<TQString> _routes;
|
||||
TQMap<TQString, TQString> _data;
|
||||
TQMap<TQString, TQString> _secrets;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_H */
|
@ -1,99 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* NM headers */
|
||||
#include <nm-setting-wired.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_wired.h"
|
||||
#include "tdenetman-accesspoint.h"
|
||||
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
/*
|
||||
class Wired
|
||||
*/
|
||||
Wired::Wired(Connection* conn, TQString port, uint32_t speed, TQString duplex, bool autoNegotiate, TQByteArray macAddress, uint32_t mtu)
|
||||
: ConnectionSetting(conn, NM_SETTING_WIRED_SETTING_NAME)
|
||||
{
|
||||
_port = port;
|
||||
_speed = speed;
|
||||
_duplex = duplex;
|
||||
_autoNegotiate = autoNegotiate;
|
||||
_macAddress = macAddress;
|
||||
_mtu = mtu;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
Wired::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
if (!_port.isNull())
|
||||
map.insert(NM_SETTING_WIRED_PORT, TQT_DBusData::fromString(_port));
|
||||
|
||||
map.insert(NM_SETTING_WIRED_SPEED, TQT_DBusData::fromUInt32(_speed));
|
||||
|
||||
if (!_duplex.isNull())
|
||||
map.insert(NM_SETTING_WIRED_DUPLEX, TQT_DBusData::fromString(_duplex));
|
||||
|
||||
map.insert(NM_SETTING_WIRED_AUTO_NEGOTIATE, TQT_DBusData::fromBool(_autoNegotiate));
|
||||
|
||||
//FIXME
|
||||
/*
|
||||
if (!_macAddress.isNull())
|
||||
map.insert(NM_SETTING_WIRED_MAC_ADDRESS, TQT_DBusData::from(_macAddress));
|
||||
*/
|
||||
map.insert(NM_SETTING_WIRED_MTU, TQT_DBusData::fromUInt32(_mtu));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
Wired::fromMap(const SettingsMap& map)
|
||||
{
|
||||
SettingsMap::ConstIterator it;
|
||||
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
Wired::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_WIRED_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
#include "tdenetman-connection_setting.h"
|
||||
#include <nm-setting-wired.h>
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
// setting for wired interfaces
|
||||
class Wired: public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
Wired(Connection* conn, TQString port = TQString(), uint32_t speed = 0, TQString duplex = TQString(), bool autoNegotiate = true, TQByteArray macAddress = TQByteArray(), uint32_t mtu = 0);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
TQString _port;
|
||||
uint32_t _speed;
|
||||
TQString _duplex;
|
||||
bool _autoNegotiate;
|
||||
TQByteArray _macAddress;
|
||||
uint32_t _mtu;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H */
|
@ -1,220 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqregexp.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_wireless.h"
|
||||
#include "tdenetman-connection_setting_wireless_security.h"
|
||||
#include "tdenetman-accesspoint.h"
|
||||
|
||||
// the bssid should look like XX:XX:XX:XX:XX:XX where X is a hexadecimal digit
|
||||
#define MAC_ADDRESS_PATTERN "[0-9A-Fa-f]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}"
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class Wireless
|
||||
*/
|
||||
Wireless::Wireless(Connection* conn, ::AccessPoint* ap, WirelessSecurity* security)
|
||||
: ConnectionSetting(conn, NM_SETTING_WIRELESS_SETTING_NAME)
|
||||
{
|
||||
_security = TQString();
|
||||
|
||||
if (ap)
|
||||
{
|
||||
_essid = ap->getSsidByteArray();
|
||||
_mode = ap->getMode() == 0 ? MODE_ADHOC : MODE_INFRASTRUCTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_essid = TQByteArray();
|
||||
_mode = MODE_INFRASTRUCTURE;
|
||||
}
|
||||
|
||||
_modeMap[MODE_INFRASTRUCTURE] = "infrastructure";
|
||||
_modeMap[MODE_ADHOC] = "adhoc";
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
Wireless::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
map.insert(NM_SETTING_WIRELESS_MODE, TQT_DBusData::fromString(_modeMap[_mode]));
|
||||
|
||||
TQValueList<TQT_DBusData> essid;
|
||||
for (TQByteArray::ConstIterator it = _essid.begin(); it != _essid.end(); ++it)
|
||||
essid.append(TQT_DBusData::fromByte(*it));
|
||||
|
||||
if (essid.size() > 0)
|
||||
map.insert(NM_SETTING_WIRELESS_SSID, TQT_DBusData::fromTQValueList(essid));
|
||||
else
|
||||
kdWarning() << k_funcinfo << " SSID undefined" << endl;
|
||||
|
||||
if (!_security.isEmpty())
|
||||
map.insert(NM_SETTING_WIRELESS_SEC, TQT_DBusData::fromString(_security));
|
||||
|
||||
if (!_seenBssids.empty())
|
||||
{
|
||||
TQValueList<TQT_DBusData> bssids;
|
||||
for (TQValueList<TQString>::ConstIterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
|
||||
bssids.append(TQT_DBusData::fromString(*it));
|
||||
|
||||
map.insert(NM_SETTING_WIRELESS_SEEN_BSSIDS, TQT_DBusData::fromTQValueList(bssids));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
Wireless::fromMap(const SettingsMap& map)
|
||||
{
|
||||
SettingsMap::ConstIterator it;
|
||||
|
||||
// Mode
|
||||
if ((it = map.find(NM_SETTING_WIRELESS_MODE)) != map.end())
|
||||
{
|
||||
TQBiDirectionalMap<MODES, TQString>::Iterator mode_it = _modeMap.findData(it.data().toString());
|
||||
if (mode_it != _modeMap.end())
|
||||
_mode = mode_it.key();
|
||||
else
|
||||
_mode = MODE_INFRASTRUCTURE;
|
||||
}
|
||||
|
||||
// Essid
|
||||
if ((it = map.find(NM_SETTING_WIRELESS_SSID)) != map.end())
|
||||
{
|
||||
TQValueList<TQT_DBusData> dbus_essid = (*it).toTQValueList();
|
||||
TQByteArray essid(dbus_essid.size());
|
||||
|
||||
int index = 0;
|
||||
for (TQValueList<TQT_DBusData>::ConstIterator byte_it = dbus_essid.begin(); byte_it != dbus_essid.end(); ++byte_it)
|
||||
{
|
||||
essid[index] = (*byte_it).toByte();
|
||||
index++;
|
||||
}
|
||||
_essid = essid;
|
||||
}
|
||||
|
||||
if ((it = map.find(NM_SETTING_WIRELESS_SEC)) != map.end())
|
||||
{
|
||||
_security = (*it).toString();
|
||||
}
|
||||
|
||||
// Seen BSSIDS
|
||||
if ((it = map.find(NM_SETTING_WIRELESS_SEEN_BSSIDS)) != map.end())
|
||||
{
|
||||
TQRegExp exp(MAC_ADDRESS_PATTERN);
|
||||
TQValueList<TQT_DBusData> bssids = (*it).toTQValueList();
|
||||
_seenBssids.clear();
|
||||
|
||||
for(TQValueList<TQT_DBusData>::Iterator it = bssids.begin(); it != bssids.end(); ++it)
|
||||
{
|
||||
TQString bssid = (*it).toString();
|
||||
if (exp.exactMatch(bssid))
|
||||
_seenBssids.append(bssid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Wireless::setEssid(const TQByteArray& essid)
|
||||
{
|
||||
_essid = essid;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQByteArray
|
||||
Wireless::getEssid(void) const
|
||||
{
|
||||
return _essid;
|
||||
}
|
||||
|
||||
void
|
||||
Wireless::setMode(MODES mode)
|
||||
{
|
||||
_mode = mode;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
Wireless::MODES
|
||||
Wireless::getMode(void) const
|
||||
{
|
||||
return _mode;
|
||||
}
|
||||
|
||||
void
|
||||
Wireless::setSecurity(const TQString& security)
|
||||
{
|
||||
_security = security;
|
||||
emitValidityChanged();
|
||||
}
|
||||
|
||||
TQString
|
||||
Wireless::getSecurity(void) const
|
||||
{
|
||||
return _security;
|
||||
}
|
||||
|
||||
bool
|
||||
Wireless::isValid() const
|
||||
{
|
||||
// ESSID is essential
|
||||
if (_essid.isEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Wireless::addSeenBssid(const TQString& bssid)
|
||||
{
|
||||
TQRegExp exp(MAC_ADDRESS_PATTERN);
|
||||
if (!exp.exactMatch(bssid))
|
||||
return;
|
||||
|
||||
// no duplicates please
|
||||
for(TQValueList<TQString>::Iterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
|
||||
{
|
||||
if ((*it) == bssid)
|
||||
return;
|
||||
}
|
||||
|
||||
// insert this bssid
|
||||
_seenBssids.append(bssid);
|
||||
emitValidityChanged();
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_WIRELESS_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
#include "tdenetman-connection_setting.h"
|
||||
#include "qbidirectionalmap.h"
|
||||
/* NM headers */
|
||||
#include <nm-setting-wireless.h>
|
||||
|
||||
|
||||
class AccessPoint;
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
|
||||
class WirelessSecurity;
|
||||
class Connection;
|
||||
|
||||
|
||||
// setting for wireless interfaces
|
||||
class Wireless : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
|
||||
enum MODES
|
||||
{
|
||||
MODE_INFRASTRUCTURE = 0
|
||||
, MODE_ADHOC
|
||||
};
|
||||
|
||||
Wireless(Connection* conn, ::AccessPoint* ap = NULL, WirelessSecurity* security = NULL);
|
||||
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
void setEssid(const TQByteArray&);
|
||||
TQByteArray getEssid(void) const;
|
||||
|
||||
void setMode(MODES);
|
||||
MODES getMode(void) const;
|
||||
|
||||
void setSecurity(const TQString&);
|
||||
TQString getSecurity(void) const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
void addSeenBssid(const TQString&);
|
||||
|
||||
private:
|
||||
TQByteArray _essid;
|
||||
MODES _mode;
|
||||
TQString _band;
|
||||
uint32_t _channel;
|
||||
TQByteArray _bssid;
|
||||
uint32_t _rate;
|
||||
uint32_t _txPower;
|
||||
TQByteArray _macAddress;
|
||||
uint32_t _mtu;
|
||||
TQValueList<TQString> _seenBssids;
|
||||
TQString _security;
|
||||
|
||||
TQBiDirectionalMap<MODES, TQString> _modeMap;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H */
|
@ -1,451 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* tdenetman-connection_setting_wireless_security.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* qt headers */
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqvariant.h>
|
||||
|
||||
/* kde headers */
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
/* TQT_DBus headers*/
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
|
||||
/* tdenetman headers */
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-connection_setting_wireless_security.h"
|
||||
#include "tdenetman-accesspoint.h"
|
||||
#include "tdenetman-connection_setting_wireless.h"
|
||||
#include "tdenetman-connection.h"
|
||||
#include "sha1.h"
|
||||
#include "md5.h"
|
||||
|
||||
|
||||
using namespace ConnectionSettings;
|
||||
|
||||
/*
|
||||
class WirelessSecurity
|
||||
*/
|
||||
WirelessSecurity::WirelessSecurity(Connection* conn)
|
||||
: ConnectionSetting(conn, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
|
||||
, _keyMgmt(KEY_MGMT_NONE)
|
||||
, _wepTxKeyidx(0)
|
||||
, _authAlg(AUTH_ALG_NONE)
|
||||
, _proto(PROTO_NONE)
|
||||
, _pairwise(CIPHER_TKIP | CIPHER_CCMP)
|
||||
, _group(CIPHER_TKIP | CIPHER_CCMP)
|
||||
{
|
||||
// init key_mgmt map
|
||||
_keyMgmtMap[KEY_MGMT_NONE] = "none";
|
||||
_keyMgmtMap[KEY_MGMT_WPA_PSK] = "wpa-psk";
|
||||
_keyMgmtMap[KEY_MGMT_WPA_EAP] = "wpa-eap";
|
||||
_keyMgmtMap[KEY_MGMT_IEEE8021X] = "ieee8021x";
|
||||
|
||||
// init auth_alg map
|
||||
_authAlgMap[AUTH_ALG_NONE] = TQString(); // do not include auth alg if none is needed
|
||||
_authAlgMap[AUTH_ALG_OPEN] = "open";
|
||||
_authAlgMap[AUTH_ALG_SHARED] = "shared";
|
||||
_authAlgMap[AUTH_ALG_LEAP] = "leap";
|
||||
|
||||
// proto map
|
||||
_protoMap[PROTO_WPA] = "wpa";
|
||||
_protoMap[PROTO_RSN] = "rsn"; // Info: rsn is wpa2
|
||||
|
||||
// cipher map
|
||||
_cipherMap[CIPHER_TKIP] = "tkip";
|
||||
_cipherMap[CIPHER_CCMP] = "ccmp";
|
||||
_cipherMap[CIPHER_WEP40] = "wep40";
|
||||
_cipherMap[CIPHER_WEP104] = "wep104";
|
||||
|
||||
}
|
||||
|
||||
bool WirelessSecurity::getEnabled() const
|
||||
{
|
||||
Connection* conn = getConnection();
|
||||
if (conn)
|
||||
{
|
||||
Wireless* wireless = dynamic_cast<Wireless*>(conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
|
||||
if (wireless && wireless->getSecurity() != getType())
|
||||
{
|
||||
kdDebug() << "WirelessSecurity::getEnabled false " << wireless->getSecurity().ascii() << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
WirelessSecurity::getWepTxidx(void) const
|
||||
{
|
||||
return _wepTxKeyidx;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setWepTxidx(int idx)
|
||||
{
|
||||
if (idx >= 0 && idx < 4)
|
||||
_wepTxKeyidx = idx;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setWepKey(int idx, TQString key)
|
||||
{
|
||||
kdDebug() << "WirelessSecurity::setWepKey " << idx << " " << key.ascii() << endl;
|
||||
if (idx >= 0 && idx < 4)
|
||||
_wepKey[idx] = key;
|
||||
}
|
||||
|
||||
TQString
|
||||
WirelessSecurity::getWepKey(int idx) const
|
||||
{
|
||||
if (idx >= 0 && idx < 4)
|
||||
return _wepKey[idx];
|
||||
return TQString();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WirelessSecurity::getGroupCiphers(void) const
|
||||
{
|
||||
return _group;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setGroupCiphers(uint32_t ciphers)
|
||||
{
|
||||
_group= ciphers & (CIPHER_TKIP | CIPHER_CCMP | CIPHER_WEP40 | CIPHER_WEP104);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WirelessSecurity::getPairwiseCiphers(void) const
|
||||
{
|
||||
return _pairwise;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setPairwiseCiphers(uint32_t ciphers)
|
||||
{
|
||||
// only tkip and ccmp allowed
|
||||
_pairwise = ciphers & (CIPHER_TKIP | CIPHER_CCMP);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WirelessSecurity::getProto(void) const
|
||||
{
|
||||
return _proto;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setProto(uint32_t proto)
|
||||
{
|
||||
_proto = proto & (PROTO_WPA | PROTO_RSN);
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::addProto(uint32_t proto)
|
||||
{
|
||||
setProto(_proto | proto);
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::delProto(uint32_t proto)
|
||||
{
|
||||
setProto(_proto & ~proto);
|
||||
}
|
||||
|
||||
TQString
|
||||
WirelessSecurity::getPSK(void) const
|
||||
{
|
||||
return _psk;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setPSK(const TQString& psk)
|
||||
{
|
||||
_psk = psk;
|
||||
}
|
||||
|
||||
TQString
|
||||
WirelessSecurity::getLeapPassword(void) const
|
||||
{
|
||||
return _leapPassword;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setLeapPassword(const TQString& p)
|
||||
{
|
||||
_leapPassword = p;
|
||||
}
|
||||
|
||||
TQString
|
||||
WirelessSecurity::getLeapUsername(void) const
|
||||
{
|
||||
return _leapUsername;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setLeapUsername(const TQString& u)
|
||||
{
|
||||
_leapUsername = u;
|
||||
}
|
||||
|
||||
WirelessSecurity::KEY_MGMT
|
||||
WirelessSecurity::getKeyMgmt(void) const
|
||||
{
|
||||
return _keyMgmt;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setKeyMgmt(KEY_MGMT keyMgmt)
|
||||
{
|
||||
_keyMgmt = keyMgmt;
|
||||
}
|
||||
|
||||
WirelessSecurity::AUTH_ALG
|
||||
WirelessSecurity::getAuthAlg(void) const
|
||||
{
|
||||
return _authAlg;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::setAuthAlg(AUTH_ALG authAlg)
|
||||
{
|
||||
_authAlg = authAlg;
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
WirelessSecurity::toMap() const
|
||||
{
|
||||
SettingsMap map;
|
||||
|
||||
// KEY MGMT
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, TQT_DBusData::fromString(_keyMgmtMap[_keyMgmt]));
|
||||
|
||||
// WEP TX KEYIDX is only needed if WEP is used
|
||||
if (_keyMgmt == KEY_MGMT_NONE && _wepTxKeyidx >= 0 && _wepTxKeyidx <= 3)
|
||||
{
|
||||
// WEP TX KEYIDX
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, TQT_DBusData::fromInt32(_wepTxKeyidx));
|
||||
}
|
||||
|
||||
// AUTH ALG
|
||||
if (_authAlg != AUTH_ALG_NONE)
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, TQT_DBusData::fromString(_authAlgMap[_authAlg]));
|
||||
|
||||
// PROTO is only needed for WPA connections
|
||||
if (_proto != PROTO_NONE && (_keyMgmt == KEY_MGMT_WPA_NONE || _keyMgmt == KEY_MGMT_WPA_PSK || _keyMgmt == KEY_MGMT_WPA_EAP))
|
||||
{
|
||||
TQValueList<TQT_DBusData> protos;
|
||||
for (TQMap<PROTO, TQString>::ConstIterator it = _protoMap.begin(); it != _protoMap.end(); ++it)
|
||||
if (_proto & it.key())
|
||||
protos.append(TQT_DBusData::fromString(it.data()));
|
||||
if (protos.size() > 0)
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_PROTO, TQT_DBusData::fromTQValueList(protos));
|
||||
}
|
||||
|
||||
// groupcipher
|
||||
if (_group != CIPHER_NONE)
|
||||
{
|
||||
TQValueList<TQT_DBusData> ciphers;
|
||||
for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
|
||||
if (_group & it.key())
|
||||
ciphers.append(TQT_DBusData::fromString(it.data()));
|
||||
|
||||
if (ciphers.size() > 0)
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_GROUP, TQT_DBusData::fromTQValueList(ciphers));
|
||||
}
|
||||
|
||||
// pairwise cipher
|
||||
if (_pairwise != CIPHER_NONE)
|
||||
{
|
||||
TQValueList<TQT_DBusData> ciphers;
|
||||
|
||||
for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
|
||||
if (_pairwise & it.key())
|
||||
ciphers.append(TQT_DBusData::fromString(it.data()));
|
||||
|
||||
if (ciphers.size() > 0)
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_PAIRWISE, TQT_DBusData::fromTQValueList(ciphers));
|
||||
}
|
||||
|
||||
if (!_leapUsername.isEmpty())
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, TQT_DBusData::fromString(_leapUsername));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
void
|
||||
WirelessSecurity::fromMap(const SettingsMap& map)
|
||||
{
|
||||
kdDebug() << "WirelessSecurity::fromMap" << endl;
|
||||
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_WIRELESS_SECURITY_KEY_MGMT)
|
||||
{
|
||||
TQBiDirectionalMap<KEY_MGMT, TQString>::Iterator it2;
|
||||
if (_keyMgmtMap.end() != (it2 = _keyMgmtMap.findData(it.data().toString())))
|
||||
setKeyMgmt(it2.key());
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX)
|
||||
{
|
||||
_wepTxKeyidx = it.data().toInt32();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_AUTH_ALG)
|
||||
{
|
||||
TQBiDirectionalMap<AUTH_ALG, TQString>::Iterator it2;
|
||||
if (_authAlgMap.end() != (it2 = _authAlgMap.findData(it.data().toString())))
|
||||
setAuthAlg(it2.key());
|
||||
}
|
||||
else if(it.key() == NM_SETTING_WIRELESS_SECURITY_PROTO)
|
||||
{
|
||||
TQValueList<TQT_DBusData> proto_list = it.data().toTQValueList();
|
||||
uint32_t protos = PROTO_NONE;
|
||||
for (TQValueList<TQT_DBusData>::Iterator proto_it = proto_list.begin(); proto_it != proto_list.end(); ++proto_it)
|
||||
{
|
||||
TQBiDirectionalMap<PROTO, TQString>::Iterator it2;
|
||||
if (_protoMap.end() != (it2 = _protoMap.findData( (*proto_it).toString() )))
|
||||
protos |= it2.key();
|
||||
}
|
||||
setProto(protos);
|
||||
}
|
||||
else if(it.key() == NM_SETTING_WIRELESS_SECURITY_GROUP)
|
||||
{
|
||||
TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
|
||||
uint32_t ciphers = CIPHER_NONE;
|
||||
for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
|
||||
{
|
||||
TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
|
||||
if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
|
||||
ciphers |= it2.key();
|
||||
}
|
||||
setGroupCiphers(ciphers);
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_PAIRWISE)
|
||||
{
|
||||
TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
|
||||
uint32_t ciphers = CIPHER_NONE;
|
||||
for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
|
||||
{
|
||||
TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
|
||||
if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
|
||||
ciphers |= it2.key();
|
||||
}
|
||||
setPairwiseCiphers(ciphers);
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME)
|
||||
{
|
||||
_leapUsername = it.data().toString();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD)
|
||||
{
|
||||
_leapPassword = it.data().toString();
|
||||
}
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
SettingsMap
|
||||
WirelessSecurity::toSecretsMap(bool with_settings) const
|
||||
{
|
||||
SettingsMap map;
|
||||
kdDebug() << "WirelessSecurity::toSecretsMap" << endl;
|
||||
// first serialize the settings if needed
|
||||
if (with_settings)
|
||||
map = toMap();
|
||||
|
||||
// add the hashed psk
|
||||
if (!_psk.isNull())
|
||||
{
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_PSK, TQT_DBusData::fromString(_psk), TRUE);
|
||||
}
|
||||
|
||||
// wep keys
|
||||
if (!_wepKey[0].isNull())
|
||||
{
|
||||
kdDebug() << "insert wep key0: " << _wepKey[0].ascii() << endl;
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, TQT_DBusData::fromString(_wepKey[0]));
|
||||
}
|
||||
|
||||
if (!_wepKey[1].isNull())
|
||||
{
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, TQT_DBusData::fromString(_wepKey[1]));
|
||||
}
|
||||
|
||||
if (!_wepKey[2].isNull())
|
||||
{
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, TQT_DBusData::fromString(_wepKey[2]));
|
||||
}
|
||||
|
||||
if (!_wepKey[3].isNull())
|
||||
{
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, TQT_DBusData::fromString(_wepKey[3]));
|
||||
}
|
||||
|
||||
if (!_leapPassword.isEmpty())
|
||||
map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, TQT_DBusData::fromString(_leapPassword));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool
|
||||
WirelessSecurity::fromSecretsMap(const SettingsMap& map)
|
||||
{
|
||||
kdDebug() << "WirelessSecurity::fromMap" << endl;
|
||||
|
||||
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
if (it.key() == NM_SETTING_WIRELESS_SECURITY_PSK)
|
||||
{
|
||||
_psk = it.data().toString();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY0)
|
||||
{
|
||||
_wepKey[0] = it.data().toString();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY1)
|
||||
{
|
||||
_wepKey[1] = it.data().toString();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY2)
|
||||
{
|
||||
_wepKey[2] = it.data().toString();
|
||||
}
|
||||
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY3)
|
||||
{
|
||||
_wepKey[3] = it.data().toString();
|
||||
}
|
||||
else
|
||||
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WirelessSecurity::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_CONNECTION_SETTING_WIRELESS_SECURITY_H
|
||||
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tqhostaddress.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqvariant.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
#include <tqdbusdata.h>
|
||||
|
||||
#include "tdenetman-connection_setting.h"
|
||||
#include "qbidirectionalmap.h"
|
||||
/* NM */
|
||||
#include <nm-setting-wireless-security.h>
|
||||
#include <nm-setting-wireless.h>
|
||||
|
||||
|
||||
class AccessPoint;
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
|
||||
class WirelessSecurity;
|
||||
|
||||
|
||||
// setting for wireless security parameters
|
||||
class WirelessSecurity : public ConnectionSetting
|
||||
{
|
||||
public:
|
||||
// bitwise or-able ciphers
|
||||
enum CIPHERS
|
||||
{
|
||||
CIPHER_NONE = 0
|
||||
, CIPHER_TKIP = 1
|
||||
, CIPHER_CCMP = 2
|
||||
, CIPHER_WEP40 = 4
|
||||
, CIPHER_WEP104 = 8
|
||||
, CIPHER_AUTO = CIPHER_TKIP | CIPHER_CCMP
|
||||
};
|
||||
|
||||
enum KEY_MGMT
|
||||
{
|
||||
KEY_MGMT_NONE = 0
|
||||
, KEY_MGMT_IEEE8021X
|
||||
, KEY_MGMT_WPA_NONE
|
||||
, KEY_MGMT_WPA_PSK
|
||||
, KEY_MGMT_WPA_EAP
|
||||
};
|
||||
|
||||
enum AUTH_ALG
|
||||
{
|
||||
AUTH_ALG_NONE = 0
|
||||
, AUTH_ALG_OPEN
|
||||
, AUTH_ALG_SHARED
|
||||
, AUTH_ALG_LEAP
|
||||
};
|
||||
|
||||
// bitwise or-able protos
|
||||
enum PROTO
|
||||
{
|
||||
PROTO_NONE = 0
|
||||
, PROTO_AUTO = PROTO_NONE
|
||||
, PROTO_WPA
|
||||
, PROTO_RSN
|
||||
};
|
||||
|
||||
WirelessSecurity(Connection* conn);
|
||||
SettingsMap toMap() const;
|
||||
void fromMap(const SettingsMap&);
|
||||
|
||||
SettingsMap toSecretsMap(bool with_settings = true) const;
|
||||
bool fromSecretsMap(const SettingsMap&);
|
||||
|
||||
uint32_t getGroupCiphers(void) const;
|
||||
void setGroupCiphers(uint32_t);
|
||||
|
||||
uint32_t getPairwiseCiphers(void) const;
|
||||
void setPairwiseCiphers(uint32_t);
|
||||
|
||||
KEY_MGMT getKeyMgmt(void) const;
|
||||
void setKeyMgmt(KEY_MGMT);
|
||||
|
||||
AUTH_ALG getAuthAlg(void) const;
|
||||
void setAuthAlg(AUTH_ALG);
|
||||
|
||||
uint32_t getProto(void) const;
|
||||
void setProto(uint32_t);
|
||||
void addProto(uint32_t);
|
||||
void delProto(uint32_t);
|
||||
|
||||
TQString getPSK(void) const;
|
||||
void setPSK(const TQString&);
|
||||
|
||||
TQString getLeapUsername(void) const;
|
||||
void setLeapUsername(const TQString&);
|
||||
|
||||
TQString getLeapPassword(void) const;
|
||||
void setLeapPassword(const TQString&);
|
||||
|
||||
TQString getWepKey(int) const;
|
||||
void setWepKey(int, TQString);
|
||||
|
||||
int getWepTxidx() const;
|
||||
void setWepTxidx(int);
|
||||
|
||||
bool isValid() const;
|
||||
bool getEnabled() const;
|
||||
|
||||
private:
|
||||
// settigs
|
||||
KEY_MGMT _keyMgmt;
|
||||
int _wepTxKeyidx;
|
||||
AUTH_ALG _authAlg;
|
||||
uint32_t _proto;
|
||||
uint32_t _pairwise;
|
||||
uint32_t _group;
|
||||
TQString _leapUsername;
|
||||
|
||||
// secrets
|
||||
TQString _wepKey[4];
|
||||
TQString _psk;
|
||||
TQString _leapPassword;
|
||||
|
||||
TQBiDirectionalMap<KEY_MGMT, TQString> _keyMgmtMap;
|
||||
TQBiDirectionalMap<AUTH_ALG, TQString> _authAlgMap;
|
||||
TQBiDirectionalMap<PROTO, TQString> _protoMap;
|
||||
TQBiDirectionalMap<CIPHERS, TQString> _cipherMap;
|
||||
};
|
||||
|
||||
}
|
||||
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */
|
@ -1,81 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-device.cpp - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
|
||||
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
// TDE includes
|
||||
#include <kdebug.h>
|
||||
|
||||
// TQtDBus includes
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusproxy.h>
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
|
||||
// NM includes
|
||||
#include <NetworkManager.h>
|
||||
#include <NetworkManagerVPN.h>
|
||||
|
||||
// TDENM includes
|
||||
#include "tdenetman.h"
|
||||
#include "tdenetman-nm_vpn_proxy.h"
|
||||
#include "tdenetman-device.h"
|
||||
#include "tdenetman-devicestore.h"
|
||||
//#include "tdenetman-connection.h"
|
||||
#include "tdenetman-connection_store.h"
|
||||
#include "dbus/vpnconnectionproxy.h"
|
||||
|
||||
class NMVPNProxyPrivate
|
||||
{
|
||||
public:
|
||||
NMVPNProxyPrivate()
|
||||
{}
|
||||
|
||||
static NMVPNProxy* nm;
|
||||
};
|
||||
|
||||
NMVPNProxy* NMVPNProxyPrivate::nm = NULL;
|
||||
|
||||
NMVPNProxy::NMVPNProxy()
|
||||
: NetworkManagerVPNProxy(NM_DBUS_SERVICE, NM_DBUS_PATH_VPN_CONNECTION)
|
||||
{
|
||||
d = new NMVPNProxyPrivate();
|
||||
NetworkManagerVPNProxy::setConnection(TQDBusConnection::systemBus());
|
||||
}
|
||||
|
||||
NMVPNProxy::~NMVPNProxy()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
NMVPNProxy* NMVPNProxy::getInstance()
|
||||
{
|
||||
if (NMVPNProxyPrivate::nm)
|
||||
return NMVPNProxyPrivate::nm;
|
||||
return (NMVPNProxyPrivate::nm = new NMVPNProxy());
|
||||
}
|
||||
|
||||
|
||||
#include "tdenetman-nm_vpn_proxy.moc"
|
@ -1,52 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* tdenetman-nm_proxy.h - A NetworkManager frontend for TDE
|
||||
*
|
||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
||||
*
|
||||
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
|
||||
*
|
||||
* 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_NMVPNPROXY_H
|
||||
#define KNETWORKMANAGER_NMVPNPROXY_H
|
||||
|
||||
#include "dbus/networkmanagervpnproxy.h"
|
||||
|
||||
namespace ConnectionSettings
|
||||
{
|
||||
class Connection;
|
||||
}
|
||||
class Device;
|
||||
class NMVPNProxyPrivate;
|
||||
|
||||
class NMVPNProxy : public DBus::NetworkManagerVPNProxy
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static NMVPNProxy* getInstance();
|
||||
|
||||
protected:
|
||||
NMVPNProxy ();
|
||||
~NMVPNProxy ();
|
||||
|
||||
private:
|
||||
NMVPNProxyPrivate * d;
|
||||
};
|
||||
|
||||
#endif /* KNETWORKMANAGER_NMVPNPROXY_H */
|
Loading…
Reference in new issue