Name: inm-manager
Summary: INM(Intelligent Network Monitoring) daemon
-Version: 0.0.17
+Version: 0.0.18
Release: 1
Group: Network & Connectivity/Other
License: Apache-2.0
double tcp_retrans_data = curr_retrans - prev_retrans ;
double tcp_trans_data = curr_transmit - prev_transmit;
- INM_LOGI("transmitted %lf retarnsmitted %lf after 10 seconds", tcp_trans_data, tcp_retrans_data);
+ INM_LOGI("transmitted %lf retarnsmitted %lf after 10 seconds",
+ tcp_trans_data,
+ tcp_retrans_data);
if (tcp_retrans_data == 0 && tcp_trans_data == 0)
INM_LOGI("Tcp data is not transmitted yet.");
else
retrans_rate = (tcp_retrans_data/tcp_trans_data) * 100;
- if(buffer)
+ if (buffer)
free(buffer);
*status = retrans_rate;
return 0;
GVariant *value = NULL;
connman_service_s *service = NULL;
- __INM_FUNC_ENTER__;
service = g_hash_table_lookup(service_tbl, object_path);
if (!service) {
__INM_FUNC_EXIT__;
inm_connman_service_write(object_path, TRUE);
g_variant_unref(value);
- __INM_FUNC_EXIT__;
}
static inline void __add_wifi_priv_info(connman_service_s *service, GVariantIter *iter)
const gchar *key = NULL;
GVariant *value = NULL;
- __INM_FUNC_ENTER__;
- if (!service || !iter) {
- __INM_FUNC_EXIT__;
+ if (!service || !iter)
return;
- }
while (g_variant_iter_loop(iter, "{sv}", &key, &value))
__fill_sec_info(key, value, service);
- __INM_FUNC_EXIT__;
return;
}
static inline void __add_cell_priv_info(connman_service_s *service)
{
int ret = 0;
- __INM_FUNC_ENTER__;
if (!service)
return;
if (ret < 0)
INM_LOGI("get pdp profile failed");
- __INM_FUNC_EXIT__;
return;
}
connman_service_s *service = NULL;
gchar *key = NULL;
- __INM_FUNC_ENTER__;
-
if (!path || ! iter) {
INM_LOGW("NULL path or iter");
return;
PRINT_LOG("<Connman service %s:Property changed>", path);
inm_connman_service_write(path, TRUE);
- __INM_FUNC_EXIT__;
return;
}
fd = g_io_channel_unix_get_fd(channel);
+ INM_LOGI("Net link event");
length = recvfrom(fd, buf, sizeof(buf), 0,
(struct sockaddr *)&nladdr, &addr_len);
+
+ INM_LOGI("%d received", length);
if (length < 0) {
strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
INM_LOGE("Failed to get netlink message [error: %s]", error_buf);
static gboolean __inmmanager_send_netlink_cmd(gpointer user_data)
{
- __INM_FUNC_ENTER__;
-
int err;
struct nl_msg *msg;
inmmanager_mon_data_s *data = (inmmanager_mon_data_s*)user_data;
if (data->timer_source_id == 0) {
INM_LOGI("monitoring stopped, timer_source_id: %d.", data->timer_source_id);
- __INM_FUNC_EXIT__;
return FALSE;
}
msg = nlmsg_alloc();
if (msg == NULL) {
INM_LOGE("Failed to allocate netlink message");
- __INM_FUNC_EXIT__;
return FALSE;
}
while (err > 0)
nl_recvmsgs(global->socket, global->cb);
+ INM_LOGI("Kernel message received");
out:
nlmsg_free(msg);
- __INM_FUNC_EXIT__;
return TRUE;
}
GList *p_list;
inm_rtnl_link_s *tmp = NULL;
- __INM_FUNC_ENTER__;
p_list = g_list_find_custom(g_list_links,
p_link,
__link_compare);
tmp = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
if (!tmp) {
INM_LOGE("link allocation failed");
- __INM_FUNC_EXIT__;
return;
}
__link_copy(p_link, tmp);
g_list_links = g_list_prepend(g_list_links, tmp);
}
- __INM_FUNC_EXIT__;
}
static inline void __link_remove(inm_rtnl_link_s *p_link)
GList *p_list;
inm_rtnl_link_s *tmp = NULL;
- __INM_FUNC_ENTER__;
p_list = g_list_find_custom(g_list_links,
p_link,
__link_compare);
g_list_links = g_list_remove(g_list_links, p_list->data);
__link_destroy(tmp);
}
- __INM_FUNC_EXIT__;
}
static void __link_recv_cb(int action,
void *user_data)
{
inm_rtnl_link_s *p_link = NULL;
- __INM_FUNC_ENTER__;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_link = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
if (!p_link) {
INM_LOGE("link mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__link_destroy(p_link);
+ INM_LOGI("Link cache received");
util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_LINK]),
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_LINK].foreach_cb,
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_LINK].user_data);
-
- __INM_FUNC_EXIT__;
}
static void __link_foreach_cb(struct nl_object *obj, void *user_data)
{
inm_rtnl_link_s *p_link;
- __INM_FUNC_ENTER__;
-
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_link = (inm_rtnl_link_s *)g_try_malloc0(sizeof(inm_rtnl_link_s));
if (!p_link) {
INM_LOGE("link mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__link_destroy(p_link);
__rtnl_link_log((struct rtnl_link *)obj);
-
- __INM_FUNC_EXIT__;
}
static inline void __rtnl_addr_log(struct rtnl_addr *p_rtnl_addr)
struct nl_object *obj,
void *user_data)
{
- __INM_FUNC_ENTER__;
inm_rtnl_addr_s *p_addr = NULL;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_addr = (inm_rtnl_addr_s *)g_try_malloc0(sizeof(inm_rtnl_addr_s));
if (!p_addr) {
INM_LOGE("addr mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__addr_destroy(p_addr);
+ INM_LOGI("Addr cache received");
util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_ADDR]),
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ADDR].foreach_cb,
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ADDR].user_data);
-
- __INM_FUNC_EXIT__;
}
static void __addr_foreach_cb(struct nl_object *obj, void *user_data)
{
- __INM_FUNC_ENTER__;
inm_rtnl_addr_s *p_addr = NULL;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_addr = (inm_rtnl_addr_s *)g_try_malloc0(sizeof(inm_rtnl_addr_s));
if (!p_addr) {
INM_LOGE("addr mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__addr_destroy(p_addr);
__rtnl_addr_log((struct rtnl_addr *)obj);
-
- __INM_FUNC_EXIT__;
}
static inline void __rtnl_neigh_log(struct rtnl_neigh *p_rtnl_neigh)
{
inm_rtnl_neigh_s *p_neigh = NULL;
- __INM_FUNC_ENTER__;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_neigh = (inm_rtnl_neigh_s *)g_try_malloc0(sizeof(inm_rtnl_neigh_s));
if (!p_neigh) {
INM_LOGE("neigh mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__neigh_destroy(p_neigh);
+ INM_LOGI("Neigh cache received");
util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_NEIGH]),
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_NEIGH].foreach_cb,
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_NEIGH].user_data);
-
- __INM_FUNC_EXIT__;
}
static void __neigh_foreach_cb(struct nl_object *obj, void *user_data)
{
inm_rtnl_neigh_s *p_neigh = NULL;
- __INM_FUNC_ENTER__;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_neigh = (inm_rtnl_neigh_s *)g_try_malloc0(sizeof(inm_rtnl_neigh_s));
if (!p_neigh) {
INM_LOGE("neigh mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__neigh_destroy(p_neigh);
__rtnl_neigh_log((struct rtnl_neigh *)obj);
-
- __INM_FUNC_EXIT__;
}
static void __next_hop_log_cb(struct rtnl_nexthop *nh, void *data)
{
inm_rtnl_route_s *p_route = NULL;
- __INM_FUNC_ENTER__;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_route = (inm_rtnl_route_s *)g_try_malloc0(sizeof(inm_rtnl_route_s));
if (!p_route) {
INM_LOGE("route mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__route_destroy(p_route);
+ INM_LOGI("Route cache received");
util_foreach_nl_data(&(nl_data_arr[INM_UTIL_RTNL_TYPE_ROUTE]),
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ROUTE].foreach_cb,
rtnl_obj_cbs[INM_UTIL_RTNL_TYPE_ROUTE].user_data);
-
- __INM_FUNC_EXIT__;
}
static void __route_foreach_cb(struct nl_object *obj, void *user_data)
{
inm_rtnl_route_s *p_route = NULL;
- __INM_FUNC_ENTER__;
- if (!obj) {
- __INM_FUNC_EXIT__;
+ if (!obj)
return;
- }
p_route = (inm_rtnl_route_s *)g_try_malloc0(sizeof(inm_rtnl_route_s));
if (!p_route) {
INM_LOGE("route mem alloc failed");
- __INM_FUNC_EXIT__;
return;
}
__route_destroy(p_route);
__rtnl_route_log((struct rtnl_route *)obj);
-
- __INM_FUNC_EXIT__;
}
static void __clear_all_nl_data()
GVariantIter *modem_properties = NULL;
GSList **modem_path_list;
const char *modem_path;
- __INM_FUNC_ENTER__;
if (!reply || !user_data)
return;
g_variant_iter_free(iter);
- __INM_FUNC_EXIT__;
return;
}
{
int ret = 0;
- __INM_FUNC_ENTER__;
method_param_s tel_method_params = {
.bus_name = TELEPHONY_SERVICE,
.object_path = TELEPHONY_MASTER_PATH,
(gpointer)modem_path_list);
if (ret != INM_GDBUS_ERROR_NONE) {
INM_LOGE("Failed to get modem paths");
- __INM_FUNC_EXIT__;
return -1;
}
- __INM_FUNC_EXIT__;
return 0;
}
profile_list = __get_profile_list();
count = g_slist_length(profile_list);
- INM_LOGI("[%d] profile found", count);
if (count > 0) {
p_profile_name = (inm_profile_name_s*)g_try_malloc0(sizeof(inm_profile_name_s) * count);
ret = 0;
out:
g_slist_free_full(profile_list, g_free);
- __INM_FUNC_EXIT__;
return ret;
}
gchar *str_ptr = NULL;
int i = 0;
- INM_LOGI("search connman profile name[%s] from %d list",
- profile_name, profile_cnt);
connman_profile_name = strrchr(profile_name, '/') + 1;
for (i = 0; i < profile_cnt; i++) {
telephony_profile_name = strrchr(profile_list[i].profile_name, '/') + 1;
str_ptr = strstr(connman_profile_name, telephony_profile_name);
- if (str_ptr != NULL && g_strcmp0(str_ptr, telephony_profile_name) == 0) {
-
- INM_LOGI("PDP profile name found in cellular profile: %s, %d",
- telephony_profile_name, i);
+ if (str_ptr != NULL && g_strcmp0(str_ptr, telephony_profile_name) == 0)
break;
- } else {
- INM_LOGI("[%s] not matched", telephony_profile_name);
- }
}
return i;
int profile_cnt = 0;
int idx = 0;
- __INM_FUNC_ENTER__;
-
/* Get pdp profile list from telephony service */
ret = __get_profile_names(&profile_list, &profile_cnt);
if (ret < 0) {
INM_LOGW("Failed to get profile list from telephony service");
- __INM_FUNC_EXIT__;
return -1;
}
if (profile_list == NULL || profile_cnt <= 0) {
INM_LOGW("There is no PDP profiles");
g_free(profile_list);
- __INM_FUNC_EXIT__;
return -1;
}
g_free(profile_list);
- __INM_FUNC_EXIT__;
return ret;
}
static int __get_profile_info(inm_telephony_profile_s *profile_info)
{
int ret = 0;
- __INM_FUNC_ENTER__;
if (profile_info == NULL) {
INM_LOGW("Invalid parameter!");
- __INM_FUNC_EXIT__;
return -1;
}
(gpointer)profile_info);
if (ret != INM_GDBUS_ERROR_NONE) {
INM_LOGE("Failed to get profile");
- __INM_FUNC_EXIT__;
return -1;
}
- __INM_FUNC_EXIT__;
return 0;
}
{
inm_util_nl_data_s *nl_data = NULL;
- __INM_FUNC_ENTER__;
if (!obj)
return;
- if (action == NL_ACT_NEW)
+ if (action == NL_ACT_NEW) {
+ INM_LOGI("Added");
PRINT_LOG("<Netlink cache object action:Add>");
- else if (action == NL_ACT_DEL)
+ } else if (action == NL_ACT_DEL) {
+ INM_LOGI("Deleted");
PRINT_LOG("<Netlink cache object action:Delete>");
- else if (action == NL_ACT_CHANGE)
+ } else if (action == NL_ACT_CHANGE) {
+ INM_LOGI("Changed");
PRINT_LOG("<Netlink cache object action:Change>");
+ }
nl_data = (inm_util_nl_data_s *)data;
if (nl_data->obj_recv_func)
nl_data->obj_recv_func(action, obj, nl_data->user_data);
-
- __INM_FUNC_EXIT__;
}
static gboolean __nl_cache_cb(GIOChannel *source,
{
struct nl_cache_mngr * p_nl_cm = NULL;
int res = 0;
- __INM_FUNC_ENTER__;
if (!data) {
- __INM_FUNC_EXIT__;
+ INM_LOGE("Data lost");
return TRUE;
}
p_nl_cm = (struct nl_cache_mngr *)data;
res = nl_cache_mngr_data_ready(p_nl_cm);
- INM_LOGI("%d res nl_cache_mngr_data_ready", res);
-
- __INM_FUNC_EXIT__;
+ INM_LOGI("%d message processed", res);
return TRUE;
}
int nl_cache_cnt;
int i;
- __INM_FUNC_ENTER__;
if (!cb || !nl_data || !nl_data->p_nl_mgr_cache || !nl_data->p_nl_mgr) {
INM_LOGW("Null data");
- __INM_FUNC_EXIT__;
return;
}
cb(p_nl_obj, user_data);
}
- __INM_FUNC_EXIT__;
return;
}