From: hyunuktak Date: Thu, 10 Jan 2019 08:18:58 +0000 (+0900) Subject: Add some APIs for restriction list to header X-Git-Tag: submit/tizen/20190211.132033~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9ae35ba7fb0821212a10365f152fccecd242941;p=platform%2Fcore%2Fapi%2Fsmart-traffic-control.git Add some APIs for restriction list to header stc_restriction_list_create stc_restriction_list_destroy stc_add_restriction_to_list stc_remove_restriction_from_list stc_get_restriction_from_list stc_foreach_restriction_list stc_set_restriction_list stc_unset_restriction_list Change-Id: I29f849f2e7bad92353d281fb768cf83f8f6c0cd6 Signed-off-by: hyunuktak --- diff --git a/include/stc_mgr_internal.h b/include/stc_mgr_internal.h index 618d1a2..b7056a2 100755 --- a/include/stc_mgr_internal.h +++ b/include/stc_mgr_internal.h @@ -88,6 +88,9 @@ extern "C" { typedef stc_callback_ret_e (*stc_restriction_rule_cb)(stc_error_e result, stc_restriction_rule_h rule, void *user_data); +typedef stc_callback_ret_e (*stc_restriction_list_cb)(stc_error_e result, + stc_restriction_list_h list, void *user_data); + typedef void (*stc_threshold_crossed_cb)(stc_restriction_rule_h rule, void *user_data); @@ -394,6 +397,297 @@ int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, int stc_get_restriction_type(stc_h stc, stc_restriction_rule_h rule, stc_restriction_type_e *type); +/** + * @brief Adds the restriction to list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list The restriction list handle + * @param[in] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_get_restriction_from_list() + * @see stc_foreach_restriction_list() + * @see stc_remove_restriction_from_list() + * @see stc_set_restriction_list() + * @see stc_unset_restriction_list() + */ +int stc_add_restriction_to_list(stc_h stc, stc_restriction_list_h list, + stc_restriction_rule_h rule); + +/** + * @brief Removes the restriction from list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list The restriction list handle + * @param[in] rule The restriction rule handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_get_restriction_from_list() + * @see stc_foreach_restriction_list() + * @see stc_add_restriction_to_list() + * @see stc_set_restriction_list() + * @see stc_unset_restriction_list() + */ +int stc_remove_restriction_from_list(stc_h stc, stc_restriction_list_h list, + stc_restriction_rule_h rule); + +/** + * @brief Gets the restriction from list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list The restriction list handle + * @param[in] rule_cb The callback is called for each application + * that applied restriction in interface specified + * @param[in] user_data User data will be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_add_restriction_to_list() + * @see stc_foreach_restriction_list() + * @see stc_remove_restriction_from_list() + * @see stc_set_restriction_list() + * @see stc_unset_restriction_list() + */ +int stc_get_restriction_from_list(stc_h stc, stc_restriction_list_h list, + stc_restriction_rule_cb rule_cb, void *user_data); + +/** + * @brief Gets the restriction list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list_cb The callback is called for each restriction list + * @param[in] user_data User data will be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_get_restriction_list() + * @see stc_add_restriction_to_list() + * @see stc_remove_restriction_from_list() + * @see stc_set_restriction_list() + * @see stc_unset_restriction_list() + */ +int stc_foreach_restriction_list(stc_h stc, stc_restriction_list_cb list_cb, void *user_data); + +/** + * @brief Sets the restriction list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list The restriction list handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_get_restriction_list() + * @see stc_add_restriction_to_list() + * @see stc_remove_restriction_from_list() + * @see stc_foreach_restriction_list() + * @see stc_unset_restriction_list() + */ +int stc_set_restriction_list(stc_h stc, stc_restriction_list_h list); + +/** + * @brief Unsets the restriction list. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] stc The stc handle + * @param[in] list The restriction list handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see #stc_restriction_rule_h + * @see stc_initialize() + * @see stc_restriction_rule_create() + * @see stc_restriction_rule_destroy() + * @see stc_restriction_rule_set_app_id() + * @see stc_restriction_rule_set_iface_name() + * @see stc_restriction_rule_set_iface_type() + * @see stc_restriction_rule_set_limit() + * @see stc_restriction_rule_set_warning_limit() + * @see stc_restriction_rule_set_roaming_type() + * @see stc_restriction_rule_set_subscriber_id() + * @see stc_restriction_rule_get_app_id() + * @see stc_restriction_rule_get_iface_type() + * @see stc_restriction_rule_get_limit() + * @see stc_restriction_rule_get_warning_limit() + * @see stc_restriction_rule_get_roaming_type() + * @see stc_restriction_rule_get_subscriber_id() + * @see stc_restriction_rule_get_process_state() + * @see stc_restriction_list_create() + * @see stc_get_restriction_list() + * @see stc_add_restriction_to_list() + * @see stc_remove_restriction_from_list() + * @see stc_foreach_restriction_list() + * @see stc_set_restriction_list() + */ +int stc_unset_restriction_list(stc_h stc, stc_restriction_list_h list); + /** * @} */ diff --git a/include/stc_rstn_internal.h b/include/stc_rstn_internal.h index 23fee23..76dff65 100755 --- a/include/stc_rstn_internal.h +++ b/include/stc_rstn_internal.h @@ -50,6 +50,12 @@ extern "C" { */ typedef void *stc_restriction_rule_h; +/** + * @brief The restriction list handle. + * @since_tizen 4.0 + */ +typedef void *stc_restriction_list_h; + /** * @} */ @@ -794,6 +800,56 @@ int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule, */ int stc_restriction_rule_get_subscriber_id(stc_restriction_rule_h rule, char **subscriber_id); +/** + * @brief Creates the restriction list handle. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a handle using stc_restriction_list_destroy(). + * + * @param[in] stc The stc handle + * @param[out] list The restriction list handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_h + * @see #stc_restriction_list_h + * @see stc_initialize() + * @see stc_restriction_list_destroy() + */ +int stc_restriction_list_create(stc_h stc, stc_restriction_list_h *list); + +/** + * @brief Destroys the restriction list handle. + * @since_tizen 5.5 + * @privlevel platform + * @privilege %http://tizen.org/privilege/network.get + * + * @param[in] list The restriction list handle + * + * @return 0 on success, otherwise a negative error value + * @retval #STC_ERROR_NONE Successful + * @retval #STC_ERROR_OPERATION_FAILED General error + * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory + * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STC_ERROR_INVALID_OPERATION Invalid operation + * @retval #STC_ERROR_NOT_INITIALIZED Not initialized + * @retval #STC_ERROR_NOT_SUPPORTED Not supported + * @retval #STC_ERROR_PERMISSION_DENIED Permission denied + * + * @see #stc_restriction_list_h + * @see stc_restriction_list_create() + */ +int stc_restriction_list_destroy(stc_restriction_list_h list); + /** * @} */ diff --git a/packaging/capi-network-stc.spec b/packaging/capi-network-stc.spec index 5f369af..3eb99e4 100755 --- a/packaging/capi-network-stc.spec +++ b/packaging/capi-network-stc.spec @@ -1,6 +1,6 @@ Name: capi-network-stc Summary: A Smart Traffic Control (STC) libraries in Native API -Version: 0.0.35 +Version: 0.0.36 Release: 1 Group: Network & Connectivity/API License: Apache-2.0