diff options
author | Alexander Kutsan <akutsan@luxoft.com> | 2020-01-28 00:09:15 +0300 |
---|---|---|
committer | Andriy Byzhynar (GitHub) <AByzhynar@luxoft.com> | 2020-02-05 21:38:00 +0200 |
commit | 731af6e613becacf539672cd0d58cdde7aa5bbbd (patch) | |
tree | c44aef38b873e30c5a7670a49ff7129fccc126fe | |
parent | 4f17e762334dcc901a1b0cc9dacdeda506e64ad1 (diff) | |
download | sdl_core-731af6e613becacf539672cd0d58cdde7aa5bbbd.tar.gz |
Add ini file parameters for WebEngineSupport
Issue : #3197
5 files changed, 137 insertions, 0 deletions
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index baf8cf6073..31302f24c6 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -202,6 +202,15 @@ TCPAdapterPort = 12345 ; If the name is omitted, Core will listen on all network interfaces by binding to INADDR_ANY. TCPAdapterNetworkInterface = +; WebSocket connection address used for incoming connections +WebSocketServerAddress = 0.0.0.0 +; Listening port for incoming connection to websocket server +WebSocketServerPort = 2020 +; WS Server Certificate +; WSServerCertificatePath = server-cert.pem +; WSServerKeyPath = server-key.pem +; WSServerCACertificatePath = ca-cert.pem + ; 128 bit uuid for bluetooth device discovery. Please format as 16 seperate bytes. ;BluetoothUUID = 0x93, 0x6D, 0xA0, 0x1F, 0x9A, 0xBD, 0x4D, 0x9D, 0x80, 0xC7, 0x02, 0xAF, 0x85, 0xC8, 0x22, 0xA8 diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 5489a962e8..1862fbd7e6 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -414,6 +414,16 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const OVERRIDE; /** + * @brief Returns websocket server address + */ + const std::string& websocket_server_address() const OVERRIDE; + + /** + * @brief Returns port for websocket server + */ + uint16_t websocket_server_port() const OVERRIDE; + + /** * @brief Returns retry timeout for cloud app connections */ uint32_t cloud_app_retry_timeout() const OVERRIDE; @@ -498,6 +508,21 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const std::string& ca_cert_path() const; /** + * @brief Returns ws server certificate path to pem file + */ + const std::string& ws_server_cert_path() const OVERRIDE; + + /** + * @brief Returns ws server CA certificate path to pem file + */ + const std::string& ws_server_ca_cert_path() const OVERRIDE; + + /** + * @brief Returns ws server key path to pem file + */ + const std::string& ws_server_key_path() const OVERRIDE; + + /** * @brief Returns ciphers */ const std::string& ciphers_list() const; @@ -991,6 +1016,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, std::string system_files_path_; uint16_t transport_manager_tcp_adapter_port_; std::string transport_manager_tcp_adapter_network_interface_; + std::string websocket_server_address_; + uint16_t websocket_server_port_; uint32_t cloud_app_retry_timeout_; uint16_t cloud_app_max_retry_attempts_; std::vector<uint8_t> bluetooth_uuid_; @@ -1014,8 +1041,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, #ifdef ENABLE_SECURITY std::string cert_path_; std::string ca_cert_path_; + std::string ws_server_cert_path_; + std::string ws_server_ca_cert_path_; std::string ssl_mode_; std::string key_path_; + std::string ws_server_key_path_; std::string ciphers_list_; bool verify_peer_; uint32_t update_before_hours_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index dd0dc50f44..a058654f85 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -136,8 +136,11 @@ const char* kAudioStreamFileKey = "AudioStreamFile"; const char* kSecurityProtocolKey = "Protocol"; const char* kSecurityCertificatePathKey = "CertificatePath"; const char* kSecurityCACertificatePathKey = "CACertificatePath"; +const char* kWSServerCertificatePathKey = "WSServerCertificatePath"; +const char* kWSServerCACertificaePathKey = "WSServerCACertificatePath"; const char* kSecuritySSLModeKey = "SSLMode"; const char* kSecurityKeyPathKey = "KeyPath"; +const char* kWSServerKeyPathKey = "WSServerKeyPath"; const char* kSecurityCipherListKey = "CipherList"; const char* kSecurityVerifyPeerKey = "VerifyPeer"; const char* kBeforeUpdateHours = "UpdateBeforeHours"; @@ -157,6 +160,10 @@ const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion"; const char* kUseLastStateKey = "UseLastState"; const char* kTCPAdapterPortKey = "TCPAdapterPort"; const char* kTCPAdapterNetworkInterfaceKey = "TCPAdapterNetworkInterface"; + +const char* kWebSocketServerAddressKey = "WebSocketServerAddress"; +const char* kWebSocketServerPortKey = "WebSocketServerPort"; + const char* kCloudAppRetryTimeoutKey = "CloudAppRetryTimeout"; const char* kCloudAppMaxRetryAttemptsKey = "CloudAppMaxRetryAttempts"; const char* kServerPortKey = "ServerPort"; @@ -305,6 +312,7 @@ const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json"; const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json"; const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json"; const char* kDefaultServerAddress = "127.0.0.1"; +const char* kDefaultWebsocketServerAddress = "0.0.0.0"; const char* kDefaultAppInfoFileName = "app_info.dat"; const char* kDefaultSystemFilesPath = "/tmp/fs/mp/images/ivsu_cache"; const char* kDefaultPluginsPath = "plugins"; @@ -334,6 +342,7 @@ const uint32_t kDefaultHubProtocolIndex = 0; const uint32_t kDefaultHeartBeatTimeout = 0; const uint16_t kDefaultMaxSupportedProtocolVersion = 5; const uint16_t kDefautTransportManagerTCPPort = 12345; +const uint16_t kDefaultWebSocketServerPort = 2020; const uint16_t kDefaultCloudAppRetryTimeout = 1000; const uint16_t kDefaultCloudAppMaxRetryAttempts = 5; const uint16_t kDefaultServerPort = 8087; @@ -495,6 +504,8 @@ Profile::Profile() , supported_diag_modes_() , system_files_path_(kDefaultSystemFilesPath) , transport_manager_tcp_adapter_port_(kDefautTransportManagerTCPPort) + , websocket_server_address_(kDefaultWebsocketServerAddress) + , websocket_server_port_(kDefaultWebSocketServerPort) , cloud_app_retry_timeout_(kDefaultCloudAppRetryTimeout) , cloud_app_max_retry_attempts_(kDefaultCloudAppMaxRetryAttempts) , tts_delimiter_(kDefaultTtsDelimiter) @@ -831,6 +842,14 @@ const std::string& Profile::transport_manager_tcp_adapter_network_interface() return transport_manager_tcp_adapter_network_interface_; } +const std::string& Profile::websocket_server_address() const { + return websocket_server_address_; +} + +uint16_t Profile::websocket_server_port() const { + return websocket_server_port_; +} + uint32_t Profile::cloud_app_retry_timeout() const { return cloud_app_retry_timeout_; } @@ -1040,6 +1059,18 @@ const std::string& Profile::ca_cert_path() const { return ca_cert_path_; } +const std::string& Profile::ws_server_cert_path() const { + return ws_server_cert_path_; +} + +const std::string& Profile::ws_server_key_path() const { + return ws_server_key_path_; +} + +const std::string& Profile::ws_server_ca_cert_path() const { + return ws_server_ca_cert_path_; +} + const std::string& Profile::ssl_mode() const { return ssl_mode_; } @@ -1240,6 +1271,7 @@ void Profile::UpdateValues() { ReadStringValue( &cert_path_, "", kSecuritySection, kSecurityCertificatePathKey); + ReadStringValue( &ca_cert_path_, "", kSecuritySection, kSecurityCACertificatePathKey); @@ -1868,6 +1900,52 @@ void Profile::UpdateValues() { kTCPAdapterNetworkInterfaceKey, kTransportManagerSection); + // Websocket server address + ReadStringValue(&websocket_server_address_, + kDefaultWebsocketServerAddress, + kTransportManagerSection, + kWebSocketServerAddressKey); + + LOG_UPDATED_VALUE(websocket_server_address_, + kWebSocketServerAddressKey, + kTransportManagerSection); + + // Websocket non-secured server port + ReadUIntValue(&websocket_server_port_, + kDefaultWebSocketServerPort, + kTransportManagerSection, + kWebSocketServerPortKey); + + LOG_UPDATED_VALUE(websocket_server_port_, + kWebSocketServerPortKey, + kTransportManagerSection); + +#ifdef ENABLE_SECURITY + ReadStringValue(&ws_server_cert_path_, + "", + kTransportManagerSection, + kWSServerCertificatePathKey); + + LOG_UPDATED_VALUE(ws_server_cert_path_, + kWSServerCertificatePathKey, + kTransportManagerSection); + + ReadStringValue( + &ws_server_key_path_, "", kTransportManagerSection, kWSServerKeyPathKey); + + LOG_UPDATED_VALUE( + ws_server_key_path_, kWSServerKeyPathKey, kTransportManagerSection); + + ReadStringValue(&ws_server_ca_cert_path_, + "", + kTransportManagerSection, + kWSServerCACertificaePathKey); + + LOG_UPDATED_VALUE(ws_server_ca_cert_path_, + kWSServerCACertificaePathKey, + kTransportManagerSection); +#endif // ENABLE_SECURITY + ReadUIntValue(&cloud_app_retry_timeout_, kDefaultCloudAppRetryTimeout, kCloudAppTransportSection, diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h index 6ed4ac5d51..63bca9de9c 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h @@ -63,6 +63,8 @@ class MockTransportManagerSettings MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t()); MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface, std::string&()); + MOCK_CONST_METHOD0(websocket_server_address, const std::string&()); + MOCK_CONST_METHOD0(websocket_server_port, uint16_t()); MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t()); MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t()); MOCK_CONST_METHOD0(bluetooth_uuid, const uint8_t*()); @@ -72,6 +74,9 @@ class MockTransportManagerSettings MOCK_CONST_METHOD0(aoa_filter_version, const std::string&()); MOCK_CONST_METHOD0(aoa_filter_uri, const std::string&()); MOCK_CONST_METHOD0(aoa_filter_serial_number, const std::string&()); + MOCK_CONST_METHOD0(ws_server_cert_path, const std::string&()); + MOCK_CONST_METHOD0(ws_server_key_path, const std::string&()); + MOCK_CONST_METHOD0(ws_server_ca_cert_path, const std::string&()); }; } // namespace transport_manager_test diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h index 83d0b3e833..ae2ad45246 100644 --- a/src/components/include/transport_manager/transport_manager_settings.h +++ b/src/components/include/transport_manager/transport_manager_settings.h @@ -71,6 +71,16 @@ class TransportManagerSettings : public TransportManagerMMESettings { const = 0; /** + *@brief Returns websocket server address + */ + virtual const std::string& websocket_server_address() const = 0; + + /** + * @brief Returns port for websocket server + */ + virtual uint16_t websocket_server_port() const = 0; + + /** * @brief Returns retry timeout for cloud app connections */ virtual uint32_t cloud_app_retry_timeout() const = 0; @@ -88,6 +98,11 @@ class TransportManagerSettings : public TransportManagerMMESettings { virtual const std::string& aoa_filter_version() const = 0; virtual const std::string& aoa_filter_uri() const = 0; virtual const std::string& aoa_filter_serial_number() const = 0; +#ifdef ENABLE_SECURITY + virtual const std::string& ws_server_cert_path() const = 0; + virtual const std::string& ws_server_key_path() const = 0; + virtual const std::string& ws_server_ca_cert_path() const = 0; +#endif // ENABLE_SECURITY }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_ |