Replaced type from status for restriction 11/177611/1
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 06:24:25 +0000 (15:24 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 06:24:28 +0000 (15:24 +0900)
Change-Id: Iba999d492bbb3f55fadebc8a92fad9dfdfdc44c3
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
13 files changed:
include/stc_internal.h
packaging/capi-network-stc.spec
src/include/stc-info.h
src/include/stc-restriction.h
src/internal/include/stc-dbus.h
src/internal/include/stc-private.h
src/internal/stc-private.c
src/stc-info.c
src/stc-manager.c
src/stc-restriction.c
test/restriction.c
test/stc_test.c
test/stc_test.h

index 3923abc73be61d86a013a550ce383559be29fbad..8ac3a9ffcf10e384ccdf4bfae4c4fee5acdd89bd 100755 (executable)
@@ -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
index 412ef1db976a98d7c64c1d1c1b9580b3ca2b43cc..a5db18af387be74fa77a05a4230621bcb05e4c04 100755 (executable)
@@ -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
index b5d4ac9cea66db1abbbcb14a296efaca7edd7d0b..54cbc5c2053083010e09aa63a31be29dc3aecb28 100755 (executable)
@@ -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;
index 1821b635854e9ddda50a7fb7cb7a0fcb9e38fa4a..e44dbd3ed311678e9cb2336484ff5e22b9afb729 100755 (executable)
@@ -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);
 
index 293badc0ffae61e6f9abda653c5d8e79c79b30d1..ef00fa41ac7bfa1b60dc1b28bb5a699a2e89b2b5 100755 (executable)
@@ -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"
index 9ab8b6afa7216c5057beb21982b5a7348be6510b..b5b4ca0bc2b52577061734aacf5a9fe109f457f1 100755 (executable)
@@ -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(
index 079372179bafb6b57f2d1040defee91dbb83d3be..dedcb5813d4c63a13d646a1ab88e7fa29ef3e451 100755 (executable)
@@ -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";
        }
index e0797575575b8d327d3d4ec048a87d602b74eea6..26c5bda9fdbd75667fae2431d2471f8c666fbe79 100755 (executable)
@@ -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;
 }
index 75a03b5f3e1bb64a8b40e5094cbb4c2785914cdf..c7a056404fd8742bfc7749841fffa0a548ce4763 100755 (executable)
@@ -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;
 }
index 45c4c1d3785f416eea0b5c1c35efc576ca523ccf..1c77a858576ff937df40266e8fea593b0bc4476a 100755 (executable)
@@ -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, &params);
+       __stc_restriction_get_type_make_params(rule, &params);
 
        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;
index 1cb93f1f327ca8ffa70fb5b527d162e3fea121d0..2f3e4b5f1db1911b03c9e34b6d984d1f43e1f0fc 100755 (executable)
@@ -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},
index 7e1c3ad5867a26b5fda93d21492ebda515042e89..420215e4f2d5fa22c30bdb970899152752750eb8 100755 (executable)
@@ -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";
        }
index 462b2f2ffd1ded2316de541b3d7b10f746cd3e98..beabe3f51163c4d7613ca7734d17a5f89dac063f 100755 (executable)
@@ -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);