static char g_rstn_rule_index[MENU_DATA_SIZE] = "0";
extern stc_h g_stc;
+extern stc_h g_stc_sub;
static stc_restriction_rule_h g_restriction_rule_h = NULL;
static stc_restriction_list_h g_restriction_list_h = NULL;
static int g_restriction_rule_index = 0;
{
int ret = STC_ERROR_NONE;
char *app_id = NULL;
+ stc_h stc = (stc_h)user_data;
msg(HR_SINGLE);
ret = stc_restriction_rule_get_app_id(rule, &app_id);
if (ret == STC_ERROR_NONE)
- msg("Warn threshold crossed app_id: " LOG_CYAN "[%s]" LOG_END, app_id);
+ msg("[%p] Warn threshold crossed app_id: " LOG_CYAN "[%s]" LOG_END, stc, app_id);
g_free(app_id);
msg(HR_SINGLE);
{
int ret = STC_ERROR_NONE;
char *app_id = NULL;
+ stc_h stc = (stc_h)user_data;
msg(HR_SINGLE);
ret = stc_restriction_rule_get_app_id(rule, &app_id);
if (ret == STC_ERROR_NONE)
- msg("Restriction threshold crossed app_id: " LOG_CYAN "[%s]" LOG_END, app_id);
+ msg("[%p] Restriction threshold crossed app_id: " LOG_CYAN "[%s]" LOG_END, stc, app_id);
g_free(app_id);
msg(HR_SINGLE);
int test_stc_restriction_register_cb(void)
{
int ret = stc_set_warn_threshold_crossed_cb(g_stc,
- __test_stc_warn_threshold_crossed_cb, NULL);
+ __test_stc_warn_threshold_crossed_cb, g_stc);
if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to register warn threshold crossed cb" LOG_END);
+ msg(LOG_GREEN "Success to register warn threshold crossed cb [%p]" LOG_END, g_stc);
+ else
+ msg("Fail to register warn threshold crossed cb " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+
+ ret = stc_set_warn_threshold_crossed_cb(g_stc_sub,
+ __test_stc_warn_threshold_crossed_cb, g_stc_sub);
+
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to register warn threshold crossed cb [%p]" LOG_END, g_stc_sub);
else
msg("Fail to register warn threshold crossed cb " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
ret = stc_set_restriction_threshold_crossed_cb(g_stc,
- __test_stc_restriction_threshold_crossed_cb, NULL);
+ __test_stc_restriction_threshold_crossed_cb, g_stc);
+
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to register restriction threshold crossed cb [%p]" LOG_END, g_stc);
+ else
+ msg("Fail to register restriction threshold crossed cb " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+
+ ret = stc_set_restriction_threshold_crossed_cb(g_stc_sub,
+ __test_stc_restriction_threshold_crossed_cb, g_stc_sub);
if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to register restriction threshold crossed cb" LOG_END);
+ msg(LOG_GREEN "Success to register restriction threshold crossed cb [%p]" LOG_END, g_stc_sub);
else
msg("Fail to register restriction threshold crossed cb " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
int ret = stc_unset_warn_threshold_crossed_cb(g_stc);
if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to unregister warn threshold crossed cb" LOG_END);
+ msg(LOG_GREEN "Success to unregister warn threshold crossed cb [%p]" LOG_END, g_stc);
else
msg("Fail to unregister warn threshold crossed cb " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
- ret = stc_unset_restriction_threshold_crossed_cb(g_stc);
+ ret = stc_unset_warn_threshold_crossed_cb(g_stc_sub);
if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to unregister warn threshold crossed cb" LOG_END);
+ msg(LOG_GREEN "Success to unregister warn threshold crossed cb [%p]" LOG_END, g_stc_sub);
else
msg("Fail to unregister warn threshold crossed cb " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
+ ret = stc_unset_restriction_threshold_crossed_cb(g_stc);
+
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to unregister restriction threshold crossed cb [%p]" LOG_END, g_stc);
+ else
+ msg("Fail to unregister restriction threshold crossed cb " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+
+ ret = stc_unset_restriction_threshold_crossed_cb(g_stc_sub);
+
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to unregister restriction threshold crossed cb [%p]" LOG_END, g_stc_sub);
+ else
+ msg("Fail to unregister restriction threshold crossed cb " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+
return ret;
}
extern struct menu_data menu_iptables[];
stc_h g_stc = NULL;
+stc_h g_stc_sub = NULL;
const char *test_stc_convert_error_type_to_string(stc_error_e err)
{
g_stc = NULL;
}
+ if (g_stc_sub) {
+ stc_deinitialize(g_stc_sub);
+ g_stc_sub = NULL;
+ }
+
ret = stc_initialize(&g_stc);
if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to initialize STC" LOG_END);
+ msg(LOG_GREEN "Success to initialize STC [%p]" LOG_END, g_stc);
+ else {
+ msg("Fail to initialize STC " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+ return ret;
+ }
+
+ ret = stc_initialize(&g_stc_sub);
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to initialize STC [%p]" LOG_END, g_stc_sub);
else {
msg("Fail to initialize STC " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
test_stc_convert_error_type_to_string(ret));
}
- g_stc = NULL;
+ if (g_stc_sub) {
+ ret = stc_deinitialize(g_stc_sub);
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to deinitialize STC" LOG_END);
+ else
+ msg("Fail to deinitialize STC " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+ }
+
return ret;
}