summaryrefslogtreecommitdiff
path: root/src/components/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/include')
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h20
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h20
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_types.h20
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h4
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h4
5 files changed, 68 insertions, 0 deletions
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 7d5bbb5e52..6028a1674e 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -481,6 +481,26 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const PolicySettings& get_settings() const = 0;
+ /**
+ * @brief Finds the next URL that must be sent on OnSystemRequest retry
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of policy application id and application url id from the
+ * urls vector
+ */
+ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
+
+ /**
+ * @brief Checks if there is existing URL in the EndpointUrls vector with
+ * index saved in the policy manager and if not, it moves to the next
+ * application index
+ * @param rs contains the application index and url index from the
+ * urls vector that are to be sent on the next OnSystemRequest
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of application index and url index
+ */
+ virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
+ const EndpointUrls& urls) const = 0;
+
protected:
/**
* Checks is PT exceeded IgnitionCycles
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index 0bd72faaae..fcdf48e8cf 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -457,6 +457,26 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const PolicySettings& get_settings() const = 0;
+ /**
+ * @brief Finds the next URL that must be sent on OnSystemRequest retry
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of policy application id and application url id from the
+ * urls vector
+ */
+ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
+
+ /**
+ * @brief Checks if there is existing URL in the EndpointUrls vector with
+ * index saved in the policy manager and if not, it moves to the next
+ * application index
+ * @param rs contains the application index and url index from the
+ * urls vector that are to be sent on the next OnSystemRequest
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of application index and url index
+ */
+ virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
+ const EndpointUrls& urls) const = 0;
+
protected:
/**
* Checks is PT exceeded IgnitionCycles
diff --git a/src/components/include/policy/policy_regular/policy/policy_types.h b/src/components/include/policy/policy_regular/policy/policy_types.h
index b3843f8889..dbd910d62d 100644
--- a/src/components/include/policy/policy_regular/policy/policy_types.h
+++ b/src/components/include/policy/policy_regular/policy/policy_types.h
@@ -313,6 +313,26 @@ struct MetaInfo {
std::string language;
};
+/**
+ * @brief The index of the application, the index of its URL
+ * and the policy application id from the Endpoints vector
+ * that will be sent on the next OnSystemRequest retry sequence
+ */
+struct RetrySequenceURL {
+ uint32_t app_idx_;
+ uint32_t url_idx_;
+ std::string policy_app_id_;
+ RetrySequenceURL(uint32_t app, uint32_t url, const std::string& app_id)
+ : app_idx_(app), url_idx_(url), policy_app_id_(app_id) {}
+ RetrySequenceURL() : app_idx_(0), url_idx_(0) {}
+};
+
+/**
+ * @brief Index of the application, index of its URL
+ * from the Endpoints vector
+ */
+typedef std::pair<uint32_t, uint32_t> AppIdURL;
+
} // namespace policy
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_TYPES_H_
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 0140efddf5..30c1496495 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -182,6 +182,10 @@ class MockPolicyManager : public PolicyManager {
int32_t timespan_seconds));
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
+ MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
+ MOCK_CONST_METHOD2(RetrySequenceUrl,
+ AppIdURL(const struct RetrySequenceURL&,
+ const EndpointUrls& urls));
};
} // namespace policy_manager_test
} // namespace components
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 638f33399c..16e647dfba 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -184,6 +184,10 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
+ MOCK_CONST_METHOD2(RetrySequenceUrl,
+ AppIdURL(const struct RetrySequenceURL&,
+ const EndpointUrls& urls));
};
} // namespace policy_manager_test