int stc_plugin_appstatus_init(void);
int stc_plugin_appstatus_deinit(void);
-int stc_plugin_appstatus_send_warn_message(const char *content,
- const char *type, const char *app_id, const char *iftype, const char *warn);
-int stc_plugin_appstatus_send_restriction_message(const char *content,
+int stc_plugin_appstatus_send_message(const char *content,
const char *type, const char *app_id, const char *iftype, const char *limit);
int stc_plugin_appstatus_register_state_changed_cb(stc_s *stc,
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.70
+Version: 0.0.71
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
typedef struct {
/* popup */
- int (*send_restriction_message_to_net_popup) (const char *,
- const char *, const char *, const char *, const char *);
- int (*send_warn_message_to_net_popup) (const char *,
- const char *, const char *, const char *, const char *);
+ int (*send_message_to_net_popup) (const char *, const char *,
+ const char *, const char *, const char *);
/* app status */
int (*register_state_changed_cb) (stc_s *stc,
stc_plugin_app_state_changed_cb cb, void *data);
int (*deregister_state_changed_cb) (stc_s *stc);
} stc_plugin_appstatus_s;
-int stc_plugin_popup_send_restriction_message(const char *content,
- const char *type, const char *app_id, const char *iftype, const char *limit);
-int stc_plugin_popup_send_restriction_message(const char *content,
+int stc_plugin_popup_send_message(const char *content,
const char *type, const char *app_id, const char *iftype, const char *limit);
int stc_plugin_appstatus_register_changed_cb(stc_s *stc,
return 0;
}
-int stc_plugin_popup_send_warn_message(const char *content,
- const char *type, const char *app_id, const char *iftype, const char *warn)
-{
- int ret = 0;
- bundle *b = bundle_create();
-
- STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] warn[%s]",
- content, type, app_id, warn);
-
- bundle_add(b, "_SYSPOPUP_CONTENT_", content);
- bundle_add(b, "_SYSPOPUP_TYPE_", type);
- bundle_add(b, "_APP_ID_", app_id);
- bundle_add(b, "_IF_TYPE_", iftype);
- bundle_add(b, "_WARN_LIMIT_", warn);
-
- ret = syspopup_launch("net-popup", b);
-
- bundle_free(b);
-
- return ret;
-}
-
-int stc_plugin_popup_send_restriction_message(const char *content,
+int stc_plugin_popup_send_message(const char *content,
const char *type, const char *app_id, const char *iftype, const char *limit)
{
int ret = 0;
bundle *b = bundle_create();
- STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
- content, type, app_id, limit);
-
bundle_add(b, "_SYSPOPUP_CONTENT_", content);
bundle_add(b, "_SYSPOPUP_TYPE_", type);
bundle_add(b, "_APP_ID_", app_id);
bundle_add(b, "_IF_TYPE_", iftype);
- bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+
+ if (g_strcmp0(type, "warning_noti") == 0) {
+ bundle_add(b, "_WARN_LIMIT_", limit);
+ STC_LOGD("Warn message : content[%s] type[%s] app_id[%s] limit[%s]",
+ content, type, app_id, limit);
+ } else {
+ bundle_add(b, "_RESTRICTION_LIMIT_", limit);
+ STC_LOGD("Restriction message : content[%s] type[%s] app_id[%s] limit[%s]",
+ content, type, app_id, limit);
+ }
ret = syspopup_launch("net-popup", b);
}
API stc_plugin_appstatus_s stc_plugin_appstatus = {
- .send_warn_message_to_net_popup =
- stc_plugin_popup_send_warn_message,
- .send_restriction_message_to_net_popup =
- stc_plugin_popup_send_restriction_message,
+ .send_message_to_net_popup =
+ stc_plugin_popup_send_message,
.register_state_changed_cb =
stc_plugin_appstatus_register_changed_cb,
.deregister_state_changed_cb =
char iftype[MAX_INT_LENGTH];
char byte[MAX_INT_LENGTH];
const char *signal_name;
+ const char *net_popup_content;
+ const char *net_popup_type;
stc_s *stc = (stc_s *)stc_get_manager();
if (stc == NULL) {
case STC_RSTN_LIMIT_TYPE_DATA_WARN:
{
signal_name = "WarnThresholdCrossed";
-
- snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
- snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
- stc_plugin_appstatus_send_warn_message("warn threshold crossed",
- "warning_noti",
- rstn_key->app_id,
- iftype, byte);
+ net_popup_content = "warn threshold crossed";
+ net_popup_type = "warning_noti";
}
break;
case STC_RSTN_LIMIT_TYPE_DATA:
case STC_RSTN_LIMIT_TYPE_DAILY:
{
signal_name = "RestrictionThresholdCrossed";
+ net_popup_content = "restriction threshold crossed";
+ net_popup_type = "restriction_noti";
/* block immediately */
context->counter->intend = NFACCT_BLOCK;
context->counter->intend = NFACCT_COUNTER;
rstn_value->limit_exceeded |= (1 << limit_type);
-
- snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
- snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
- stc_plugin_appstatus_send_restriction_message("restriction threshold crossed",
- "restriction_noti",
- rstn_key->app_id,
- iftype, byte);
}
break;
default:
if (rv == TRUE)
rstn_value->limit_notified |= (1 << limit_type);
+
+ snprintf(iftype, MAX_INT_LENGTH, "%d", rstn_key->iftype);
+ snprintf(byte, MAX_INT_LENGTH, "%lld", rstn_value->limit[limit_type]);
+ stc_plugin_appstatus_send_message(net_popup_content,
+ net_popup_type, rstn_key->app_id, iftype, byte);
}
static gboolean __rstn_counter_update(stc_rstn_key_s *rstn_key,
return STC_ERROR_NONE;
}
-int stc_plugin_appstatus_send_warn_message(const char *content,
- const char *type, const char *app_id, const char *iftype, const char *warn)
-{
- __STC_LOG_FUNC_ENTER__;
-
- if (!stc_plugin_enabled) {
- STC_LOGE("Plugin wasn't enabled");
- __STC_LOG_FUNC_EXIT__;
- return STC_ERROR_UNINITIALIZED;
- }
-
- if (!stc_plugin) {
- STC_LOGE("Plugin wasn't loaded");
- __STC_LOG_FUNC_EXIT__;
- return STC_ERROR_UNINITIALIZED;
- }
-
- __STC_LOG_FUNC_EXIT__;
- return stc_plugin->send_warn_message_to_net_popup(content,
- type, app_id, iftype, warn);
-}
-
-int stc_plugin_appstatus_send_restriction_message(const char *content,
+int stc_plugin_appstatus_send_message(const char *content,
const char *type, const char *app_id, const char *iftype, const char *limit)
{
__STC_LOG_FUNC_ENTER__;
}
__STC_LOG_FUNC_EXIT__;
- return stc_plugin->send_restriction_message_to_net_popup(content,
- type, app_id, iftype, limit);
+ return stc_plugin->send_message_to_net_popup(content,
+ type, app_id, iftype, limit);
}
int stc_plugin_appstatus_register_state_changed_cb(stc_s *stc,