From 2aecc213ffc5dd36d9e6094dbdad03cfc95d77a6 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Wed, 18 Nov 2020 17:46:47 +0100 Subject: [PATCH] Rename DataSecurity enums; conflict with Wifimanager --- examples/knx-demo/platformio-ci.ini | 58 +++++++++++++-------------- src/knx/application_layer.cpp | 2 +- src/knx/application_layer.h | 2 +- src/knx/bau_systemB_device.cpp | 2 +- src/knx/knx_types.h | 6 +-- src/knx/secure_application_layer.cpp | 18 ++++----- src/knx/security_interface_object.cpp | 4 +- 7 files changed, 46 insertions(+), 46 deletions(-) diff --git a/examples/knx-demo/platformio-ci.ini b/examples/knx-demo/platformio-ci.ini index 22e5e6d..2fee107 100644 --- a/examples/knx-demo/platformio-ci.ini +++ b/examples/knx-demo/platformio-ci.ini @@ -25,44 +25,44 @@ build_flags = ;--- ESP8266 ----------------------------------------------- -#[env:nodemcuv2_ip] -#platform = espressif8266 -#board = nodemcuv2 -#framework = arduino -#lib_deps = -# WifiManager@0.15.0 -# knx +[env:nodemcuv2_ip] +platform = espressif8266 +board = nodemcuv2 +framework = arduino +lib_deps = + WifiManager + knx -#build_flags = -# -DMASK_VERSION=0x57B0 -# -Wno-unknown-pragmas +build_flags = + -DMASK_VERSION=0x57B0 + -Wno-unknown-pragmas -#[env:nodemcuv2_tp] -#platform = espressif8266 -#board = nodemcuv2 -#framework = arduino -#lib_deps = -# WifiManager@0.15.0 -# knx +[env:nodemcuv2_tp] +platform = espressif8266 +board = nodemcuv2 +framework = arduino +lib_deps = + WifiManager@0.15.0 + knx -#build_flags = -# -DMASK_VERSION=0x07B0 -# -Wno-unknown-pragmas +build_flags = + -DMASK_VERSION=0x07B0 + -Wno-unknown-pragmas ;--------------------------------------------------------- ;--- ESP32 ----------------------------------------------- -#[env:esp32dev_ip] -#platform = espressif32 -#board = esp32dev -#framework = arduino -#lib_deps = -# knx +[env:esp32dev_ip] +platform = espressif32 +board = esp32dev +framework = arduino +lib_deps = + knx -#build_flags = -# -DMASK_VERSION=0x57B0 -# -Wno-unknown-pragmas +build_flags = + -DMASK_VERSION=0x57B0 + -Wno-unknown-pragmas [env:esp32dev_tp] platform = espressif32 diff --git a/src/knx/application_layer.cpp b/src/knx/application_layer.cpp index 18094d0..7103974 100644 --- a/src/knx/application_layer.cpp +++ b/src/knx/application_layer.cpp @@ -8,7 +8,7 @@ #include "bits.h" #include -const SecurityControl ApplicationLayer::noSecurity {.toolAccess=false, .dataSecurity=DataSecurity::none}; +const SecurityControl ApplicationLayer::noSecurity {.toolAccess=false, .dataSecurity=DataSecurity::None}; ApplicationLayer::ApplicationLayer(BusAccessUnit& bau) : _bau(bau) { diff --git a/src/knx/application_layer.h b/src/knx/application_layer.h index 73832e2..ae6da70 100644 --- a/src/knx/application_layer.h +++ b/src/knx/application_layer.h @@ -31,7 +31,7 @@ class ApplicationLayer void associationTableObject(AssociationTableObject& assocTable); // from transport layer - // Note: without data secure feature, the application layer is just used with SecurtyControl.dataSecurity = none + // Note: without data secure feature, the application layer is just used with SecurtyControl.dataSecurity = None // hooks that can be implemented by derived class (e.g. SecureApplicationLayer) #pragma region Transport - Layer - Callbacks diff --git a/src/knx/bau_systemB_device.cpp b/src/knx/bau_systemB_device.cpp index 3574b34..43d70f7 100644 --- a/src/knx/bau_systemB_device.cpp +++ b/src/knx/bau_systemB_device.cpp @@ -79,7 +79,7 @@ void BauSystemBDevice::sendNextGroupTelegram() // Get security flags from Security Interface Object for this group object goSecurity.dataSecurity = _secIfObj.getGroupObjectSecurity(asap); #else - goSecurity.dataSecurity = DataSecurity::none; + goSecurity.dataSecurity = DataSecurity::None; #endif if (flag == WriteRequest && go.transmitEnable()) diff --git a/src/knx/knx_types.h b/src/knx/knx_types.h index 8a5ca15..a97fca9 100644 --- a/src/knx/knx_types.h +++ b/src/knx/knx_types.h @@ -204,9 +204,9 @@ enum ApduType enum DataSecurity { - none, - auth, - authConf + None, + Auth, + AuthConf }; struct SecurityControl diff --git a/src/knx/secure_application_layer.cpp b/src/knx/secure_application_layer.cpp index d1ecdcf..7913c78 100644 --- a/src/knx/secure_application_layer.cpp +++ b/src/knx/secure_application_layer.cpp @@ -305,7 +305,7 @@ void SecureApplicationLayer::dataGroupRequest(AckType ack, HopCountType hopType, println("dataGroupRequest"); - if (secCtrl.dataSecurity != DataSecurity::none) + if (secCtrl.dataSecurity != DataSecurity::None) { apdu.frame().sourceAddress(_deviceObj.individualAddress()); apdu.frame().destinationAddress(_addrTab->getGroupAddress(tsap)); @@ -328,7 +328,7 @@ void SecureApplicationLayer::dataBroadcastRequest(AckType ack, HopCountType hopT { println("dataBroadcastRequest"); - if (secCtrl.dataSecurity != DataSecurity::none) + if (secCtrl.dataSecurity != DataSecurity::None) { apdu.frame().sourceAddress(_deviceObj.individualAddress()); apdu.frame().destinationAddress(0x0000); @@ -352,7 +352,7 @@ void SecureApplicationLayer::dataSystemBroadcastRequest(AckType ack, HopCountTyp { println("dataSystemBroadcastRequest"); - if (secCtrl.dataSecurity != DataSecurity::none) + if (secCtrl.dataSecurity != DataSecurity::None) { apdu.frame().sourceAddress(_deviceObj.individualAddress()); apdu.frame().destinationAddress(0x0000); @@ -376,7 +376,7 @@ void SecureApplicationLayer::dataIndividualRequest(AckType ack, HopCountType hop { println("dataIndividualRequest"); - if (secCtrl.dataSecurity != DataSecurity::none) + if (secCtrl.dataSecurity != DataSecurity::None) { apdu.frame().sourceAddress(_deviceObj.individualAddress()); apdu.frame().destinationAddress(destination); @@ -399,7 +399,7 @@ void SecureApplicationLayer::dataConnectedRequest(uint16_t tsap, Priority priori { println("dataConnectedRequest"); - if (secCtrl.dataSecurity != DataSecurity::none) + if (secCtrl.dataSecurity != DataSecurity::None) { apdu.frame().sourceAddress(_deviceObj.individualAddress()); apdu.frame().destinationAddress(_transportLayer->getConnectionAddress()); @@ -593,7 +593,7 @@ void SecureApplicationLayer::updateLastValidSequence(bool toolAccess, uint16_t r void SecureApplicationLayer::sendSyncRequest(uint16_t dstAddr, bool dstAddrIsGroupAddr, const SecurityControl &secCtrl, bool systemBcast) { - if (secCtrl.dataSecurity != DataSecurity::authConf) + if (secCtrl.dataSecurity != DataSecurity::AuthConf) { println("sync.req is always sent with auth+conf!"); return; @@ -655,7 +655,7 @@ void SecureApplicationLayer::sendSyncRequest(uint16_t dstAddr, bool dstAddrIsGro void SecureApplicationLayer::sendSyncResponse(uint16_t dstAddr, bool dstAddrIsGroupAddr, const SecurityControl &secCtrl, uint64_t remoteNextSeqNum, bool systemBcast) { - if (secCtrl.dataSecurity != DataSecurity::authConf) + if (secCtrl.dataSecurity != DataSecurity::AuthConf) { println("sync.res is always sent with auth+conf!"); return; @@ -797,7 +797,7 @@ bool SecureApplicationLayer::decrypt(uint8_t* plainApdu, uint16_t plainApduLengt } secCtrl.toolAccess = toolAccess; - secCtrl.dataSecurity = authOnly ? DataSecurity::auth : DataSecurity::authConf; + secCtrl.dataSecurity = authOnly ? DataSecurity::Auth : DataSecurity::AuthConf; bool syncReq = service == kSecureSyncRequest; bool syncRes = service == kSecureSyncResponse; @@ -1052,7 +1052,7 @@ bool SecureApplicationLayer::secure(uint8_t* buffer, uint16_t service, uint16_t uint8_t* apdu, uint16_t apduLength, const SecurityControl& secCtrl, bool systemBcast) { bool toolAccess = secCtrl.toolAccess; - bool confidentiality = secCtrl.dataSecurity == DataSecurity::authConf; + bool confidentiality = secCtrl.dataSecurity == DataSecurity::AuthConf; if (toolAccess) { diff --git a/src/knx/security_interface_object.cpp b/src/knx/security_interface_object.cpp index 2d03530..e3feba1 100644 --- a/src/knx/security_interface_object.cpp +++ b/src/knx/security_interface_object.cpp @@ -550,10 +550,10 @@ DataSecurity SecurityInterfaceObject::getGroupObjectSecurity(uint16_t index) // write access flags, approved spec. AN158, p.97 bool conf = (data[0] & 2) == 2; bool auth = (data[0] & 1) == 1; - return conf ? DataSecurity::authConf : auth ? DataSecurity::auth : DataSecurity::none; + return conf ? DataSecurity::AuthConf : auth ? DataSecurity::Auth : DataSecurity::None; } - return DataSecurity::none; + return DataSecurity::None; } #endif