is_roaming INT,
hw_net_protocol_type INT,
ifname TEXT,
- imsi TEXT,
+ subscriber_id TEXT,
ground INT
);
ifname TEXT,
rst_state INT,
roaming INT,
- imsi TEXT NOT NULL,
+ subscriber_id TEXT NOT NULL,
data_limit BIGINT,
data_warn_limit BIGINT
);
int64_t rcv_warning_limit;
stc_roaming_type_e roaming;
char *ifname;
- char *imsi;
+ char *subscriber_id;
} stc_restriction_s;
/*****************************************************************************
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.32
+Version: 0.0.33
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(openssl)
%if %{?enable_database} == YES
BuildRequires: pkgconfig(sqlite3)
vconf
capi-system-info
pkgmgr-info
+ openssl
)
IF("${ENABLE_DATABASE}" STREQUAL "YES")
typedef struct {
uint32_t classid;
int iftype;
- /* pointer to telephony's imsi */
- char *imsi;
+ /* pointer to telephony's subscriber_id */
+ char *subscriber_id;
char ifname[MAX_IFACE_LENGTH];
} stc_db_classid_iftype_key;
typedef struct {
char *app_id;
char *ifname;
- char *imsi;
+ char *subscriber_id;
stc_iface_type_e iftype;
stc_restriction_state_e rst_state;
stc_roaming_type_e roaming;
void *user_data);
-stc_error_e table_restrictions_get_restriction_state_imsi(const char *app_id,
+stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *app_id,
stc_iface_type_e iftype,
- const char *imsi_hash,
+ const char *subscriber_id,
stc_restriction_state_e *state);
stc_error_e table_restrictions_get_restriction_state(const char *app_id,
stc_error_e table_restrictions_delete(const char *app_id,
const stc_iface_type_e iftype,
- const char *imsi);
+ const char *subscriber_id);
stc_error_e table_restrictions_prepare(sqlite3 *db);
typedef struct {
char *app_id;
char *ifname;
- char *imsi;
+ char *subscriber_id;
stc_iface_type_e iftype;
stc_db_tm_interval_s *interval;
stc_data_counter_s cnt;
typedef struct {
unsigned char version;
char *app_id;
- char *imsi;
+ char *subscriber_id;
stc_iface_type_e iftype;
stc_db_tm_interval_s *interval;
stc_db_connection_period_type connection_state;
/* DELETE statements */
#define DELETE_RESTRICTIONS "DELETE FROM restrictions " \
- " WHERE binpath = ? AND iftype = ? AND imsi = ?"
+ " WHERE binpath = ? AND iftype = ? AND subscriber_id = ?"
/* SELECT statements */
#define SELECT_RESTRICTIONS "SELECT binpath, data_limit, " \
- " iftype, rst_state, roaming, ifname, imsi, " \
+ " iftype, rst_state, roaming, ifname, subscriber_id, " \
" data_warn_limit, restriction_id FROM restrictions"
#define SELECT_RESTRICTIONS_PER_APP "SELECT binpath, data_limit, " \
- " iftype, rst_state, roaming, ifname, imsi, " \
+ " iftype, rst_state, roaming, ifname, subscriber_id, " \
" data_warn_limit, restriction_id " \
" FROM restrictions INDEXED BY restrictions_index " \
" WHERE binpath = ?"
" FROM restrictions INDEXED BY restrictions_index " \
" WHERE binpath = ? AND iftype = ?"
-#define SELECT_RESTRICTION_STATE_IMSI "SELECT rst_state " \
+#define SELECT_RESTRICTION_STATE_SUBSCRIBER_ID "SELECT rst_state " \
" FROM restrictions INDEXED BY restrictions_index " \
- " WHERE binpath = ? AND iftype = ? AND imsi = ?"
+ " WHERE binpath = ? AND iftype = ? AND subscriber_id = ?"
#define SELECT_RESTRICTION_ID "SELECT restriction_id FROM restrictions " \
- " WHERE binpath = ? AND iftype = ? AND imsi = ? AND " \
+ " WHERE binpath = ? AND iftype = ? AND subscriber_id = ? AND " \
" rst_state = ? AND roaming = ? AND ifname = ?"
/* UPDATE statement */
#define UPDATE_NET_RESTRICTIONS "UPDATE restrictions " \
" SET binpath = ?, data_limit = ?, iftype = ?, rst_state = ?, " \
- " roaming = ?, ifname = ?, imsi = ?, data_warn_limit = ? " \
+ " roaming = ?, ifname = ?, subscriber_id = ?, data_warn_limit = ? " \
" WHERE restriction_id = ?"
/* INSERT statement */
#define INSERT_NET_RESTRICTIONS "INSERT INTO restrictions " \
" (binpath, data_limit, iftype, rst_state, " \
- " roaming, ifname, imsi, data_warn_limit) " \
+ " roaming, ifname, subscriber_id, data_warn_limit) " \
" VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
static void __finalize_delete(void);
static sqlite3_stmt *select_restriction;
static sqlite3_stmt *select_restriction_per_app;
static sqlite3_stmt *select_restriction_state;
-static sqlite3_stmt *select_restriction_state_imsi;
+static sqlite3_stmt *select_restriction_state_subscriber_id;
static sqlite3_stmt *select_restriction_id;
/* REPLACE statements */
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_imsi, SELECT_RESTRICTION_STATE_IMSI);
+ PREPARE_SELECT(select_restriction_state_subscriber_id, SELECT_RESTRICTION_STATE_SUBSCRIBER_ID);
PREPARE_SELECT(select_restriction_id, SELECT_RESTRICTION_ID);
initialized = 1;
FINALIZE(select_restriction);
FINALIZE(select_restriction_per_app);
FINALIZE(select_restriction_state);
- FINALIZE(select_restriction_state_imsi);
+ FINALIZE(select_restriction_state_subscriber_id);
FINALIZE(select_restriction_id);
__STC_LOG_FUNC_EXIT__;
(stc_restriction_state_e)sqlite3_column_int(stmt, 3);
data.roaming = sqlite3_column_int(stmt, 4);
data.ifname = (char *)sqlite3_column_text(stmt, 5);
- data.imsi = (char *)sqlite3_column_text(stmt, 6);
+ data.subscriber_id = (char *)sqlite3_column_text(stmt, 6);
data.data_warn_limit = sqlite3_column_int64(stmt, 7);
data.restriction_id = sqlite3_column_int64(stmt, 8);
(stc_restriction_state_e)sqlite3_column_int(stmt, 3);
data.roaming = sqlite3_column_int(stmt, 4);
data.ifname = (char *)sqlite3_column_text(stmt, 5);
- data.imsi = (char *)sqlite3_column_text(stmt, 6);
+ data.subscriber_id = (char *)sqlite3_column_text(stmt, 6);
data.data_warn_limit = sqlite3_column_int64(stmt, 7);
data.restriction_id = sqlite3_column_int64(stmt, 8);
return error_code;
}
-stc_error_e table_restrictions_get_restriction_state_imsi(const char *app_id,
+stc_error_e table_restrictions_get_restriction_state_subscriber_id(const char *app_id,
stc_iface_type_e iftype,
- const char *imsi_hash,
+ const char *subscriber_id,
stc_restriction_state_e *state)
{
__STC_LOG_FUNC_ENTER__;
int error_code = STC_ERROR_NONE;
int ret;
- bool state_imsi = 0;
+ bool state_subscriber_id = 0;
if (state == NULL) {
STC_LOGE("Please provide valid argument!");
}
*state = STC_RESTRICTION_UNKNOWN;
- sqlite3_reset(select_restriction_state_imsi);
+ sqlite3_reset(select_restriction_state_subscriber_id);
sqlite3_reset(select_restriction_state);
- if (imsi_hash == NULL) {
- state_imsi = 0;
+ if (subscriber_id == NULL) {
+ state_subscriber_id = 0;
DB_ACTION(sqlite3_bind_text(select_restriction_state, 1,
app_id ? app_id : "", -1,
SQLITE_STATIC));
iftype));
ret = sqlite3_step(select_restriction_state);
} else {
- state_imsi = 1;
- DB_ACTION(sqlite3_bind_text(select_restriction_state_imsi, 1,
+ state_subscriber_id = 1;
+ DB_ACTION(sqlite3_bind_text(select_restriction_state_subscriber_id, 1,
app_id ? app_id : "", -1,
SQLITE_STATIC));
- DB_ACTION(sqlite3_bind_int(select_restriction_state_imsi, 2,
+ DB_ACTION(sqlite3_bind_int(select_restriction_state_subscriber_id, 2,
iftype));
- DB_ACTION(sqlite3_bind_text(select_restriction_state_imsi, 3,
- imsi_hash, -1, SQLITE_STATIC));
- ret = sqlite3_step(select_restriction_state_imsi);
+ DB_ACTION(sqlite3_bind_text(select_restriction_state_subscriber_id, 3,
+ subscriber_id, -1, SQLITE_STATIC));
+ ret = sqlite3_step(select_restriction_state_subscriber_id);
}
switch (ret) {
case SQLITE_DONE:
break;
case SQLITE_ROW:
- if (state_imsi)
- *state = (stc_restriction_state_e)sqlite3_column_int(select_restriction_state_imsi, 0);
+ if (state_subscriber_id)
+ *state = (stc_restriction_state_e)sqlite3_column_int(select_restriction_state_subscriber_id, 0);
else
*state = (stc_restriction_state_e)sqlite3_column_int(select_restriction_state, 0);
break;
handle_error:
sqlite3_reset(select_restriction_state);
- sqlite3_reset(select_restriction_state_imsi);
+ sqlite3_reset(select_restriction_state_subscriber_id);
return error_code;
}
{
__STC_LOG_FUNC_ENTER__;
__STC_LOG_FUNC_EXIT__;
- return table_restrictions_get_restriction_state_imsi(app_id, iftype,
+ return table_restrictions_get_restriction_state_subscriber_id(app_id, iftype,
NULL, state);
}
stc_error_e table_restrictions_delete(const char *app_id,
const stc_iface_type_e iftype,
- const char *imsi)
+ const char *subscriber_id)
{
stc_error_e error_code = STC_ERROR_NONE;
sqlite3_stmt *stmt = delete_restrictions;
- STC_LOGD("app_id [%s], iftype [%d], imsi [%s]",
- app_id, iftype, imsi);
+ STC_LOGD("app_id [%s], iftype [%d], subscriber_id [%s]",
+ app_id, iftype, subscriber_id);
DB_ACTION(sqlite3_bind_text(stmt, 1, app_id ? app_id : "",
-1, SQLITE_TRANSIENT));
DB_ACTION(sqlite3_bind_int(stmt, 2, iftype));
- DB_ACTION(sqlite3_bind_text(stmt, 3, imsi ? imsi : "", -1,
+ DB_ACTION(sqlite3_bind_text(stmt, 3, subscriber_id ? subscriber_id : "", -1,
SQLITE_TRANSIENT));
if (sqlite3_step(stmt) != SQLITE_DONE) {
DB_ACTION(sqlite3_bind_text(stmt, 1, info->app_id ? info->app_id : "",
-1, SQLITE_TRANSIENT));
DB_ACTION(sqlite3_bind_int(stmt, 2, info->iftype));
- DB_ACTION(sqlite3_bind_text(stmt, 3, info->imsi ? info->imsi : "",
+ DB_ACTION(sqlite3_bind_text(stmt, 3, info->subscriber_id ? info->subscriber_id : "",
-1, SQLITE_TRANSIENT));
DB_ACTION(sqlite3_bind_int(stmt, 4, info->rst_state));
DB_ACTION(sqlite3_bind_int(stmt, 5, info->roaming));
DB_ACTION(sqlite3_bind_int(stmt, 5, info->roaming));
DB_ACTION(sqlite3_bind_text(stmt, 6, info->ifname ? info->ifname : "",
-1, SQLITE_TRANSIENT));
- DB_ACTION(sqlite3_bind_text(stmt, 7, info->imsi ? info->imsi : "",
+ DB_ACTION(sqlite3_bind_text(stmt, 7, info->subscriber_id ? info->subscriber_id : "",
-1, SQLITE_TRANSIENT));
DB_ACTION(sqlite3_bind_int64(stmt, 8, info->data_warn_limit));
/* SELECT statements */
#define SELECT_FOR_PERIOD "select binpath, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, " \
- "sum(sent) as sent, imsi, ground, iftype, ifname from statistics " \
+ "sum(sent) as sent, subscriber_id, ground, iftype, ifname from statistics " \
"where time_stamp between ? and ? " \
- "group by binpath, is_roaming, imsi order by received desc"
+ "group by binpath, is_roaming, subscriber_id order by received desc"
#define SELECT_FOR_PERIOD_IFACE "select binpath, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, " \
- "sum(sent) as sent, imsi, ground, iftype, ifname from statistics " \
+ "sum(sent) as sent, subscriber_id, ground, iftype, ifname from statistics " \
"where time_stamp between ? and ? " \
- "and iftype=? group by binpath, is_roaming, imsi order by received desc"
+ "and iftype=? group by binpath, is_roaming, subscriber_id order by received desc"
#define SELECT_CHUNKS "select binpath, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, " \
- "sum(sent) as sent, imsi, ground, iftype, ifname, " \
+ "sum(sent) as sent, subscriber_id, ground, iftype, ifname, " \
"time_stamp - time_stamp % ? as timestamp " \
"from statistics where time_stamp between ? and ? " \
- "group by binpath, timestamp, imsi order by timestamp"
+ "group by binpath, timestamp, subscriber_id order by timestamp"
#define SELECT_CHUNKS_IFACE "select binpath, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, " \
- "sum(sent) as sent, imsi, ground, iftype, ifname, " \
+ "sum(sent) as sent, subscriber_id, ground, iftype, ifname, " \
"time_stamp - time_stamp % ? as timestamp " \
"from statistics where time_stamp between ? and ? and iftype=?" \
- "group by binpath, timestamp, imsi order by timestamp"
+ "group by binpath, timestamp, subscriber_id order by timestamp"
#define SELECT_APP_DETAILS "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground from statistics " \
+ "ifname, subscriber_id, ground from statistics " \
"where time_stamp between ? and ? and binpath=? " \
- "group by binpath, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "group by binpath, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming " \
- "order by time_stamp, binpath, iftype, ifname, imsi, " \
+ "order by time_stamp, binpath, iftype, ifname, subscriber_id, " \
"hw_net_protocol_type, is_roaming"
#define SELECT_APP_DETAILS_IFACE "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground from statistics " \
+ "ifname, subscriber_id, ground from statistics " \
"where time_stamp between ? and ? and binpath=? and iftype=?" \
- "group by hw_net_protocol_type, is_roaming, iftype, ifname, imsi " \
+ "group by hw_net_protocol_type, is_roaming, iftype, ifname, subscriber_id " \
"order by time_stamp, hw_net_protocol_type, is_roaming, iftype, " \
- "ifname, imsi"
+ "ifname, subscriber_id"
#define SELECT_CHUNKS_APP "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground, time_stamp - time_stamp % ? as time_stamp " \
+ "ifname, subscriber_id, ground, time_stamp - time_stamp % ? as time_stamp " \
"from statistics " \
"group by iftype, ifname, time_stamp, hw_net_protocol_type, is_roaming " \
"order by time_stamp, iftype, ifname, hw_net_protocol_type, is_roaming"
#define SELECT_CHUNKS_APP_IFACE "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground, time_stamp - time_stamp % ? as time_stamp " \
+ "ifname, subscriber_id, ground, time_stamp - time_stamp % ? as time_stamp " \
"from statistics where time_stamp between ? and ? and binpath = ? " \
"and iftype = ? " \
"group by time_stamp, hw_net_protocol_type, is_roaming, " \
- "iftype, ifname, imsi " \
- "order by time_stamp, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "iftype, ifname, subscriber_id " \
+ "order by time_stamp, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming"
#define SELECT_TOTAL "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground from statistics " \
+ "ifname, subscriber_id, ground from statistics " \
"where (time_stamp between ? and ?) " \
"and binpath NOT LIKE 'TOTAL_%' " \
- "group by iftype, ifname, imsi, hw_net_protocol_type, is_roaming " \
- "order by time_stamp, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "group by iftype, ifname, subscriber_id, hw_net_protocol_type, is_roaming " \
+ "order by time_stamp, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming"
#define SELECT_TOTAL_IFACE "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground from statistics " \
+ "ifname, subscriber_id, ground from statistics " \
"where (time_stamp between ? and ?) and iftype=? " \
"and binpath NOT LIKE 'TOTAL_%' " \
"group by hw_net_protocol_type, is_roaming, " \
- "iftype, ifname, imsi " \
- "order by time_stamp, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "iftype, ifname, subscriber_id " \
+ "order by time_stamp, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming"
#define SELECT_CHUNKS_TOTAL "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground, time_stamp - time_stamp % ? as time_stamp " \
+ "ifname, subscriber_id, ground, time_stamp - time_stamp % ? as time_stamp " \
"from statistics where time_stamp between ? and ? " \
"and binpath NOT LIKE 'TOTAL_%' " \
- "group by time_stamp, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "group by time_stamp, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming " \
- "order by time_stamp, iftype, ifname, imsi, hw_net_protocol_type, " \
+ "order by time_stamp, iftype, ifname, subscriber_id, hw_net_protocol_type, " \
"is_roaming"
#define SELECT_CHUNKS_TOTAL_IFACE "select iftype, hw_net_protocol_type, " \
"is_roaming, sum(received) as received, sum(sent) as sent, " \
- "ifname, imsi, ground, time_stamp - time_stamp % ? as time_stamp " \
+ "ifname, subscriber_id, ground, time_stamp - time_stamp % ? as time_stamp " \
"from statistics where time_stamp between ? and ? " \
"and iftype = ? " \
"and binpath NOT LIKE 'TOTAL_%' " \
- "group by time_stamp, hw_net_protocol_type, is_roaming, iftype, ifname, imsi " \
+ "group by time_stamp, hw_net_protocol_type, is_roaming, iftype, ifname, subscriber_id " \
"order by time_stamp, hw_net_protocol_type, is_roaming, iftype, " \
- "ifname, imsi"
+ "ifname, subscriber_id"
/* INSERT statement */
#define INSERT_VALUES "insert into statistics " \
"(binpath, received, sent, time_stamp, " \
"iftype, is_roaming, hw_net_protocol_type, " \
- "ifname, imsi, ground) " \
+ "ifname, subscriber_id, ground) " \
"values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
static void __finalize_delete(void);
data.roaming = sqlite3_column_int(stmt, 2);
data.cnt.in_bytes = sqlite3_column_int64(stmt, 3);
data.cnt.out_bytes = sqlite3_column_int64(stmt, 4);
- data.imsi = (char *)sqlite3_column_text(stmt, 5);
+ data.subscriber_id = (char *)sqlite3_column_text(stmt, 5);
data.ground = sqlite3_column_int(stmt, 6);
data.iftype = sqlite3_column_int(stmt, 7);
data.ifname = (char *)sqlite3_column_text(stmt, 8);
data.cnt.in_bytes = sqlite3_column_int64(stmt, 3);
data.cnt.out_bytes = sqlite3_column_int64(stmt, 4);
data.ifname = (char *)sqlite3_column_text(stmt, 5);
- data.imsi = (char *)sqlite3_column_text(stmt, 6);
+ data.subscriber_id = (char *)sqlite3_column_text(stmt, 6);
data.ground = sqlite3_column_int(stmt, 7);
if (rule->granularity) {
DB_ACTION(sqlite3_bind_text(stmt, 8, stat_key->ifname, -1,
SQLITE_STATIC));
DB_ACTION(sqlite3_bind_text(stmt, 9,
- stat_key->imsi ? stat_key->imsi : "" , -1,
+ stat_key->subscriber_id ? stat_key->subscriber_id : "" , -1,
SQLITE_STATIC));
DB_ACTION(sqlite3_bind_int(stmt, 10, (int)stat->ground));
#include "stc-manager-util.h"
#define IMSI_LENGTH 16
+#define SHA256_DIGEST_LENGTH 32
/**
* @brief default connection information will be fetched from net-config
gboolean roaming;
/* only present when default profile is cellular */
- char imsi[IMSI_LENGTH];
+ char subscriber_id[SHA256_DIGEST_LENGTH * 2 + 1];
/* hardware network protocol type */
stc_hw_net_protocol_type_e hw_net_protocol_type;
typedef struct {
gchar *app_id;
gchar *ifname;
- gchar *imsi;
+ gchar *subscriber_id;
stc_iface_type_e iftype;
stc_roaming_type_e roaming;
} stc_rstn_key_s;
*/
#include <vconf/vconf.h>
+#include <openssl/sha.h>
#include "stc-monitor.h"
#include "stc-manager-gdbus.h"
return current_sim;
}
-static void __telephony_get_modem_imsi(GDBusConnection *connection,
+static void __make_imsi_to_subscriber_id(char *imsi)
+{
+ int i = 0;
+ SHA256_CTX ctx;
+ unsigned char md[SHA256_DIGEST_LENGTH];
+
+ SHA256_Init(&ctx);
+ SHA256_Update(&ctx, imsi, strlen(imsi));
+ SHA256_Final(md, &ctx);
+
+ for (i = 0; i < SHA256_DIGEST_LENGTH; ++i)
+ snprintf(g_default_connection.subscriber_id + (i * 2), 3, "%02x", md[i]);
+}
+
+static void __telephony_get_modem_subscriber_id(GDBusConnection *connection,
const char *default_modem_name)
{
GVariant *message = NULL;
char tel_path[MAX_PATH_LENGTH];
+ char imsi[IMSI_LENGTH];
const char *plmn = NULL;
int plmn_len = 0;
const char *msin = NULL;
goto done;
}
- snprintf(g_default_connection.imsi, IMSI_LENGTH, "%s%s", plmn, msin);
+ snprintf(imsi, IMSI_LENGTH, "%s%s", plmn, msin);
+ __make_imsi_to_subscriber_id(imsi);
done:
g_variant_unref(message);
return;
}
-static void __telephony_update_default_modem_imsi(GDBusConnection *connection)
+static void __telephony_update_default_modem_subscriber_id(GDBusConnection *connection)
{
GVariant *message = NULL;
GVariantIter *iter = NULL;
current_sim--;
}
- __telephony_get_modem_imsi(connection, default_modem_name);
+ __telephony_get_modem_subscriber_id(connection, default_modem_name);
FREE(default_modem_name);
g_variant_iter_free(iter);
STC_LOGI("ifname [%s]", g_default_connection.ifname);
STC_LOGI("roaming [%u]", g_default_connection.roaming ? TRUE : FALSE);
if (g_default_connection.type == STC_IFACE_DATACALL)
- STC_LOGI("imsi [%s]", g_default_connection.imsi);
+ STC_LOGI("sub_id [%s]", g_default_connection.subscriber_id);
STC_LOGI("==================================================");
}
if (__is_cellular_profile(g_default_connection.path)) {
g_default_connection.type = STC_IFACE_DATACALL;
- __telephony_update_default_modem_imsi(connection);
+ __telephony_update_default_modem_subscriber_id(connection);
} else if (__is_wifi_profile(g_default_connection.path)) {
g_default_connection.type = STC_IFACE_WIFI;
} else if (__is_ethernet_profile(g_default_connection.path)) {
if (ret != 0)
return ret;
- ret = g_strcmp0(key_a->imsi, key_b->imsi);
+ ret = g_strcmp0(key_a->subscriber_id, key_b->subscriber_id);
if (ret != 0)
return ret;
FREE(key->app_id);
FREE(key->ifname);
- FREE(key->imsi);
+ FREE(key->subscriber_id);
FREE(key);
}
"limit [ (%lld) bytes], "
"warn_limit [ (%lld) bytes], "
"counter [ (%lld) bytes], "
- "roaming [%d], imsi [%s]",
+ "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->data_limit,
rstn_value->data_warn_limit,
rstn_value->data_counter,
- rstn_key->roaming, rstn_key->imsi);
+ rstn_key->roaming, rstn_key->subscriber_id);
}
static void __process_restriction(enum traffic_restriction_type rst_type,
stat_key.iftype = default_connection->type;
if (STC_IFACE_DATACALL == stat_key.iftype)
- stat_key.imsi = g_strdup(default_connection->imsi);
+ stat_key.subscriber_id = g_strdup(default_connection->subscriber_id);
else
- stat_key.imsi = g_strdup("noneimsi");
+ stat_key.subscriber_id = g_strdup("none_subid");
g_strlcpy(stat_key.ifname, default_connection->ifname,
MAX_IFACE_LENGTH);
app_value->counter.in_bytes = 0;
FREE(stat.app_id);
- FREE(stat_key.imsi);
+ FREE(stat_key.subscriber_id);
return FALSE;
}
rstn_key->app_id = g_strdup(key->app_id);
rstn_key->ifname = g_strdup(key->ifname);
- rstn_key->imsi = g_strdup(key->imsi);
+ rstn_key->subscriber_id = g_strdup(key->subscriber_id);
rstn_key->iftype = key->iftype;
rstn_key->roaming = key->roaming;
key.app_id = g_strdup(info->app_id);
key.ifname = g_strdup(info->ifname);
- key.imsi = g_strdup(info->imsi);
+ key.subscriber_id = g_strdup(info->subscriber_id);
key.iftype = info->iftype;
key.roaming = info->roaming;
FREE(key.app_id);
FREE(key.ifname);
- FREE(key.imsi);
+ FREE(key.subscriber_id);
return ret;
}
process_name, exe_type);
}
+#if 0
static void __excn_hash_printall(void)
{
g_hash_table_foreach(g_system->excns_hash,
__excn_hash_foreach_print, NULL);
}
+#endif
static gboolean __remove_exception_app(gpointer key, gpointer value,
gpointer data)
key.app_id = g_strdup(info->app_id);
key.ifname = g_strdup(info->ifname);
- key.imsi = g_strdup(info->imsi);
+ key.subscriber_id = g_strdup(info->subscriber_id);
key.iftype = info->iftype;
key.roaming = info->roaming;
FREE(key.app_id);
FREE(key.ifname);
- FREE(key.imsi);
+ FREE(key.subscriber_id);
return ret;
}
stc_rstn_key_s key = {
.app_id = g_strdup(info->app_id),
.ifname = g_strdup(info->ifname),
- .imsi = g_strdup(info->imsi),
+ .subscriber_id = g_strdup(info->subscriber_id),
.iftype = info->iftype,
.roaming = info->roaming,
};
FREE(key.app_id);
FREE(key.ifname);
- FREE(key.imsi);
+ FREE(key.subscriber_id);
return ret;
}
rule->data_limit = 0;
rule->data_warn_limit = 0;
rule->roaming = STC_ROAMING_DISABLE;
- rule->imsi = NULL;
+ rule->subscriber_id = NULL;
}
gboolean __validate_rstn_rule(table_restrictions_info *rule,
return FALSE;
}
- if (rule->imsi == NULL) {
+ if (rule->subscriber_id == NULL) {
__STC_LOG_FUNC_EXIT__;
return FALSE;
}
g_variant_builder_add(builder, "{sv}", "roaming",
g_variant_new_uint16(info->roaming));
- g_variant_builder_add(builder, "{sv}", "imsi",
- g_variant_new_string(info->imsi));
+ g_variant_builder_add(builder, "{sv}", "subscriber_id",
+ g_variant_new_string(info->subscriber_id));
__STC_LOG_FUNC_EXIT__;
}
rule->roaming = g_variant_get_uint16(value);
STC_LOGD("roaming: [%u]", rule->roaming);
- } else if (!g_strcmp0(key, "imsi")) {
+ } else if (!g_strcmp0(key, "subscriber_id")) {
guint str_length;
const gchar *str = g_variant_get_string(value, &str_length);
- rule->imsi = g_strdup(str);
- STC_LOGD("imsi: [%s]", rule->imsi);
+ rule->subscriber_id = g_strdup(str);
+ STC_LOGD("subscriber_id: [%s]", rule->subscriber_id);
} else {
STC_LOGD("Unknown select rule");
return TRUE;
}
- table_restrictions_delete(rule.app_id, rule.iftype, rule.imsi);
+ table_restrictions_delete(rule.app_id, rule.iftype, rule.subscriber_id);
/* remove restriction rule from runtime structure */
stc_monitor_rstns_tree_remove(&rule);
rule->app_id = g_variant_dup_string(value, &len);
STC_LOGD("app_id: [%s]", rule->app_id);
- } else if (!g_strcmp0(key, "imsi")) {
+ } else if (!g_strcmp0(key, "subscriber_id")) {
gsize len = 0;
- rule->imsi = g_variant_dup_string(value, &len);
- STC_LOGD("imsi: [%s]", rule->imsi);
+ rule->subscriber_id = g_variant_dup_string(value, &len);
+ STC_LOGD("subscriber_id: [%s]", rule->subscriber_id);
} else if (!g_strcmp0(key, "iftype")) {
rule->iftype = g_variant_get_uint16(value);
g_variant_builder_add(builder, "{sv}", "ifname",
g_variant_new_string(info->ifname));
- g_variant_builder_add(builder, "{sv}", "imsi",
- g_variant_new_string(info->imsi));
+ g_variant_builder_add(builder, "{sv}", "subscriber_id",
+ g_variant_new_string(info->subscriber_id));
g_variant_builder_add(builder, "{sv}", "iftype",
g_variant_new_uint16(info->iftype));
handle_error:
FREE(rule.app_id);
- FREE(rule.imsi);
+ FREE(rule.subscriber_id);
FREE(rule.interval);
__STC_LOG_FUNC_EXIT__;
return TRUE;