diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-01 19:37:22 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-01 19:37:22 -0500 |
commit | 589db866d81a312fe7e24d5a8f3d818e1d956e4f (patch) | |
tree | 5d00a09458214794f076ba1102c61db704d3e31c | |
parent | aae14103d5218d1b939e484a6335f0ba6f563aff (diff) | |
download | tdelibs-589db866d81a312fe7e24d5a8f3d818e1d956e4f.tar.gz tdelibs-589db866d81a312fe7e24d5a8f3d818e1d956e4f.zip |
Add bluetooth, olpcmesh, etc.
-rw-r--r-- | tdecore/networkbackends/network-manager/dbus/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tdecore/networkbackends/network-manager/network-manager.cpp | 422 | ||||
-rw-r--r-- | tdecore/networkbackends/network-manager/network-manager_p.h | 3 | ||||
-rw-r--r-- | tdecore/tdenetworkconnections.cpp | 74 | ||||
-rw-r--r-- | tdecore/tdenetworkconnections.h | 113 |
5 files changed, 611 insertions, 11 deletions
diff --git a/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt b/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt index 0739a85d8..6f4e39f6f 100644 --- a/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt +++ b/tdecore/networkbackends/network-manager/dbus/CMakeLists.txt @@ -39,6 +39,8 @@ add_dbus_xml( p networkmanagerpppproxy NetworkManagerPPPProxy DBus nm-ppp-manage add_dbus_xml( p deviceproxy DeviceProxy DBus nm-device.xml ) add_dbus_xml( p wifiproxy WiFiDeviceProxy DBus nm-device-wifi.xml ) add_dbus_xml( p wimaxproxy WiMaxDeviceProxy DBus nm-device-wimax.xml ) +add_dbus_xml( p olpcmeshproxy OlpcMeshDeviceProxy DBus nm-device-olpc-mesh.xml ) +add_dbus_xml( p bluetoothproxy BluetoothDeviceProxy DBus nm-device-bt.xml ) add_dbus_xml( p ethernetproxy EthernetDeviceProxy DBus nm-device-ethernet.xml ) add_dbus_xml( p infinibandproxy InfinibandDeviceProxy DBus nm-device-infiniband.xml ) add_dbus_xml( p modemproxy ModemDeviceProxy DBus nm-device-modem.xml ) @@ -52,7 +54,7 @@ add_dbus_xml( p connectionsettings ConnectionSettingsInterface DBus nm-settings- # generate moc files -set( MOCHEADERS accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagerpppproxy.h ethernetproxy.h +set( MOCHEADERS accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagerpppproxy.h bluetoothproxy.h olpcmeshproxy.h ethernetproxy.h infinibandproxy.h wifiproxy.h wimaxproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h modemproxy.h networkmanagersettings.h connectionsettings.h ) @@ -75,9 +77,9 @@ add_custom_command( OUTPUT mocfiles.cpp tde_add_library( tdenm_dbus STATIC_PIC SOURCES networkmanagerproxy.cpp networkmanagerpppproxy.cpp - deviceproxy.cpp ethernetproxy.cpp infinibandproxy.cpp wifiproxy.cpp - wimaxproxy.cpp accesspointproxy.cpp networkmanagersettings.cpp - connectionsettings.cpp + deviceproxy.cpp bluetoothproxy.cpp olpcmeshproxy.cpp ethernetproxy.cpp + infinibandproxy.cpp wifiproxy.cpp wimaxproxy.cpp accesspointproxy.cpp + networkmanagersettings.cpp connectionsettings.cpp mocfiles.cpp activeconnectionproxy.cpp vpnconnectionproxy.cpp vpnpluginproxy.cpp modemproxy.cpp ) diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp index 1b95d5d09..5dc8daaf0 100644 --- a/tdecore/networkbackends/network-manager/network-manager.cpp +++ b/tdecore/networkbackends/network-manager/network-manager.cpp @@ -238,6 +238,12 @@ TDENetworkConnectionType::TDENetworkConnectionType nmConnectionTypeToTDEConnecti else if (nm.lower() == "vlan") { ret = TDENetworkConnectionType::VLAN; } + else if (nm.lower() == "802-11-olpc-mesh") { + ret = TDENetworkConnectionType::OLPCMesh; + } + else if (nm.lower() == "bluetooth") { + ret = TDENetworkConnectionType::Bluetooth; + } return ret; } @@ -263,6 +269,12 @@ TQString tdeConnectionTypeToNMConnectionType(TDENetworkConnectionType::TDENetwor else if (type == TDENetworkConnectionType::VLAN) { ret = "vlan"; } + else if (type == TDENetworkConnectionType::OLPCMesh) { + ret = "802-11-olpc-mesh"; + } + else if (type == TDENetworkConnectionType::Bluetooth) { + ret = "bluetooth"; + } return ret; } @@ -463,6 +475,32 @@ TQString tdeWiFiModeToNMWiFiMode(TDEWiFiMode::TDEWiFiMode mode) { return ret; } +TDEBluetoothConnectionType::TDEBluetoothConnectionType nmBluetoothModeToTDEBluetoothMode(TQString nm) { + TDEBluetoothConnectionType::TDEBluetoothConnectionType ret = TDEBluetoothConnectionType::PAN; + + if (nm.lower() == "dun") { + ret = TDEBluetoothConnectionType::DUN; + } + else if (nm.lower() == "panu") { + ret = TDEBluetoothConnectionType::PAN; + } + + return ret; +} + +TQString tdeBluetoothModeToNMBluetoothMode(TDEBluetoothConnectionType::TDEBluetoothConnectionType type) { + TQString ret; + + if (type == TDEBluetoothConnectionType::DUN) { + ret = "dun"; + } + else if (type == TDEBluetoothConnectionType::PAN) { + ret = "panu"; + } + + return ret; +} + TDEWiFiFrequencyBand::TDEWiFiFrequencyBand nmWiFiFrequencyBandToTDEWiFiFrequencyBand(TQString nm) { TDEWiFiFrequencyBand::TDEWiFiFrequencyBand ret = TDEWiFiFrequencyBand::Other; @@ -722,6 +760,32 @@ unsigned int tdeVLANFlagsToNMVLANFlags(TDENetworkVLANFlags::TDENetworkVLANFlags return ret; } +TDENetworkParity::TDENetworkParity nmParityToTDEParity(char nm) { + TDENetworkParity::TDENetworkParity ret = TDENetworkParity::None; + + if (nm == 'E') { + ret = TDENetworkParity::Even; + } + else if (nm == 'o') { + ret = TDENetworkParity::Odd; + } + + return ret; +} + +char tdeParityToNMParity(TDENetworkParity::TDENetworkParity parity) { + char ret = 'n'; + + if (parity == TDENetworkParity::Even) { + ret = 'E'; + } + else if (parity == TDENetworkParity::Odd) { + ret = 'o'; + } + + return ret; +} + TDENetworkWepKeyType::TDENetworkWepKeyType nmWepKeyTypeToTDEWepKeyType(unsigned int nm) { TDENetworkWepKeyType::TDENetworkWepKeyType ret = TDENetworkWepKeyType::Hexadecimal; @@ -935,6 +999,36 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m } } } + else if (deviceType == TDENetworkDeviceType::WiMax) { + DBus::WiMaxDeviceProxy wiMaxDevice(NM_DBUS_SERVICE, (*it)); + wiMaxDevice.setConnection(TQT_DBusConnection::systemBus()); + TQString candidateMACAddress = wiMaxDevice.getHwAddress(error); + if (!error.isValid()) { + if (candidateMACAddress.lower() == macAddress.lower()) { + return (*it); + } + } + } + else if (deviceType == TDENetworkDeviceType::OLPCMesh) { + DBus::OlpcMeshDeviceProxy olpcMeshDevice(NM_DBUS_SERVICE, (*it)); + olpcMeshDevice.setConnection(TQT_DBusConnection::systemBus()); + TQString candidateMACAddress = olpcMeshDevice.getHwAddress(error); + if (!error.isValid()) { + if (candidateMACAddress.lower() == macAddress.lower()) { + return (*it); + } + } + } + else if (deviceType == TDENetworkDeviceType::Bluetooth) { + DBus::BluetoothDeviceProxy bluetoothDevice(NM_DBUS_SERVICE, (*it)); + bluetoothDevice.setConnection(TQT_DBusConnection::systemBus()); + TQString candidateMACAddress = bluetoothDevice.getHwAddress(error); + if (!error.isValid()) { + if (candidateMACAddress.lower() == macAddress.lower()) { + return (*it); + } + } + } // FIXME // Add other supported device types here } @@ -1163,6 +1257,8 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { TDEVPNConnection* vpnConnection = NULL; TDEWiMaxConnection* wiMaxConnection = NULL; TDEVLANConnection* vlanConnection = NULL; + TDEOLPCMeshConnection* olpcMeshConnection = NULL; + TDEBluetoothConnection* bluetoothConnection = NULL; TDENetworkConnectionType::TDENetworkConnectionType connType = connectionType((*it)); if (connType == TDENetworkConnectionType::WiredEthernet) { connection = ethernetConnection = new TDEWiredEthernetConnection; @@ -1182,6 +1278,12 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { else if (connType == TDENetworkConnectionType::VLAN) { connection = vlanConnection = new TDEVLANConnection; } + else if (connType == TDENetworkConnectionType::OLPCMesh) { + connection = olpcMeshConnection = new TDEOLPCMeshConnection; + } + else if (connType == TDENetworkConnectionType::Bluetooth) { + connection = bluetoothConnection = new TDEBluetoothConnection; + } else { connection = new TDENetworkConnection; } @@ -1488,7 +1590,18 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { } } else if (outerKeyValue.lower() == "802-11-wireless") { - if (keyValue.lower() == "mac-address") { + if (keyValue.lower() == "ssid") { + TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); + TQT_DBusDataValueList::const_iterator it4; + int count = 0; + for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) { + TQT_DBusData innerDataValue = *it4; + wiFiConnection->SSID.resize(count+1); + wiFiConnection->SSID[count] = innerDataValue.toByte(); + count++; + } + } + else if (keyValue.lower() == "mac-address") { TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); TQT_DBusDataValueList::const_iterator it4; TDENetworkByteList macAddress; @@ -1693,6 +1806,147 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() { } } } + else if (outerKeyValue.lower() == "serial") { + if (keyValue.lower() == "baud") { + connection->serialConfig.baudRate = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "bits") { + connection->serialConfig.byteWidth = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "parity") { + connection->serialConfig.parity = nmParityToTDEParity(dataValue2.toByte()); + } + else if (keyValue.lower() == "stopbits") { + connection->serialConfig.stopBits = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "send-delay") { + connection->serialConfig.txDelay = dataValue2.toUInt64(); + } + connection->serialConfig.valid = true; + } + else if (outerKeyValue.lower() == "ppp") { + if (keyValue.lower() == "noauth") { + connection->pppConfig.requireServerAuthentication = !(dataValue2.toBool()); + } + else if (keyValue.lower() == "refuse-eap") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableEAP; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableEAP; + } + else if (keyValue.lower() == "refuse-pap") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisablePAP; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisablePAP; + } + else if (keyValue.lower() == "refuse-chap") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableCHAP; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableCHAP; + } + else if (keyValue.lower() == "refuse-mschap") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableMSCHAP; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableMSCHAP; + } + else if (keyValue.lower() == "refuse-mschapv2") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::DisableMSCHAPv2; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::DisableMSCHAPv2; + } + else if (keyValue.lower() == "nobsdcomp") { + if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowBSDCompression; + else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowBSDCompression; + } + else if (keyValue.lower() == "nodeflate") { + if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowDeflateCompression; + else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowDeflateCompression; + } + else if (keyValue.lower() == "no-vj-comp") { + if (dataValue2.toBool()) connection->pppConfig.flags &= ~TDENetworkPPPFlags::AllowVJCompression; + else connection->pppConfig.flags |= TDENetworkPPPFlags::AllowVJCompression; + } + else if (keyValue.lower() == "require-mppe") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::RequireMPPE; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::RequireMPPE; + } + else if (keyValue.lower() == "require-mppe-128") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::RequireMPPE128; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::RequireMPPE128; + } + else if (keyValue.lower() == "mppe-stateful") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::StatefulMPPE; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::StatefulMPPE; + } + else if (keyValue.lower() == "crtscts") { + if (dataValue2.toBool()) connection->pppConfig.flags |= TDENetworkPPPFlags::UseHardwareFlowControl; + else connection->pppConfig.flags &= ~TDENetworkPPPFlags::UseHardwareFlowControl; + } + else if (keyValue.lower() == "baud") { + connection->pppConfig.baudRate = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "mru") { + connection->pppConfig.mru = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "mtu") { + connection->pppConfig.mtu = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "lcp-echo-interval") { + connection->pppConfig.lcpEchoPingInterval = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "lcp-echo-failure") { + connection->pppConfig.lcpEchoFailureThreshold = dataValue2.toUInt32(); + } + connection->pppConfig.valid = true; + } + else if (outerKeyValue.lower() == "pppoe") { + if (keyValue.lower() == "service") { + connection->pppoeConfig.networkServiceProvider = dataValue2.toString(); + } + else if (keyValue.lower() == "username") { + connection->pppoeConfig.username = dataValue2.toString(); + } + else if (keyValue.lower() == "password-flags") { + connection->pppoeConfig.passwordFlags = nmPasswordFlagsToTDEPasswordFlags(dataValue2.toUInt32()); + } + connection->pppoeConfig.secretsValid = true; + } + else if ((outerKeyValue.lower() == "802-11-olpc-mesh") && (olpcMeshConnection)) { + if (keyValue.lower() == "ssid") { + TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); + TQT_DBusDataValueList::const_iterator it4; + int count = 0; + for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) { + TQT_DBusData innerDataValue = *it4; + olpcMeshConnection->SSID.resize(count+1); + olpcMeshConnection->SSID[count] = innerDataValue.toByte(); + count++; + } + } + else if (keyValue.lower() == "channel") { + olpcMeshConnection->channel = dataValue2.toUInt32(); + } + else if (keyValue.lower() == "dhcp-anycast-address") { + TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); + TQT_DBusDataValueList::const_iterator it4; + int count = 0; + for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) { + TQT_DBusData innerDataValue = *it4; + olpcMeshConnection->anycastDHCPHWAddress.resize(count+1); + olpcMeshConnection->anycastDHCPHWAddress[count] = innerDataValue.toByte(); + count++; + } + } + } + else if ((outerKeyValue.lower() == "bluetooth") && (bluetoothConnection)) { + if (keyValue.lower() == "bdaddr") { + TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); + TQT_DBusDataValueList::const_iterator it4; + TDENetworkByteList macAddress; + for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) { + TQT_DBusData innerDataValue = *it4; + macAddress.append(innerDataValue.toByte()); + } + connection->lockedHWAddress.setAddress(macAddress); + } + else if (keyValue.lower() == "type") { + bluetoothConnection->type = nmBluetoothModeToTDEBluetoothMode(dataValue2.toString()); + } + } else if (outerKeyValue.lower() == "ipv4") { if (keyValue.lower() == "addresses") { TQT_DBusDataValueList valueList = dataValue2.toTQValueList(); @@ -2043,6 +2297,10 @@ bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQStri //TDEWiredInfinibandConnection* infinibandConnection = dynamic_cast<TDEWiredInfinibandConnection*>(connection); TDEWiFiConnection* wiFiConnection = dynamic_cast<TDEWiFiConnection*>(connection); TDEVPNConnection* vpnConnection = dynamic_cast<TDEVPNConnection*>(connection); + //TDEWiMaxConnection* wiMaxConnection = dynamic_cast<TDEWiMaxConnection*>(connection); + //TDEVLANConnection* vlanConnection = dynamic_cast<TDEVLANConnection*>(connection); + //TDEOLPCMeshConnection* olpcMeshConnection = dynamic_cast<TDEVLANConnection*>(connection); + //TDEBluetoothConnection* bluetoothConnection = dynamic_cast<TDEBluetoothConnection*>(connection); TQT_DBusObjectPath existingConnection; TQT_DBusError error; bool ret; @@ -2164,6 +2422,12 @@ bool TDENetworkConnectionManager_BackendNM::loadConnectionSecretsForGroup(TQStri vpnConnection->secretsValid = true; } } + if (outerKeyValue.lower() == "pppoe") { + if (keyValue.lower() == "username") { + connection->pppoeConfig.password = dataValue2.toString(); + } + connection->pppoeConfig.secretsValid = true; + } } } } @@ -2194,6 +2458,8 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* TDEVPNConnection* vpnConnection = dynamic_cast<TDEVPNConnection*>(connection); TDEWiMaxConnection* wiMaxConnection = dynamic_cast<TDEWiMaxConnection*>(connection); TDEVLANConnection* vlanConnection = dynamic_cast<TDEVLANConnection*>(connection); + TDEOLPCMeshConnection* olpcMeshConnection = dynamic_cast<TDEOLPCMeshConnection*>(connection); + TDEBluetoothConnection* bluetoothConnection = dynamic_cast<TDEBluetoothConnection*>(connection); TQT_DBusObjectPath existingConnection; TQT_DBusError error; bool ret; @@ -2251,6 +2517,8 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* else if (vpnConnection) type = "vpn"; else if (wiMaxConnection) type = "wimax"; else if (vlanConnection) type = "vlan"; + else if (olpcMeshConnection) type = "802-11-olpc-mesh"; + else if (bluetoothConnection) type = "bluetooth"; if (!type.isNull()) settingsMap["type"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(type)); } settingsMap["uuid"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(connection->UUID)); @@ -2507,7 +2775,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* if (groupValid) outerMap.insert("802-1x", dbusData, TRUE); else outerMap.remove("802-1x"); dbusData = outerMap["802-3-ethernet"]; - { + if (ethernetConnection) { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); { settingsMap["duplex"] = convertDBUSDataToVariantData(TQT_DBusData::fromString((connection->fullDuplex)?"full":"half")); @@ -2552,7 +2820,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* if (groupValid) outerMap.insert("802-3-ethernet", dbusData, TRUE); else outerMap.remove("802-3-ethernet"); dbusData = outerMap["infiniband"]; - { + if (infinibandConnection) { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); { if (connection->lockedHWAddress.isValid()) { @@ -2583,9 +2851,18 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* if (groupValid) outerMap.insert("infiniband", dbusData, TRUE); else outerMap.remove("infiniband"); dbusData = outerMap["802-11-wireless"]; - { + if (wiFiConnection) { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); { + { + unsigned int i; + TQT_DBusDataValueList valueList; + for (i=0; i<wiFiConnection->SSID.count(); i++) { + TQT_DBusData innerDataValue = TQT_DBusData::fromByte(wiFiConnection->SSID[i]); + valueList.append(innerDataValue); + } + settingsMap["ssid"] = convertDBUSDataToVariantData(TQT_DBusData::fromTQValueList(valueList)); + } if (connection->lockedHWAddress.isValid()) { TDENetworkByteList address = connection->lockedHWAddress.address(); TQT_DBusDataValueList valueList; @@ -2802,7 +3079,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* if (groupValid) outerMap.insert("vpn", dbusData, TRUE); else outerMap.remove("vpn"); dbusData = outerMap["wimax"]; - { + if (wiMaxConnection) { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); { if (connection->lockedHWAddress.isValid()) { @@ -2827,7 +3104,7 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* if (groupValid) outerMap.insert("wimax", dbusData, TRUE); else outerMap.remove("wimax"); dbusData = outerMap["vlan"]; - { + if (vlanConnection) { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); { UPDATE_STRING_SETTING_IF_VALID(vlanConnection->kernelName, "interface-name", settingsMap) @@ -2856,6 +3133,139 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* } if (groupValid) outerMap.insert("vlan", dbusData, TRUE); else outerMap.remove("vlan"); + dbusData = outerMap["serial"]; + if (connection->serialConfig.valid) { + TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); + { + settingsMap["baud"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->serialConfig.baudRate)); + settingsMap["bits"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->serialConfig.byteWidth)); + settingsMap["parity"] = convertDBUSDataToVariantData(TQT_DBusData::fromByte(tdeParityToNMParity(connection->serialConfig.parity))); + settingsMap["stopbits"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->serialConfig.stopBits)); + settingsMap["send-delay"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt64(connection->serialConfig.txDelay)); + } + dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); + groupValid = (settingsMap.count() > 0); + } + if (groupValid) outerMap.insert("serial", dbusData, TRUE); else outerMap.remove("serial"); + + dbusData = outerMap["ppp"]; + if (connection->pppConfig.valid) { + TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); + { + settingsMap["noauth"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(!(connection->pppConfig.requireServerAuthentication))); + settingsMap["refuse-eap"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableEAP)); + settingsMap["refuse-pap"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisablePAP)); + settingsMap["refuse-chap"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP)); + settingsMap["refuse-mschap"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP)); + settingsMap["refuse-mschapv2"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2)); + settingsMap["nobsdcomp"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression))); + settingsMap["nodeflate"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression))); + settingsMap["no-vj-comp"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(!(connection->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression))); + settingsMap["require-mppe"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE)); + settingsMap["require-mppe-128"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128)); + settingsMap["mppe-stateful"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE)); + settingsMap["crtscts"] = convertDBUSDataToVariantData(TQT_DBusData::fromBool(connection->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl)); + settingsMap["baud"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->pppConfig.baudRate)); + if (connection->pppConfig.mru > 0) { + settingsMap["mru"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->pppConfig.mru)); + } + else { + settingsMap.remove("mru"); + } + if (connection->pppConfig.mtu > 0) { + settingsMap["mtu"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->pppConfig.mtu)); + } + else { + settingsMap.remove("mtu"); + } + if (connection->pppConfig.mtu > 0) { + settingsMap["lcp-echo-interval"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->pppConfig.lcpEchoPingInterval)); + } + else { + settingsMap.remove("lcp-echo-interval"); + } + if (connection->pppConfig.mtu > 0) { + settingsMap["lcp-echo-failure"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(connection->pppConfig.lcpEchoFailureThreshold)); + } + else { + settingsMap.remove("lcp-echo-failure"); + } + } + dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); + groupValid = (settingsMap.count() > 0); + } + if (groupValid) outerMap.insert("ppp", dbusData, TRUE); else outerMap.remove("ppp"); + + dbusData = outerMap["pppoe"]; + if (connection->pppoeConfig.valid) { + TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); + { + UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.networkServiceProvider, "service", settingsMap) + UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.username, "username", settingsMap) + if (connection->pppoeConfig.secretsValid) { + UPDATE_STRING_SETTING_IF_VALID(connection->pppoeConfig.password, "password", settingsMap) + } + settingsMap["password-flags"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(tdePasswordFlagsToNMPasswordFlags(connection->pppoeConfig.passwordFlags))); + } + dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); + groupValid = (settingsMap.count() > 0); + } + if (groupValid) outerMap.insert("pppoe", dbusData, TRUE); else outerMap.remove("pppoe"); + + dbusData = outerMap["802-11-olpc-mesh"]; + if (olpcMeshConnection) { + TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); + { + { + unsigned int i; + TQT_DBusDataValueList valueList; + for (i=0; i<olpcMeshConnection->SSID.count(); i++) { + TQT_DBusData innerDataValue = TQT_DBusData::fromByte(olpcMeshConnection->SSID[i]); + valueList.append(innerDataValue); + } + settingsMap["ssid"] = convertDBUSDataToVariantData(TQT_DBusData::fromTQValueList(valueList)); + } + settingsMap["channel"] = convertDBUSDataToVariantData(TQT_DBusData::fromUInt32(olpcMeshConnection->channel)); + { + unsigned int i; + TQT_DBusDataValueList valueList; + for (i=0; i<olpcMeshConnection->anycastDHCPHWAddress.count(); i++) { + TQT_DBusData innerDataValue = TQT_DBusData::fromByte(olpcMeshConnection->anycastDHCPHWAddress[i]); + valueList.append(innerDataValue); + } + settingsMap["dhcp-anycast-address"] = convertDBUSDataToVariantData(TQT_DBusData::fromTQValueList(valueList)); + } + } + dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); + groupValid = (settingsMap.count() > 0); + } + if (groupValid) outerMap.insert("802-11-olpc-mesh", dbusData, TRUE); else outerMap.remove("802-11-olpc-mesh"); + + dbusData = outerMap["bluetooth"]; + if (olpcMeshConnection) { + TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); + { + if (connection->lockedHWAddress.isValid()) { + TDENetworkByteList address = connection->lockedHWAddress.address(); + TQT_DBusDataValueList valueList; + TDENetworkByteList::iterator it; + for (it = address.begin(); it != address.end(); ++it) { + TQT_DBusData innerDataValue = TQT_DBusData::fromByte(*it); + valueList.append(innerDataValue); + } + TQT_DBusData nmHWAddress = TQT_DBusData::fromTQValueList(valueList); + settingsMap["bdaddr"] = convertDBUSDataToVariantData(nmHWAddress); + } + else { + settingsMap.remove("bdaddr"); + } + UPDATE_STRING_SETTING_IF_VALID(tdeBluetoothModeToNMBluetoothMode(bluetoothConnection->type), "type", settingsMap) + } + dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap)); + groupValid = (settingsMap.count() > 0); + } + if (groupValid) outerMap.insert("bluetooth", dbusData, TRUE); else outerMap.remove("bluetooth"); + dbusData = outerMap["ipv4"]; { TQMap<TQString, TQT_DBusData> settingsMap = dbusData.toStringKeyMap().toTQMap(); diff --git a/tdecore/networkbackends/network-manager/network-manager_p.h b/tdecore/networkbackends/network-manager/network-manager_p.h index c162d8d7f..e7356fd79 100644 --- a/tdecore/networkbackends/network-manager/network-manager_p.h +++ b/tdecore/networkbackends/network-manager/network-manager_p.h @@ -48,6 +48,9 @@ #include "ethernetproxy.h" #include "infinibandproxy.h" #include "wifiproxy.h" +#include "wimaxproxy.h" +#include "bluetoothproxy.h" +#include "olpcmeshproxy.h" #include "activeconnectionproxy.h" #include "accesspointproxy.h" diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp index 4aa246578..0704cfb37 100644 --- a/tdecore/tdenetworkconnections.cpp +++ b/tdecore/tdenetworkconnections.cpp @@ -303,6 +303,56 @@ TDENetworkIEEE8021xConfiguration::~TDENetworkIEEE8021xConfiguration() { } /*================================================================================================*/ +/* TDENetworkPPPConfiguration */ +/*================================================================================================*/ + +TDENetworkPPPConfiguration::TDENetworkPPPConfiguration() { + valid = false; + requireServerAuthentication = false; + flags = TDENetworkPPPFlags::None; + baudRate = 115200; + mru = 0; + mtu = 0; + lcpEchoPingInterval = 0; + lcpEchoFailureThreshold = 0; +} + +TDENetworkPPPConfiguration::~TDENetworkPPPConfiguration() { + // +} + +/*================================================================================================*/ +/* TDENetworkPPPOEConfiguration */ +/*================================================================================================*/ + +TDENetworkPPPOEConfiguration::TDENetworkPPPOEConfiguration() { + valid = false; + secretsValid = false; + passwordFlags = TDENetworkPasswordHandlingFlags::None; +} + +TDENetworkPPPOEConfiguration::~TDENetworkPPPOEConfiguration() { + // +} + +/*================================================================================================*/ +/* TDENetworkSerialConfiguration */ +/*================================================================================================*/ + +TDENetworkSerialConfiguration::TDENetworkSerialConfiguration() { + valid = false; + baudRate = 115200; + byteWidth = 8; + parity = TDENetworkParity::None; + stopBits = 1; + txDelay = 0; +} + +TDENetworkSerialConfiguration::~TDENetworkSerialConfiguration() { + // +} + +/*================================================================================================*/ /* TDENetworkIPConfiguration */ /*================================================================================================*/ @@ -471,6 +521,30 @@ TDEVLANConnection::~TDEVLANConnection() { } /*================================================================================================*/ +/* TDEOLPCMeshConnection */ +/*================================================================================================*/ + +TDEOLPCMeshConnection::TDEOLPCMeshConnection() : TDENetworkConnection() { + channel = 0; +} + +TDEOLPCMeshConnection::~TDEOLPCMeshConnection() { + // +} + +/*================================================================================================*/ +/* TDEBluetoothConnection */ +/*================================================================================================*/ + +TDEBluetoothConnection::TDEBluetoothConnection() : TDENetworkConnection() { + type = TDEBluetoothConnectionType::Other; +} + +TDEBluetoothConnection::~TDEBluetoothConnection() { + // +} + +/*================================================================================================*/ /* TDEWiFiConnection */ /*================================================================================================*/ diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h index 1e81cd851..3ba5c3be8 100644 --- a/tdecore/tdenetworkconnections.h +++ b/tdecore/tdenetworkconnections.h @@ -125,6 +125,25 @@ namespace TDEWiFiFrequencyBand { }; }; +namespace TDEBluetoothConnectionType { + enum TDEBluetoothConnectionType { + DUN, + PAN, + Other, + Last = Other + }; +}; + +namespace TDENetworkParity { + enum TDENetworkParity { + None, + Even, + Odd, + Other, + Last = Other + }; +}; + namespace TDENetworkSlaveDeviceType { enum TDENetworkSlaveDeviceType { None, @@ -160,6 +179,26 @@ namespace TDENetworkDeviceCapabilityFlags { CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkDeviceCapabilityFlags) }; +namespace TDENetworkPPPFlags { + enum TDENetworkPPPFlags { + None = 0x00000000, + DisableEAP = 0x00000001, + DisablePAP = 0x00000002, + DisableCHAP = 0x00000004, + DisableMSCHAP = 0x00000008, + DisableMSCHAPv2 = 0x00000010, + AllowBSDCompression = 0x00000020, + AllowDeflateCompression = 0x00000040, + AllowVJCompression = 0x00000080, + RequireMPPE = 0x00000100, + RequireMPPE128 = 0x00000200, + StatefulMPPE = 0x00000400, + UseHardwareFlowControl = 0x00000800 + }; + + CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkPPPFlags) +}; + namespace TDENetworkWiFiAPFlags { enum TDENetworkWiFiAPFlags { None = 0x00000000, @@ -491,6 +530,53 @@ class TDENetworkIEEE8021xConfiguration bool forceSystemCaCertificates; }; +class TDECORE_EXPORT TDENetworkPPPConfiguration +{ + public: + TDENetworkPPPConfiguration(); + virtual ~TDENetworkPPPConfiguration(); + + public: + bool valid; + bool requireServerAuthentication; + TDENetworkPPPFlags::TDENetworkPPPFlags flags; + TQ_UINT32 baudRate; + TQ_UINT32 mru; + TQ_UINT32 mtu; + TQ_UINT32 lcpEchoPingInterval; + TQ_UINT32 lcpEchoFailureThreshold; +}; + +class TDECORE_EXPORT TDENetworkPPPOEConfiguration +{ + public: + TDENetworkPPPOEConfiguration(); + virtual ~TDENetworkPPPOEConfiguration(); + + public: + bool valid; + bool secretsValid; + TQString networkServiceProvider; + TQString username; + TQString password; + TDENetworkPasswordHandlingFlags::TDENetworkPasswordHandlingFlags passwordFlags; +}; + +class TDECORE_EXPORT TDENetworkSerialConfiguration +{ + public: + TDENetworkSerialConfiguration(); + virtual ~TDENetworkSerialConfiguration(); + + public: + bool valid; + TQ_UINT32 baudRate; + TQ_UINT32 byteWidth; + TDENetworkParity::TDENetworkParity parity; + TQ_UINT32 stopBits; + TQ_UINT64 txDelay; +}; + class TDENetworkWiFiSecurityConfiguration { public: @@ -623,6 +709,9 @@ class TDECORE_EXPORT TDENetworkConnection bool requireIPV6; TQ_UINT32 mtu; TDENetworkIEEE8021xConfiguration eapConfig; + TDENetworkPPPConfiguration pppConfig; + TDENetworkPPPOEConfiguration pppoeConfig; + TDENetworkSerialConfiguration serialConfig; TQStringList authorizedUsers; TQString masterConnectionUUID; TDENetworkSlaveDeviceType::TDENetworkSlaveDeviceType slaveType; @@ -643,7 +732,7 @@ class TDECORE_EXPORT TDEWiFiConnection : public TDENetworkConnection virtual ~TDEWiFiConnection(); public: - TQString SSID; + TQByteArray SSID; TDEWiFiMode::TDEWiFiMode operatingMode; TDEWiFiFrequencyBand::TDEWiFiFrequencyBand bandRestriction; TQ_INT32 channelRestriction; @@ -706,6 +795,28 @@ class TDECORE_EXPORT TDEVLANConnection : public TDENetworkConnection TDENetworkPriorityMap egressPriorityMap; }; +class TDECORE_EXPORT TDEOLPCMeshConnection : public TDENetworkConnection +{ + public: + TDEOLPCMeshConnection(); + virtual ~TDEOLPCMeshConnection(); + + public: + TQByteArray SSID; + TQ_INT32 channel; + TQByteArray anycastDHCPHWAddress; +}; + +class TDECORE_EXPORT TDEBluetoothConnection : public TDENetworkConnection +{ + public: + TDEBluetoothConnection(); + virtual ~TDEBluetoothConnection(); + + public: + TDEBluetoothConnectionType::TDEBluetoothConnectionType type; +}; + typedef TQPtrList< TDENetworkConnection > TDENetworkConnectionList; class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject |