From: hyunuktak Date: Wed, 20 Sep 2017 07:40:32 +0000 (+0900) Subject: Replaced imsi to subscriber ID X-Git-Tag: submit/tizen/20170922.065607^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0ded9ab0943ed7867f8817996f4298f9dac63d4;p=platform%2Fcore%2Fapi%2Fsmart-traffic-control.git Replaced imsi to subscriber ID Change-Id: I68c4acc2312b975f2f27cace6052660bd9381e7e Signed-off-by: hyunuktak --- diff --git a/include/stc.h b/include/stc.h index 08cb422..5a8ba11 100755 --- a/include/stc.h +++ b/include/stc.h @@ -233,7 +233,6 @@ typedef enum { * @pre stc_get_total_stats() will invoke this callback. * @see stc_stats_info_get_app_id() * @see stc_stats_info_get_iface_name() - * @see stc_stats_info_get_imsi() * @see stc_stats_info_get_time_interval() * @see stc_stats_info_get_iface_type() * @see stc_stats_info_get_counter() diff --git a/include/stc_internal.h b/include/stc_internal.h index d94916b..d529a4d 100755 --- a/include/stc_internal.h +++ b/include/stc_internal.h @@ -125,7 +125,7 @@ typedef enum { * @pre stc_foreach_restriction() will invoke this callback. * @see stc_restriction_info_get_app_id() * @see stc_restriction_info_get_iface_name() - * @see stc_restriction_info_get_imsi() + * @see stc_restriction_info_get_subscriber_id() * @see stc_restriction_info_get_status() * @see stc_restriction_info_get_iface_type() * @see stc_restriction_info_get_limit() @@ -179,11 +179,11 @@ typedef void (*stc_threshold_crossed_cb)(stc_restriction_info_h info, * @see stc_reset_rule_create() * @see stc_reset_rule_destroy() * @see stc_reset_rule_set_app_id() - * @see stc_reset_rule_set_imsi() + * @see stc_reset_rule_set_subscriber_id() * @see stc_reset_rule_set_iface_type() * @see stc_reset_rule_set_time_interval() * @see stc_reset_rule_get_app_id() - * @see stc_reset_rule_get_imsi() + * @see stc_reset_rule_get_subscriber_id() * @see stc_reset_rule_get_iface_type() * @see stc_reset_rule_get_time_interval() */ @@ -222,13 +222,13 @@ int stc_reset_stats(stc_h stc, stc_reset_rule_h rule); * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_get_restriction() * @see stc_foreach_restriction() @@ -270,13 +270,13 @@ int stc_set_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_set_restriction() * @see stc_get_restriction() @@ -318,13 +318,13 @@ int stc_exclude_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_set_restriction() * @see stc_get_restriction() @@ -368,13 +368,13 @@ int stc_unset_restriction(stc_h stc, stc_restriction_rule_h rule); * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_restriction_info_cb() * @see stc_set_restriction() @@ -430,13 +430,13 @@ int stc_unset_warn_threshold_crossed_cb(stc_h stc); * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_restriction_info_cb() * @see stc_set_restriction() @@ -480,13 +480,13 @@ int stc_foreach_restriction(stc_h stc, stc_restriction_rule_h rule, * @see stc_restriction_rule_set_limit() * @see stc_restriction_rule_set_warning_limit() * @see stc_restriction_rule_set_roaming_type() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() * @see stc_restriction_rule_get_app_id() * @see stc_restriction_rule_get_iface_type() * @see stc_restriction_rule_get_limit() * @see stc_restriction_rule_get_warning_limit() * @see stc_restriction_rule_get_roaming_type() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() * @see stc_restriction_rule_get_process_state() * @see stc_set_restriction() * @see stc_get_restriction() @@ -583,13 +583,13 @@ int stc_reset_rule_destroy(stc_reset_rule_h rule); int stc_reset_rule_set_app_id(stc_reset_rule_h rule, const char *app_id); /** - * @brief Sets the imsi for reset rule. + * @brief Sets the subscriber ID for reset rule. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] rule The reset rule handle - * @param[in] imsi The imsi + * @param[in] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -604,9 +604,9 @@ int stc_reset_rule_set_app_id(stc_reset_rule_h rule, const char *app_id); * @see #stc_reset_rule_h * @see stc_reset_rule_create() * @see stc_reset_rule_destroy() - * @see stc_reset_rule_get_imsi() + * @see stc_reset_rule_get_subscriber_id() */ -int stc_reset_rule_set_imsi(stc_reset_rule_h rule, const char *imsi); +int stc_reset_rule_set_subscriber_id(stc_reset_rule_h rule, const char *subscriber_id); /** * @brief Sets the interface type for reset rule. @@ -691,13 +691,13 @@ int stc_reset_rule_set_time_interval(stc_reset_rule_h rule, int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id); /** - * @brief Gets the imsi for reset rule. + * @brief Gets the subscriber ID for reset rule. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] rule The reset rule handle - * @param[out] imsi The imsi + * @param[out] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -712,9 +712,9 @@ int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id); * @see #stc_reset_rule_h * @see stc_reset_rule_create() * @see stc_reset_rule_destroy() - * @see stc_reset_rule_set_imsi() + * @see stc_reset_rule_set_subscriber_id() */ -int stc_reset_rule_get_imsi(stc_reset_rule_h rule, char **imsi); +int stc_reset_rule_get_subscriber_id(stc_reset_rule_h rule, char **subscriber_id); /** * @brief Gets the interface type for reset rule. @@ -997,13 +997,13 @@ int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule, stc_roaming_type_e roaming_type); /** - * @brief Sets the imsi for restriction rule. + * @brief Sets the subscriber ID for restriction rule. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] rule The restriction rule handle - * @param[in] imsi The imsi + * @param[in] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -1018,9 +1018,9 @@ int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule, * @see #stc_restriction_rule_h * @see stc_restriction_rule_create() * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_get_imsi() + * @see stc_restriction_rule_get_subscriber_id() */ -int stc_restriction_rule_set_imsi(stc_restriction_rule_h rule, const char *imsi); +int stc_restriction_rule_set_subscriber_id(stc_restriction_rule_h rule, const char *subscriber_id); /** * @brief Gets the application ID for restriction rule. @@ -1187,13 +1187,13 @@ int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule, stc_roaming_type_e *roaming_type); /** - * @brief Gets the imsi for restriction rule. + * @brief Gets the subscriber ID for restriction rule. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] rule The restriction rule handle - * @param[out] imsi The imsi + * @param[out] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -1208,17 +1208,17 @@ int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule, * @see #stc_restriction_rule_h * @see stc_restriction_rule_create() * @see stc_restriction_rule_destroy() - * @see stc_restriction_rule_set_imsi() + * @see stc_restriction_rule_set_subscriber_id() */ -int stc_restriction_rule_get_imsi(stc_restriction_rule_h rule, char **imsi); +int stc_restriction_rule_get_subscriber_id(stc_restriction_rule_h rule, char **subscriber_id); /** - * @brief Gets the IMSI from statistics information. + * @brief Gets the subscriber ID from statistics information. * @since_tizen 4.0 - * @remarks You must release @a imsi using free(). + * @remarks You must release @a subscriber ID using free(). * - * @param[in] info The statistics information handle - * @param[out] imsi The IMSI + * @param[in] info The statistics information handle + * @param[out] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -1233,7 +1233,7 @@ int stc_restriction_rule_get_imsi(stc_restriction_rule_h rule, char **imsi); * @see stc_stats_info_h * @see stc_stats_info_cb() */ -int stc_stats_info_get_imsi(stc_stats_info_h info, char **imsi); +int stc_stats_info_get_subscriber_id(stc_stats_info_h info, char **subscriber_id); /** * @brief Gets the application ID for restriction information. @@ -1285,13 +1285,13 @@ int stc_restriction_info_get_iface_name(stc_restriction_info_h info, char **iface_name); /** - * @brief Gets the imsi for restriction information. + * @brief Gets the subscriber ID for restriction information. * @since_tizen 4.0 * @privlevel platform * @privilege %http://tizen.org/privilege/network.get * * @param[in] info The restriction information handle - * @param[out] imsi The imsi + * @param[out] subscriber_id The subscriber ID * * @return 0 on success, otherwise a negative error value * @retval #STC_ERROR_NONE Successful @@ -1306,7 +1306,7 @@ int stc_restriction_info_get_iface_name(stc_restriction_info_h info, * @see #stc_restriction_info_h * @see stc_restriction_info_cb() */ -int stc_restriction_info_get_imsi(stc_restriction_info_h info, char **imsi); +int stc_restriction_info_get_subscriber_id(stc_restriction_info_h info, char **subscriber_id); /** * @brief Gets the restriction status for restriction information. diff --git a/packaging/capi-network-stc.spec b/packaging/capi-network-stc.spec index 93f4d73..62eff2a 100755 --- a/packaging/capi-network-stc.spec +++ b/packaging/capi-network-stc.spec @@ -1,6 +1,6 @@ Name: capi-network-stc Summary: A Smart Traffic Control (STC) libraries in Native API -Version: 0.0.20 +Version: 0.0.21 Release: 1 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/include/stc-info.h b/src/include/stc-info.h index 8cef4eb..b5d4ac9 100755 --- a/src/include/stc-info.h +++ b/src/include/stc-info.h @@ -54,7 +54,7 @@ extern "C" { #define STC_STATS_INFO_APP_ID "app_id" #define STC_STATS_INFO_IFTYPE "iftype" #define STC_STATS_INFO_IFNAME "ifname" -#define STC_STATS_INFO_IMSI "imsi" +#define STC_STATS_INFO_SUBSCRIBER_ID "subscriber_id" #define STC_STATS_INFO_INTERVAL_FROM "interval_from" #define STC_STATS_INFO_INTERVAL_TO "interval_to" #define STC_STATS_INFO_OUTGOING_BYTES "cnt_out_bytes" @@ -67,10 +67,10 @@ extern "C" { #define STC_RESTRICTION_INFO_IFTYPE "iftype" #define STC_RESTRICTION_INFO_IFNAME "ifname" #define STC_RESTRICTION_INFO_DATA_LIMIT "data_limit" -#define STC_RESTRICTION_INFO_DATA_WARN_LIMIT "data_warn_limit" +#define STC_RESTRICTION_INFO_DATA_WARN_LIMIT "data_warn_limit" #define STC_RESTRICTION_INFO_RST_STATUS "rst_state" #define STC_RESTRICTION_INFO_ROAMING "roaming" -#define STC_RESTRICTION_INFO_IMSI "imsi" +#define STC_RESTRICTION_INFO_SUBSCRIBER_ID "subscriber_id" typedef struct { int64_t incoming_bytes; /** imsi); - if (*imsi == NULL) + *subscriber_id = g_strdup(stats_info->subscriber_id); + if (*subscriber_id == NULL) return STC_ERROR_OUT_OF_MEMORY; - STC_LOGI("Imsi [%s]", *imsi); + STC_LOGI("Subscriber ID [%s]", *subscriber_id); return STC_ERROR_NONE; } @@ -298,11 +299,12 @@ EXPORT_API int stc_restriction_info_get_iface_name(stc_restriction_info_h info, return STC_ERROR_NONE; } -EXPORT_API int stc_restriction_info_get_imsi(stc_restriction_info_h info, char **imsi) +EXPORT_API int stc_restriction_info_get_subscriber_id(stc_restriction_info_h info, + char **subscriber_id) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); - if (info == NULL || imsi == NULL) { + if (info == NULL || subscriber_id == NULL) { STC_LOGE("Invalid parameter"); return STC_ERROR_INVALID_PARAMETER; } @@ -310,11 +312,11 @@ EXPORT_API int stc_restriction_info_get_imsi(stc_restriction_info_h info, char * stc_restriction_info_s *restriction_info = (stc_restriction_info_s *)info; - *imsi = g_strdup(restriction_info->imsi); - if (*imsi == NULL) + *subscriber_id = g_strdup(restriction_info->subscriber_id); + if (*subscriber_id == NULL) return STC_ERROR_OUT_OF_MEMORY; - STC_LOGI("Imsi [%s]", *imsi); + STC_LOGI("Subscriber ID [%s]", *subscriber_id); return STC_ERROR_NONE; } diff --git a/src/stc-reset.c b/src/stc-reset.c index 2e407a7..4a56fcd 100755 --- a/src/stc-reset.c +++ b/src/stc-reset.c @@ -98,10 +98,10 @@ static void __stc_reset_stats_make_params( g_variant_new_string(reset_rule->app_id)); } - if (reset_rule->imsi[0] != '\0') { + if (reset_rule->subscriber_id[0] != '\0') { g_variant_builder_add(builder, "{sv}", - STC_RESET_RULE_IMSI, - g_variant_new_string(reset_rule->imsi)); + STC_RESET_RULE_SUBSCRIBER_ID, + g_variant_new_string(reset_rule->subscriber_id)); } if (reset_rule->iface_type != STC_IFACE_UNKNOWN) { @@ -223,7 +223,8 @@ EXPORT_API int stc_reset_rule_set_app_id(stc_reset_rule_h rule, const char *app_ return STC_ERROR_NONE; } -EXPORT_API int stc_reset_rule_set_imsi(stc_reset_rule_h rule, const char *imsi) +EXPORT_API int stc_reset_rule_set_subscriber_id(stc_reset_rule_h rule, + const char *subscriber_id) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); @@ -234,12 +235,12 @@ EXPORT_API int stc_reset_rule_set_imsi(stc_reset_rule_h rule, const char *imsi) stc_reset_rule_s *reset_rule = rule; - if (imsi == NULL) - reset_rule->imsi[0] = '\0'; + if (subscriber_id == NULL) + reset_rule->subscriber_id[0] = '\0'; else - g_strlcpy(reset_rule->imsi, imsi, STC_IMSI_LEN); + g_strlcpy(reset_rule->subscriber_id, subscriber_id, STC_SUBSCRIBER_ID_LEN); - STC_LOGI("Imsi [%s]", reset_rule->imsi); + STC_LOGI("Subscriber ID [%s]", reset_rule->subscriber_id); return STC_ERROR_NONE; } @@ -321,22 +322,23 @@ EXPORT_API int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id) return STC_ERROR_NONE; } -EXPORT_API int stc_reset_rule_get_imsi(stc_reset_rule_h rule, char **imsi) +EXPORT_API int stc_reset_rule_get_subscriber_id(stc_reset_rule_h rule, + char **subscriber_id) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); - if (rule == NULL || imsi == NULL) { + if (rule == NULL || subscriber_id == NULL) { STC_LOGE("Invalid parameter"); return STC_ERROR_INVALID_PARAMETER; } stc_reset_rule_s *reset_rule = (stc_reset_rule_s *)rule; - *imsi = g_strdup(reset_rule->imsi); - if (*imsi == NULL) + *subscriber_id = g_strdup(reset_rule->subscriber_id); + if (*subscriber_id == NULL) return STC_ERROR_OUT_OF_MEMORY; - STC_LOGI("Imsi [%s]", *imsi); + STC_LOGI("Subscriber ID [%s]", *subscriber_id); return STC_ERROR_NONE; } diff --git a/src/stc-restriction.c b/src/stc-restriction.c index 99cdf2f..45c4c1d 100755 --- a/src/stc-restriction.c +++ b/src/stc-restriction.c @@ -72,7 +72,7 @@ static void __stc_restriction_init_rule(stc_restriction_rule_s *rule) rule->data_limit = 0; rule->data_warn_limit = 0; rule->roaming_type = STC_ROAMING_DISABLED; - rule->imsi[0] = '\0'; + rule->subscriber_id[0] = '\0'; } static void __stc_restriction_deinit_rule(stc_restriction_rule_h rule) @@ -106,8 +106,8 @@ static void __stc_restriction_rule_make_params( g_variant_new_uint16(restriction_rule->roaming_type)); g_variant_builder_add(builder, "{sv}", - STC_RESTRICTION_RULE_IMSI, - g_variant_new_string(restriction_rule->imsi)); + STC_RESTRICTION_RULE_SUBSCRIBER_ID, + g_variant_new_string(restriction_rule->subscriber_id)); g_variant_builder_add(builder, "{sv}", STC_RESTRICTION_RULE_DATA_LIMIT, @@ -158,10 +158,10 @@ static void __stc_restriction_extract_info_cb(const char *key, if (iface_name != NULL) g_strlcpy(restriction_info->iface_name, iface_name, STC_IFNAME_LEN); - } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_IMSI)) { - const char *imsi = g_variant_get_string(value, NULL); - if (imsi != NULL) - g_strlcpy(restriction_info->imsi, imsi, STC_IMSI_LEN); + } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_SUBSCRIBER_ID)) { + const char *subscriber_id = g_variant_get_string(value, NULL); + if (subscriber_id != NULL) + g_strlcpy(restriction_info->subscriber_id, subscriber_id, STC_SUBSCRIBER_ID_LEN); } else if (!g_strcmp0(key, STC_RESTRICTION_INFO_IFTYPE)) { restriction_info->iface_type = @@ -196,8 +196,8 @@ static void __stc_restriction_print_info( if (info->iface_type != STC_IFACE_UNKNOWN) STC_LOGD("Iftype: [%s]", _stc_convert_iface_type_to_string(info->iface_type)); - if (info->imsi[0] != '\0') - STC_LOGD("Imsi: [%s]", info->imsi); + if (info->subscriber_id[0] != '\0') + STC_LOGD("Sub_id: [%s]", info->subscriber_id); if (info->roaming_type != STC_ROAMING_UNKNOWN) STC_LOGD("Roaming: [%s]", _stc_convert_roaming_to_string(info->roaming_type)); @@ -483,9 +483,9 @@ stc_error_e _stc_restriction_check_set_rule( "Roaming type is not valid [%s]", _stc_convert_roaming_to_string(restriction_rule->roaming_type)); - STC_RETURN_VAL_IF(restriction_rule->imsi[0] == '\0', + STC_RETURN_VAL_IF(restriction_rule->subscriber_id[0] == '\0', STC_ERROR_INVALID_PARAMETER, - "Imsi is not valid"); + "Subscriber ID is not valid"); return STC_ERROR_NONE; } @@ -587,9 +587,9 @@ stc_error_e _stc_restriction_check_remove_rule( "Roaming type is not valid [%d]", restriction_rule->roaming_type); - STC_RETURN_VAL_IF(restriction_rule->imsi[0] == '\0', + STC_RETURN_VAL_IF(restriction_rule->subscriber_id[0] == '\0', STC_ERROR_INVALID_PARAMETER, - "Imsi is not valid"); + "Subscriber ID is not valid"); return STC_ERROR_NONE; } @@ -629,9 +629,9 @@ stc_error_e _stc_restriction_check_exclude_rule( "Roaming type is not valid [%d]", restriction_rule->roaming_type); - STC_RETURN_VAL_IF(restriction_rule->imsi[0] == '\0', + STC_RETURN_VAL_IF(restriction_rule->subscriber_id[0] == '\0', STC_ERROR_INVALID_PARAMETER, - "Imsi is not valid"); + "Subscriber ID is not valid"); return STC_ERROR_NONE; } @@ -964,7 +964,8 @@ EXPORT_API int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule return STC_ERROR_NONE; } -EXPORT_API int stc_restriction_rule_set_imsi(stc_restriction_rule_h rule, const char *imsi) +EXPORT_API int stc_restriction_rule_set_subscriber_id(stc_restriction_rule_h rule, + const char *subscriber_id) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); @@ -976,12 +977,12 @@ EXPORT_API int stc_restriction_rule_set_imsi(stc_restriction_rule_h rule, const stc_restriction_rule_s *restriction_rule = (stc_restriction_rule_s *)rule; - if (imsi == NULL || strlen(imsi) == 0) - restriction_rule->imsi[0] = '\0'; + if (subscriber_id == NULL || strlen(subscriber_id) == 0) + restriction_rule->subscriber_id[0] = '\0'; else - g_strlcpy(restriction_rule->imsi, imsi, STC_IMSI_LEN); + g_strlcpy(restriction_rule->subscriber_id, subscriber_id, STC_SUBSCRIBER_ID_LEN); - STC_LOGI("Imsi [%s]", restriction_rule->imsi); + STC_LOGI("Subscriber ID [%s]", restriction_rule->subscriber_id); return STC_ERROR_NONE; } @@ -1110,11 +1111,12 @@ EXPORT_API int stc_restriction_rule_get_roaming_type(stc_restriction_rule_h rule return STC_ERROR_NONE; } -EXPORT_API int stc_restriction_rule_get_imsi(stc_restriction_rule_h rule, char **imsi) +EXPORT_API int stc_restriction_rule_get_subscriber_id(stc_restriction_rule_h rule, + char **subscriber_id) { CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC); - if (rule == NULL || imsi == NULL) { + if (rule == NULL || subscriber_id == NULL) { STC_LOGE("Invalid parameter"); return STC_ERROR_INVALID_PARAMETER; } @@ -1122,11 +1124,11 @@ EXPORT_API int stc_restriction_rule_get_imsi(stc_restriction_rule_h rule, char * stc_restriction_rule_s *restriction_rule = (stc_restriction_rule_s *)rule; - *imsi = g_strdup(restriction_rule->imsi); - if (*imsi == NULL) + *subscriber_id = g_strdup(restriction_rule->subscriber_id); + if (*subscriber_id == NULL) return STC_ERROR_OUT_OF_MEMORY; - STC_LOGI("Imsi [%s]", *imsi); + STC_LOGI("Subscriber ID [%s]", *subscriber_id); return STC_ERROR_NONE; } diff --git a/src/stc-statistics.c b/src/stc-statistics.c index 2e20cd0..36d4ba7 100755 --- a/src/stc-statistics.c +++ b/src/stc-statistics.c @@ -194,10 +194,10 @@ static void __stc_stats_extract_info_cb(const char *key, if (iface_name != NULL) g_strlcpy(stats_info->iface_name, iface_name, STC_IFNAME_LEN); - } else if (!g_strcmp0(key, STC_STATS_INFO_IMSI)) { - const char *imsi = g_variant_get_string(value, NULL); - if (imsi != NULL) - g_strlcpy(stats_info->imsi, imsi, STC_IMSI_LEN); + } else if (!g_strcmp0(key, STC_STATS_INFO_SUBSCRIBER_ID)) { + const char *subscriber_id = g_variant_get_string(value, NULL); + if (subscriber_id != NULL) + g_strlcpy(stats_info->subscriber_id, subscriber_id, STC_SUBSCRIBER_ID_LEN); } else if (!g_strcmp0(key, STC_STATS_INFO_INTERVAL_FROM)) { stats_info->interval.from = g_variant_get_uint64(value); //LCOV_EXCL_LINE @@ -242,8 +242,8 @@ static void __stc_stats_print_info(stc_stats_info_s *info) if (info->iface_type != STC_IFACE_UNKNOWN) STC_LOGD("Iftype: [%d]", info->iface_type); - if (info->imsi[0] != '\0') - STC_LOGD("Imsi: [%s]", info->imsi); + if (info->subscriber_id[0] != '\0') + STC_LOGD("Sub_id: [%s]", info->subscriber_id); if (info->roaming_type != STC_ROAMING_UNKNOWN) STC_LOGD("Roaming: [%d]", info->roaming_type); diff --git a/test/restriction.c b/test/restriction.c index 95503f9..1cb93f1 100755 --- a/test/restriction.c +++ b/test/restriction.c @@ -46,7 +46,7 @@ static char g_app_id[MENU_DATA_SIZE] = ""; static char g_iface_name[MENU_DATA_SIZE] = ""; static char g_iface_type[MENU_DATA_SIZE] = "0"; static char g_roaming[MENU_DATA_SIZE] = "0"; -static char g_imsi[MENU_DATA_SIZE] = ""; +static char g_subscriber_id[MENU_DATA_SIZE] = ""; static char g_data_limit[MENU_DATA_SIZE] = "0"; static char g_data_warn_limit[MENU_DATA_SIZE] = "0"; @@ -65,7 +65,7 @@ static stc_callback_ret_e __test_stc_restriction_info_cb( int ret = STC_ERROR_NONE; char *app_id = NULL; char *iface_name = NULL; - char *imsi = NULL; + char *subscriber_id = NULL; stc_restriction_status_e rst_status; stc_iface_type_e iface_type; int64_t data_limit; @@ -82,9 +82,9 @@ static stc_callback_ret_e __test_stc_restriction_info_cb( if (ret == STC_ERROR_NONE) msg("Ifname: [%s]", iface_name); - ret = stc_restriction_info_get_imsi(info, &imsi); + ret = stc_restriction_info_get_subscriber_id(info, &subscriber_id); if (ret == STC_ERROR_NONE) - msg("Imsi: [%s]", imsi); + msg("Sub_id: [%s]", subscriber_id); ret = stc_restriction_info_get_status(info, &rst_status); if (ret == STC_ERROR_NONE) @@ -110,7 +110,7 @@ static stc_callback_ret_e __test_stc_restriction_info_cb( g_free(app_id); g_free(iface_name); - g_free(imsi); + g_free(subscriber_id); return STC_CALLBACK_CONTINUE; } @@ -154,7 +154,7 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu) int64_t data_limit = (int64_t)strtol(g_data_limit, NULL, 10); int64_t data_warn_limit = (int64_t)strtol(g_data_warn_limit, NULL, 10); char *app_id = NULL; - char *imsi = NULL; + char *subscriber_id = NULL; char *iface_name = NULL; int ret = STC_ERROR_NONE; @@ -198,11 +198,11 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu) } } - ret = stc_restriction_rule_set_imsi(g_restriction_rule, g_imsi); + ret = stc_restriction_rule_set_subscriber_id(g_restriction_rule, g_subscriber_id); if (ret == STC_ERROR_NONE) - msg(LOG_GREEN "Success to set imsi" LOG_END); + msg(LOG_GREEN "Success to set subscriber ID" LOG_END); else { - msg("Fail to set imsi " LOG_RED "[%s]" LOG_END, + msg("Fail to set subscriber ID " LOG_RED "[%s]" LOG_END, test_stc_convert_error_type_to_string(ret)); return ret; } @@ -239,10 +239,10 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu) g_free(app_id); } - ret = stc_restriction_rule_get_imsi(g_restriction_rule, &imsi); + ret = stc_restriction_rule_get_subscriber_id(g_restriction_rule, &subscriber_id); if (ret == STC_ERROR_NONE) { - msg("Imsi: " LOG_CYAN "[%s]" LOG_END, imsi); - g_free(imsi); + msg("Sub_id: " LOG_CYAN "[%s]" LOG_END, subscriber_id); + g_free(subscriber_id); } ret = stc_restriction_rule_get_iface_type(g_restriction_rule, &iface_type); @@ -453,7 +453,7 @@ int test_stc_restriction_unregister_cb(void) static struct menu_data menu_restriction_rule[] = { { "1", "Application ID", NULL, NULL, g_app_id}, - { "2", "Imsi", NULL, NULL, g_imsi}, + { "2", "Subscriber ID", NULL, NULL, g_subscriber_id}, { "3", "Interface type(1.Tel/2.Wifi/3.Wired/4.BT/5.All)", NULL, NULL, g_iface_type}, { "4", "Interface name", NULL, NULL, g_iface_name}, { "5", "Roaming(1.Enable/2.Disable)", NULL, NULL, g_roaming}, diff --git a/test/statistics.c b/test/statistics.c index cb8be27..73c7937 100755 --- a/test/statistics.c +++ b/test/statistics.c @@ -43,7 +43,7 @@ #include "stc_menu.h" static char g_reset_app_id[MENU_DATA_SIZE] = ""; -static char g_reset_imsi[MENU_DATA_SIZE] = ""; +static char g_reset_subscriber_id[MENU_DATA_SIZE] = ""; static char g_reset_iface_type[MENU_DATA_SIZE] = "0"; static char g_stats_app_id[MENU_DATA_SIZE] = ""; @@ -77,7 +77,7 @@ static stc_callback_ret_e __test_stc_stats_info_cb( int ret = STC_ERROR_NONE; char *app_id = NULL; char *iface_name = NULL; - char *imsi = NULL; + char *subscriber_id = NULL; time_t from; time_t to; stc_iface_type_e iface_type; @@ -97,9 +97,9 @@ static stc_callback_ret_e __test_stc_stats_info_cb( if (ret == STC_ERROR_NONE) msg("Ifname: [%s]", iface_name); - ret = stc_stats_info_get_imsi(info, &imsi); + ret = stc_stats_info_get_subscriber_id(info, &subscriber_id); if (ret == STC_ERROR_NONE) - msg("Imsi: [%s]", imsi); + msg("Sub_id: [%s]", subscriber_id); ret = stc_stats_info_get_iface_type(info, &iface_type); if (ret == STC_ERROR_NONE) @@ -133,7 +133,7 @@ static stc_callback_ret_e __test_stc_stats_info_cb( g_free(app_id); g_free(iface_name); - g_free(imsi); + g_free(subscriber_id); return STC_CALLBACK_CONTINUE; } @@ -143,7 +143,7 @@ static int __test_stc_set_reset_rule(MManager *mm, struct menu_data *menu) int ret = STC_ERROR_NONE; stc_iface_type_e iface_type = (int)strtol(g_reset_iface_type, NULL, 10); char *app_id = NULL; - char *imsi = NULL; + char *subscriber_id = NULL; ret = stc_reset_rule_set_app_id(g_reset_rule, g_reset_app_id); if (ret == STC_ERROR_NONE) @@ -154,11 +154,11 @@ static int __test_stc_set_reset_rule(MManager *mm, struct menu_data *menu) return ret; } - ret = stc_reset_rule_set_imsi(g_reset_rule, g_reset_imsi); + ret = stc_reset_rule_set_subscriber_id(g_reset_rule, g_reset_subscriber_id); if (ret == STC_ERROR_NONE) - msg(LOG_GREEN "Success to set imsi" LOG_END); + msg(LOG_GREEN "Success to set subscriber ID" LOG_END); else { - msg("Fail to set imsi " LOG_RED "[%s]" LOG_END, + msg("Fail to set subscriber ID " LOG_RED "[%s]" LOG_END, test_stc_convert_error_type_to_string(ret)); return ret; } @@ -182,10 +182,10 @@ static int __test_stc_set_reset_rule(MManager *mm, struct menu_data *menu) g_free(app_id); } - ret = stc_reset_rule_get_imsi(g_reset_rule, &imsi); + ret = stc_reset_rule_get_subscriber_id(g_reset_rule, &subscriber_id); if (ret == STC_ERROR_NONE) { - msg("Imsi: " LOG_CYAN "[%s]" LOG_END, imsi); - g_free(imsi); + msg("Sub_id: " LOG_CYAN "[%s]" LOG_END, subscriber_id); + g_free(subscriber_id); } ret = stc_reset_rule_get_iface_type(g_reset_rule, &iface_type); @@ -447,7 +447,7 @@ int test_stc_stats_rule_destroy(void) static struct menu_data menu_reset_rule[] = { { "1", "Application ID", NULL, NULL, g_reset_app_id}, - { "2", "Imsi", NULL, NULL, g_reset_imsi}, + { "2", "Subscriber ID", NULL, NULL, g_reset_subscriber_id}, { "3", "Interface type (1.Tel/2.Wifi/3.Wired/4.BT/5.All)", NULL, NULL, g_reset_iface_type}, { "s", LOG_LIGHTMAGENTA "[Set]" LOG_END, NULL, __test_stc_set_reset_rule, NULL}, { NULL, NULL, }, diff --git a/test/stc_test.c b/test/stc_test.c index fbe3d46..63ab417 100755 --- a/test/stc_test.c +++ b/test/stc_test.c @@ -43,7 +43,7 @@ #define STC_APP_ID_LEN 128 #define STC_IFNAME_LEN 16 -#define STC_IMSI_LEN 64 +#define STC_SUBSCRIBER_ID_LEN 128 extern struct menu_data menu_statistics[]; extern struct menu_data menu_restriction[];