* @brief datausage in bytes
*/
typedef struct {
- int64_t in_bytes; /**< incoming bytes */
- int64_t out_bytes; /**< outgoing bytes */
+ long long int in_bytes; /**< incoming bytes */
+ long long int out_bytes; /**< outgoing bytes */
} stc_data_counter_s;
typedef struct {
typedef struct {
stc_app_state_e rs_type;
stc_iface_type_e iftype;
- int64_t send_limit;
- int64_t rcv_limit;
- int64_t snd_warning_limit;
- int64_t rcv_warning_limit;
+ long long int send_limit;
+ long long int rcv_limit;
+ long long int snd_warning_limit;
+ long long int rcv_warning_limit;
stc_roaming_type_e roaming;
char *ifname;
char *subscriber_id;
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.84
+Version: 0.0.85
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
typedef struct {
stc_fw_chain_target_e target;
- uint64_t priority;
+ long long int priority;
GSList *rules;
} stc_fw_data_s;
}
if (g_strcmp0(key, RULE_CHAIN) == 0) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->chain = g_strdup(str);
STC_LOGD("%s: [%s]", RULE_CHAIN, rule->chain);
} else if (g_strcmp0(key, RULE_SIP1) == 0) {
if (rule->s_ip_type != STC_FW_IP_NONE) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
if (rule->family == STC_FW_FAMILY_V4) {
inet_pton(AF_INET, str, &(rule->s_ip1.Ipv4));
} else if (g_strcmp0(key, RULE_SIP2) == 0) {
if (rule->s_ip_type != STC_FW_IP_NONE) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
if (rule->family == STC_FW_FAMILY_V4) {
inet_pton(AF_INET, str, &(rule->s_ip2.Ipv4));
} else if (g_strcmp0(key, RULE_DIP1) == 0) {
if (rule->d_ip_type != STC_FW_IP_NONE) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
if (rule->family == STC_FW_FAMILY_V4) {
inet_pton(AF_INET, str, &(rule->d_ip1.Ipv4));
} else if (g_strcmp0(key, RULE_DIP2) == 0) {
if (rule->d_ip_type != STC_FW_IP_NONE) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
if (rule->family == STC_FW_FAMILY_V4) {
inet_pton(AF_INET, str, &(rule->d_ip2.Ipv4));
} else if (g_strcmp0(key, RULE_IFNAME) == 0) {
if (rule->direction != STC_FW_DIRECTION_NONE) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->ifname = g_strdup(str);
STC_LOGD("%s: [%s]", RULE_IFNAME, rule->ifname);
} else if (g_strcmp0(key, RULE_LOG_PREFIX) == 0) {
if (rule->target == STC_FW_RULE_TARGET_LOG) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->log_prefix = g_strdup(str);
STC_LOGD("%s: [%s]", RULE_LOG_PREFIX, rule->log_prefix);
} else if (g_strcmp0(key, RULE_NFLOG_PREFIX) == 0) {
if (rule->target == STC_FW_RULE_TARGET_NFLOG) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->nflog_prefix = g_strdup(str);
STC_LOGD("%s: [%s]", RULE_NFLOG_PREFIX, rule->nflog_prefix);
}
} else if (g_strcmp0(key, RULE_IDENTIFIER) == 0) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->identifier = g_strdup(str);
STC_LOGD("%s: [%s]", RULE_IDENTIFIER, rule->identifier);
typedef struct {
struct nfacct_rule *counter;
- int64_t bytes;
+ long long int bytes;
gboolean data_limit_exceeded;
} classid_bytes_context_s;
stc_roaming_type_e roaming;
char *mac;
- uint64_t restriction_id;
+ long long int restriction_id;
stc_rstn_state_e rstn_state;
stc_rstn_type_e rstn_type;
- int64_t counter[STC_RSTN_LIMIT_TYPE_MAX];
- int64_t limit[STC_RSTN_LIMIT_TYPE_MAX];
+ long long int counter[STC_RSTN_LIMIT_TYPE_MAX];
+ long long int limit[STC_RSTN_LIMIT_TYPE_MAX];
int32_t limit_exceeded;
int32_t limit_notified;
time_t month_start_ts;
time_t week_start_ts;
time_t day_start_ts;
- int64_t monthly_stat;
- int64_t weekly_stat;
- int64_t daily_stat;
+ long long int monthly_stat;
+ long long int weekly_stat;
+ long long int daily_stat;
} stc_rstn_cumulative_data_s;
void *user_data)
{
stc_rstn_cumulative_data_s *stat = (stc_rstn_cumulative_data_s *)user_data;
- int64_t counters = 0;
+ long long int counters = 0;
counters = info->cnt.in_bytes + info->cnt.out_bytes;
return STC_CONTINUE;
}
-static void __rstn_add_tether_rule(int64_t classid, gchar *mac,
+static void __rstn_add_tether_rule(long long int classid, gchar *mac,
nfacct_rule_intend intend, stc_iface_type_e iftype)
{
GSList *conn_list = stc_get_connection_list();
}
}
-static void __rstn_del_tether_rule(int64_t classid, gchar *mac,
+static void __rstn_del_tether_rule(long long int classid, gchar *mac,
nfacct_rule_intend intend, stc_iface_type_e iftype)
{
GSList *conn_list = stc_get_connection_list();
}
}
-static void __rstn_add_ipt_rule(int64_t classid, nfacct_rule_intend intend,
+static void __rstn_add_ipt_rule(long long int classid, nfacct_rule_intend intend,
stc_iface_type_e iftype)
{
GSList *conn_list = stc_get_connection_list();
}
}
-static void __rstn_del_ipt_rule(int64_t classid, nfacct_rule_intend intend,
+static void __rstn_del_ipt_rule(long long int classid, nfacct_rule_intend intend,
stc_iface_type_e iftype)
{
GSList *conn_list = stc_get_connection_list();
{
int i;
table_counters_info info;
- int64_t effective_limit[STC_RSTN_LIMIT_TYPE_MAX] = { 0, };
+ long long int effective_limit[STC_RSTN_LIMIT_TYPE_MAX] = { 0, };
memset(&info, 0, sizeof(table_counters_info));
rstn_data->limit_exceeded = 0;
{
int i;
table_counters_info info;
- int64_t effective_limit[STC_RSTN_LIMIT_TYPE_MAX] = { 0, };
+ long long int effective_limit[STC_RSTN_LIMIT_TYPE_MAX] = { 0, };
memset(&info, 0, sizeof(table_counters_info));
rstn_data->limit_exceeded = 0;
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
STC_LOGD("Restriction activated "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
}
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
STC_LOGD("Restriction activated "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
break;
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
STC_LOGD("Restriction deactivated "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
}
if (rstn_data->rstn_state == STC_RSTN_STATE_ACTIVATED) {
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
STC_LOGD("Restriction already activated "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
return;
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
__print_rstn(rstn_data);
STC_LOGD("\033[1;32mRestriction added\033[0;m "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
}
if (rstn_data->rstn_state == STC_RSTN_STATE_DEACTIVATED) {
STC_LOGD("\033[1;31mRestriction already deactivated\033[0;m "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
return;
}
if (STC_DEBUG_LOG && STC_RSTN_LOG) {
__print_rstn(rstn_data);
STC_LOGD("\033[1;31mRestriction removed\033[0;m "
- "[\033[1;36m%d\033[0;m:\033[1;35m%d\033[0;m]",
+ "[\033[1;36m%d\033[0;m:\033[1;35m%lld\033[0;m]",
rstn_data->classid, rstn_data->restriction_id);
}
}
*limit_exceeded = rstn_data->limit_exceeded;
}
-static void __fill_nfacct_result(char *cnt_name, int64_t bytes,
+static void __fill_nfacct_result(char *cnt_name, long long int bytes,
struct counter_arg *carg)
{
stc_monitor_rstn_reset_time_counters_if_required();
populate_counters(cnt_name, carg);
*/
} else {
- int64_t *bytes_p =
- (int64_t *)RTA_DATA(attr_list[NFACCT_BYTES]);
+ long long int *bytes_p =
+ (long long int *)RTA_DATA(attr_list[NFACCT_BYTES]);
int bytes = be64toh(*bytes_p);
if (bytes) {
++carg->serialized_counters;
*/
typedef struct {
char *app_id;
- int64_t rcv_count;
- int64_t snd_count;
+ long long int rcv_count;
+ long long int snd_count;
#ifndef CONFIG_DATAUSAGE_NFACCT
pid_t pid;
#define __TABLE_COUNTERS_H__
typedef struct {
- uint64_t restriction_id;
- int64_t data_counter;
- int64_t warn_counter;
- int64_t monthly_counter;
- int64_t weekly_counter;
- int64_t daily_counter;
+ long long int restriction_id;
+ long long int data_counter;
+ long long int warn_counter;
+ long long int monthly_counter;
+ long long int weekly_counter;
+ long long int daily_counter;
int32_t month_start_date;
- int64_t month_start_ts;
- int64_t week_start_ts;
- int64_t day_start_ts;
+ long long int month_start_ts;
+ long long int week_start_ts;
+ long long int day_start_ts;
} table_counters_info;
typedef stc_cb_ret_e(*table_counters_info_cb)(const table_counters_info *info,
void *user_data);
-stc_error_e table_counters_get(uint64_t restriction_id,
+stc_error_e table_counters_get(long long int restriction_id,
table_counters_info *info);
stc_error_e table_counters_update_counters(const table_counters_info *info);
-stc_error_e table_counters_get_timestamps(uint64_t restriction_id,
+stc_error_e table_counters_get_timestamps(long long int restriction_id,
table_counters_info *info);
stc_error_e table_counters_update_timestamps(const table_counters_info *info);
-stc_error_e table_counters_delete(uint64_t restriction_id);
+stc_error_e table_counters_delete(long long int restriction_id);
stc_error_e table_counters_prepare(sqlite3 *db);
stc_iface_type_e iftype;
stc_rstn_type_e rstn_type;
stc_roaming_type_e roaming;
- int64_t data_limit;
- int64_t data_warn_limit;
- int64_t monthly_limit;
- int64_t weekly_limit;
- int64_t daily_limit;
+ long long int data_limit;
+ long long int data_warn_limit;
+ long long int monthly_limit;
+ long long int weekly_limit;
+ long long int daily_limit;
int month_start_date;
- uint64_t restriction_id;
+ long long int restriction_id;
} table_restrictions_info;
typedef stc_cb_ret_e
__STC_LOG_FUNC_EXIT__;
}
-static bool __table_counters_is_entry_present(uint64_t restriction_id)
+static bool __table_counters_is_entry_present(long long int restriction_id)
{
bool ret = FALSE;
int rc;
- uint64_t l_restriction_id = -1;
+ long long int l_restriction_id = -1;
sqlite3_stmt *stmt = select_restriction_id;
if (sqlite3_bind_int(stmt, 1, restriction_id) != SQLITE_OK) {
return ret;
}
-API stc_error_e table_counters_get(uint64_t restriction_id,
+API stc_error_e table_counters_get(long long int restriction_id,
table_counters_info *info)
{
stc_error_e error_code = STC_ERROR_NONE;
}
//LCOV_EXCL_STOP
-API stc_error_e table_counters_get_timestamps(uint64_t restriction_id,
+API stc_error_e table_counters_get_timestamps(long long int restriction_id,
table_counters_info *info)
{
stc_error_e error_code = STC_ERROR_NONE;
//LCOV_EXCL_STOP
-API stc_error_e table_counters_delete(uint64_t restriction_id)
+API stc_error_e table_counters_delete(long long int restriction_id)
{
stc_error_e error_code = STC_ERROR_NONE;
sqlite3_stmt *stmt = delete_counter;
stc_error_e error_code = STC_ERROR_NONE;
sqlite3_stmt *stmt = update_statistics_query;
stc_hw_net_protocol_type_e hw_net_protocol_type = STC_PROTOCOL_UNKNOWN;
- int64_t rcv;
- int64_t snd;
+ long long int rcv;
+ long long int snd;
if (!stat->rcv_count && !stat->snd_count) {
error_code = STC_ERROR_INVALID_PARAMETER;
add_value_attr(req, str, strlen(str) + 1, type);
}
-static void add_uint64_attr(struct genl *req, const uint64_t v, int type)
+static void add_uint64_attr(struct genl *req, const long long unsigned int v, int type)
{
add_value_attr(req, &v, sizeof(v), type);
}
add_uint64_attr(req, 0, NFACCT_BYTES);
//LCOV_EXCL_START
if (counter->quota) {
- STC_LOGD("quota bytes %"PRId64, counter->quota);
+ STC_LOGD("quota bytes %lld", counter->quota);
add_uint32_attr(req, htobe32(NFACCT_F_QUOTA_BYTES),
NFACCT_FLAGS);
struct counter_arg *carg;
stc_error_e(*iptables_rule)(struct nfacct_rule *counter);
- int64_t quota;
+ long long int quota;
int quota_id;
stc_roaming_type_e roaming;
- int64_t send_limit;
- int64_t rcv_limit;
+ long long int send_limit;
+ long long int rcv_limit;
};
typedef struct nfacct_rule nfacct_rule_s;
}
if (!g_strcmp0(key, STC_PCAP_IFNAME)) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
pcap->ifname = g_strdup(str);
STC_LOGD("ifname: [%s]", pcap->ifname);
}
if (!g_strcmp0(key, "app_id")) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->app_id = g_strdup(str);
STC_LOGD("app_id: [%s]", rule->app_id);
} else if (!g_strcmp0(key, "ifname")) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->ifname = g_strdup(str);
STC_LOGD("ifname: [%s]", rule->ifname);
STC_LOGD("roaming: [%u]", rule->roaming);
} else if (!g_strcmp0(key, "subscriber_id")) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->subscriber_id = g_strdup(str);
STC_LOGD("subscriber_id: [%s]", rule->subscriber_id);
STC_LOGD("type: [%u]", (unsigned int) rule->rstn_type);
} else if (!g_strcmp0(key, "mac")) {
- guint str_length;
+ gsize str_length;
const gchar *str = g_variant_get_string(value, &str_length);
rule->mac = g_strdup(str);
STC_LOGD("mac: [%s]", rule->mac);