Replaced type from state for restriction 12/177612/1
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 06:28:54 +0000 (15:28 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 2 May 2018 06:28:59 +0000 (15:28 +0900)
Change-Id: Ib2575dc03a4447a4dd1878625580f353b474c927
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
14 files changed:
data/traffic_db.sql
include/stc-manager.h
include/stc-restriction.h
interfaces/stcmanager-iface-firewall.xml
interfaces/stcmanager-iface-restriction.xml
packaging/stc-manager.spec
plugin/appstatus/stc-plugin-appstatus.c
src/database/include/table-restrictions.h
src/database/tables/table-restrictions.c
src/helper/helper-nfacct-rule.h
src/monitor/include/stc-monitor.h
src/monitor/stc-monitor.c
src/stc-manager-gdbus.c
src/stc-restriction.c

index c305dbd..1444598 100644 (file)
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS restrictions (
   binpath TEXT,
   iftype INT,
   ifname TEXT,
-  rst_type INT,
+  rstn_type INT,
   roaming INT,
   subscriber_id TEXT NOT NULL,
   data_limit BIGINT,
index e084037..f3cee74 100755 (executable)
@@ -131,19 +131,19 @@ typedef enum {
  * @brief Network restriction states
  */
 typedef enum {
-       STC_RESTRICTION_UNKNOWN,
-       STC_RESTRICTION_ACTIVATED,  /**< restriction has been activated */
-       STC_RESTRICTION_DEACTIVATED,  /**< restriction has been deactivated */
-       STC_RESTRICTION_LAST_ELEM
-} stc_restriction_state_e;
+       STC_RSTN_STATE_UNKNOWN,
+       STC_RSTN_STATE_ACTIVATED,
+       STC_RSTN_STATE_DEACTIVATED,
+       STC_RSTN_STATE_LAST_ELEM
+} stc_rstn_state_e;
 
 /**
  * @brief Network restriction types
  */
 typedef enum {
        STC_RSTN_TYPE_UNKNOWN,
-       STC_RSTN_TYPE_EXCLUDED,  /**< exclusion */
-       STC_RSTN_TYPE_BLOCKED,    /**< block */
+       STC_RSTN_TYPE_ACCEPT,
+       STC_RSTN_TYPE_DROP,
        STC_RSTN_TYPE_LAST_ELEM
 } stc_rstn_type_e;
 
index e804e0f..9fcc7e3 100755 (executable)
@@ -52,6 +52,11 @@ gboolean handle_restriction_exclude(StcRestriction *object,
                                    GVariant *parameters,
                                    void *user_data);
 
+gboolean handle_restriction_unset(StcRestriction *object,
+                                  GDBusMethodInvocation *invocation,
+                                  GVariant *parameters,
+                                  void *user_data);
+
 gboolean handle_restriction_get(StcRestriction *object,
                                GDBusMethodInvocation *invocation,
                                const gchar *app_id,
@@ -61,15 +66,10 @@ gboolean handle_restriction_get_all(StcRestriction *object,
                                    GDBusMethodInvocation *invocation,
                                    void *user_data);
 
-gboolean handle_restriction_get_state(StcRestriction *object,
+gboolean handle_restriction_get_type(StcRestriction *object,
                                      GDBusMethodInvocation *invocation,
                                      const gchar *app_id,
                                      int iftype,
                                      void *user_data);
 
-gboolean handle_restriction_unset(StcRestriction *object,
-                                  GDBusMethodInvocation *invocation,
-                                  GVariant *parameters,
-                                  void *user_data);
-
 #endif /* __STC_RESTRICTION_H__ */
index d5817cf..d74a7a4 100644 (file)
@@ -6,6 +6,7 @@
                <method name='Unlock'>
                        <arg type='i' name='error_code' direction='out'/>
                </method>
+
                <method name='GetLock'>
                        <arg type='i' name='state' direction='out'/>
                </method>
index 93b81af..3ecc542 100644 (file)
                        <arg type='aa{sv}' name='parameters' direction='out'/>
                </method>
 
-               <method name='GetState'>
+               <method name='GetType'>
                        <arg type='s' name='app_id' direction='in'/>
                        <arg type='i' name='iftype' direction='in'/>
                        <arg type='i' name='error_code' direction='out'/>
-                       <arg type='i' name='state' direction='out'/>
+                       <arg type='i' name='type' direction='out'/>
                </method>
 
                <method name='Unset'>
index 3242bd4..afafa95 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.57
+Version:    0.0.58
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index fb85dea..d9764b4 100755 (executable)
@@ -124,7 +124,6 @@ signal_map_s signal_map[] = {
        }
 };
 
-
 static stc_error_e __ground_status_monitor_init(stc_s *stc)
 {
        guint i = 0;
index e006bdc..77793d1 100755 (executable)
@@ -22,7 +22,7 @@ typedef struct {
        char *ifname;
        char *subscriber_id;
        stc_iface_type_e iftype;
-       stc_rstn_type_e rst_type;
+       stc_rstn_type_e rstn_type;
        stc_roaming_type_e roaming;
        int64_t data_limit;
        int64_t data_warn_limit;
@@ -41,14 +41,14 @@ stc_error_e table_restrictions_per_app(const gchar *app_id,
                                       void *user_data);
 
 
-stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *app_id,
+stc_error_e table_restrictions_get_restriction_type_subscriber_id(const char *app_id,
                                                          stc_iface_type_e iftype,
                                                          const char *subscriber_id,
-                                                         stc_restriction_state_e *state);
+                                                         stc_rstn_type_e *type);
 
-stc_error_e table_restrictions_get_restriction_state(const char *app_id,
+stc_error_e table_restrictions_get_restriction_type(const char *app_id,
                                                     stc_iface_type_e iftype,
-                                                    stc_restriction_state_e *state);
+                                                    stc_rstn_type_e *type);
 
 stc_error_e table_restrictions_update(table_restrictions_info *info);
 
index 8452926..5c7e4ee 100755 (executable)
 
 /* SELECT statements */
 #define SELECT_RESTRICTIONS "SELECT binpath, data_limit, " \
-       " iftype, rst_type, roaming, ifname, subscriber_id, " \
+       " iftype, rstn_type, roaming, ifname, subscriber_id, " \
        " data_warn_limit, restriction_id FROM restrictions"
 
 #define SELECT_RESTRICTIONS_PER_APP "SELECT binpath, data_limit, " \
-       " iftype, rst_type, roaming, ifname, subscriber_id, " \
+       " iftype, rstn_type, roaming, ifname, subscriber_id, " \
        " data_warn_limit, restriction_id " \
        " FROM restrictions INDEXED BY restrictions_index " \
        " WHERE binpath = ?"
 
-#define SELECT_RESTRICTION_STATE "SELECT rst_type " \
+#define SELECT_RESTRICTION_TYPE "SELECT rstn_type " \
        " FROM restrictions INDEXED BY restrictions_index " \
        " WHERE binpath = ? AND iftype = ?"
 
-#define SELECT_RESTRICTION_STATE_SUBSCRIBER_ID "SELECT rst_type " \
+#define SELECT_RESTRICTION_TYPE_SUBSCRIBER_ID "SELECT rstn_type " \
        " FROM restrictions INDEXED BY restrictions_index " \
        " WHERE binpath = ? AND iftype = ? AND subscriber_id = ?"
 
 
 /* UPDATE statement */
 #define UPDATE_NET_RESTRICTIONS "UPDATE restrictions " \
-       " SET binpath = ?, data_limit = ?, iftype = ?, rst_type = ?, " \
+       " SET binpath = ?, data_limit = ?, iftype = ?, rstn_type = ?, " \
        " roaming = ?, ifname = ?, subscriber_id = ?, data_warn_limit = ? " \
        " WHERE restriction_id = ?"
 
 /* INSERT statement */
 #define INSERT_NET_RESTRICTIONS "INSERT INTO restrictions " \
-       " (binpath, data_limit, iftype, rst_type, " \
+       " (binpath, data_limit, iftype, rstn_type, " \
        " roaming, ifname, subscriber_id, data_warn_limit) " \
        " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
 
@@ -128,8 +128,8 @@ static sqlite3_stmt *delete_restrictions;
 /* SELECT statements */
 static sqlite3_stmt *select_restriction;
 static sqlite3_stmt *select_restriction_per_app;
-static sqlite3_stmt *select_restriction_state;
-static sqlite3_stmt *select_restriction_state_subscriber_id;
+static sqlite3_stmt *select_restriction_type;
+static sqlite3_stmt *select_restriction_type_subscriber_id;
 static sqlite3_stmt *select_restriction_id;
 
 /* REPLACE statements */
@@ -178,8 +178,8 @@ static int __prepare_select(sqlite3 *db)
 
        PREPARE_SELECT(select_restriction, SELECT_RESTRICTIONS);
        PREPARE_SELECT(select_restriction_per_app, SELECT_RESTRICTIONS_PER_APP);
-       PREPARE_SELECT(select_restriction_state, SELECT_RESTRICTION_STATE);
-       PREPARE_SELECT(select_restriction_state_subscriber_id, SELECT_RESTRICTION_STATE_SUBSCRIBER_ID);
+       PREPARE_SELECT(select_restriction_type, SELECT_RESTRICTION_TYPE);
+       PREPARE_SELECT(select_restriction_type_subscriber_id, SELECT_RESTRICTION_TYPE_SUBSCRIBER_ID);
        PREPARE_SELECT(select_restriction_id, SELECT_RESTRICTION_ID);
 
        initialized = 1;
@@ -193,8 +193,8 @@ static void __finalize_select(void)
 
        FINALIZE(select_restriction);
        FINALIZE(select_restriction_per_app);
-       FINALIZE(select_restriction_state);
-       FINALIZE(select_restriction_state_subscriber_id);
+       FINALIZE(select_restriction_type);
+       FINALIZE(select_restriction_type_subscriber_id);
        FINALIZE(select_restriction_id);
 
        __STC_LOG_FUNC_EXIT__;
@@ -285,7 +285,7 @@ stc_error_e table_restrictions_per_app(const gchar* app_id,
                        data.app_id = (char *)sqlite3_column_text(stmt, 0);
                        data.data_limit = sqlite3_column_int64(stmt, 1);
                        data.iftype = (stc_iface_type_e)sqlite3_column_int(stmt, 2);
-                       data.rst_type =
+                       data.rstn_type =
                                (stc_rstn_type_e)sqlite3_column_int(stmt, 3);
                        data.roaming = sqlite3_column_int(stmt, 4);
                        data.ifname = (char *)sqlite3_column_text(stmt, 5);
@@ -333,7 +333,7 @@ stc_error_e table_restrictions_foreach(const table_restrictions_info_cb restrict
                        data.app_id = (char *)sqlite3_column_text(stmt, 0);
                        data.data_limit = sqlite3_column_int64(stmt, 1);
                        data.iftype = (stc_iface_type_e)sqlite3_column_int(stmt, 2);
-                       data.rst_type =
+                       data.rstn_type =
                                (stc_rstn_type_e)sqlite3_column_int(stmt, 3);
                        data.roaming = sqlite3_column_int(stmt, 4);
                        data.ifname = (char *)sqlite3_column_text(stmt, 5);
@@ -359,44 +359,44 @@ stc_error_e table_restrictions_foreach(const table_restrictions_info_cb restrict
        return error_code;
 }
 
-stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *app_id,
+stc_error_e table_restrictions_get_restriction_type_subscriber_id(const char *app_id,
                                                          stc_iface_type_e iftype,
                                                          const char *subscriber_id,
-                                                         stc_restriction_state_e *state)
+                                                         stc_rstn_type_e *type)
 {
        __STC_LOG_FUNC_ENTER__;
        int error_code = STC_ERROR_NONE;
        int ret;
        bool state_subscriber_id = 0;
 
-       if (state == NULL) {
+       if (type == NULL) {
                STC_LOGE("Please provide valid argument!"); //LCOV_EXCL_LINE
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
                return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
-       *state = STC_RESTRICTION_UNKNOWN;
-       sqlite3_reset(select_restriction_state_subscriber_id);
-       sqlite3_reset(select_restriction_state);
+       *type = STC_RSTN_TYPE_UNKNOWN;
+       sqlite3_reset(select_restriction_type_subscriber_id);
+       sqlite3_reset(select_restriction_type);
 
        if (subscriber_id == NULL) {
                state_subscriber_id = 0;
-               DB_ACTION(sqlite3_bind_text(select_restriction_state, 1,
+               DB_ACTION(sqlite3_bind_text(select_restriction_type, 1,
                                            app_id ? app_id : "", -1,
                                            SQLITE_STATIC));
-               DB_ACTION(sqlite3_bind_int(select_restriction_state, 2,
+               DB_ACTION(sqlite3_bind_int(select_restriction_type, 2,
                                           iftype));
-               ret = sqlite3_step(select_restriction_state);
+               ret = sqlite3_step(select_restriction_type);
        } else {
                state_subscriber_id = 1;
-               DB_ACTION(sqlite3_bind_text(select_restriction_state_subscriber_id, 1,
+               DB_ACTION(sqlite3_bind_text(select_restriction_type_subscriber_id, 1,
                                            app_id ? app_id : "", -1,
                                            SQLITE_STATIC));
-               DB_ACTION(sqlite3_bind_int(select_restriction_state_subscriber_id, 2,
+               DB_ACTION(sqlite3_bind_int(select_restriction_type_subscriber_id, 2,
                                           iftype));
-               DB_ACTION(sqlite3_bind_text(select_restriction_state_subscriber_id, 3,
+               DB_ACTION(sqlite3_bind_text(select_restriction_type_subscriber_id, 3,
                                            subscriber_id, -1, SQLITE_STATIC));
-               ret = sqlite3_step(select_restriction_state_subscriber_id);
+               ret = sqlite3_step(select_restriction_type_subscriber_id);
        }
 
        switch (ret) {
@@ -404,32 +404,32 @@ stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *a
                break;
        case SQLITE_ROW:
                if (state_subscriber_id)
-                       *state = (stc_restriction_state_e)sqlite3_column_int(select_restriction_state_subscriber_id, 0);
+                       *type = (stc_rstn_type_e)sqlite3_column_int(select_restriction_type_subscriber_id, 0);
                else
-                       *state = (stc_restriction_state_e)sqlite3_column_int(select_restriction_state, 0);
+                       *type = (stc_rstn_type_e)sqlite3_column_int(select_restriction_type, 0);
                break;
        case SQLITE_ERROR:
        default:
                STC_LOGE("Can't perform sql query: %s \n%s", //LCOV_EXCL_LINE
-                        SELECT_RESTRICTION_STATE,
+                        SELECT_RESTRICTION_TYPE,
                         sqlite3_errmsg(stc_db_get_database()));
                error_code = STC_ERROR_DB_FAILED; //LCOV_EXCL_LINE
        }
 
 handle_error:
-       sqlite3_reset(select_restriction_state);
-       sqlite3_reset(select_restriction_state_subscriber_id);
+       sqlite3_reset(select_restriction_type);
+       sqlite3_reset(select_restriction_type_subscriber_id);
        return error_code;
 }
 
-stc_error_e table_restrictions_get_restriction_state(const char *app_id,
+stc_error_e table_restrictions_get_restriction_type(const char *app_id,
                                                     stc_iface_type_e iftype,
-                                                    stc_restriction_state_e *state)
+                                                    stc_rstn_type_e *type)
 {
        __STC_LOG_FUNC_ENTER__;
        __STC_LOG_FUNC_EXIT__;
-       return table_restrictions_get_restriction_state_subscriber_id(app_id, iftype,
-                                                            NULL, state);
+       return table_restrictions_get_restriction_type_subscriber_id(app_id, iftype,
+                                                            NULL, type);
 }
 
 stc_error_e table_restrictions_delete(const char *app_id,
@@ -518,7 +518,7 @@ stc_error_e table_restrictions_update(table_restrictions_info *info)
                                    -1, SQLITE_TRANSIENT));
        DB_ACTION(sqlite3_bind_int64(stmt, 2, info->data_limit));
        DB_ACTION(sqlite3_bind_int(stmt, 3, info->iftype));
-       DB_ACTION(sqlite3_bind_int(stmt, 4, info->rst_type));
+       DB_ACTION(sqlite3_bind_int(stmt, 4, info->rstn_type));
        DB_ACTION(sqlite3_bind_int(stmt, 5, info->roaming));
        DB_ACTION(sqlite3_bind_text(stmt, 6, info->ifname ? info->ifname : "",
                                    -1, SQLITE_TRANSIENT));
index c305246..9d80afb 100755 (executable)
@@ -80,7 +80,7 @@ enum nfnl_acct_flags {
  *
  *  and inherited nfacct_rule_counter and nfacct_rule_restriction
  *  with additional field:
- *     quota, quota_id, roaming, rst_state
+ *     quota, quota_id, roaming, rstn_state
  *
  * But ANSI C doesn't support inheritance.
  */
@@ -95,7 +95,7 @@ struct nfacct_rule {
        nfacct_rule_direction iotype;
        nfacct_rule_intend intend;
        nfacct_rule_jump jump; /* in most cases jump is evalutation based on intend, but not always */
-       stc_restriction_state_e rst_state;
+       stc_rstn_state_e rstn_state;
        nfacct_rule_iptype iptype;
 
        struct counter_arg *carg;
index 3437637..a102ea3 100755 (executable)
@@ -78,8 +78,8 @@ typedef struct {
 typedef struct {
        uint64_t restriction_id;
        uint32_t classid;
-       stc_restriction_state_e rst_state;
-       stc_rstn_type_e rst_type;
+       stc_rstn_state_e rstn_state;
+       stc_rstn_type_e rstn_type;
        int64_t data_limit;
        int64_t data_warn_limit;
        int64_t data_counter;
index 83d64d0..b73a889 100755 (executable)
@@ -462,14 +462,14 @@ static void __print_rstn(stc_rstn_key_s *rstn_key, stc_rstn_value_s *rstn_value)
 {
        STC_LOGI("rstn info => rstn_id [%llu], "
                 "app_id [%s], classid [%lu], ifname [%s], "
-                "iftype [%d], rst_state [%d], rst_type [%d], "
+                "iftype [%d], rstn_state [%d], rstn_type [%d], "
                 "limit [ (%lld) bytes], "
                 "warn_limit [ (%lld) bytes], "
                 "counter [ (%lld) bytes], "
                 "roaming [%d], subscriber_id [%s]",
                 rstn_value->restriction_id,
                 rstn_key->app_id, rstn_value->classid , rstn_key->ifname,
-                rstn_key->iftype, rstn_value->rst_state, rstn_value->rst_type,
+                rstn_key->iftype, rstn_value->rstn_state, rstn_value->rstn_type,
                 rstn_value->data_limit,
                 rstn_value->data_warn_limit,
                 rstn_value->data_counter,
@@ -550,7 +550,7 @@ static void __del_iptables_rule(int64_t classid, nfacct_rule_intend intend,
        __del_ip6tables_out(&counter);
 }
 
-static void __process_restriction(enum traffic_restriction_type rst_type,
+static void __process_restriction(enum traffic_restriction_type rstn_type,
                                  stc_rstn_key_s *rstn_key,
                                  stc_rstn_value_s *rstn_value, void *data)
 {
@@ -579,7 +579,7 @@ static void __process_restriction(enum traffic_restriction_type rst_type,
        effective_data_limit = rstn_value->data_limit;
        effective_data_warn_limit = rstn_value->data_warn_limit;
 
-       if (rst_type == RST_SET) {
+       if (rstn_type == RST_SET) {
                /* TODO: Change this to runtime memory */
                table_counters_info info;
 
@@ -605,27 +605,27 @@ static void __process_restriction(enum traffic_restriction_type rst_type,
                 rstn_value->restriction_id, effective_data_limit,
                 effective_data_warn_limit);
 
-       switch (rst_type) {
+       switch (rstn_type) {
        case RST_SET:
                if (effective_data_limit <= 0)
                        __add_iptables_rule(rstn_value->classid, NFACCT_BLOCK,
                                            rstn_key->iftype);
 
-               rstn_value->rst_state = STC_RESTRICTION_ACTIVATED;
+               rstn_value->rstn_state = STC_RSTN_STATE_ACTIVATED;
                rstn_value->data_limit_reached = FALSE;
                break;
        case RST_EXCLUDE:
                __add_iptables_rule(rstn_value->classid, NFACCT_ALLOW,
                                    rstn_key->iftype);
 
-               rstn_value->rst_state = STC_RESTRICTION_ACTIVATED;
+               rstn_value->rstn_state = STC_RSTN_STATE_ACTIVATED;
                rstn_value->data_limit_reached = TRUE;
                break;
        case RST_UNSET:
-               __del_iptables_rule(rstn_value->classid, rstn_value->rst_type,
+               __del_iptables_rule(rstn_value->classid, rstn_value->rstn_type,
                                    rstn_key->iftype);
 
-               rstn_value->rst_state = STC_RESTRICTION_DEACTIVATED;
+               rstn_value->rstn_state = STC_RSTN_STATE_DEACTIVATED;
                rstn_value->data_limit_reached = FALSE;
                break;
        default:
@@ -651,7 +651,7 @@ static gboolean __remove_rstns_foreach_application(gpointer key,
                goto out;
 
        /* rstn rule is already removed */
-       if (rstn_value->rst_state == STC_RESTRICTION_DEACTIVATED)
+       if (rstn_value->rstn_state == STC_RSTN_STATE_DEACTIVATED)
                goto out;
 
        /* remove restriction from system */
@@ -1275,10 +1275,10 @@ static gboolean __add_restriction_debug(gpointer key, gpointer value,
        stc_rstn_value_s *rstn_value = (stc_rstn_value_s *)value;
 
        /* rstn rule is activated */
-       if (rstn_value->rst_state == STC_RESTRICTION_ACTIVATED)
+       if (rstn_value->rstn_state == STC_RSTN_STATE_ACTIVATED)
                return FALSE;
 
-       if (rstn_value->rst_type == STC_RSTN_TYPE_EXCLUDED)
+       if (rstn_value->rstn_type == STC_RSTN_TYPE_ACCEPT)
                __process_restriction(RST_EXCLUDE, rstn_key, rstn_value, data);
        else
                __process_restriction(RST_SET, rstn_key, rstn_value, data);
@@ -1295,10 +1295,10 @@ static gboolean __add_restriction(gpointer key, gpointer value, gpointer data)
        stc_rstn_value_s *rstn_value = (stc_rstn_value_s *)value;
 
        /* rstn rule is activated */
-       if (rstn_value->rst_state == STC_RESTRICTION_ACTIVATED)
+       if (rstn_value->rstn_state == STC_RSTN_STATE_ACTIVATED)
                return FALSE;
 
-       if (rstn_value->rst_type == STC_RSTN_TYPE_EXCLUDED)
+       if (rstn_value->rstn_type == STC_RSTN_TYPE_ACCEPT)
                __process_restriction(RST_EXCLUDE, rstn_key, rstn_value, data);
        else
                __process_restriction(RST_SET, rstn_key, rstn_value, data);
@@ -1366,8 +1366,8 @@ static stc_error_e __rstn_tree_add(stc_rstn_key_s *key,
        g_tree_insert(g_system->rstns, rstn_key, rstn_value);
 
        rstn_value->restriction_id = value->restriction_id;
-       rstn_value->rst_state = value->rst_state;
-       rstn_value->rst_type = value->rst_type;
+       rstn_value->rstn_state = value->rstn_state;
+       rstn_value->rstn_type = value->rstn_type;
        rstn_value->classid = value->classid;
        rstn_value->data_limit = value->data_limit;
        rstn_value->data_warn_limit = value->data_warn_limit;
@@ -1401,8 +1401,8 @@ static stc_cb_ret_e __insert_restriction_cb(const table_restrictions_info *info,
        key.iftype = info->iftype;
        key.roaming = info->roaming;
 
-       value.rst_type = info->rst_type;
-       value.rst_state = STC_RESTRICTION_UNKNOWN;
+       value.rstn_type = info->rstn_type;
+       value.rstn_state = STC_RSTN_STATE_UNKNOWN;
        value.restriction_id = info->restriction_id;
 
        if (info->app_id)
@@ -1447,11 +1447,11 @@ static gboolean __add_rstn_foreach_application(gpointer key,
                goto out;
 
        /* rstn rule is already applied */
-       if (rstn_value->rst_state == STC_RESTRICTION_ACTIVATED)
+       if (rstn_value->rstn_state == STC_RSTN_STATE_ACTIVATED)
                goto out;
 
        /* add restriction to system */
-       if (rstn_value->rst_type == STC_RSTN_TYPE_EXCLUDED)
+       if (rstn_value->rstn_type == STC_RSTN_TYPE_ACCEPT)
                __process_restriction(RST_EXCLUDE, rstn_key, rstn_value, NULL);
        else
                __process_restriction(RST_SET, rstn_key, rstn_value, NULL);
@@ -1891,8 +1891,8 @@ stc_error_e stc_monitor_rstns_tree_add(const table_restrictions_info *info)
        key.iftype = info->iftype;
        key.roaming = info->roaming;
 
-       value.rst_type = info->rst_type;
-       value.rst_state = STC_RESTRICTION_UNKNOWN;
+       value.rstn_type = info->rstn_type;
+       value.rstn_state = STC_RSTN_STATE_UNKNOWN;
        value.restriction_id = info->restriction_id;
 
        if (info->app_id)
index 2abe2c1..3170c42 100755 (executable)
@@ -134,8 +134,8 @@ static gboolean __stc_manager_gdbus_restriction_init(stc_s *stc)
        g_signal_connect(restriction, "handle-get-all",
                         G_CALLBACK(handle_restriction_get_all), stc);
 
-       g_signal_connect(restriction, "handle-get-state",
-                        G_CALLBACK(handle_restriction_get_state),
+       g_signal_connect(restriction, "handle-get-type",
+                        G_CALLBACK(handle_restriction_get_type),
                         stc);
 
        g_signal_connect(restriction, "handle-unset",
index e39575a..05d7544 100755 (executable)
@@ -45,7 +45,7 @@ void __initialize_rstn_rule(table_restrictions_info *rule)
        rule->app_id = NULL;
        rule->ifname = NULL;
        rule->iftype = STC_IFACE_ALL;
-       rule->rst_type = STC_RSTN_TYPE_UNKNOWN;
+       rule->rstn_type = STC_RSTN_TYPE_UNKNOWN;
        rule->data_limit = 0;
        rule->data_warn_limit = 0;
        rule->roaming = STC_ROAMING_DISABLE;
@@ -53,7 +53,7 @@ void __initialize_rstn_rule(table_restrictions_info *rule)
 }
 
 gboolean __validate_rstn_rule(table_restrictions_info *rule,
-                             enum traffic_restriction_type rst_type)
+                             enum traffic_restriction_type rstn_type)
 {
        __STC_LOG_FUNC_ENTER__;
 
@@ -62,7 +62,7 @@ gboolean __validate_rstn_rule(table_restrictions_info *rule,
                return FALSE; //LCOV_EXCL_LINE
        }
 
-       if (rst_type <= RST_UNDEFINDED || rst_type >= RST_MAX_VALUE) {
+       if (rstn_type <= RST_UNDEFINDED || rstn_type >= RST_MAX_VALUE) {
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
                return FALSE; //LCOV_EXCL_LINE
        }
@@ -111,8 +111,8 @@ void __stc_restriction_app_info_builder_add(GVariantBuilder *builder,
        g_variant_builder_add(builder, "{sv}", "iftype",
                              g_variant_new_uint16(info->iftype));
 
-       g_variant_builder_add(builder, "{sv}", "rst_type",
-                             g_variant_new_uint16(info->rst_type));
+       g_variant_builder_add(builder, "{sv}", "rstn_type",
+                             g_variant_new_uint16(info->rstn_type));
 
        g_variant_builder_add(builder, "{sv}", "data_limit",
                              g_variant_new_int64(info->data_limit));
@@ -241,7 +241,7 @@ gboolean handle_restriction_set(StcRestriction *object,
                g_variant_iter_free(iter);
        }
 
-       rule.rst_type = STC_RSTN_TYPE_BLOCKED;
+       rule.rstn_type = STC_RSTN_TYPE_DROP;
 
        if (__validate_rstn_rule(&rule, RST_SET) == FALSE) {
                STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
@@ -279,7 +279,7 @@ gboolean handle_restriction_exclude(StcRestriction *object,
                g_variant_iter_free(iter);
        }
 
-       rule.rst_type = STC_RSTN_TYPE_EXCLUDED;
+       rule.rstn_type = STC_RSTN_TYPE_ACCEPT;
 
        if (__validate_rstn_rule(&rule, RST_EXCLUDE) == FALSE) {
                STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
@@ -393,7 +393,7 @@ gboolean handle_restriction_get_all(StcRestriction *object,
        return TRUE;
 }
 
-gboolean handle_restriction_get_state(StcRestriction *object,
+gboolean handle_restriction_get_type(StcRestriction *object,
                                      GDBusMethodInvocation *invocation,
                                      const gchar *app_id,
                                      int iftype,
@@ -401,17 +401,17 @@ gboolean handle_restriction_get_state(StcRestriction *object,
 {
        __STC_LOG_FUNC_ENTER__;
        GVariant *return_parameters = NULL;
-       stc_restriction_state_e state = STC_RESTRICTION_UNKNOWN;
+       stc_rstn_type_e type = STC_RSTN_TYPE_UNKNOWN;
        stc_error_e ret;
 
-       ret = table_restrictions_get_restriction_state(app_id, iftype, &state);
+       ret = table_restrictions_get_restriction_type(app_id, iftype, &type);
        if (ret < STC_ERROR_NONE) {
                STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE
                __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
                return TRUE;
        }
 
-       return_parameters = g_variant_new("(ii)", STC_ERROR_NONE, state);
+       return_parameters = g_variant_new("(ii)", STC_ERROR_NONE, type);
        STC_DBUS_REPLY(invocation, return_parameters);
        __STC_LOG_FUNC_EXIT__;
        return TRUE;