Removed exclude restriction method 26/177626/1 submit/tizen/20180503.122906
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 08:05:10 +0000 (17:05 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 08:05:10 +0000 (17:05 +0900)
Change-Id: Id61aa10111a725ce19197896a982496c4ad0f75e

include/stc-restriction.h
interfaces/stcmanager-iface-restriction.xml
packaging/stc-manager.spec
src/stc-manager-gdbus.c
src/stc-restriction.c

index 9fcc7e3..9f5560a 100755 (executable)
@@ -47,11 +47,6 @@ gboolean handle_restriction_set(StcRestriction *object,
                                GVariant *parameters,
                                void *user_data);
 
-gboolean handle_restriction_exclude(StcRestriction *object,
-                                   GDBusMethodInvocation *invocation,
-                                   GVariant *parameters,
-                                   void *user_data);
-
 gboolean handle_restriction_unset(StcRestriction *object,
                                   GDBusMethodInvocation *invocation,
                                   GVariant *parameters,
index 3ecc542..1fbfc3f 100644 (file)
@@ -5,11 +5,6 @@
                        <arg type='i' name='error_code' direction='out'/>
                </method>
 
-               <method name='Exclude'>
-                       <arg type='a{sv}' name='parameters' direction='in'/>
-                       <arg type='i' name='error_code' direction='out'/>
-               </method>
-
                <method name='Get'>
                        <arg type='s' name='app_id' direction='in'/>
                        <arg type='i' name='error_code' direction='out'/>
index afafa95..65d6175 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.58
+Version:    0.0.59
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 3170c42..a31deb0 100755 (executable)
@@ -125,9 +125,6 @@ static gboolean __stc_manager_gdbus_restriction_init(stc_s *stc)
        g_signal_connect(restriction, "handle-set",
                         G_CALLBACK(handle_restriction_set), stc);
 
-       g_signal_connect(restriction, "handle-exclude",
-                        G_CALLBACK(handle_restriction_exclude), stc);
-
        g_signal_connect(restriction, "handle-get",
                         G_CALLBACK(handle_restriction_get), stc);
 
index 05d7544..242cdcb 100755 (executable)
@@ -52,8 +52,7 @@ void __initialize_rstn_rule(table_restrictions_info *rule)
        rule->subscriber_id = NULL;
 }
 
-gboolean __validate_rstn_rule(table_restrictions_info *rule,
-                             enum traffic_restriction_type rstn_type)
+gboolean __validate_rstn_rule(table_restrictions_info *rule)
 {
        __STC_LOG_FUNC_ENTER__;
 
@@ -62,11 +61,6 @@ gboolean __validate_rstn_rule(table_restrictions_info *rule,
                return FALSE; //LCOV_EXCL_LINE
        }
 
-       if (rstn_type <= RST_UNDEFINDED || rstn_type >= RST_MAX_VALUE) {
-               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
-               return FALSE; //LCOV_EXCL_LINE
-       }
-
        if (rule->iftype <= STC_IFACE_UNKNOWN ||
            rule->iftype >= STC_IFACE_LAST_ELEM) {
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
@@ -214,6 +208,10 @@ static void __stc_extract_restriction_rule(const char *key, GVariant *value,
                rule->subscriber_id = g_strdup(str);
                STC_LOGD("subscriber_id: [%s]", rule->subscriber_id);
 
+       } else if (!g_strcmp0(key, "type")) {
+               rule->rstn_type = g_variant_get_uint16(value);
+               STC_LOGD("type: [%u]", (unsigned int) rule->rstn_type);
+
        } else {
                STC_LOGD("Unknown select rule"); //LCOV_EXCL_LINE
        }
@@ -241,47 +239,7 @@ gboolean handle_restriction_set(StcRestriction *object,
                g_variant_iter_free(iter);
        }
 
-       rule.rstn_type = STC_RSTN_TYPE_DROP;
-
-       if (__validate_rstn_rule(&rule, RST_SET) == FALSE) {
-               STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
-                                                STC_ERROR_INVALID_PARAMETER);
-               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
-               return TRUE;
-       }
-
-       table_restrictions_update(&rule);
-       /* update restriction rule in runtime structure */
-       stc_monitor_rstns_tree_add(&rule);
-
-       STC_DBUS_REPLY_ERROR_NONE(invocation);
-       __STC_LOG_FUNC_EXIT__;
-       return TRUE;
-}
-
-gboolean handle_restriction_exclude(StcRestriction *object,
-                                   GDBusMethodInvocation *invocation,
-                                   GVariant *parameters,
-                                   void *user_data)
-{
-       __STC_LOG_FUNC_ENTER__;
-       GVariantIter *iter = NULL;
-       table_restrictions_info rule;
-
-       memset(&rule, 0, sizeof(table_restrictions_info));
-       __initialize_rstn_rule(&rule);
-
-       g_variant_get(parameters, "a{sv}", &iter);
-       if (iter != NULL) {
-               stc_manager_gdbus_dict_foreach(iter,
-                                              __stc_extract_restriction_rule,
-                                              &rule);
-               g_variant_iter_free(iter);
-       }
-
-       rule.rstn_type = STC_RSTN_TYPE_ACCEPT;
-
-       if (__validate_rstn_rule(&rule, RST_EXCLUDE) == FALSE) {
+       if (__validate_rstn_rule(&rule) == FALSE) {
                STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
                                                 STC_ERROR_INVALID_PARAMETER);
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
@@ -317,7 +275,7 @@ gboolean handle_restriction_unset(StcRestriction *object,
                g_variant_iter_free(iter);
        }
 
-       if (__validate_rstn_rule(&rule, RST_UNSET) == FALSE) {
+       if (__validate_rstn_rule(&rule) == FALSE) {
                STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
                                                 STC_ERROR_INVALID_PARAMETER);
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE