summaryrefslogtreecommitdiff
path: root/src/components/config_profile/src/profile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/config_profile/src/profile.cc')
-rw-r--r--src/components/config_profile/src/profile.cc1029
1 files changed, 661 insertions, 368 deletions
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 700c52fff8..4eacbe88ec 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -43,22 +43,34 @@
#include "utils/threads/thread.h"
#include "utils/file_system.h"
+#ifdef ENABLE_SECURITY
+#include <openssl/ssl.h>
+#endif // ENABLE_SECURITY
+
namespace {
-#define LOG_UPDATED_VALUE(value, key, section) {\
- LOG4CXX_INFO(logger_, "Setting value '" << value\
- << "' for key '" << key\
- << "' in section '" << section << "'.");\
-}
+#define LOG_UPDATED_VALUE(value, key, section) \
+ { \
+ LOG4CXX_INFO(logger_, \
+ "Setting value '" << value << "' for key '" << key \
+ << "' in section '" << section << "'."); \
+ }
-#define LOG_UPDATED_BOOL_VALUE(value, key, section) {\
- LOG4CXX_INFO(logger_, "Setting value '" << std::boolalpha << value\
- << "' for key '" << key\
- << "' in section '" << section << "'.");\
-}
+#define LOG_UPDATED_BOOL_VALUE(value, key, section) \
+ { \
+ LOG4CXX_INFO(logger_, \
+ "Setting value '" << std::boolalpha << value << "' for key '" \
+ << key << "' in section '" << section \
+ << "'."); \
+ }
const char* kDefaultConfigFileName = "smartDeviceLink.ini";
const char* kMainSection = "MAIN";
+#ifdef ENABLE_SECURITY
+const char* kSecuritySection = "Security Manager";
+const char* kForceProtectedService = "ForceProtectedService";
+const char* kForceUnprotectedService = "ForceUnprotectedService";
+#endif
const char* kPolicySection = "Policy";
const char* kHmiSection = "HMI";
const char* kAppInfoSection = "AppInfo";
@@ -83,15 +95,18 @@ const char* kServerAddressKey = "ServerAddress";
const char* kAppInfoStorageKey = "AppInfoStorage";
const char* kAppStorageFolderKey = "AppStorageFolder";
const char* kAppResourseFolderKey = "AppResourceFolder";
+const char* kLogsEnabledKey = "LogsEnabled";
const char* kAppConfigFolderKey = "AppConfigFolder";
const char* kEnableProtocol4Key = "EnableProtocol4";
const char* kAppIconsFolderKey = "AppIconsFolder";
const char* kAppIconsFolderMaxSizeKey = "AppIconsFolderMaxSize";
const char* kAppIconsAmountToRemoveKey = "AppIconsAmountToRemove";
const char* kLaunchHMIKey = "LaunchHMI";
+
+const char* kDefaultSDLVersion = "";
#ifdef WEB_HMI
const char* kLinkToWebHMI = "LinkToWebHMI";
-#endif // WEB_HMI
+#endif // WEB_HMI
const char* kStartStreamRetry = "StartStreamRetry";
const char* kEnableRedecodingKey = "EnableRedecoding";
const char* kVideoStreamConsumerKey = "VideoStreamConsumer";
@@ -100,6 +115,18 @@ const char* kNamedVideoPipePathKey = "NamedVideoPipePath";
const char* kNamedAudioPipePathKey = "NamedAudioPipePath";
const char* kVideoStreamFileKey = "VideoStreamFile";
const char* kAudioStreamFileKey = "AudioStreamFile";
+
+#ifdef ENABLE_SECURITY
+const char* kSecurityProtocolKey = "Protocol";
+const char* kSecurityCertificatePathKey = "CertificatePath";
+const char* kSecurityCACertificatePathKey = "CACertificatePath";
+const char* kSecuritySSLModeKey = "SSLMode";
+const char* kSecurityKeyPathKey = "KeyPath";
+const char* kSecurityCipherListKey = "CipherList";
+const char* kSecurityVerifyPeerKey = "VerifyPeer";
+const char* kBeforeUpdateHours = "UpdateBeforeHours";
+#endif
+
const char* kAudioDataStoppedTimeoutKey = "AudioDataStoppedTimeout";
const char* kVideoDataStoppedTimeoutKey = "VideoDataStoppedTimeout";
const char* kMixingAudioSupportedKey = "MixingAudioSupported";
@@ -109,6 +136,7 @@ const char* kHelpTitleKey = "HelpTitle";
const char* kHelpCommandKey = "HelpCommand";
const char* kSystemFilesPathKey = "SystemFilesPath";
const char* kHeartBeatTimeoutKey = "HeartBeatTimeout";
+const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion";
const char* kUseLastStateKey = "UseLastState";
const char* kTCPAdapterPortKey = "TCPAdapterPort";
const char* kServerPortKey = "ServerPort";
@@ -121,6 +149,7 @@ const char* kMaxCmdIdKey = "MaxCmdID";
const char* kPutFileRequestKey = "PutFileRequest";
const char* kDeleteFileRequestKey = "DeleteFileRequest";
const char* kListFilesRequestKey = "ListFilesRequest";
+const char* kListFilesResponseSizeKey = "ListFilesResponseSize";
const char* kDefaultTimeoutKey = "DefaultTimeout";
const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout";
const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout";
@@ -140,7 +169,6 @@ const char* kTTSDelimiterKey = "TTSDelimiter";
const char* kRecordingFileNameKey = "RecordingFileName";
const char* kRecordingFileSourceKey = "RecordingFileSource";
const char* kEnablePolicy = "EnablePolicy";
-const char* kMmeDatabaseNameKey = "MMEDatabase";
const char* kEventMQKey = "EventMQ";
const char* kAckMQKey = "AckMQ";
const char* kApplicationListUpdateTimeoutKey = "ApplicationListUpdateTimeout";
@@ -161,12 +189,17 @@ const char* kFrequencyTime = "FrequencyTime";
const char* kMalformedMessageFiltering = "MalformedMessageFiltering";
const char* kMalformedFrequencyCount = "MalformedFrequencyCount";
const char* kMalformedFrequencyTime = "MalformedFrequencyTime";
+const char* kExpectedConsecutiveFramesTimeout =
+ "ExpectedConsecutiveFramesTimeout";
const char* kHashStringSizeKey = "HashStringSize";
+const char* kUseDBForResumptionKey = "UseDBForResumption";
+const char* kAttemptsToOpenResumptionDBKey = "AttemptsToOpenResumptionDB";
+const char* kOpenAttemptTimeoutMsResumptionDBKey =
+ "OpenAttemptTimeoutMsResumptionDB";
#ifdef WEB_HMI
const char* kDefaultLinkToWebHMI = "HMI/index.html";
-#endif // WEB_HMI
-const char* kDefaultSDLVersion = "";
+#endif // WEB_HMI
const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json";
const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json";
const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json";
@@ -176,7 +209,6 @@ const char* kDefaultSystemFilesPath = "/tmp/fs/mp/images/ivsu_cache";
const char* kDefaultTtsDelimiter = ",";
const uint32_t kDefaultAudioDataStoppedTimeout = 1000;
const uint32_t kDefaultVideoDataStoppedTimeout = 1000;
-const char* kDefaultMmeDatabaseName = "/dev/qdb/mediaservice_db";
const char* kDefaultEventMQ = "/dev/mqueue/ToSDLCoreUSBAdapter";
const char* kDefaultAckMQ = "/dev/mqueue/FromSDLCoreUSBAdapter";
const char* kDefaultRecordingFileSourceName = "audio.8bit.wav";
@@ -188,8 +220,16 @@ const char* kDefaultPoolProtocolMask = "com.smartdevicelink.prot";
const char* kDefaultIAPSystemConfig = "/fs/mp/etc/mm/ipod.cfg";
const char* kDefaultIAP2SystemConfig = "/fs/mp/etc/mm/iap2.cfg";
+#ifdef ENABLE_SECURITY
+const char* kDefaultSecurityProtocol = "TLSv1.2";
+const char* kDefaultSSLMode = "CLIENT";
+const bool kDefaultVerifyPeer = false;
+const uint32_t kDefaultBeforeUpdateHours = 24;
+#endif // ENABLE_SECURITY
+
const uint32_t kDefaultHubProtocolIndex = 0;
const uint32_t kDefaultHeartBeatTimeout = 0;
+const uint16_t kDefaultMaxSupportedProtocolVersion = 3;
const uint16_t kDefautTransportManagerTCPPort = 12345;
const uint16_t kDefaultServerPort = 8087;
const uint16_t kDefaultVideoStreamingPort = 5050;
@@ -201,11 +241,12 @@ const uint32_t kDefaultPutFileRequestInNone = 5;
const uint32_t kDefaultDeleteFileRequestInNone = 5;
const uint32_t kDefaultListFilesRequestInNone = 5;
const uint32_t kDefaultTimeout = 10000;
-const uint32_t kDefaultAppResumingTimeout = 3;
-const uint32_t kDefaultAppSavePersistentDataTimeout = 10;
+const uint32_t kDefaultAppResumingTimeout = 3000;
+const uint32_t kDefaultAppSavePersistentDataTimeout = 10000;
const uint32_t kDefaultResumptionDelayBeforeIgn = 30;
const uint32_t kDefaultResumptionDelayAfterIgn = 30;
const uint32_t kDefaultHashStringSize = 32;
+const uint32_t kDefaultListFilesResponseSize = 1000;
const uint32_t kDefaultDirQuota = 104857600;
const uint32_t kDefaultAppTimeScaleMaxRequests = 0;
@@ -215,12 +256,13 @@ const uint32_t kDefaultAppHmiLevelNoneRequestsTimeScale = 10;
const uint32_t kDefaultPendingRequestsAmount = 0;
const uint32_t kDefaultTransportManagerDisconnectTimeout = 0;
const uint32_t kDefaultApplicationListUpdateTimeout = 1;
-const std::pair<uint32_t, uint32_t> kReadDIDFrequency = { 5, 1 };
-const std::pair<uint32_t, uint32_t> kGetVehicleDataFrequency = { 5, 1 };
-const std::pair<uint32_t, uint32_t> kStartStreamRetryAmount = { 3, 1 };
+const std::pair<uint32_t, uint32_t> kReadDIDFrequency = {5, 1};
+const std::pair<uint32_t, uint32_t> kGetVehicleDataFrequency = {5, 1};
+const std::pair<uint32_t, uint32_t> kStartStreamRetryAmount = {3, 1};
const uint32_t kDefaultMaxThreadPoolSize = 2;
const int kDefaultIAP2HubConnectAttempts = 0;
-const int kDefaultIAPHubConnectionWaitTimeout = 10;
+const int kDefaultIAPHubConnectionWaitTimeout = 10000;
+const int kDefaultIAPArmEventTimeout = 500;
const uint16_t kDefaultTTSGlobalPropertiesTimeout = 20;
// TCP MTU - header size = 1500 - 12
const size_t kDefaultMaximumPayloadSize = 1500 - 12;
@@ -229,11 +271,13 @@ const size_t kDefaultFrequencyTime = 1000;
const bool kDefaulMalformedMessageFiltering = true;
const size_t kDefaultMalformedFrequencyCount = 10;
const size_t kDefaultMalformedFrequencyTime = 1000;
+const uint32_t kDefaultExpectedConsecutiveFramesTimeout = 10000;
const uint16_t kDefaultAttemptsToOpenPolicyDB = 5;
-const uint16_t kDefaultOpenAttemptTimeoutMsKey = 500;
-const uint32_t kDefaultAppIconsFolderMaxSize = 1048576;
+const uint16_t kDefaultOpenAttemptTimeoutMs = 500;
+const uint32_t kDefaultAppIconsFolderMaxSize = 104857600;
const uint32_t kDefaultAppIconsAmountToRemove = 1;
-
+const uint16_t kDefaultAttemptsToOpenResumptionDB = 5;
+const uint16_t kDefaultOpenAttemptTimeoutMsResumptionDB = 500;
} // namespace
namespace profile {
@@ -241,82 +285,84 @@ namespace profile {
CREATE_LOGGERPTR_GLOBAL(logger_, "Profile")
Profile::Profile()
- : sdl_version_(kDefaultSDLVersion),
- launch_hmi_(true),
+ : sdl_version_(kDefaultSDLVersion)
+ , launch_hmi_(true)
+ ,
#ifdef WEB_HMI
- link_to_web_hmi_(kDefaultLinkToWebHMI),
-#endif // WEB_HMI
- app_config_folder_(),
- app_storage_folder_(),
- app_resourse_folder_(),
- enable_protocol_4_(false),
- app_icons_folder_(),
- app_icons_folder_max_size_(kDefaultAppIconsFolderMaxSize),
- app_icons_amount_to_remove_(kDefaultAppIconsAmountToRemove),
- config_file_name_(kDefaultConfigFileName),
- server_address_(kDefaultServerAddress),
- server_port_(kDefaultServerPort),
- video_streaming_port_(kDefaultVideoStreamingPort),
- audio_streaming_port_(kDefaultAudioStreamingPort),
- time_testing_port_(kDefaultTimeTestingPort),
- hmi_capabilities_file_name_(kDefaultHmiCapabilitiesFileName),
- help_prompt_(),
- time_out_promt_(),
- min_tread_stack_size_(threads::Thread::kMinStackSize),
- is_mixing_audio_supported_(false),
- is_redecoding_enabled_(false),
- max_cmd_id_(kDefaultMaxCmdId),
- default_timeout_(kDefaultTimeout),
- app_resuming_timeout_(kDefaultAppResumingTimeout),
- app_dir_quota_(kDefaultDirQuota),
- app_hmi_level_none_time_scale_max_requests_(
- kDefaultAppHmiLevelNoneTimeScaleMaxRequests),
- app_hmi_level_none_requests_time_scale_(
- kDefaultAppHmiLevelNoneRequestsTimeScale),
- app_time_scale_max_requests_(kDefaultAppTimeScaleMaxRequests),
- app_requests_time_scale_(kDefaultAppRequestsTimeScale),
- pending_requests_amount_(kDefaultPendingRequestsAmount),
- put_file_in_none_(kDefaultPutFileRequestInNone),
- delete_file_in_none_(kDefaultDeleteFileRequestInNone),
- list_files_in_none_(kDefaultListFilesRequestInNone),
- app_info_storage_(kDefaultAppInfoFileName),
- heart_beat_timeout_(kDefaultHeartBeatTimeout),
- policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName),
- enable_policy_(false),
- transport_manager_disconnect_timeout_(
- kDefaultTransportManagerDisconnectTimeout),
- use_last_state_(false),
- supported_diag_modes_(),
- system_files_path_(kDefaultSystemFilesPath),
- transport_manager_tcp_adapter_port_(kDefautTransportManagerTCPPort),
- tts_delimiter_(kDefaultTtsDelimiter),
- audio_data_stopped_timeout_(kDefaultAudioDataStoppedTimeout),
- video_data_stopped_timeout_(kDefaultVideoDataStoppedTimeout),
- mme_db_name_(kDefaultMmeDatabaseName),
- event_mq_name_(kDefaultEventMQ),
- ack_mq_name_(kDefaultAckMQ),
- recording_file_source_(kDefaultRecordingFileSourceName),
- recording_file_name_(kDefaultRecordingFileName),
- application_list_update_timeout_(kDefaultApplicationListUpdateTimeout),
- iap_legacy_protocol_mask_(kDefaultLegacyProtocolMask),
- iap_hub_protocol_mask_(kDefaultHubProtocolMask),
- iap_pool_protocol_mask_(kDefaultPoolProtocolMask),
- iap_system_config_(kDefaultIAPSystemConfig),
- iap2_system_config_(kDefaultIAP2SystemConfig),
- iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts),
- iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout),
- tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout),
- attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB),
- open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB),
- hash_string_size_(kDefaultHashStringSize) {
- ReadStringValue(&sdl_version_, kDefaultSDLVersion,
- kMainSection, kSDLVersionKey);
-}
-
-
-
-Profile::~Profile() {
-}
+ link_to_web_hmi_(kDefaultLinkToWebHMI)
+ ,
+#endif // WEB_HMI
+ app_config_folder_()
+ , app_storage_folder_()
+ , app_resource_folder_()
+ , enable_protocol_4_(false)
+ , app_icons_folder_()
+ , app_icons_folder_max_size_(kDefaultAppIconsFolderMaxSize)
+ , app_icons_amount_to_remove_(kDefaultAppIconsAmountToRemove)
+ , config_file_name_(kDefaultConfigFileName)
+ , server_address_(kDefaultServerAddress)
+ , server_port_(kDefaultServerPort)
+ , video_streaming_port_(kDefaultVideoStreamingPort)
+ , audio_streaming_port_(kDefaultAudioStreamingPort)
+ , time_testing_port_(kDefaultTimeTestingPort)
+ , hmi_capabilities_file_name_(kDefaultHmiCapabilitiesFileName)
+ , help_prompt_()
+ , time_out_promt_()
+ , min_tread_stack_size_(threads::Thread::kMinStackSize)
+ , is_mixing_audio_supported_(false)
+ , is_redecoding_enabled_(false)
+ , max_cmd_id_(kDefaultMaxCmdId)
+ , default_timeout_(kDefaultTimeout)
+ , app_resuming_timeout_(kDefaultAppResumingTimeout)
+ , app_dir_quota_(kDefaultDirQuota)
+ , app_hmi_level_none_time_scale_max_requests_(
+ kDefaultAppHmiLevelNoneTimeScaleMaxRequests)
+ , app_hmi_level_none_requests_time_scale_(
+ kDefaultAppHmiLevelNoneRequestsTimeScale)
+ , app_time_scale_max_requests_(kDefaultAppTimeScaleMaxRequests)
+ , app_requests_time_scale_(kDefaultAppRequestsTimeScale)
+ , pending_requests_amount_(kDefaultPendingRequestsAmount)
+ , put_file_in_none_(kDefaultPutFileRequestInNone)
+ , delete_file_in_none_(kDefaultDeleteFileRequestInNone)
+ , list_files_in_none_(kDefaultListFilesRequestInNone)
+ , list_files_response_size_(kDefaultListFilesResponseSize)
+ , app_info_storage_(kDefaultAppInfoFileName)
+ , heart_beat_timeout_(kDefaultHeartBeatTimeout)
+ , max_supported_protocol_version_(kDefaultMaxSupportedProtocolVersion)
+ , policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName)
+ , enable_policy_(false)
+ , transport_manager_disconnect_timeout_(
+ kDefaultTransportManagerDisconnectTimeout)
+ , use_last_state_(false)
+ , supported_diag_modes_()
+ , system_files_path_(kDefaultSystemFilesPath)
+ , transport_manager_tcp_adapter_port_(kDefautTransportManagerTCPPort)
+ , tts_delimiter_(kDefaultTtsDelimiter)
+ , audio_data_stopped_timeout_(kDefaultAudioDataStoppedTimeout)
+ , video_data_stopped_timeout_(kDefaultVideoDataStoppedTimeout)
+ , event_mq_name_(kDefaultEventMQ)
+ , ack_mq_name_(kDefaultAckMQ)
+ , recording_file_source_(kDefaultRecordingFileSourceName)
+ , recording_file_name_(kDefaultRecordingFileName)
+ , application_list_update_timeout_(kDefaultApplicationListUpdateTimeout)
+ , iap_legacy_protocol_mask_(kDefaultLegacyProtocolMask)
+ , iap_hub_protocol_mask_(kDefaultHubProtocolMask)
+ , iap_pool_protocol_mask_(kDefaultPoolProtocolMask)
+ , iap_system_config_(kDefaultIAPSystemConfig)
+ , iap2_system_config_(kDefaultIAP2SystemConfig)
+ , iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts)
+ , iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout)
+ , tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout)
+ , attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB)
+ , open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB)
+ , hash_string_size_(kDefaultHashStringSize)
+ , use_db_for_resumption_(false)
+ , attempts_to_open_resumption_db_(kDefaultAttemptsToOpenResumptionDB)
+ , open_attempt_timeout_ms_resumption_db_(
+ kDefaultOpenAttemptTimeoutMsResumptionDB) {
+}
+
+Profile::~Profile() {}
void Profile::config_file_name(const std::string& fileName) {
if (false == fileName.empty()) {
@@ -341,7 +387,7 @@ bool Profile::launch_hmi() const {
std::string Profile::link_to_web_hmi() const {
return link_to_web_hmi_;
}
-#endif // WEB_HMI
+#endif // WEB_HMI
const std::string& Profile::app_config_folder() const {
return app_config_folder_;
@@ -351,23 +397,23 @@ const std::string& Profile::app_storage_folder() const {
return app_storage_folder_;
}
-const std::string& Profile::app_resourse_folder() const {
- return app_resourse_folder_;
+const std::string& Profile::app_resource_folder() const {
+ return app_resource_folder_;
}
bool Profile::enable_protocol_4() const {
return enable_protocol_4_;
}
-const std::string&Profile::app_icons_folder() const {
+const std::string& Profile::app_icons_folder() const {
return app_icons_folder_;
}
-const uint32_t&Profile::app_icons_folder_max_size() const {
+const uint32_t& Profile::app_icons_folder_max_size() const {
return app_icons_folder_max_size_;
}
-const uint32_t&Profile::app_icons_amount_to_remove() const {
+const uint32_t& Profile::app_icons_amount_to_remove() const {
return app_icons_amount_to_remove_;
}
@@ -415,11 +461,11 @@ const uint16_t& Profile::server_port() const {
return server_port_;
}
-const uint16_t& Profile::video_streaming_port() const {
+const uint16_t Profile::video_streaming_port() const {
return video_streaming_port_;
}
-const uint16_t& Profile::audio_streaming_port() const {
+const uint16_t Profile::audio_streaming_port() const {
return audio_streaming_port_;
}
@@ -511,14 +557,22 @@ const uint32_t& Profile::list_files_in_none() const {
return list_files_in_none_;
}
+const uint32_t& Profile::list_files_response_size() const {
+ return list_files_response_size_;
+}
+
const std::string& Profile::app_info_storage() const {
return app_info_storage_;
}
-int32_t Profile::heart_beat_timeout() const {
+uint32_t Profile::heart_beat_timeout() const {
return heart_beat_timeout_;
}
+uint16_t Profile::max_supported_protocol_version() const {
+ return max_supported_protocol_version_;
+}
+
const std::string& Profile::preloaded_pt_file() const {
return preloaded_pt_file_;
}
@@ -558,15 +612,10 @@ const std::string& Profile::tts_delimiter() const {
const std::string& Profile::recording_file_source() const {
return recording_file_source_;
}
-
-const std::string&Profile::recording_file_name() const {
+const std::string& Profile::recording_file_name() const {
return recording_file_name_;
}
-const std::string& Profile::mme_db_name() const {
- return mme_db_name_;
-}
-
const std::string& Profile::event_mq_name() const {
return event_mq_name_;
}
@@ -583,7 +632,8 @@ const std::pair<uint32_t, int32_t>& Profile::read_did_frequency() const {
return read_did_frequency_;
}
-const std::pair<uint32_t, int32_t>& Profile::get_vehicle_data_frequency() const {
+const std::pair<uint32_t, int32_t>& Profile::get_vehicle_data_frequency()
+ const {
return get_vehicle_data_frequency_;
}
@@ -619,55 +669,75 @@ const std::string& Profile::iap2_system_config() const {
return iap2_system_config_;
}
-int Profile::iap2_hub_connect_attempts() const {
+uint32_t Profile::iap2_hub_connect_attempts() const {
return iap2_hub_connect_attempts_;
}
-int Profile::iap_hub_connection_wait_timeout() const {
+uint32_t Profile::iap_hub_connection_wait_timeout() const {
return iap_hub_connection_wait_timeout_;
}
size_t Profile::maximum_payload_size() const {
size_t maximum_payload_size = 0;
- ReadUIntValue(&maximum_payload_size, kDefaultMaximumPayloadSize,
- kProtocolHandlerSection, kMaximumPayloadSizeKey);
+ ReadUIntValue(&maximum_payload_size,
+ kDefaultMaximumPayloadSize,
+ kProtocolHandlerSection,
+ kMaximumPayloadSizeKey);
return maximum_payload_size;
}
size_t Profile::message_frequency_count() const {
size_t message_frequency_count = 0;
- ReadUIntValue(&message_frequency_count, kDefaultFrequencyCount,
- kProtocolHandlerSection, kFrequencyCount);
+ ReadUIntValue(&message_frequency_count,
+ kDefaultFrequencyCount,
+ kProtocolHandlerSection,
+ kFrequencyCount);
return message_frequency_count;
}
size_t Profile::message_frequency_time() const {
size_t message_frequency_time = 0;
- ReadUIntValue(&message_frequency_time, kDefaultFrequencyTime,
- kProtocolHandlerSection, kFrequencyTime);
+ ReadUIntValue(&message_frequency_time,
+ kDefaultFrequencyTime,
+ kProtocolHandlerSection,
+ kFrequencyTime);
return message_frequency_time;
}
bool Profile::malformed_message_filtering() const {
bool malformed_message_filtering = 0;
- ReadBoolValue(&malformed_message_filtering, kDefaulMalformedMessageFiltering,
- kProtocolHandlerSection, kMalformedMessageFiltering);
+ ReadBoolValue(&malformed_message_filtering,
+ kDefaulMalformedMessageFiltering,
+ kProtocolHandlerSection,
+ kMalformedMessageFiltering);
return malformed_message_filtering;
}
size_t Profile::malformed_frequency_count() const {
size_t malformed_frequency_count = 0;
- ReadUIntValue(&malformed_frequency_count, kDefaultMalformedFrequencyCount,
- kProtocolHandlerSection, kMalformedFrequencyCount);
+ ReadUIntValue(&malformed_frequency_count,
+ kDefaultMalformedFrequencyCount,
+ kProtocolHandlerSection,
+ kMalformedFrequencyCount);
return malformed_frequency_count;
}
size_t Profile::malformed_frequency_time() const {
size_t malformed_frequency_time = 0;
- ReadUIntValue(&malformed_frequency_time, kDefaultMalformedFrequencyTime,
- kProtocolHandlerSection, kMalformedFrequencyTime);
+ ReadUIntValue(&malformed_frequency_time,
+ kDefaultMalformedFrequencyTime,
+ kProtocolHandlerSection,
+ kMalformedFrequencyTime);
return malformed_frequency_time;
}
+uint32_t Profile::multiframe_waiting_timeout() const {
+ uint32_t multiframe_waiting_timeout = 0;
+ ReadUIntValue(&multiframe_waiting_timeout,
+ kDefaultExpectedConsecutiveFramesTimeout,
+ kProtocolHandlerSection,
+ kExpectedConsecutiveFramesTimeout);
+ return multiframe_waiting_timeout;
+}
uint16_t Profile::attempts_to_open_policy_db() const {
return attempts_to_open_policy_db_;
@@ -693,12 +763,71 @@ uint16_t Profile::tts_global_properties_timeout() const {
return tts_global_properties_timeout_;
}
+#ifdef ENABLE_SECURITY
+
+const std::string& Profile::cert_path() const {
+ return cert_path_;
+}
+
+const std::string& Profile::ca_cert_path() const {
+ return ca_cert_path_;
+}
+
+const std::string& Profile::ssl_mode() const {
+ return ssl_mode_;
+}
+
+const std::string& Profile::key_path() const {
+ return key_path_;
+}
+
+const std::string& Profile::ciphers_list() const {
+ return ciphers_list_;
+}
+
+bool Profile::verify_peer() const {
+ return verify_peer_;
+}
+
+size_t Profile::update_before_hours() const {
+ return update_before_hours_;
+}
+
+const std::string& Profile::security_manager_protocol_name() const {
+ return security_manager_protocol_name_;
+}
+
+const std::vector<int>& Profile::force_protected_service() const {
+ return force_protected_service_;
+}
+
+const std::vector<int>& Profile::force_unprotected_service() const {
+ return force_unprotected_service_;
+}
+#endif // ENABLE_SECURITY
+
+bool Profile::logs_enabled() const {
+ return logs_enabled_;
+}
+
+bool Profile::use_db_for_resumption() const {
+ return use_db_for_resumption_;
+}
+
+uint16_t Profile::attempts_to_open_resumption_db() const {
+ return attempts_to_open_resumption_db_;
+}
+
+uint16_t Profile::open_attempt_timeout_ms_resumption_db() const {
+ return open_attempt_timeout_ms_resumption_db_;
+}
+
void Profile::UpdateValues() {
LOG4CXX_AUTO_TRACE(logger_);
// SDL version
- ReadStringValue(&sdl_version_, kDefaultSDLVersion,
- kMainSection, kSDLVersionKey);
+ ReadStringValue(
+ &sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
LOG_UPDATED_VALUE(sdl_version_, kSDLVersionKey, kMainSection);
@@ -711,19 +840,63 @@ void Profile::UpdateValues() {
launch_hmi_ = false;
}
- LOG_UPDATED_BOOL_VALUE(launch_hmi_, kLaunchHMIKey, kHmiSection);
+ LOG_UPDATED_BOOL_VALUE(launch_hmi_, kLaunchHMIKey, kHmiSection);
#ifdef WEB_HMI
// Link to web HMI parameter
- ReadStringValue(&link_to_web_hmi_, kDefaultLinkToWebHMI,
- kHmiSection, kLinkToWebHMI);
+ ReadStringValue(
+ &link_to_web_hmi_, kDefaultLinkToWebHMI, kHmiSection, kLinkToWebHMI);
LOG_UPDATED_BOOL_VALUE(link_to_web_hmi_, kLinkToWebHMI, kHmiSection);
-#endif // WEB_HMI
+#endif // WEB_HMI
+
+#ifdef ENABLE_SECURITY
+
+ force_protected_service_ =
+ ReadIntContainer(kSecuritySection, kForceProtectedService, NULL);
+
+ force_unprotected_service_ =
+ ReadIntContainer(kSecuritySection, kForceUnprotectedService, NULL);
+
+ ReadStringValue(&security_manager_protocol_name_,
+ kDefaultSecurityProtocol,
+ kSecuritySection,
+ kSecurityProtocolKey);
+
+ ReadStringValue(
+ &cert_path_, "", kSecuritySection, kSecurityCertificatePathKey);
+ ReadStringValue(
+ &ca_cert_path_, "", kSecuritySection, kSecurityCACertificatePathKey);
+
+ ReadStringValue(
+ &ssl_mode_, kDefaultSSLMode, kSecuritySection, kSecuritySSLModeKey);
+
+ ReadStringValue(&key_path_, "", kSecuritySection, kSecurityKeyPathKey);
+
+ ReadStringValue(
+ &ciphers_list_, SSL_TXT_ALL, kSecuritySection, kSecurityCipherListKey);
+
+ ReadBoolValue(&verify_peer_,
+ kDefaultVerifyPeer,
+ kSecuritySection,
+ kSecurityVerifyPeerKey);
+
+ ReadUIntValue(&update_before_hours_,
+ kDefaultBeforeUpdateHours,
+ kSecuritySection,
+ kBeforeUpdateHours);
+
+#endif // ENABLE_SECURITY
+
+ // Logs enabled
+ ReadBoolValue(&logs_enabled_, false, kMainSection, kLogsEnabledKey);
+
+ LOG_UPDATED_BOOL_VALUE(logs_enabled_, kLogsEnabledKey, kMainSection);
// Application config folder
ReadStringValue(&app_config_folder_,
file_system::CurrentWorkingDirectory().c_str(),
- kMainSection, kAppConfigFolderKey);
+ kMainSection,
+ kAppConfigFolderKey);
if (IsRelativePath(app_config_folder_)) {
MakeAbsolutePath(app_config_folder_);
@@ -734,7 +907,8 @@ void Profile::UpdateValues() {
// Application storage folder
ReadStringValue(&app_storage_folder_,
file_system::CurrentWorkingDirectory().c_str(),
- kMainSection, kAppStorageFolderKey);
+ kMainSection,
+ kAppStorageFolderKey);
if (IsRelativePath(app_storage_folder_)) {
MakeAbsolutePath(app_storage_folder_);
@@ -743,16 +917,16 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(app_storage_folder_, kAppStorageFolderKey, kMainSection);
// Application resourse folder
- ReadStringValue(&app_resourse_folder_,
+ ReadStringValue(&app_resource_folder_,
file_system::CurrentWorkingDirectory().c_str(),
- kMainSection, kAppResourseFolderKey);
+ kMainSection,
+ kAppResourseFolderKey);
- if (IsRelativePath(app_resourse_folder_)) {
- MakeAbsolutePath(app_resourse_folder_);
+ if (IsRelativePath(app_resource_folder_)) {
+ MakeAbsolutePath(app_resource_folder_);
}
- LOG_UPDATED_VALUE(app_resourse_folder_, kAppResourseFolderKey,
- kMainSection);
+ LOG_UPDATED_VALUE(app_resource_folder_, kAppResourseFolderKey, kMainSection);
// Enable protocol ver.4 parameter
std::string enable_protocol_4_value;
@@ -768,95 +942,108 @@ void Profile::UpdateValues() {
// Application icon folder
ReadStringValue(&app_icons_folder_,
file_system::CurrentWorkingDirectory().c_str(),
- kSDL4Section, kAppIconsFolderKey);
+ kSDL4Section,
+ kAppIconsFolderKey);
if (IsRelativePath(app_icons_folder_)) {
MakeAbsolutePath(app_icons_folder_);
}
- LOG_UPDATED_VALUE(app_icons_folder_, kAppIconsFolderKey,
- kSDL4Section);
+ LOG_UPDATED_VALUE(app_icons_folder_, kAppIconsFolderKey, kSDL4Section);
// Application icon folder maximum size
- ReadUIntValue(&app_icons_folder_max_size_, kDefaultAppIconsFolderMaxSize,
- kSDL4Section, kAppIconsFolderMaxSizeKey);
+ ReadUIntValue(&app_icons_folder_max_size_,
+ kDefaultAppIconsFolderMaxSize,
+ kSDL4Section,
+ kAppIconsFolderMaxSizeKey);
if (app_icons_folder_max_size_ < kDefaultAppIconsFolderMaxSize) {
app_icons_folder_max_size_ = kDefaultAppIconsFolderMaxSize;
}
- LOG_UPDATED_VALUE(app_icons_folder_max_size_, kAppIconsFolderMaxSizeKey,
- kSDL4Section);
+ LOG_UPDATED_VALUE(
+ app_icons_folder_max_size_, kAppIconsFolderMaxSizeKey, kSDL4Section);
// Application icon folder maximum size
- ReadUIntValue(&app_icons_amount_to_remove_, kDefaultAppIconsAmountToRemove,
- kSDL4Section, kAppIconsAmountToRemoveKey);
+ ReadUIntValue(&app_icons_amount_to_remove_,
+ kDefaultAppIconsAmountToRemove,
+ kSDL4Section,
+ kAppIconsAmountToRemoveKey);
- LOG_UPDATED_VALUE(app_icons_amount_to_remove_, kAppIconsAmountToRemoveKey,
- kSDL4Section);
+ LOG_UPDATED_VALUE(
+ app_icons_amount_to_remove_, kAppIconsAmountToRemoveKey, kSDL4Section);
// Application info file name
- ReadStringValue(&app_info_storage_, kDefaultAppInfoFileName,
+ ReadStringValue(&app_info_storage_,
+ kDefaultAppInfoFileName,
kAppInfoSection,
kAppInfoStorageKey);
- LOG_UPDATED_VALUE(app_info_storage_, kAppInfoStorageKey,
- kAppInfoSection);
+ LOG_UPDATED_VALUE(app_info_storage_, kAppInfoStorageKey, kAppInfoSection);
// Server address
- ReadStringValue(&server_address_, kDefaultServerAddress, kHmiSection,
- kServerAddressKey);
+ ReadStringValue(
+ &server_address_, kDefaultServerAddress, kHmiSection, kServerAddressKey);
LOG_UPDATED_VALUE(server_address_, kServerAddressKey, kHmiSection);
// HMI capabilities
- ReadStringValue(&hmi_capabilities_file_name_ ,
+ ReadStringValue(&hmi_capabilities_file_name_,
kDefaultHmiCapabilitiesFileName,
- kMainSection, kHmiCapabilitiesKey);
+ kMainSection,
+ kHmiCapabilitiesKey);
- hmi_capabilities_file_name_ = app_config_folder_ + "/" +
- hmi_capabilities_file_name_;
+ hmi_capabilities_file_name_ =
+ app_config_folder_ + "/" + hmi_capabilities_file_name_;
- LOG_UPDATED_VALUE(hmi_capabilities_file_name_, kHmiCapabilitiesKey,
- kMainSection);
+ LOG_UPDATED_VALUE(
+ hmi_capabilities_file_name_, kHmiCapabilitiesKey, kMainSection);
// Server port
- ReadUIntValue(&server_port_, kDefaultServerPort, kHmiSection,
- kServerPortKey);
+ ReadUIntValue(&server_port_, kDefaultServerPort, kHmiSection, kServerPortKey);
LOG_UPDATED_VALUE(server_port_, kServerPortKey, kHmiSection);
// Video streaming port
- ReadUIntValue(&video_streaming_port_, kDefaultVideoStreamingPort,
- kHmiSection, kVideoStreamingPortKey);
+ ReadUIntValue(&video_streaming_port_,
+ kDefaultVideoStreamingPort,
+ kHmiSection,
+ kVideoStreamingPortKey);
- LOG_UPDATED_VALUE(video_streaming_port_, kVideoStreamingPortKey,
- kHmiSection);
+ LOG_UPDATED_VALUE(video_streaming_port_, kVideoStreamingPortKey, kHmiSection);
// Audio streaming port
- ReadUIntValue(&audio_streaming_port_, kDefaultAudioStreamingPort,
- kHmiSection, kAudioStreamingPortKey);
+ ReadUIntValue(&audio_streaming_port_,
+ kDefaultAudioStreamingPort,
+ kHmiSection,
+ kAudioStreamingPortKey);
- LOG_UPDATED_VALUE(audio_streaming_port_, kAudioStreamingPortKey,
- kHmiSection);
+ LOG_UPDATED_VALUE(audio_streaming_port_, kAudioStreamingPortKey, kHmiSection);
// Streaming timeout
- ReadUIntValue(&stop_streaming_timeout_, kDefaultStopStreamingTimeout,
- kMediaManagerSection, kStopStreamingTimeout);
+ ReadUIntValue(&stop_streaming_timeout_,
+ kDefaultStopStreamingTimeout,
+ kMediaManagerSection,
+ kStopStreamingTimeout);
- stop_streaming_timeout_ = std::max(kDefaultStopStreamingTimeout, stop_streaming_timeout_);
+ stop_streaming_timeout_ =
+ std::max(kDefaultStopStreamingTimeout, stop_streaming_timeout_);
- LOG_UPDATED_VALUE(stop_streaming_timeout_, kStopStreamingTimeout,
- kHmiSection);
+ LOG_UPDATED_VALUE(
+ stop_streaming_timeout_, kStopStreamingTimeout, kHmiSection);
// Time testing port
- ReadUIntValue(&time_testing_port_, kDefaultTimeTestingPort, kMainSection,
+ ReadUIntValue(&time_testing_port_,
+ kDefaultTimeTestingPort,
+ kMainSection,
kTimeTestingPortKey);
LOG_UPDATED_VALUE(time_testing_port_, kTimeTestingPortKey, kMainSection);
// Minimum thread stack size
- ReadUIntValue(&min_tread_stack_size_, threads::Thread::kMinStackSize,
- kMainSection, kThreadStackSizeKey);
+ ReadUIntValue(&min_tread_stack_size_,
+ threads::Thread::kMinStackSize,
+ kMainSection,
+ kThreadStackSizeKey);
if (min_tread_stack_size_ < threads::Thread::kMinStackSize) {
min_tread_stack_size_ = threads::Thread::kMinStackSize;
@@ -865,94 +1052,107 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(min_tread_stack_size_, kThreadStackSizeKey, kMainSection);
// Start stream retry frequency
- ReadUintIntPairValue(&start_stream_retry_amount_, kStartStreamRetryAmount,
- kMediaManagerSection, kStartStreamRetry);
+ ReadUintIntPairValue(&start_stream_retry_amount_,
+ kStartStreamRetryAmount,
+ kMediaManagerSection,
+ kStartStreamRetry);
// Redecoding parameter
std::string redecoding_value;
- if (ReadValue(&redecoding_value, kMediaManagerSection, kEnableRedecodingKey)
- && 0 == strcmp("true", redecoding_value.c_str())) {
+ if (ReadValue(
+ &redecoding_value, kMediaManagerSection, kEnableRedecodingKey) &&
+ 0 == strcmp("true", redecoding_value.c_str())) {
is_redecoding_enabled_ = true;
} else {
is_redecoding_enabled_ = false;
}
- LOG_UPDATED_BOOL_VALUE(is_redecoding_enabled_, kEnableRedecodingKey,
- kMediaManagerSection);
+ LOG_UPDATED_BOOL_VALUE(
+ is_redecoding_enabled_, kEnableRedecodingKey, kMediaManagerSection);
// Video consumer type
- ReadStringValue(&video_consumer_type_, "", kMediaManagerSection,
- kVideoStreamConsumerKey);
+ ReadStringValue(
+ &video_consumer_type_, "", kMediaManagerSection, kVideoStreamConsumerKey);
- LOG_UPDATED_VALUE(video_consumer_type_, kVideoStreamConsumerKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ video_consumer_type_, kVideoStreamConsumerKey, kMediaManagerSection);
// Audio stream consumer
- ReadStringValue(&audio_consumer_type_, "", kMediaManagerSection,
- kAudioStreamConsumerKey);
+ ReadStringValue(
+ &audio_consumer_type_, "", kMediaManagerSection, kAudioStreamConsumerKey);
- LOG_UPDATED_VALUE(audio_consumer_type_, kAudioStreamConsumerKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ audio_consumer_type_, kAudioStreamConsumerKey, kMediaManagerSection);
// Named video pipe path
- ReadStringValue(&named_video_pipe_path_, "", kMediaManagerSection,
+ ReadStringValue(&named_video_pipe_path_,
+ "",
+ kMediaManagerSection,
kNamedVideoPipePathKey);
named_video_pipe_path_ = app_storage_folder_ + "/" + named_video_pipe_path_;
- LOG_UPDATED_VALUE(named_video_pipe_path_, kNamedVideoPipePathKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ named_video_pipe_path_, kNamedVideoPipePathKey, kMediaManagerSection);
// Named audio pipe path
- ReadStringValue(&named_audio_pipe_path_, "", kMediaManagerSection,
+ ReadStringValue(&named_audio_pipe_path_,
+ "",
+ kMediaManagerSection,
kNamedAudioPipePathKey);
named_audio_pipe_path_ = app_storage_folder_ + "/" + named_audio_pipe_path_;
- LOG_UPDATED_VALUE(named_audio_pipe_path_, kNamedAudioPipePathKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ named_audio_pipe_path_, kNamedAudioPipePathKey, kMediaManagerSection);
// Video stream file
- ReadStringValue(&video_stream_file_, "", kMediaManagerSection,
- kVideoStreamFileKey);
+ ReadStringValue(
+ &video_stream_file_, "", kMediaManagerSection, kVideoStreamFileKey);
video_stream_file_ = app_storage_folder_ + "/" + video_stream_file_;
- LOG_UPDATED_VALUE(video_stream_file_, kVideoStreamFileKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ video_stream_file_, kVideoStreamFileKey, kMediaManagerSection);
// Audio stream file
- ReadStringValue(&audio_stream_file_, "", kMediaManagerSection,
- kAudioStreamFileKey);
+ ReadStringValue(
+ &audio_stream_file_, "", kMediaManagerSection, kAudioStreamFileKey);
audio_stream_file_ = app_storage_folder_ + "/" + audio_stream_file_;
- LOG_UPDATED_VALUE(audio_stream_file_, kAudioStreamFileKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ audio_stream_file_, kAudioStreamFileKey, kMediaManagerSection);
- ReadUIntValue(&audio_data_stopped_timeout_, kDefaultAudioDataStoppedTimeout,
- kMediaManagerSection, kAudioDataStoppedTimeoutKey);
+ ReadUIntValue(&audio_data_stopped_timeout_,
+ kDefaultAudioDataStoppedTimeout,
+ kMediaManagerSection,
+ kAudioDataStoppedTimeoutKey);
- LOG_UPDATED_VALUE(audio_data_stopped_timeout_, kAudioDataStoppedTimeoutKey,
+ LOG_UPDATED_VALUE(audio_data_stopped_timeout_,
+ kAudioDataStoppedTimeoutKey,
kMediaManagerSection);
- ReadUIntValue(&video_data_stopped_timeout_, kDefaultVideoDataStoppedTimeout,
- kMediaManagerSection, kVideoDataStoppedTimeoutKey);
+ ReadUIntValue(&video_data_stopped_timeout_,
+ kDefaultVideoDataStoppedTimeout,
+ kMediaManagerSection,
+ kVideoDataStoppedTimeoutKey);
- LOG_UPDATED_VALUE(video_data_stopped_timeout_, kVideoDataStoppedTimeoutKey,
+ LOG_UPDATED_VALUE(video_data_stopped_timeout_,
+ kVideoDataStoppedTimeoutKey,
kMediaManagerSection);
// Mixing audio parameter
std::string mixing_audio_value;
- if (ReadValue(&mixing_audio_value, kMainSection, kMixingAudioSupportedKey)
- && 0 == strcmp("true", mixing_audio_value.c_str())) {
+ if (ReadValue(&mixing_audio_value, kMainSection, kMixingAudioSupportedKey) &&
+ 0 == strcmp("true", mixing_audio_value.c_str())) {
is_mixing_audio_supported_ = true;
} else {
is_mixing_audio_supported_ = false;
}
- LOG_UPDATED_BOOL_VALUE(is_mixing_audio_supported_, kMixingAudioSupportedKey,
- kMainSection);
+ LOG_UPDATED_BOOL_VALUE(
+ is_mixing_audio_supported_, kMixingAudioSupportedKey, kMainSection);
// Maximum command id value
ReadUIntValue(&max_cmd_id_, kDefaultMaxCmdId, kMainSection, kMaxCmdIdKey);
@@ -960,29 +1160,47 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(max_cmd_id_, kMaxCmdIdKey, kMainSection);
// PutFile restrictions
- ReadUIntValue(&put_file_in_none_, kDefaultPutFileRequestInNone,
- kFilesystemRestrictionsSection, kPutFileRequestKey);
+ ReadUIntValue(&put_file_in_none_,
+ kDefaultPutFileRequestInNone,
+ kFilesystemRestrictionsSection,
+ kPutFileRequestKey);
- LOG_UPDATED_VALUE(put_file_in_none_, kPutFileRequestKey,
- kFilesystemRestrictionsSection);
+ LOG_UPDATED_VALUE(
+ put_file_in_none_, kPutFileRequestKey, kFilesystemRestrictionsSection);
// DeleteFileRestrictions
- ReadUIntValue(&delete_file_in_none_, kDefaultDeleteFileRequestInNone,
- kFilesystemRestrictionsSection, kDeleteFileRequestKey);
+ ReadUIntValue(&delete_file_in_none_,
+ kDefaultDeleteFileRequestInNone,
+ kFilesystemRestrictionsSection,
+ kDeleteFileRequestKey);
- LOG_UPDATED_VALUE(delete_file_in_none_, kDeleteFileRequestKey,
+ LOG_UPDATED_VALUE(delete_file_in_none_,
+ kDeleteFileRequestKey,
kFilesystemRestrictionsSection);
// ListFiles restrictions
- ReadUIntValue(&list_files_in_none_, kDefaultListFilesRequestInNone,
- kFilesystemRestrictionsSection, kListFilesRequestKey);
+ ReadUIntValue(&list_files_in_none_,
+ kDefaultListFilesRequestInNone,
+ kFilesystemRestrictionsSection,
+ kListFilesRequestKey);
- LOG_UPDATED_VALUE(list_files_in_none_, kListFilesRequestKey,
+ LOG_UPDATED_VALUE(list_files_in_none_,
+ kListFilesRequestKey,
+ kFilesystemRestrictionsSection);
+
+ // ListFiles request size
+ ReadUIntValue(&list_files_response_size_,
+ kDefaultListFilesResponseSize,
+ kFilesystemRestrictionsSection,
+ kListFilesResponseSizeKey);
+
+ LOG_UPDATED_VALUE(list_files_response_size_,
+ kListFilesResponseSizeKey,
kFilesystemRestrictionsSection);
// Default timeout
- ReadUIntValue(&default_timeout_, kDefaultTimeout, kMainSection,
- kDefaultTimeoutKey);
+ ReadUIntValue(
+ &default_timeout_, kDefaultTimeout, kMainSection, kDefaultTimeoutKey);
if (default_timeout_ == 0) {
default_timeout_ = kDefaultTimeout;
@@ -991,25 +1209,29 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(default_timeout_, kDefaultTimeoutKey, kMainSection);
// Application resuming timeout
- ReadUIntValue(&app_resuming_timeout_, kDefaultAppResumingTimeout,
- kResumptionSection, kAppResumingTimeoutKey);
+ ReadUIntValue(&app_resuming_timeout_,
+ kDefaultAppResumingTimeout,
+ kResumptionSection,
+ kAppResumingTimeoutKey);
if (app_resuming_timeout_ == 0) {
app_resuming_timeout_ = kDefaultAppResumingTimeout;
}
// Save resumption info to File System
- LOG_UPDATED_VALUE(app_resuming_timeout_, kAppSavePersistentDataTimeoutKey,
+ LOG_UPDATED_VALUE(app_resuming_timeout_,
+ kAppSavePersistentDataTimeoutKey,
kResumptionSection);
ReadUIntValue(&app_resumption_save_persistent_data_timeout_,
kDefaultAppSavePersistentDataTimeout,
- kResumptionSection, kAppSavePersistentDataTimeoutKey);
+ kResumptionSection,
+ kAppSavePersistentDataTimeoutKey);
if (app_resuming_timeout_ == 0) {
app_resuming_timeout_ = kDefaultAppSavePersistentDataTimeout;
}
- LOG_UPDATED_VALUE(app_resuming_timeout_, kAppResumingTimeoutKey,
- kResumptionSection);
+ LOG_UPDATED_VALUE(
+ app_resuming_timeout_, kAppResumingTimeoutKey, kResumptionSection);
// Open attempt timeout in ms
ReadUIntValue(&resumption_delay_before_ign_,
kDefaultResumptionDelayBeforeIgn,
@@ -1017,7 +1239,8 @@ void Profile::UpdateValues() {
kResumptionDelayBeforeIgnKey);
LOG_UPDATED_VALUE(resumption_delay_before_ign_,
- kResumptionDelayBeforeIgnKey, kResumptionSection);
+ kResumptionDelayBeforeIgnKey,
+ kResumptionSection);
// Open attempt timeout in ms
ReadUIntValue(&resumption_delay_after_ign_,
@@ -1026,11 +1249,12 @@ void Profile::UpdateValues() {
kResumptionDelayAfterIgnKey);
LOG_UPDATED_VALUE(resumption_delay_after_ign_,
- kResumptionDelayAfterIgnKey, kResumptionSection);
+ kResumptionDelayAfterIgnKey,
+ kResumptionSection);
// Application directory quota
- ReadUIntValue(&app_dir_quota_, kDefaultDirQuota, kMainSection,
- kAppDirectoryQuotaKey);
+ ReadUIntValue(
+ &app_dir_quota_, kDefaultDirQuota, kMainSection, kAppDirectoryQuotaKey);
if (app_dir_quota_ == 0) {
app_dir_quota_ = kDefaultDirQuota;
@@ -1040,68 +1264,62 @@ void Profile::UpdateValues() {
// TTS delimiter
// Should be gotten before any TTS prompts, since it should be appended back
- ReadStringValue(&tts_delimiter_, kDefaultTtsDelimiter,
- kGlobalPropertiesSection, kTTSDelimiterKey);
+ ReadStringValue(&tts_delimiter_,
+ kDefaultTtsDelimiter,
+ kGlobalPropertiesSection,
+ kTTSDelimiterKey);
- LOG_UPDATED_VALUE(tts_delimiter_, kTTSDelimiterKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(tts_delimiter_, kTTSDelimiterKey, kGlobalPropertiesSection);
// Help prompt
help_prompt_.clear();
std::string help_prompt_value;
- if (ReadValue(&help_prompt_value, kGlobalPropertiesSection,
- kHelpPromptKey)) {
+ if (ReadValue(&help_prompt_value, kGlobalPropertiesSection, kHelpPromptKey)) {
char* str = NULL;
str = strtok(const_cast<char*>(help_prompt_value.c_str()), ",");
while (str != NULL) {
// Default prompt should have delimiter included for each item
const std::string prompt_item = std::string(str) + tts_delimiter_;
help_prompt_.push_back(prompt_item);
- LOG_UPDATED_VALUE(prompt_item, kHelpPromptKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(prompt_item, kHelpPromptKey, kGlobalPropertiesSection);
str = strtok(NULL, ",");
}
} else {
help_prompt_value.clear();
- LOG_UPDATED_VALUE(help_prompt_value, kHelpPromptKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(
+ help_prompt_value, kHelpPromptKey, kGlobalPropertiesSection);
}
-
-
// Timeout prompt
time_out_promt_.clear();
std::string timeout_prompt_value;
- if (ReadValue(&timeout_prompt_value, kGlobalPropertiesSection,
- kTimeoutPromptKey)) {
+ if (ReadValue(
+ &timeout_prompt_value, kGlobalPropertiesSection, kTimeoutPromptKey)) {
char* str = NULL;
str = strtok(const_cast<char*>(timeout_prompt_value.c_str()), ",");
while (str != NULL) {
// Default prompt should have delimiter included for each item
const std::string prompt_item = std::string(str) + tts_delimiter_;
time_out_promt_.push_back(prompt_item);
- LOG_UPDATED_VALUE(prompt_item, kTimeoutPromptKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(
+ prompt_item, kTimeoutPromptKey, kGlobalPropertiesSection);
str = strtok(NULL, ",");
}
} else {
timeout_prompt_value.clear();
- LOG_UPDATED_VALUE(timeout_prompt_value, kTimeoutPromptKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(
+ timeout_prompt_value, kTimeoutPromptKey, kGlobalPropertiesSection);
}
// Voice recognition help title
- ReadStringValue(&vr_help_title_, "", kGlobalPropertiesSection,
- kHelpTitleKey);
+ ReadStringValue(&vr_help_title_, "", kGlobalPropertiesSection, kHelpTitleKey);
- LOG_UPDATED_VALUE(vr_help_title_, kHelpTitleKey,
- kGlobalPropertiesSection);
+ LOG_UPDATED_VALUE(vr_help_title_, kHelpTitleKey, kGlobalPropertiesSection);
// Voice recognition help command
vr_commands_.clear();
std::string vr_help_command_value;
- if (ReadValue(&vr_help_command_value, kVrCommandsSection,
- kHelpCommandKey)) {
+ if (ReadValue(&vr_help_command_value, kVrCommandsSection, kHelpCommandKey)) {
char* str = NULL;
str = strtok(const_cast<char*>(vr_help_command_value.c_str()), ",");
while (str != NULL) {
@@ -1112,17 +1330,18 @@ void Profile::UpdateValues() {
}
} else {
vr_help_command_value.clear();
- LOG_UPDATED_VALUE(vr_help_command_value, kHelpCommandKey,
- kVrCommandsSection);
+ LOG_UPDATED_VALUE(
+ vr_help_command_value, kHelpCommandKey, kVrCommandsSection);
}
- //TTS GlobalProperties timeout
+ // TTS GlobalProperties timeout
ReadUIntValue(&tts_global_properties_timeout_,
kDefaultTTSGlobalPropertiesTimeout,
kGlobalPropertiesSection,
kTTSGlobalPropertiesTimeoutKey);
- LOG_UPDATED_VALUE(tts_global_properties_timeout_, kTTSGlobalPropertiesTimeoutKey,
+ LOG_UPDATED_VALUE(tts_global_properties_timeout_,
+ kTTSGlobalPropertiesTimeoutKey,
kGlobalPropertiesSection);
// Application time scale maximum requests
@@ -1131,15 +1350,17 @@ void Profile::UpdateValues() {
kMainSection,
kAppTimeScaleMaxRequestsKey);
- LOG_UPDATED_VALUE(app_time_scale_max_requests_, kAppTimeScaleMaxRequestsKey,
- kMainSection);
+ LOG_UPDATED_VALUE(
+ app_time_scale_max_requests_, kAppTimeScaleMaxRequestsKey, kMainSection);
// Application time scale
- ReadUIntValue(&app_requests_time_scale_, kDefaultAppRequestsTimeScale,
- kMainSection, kAppRequestsTimeScaleKey);
+ ReadUIntValue(&app_requests_time_scale_,
+ kDefaultAppRequestsTimeScale,
+ kMainSection,
+ kAppRequestsTimeScaleKey);
- LOG_UPDATED_VALUE(app_requests_time_scale_, kAppRequestsTimeScaleKey,
- kMainSection);
+ LOG_UPDATED_VALUE(
+ app_requests_time_scale_, kAppRequestsTimeScaleKey, kMainSection);
// Application HMI level NONE time scale maximum requests
ReadUIntValue(&app_hmi_level_none_time_scale_max_requests_,
@@ -1162,21 +1383,25 @@ void Profile::UpdateValues() {
kMainSection);
// Amount of pending requests
- ReadUIntValue(&pending_requests_amount_, kDefaultPendingRequestsAmount,
- kMainSection, kPendingRequestsAmoundKey);
+ ReadUIntValue(&pending_requests_amount_,
+ kDefaultPendingRequestsAmount,
+ kMainSection,
+ kPendingRequestsAmoundKey);
if (pending_requests_amount_ == 0) {
pending_requests_amount_ = kDefaultPendingRequestsAmount;
}
- LOG_UPDATED_VALUE(pending_requests_amount_, kPendingRequestsAmoundKey,
- kMainSection);
+ LOG_UPDATED_VALUE(
+ pending_requests_amount_, kPendingRequestsAmoundKey, kMainSection);
// Supported diagnostic modes
supported_diag_modes_.clear();
std::string supported_diag_modes_value;
std::string correct_diag_modes;
- if (ReadStringValue(&supported_diag_modes_value, "", kMainSection,
+ if (ReadStringValue(&supported_diag_modes_value,
+ "",
+ kMainSection,
kSupportedDiagModesKey)) {
char* str = NULL;
str = strtok(const_cast<char*>(supported_diag_modes_value.c_str()), ",");
@@ -1195,13 +1420,17 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(correct_diag_modes, kSupportedDiagModesKey, kMainSection);
// System files path
- ReadStringValue(&system_files_path_, kDefaultSystemFilesPath, kMainSection,
+ ReadStringValue(&system_files_path_,
+ kDefaultSystemFilesPath,
+ kMainSection,
kSystemFilesPathKey);
LOG_UPDATED_VALUE(system_files_path_, kSystemFilesPathKey, kMainSection);
// Heartbeat timeout
- ReadUIntValue(&heart_beat_timeout_, kDefaultHeartBeatTimeout, kMainSection,
+ ReadUIntValue(&heart_beat_timeout_,
+ kDefaultHeartBeatTimeout,
+ kMainSection,
kHeartBeatTimeoutKey);
LOG_UPDATED_VALUE(heart_beat_timeout_, kHeartBeatTimeoutKey, kMainSection);
@@ -1223,29 +1452,19 @@ void Profile::UpdateValues() {
kTransportManagerSection,
kTCPAdapterPortKey);
- LOG_UPDATED_VALUE(transport_manager_tcp_adapter_port_, kTCPAdapterPortKey,
+ LOG_UPDATED_VALUE(transport_manager_tcp_adapter_port_,
+ kTCPAdapterPortKey,
kTransportManagerSection);
- // MME database name
- ReadStringValue(&mme_db_name_,
- kDefaultMmeDatabaseName,
- kTransportManagerSection,
- kMmeDatabaseNameKey);
-
- LOG_UPDATED_VALUE(mme_db_name_, kMmeDatabaseNameKey, kTransportManagerSection);
// Event MQ
- ReadStringValue(&event_mq_name_,
- kDefaultEventMQ,
- kTransportManagerSection,
- kEventMQKey);
+ ReadStringValue(
+ &event_mq_name_, kDefaultEventMQ, kTransportManagerSection, kEventMQKey);
LOG_UPDATED_VALUE(event_mq_name_, kEventMQKey, kTransportManagerSection);
// Ack MQ
- ReadStringValue(&ack_mq_name_,
- kDefaultAckMQ,
- kTransportManagerSection,
- kAckMQKey);
+ ReadStringValue(
+ &ack_mq_name_, kDefaultAckMQ, kTransportManagerSection, kAckMQKey);
LOG_UPDATED_VALUE(ack_mq_name_, kAckMQKey, kTransportManagerSection);
@@ -1260,22 +1479,28 @@ void Profile::UpdateValues() {
kTransportManagerSection);
// Recording file
- ReadStringValue(&recording_file_name_, kDefaultRecordingFileName,
- kMediaManagerSection, kRecordingFileNameKey);
+ ReadStringValue(&recording_file_name_,
+ kDefaultRecordingFileName,
+ kMediaManagerSection,
+ kRecordingFileNameKey);
- LOG_UPDATED_VALUE(recording_file_name_, kRecordingFileNameKey, kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ recording_file_name_, kRecordingFileNameKey, kMediaManagerSection);
// Recording file source
- ReadStringValue(&recording_file_source_, kDefaultRecordingFileSourceName,
- kMediaManagerSection, kRecordingFileSourceKey);
+ ReadStringValue(&recording_file_source_,
+ kDefaultRecordingFileSourceName,
+ kMediaManagerSection,
+ kRecordingFileSourceKey);
- LOG_UPDATED_VALUE(recording_file_source_, kRecordingFileSourceKey,
- kMediaManagerSection);
+ LOG_UPDATED_VALUE(
+ recording_file_source_, kRecordingFileSourceKey, kMediaManagerSection);
// Policy preloaded file
ReadStringValue(&preloaded_pt_file_,
kDefaultPreloadedPTFileName,
- kPolicySection, kPreloadedPTKey);
+ kPolicySection,
+ kPreloadedPTKey);
preloaded_pt_file_ = app_config_folder_ + '/' + preloaded_pt_file_;
@@ -1284,10 +1509,11 @@ void Profile::UpdateValues() {
// Policy snapshot file
ReadStringValue(&policy_snapshot_file_name_,
kDefaultPoliciesSnapshotFileName,
- kPolicySection, kPathToSnapshotKey);
+ kPolicySection,
+ kPathToSnapshotKey);
- LOG_UPDATED_VALUE(policy_snapshot_file_name_, kPathToSnapshotKey,
- kPolicySection);
+ LOG_UPDATED_VALUE(
+ policy_snapshot_file_name_, kPathToSnapshotKey, kPolicySection);
// Attempts number for opening policy DB
ReadUIntValue(&attempts_to_open_policy_db_,
@@ -1295,17 +1521,17 @@ void Profile::UpdateValues() {
kPolicySection,
kAttemptsToOpenPolicyDBKey);
- LOG_UPDATED_VALUE(attempts_to_open_policy_db_,
- kAttemptsToOpenPolicyDBKey, kPolicySection);
+ LOG_UPDATED_VALUE(
+ attempts_to_open_policy_db_, kAttemptsToOpenPolicyDBKey, kPolicySection);
// Open attempt timeout in ms
ReadUIntValue(&open_attempt_timeout_ms_,
- kDefaultOpenAttemptTimeoutMsKey,
+ kDefaultOpenAttemptTimeoutMs,
kPolicySection,
kOpenAttemptTimeoutMsKey);
- LOG_UPDATED_VALUE(open_attempt_timeout_ms_,
- kOpenAttemptTimeoutMsKey, kPolicySection);
+ LOG_UPDATED_VALUE(
+ open_attempt_timeout_ms_, kOpenAttemptTimeoutMsKey, kPolicySection);
// Turn Policy Off?
std::string enable_policy_string;
@@ -1316,6 +1542,18 @@ void Profile::UpdateValues() {
enable_policy_ = false;
}
+ // Max protocol version
+ ReadUIntValue(&max_supported_protocol_version_,
+ kDefaultMaxSupportedProtocolVersion,
+ kProtocolHandlerSection,
+ kMaxSupportedProtocolVersionKey);
+
+ // if .ini file contains protocol version less than 2 or more than 3
+ // max_supported_protocol_version_ = 3
+ if (max_supported_protocol_version_ < 2) {
+ max_supported_protocol_version_ = 3;
+ }
+
LOG_UPDATED_BOOL_VALUE(enable_policy_, kEnablePolicy, kPolicySection);
ReadUIntValue(&application_list_update_timeout_,
@@ -1324,13 +1562,18 @@ void Profile::UpdateValues() {
kApplicationListUpdateTimeoutKey);
LOG_UPDATED_VALUE(application_list_update_timeout_,
- kApplicationListUpdateTimeoutKey, kMainSection);
+ kApplicationListUpdateTimeoutKey,
+ kMainSection);
- ReadUintIntPairValue(&read_did_frequency_, kReadDIDFrequency,
- kMainSection, kReadDIDFrequencykey);
+ ReadUintIntPairValue(&read_did_frequency_,
+ kReadDIDFrequency,
+ kMainSection,
+ kReadDIDFrequencykey);
- ReadUintIntPairValue(&get_vehicle_data_frequency_, kGetVehicleDataFrequency,
- kMainSection, kGetVehicleDataFrequencyKey);
+ ReadUintIntPairValue(&get_vehicle_data_frequency_,
+ kGetVehicleDataFrequency,
+ kMainSection,
+ kGetVehicleDataFrequencyKey);
ReadUIntValue(&max_thread_pool_size_,
kDefaultMaxThreadPoolSize,
@@ -1340,14 +1583,16 @@ void Profile::UpdateValues() {
max_thread_pool_size_ = kDefaultMaxThreadPoolSize;
}
LOG_UPDATED_VALUE(max_thread_pool_size_,
- kDefaultMaxThreadPoolSize, kApplicationManagerSection);
+ kDefaultMaxThreadPoolSize,
+ kApplicationManagerSection);
ReadStringValue(&iap_legacy_protocol_mask_,
kDefaultLegacyProtocolMask,
kIAPSection,
kLegacyProtocolMaskKey);
- LOG_UPDATED_VALUE(iap_legacy_protocol_mask_, kLegacyProtocolMaskKey, kIAPSection);
+ LOG_UPDATED_VALUE(
+ iap_legacy_protocol_mask_, kLegacyProtocolMaskKey, kIAPSection);
ReadStringValue(&iap_hub_protocol_mask_,
kDefaultHubProtocolMask,
@@ -1382,7 +1627,8 @@ void Profile::UpdateValues() {
kIAPSection,
kIAP2HubConnectAttemptskey);
- LOG_UPDATED_VALUE(iap2_hub_connect_attempts_, kIAP2HubConnectAttemptskey, kIAPSection);
+ LOG_UPDATED_VALUE(
+ iap2_hub_connect_attempts_, kIAP2HubConnectAttemptskey, kIAPSection);
ReadIntValue(&iap_hub_connection_wait_timeout_,
kDefaultIAPHubConnectionWaitTimeout,
@@ -1390,59 +1636,91 @@ void Profile::UpdateValues() {
kIAPHubConnectionWaitTimeoutKey);
LOG_UPDATED_VALUE(iap_hub_connection_wait_timeout_,
- kIAPHubConnectionWaitTimeoutKey, kIAPSection);
+ kIAPHubConnectionWaitTimeoutKey,
+ kIAPSection);
- ReadUIntValue(&default_hub_protocol_index_, kDefaultHubProtocolIndex, kIAPSection, kDefaultHubProtocolIndexKey);
+ ReadUIntValue(&default_hub_protocol_index_,
+ kDefaultHubProtocolIndex,
+ kIAPSection,
+ kDefaultHubProtocolIndexKey);
- LOG_UPDATED_VALUE(default_hub_protocol_index_, kDefaultHubProtocolIndexKey, kIAPSection);
+ LOG_UPDATED_VALUE(
+ default_hub_protocol_index_, kDefaultHubProtocolIndexKey, kIAPSection);
- ReadUIntValue(&hash_string_size_,
+ ReadUIntValue(&hash_string_size_,
kDefaultHashStringSize,
kApplicationManagerSection,
kHashStringSizeKey);
- LOG_UPDATED_VALUE(hash_string_size_,
- kHashStringSizeKey,
- kApplicationManagerSection);
+ LOG_UPDATED_VALUE(
+ hash_string_size_, kHashStringSizeKey, kApplicationManagerSection);
+
+ ReadBoolValue(&use_db_for_resumption_,
+ false,
+ kResumptionSection,
+ kUseDBForResumptionKey);
+
+ LOG_UPDATED_BOOL_VALUE(
+ use_db_for_resumption_, kUseDBForResumptionKey, kResumptionSection);
+
+ ReadUIntValue(&attempts_to_open_resumption_db_,
+ kDefaultAttemptsToOpenResumptionDB,
+ kResumptionSection,
+ kAttemptsToOpenResumptionDBKey);
+
+ LOG_UPDATED_VALUE(attempts_to_open_resumption_db_,
+ kAttemptsToOpenResumptionDBKey,
+ kResumptionSection);
+
+ ReadUIntValue(&open_attempt_timeout_ms_resumption_db_,
+ kDefaultOpenAttemptTimeoutMsResumptionDB,
+ kResumptionSection,
+ kOpenAttemptTimeoutMsResumptionDBKey);
+
+ LOG_UPDATED_VALUE(open_attempt_timeout_ms_resumption_db_,
+ kOpenAttemptTimeoutMsResumptionDBKey,
+ kResumptionSection);
}
-bool Profile::ReadValue(bool* value, const char* const pSection,
+bool Profile::ReadValue(bool* value,
+ const char* const pSection,
const char* const pKey) const {
DCHECK(value);
bool ret = false;
char buf[INI_LINE_LEN + 1];
*buf = '\0';
- if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf))
- && ('\0' != *buf)) {
- const int32_t tmpVal = atoi(buf);
- if (0 == tmpVal) {
- *value = false;
- } else {
+ if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) &&
+ ('\0' != *buf)) {
+ const int32_t tmpVal = atoi(buf);
+ if ((0 == strcmp("true", buf)) || (0 != tmpVal)) {
*value = true;
+ } else {
+ *value = false;
}
-
ret = true;
}
return ret;
}
-bool Profile::ReadValue(std::string* value, const char* const pSection,
+bool Profile::ReadValue(std::string* value,
+ const char* const pSection,
const char* const pKey) const {
DCHECK(value);
bool ret = false;
char buf[INI_LINE_LEN + 1];
*buf = '\0';
- if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf))
- && ('\0' != *buf)) {
+ if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) &&
+ ('\0' != *buf)) {
*value = buf;
ret = true;
}
return ret;
}
-bool Profile::ReadStringValue(std::string* value, const char* default_value,
+bool Profile::ReadStringValue(std::string* value,
+ const char* default_value,
const char* const pSection,
const char* const pKey) const {
DCHECK(value);
@@ -1453,7 +1731,8 @@ bool Profile::ReadStringValue(std::string* value, const char* default_value,
return true;
}
-bool Profile::ReadIntValue(int32_t* value, const int32_t default_value,
+bool Profile::ReadIntValue(int32_t* value,
+ const int32_t default_value,
const char* const pSection,
const char* const pKey) const {
DCHECK(value);
@@ -1466,24 +1745,26 @@ bool Profile::ReadIntValue(int32_t* value, const int32_t default_value,
return true;
}
-bool Profile::ReadUintIntPairValue(std::pair<uint32_t, int32_t>* value,
+bool Profile::ReadUintIntPairValue(
+ std::pair<uint32_t, int32_t>* value,
const std::pair<uint32_t, uint32_t>& default_value,
- const char *const pSection,
- const char *const pKey) const {
+ const char* const pSection,
+ const char* const pKey) const {
std::string string_value;
if (!ReadValue(&string_value, pSection, pKey)) {
*value = default_value;
return false;
}
std::string first_str = string_value.substr(0, string_value.find(","));
- std::string second_str = string_value.substr(string_value.find(",") + 1,
- string_value.size() - first_str.size());
+ std::string second_str = string_value.substr(
+ string_value.find(",") + 1, string_value.size() - first_str.size());
(*value).first = strtoul(first_str.c_str(), NULL, 10);
(*value).second = strtoul(second_str.c_str(), NULL, 10);
return true;
}
-bool Profile::ReadBoolValue(bool* value, const bool default_value,
+bool Profile::ReadBoolValue(bool* value,
+ const bool default_value,
const char* const pSection,
const char* const pKey) const {
DCHECK(value);
@@ -1498,38 +1779,41 @@ int32_t hex_to_int(const std::string& value) {
}
}
-std::list<int> Profile::ReadIntContainer(
- const char * const pSection, const char * const pKey,
- bool *out_result) const {
- const std::list<std::string> string_list =
+std::vector<int> Profile::ReadIntContainer(const char* const pSection,
+ const char* const pKey,
+ bool* out_result) const {
+ const std::vector<std::string> string_list =
ReadStringContainer(pSection, pKey, out_result);
- std::list<int> value_list;
+ std::vector<int> value_list;
value_list.resize(string_list.size());
- std::transform(string_list.begin(), string_list.end(),
- value_list.begin(), hex_to_int);
+ std::transform(
+ string_list.begin(), string_list.end(), value_list.begin(), hex_to_int);
return value_list;
}
-std::list<std::string> Profile::ReadStringContainer(
- const char * const pSection, const char * const pKey,
- bool *out_result) const {
+std::vector<std::string> Profile::ReadStringContainer(
+ const char* const pSection,
+ const char* const pKey,
+ bool* out_result) const {
std::string string;
const bool result = ReadValue(&string, pSection, pKey);
if (out_result)
*out_result = result;
- std::list < std::string > value_container;
+ std::vector<std::string> value_container;
if (result) {
std::istringstream iss(string);
std::string temp_str;
while (iss) {
- if (!getline( iss, temp_str, ',' )) break;
+ if (!getline(iss, temp_str, ','))
+ break;
value_container.push_back(temp_str);
}
}
return value_container;
}
-bool Profile::ReadUIntValue(uint16_t* value, uint16_t default_value,
+bool Profile::ReadUIntValue(uint16_t* value,
+ uint16_t default_value,
const char* const pSection,
const char* const pKey) const {
std::string string_value;
@@ -1542,13 +1826,17 @@ bool Profile::ReadUIntValue(uint16_t* value, uint16_t default_value,
*value = default_value;
return false;
}
-
+ if (user_value > (std::numeric_limits<uint16_t>::max)()) {
+ *value = default_value;
+ return false;
+ }
*value = static_cast<uint16_t>(user_value);
return true;
}
}
-bool Profile::ReadUIntValue(uint32_t* value, uint32_t default_value,
+bool Profile::ReadUIntValue(uint32_t* value,
+ uint32_t default_value,
const char* const pSection,
const char* const pKey) const {
std::string string_value;
@@ -1558,7 +1846,11 @@ bool Profile::ReadUIntValue(uint32_t* value, uint32_t default_value,
} else {
uint64_t user_value;
if (!StringToNumber(string_value, user_value)) {
- *value = default_value;
+ *value = default_value;
+ return false;
+ }
+ if (user_value > (std::numeric_limits<uint32_t>::max)()) {
+ *value = default_value;
return false;
}
@@ -1567,7 +1859,8 @@ bool Profile::ReadUIntValue(uint32_t* value, uint32_t default_value,
}
}
-bool Profile::ReadUIntValue(uint64_t* value, uint64_t default_value,
+bool Profile::ReadUIntValue(uint64_t* value,
+ uint64_t default_value,
const char* const pSection,
const char* const pKey) const {
std::string string_value;
@@ -1613,4 +1906,4 @@ void Profile::MakeAbsolutePath(std::string& path) {
path = file_system::CurrentWorkingDirectory() + "/" + path;
}
-}// namespace profile
+} // namespace profile