summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_external/include
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-01-29 15:21:13 -0500
committerJackLivio <jack@livio.io>2019-01-29 15:21:13 -0500
commitbfcae5a747ff5f72de9132c2e992e1bbaa7a23dc (patch)
tree5072eb764f340b625284c4335dba6f441574ed8c /src/components/policy/policy_external/include
parent38d1ad78ea7acab3e7aecc668680c1476f3bf7ec (diff)
downloadsdl_core-bfcae5a747ff5f72de9132c2e992e1bbaa7a23dc.tar.gz
Update external policies for app services parameters
Diffstat (limited to 'src/components/policy/policy_external/include')
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h11
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h11
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h13
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h52
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_queries.h12
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_representation.h10
6 files changed, 73 insertions, 36 deletions
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index e31e3e6c34..d7094e19e5 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -231,16 +231,11 @@ class CacheManager : public CacheManagerInterface {
/**
* @brief Get app service parameters from the policy table
* @param policy_app_id Unique application id
- * @param service_name Service name published by app service provider
- * @param service_type Service type published by app service provider
- * @param handled_rpcs Vector of allowed function ids an app service provider
- * can handle
+ * @param app_service_parameters Pointer to struct containing all app service information
*/
virtual void GetAppServiceParameters(
- const std::string& policy_app_id,
- std::string& service_name,
- std::string& service_type,
- std::vector<uint32_t>& handled_rpcs) const;
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
/**
* @brief Allows to update 'vin' field in module_meta table.
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index 5b9fe5cfcb..4a904c5829 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -240,16 +240,11 @@ class CacheManagerInterface {
/**
* @brief Get app service parameters from the policy table
* @param policy_app_id Unique application id
- * @param service_name Service name published by app service provider
- * @param service_type Service type published by app service provider
- * @param handled_rpcs Vector of allowed function ids an app service provider
- * can handle
+ * @param app_service_parameters Pointer to struct containing all app service information
*/
virtual void GetAppServiceParameters(
- const std::string& policy_app_id,
- std::string& service_name,
- std::string& service_type,
- std::vector<uint32_t>& handled_rpcs) const = 0;
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
/**
* @brief Allows to update 'vin' field in module_meta table.
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index b5a9709ecc..fe982ff59e 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -642,16 +642,11 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Get app service parameters from the policy table
* @param policy_app_id Unique application id
- * @param service_name Service name published by app service provider
- * @param service_type Service type published by app service provider
- * @param handled_rpcs Vector of allowed function ids an app service provider
- * can handle
+ * @param app_service_parameters Pointer to struct containing all app service information
*/
- void GetAppServiceParameters(
- const std::string& policy_app_id,
- std::string& service_name,
- std::string& service_type,
- std::vector<uint32_t>& handled_rpcs) const OVERRIDE;
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h
index ed845b1191..e74091b8a3 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/types.h
@@ -52,6 +52,8 @@ struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
+struct AppServiceHandledRpc;
+struct AppServiceInfo;
} // namespace policy_table_interface_base
} // namespace rpc
@@ -104,7 +106,12 @@ typedef Array<Enum<RequestType>, 0, 255> RequestsTypeArray;
typedef Strings RequestSubTypes;
-typedef Array<Integer<uint64_t, 0u, UINT_MAX>, 0, 255> HandledRpcs;
+typedef String<0, 255> AppServiceType;
+typedef String<0, 255> AppServiceName;
+typedef Array<AppServiceName, 0, 255> AppServiceNames;
+typedef Array<AppServiceHandledRpc, 0, 255> AppServiceHandledRpcs;
+typedef Map<AppServiceInfo, 0, 255> AppServiceParameters;
+typedef Integer<int32_t, 0, INT32_MAX> FunctionIDInt;
typedef Map<Strings, 0, 255> RemoteRpcs;
typedef Map<RemoteRpcs, 0, 255> AccessModules;
@@ -113,6 +120,45 @@ typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
typedef AppHMIType AppHmiType;
typedef std::vector<AppHMIType> AppHmiTypes;
+struct AppServiceHandledRpc : CompositeType {
+ public:
+ FunctionIDInt function_id;
+
+ public:
+ AppServiceHandledRpc();
+ ~AppServiceHandledRpc();
+ AppServiceHandledRpc(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
+struct AppServiceInfo : CompositeType {
+ public:
+ Optional<AppServiceNames> service_names;
+ Optional<AppServiceHandledRpcs> handled_rpcs;
+
+ public:
+ AppServiceInfo();
+ ~AppServiceInfo();
+ AppServiceInfo(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
struct RequestTypes : public RequestsTypeArray {
RequestTypes();
explicit RequestTypes(Json::Value* value);
@@ -188,9 +234,7 @@ struct ApplicationParams : PolicyBase {
Optional<String<0, 255> > cloud_transport_type;
// App Service Params
- Optional<String<0, 255> > service_name;
- Optional<String<0, 255> > service_type;
- Optional<HandledRpcs> handled_rpcs;
+ Optional<AppServiceParameters> app_service_parameters;
public:
ApplicationParams();
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
index c66d878e5a..5382ff2d6b 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
@@ -66,7 +66,9 @@ extern const std::string kSelectNicknames;
extern const std::string kSelectAppTypes;
extern const std::string kSelectRequestTypes;
extern const std::string kSelectRequestSubTypes;
-extern const std::string kSelectHandledRpcs;
+extern const std::string kSelectAppServiceTypes;
+extern const std::string kSelectAppServiceNames;
+extern const std::string kSelectAppServiceHandledRpcs;
extern const std::string kSelectSecondsBetweenRetries;
extern const std::string kSelectIgnitionCycles;
extern const std::string kSelectKilometers;
@@ -81,7 +83,9 @@ extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
extern const std::string kInsertRequestSubType;
-extern const std::string kInsertHandledRpcs;
+extern const std::string kInsertAppServiceTypes;
+extern const std::string kInsertAppServiceNames;
+extern const std::string kInsertAppServiceHandledRpcs;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
extern const std::string kInsertMessageString;
@@ -103,7 +107,9 @@ extern const std::string kDeleteAppGroup;
extern const std::string kDeleteApplication;
extern const std::string kDeleteRequestType;
extern const std::string kDeleteRequestSubType;
-extern const std::string kDeleteHandledRpcs;
+extern const std::string kDeleteAppServiceTypes;
+extern const std::string kDeleteAppServiceNames;
+extern const std::string kDeleteAppServiceHandledRpcs;
extern const std::string kDeleteDevice;
extern const std::string kIncrementIgnitionCycles;
extern const std::string kResetIgnitionCycles;
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
index ebc307cc8b..0d8e1c7ae9 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
@@ -134,8 +134,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool GatherRequestSubType(
const std::string& app_id,
policy_table::RequestSubTypes* request_subtypes) const;
- bool GatherHandledRpcs(const std::string& app_id,
- policy_table::HandledRpcs* handled_rpcs) const;
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
bool GatherNickName(const std::string& app_id,
policy_table::Strings* nicknames) const;
@@ -174,8 +175,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool SaveRequestSubType(
const std::string& app_id,
const policy_table::RequestSubTypes& request_subtypes);
- bool SaveHandledRpcs(const std::string& app_id,
- const policy_table::HandledRpcs& handled_rpcs);
+ bool SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters);
public:
virtual std::string GetLockScreenIconUrl() const;