From: hyunuktak Date: Wed, 2 May 2018 06:24:25 +0000 (+0900) Subject: Replaced type from status for restriction X-Git-Tag: submit/tizen/20180503.122906~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F177611%2F1;p=platform%2Fcore%2Fapi%2Fsmart-traffic-control.git Replaced type from status for restriction Change-Id: Iba999d492bbb3f55fadebc8a92fad9dfdfdc44c3 Signed-off-by: hyunuktak --- diff --git a/include/stc_internal.h b/include/stc_internal.h index 3923abc..8ac3a9f 100755 --- a/include/stc_internal.h +++ b/include/stc_internal.h @@ -107,17 +107,15 @@ typedef void *stc_restriction_info_h; */ /** - * @brief Enumeration for network restriction status. - * @since_tizen 4.0 + * @brief Enumeration for network restriction type. + * @since_tizen 5.0 */ typedef enum { - STC_RESTRICTION_UNKNOWN, - STC_RESTRICTION_ACTIVATED, /** < restriction has been activated */ - STC_RESTRICTION_REMOVED, /** < restriction has been removed */ - STC_RESTRICTION_EXCLUDED, /** < restriction has been excluded */ - STC_RESTRICTION_BACKGROUND, /** < background restriction has been activated */ - STC_RESTRICTION_LAST_ELEM, -} stc_restriction_status_e; + STC_RSTN_TYPE_UNKNOWN, + STC_RSTN_TYPE_ACCEPT, + STC_RSTN_TYPE_DROP, + STC_RSTN_TYPE_LAST_ELEM, +} stc_restriction_type_e; /** * @} @@ -237,7 +235,7 @@ typedef enum { * @see stc_restriction_info_get_app_id() * @see stc_restriction_info_get_iface_name() * @see stc_restriction_info_get_subscriber_id() - * @see stc_restriction_info_get_status() + * @see stc_restriction_info_get_type() * @see stc_restriction_info_get_iface_type() * @see stc_restriction_info_get_limit() * @see stc_restriction_info_get_warning_limit() @@ -398,7 +396,7 @@ int stc_reset_stats(stc_h stc, stc_reset_rule_h rule); * @see stc_restriction_rule_get_process_state() * @see stc_get_restriction() * @see stc_foreach_restriction() - * @see stc_get_restriction_status() + * @see stc_get_restriction_type() * @see stc_unset_restriction() * @see stc_exclude_restriction() */ @@ -447,7 +445,7 @@ int stc_set_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_set_restriction() * @see stc_get_restriction() * @see stc_foreach_restriction() - * @see stc_get_restriction_status() + * @see stc_get_restriction_type() * @see stc_unset_restriction() */ int stc_exclude_restriction(stc_h stc, stc_restriction_rule_h rule); @@ -495,7 +493,7 @@ int stc_exclude_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_set_restriction() * @see stc_get_restriction() * @see stc_foreach_restriction() - * @see stc_get_restriction_status() + * @see stc_get_restriction_type() * @see stc_exclude_restriction() */ int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule); @@ -545,7 +543,7 @@ int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_restriction_info_cb() * @see stc_set_restriction() * @see stc_foreach_restriction() - * @see stc_get_restriction_status() + * @see stc_get_restriction_type() * @see stc_unset_restriction() * @see stc_exclude_restriction() */ @@ -607,7 +605,7 @@ int stc_unset_warn_threshold_crossed_cb(stc_h stc); * @see stc_restriction_info_cb() * @see stc_set_restriction() * @see stc_get_restriction() - * @see stc_get_restriction_status() + * @see stc_get_restriction_type() * @see stc_unset_restriction() * @see stc_exclude_restriction() */ @@ -615,14 +613,14 @@ int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, stc_restriction_info_cb info_cb, void *user_data); /** - * @brief Gets the restriction status information. + * @brief Gets the restriction type information. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] stc The stc handle * @param[in] rule The restriction rule handle - * @param[out] status The restriction status + * @param[out] type The restriction type * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -636,7 +634,7 @@ int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, * * @see #stc_h * @see #stc_restriction_rule_h - * @see #stc_restriction_status_e + * @see #stc_restriction_type_e * @see stc_initialize() * @see stc_restriction_rule_create() * @see stc_restriction_rule_destroy() @@ -660,8 +658,8 @@ int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, * @see stc_unset_restriction() * @see stc_exclude_restriction() */ -int stc_get_restriction_status(stc_h stc, stc_restriction_rule_h rule, - stc_restriction_status_e *status); +int stc_get_restriction_type(stc_h stc, stc_restriction_rule_h rule, + stc_restriction_type_e *type); /** * @} @@ -1475,13 +1473,13 @@ int stc_restriction_info_get_iface_name(stc_restriction_info_h info, int stc_restriction_info_get_subscriber_id(stc_restriction_info_h info, char **subscriber_id); /** - * @brief Gets the restriction status for restriction information. - * @since_tizen 4.0 + * @brief Gets the restriction type for restriction information. + * @since_tizen 5.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] info The restriction information handle - * @param[out] status The restriction status + * @param[out] type The restriction type * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -1494,11 +1492,12 @@ int stc_restriction_info_get_subscriber_id(stc_restriction_info_h info, char **s * @retval #STC_ERROR_PERMISSION_DENIED Permission denied * * @see #stc_restriction_info_h - * @see #stc_restriction_status_e + * @see #stc_restriction_type_e * @see stc_restriction_info_cb() */ -int stc_restriction_info_get_status(stc_restriction_info_h info, - stc_restriction_status_e *status); +int stc_restriction_info_get_type(stc_restriction_info_h info, + stc_restriction_type_e *type); + /** * @brief Gets the interface type for restriction information. @@ -1937,6 +1936,7 @@ int stc_firewall_chain_foreach(stc_h stc, * @since_tizen 5.0 * @privlevel platform * @privilege %http://tizen.org/privilege/firewall.common + * @remarks You should set only one chain. * * @param[in] chain The firewall chain handle * @param[in] target The target type diff --git a/packaging/capi-network-stc.spec b/packaging/capi-network-stc.spec index 412ef1d..a5db18a 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.25 +Version: 0.0.26 Release: 1 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/include/stc-info.h b/src/include/stc-info.h index b5d4ac9..54cbc5c 100755 --- a/src/include/stc-info.h +++ b/src/include/stc-info.h @@ -68,7 +68,7 @@ extern "C" { #define STC_RESTRICTION_INFO_IFNAME "ifname" #define STC_RESTRICTION_INFO_DATA_LIMIT "data_limit" #define STC_RESTRICTION_INFO_DATA_WARN_LIMIT "data_warn_limit" -#define STC_RESTRICTION_INFO_RST_STATUS "rst_state" +#define STC_RESTRICTION_INFO_RSTN_TYPE "type" #define STC_RESTRICTION_INFO_ROAMING "roaming" #define STC_RESTRICTION_INFO_SUBSCRIBER_ID "subscriber_id" @@ -94,7 +94,7 @@ typedef struct { char iface_name[STC_IFNAME_LEN]; char subscriber_id[STC_SUBSCRIBER_ID_LEN]; stc_iface_type_e iface_type; - stc_restriction_status_e rst_status; + stc_restriction_type_e rstn_type; int64_t data_limit; int64_t data_warn_limit; stc_roaming_type_e roaming_type; diff --git a/src/include/stc-restriction.h b/src/include/stc-restriction.h index 1821b63..e44dbd3 100755 --- a/src/include/stc-restriction.h +++ b/src/include/stc-restriction.h @@ -57,19 +57,19 @@ extern "C" { #define STC_RESTRICTION_RULE_DATA_WARN_LIMIT "data_warn_limit" typedef enum { - STC_RST_TYPE_UNDEF, - STC_RST_TYPE_SET, - STC_RST_TYPE_UNSET, - STC_RST_TYPE_EXCLUDE, - STC_RST_TYPE_MAX_VALUE, -} stc_restriction_type_e; + STC_RSTN_TYPE_UNDEF, + STC_RSTN_TYPE_SET, + STC_RSTN_TYPE_UNSET, + STC_RSTN_TYPE_EXCLUDE, + STC_RSTN_TYPE_MAX_VALUE, +} stc_rstn_type_e; typedef struct { char app_id[STC_APP_ID_LEN]; char iface_name[STC_IFNAME_LEN]; char subscriber_id[STC_SUBSCRIBER_ID_LEN]; stc_iface_type_e iface_type; - stc_restriction_status_e rst_state; + stc_rstn_type_e rstn_type; int64_t data_limit; int64_t data_warn_limit; stc_roaming_type_e roaming_type; @@ -84,17 +84,17 @@ typedef struct { *****************************************************************************/ stc_error_e _stc_restriction_validate_rule( - stc_restriction_rule_h rule, stc_restriction_type_e rst_type); + stc_restriction_rule_h rule, stc_rstn_type_e rstn_type); stc_error_e _stc_restriction_check_get_rule(stc_restriction_rule_h rule); stc_error_e _stc_restriction_check_get_all_rule( stc_restriction_rule_h rule); -stc_error_e _stc_restriction_check_get_status_rule( +stc_error_e _stc_restriction_check_get_type_rule( stc_restriction_rule_h rule); stc_error_e _stc_restriction_set(stc_restriction_rule_h rule); stc_error_e _stc_restriction_exclude(stc_restriction_rule_h rule); stc_error_e _stc_restriction_unset(stc_restriction_rule_h rule); -stc_error_e _stc_restriction_get_status(stc_restriction_rule_h rule, - stc_restriction_status_e *status); +stc_error_e _stc_restriction_get_type(stc_restriction_rule_h rule, + stc_restriction_type_e *type); stc_error_e _stc_restriction_get(stc_restriction_rule_h rule); stc_error_e _stc_restriction_get_all(stc_restriction_rule_h rule); diff --git a/src/internal/include/stc-dbus.h b/src/internal/include/stc-dbus.h index 293badc..ef00fa4 100755 --- a/src/internal/include/stc-dbus.h +++ b/src/internal/include/stc-dbus.h @@ -68,7 +68,7 @@ extern "C" { #define STC_MANAGER_METHOD_STATS_RESET "Reset" #define STC_MANAGER_METHOD_RESTRICTION_SET "Set" -#define STC_MANAGER_METHOD_RESTRICTION_GET_STATUS "GetState" +#define STC_MANAGER_METHOD_RESTRICTION_GET_TYPE "GetType" #define STC_MANAGER_METHOD_RESTRICTION_GET_PER_APP_ID "Get" #define STC_MANAGER_METHOD_RESTRICTION_GET_ALL "GetAll" #define STC_MANAGER_METHOD_RESTRICTION_UNSET "Unset" diff --git a/src/internal/include/stc-private.h b/src/internal/include/stc-private.h index 9ab8b6a..b5b4ca0 100755 --- a/src/internal/include/stc-private.h +++ b/src/internal/include/stc-private.h @@ -97,7 +97,7 @@ const char *_stc_convert_error_type_to_string(stc_error_e err); int _stc_convert_error_string_to_enum(const char *error); const char *_stc_convert_iface_type_to_string(stc_iface_type_e type); const char *_stc_convert_roaming_to_string(stc_roaming_type_e type); -const char *_stc_convert_rst_status_to_string(stc_restriction_status_e state); +const char *_stc_convert_rstn_type_to_string(stc_restriction_type_e type); const char *_stc_convert_protocol_to_string(stc_protocol_type_e type); const char *_stc_convert_process_state_to_string(stc_process_state_e state); const char *_stc_convert_connection_period_to_string( diff --git a/src/internal/stc-private.c b/src/internal/stc-private.c index 0793721..dedcb58 100755 --- a/src/internal/stc-private.c +++ b/src/internal/stc-private.c @@ -157,19 +157,15 @@ const char *_stc_convert_roaming_to_string(stc_roaming_type_e type) } } -const char *_stc_convert_rst_status_to_string(stc_restriction_status_e status) +const char *_stc_convert_rstn_type_to_string(stc_restriction_type_e type) { - switch (status) { - case STC_RESTRICTION_UNKNOWN: - return "Undefined"; - case STC_RESTRICTION_ACTIVATED: - return "Activated"; - case STC_RESTRICTION_REMOVED: - return "Removed"; - case STC_RESTRICTION_EXCLUDED: - return "Excluded"; - case STC_RESTRICTION_BACKGROUND: - return "Background"; + switch (type) { + case STC_RSTN_TYPE_UNKNOWN: + return "Unknown"; + case STC_RSTN_TYPE_ACCEPT: + return "Accept"; + case STC_RSTN_TYPE_DROP: + return "Drop"; default: return "Unknown"; } diff --git a/src/stc-info.c b/src/stc-info.c index e079757..26c5bda 100755 --- a/src/stc-info.c +++ b/src/stc-info.c @@ -321,8 +321,8 @@ EXPORT_API int stc_restriction_info_get_subscriber_id(stc_restriction_info_h inf return STC_ERROR_NONE; } -EXPORT_API int stc_restriction_info_get_status(stc_restriction_info_h info, - stc_restriction_status_e *status) +EXPORT_API int stc_restriction_info_get_type(stc_restriction_info_h info, + stc_restriction_type_e *type) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); @@ -334,10 +334,10 @@ EXPORT_API int stc_restriction_info_get_status(stc_restriction_info_h info, stc_restriction_info_s *restriction_info = (stc_restriction_info_s *)info; - *status = restriction_info->rst_status; + *type = restriction_info->rstn_type; - STC_LOGI("Status [%s]", - _stc_convert_rst_status_to_string(*status)); + STC_LOGI("Type [%s]", + _stc_convert_rstn_type_to_string(*type)); return STC_ERROR_NONE; } diff --git a/src/stc-manager.c b/src/stc-manager.c index 75a03b5..c7a0564 100755 --- a/src/stc-manager.c +++ b/src/stc-manager.c @@ -258,7 +258,7 @@ EXPORT_API int stc_set_restriction(stc_h stc, return STC_ERROR_INVALID_PARAMETER; } - ret = _stc_restriction_validate_rule(rule, STC_RST_TYPE_SET); + ret = _stc_restriction_validate_rule(rule, STC_RSTN_TYPE_SET); if (ret != STC_ERROR_NONE) { STC_LOGE("Invalid restriction rule [%s]", _stc_convert_error_type_to_string(ret)); @@ -286,7 +286,7 @@ EXPORT_API int stc_exclude_restriction(stc_h stc, stc_restriction_rule_h rule) return STC_ERROR_INVALID_PARAMETER; } - ret = _stc_restriction_validate_rule(rule, STC_RST_TYPE_EXCLUDE); + ret = _stc_restriction_validate_rule(rule, STC_RSTN_TYPE_EXCLUDE); if (ret != STC_ERROR_NONE) { STC_LOGE("Invalid restriction rule [%s]", _stc_convert_error_type_to_string(ret)); @@ -314,7 +314,7 @@ EXPORT_API int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule) return STC_ERROR_INVALID_PARAMETER; } - ret = _stc_restriction_validate_rule(rule, STC_RST_TYPE_UNSET); + ret = _stc_restriction_validate_rule(rule, STC_RSTN_TYPE_UNSET); if (ret != STC_ERROR_NONE) { STC_LOGE("Invalid restriction rule [%s]", _stc_convert_error_type_to_string(ret)); @@ -473,8 +473,8 @@ EXPORT_API int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, return STC_ERROR_NONE; } -EXPORT_API int stc_get_restriction_status(stc_h stc, stc_restriction_rule_h rule, - stc_restriction_status_e *status) +EXPORT_API int stc_get_restriction_type(stc_h stc, stc_restriction_rule_h rule, + stc_restriction_type_e *type) { int ret = STC_ERROR_NONE; @@ -485,21 +485,21 @@ EXPORT_API int stc_get_restriction_status(stc_h stc, stc_restriction_rule_h rule return STC_ERROR_INVALID_PARAMETER; } - ret = _stc_restriction_check_get_status_rule(rule); + ret = _stc_restriction_check_get_type_rule(rule); if (ret != STC_ERROR_NONE) { STC_LOGE("Invalid restriction rule [%s]", _stc_convert_error_type_to_string(ret)); return ret; } - ret = _stc_restriction_get_status(rule, status); + ret = _stc_restriction_get_type(rule, type); if (ret != STC_ERROR_NONE) { - STC_LOGE("Failed to get restriction status [%s]", + STC_LOGE("Failed to get restriction type [%s]", _stc_convert_error_type_to_string(ret)); return ret; } - STC_LOGI("Get restriction status"); + STC_LOGI("Get restriction type"); return STC_ERROR_NONE; } diff --git a/src/stc-restriction.c b/src/stc-restriction.c index 45c4c1d..1c77a85 100755 --- a/src/stc-restriction.c +++ b/src/stc-restriction.c @@ -68,7 +68,7 @@ static void __stc_restriction_init_rule(stc_restriction_rule_s *rule) rule->app_id[0] = '\0'; rule->iface_name[0] = '\0'; rule->iface_type = STC_IFACE_ALL; - rule->rst_state = STC_RESTRICTION_REMOVED; + rule->rstn_type = STC_RSTN_TYPE_UNKNOWN; rule->data_limit = 0; rule->data_warn_limit = 0; rule->roaming_type = STC_ROAMING_DISABLED; @@ -129,7 +129,7 @@ static void __stc_restriction_get_make_params( *params = g_variant_new("(s)", restriction_rule->app_id); } -static void __stc_restriction_get_status_make_params( +static void __stc_restriction_get_type_make_params( stc_restriction_rule_h rule, GVariant **params) { @@ -167,9 +167,9 @@ static void __stc_restriction_extract_info_cb(const char *key, restriction_info->iface_type = (stc_iface_type_e)g_variant_get_uint16(value); - } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_RST_STATUS)) { - restriction_info->rst_status = - (stc_restriction_status_e)g_variant_get_uint16(value); + } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_RSTN_TYPE)) { + restriction_info->rstn_type = + (stc_restriction_type_e)g_variant_get_uint16(value); } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_DATA_LIMIT)) { restriction_info->data_limit = g_variant_get_int64(value); @@ -202,8 +202,8 @@ static void __stc_restriction_print_info( if (info->roaming_type != STC_ROAMING_UNKNOWN) STC_LOGD("Roaming: [%s]", _stc_convert_roaming_to_string(info->roaming_type)); - if (info->rst_status != STC_RESTRICTION_UNKNOWN) - STC_LOGD("Status: [%s]", _stc_convert_rst_status_to_string(info->rst_status)); + if (info->rstn_type != STC_RSTN_TYPE_UNKNOWN) + STC_LOGD("Type: [%s]", _stc_convert_rstn_type_to_string(info->rstn_type)); STC_LOGD("Limit: [%lld] bytes", info->data_limit); STC_LOGD("Warning: [%lld] bytes", info->data_warn_limit); @@ -403,7 +403,7 @@ stc_error_e __stc_restriction_get_all( } stc_error_e _stc_restriction_validate_rule( - stc_restriction_rule_h rule, stc_restriction_type_e rst_type) + stc_restriction_rule_h rule, stc_rstn_type_e rstn_type) { stc_restriction_rule_s *restriction_rule = rule; @@ -412,8 +412,8 @@ stc_error_e _stc_restriction_validate_rule( STC_ERROR_INVALID_PARAMETER, "Restriction rule should be set"); - STC_RETURN_VAL_IF(rst_type <= STC_RST_TYPE_UNDEF || - rst_type >= STC_RST_TYPE_MAX_VALUE, + STC_RETURN_VAL_IF(rstn_type <= STC_RSTN_TYPE_UNDEF || + rstn_type >= STC_RSTN_TYPE_MAX_VALUE, STC_ERROR_INVALID_PARAMETER, "Invalid restriction type"); @@ -427,7 +427,7 @@ stc_error_e _stc_restriction_validate_rule( "Invalid restriction network interface type [%s]", _stc_convert_iface_type_to_string(restriction_rule->iface_type)); - if (rst_type == STC_RST_TYPE_SET) { + if (rstn_type == STC_RSTN_TYPE_SET) { STC_RETURN_VAL_IF(restriction_rule->data_limit < 0, STC_ERROR_INVALID_PARAMETER, "Invalid tx limit [%lld] bytes", @@ -530,7 +530,7 @@ stc_error_e _stc_restriction_check_get_all_rule( return STC_ERROR_NONE; } -stc_error_e _stc_restriction_check_get_status_rule( +stc_error_e _stc_restriction_check_get_type_rule( stc_restriction_rule_h rule) { stc_restriction_rule_s *restriction_rule = rule; @@ -740,31 +740,31 @@ stc_error_e _stc_restriction_get_all( return __stc_restriction_get_all(rule); } -stc_error_e _stc_restriction_get_status( +stc_error_e _stc_restriction_get_type( stc_restriction_rule_h rule, - stc_restriction_status_e *status) + stc_restriction_type_e *type) { GVariant *message = NULL; GVariant *params = NULL; stc_error_e error = STC_ERROR_NONE; int result = 0; - __stc_restriction_get_status_make_params(rule, ¶ms); + __stc_restriction_get_type_make_params(rule, ¶ms); message = _stc_dbus_invoke_method( STC_MANAGER_SERVICE, STC_MANAGER_RESTRICTION_PATH, STC_MANAGER_RESTRICTION_INTERFACE, - STC_MANAGER_METHOD_RESTRICTION_GET_STATUS, + STC_MANAGER_METHOD_RESTRICTION_GET_TYPE, params, &error); STC_RETURN_VAL_IF(message == NULL, error, "Failed to invoke dbus method"); - g_variant_get(message, "(ii)", &result, status); - STC_LOGI("Successfully get restriction status [%s]", - _stc_convert_rst_status_to_string(*status)); + g_variant_get(message, "(ii)", &result, type); + STC_LOGI("Successfully get restriction type [%s]", + _stc_convert_rstn_type_to_string(*type)); g_variant_unref(message); return STC_ERROR_NONE; diff --git a/test/restriction.c b/test/restriction.c index 1cb93f1..2f3e4b5 100755 --- a/test/restriction.c +++ b/test/restriction.c @@ -66,7 +66,7 @@ static stc_callback_ret_e __test_stc_restriction_info_cb( char *app_id = NULL; char *iface_name = NULL; char *subscriber_id = NULL; - stc_restriction_status_e rst_status; + stc_restriction_type_e rstn_type; stc_iface_type_e iface_type; int64_t data_limit; int64_t data_warn_limit; @@ -86,9 +86,9 @@ static stc_callback_ret_e __test_stc_restriction_info_cb( if (ret == STC_ERROR_NONE) msg("Sub_id: [%s]", subscriber_id); - ret = stc_restriction_info_get_status(info, &rst_status); + ret = stc_restriction_info_get_type(info, &rstn_type); if (ret == STC_ERROR_NONE) - msg("Status: [%s]", test_stc_convert_rst_status_to_string(rst_status)); + msg("Type: [%s]", test_stc_convert_rstn_type_to_string(rstn_type)); ret = stc_restriction_info_get_iface_type(info, &iface_type); if (ret == STC_ERROR_NONE) @@ -328,19 +328,19 @@ static int __test_stc_restriction_get_all(MManager *mm, struct menu_data *menu) return ret; } -static int __test_stc_restriction_get_status(MManager *mm, struct menu_data *menu) +static int __test_stc_restriction_get_type(MManager *mm, struct menu_data *menu) { int ret = STC_ERROR_NONE; - stc_restriction_status_e rst_status; + stc_restriction_type_e rstn_type; - ret = stc_get_restriction_status(g_stc, g_restriction_rule, &rst_status); + ret = stc_get_restriction_type(g_stc, g_restriction_rule, &rstn_type); if (ret == STC_ERROR_NONE) { - msg("Restriction status " LOG_CYAN "[%s]" LOG_END, - test_stc_convert_rst_status_to_string(rst_status)); - msg(LOG_GREEN "Success to get restriction status" LOG_END); + msg("Restriction type " LOG_CYAN "[%s]" LOG_END, + test_stc_convert_rstn_type_to_string(rstn_type)); + msg(LOG_GREEN "Success to get restriction type" LOG_END); } else - msg("Fail to get restriction status " LOG_RED "[%s]" LOG_END, + msg("Fail to get restriction type " LOG_RED "[%s]" LOG_END, test_stc_convert_error_type_to_string(ret)); return ret; @@ -467,7 +467,7 @@ struct menu_data menu_restriction[] = { { "1", LOG_LIGHTMAGENTA "[Set]" LOG_END " restriction rule", menu_restriction_rule, NULL, NULL}, { "2", LOG_LIGHTBLUE "[Get]" LOG_END " restriction", NULL, __test_stc_restriction_get, NULL}, { "3", LOG_LIGHTBLUE "[Get]" LOG_END " all restrictions", NULL, __test_stc_restriction_get_all, NULL}, - { "4", LOG_LIGHTBLUE "[Get]" LOG_END " restriction status", NULL, __test_stc_restriction_get_status, NULL}, + { "4", LOG_LIGHTBLUE "[Get]" LOG_END " restriction type", NULL, __test_stc_restriction_get_type, NULL}, { "5", LOG_LIGHTMAGENTA "[Set]" LOG_END " restriction", NULL, __test_stc_restriction_set, NULL}, { "6", LOG_LIGHTMAGENTA "[Remove]" LOG_END " restriction", NULL, __test_stc_restriction_unset, NULL}, { "7", LOG_LIGHTMAGENTA "[Exlcude]" LOG_END " restriction", NULL, __test_stc_restriction_exclude, NULL}, diff --git a/test/stc_test.c b/test/stc_test.c index 7e1c3ad..420215e 100755 --- a/test/stc_test.c +++ b/test/stc_test.c @@ -120,19 +120,15 @@ const char *test_stc_convert_roaming_to_string(stc_roaming_type_e type) } } -const char *test_stc_convert_rst_status_to_string(stc_restriction_status_e status) +const char *test_stc_convert_rstn_type_to_string(stc_restriction_type_e type) { - switch (status) { - case STC_RESTRICTION_UNKNOWN: + switch (type) { + case STC_RSTN_TYPE_UNKNOWN: return "Undefined"; - case STC_RESTRICTION_ACTIVATED: - return "Activated"; - case STC_RESTRICTION_REMOVED: - return "Removed"; - case STC_RESTRICTION_EXCLUDED: - return "Excluded"; - case STC_RESTRICTION_BACKGROUND: - return "Background"; + case STC_RSTN_TYPE_ACCEPT: + return "Accept"; + case STC_RSTN_TYPE_DROP: + return "Drop"; default: return "Unknown"; } diff --git a/test/stc_test.h b/test/stc_test.h index 462b2f2..beabe3f 100755 --- a/test/stc_test.h +++ b/test/stc_test.h @@ -40,7 +40,7 @@ const char *test_stc_convert_error_type_to_string(stc_error_e err); const char *test_stc_convert_iface_type_to_string(stc_iface_type_e type); const char *test_stc_convert_roaming_to_string(stc_roaming_type_e type); -const char *test_stc_convert_rst_status_to_string(stc_restriction_status_e status); +const char *test_stc_convert_rstn_type_to_string(stc_restriction_type_e type); const char *test_stc_convert_protocol_to_string(stc_protocol_type_e type); const char *test_stc_convert_process_state_to_string(stc_process_state_e state); const char *test_stc_convert_time_period_to_string(stc_time_period_e time);