diff options
34 files changed, 190 insertions, 155 deletions
@@ -14,7 +14,7 @@ Pull Requests Welcome! ## Documentation - * [Software Architecture Document](https://smartdevicelink.com/en/guides/core/software-architecture-document/table-of-contents/) + * [Software Architecture Document](https://smartdevicelink.com/en/docs/sdl-core/master/software-architecture-document/table-of-contents/) * [Transport Manager Programming Guide](https://smartdevicelink.com/en/guides/core/transport-manager-programming/) * [Software Detailed Design](https://app.box.com/s/ohgrvemtx39f8hfea1ab676xxrzvyx1y) * [Integration Guidelines](https://smartdevicelink.com/en/docs/hmi/master/overview/) @@ -65,8 +65,10 @@ The dependencies for SDL Core vary based on the configuration. You can change SD | Flag | Description | Dependencies | |------|-------------|--------------| |Web HMI|Use HTML5 HMI|chromium-browser| +|DBus|Use DBus HMI Adapter|dbus-1-dev| |EXTENDED_MEDIA_MODE|Support Video and Audio Streaming|Opengl es2, gstreamer1.0*| |Bluetooth|Enable bluetooth transport adapter|libbluetooth3, libbluetooth-dev, bluez-tools| +|USB|Enable USB transport adapter|libusb-dev| |Testing framework|Needed to support running unit tests|libgtest-dev| |Cmake|Needed to configure SDL prior to compilation|cmake| diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 12ebafcb89..0965d7710d 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -22,7 +22,7 @@ "default": ["http://sdl.shaid.server"]
},
"lock_screen_icon_url": {
- "default": ["http://i.imgur.com/QwZ9uKG.png"]
+ "default": ["http://i.imgur.com/TgkvOIZ.png"]
}
},
"notifications_per_minute_by_priority": {
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 281f989e51..286ad87018 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -939,6 +939,13 @@ class ApplicationManagerImpl const protocol_handler::ServiceType& type, const connection_handler::CloseSessionReason& close_reason) OVERRIDE; + /** + * @brief Check if application with specified app_id has NAVIGATION HMI type + * @param app_id id of application to check + * @return true if application is navi otherwise returns false + */ + bool CheckAppIsNavi(const uint32_t app_id) const OVERRIDE; + #ifdef ENABLE_SECURITY /** * @brief Notification about protection result @@ -970,13 +977,6 @@ class ApplicationManagerImpl */ security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const OVERRIDE; - - /** - * @brief Check if application with specified app_id has NAVIGATION HMI type - * @param app_id id of application to check - * @return true if application is navi otherwise returns false - */ - bool CheckAppIsNavi(const uint32_t app_id) const OVERRIDE; #endif // ENABLE_SECURITY /** diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 4edcd36486..b94609c01b 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -49,6 +49,7 @@ #include "protocol_handler/session_observer.h" #include "application_manager/policies/policy_handler_interface.h" #include "smart_objects/smart_object.h" +#include "transport_manager/common.h" namespace policy { class PolicyHandlerInterface; @@ -140,7 +141,8 @@ class MessageHelper { mobile_apis::Result::eType mobile_result); static std::string GetDeviceMacAddressForHandle( - const uint32_t device_handle, const ApplicationManager& app_mngr); + const transport_manager::DeviceHandle device_handle, + const ApplicationManager& app_mngr); /** * @brief Converts string to mobile Result enum value * @param mobile_result stringified value diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index ce5c0818f1..b4653c6cb2 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -67,7 +67,7 @@ class ApplicationManager; namespace policy { typedef std::vector<uint32_t> AppIds; -typedef std::vector<uint32_t> DeviceHandles; +typedef std::vector<transport_manager::DeviceHandle> DeviceHandles; namespace custom_str = utils::custom_string; class PolicyHandler : public PolicyHandlerInterface, diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 22a0f2628e..ac21219d7d 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -46,6 +46,7 @@ #include "utils/timer_task_impl.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/resumption/resume_ctrl.h" +#include "transport_manager/common.h" namespace { @@ -81,6 +82,7 @@ void SwitchApplicationParameters(ApplicationSharedPtr app, const uint32_t app_id, const size_t device_id, const std::string& mac_address) { + LOG4CXX_AUTO_TRACE(logger_); utils::SharedPtr<ApplicationImpl> application = ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app); DCHECK_OR_RETURN_VOID(application); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 8c91bf363a..248b54fee5 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1659,6 +1659,15 @@ void ApplicationManagerImpl::OnServiceEndedCallback( } } +bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application(app_id); + if (app) { + return app->is_navi(); + } + return false; +} + #ifdef ENABLE_SECURITY bool ApplicationManagerImpl::OnHandshakeDone( uint32_t connection_key, @@ -1704,15 +1713,6 @@ ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { } return SSLContext::HandshakeContext(); } - -bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); - ApplicationSharedPtr app = application(app_id); - if (app) { - return app->is_navi(); - } - return false; -} #endif // ENABLE_SECURITY void ApplicationManagerImpl::set_hmi_message_handler( diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 61012224b6..6a908c4ebc 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -54,6 +54,7 @@ #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/resumption/resume_ctrl.h" #include "connection_handler/connection_handler_impl.h" +#include "transport_manager/common.h" #include "interfaces/MOBILE_API.h" #include "smart_objects/enum_schema_item.h" #include "utils/file_system.h" @@ -295,7 +296,8 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString( } std::string MessageHelper::GetDeviceMacAddressForHandle( - const uint32_t device_handle, const ApplicationManager& app_mngr) { + const transport_manager::DeviceHandle device_handle, + const ApplicationManager& app_mngr) { std::string device_mac_address = ""; app_mngr.connection_handler().get_session_observer().GetDataOnDeviceID( device_handle, NULL, NULL, &device_mac_address); @@ -2415,6 +2417,7 @@ void MessageHelper::SendOnPermissionsChangeNotification( uint32_t connection_key, const policy::Permissions& permissions, ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject content(smart_objects::SmartType_Map); content[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index b6b208b39b..bbf391a9f1 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -103,7 +103,7 @@ const std::string RequestTypeToString(mobile_apis::RequestType::eType type) { const policy::DeviceParams GetDeviceParams( connection_handler::DeviceHandle device_handle, const protocol_handler::SessionObserver& session_observer) { - CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler") + CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler"); policy::DeviceParams device_params; if (-1 == session_observer.GetDataOnDeviceID( @@ -1223,6 +1223,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( device_handle); // If consent done from HMI menu if (it == pending_device_handles_.end()) { + LOG4CXX_WARN(logger_, "No pendining application activation"); return; } diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index 3e9010e22c..90059e4d98 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -101,11 +101,14 @@ set(LIBRARIES MediaManager Resumption ProtocolHandler - SecurityManager bson -L${BSON_LIBS_DIRECTORY} emhashmap -L${EMHASHMAP_LIBS_DIRECTORY} ) +if (ENABLE_SECURITY) + list(APPEND LIBRARIES SecurityManager) +endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(REMOVE_ITEM LIBRARIES dl) endif() diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 7598e33e19..93db0d9795 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -40,6 +40,7 @@ #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/application_manager.h" #include "smart_objects/smart_object.h" +#include "transport_manager/common.h" namespace application_manager { @@ -266,7 +267,7 @@ class MockMessageHelper { MOCK_METHOD1(StringifiedHMILevel, std::string(const mobile_apis::HMILevel::eType hmi_level)); MOCK_METHOD2(GetDeviceMacAddressForHandle, - std::string(const uint32_t device_handle, + std::string(const transport_manager::DeviceHandle device_handle, const ApplicationManager& app_mngr)); MOCK_METHOD3(SendDeleteCommandRequest, void(smart_objects::SmartObject* cmd, diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 2a74f5b3b1..24bba63e71 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -33,6 +33,7 @@ #include "application_manager/message_helper.h" #include "application_manager/mock_message_helper.h" #include "application_manager/policies/policy_handler_interface.h" +#include "transport_manager/common.h" #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -496,7 +497,8 @@ std::string MessageHelper::StringifiedHMILevel( } std::string MessageHelper::GetDeviceMacAddressForHandle( - const uint32_t device_handle, const ApplicationManager& app_mngr) { + const transport_manager::DeviceHandle device_handle, + const ApplicationManager& app_mngr) { return MockMessageHelper::message_helper_mock()->GetDeviceMacAddressForHandle( device_handle, app_mngr); } diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 66efe45e30..77500fd238 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -40,8 +40,10 @@ #include "connection_handler/connection_handler_impl.h" #include "application_manager/application_manager_impl.h" #include "application_manager/application_impl.h" +#ifdef ENABLE_SECURITY #include "security_manager/mock_security_manager.h" #include "security_manager/mock_crypto_manager.h" +#endif // ENABLE_SECURITY #include "application_manager/mock_message_helper.h" #include "connection_handler/mock_connection_handler_settings.h" #include "transport_manager/mock_transport_manager.h" @@ -1601,6 +1603,7 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_GroupPermissions_SUCCESS) { policy_handler_.OnGetListOfPermissions(app_id, corr_id); } +#ifdef ENABLE_SECURITY TEST_F(PolicyHandlerTest, RetrieveCertificate) { // Arrange EnablePolicyAndPolicyManagerMock(); @@ -1609,6 +1612,7 @@ TEST_F(PolicyHandlerTest, RetrieveCertificate) { .WillOnce(Return(test_certificate)); EXPECT_EQ(test_certificate, policy_handler_.RetrieveCertificate()); } +#endif // ENABLE_SECURITY TEST_F(PolicyHandlerTest, OnSnapshotCreated_UrlNotAdded) { EnablePolicyAndPolicyManagerMock(); @@ -1826,6 +1830,7 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) { policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed); } +#ifdef ENABLE_SECURITY #ifdef EXTERNAL_PROPRIETARY_MODE TEST_F(PolicyHandlerTest, OnCertificateUpdated) { const std::string app_storage = "storage"; @@ -1851,7 +1856,8 @@ TEST_F(PolicyHandlerTest, OnCertificateUpdated) { EXPECT_CALL(policy_handler_observer, OnCertificateUpdated(cert_data)); policy_handler_.OnCertificateUpdated(cert_data); } -#endif +#endif // EXTERNAL_PROPRIETARY_MODE +#endif // ENABLE_SECURITY TEST_F(PolicyHandlerTest, GetAppIdForSending_WithoutApps) { // Arrange diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h index b0f9586046..9b72d60776 100644 --- a/src/components/connection_handler/include/connection_handler/connection.h +++ b/src/components/connection_handler/include/connection_handler/connection.h @@ -212,6 +212,13 @@ class Connection { void SetProtectionFlag(const uint8_t session_id, const protocol_handler::ServiceType& service_type); +#endif // ENABLE_SECURITY + /** + * @brief Returns map of sessions which have been opened in + * current connection. + */ + const SessionMap session_map() const; + /** * @brief Check if session contains service with specified service type * @param session_id id of session to check @@ -222,13 +229,6 @@ class Connection { const uint8_t session_id, const protocol_handler::ServiceType& service_type) const; -#endif // ENABLE_SECURITY - /** - * @brief Returns map of sessions which have been opened in - * current connection. - */ - const SessionMap session_map() const; - /** * @brief Close session * @param session_id session id diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index 3aa304aabc..66b2d7cf16 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -350,6 +350,10 @@ class ConnectionHandlerImpl const uint32_t& key, const protocol_handler::ServiceType& service_type) OVERRIDE; + security_manager::SSLContext::HandshakeContext GetHandshakeContext( + uint32_t key) const OVERRIDE; +#endif // ENABLE_SECURITY + /** * @brief Check if session contains service with specified service type * @param connection_key unique id of session to check @@ -360,10 +364,6 @@ class ConnectionHandlerImpl const uint32_t connection_key, const protocol_handler::ServiceType& service_type) const OVERRIDE; - security_manager::SSLContext::HandshakeContext GetHandshakeContext( - uint32_t key) const OVERRIDE; -#endif // ENABLE_SECURITY - /** * \brief Get device handle by mac address * \param mac_address uniq address diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index d494611643..16b88c4164 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -314,6 +314,8 @@ void Connection::SetProtectionFlag( } } +#endif // ENABLE_SECURITY + bool Connection::SessionServiceExists( const uint8_t session_id, const protocol_handler::ServiceType& service_type) const { @@ -330,8 +332,6 @@ bool Connection::SessionServiceExists( return session.FindService(service_type); } -#endif // ENABLE_SECURITY - ConnectionHandle Connection::connection_handle() const { return connection_handle_; } diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 7ea9efa1cc..5b26304302 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -753,12 +753,11 @@ struct CompareMAC { bool ConnectionHandlerImpl::GetDeviceID(const std::string& mac_address, DeviceHandle* device_handle) { + DCHECK_OR_RETURN(device_handle, false); DeviceMap::const_iterator it = std::find_if( device_list_.begin(), device_list_.end(), CompareMAC(mac_address)); if (it != device_list_.end()) { - if (device_handle) { - *device_handle = it->first; - } + *device_handle = it->first; return true; } return false; @@ -775,7 +774,7 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID( int32_t result = -1; DeviceMap::const_iterator it = device_list_.find(device_handle); if (device_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Device not found!"); + LOG4CXX_ERROR(logger_, "Device not found for handle " << device_handle); return result; } @@ -878,6 +877,13 @@ void ConnectionHandlerImpl::SetProtectionFlag( connection.SetProtectionFlag(session_id, service_type); } +security_manager::SSLContext::HandshakeContext +ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { + return connection_handler_observer_->GetHandshakeContext(key); +} + +#endif // ENABLE_SECURITY + bool ConnectionHandlerImpl::SessionServiceExists( const uint32_t connection_key, const protocol_handler::ServiceType& service_type) const { @@ -896,13 +902,6 @@ bool ConnectionHandlerImpl::SessionServiceExists( return connection.SessionServiceExists(session_id, service_type); } -security_manager::SSLContext::HandshakeContext -ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { - return connection_handler_observer_->GetHandshakeContext(key); -} - -#endif // ENABLE_SECURITY - void ConnectionHandlerImpl::StartDevicesDiscovery() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc index a951598917..d0b9ce4ae4 100644 --- a/src/components/connection_handler/test/connection_handler_impl_test.cc +++ b/src/components/connection_handler/test/connection_handler_impl_test.cc @@ -37,8 +37,10 @@ #include "connection_handler/connection_handler_impl.h" #include "protocol/common.h" // TODO(EZamakhov): move security test +#ifdef ENABLE_SECURITY #include "security_manager/mock_security_manager.h" #include "security_manager/mock_ssl_context.h" +#endif // ENABLE_SECURITY #include "protocol_handler/mock_protocol_handler.h" #include "connection_handler/mock_connection_handler_observer.h" #include "connection_handler/mock_connection_handler_settings.h" @@ -175,7 +177,7 @@ class ConnectionHandlerTest : public ::testing::Test { ASSERT_FALSE(connection_list.empty()); ConnectionList::const_iterator conn_it = connection_list.find(connectionId); ASSERT_NE(conn_it, connection_list.end()); - const Connection& connection = *connection_list.begin()->second; + const Connection& connection = *conn_it->second; const SessionMap& session_map = connection.session_map(); SessionMap::const_iterator sess_it = session_map.find(session_id); @@ -206,7 +208,7 @@ class ConnectionHandlerTest : public ::testing::Test { ASSERT_FALSE(connection_list.empty()); ConnectionList::const_iterator conn_it = connection_list.find(connectionId); ASSERT_NE(conn_it, connection_list.end()); - const Connection& connection = *connection_list.begin()->second; + const Connection& connection = *conn_it->second; const SessionMap& session_map = connection.session_map(); ASSERT_FALSE(session_map.empty()); @@ -223,7 +225,9 @@ class ConnectionHandlerTest : public ::testing::Test { ASSERT_EQ(serv_it, service_list.end()); } } - // Check Service Wrapper + +// Check Service Wrapper +#ifdef ENABLE_SECURITY void CheckService(const int connectionId, const int session_id, const ::protocol_handler::ServiceType serviceId, @@ -235,16 +239,14 @@ class ConnectionHandlerTest : public ::testing::Test { ASSERT_FALSE(connection_list.empty()); ConnectionList::const_iterator conn_it = connection_list.find(connectionId); ASSERT_NE(conn_it, connection_list.end()); - const Connection& connection = *connection_list.begin()->second; + const Connection& connection = *conn_it->second; const SessionMap& session_map = connection.session_map(); ASSERT_FALSE(session_map.empty()); SessionMap::const_iterator sess_it = session_map.find(session_id); ASSERT_NE(sess_it, session_map.end()); const Session& session = sess_it->second; -#ifdef ENABLE_SECURITY ASSERT_EQ(session.ssl_context, ssl_context); -#endif // ENABLE_SECURITY const ServiceList& service_list = session.service_list; ASSERT_FALSE(service_list.empty()); ServiceList::const_iterator serv_it = @@ -253,14 +255,39 @@ class ConnectionHandlerTest : public ::testing::Test { const Service& service = *serv_it; EXPECT_EQ(PROTECTION_OFF, service.is_protected_); -#ifdef ENABLE_SECURITY if (is_protected) { // Emulate success protection - check enable service flag const uint32_t connection_key_ = connection_handler_->KeyFromPair(connectionId, session_id); connection_handler_->SetProtectionFlag(connection_key_, serviceId); } + } #endif // ENABLE_SECURITY + + void CheckService(const int connectionId, + const int session_id, + const ::protocol_handler::ServiceType serviceId) { + // Check all tree to find Service and check own protected value + const ConnectionList& connection_list = + connection_handler_->getConnectionList(); + ASSERT_FALSE(connection_list.empty()); + ConnectionList::const_iterator conn_it = connection_list.find(connectionId); + ASSERT_NE(conn_it, connection_list.end()); + const Connection& connection = *conn_it->second; + + const SessionMap& session_map = connection.session_map(); + ASSERT_FALSE(session_map.empty()); + SessionMap::const_iterator sess_it = session_map.find(session_id); + ASSERT_NE(sess_it, session_map.end()); + const Session& session = sess_it->second; + const ServiceList& service_list = session.service_list; + ASSERT_FALSE(service_list.empty()); + ServiceList::const_iterator serv_it = + std::find(service_list.begin(), service_list.end(), serviceId); + ASSERT_NE(serv_it, service_list.end()); + + const Service& service = *serv_it; + EXPECT_EQ(PROTECTION_OFF, service.is_protected_); } void ChangeProtocol(const int connectionId, @@ -1482,8 +1509,7 @@ TEST_F(ConnectionHandlerTest, connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); EXPECT_NE(0u, positive_context.new_session_id_); - CheckService( - uid_, positive_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); + CheckService(uid_, positive_context.new_session_id_, kRpc); EXPECT_EQ(SessionHash(uid_, positive_context.new_session_id_), positive_context.hash_id_); } @@ -1525,10 +1551,10 @@ TEST_F(ConnectionHandlerTest, EXPECT_NE(0u, positive_context.new_session_id_); EXPECT_EQ(SessionHash(uid_, positive_context.new_session_id_), positive_context.hash_id_); - +#ifdef ENABLE_SECURITY // Protection steal FALSE because of APPlink Protocol implementation - CheckService( - uid_, positive_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); + CheckService(uid_, positive_context.new_session_id_, kRpc); +#endif // ENABLE_SECURITY } TEST_F(ConnectionHandlerTest, @@ -1634,8 +1660,6 @@ TEST_F(ConnectionHandlerTest, #else EXPECT_EQ(0u, positive_context.new_session_id_); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, positive_context.hash_id_); - CheckService( - uid_, positive_context.new_session_id_, kAudio, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } @@ -1667,7 +1691,6 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { EXPECT_EQ(0u, context_new.new_session_id_); // Post protection nedd no hash EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context_new.hash_id_); - CheckService(uid_, context_new.new_session_id_, kRpc, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY // Start Audio session without protection @@ -1678,8 +1701,7 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { static_cast<BsonObject*>(NULL)); EXPECT_EQ(out_context_.new_session_id_, context_second.new_session_id_); EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, context_second.hash_id_); - CheckService( - uid_, context_second.new_session_id_, kAudio, NULL, PROTECTION_OFF); + CheckService(uid_, context_second.new_session_id_, kAudio); // Start Audio protection connection_handler_->OnSessionStartedCallback(uid_, @@ -1695,8 +1717,6 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { #else EXPECT_EQ(0u, context_third.new_session_id_); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context_third.hash_id_); - CheckService( - uid_, context_third.new_session_id_, kAudio, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } @@ -1718,7 +1738,6 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtectBulk) { CheckService(uid_, new_context.new_session_id_, kRpc, NULL, PROTECTION_ON); #else EXPECT_EQ(0u, new_context.new_session_id_); - CheckService(uid_, new_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc index 5fd6b40e0e..de21dd1e97 100644 --- a/src/components/connection_handler/test/connection_test.cc +++ b/src/components/connection_handler/test/connection_test.cc @@ -40,8 +40,10 @@ #include "protocol/service_type.h" #include "connection_handler/mock_connection_handler_settings.h" #include "transport_manager/mock_transport_manager.h" +#ifdef ENABLE_SECURITY #include "security_manager/mock_security_manager.h" #include "security_manager/mock_ssl_context.h" +#endif // ENABLE_SECURITY #define EXPECT_RETURN_TRUE true #define EXPECT_RETURN_FALSE false diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index 1bd919f30e..b4c04c17c9 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -140,6 +140,13 @@ class ConnectionHandlerObserver { */ virtual void OnDeviceSwitchingFinish(const std::string& device_uid) = 0; + /** + * @brief Check if application with specified app_id has NAVIGATION HMI type + * @param app_id id of application to check + * @return true if application is navi otherwise returns false + */ + virtual bool CheckAppIsNavi(const uint32_t app_id) const = 0; + #ifdef ENABLE_SECURITY /** * @brief Get unique handshake context by application id @@ -149,13 +156,6 @@ class ConnectionHandlerObserver { */ virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const = 0; - - /** - * @brief Check if application with specified app_id has NAVIGATION HMI type - * @param app_id id of application to check - * @return true if application is navi otherwise returns false - */ - virtual bool CheckAppIsNavi(const uint32_t app_id) const = 0; #endif // ENABLE_SECURITY protected: /** diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index ccf000a18d..3482c6569c 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -297,6 +297,16 @@ class SessionObserver { uint8_t session_id, uint8_t& protocol_version) const = 0; + /** + * @brief Check if session contains service with specified service type + * @param connection_key unique id of session to check + * @param service_type type of service to check + * @return true if session contains service with specified service type + */ + virtual bool SessionServiceExists( + const uint32_t connection_key, + const protocol_handler::ServiceType& service_type) const = 0; + #ifdef ENABLE_SECURITY /** * \brief Sets crypto context of connection @@ -327,16 +337,6 @@ class SessionObserver { const uint32_t& key, const protocol_handler::ServiceType& service_type) = 0; - /** - * @brief Check if session contains service with specified service type - * @param connection_key unique id of session to check - * @param service_type type of service to check - * @return true if session contains service with specified service type - */ - virtual bool SessionServiceExists( - const uint32_t connection_key, - const protocol_handler::ServiceType& service_type) const = 0; - virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const = 0; #endif // ENABLE_SECURITY diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h index f1c605eaca..a96498028d 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h +++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h @@ -63,9 +63,11 @@ class MockConnectionHandlerObserver void(const int32_t& session_key, const protocol_handler::ServiceType& type, const connection_handler::CloseSessionReason& close_reason)); +#ifdef ENABLE_SECURITY MOCK_CONST_METHOD1( GetHandshakeContext, security_manager::SSLContext::HandshakeContext(uint32_t key)); +#endif // ENABLE_SECURITY MOCK_METHOD2(OnDeviceSwitchingStart, void(const connection_handler::Device& device_from, diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h index 3d54b97fad..ae32f35948 100644 --- a/src/components/include/test/protocol_handler/mock_session_observer.h +++ b/src/components/include/test/protocol_handler/mock_session_observer.h @@ -37,6 +37,7 @@ #include <string> #include <list> #include "protocol_handler/session_observer.h" +#include "transport_manager/common.h" namespace test { namespace components { @@ -101,13 +102,6 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { std::string* mac_address, std::string* connection_type)); - DEPRECATED MOCK_CONST_METHOD5(GetDataOnDeviceID, - int32_t(uint32_t device_handle, - std::string* device_name, - std::list<uint32_t>* applications_list, - std::string* mac_address, - std::string* connection_type)); - MOCK_CONST_METHOD2(IsHeartBeatSupported, bool(transport_manager::ConnectionUID connection_handle, uint8_t session_id)); @@ -115,6 +109,9 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { bool(uint32_t connection_id, uint8_t session_id, uint8_t& protocol_version)); + MOCK_CONST_METHOD2(SessionServiceExists, + bool(const uint32_t connection_key, + const protocol_handler::ServiceType& service_type)); #ifdef ENABLE_SECURITY MOCK_METHOD2(SetSSLContext, @@ -126,9 +123,6 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver { MOCK_METHOD2(SetProtectionFlag, void(const uint32_t& key, const protocol_handler::ServiceType& service_type)); - MOCK_CONST_METHOD2(SessionServiceExists, - bool(const uint32_t connection_key, - const protocol_handler::ServiceType& service_type)); MOCK_CONST_METHOD1( GetHandshakeContext, security_manager::SSLContext::HandshakeContext(uint32_t key)); diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index f57919b6f7..232191cfea 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -41,6 +41,8 @@ #include <utility> #include "utils/shared_ptr.h" #include "utils/helpers.h" +#include "transport_manager/common.h" + namespace policy { // TODO(PV): specify errors @@ -190,7 +192,7 @@ struct DeviceParams { std::string device_name; std::string device_mac_address; std::string device_connection_type; - uint32_t device_handle; + transport_manager::DeviceHandle device_handle; }; /** diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 5425777833..8be0372c03 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -797,7 +797,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -817,7 +817,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_INFO(logger_, "Exclude same groups"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -839,7 +839,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Merge groups"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 806b7e13ba..2cd0d2b23b 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -588,13 +588,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, policy_table::FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); -#ifdef SDL_REMOTE_CONTROL - ApplicationOnDevice who = {device_id, app_id}; - const policy_table::Strings app_groups = access_remote_->GetGroups(who); -#else // SDL_REMOTE_CONTROL - const policy_table::Strings app_groups = + policy_table::Strings app_groups = GetGroupsNames(app_group_permissions); -#endif // SDL_REMOTE_CONTROL // Undefined groups (without user consent) disallowed by default, since // OnPermissionsChange notification has no "undefined" section @@ -614,8 +609,20 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, << " returns true"); } + if (cache_->IsApplicationRevoked(app_id)) { + // SDL must be able to notify mobile side with its status after app has + // been revoked by backend + if ("OnHMIStatus" == rpc && "NONE" == hmi_level) { + result.hmi_level_permitted = kRpcAllowed; + } else { + result.hmi_level_permitted = kRpcDisallowed; + } + return; + } + const bool known_rpc = rpc_permissions.end() != rpc_permissions.find(rpc); - LOG4CXX_INFO(logger_, "Is known rpc " << known_rpc); + LOG4CXX_DEBUG(logger_, "Is known rpc " << + (known_rpc ? "true" : "false") ); if (!known_rpc) { // RPC not found in list == disallowed by backend result.hmi_level_permitted = kRpcDisallowed; @@ -637,6 +644,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, rpc_permissions[rpc].hmi_permissions[kUserDisallowedKey].find( hmi_level)) { // RPC found in allowed == allowed by backend, but disallowed by user + LOG4CXX_DEBUG(logger_, "RPC found in allowed == allowed by backend, but disallowed by user"); result.hmi_level_permitted = kRpcUserDisallowed; } else { LOG4CXX_DEBUG(logger_, @@ -715,17 +723,6 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, LOG4CXX_DEBUG(logger_, "There are no parameters allowed."); result.hmi_level_permitted = kRpcDisallowed; } - - if (cache_->IsApplicationRevoked(app_id)) { - // SDL must be able to notify mobile side with its status after app has - // been revoked by backend - if ("OnHMIStatus" == rpc && "NONE" == hmi_level) { - result.hmi_level_permitted = kRpcAllowed; - } else { - result.hmi_level_permitted = kRpcDisallowed; - } - return; - } } bool PolicyManagerImpl::ResetUserConsent() { @@ -967,6 +964,7 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( void PolicyManagerImpl::NotifyPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& app_group_permissions) { + LOG4CXX_AUTO_TRACE(logger_); // Get current functional groups from DB with RPC permissions policy_table::FunctionalGroupings functional_groups; cache_->GetFunctionalGroupings(functional_groups); @@ -986,10 +984,6 @@ void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions, const NotificationMode mode) { LOG4CXX_AUTO_TRACE(logger_); - if (permissions.group_permissions.empty()) { - LOG4CXX_DEBUG(logger_, "Permissions list is empty, skipping update."); - return; - } cache_->ResetCalculatedPermissions(); PermissionConsent verified_permissions = @@ -1157,14 +1151,8 @@ void PolicyManagerImpl::GetPermissionsForApp( FunctionalIdType group_types; -#ifdef SDL_REMOTE_CONTROL - allowed_by_default = false; - const bool ret = access_remote_->GetPermissionsForApp( - device_id, app_id_to_check, group_types); -#else const bool ret = cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); -#endif // REMOTE_CONTROL if (!ret) { LOG4CXX_WARN(logger_, diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index 4afce16885..9702c315b0 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -325,7 +325,7 @@ const std::string kCreateSchema = "`consent_group.fk_consent_group_functional_group1_idx` " " ON `consent_group`(`functional_group_id`); " "CREATE TABLE IF NOT EXISTS `endpoint`( " - " `service` INTEGER NOT NULL, " + " `service` VARCHAR(100) NOT NULL, " " `url` VARCHAR(100) NOT NULL, " " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " CONSTRAINT `fk_endpoint_application1` " diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index f9cc5e5ed5..6cc68cb102 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -1262,11 +1262,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::URL& urls = app_it->second; policy_table::URL::const_iterator url_it; for (url_it = urls.begin(); url_it != urls.end(); ++url_it) { - std::stringstream temp_stream(it->first); - int service; - temp_stream.seekg(3); - temp_stream >> service; - query.Bind(0, service); + query.Bind(0, it->first); query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h index 25aa126a03..af1d119e7a 100644 --- a/src/components/policy/policy_regular/include/policy/policy_types.h +++ b/src/components/policy/policy_regular/include/policy/policy_types.h @@ -41,6 +41,8 @@ #include <utility> #include "utils/shared_ptr.h" #include "utils/helpers.h" +#include "transport_manager/common.h" + namespace policy { // TODO(PV): specify errors @@ -190,7 +192,7 @@ struct DeviceParams { std::string device_name; std::string device_mac_address; std::string device_connection_type; - uint32_t device_handle; + transport_manager::DeviceHandle device_handle; }; /** diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 782a65f91a..95f275769c 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -709,7 +709,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -729,7 +729,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_INFO(logger_, "Exclude same groups"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -751,7 +751,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Merge groups"); + LOG4CXX_AUTO_TRACE(logger_); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 055b57d985..39b303cbb5 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -754,7 +754,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "GetDeviceInfo"); + LOG4CXX_AUTO_TRACE(logger_); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id); return last_device_id_; } diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt index ebecff2402..ed3aaaf24c 100644 --- a/src/components/protocol_handler/CMakeLists.txt +++ b/src/components/protocol_handler/CMakeLists.txt @@ -42,7 +42,14 @@ set(PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ) -collect_sources(SOURCES "${PATHS}") + +if (ENABLE_SECURITY) + set(EXCLUDE_PATHS) +else() + set(EXCLUDE_PATHS handshake_handler.cc) +endif() + +collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") set(LIBRARIES ProtocolLibrary diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 47d546657f..762b986782 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -75,11 +75,11 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( , #ifdef ENABLE_SECURITY security_manager_(NULL) + , is_ptu_triggered_(false) , #endif // ENABLE_SECURITY - is_ptu_triggered_(false) - , raw_ford_messages_from_mobile_( - "PH FromMobile", this, threads::ThreadOptions(kStackSize)) + raw_ford_messages_from_mobile_( + "PH FromMobile", this, threads::ThreadOptions(kStackSize)) , raw_ford_messages_to_mobile_( "PH ToMobile", this, threads::ThreadOptions(kStackSize)) , start_session_frame_map_lock_() @@ -1252,13 +1252,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( logger_, "Protocol version:" << static_cast<int>(packet.protocol_version())); const ServiceType service_type = ServiceTypeFromByte(packet.service_type()); - const uint8_t protocol_version = packet.protocol_version(); #ifdef ENABLE_SECURITY const bool protection = - // Protocolo version 1 is not support protection - (protocol_version > PROTOCOL_VERSION_1) ? packet.protection_flag() - : false; + // Protocol version 1 is not support protection + (packet.protocol_version() > PROTOCOL_VERSION_1) + ? packet.protection_flag() + : false; #else const bool protection = false; #endif // ENABLE_SECURITY @@ -1274,7 +1274,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( << static_cast<int32_t>(service_type) << " type."); SendStartSessionNAck(connection_id, packet.session_id(), - protocol_version, + packet.protocol_version(), packet.service_type()); return RESULT_OK; } @@ -1323,7 +1323,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( if (!rejectedParams.empty()) { SendStartSessionNAck(connection_id, packet.session_id(), - protocol_version, + packet.protocol_version(), packet.service_type(), rejectedParams); } else if (ssl_context->IsInitCompleted()) { @@ -1383,7 +1383,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( std::string("protocolVersion")); SendStartSessionNAck(connection_id, packet.session_id(), - protocol_version, + packet.protocol_version(), packet.service_type(), rejectedParams); } @@ -1408,7 +1408,6 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( logger_, "Protocol version:" << static_cast<int>(packet->protocol_version())); const ServiceType service_type = ServiceTypeFromByte(packet->service_type()); - const uint8_t protocol_version = packet->protocol_version(); BsonObject bson_obj; if (packet->data() != NULL) { bson_obj = bson_object_from_bytes(packet->data()); @@ -1418,9 +1417,10 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( #ifdef ENABLE_SECURITY const bool protection = - // Protocolo version 1 is not support protection - (protocol_version > PROTOCOL_VERSION_1) ? packet->protection_flag() - : false; + // Protocol version 1 is not support protection + (packet->protocol_version() > PROTOCOL_VERSION_1) + ? packet->protection_flag() + : false; #else const bool protection = false; #endif // ENABLE_SECURITY diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index cb11eca887..77de1705da 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -41,8 +41,10 @@ #include "protocol_handler/mock_protocol_handler_settings.h" #include "protocol_handler/mock_session_observer.h" #include "connection_handler/mock_connection_handler.h" +#ifdef ENABLE_SECURITY #include "security_manager/mock_security_manager.h" #include "security_manager/mock_ssl_context.h" +#endif // ENABLE_SECURITY #include "transport_manager/mock_transport_manager.h" #include "utils/make_shared.h" #include "utils/test_async_waiter.h" |