Remove unused files and sync function names in test 17/201817/3
authorYu <jiung.yu@samsung.com>
Wed, 20 Mar 2019 00:52:45 +0000 (09:52 +0900)
committerYu <jiung.yu@samsung.com>
Wed, 20 Mar 2019 01:16:56 +0000 (10:16 +0900)
Change-Id: I7ec8c92b4ba55305d07aa9334ffd0dac26c82c02
Signed-off-by: Yu Jiung <jiung.yu@samsung.com>
packaging/inm-manager.spec
src/inm-supplicant-bss.c [deleted file]
src/inm-supplicant-network.c [deleted file]
test/CMakeLists.txt
test/inm-test.c

index 8a11e1617235fcc86b4555cb78fc88d0e5b36476..e9cc3b4f09415a54db222f28678889cde27999fc 100644 (file)
@@ -1,6 +1,6 @@
 Name:       inm-manager
 Summary:    INM(Intelligent Network Monitoring) daemon
-Version:    0.0.13
+Version:    0.0.14
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
diff --git a/src/inm-supplicant-bss.c b/src/inm-supplicant-bss.c
deleted file mode 100644 (file)
index 603cc5f..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * Network Monitoring Module
- *
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
- * This file implements functions for handling signal from WPA Supplicant BSS interface.
- *
- * @file        nm-supplicant-bss.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- * @version     0.1
- */
-
-#include <string.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-
-#include "inm-util.h"
-#include "inm-manager-log.h"
-#include "inm-gdbus.h"
-#include "inm-supplicant.h"
-#include "inm-supplicant-internal.h"
-
-typedef enum {
-       BSS_SIGNAL_PROPERTIESCHANGED,
-       BSS_SIGNAL_MAX,
-} supplicant_bss_signal_e;
-
-typedef struct {
-       guint key_mgmt;
-       guint pairwaise;
-       guint group;
-} wpa_s;
-
-typedef struct {
-       guint key_mgmt;
-       guint pairwaise;
-       guint group;
-       guint mgmt_group;
-} rsn_s;
-
-typedef struct {
-       /*
-        * BSSID of the BSS.
-        */
-       guchar bssid[BSSID_LEN];
-       /*
-        * SSID of the BSS.
-        */
-       gchar ssid[SSID_LEN + 1];
-       /*
-        * WPA information of the BSS.
-        */
-       wpa_s wpa;
-       /*
-        * RSN information of the BSS.
-        */
-       rsn_s rsn;
-       /*
-        * WPS information of the BSS.
-        */
-       guint wps_type;
-       /*
-        * indicates if BSS supports privacy.
-        */
-       gboolean private;
-       /*
-        * Describes mode of the BSS.
-        * Possible values are: "ad-hoc" and "infrastructure".
-        */
-       guint mode;
-       /*
-        * Frequency of the BSS in MHz.
-        */
-       guint16 frequency;
-
-       /*
-        * Signal strength of the BSS.
-        */
-       gint16 signal;
-       /*
-        * Number of seconds since the BSS was last seen.
-        */
-       guint age;
-
-       guint subscriber_id[BSS_SIGNAL_MAX];
-} supplicant_bss_s;
-
-static DECLARE_DBUS_SIGNAL_HANDLER_W_DATA(bss_properties_changed);
-
-static signal_param_s bss_signal_params[] = {
-               {
-                       .sender = SUPPLICANT_SERVICE,
-                       .interface_name = SUPPLICANT_IFACE_BSS,
-                       .member = DBUS_SIGNAL_PROPERTIES_CHANGED,
-                       .object_path = NULL,
-                       .arg0 = NULL,
-                       .callback_with_data = __bss_properties_changed,
-                       .subscriber_id  = 0,
-               }
-};
-
-static method_param_s get_bss_property_method_param = {
-               .bus_name = SUPPLICANT_SERVICE,
-               .object_path = NULL,
-               .interface_name = DBUS_PROPERTIES_INTERFACE,
-               .method_name = DBUS_PROPERTIES_METHOD_GETALL,
-               .parameters = NULL,
-};
-
-static inline int __subscribe_bss_signal(const gchar *path, supplicant_bss_s *bss_data)
-{
-       int ret = INM_GDBUS_ERROR_NONE;
-       int signal_idx = 0;
-       __INM_FUNC_ENTER__;
-
-       if (!path || !bss_data) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       INM_LOGI("path [%s]", path);
-       for (signal_idx = BSS_SIGNAL_PROPERTIESCHANGED; signal_idx < BSS_SIGNAL_MAX; signal_idx++) {
-               bss_signal_params[signal_idx].object_path = path;
-               ret = inm_gdbus_subscribe_signal_with_data(&(bss_signal_params[signal_idx]), bss_data);
-               if (ret != INM_GDBUS_ERROR_NONE)
-                       INM_LOGI("Error! Failed to subscribe signal");
-               else
-                       bss_data->subscriber_id[signal_idx] =
-                                       bss_signal_params[signal_idx].subscriber_id;
-       }
-
-       __INM_FUNC_EXIT__;
-       return INM_SUPPLICANT_ERROR_NONE;
-}
-
-static inline int __unsubscribe_bss_signal(supplicant_bss_s *bss_data)
-{
-       int signal_idx = 0;
-       int ret = INM_GDBUS_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-       if (!bss_data) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       for (signal_idx = BSS_SIGNAL_PROPERTIESCHANGED; signal_idx < BSS_SIGNAL_MAX; signal_idx++) {
-
-               if (bss_data->subscriber_id[signal_idx] == 0)
-                       continue;
-
-               bss_signal_params[signal_idx].subscriber_id = bss_data->subscriber_id[signal_idx];
-               ret = inm_gdbus_unsubscribe_signal(&(bss_signal_params[signal_idx]));
-               if (ret != INM_GDBUS_ERROR_NONE)
-                       INM_LOGI("Error! Failed to unsubscribe signal");
-               else
-                       bss_data->subscriber_id[signal_idx] = 0;
-       }
-
-       __INM_FUNC_EXIT__;
-       return INM_SUPPLICANT_ERROR_NONE;
-}
-
-void inm_supplicant_bss_destroy(gpointer data)
-{
-       supplicant_bss_s *bss_data = (supplicant_bss_s *)data;
-       __INM_FUNC_ENTER__;
-
-       INM_LOGI("BSS destroyed [%s]", bss_data->ssid);
-
-       __unsubscribe_bss_signal(bss_data);
-
-       g_free(bss_data);
-       __INM_FUNC_EXIT__;
-       return;
-}
-/*
-static inline void __get_pairwise(GVariant *value, guint *pairwaise)
-{
-       GVariantIter *iter = NULL;
-       const gchar *str = NULL;
-
-       g_variant_get(value, "as", &iter);
-       if (!iter) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       *pairwaise = 0;
-       while (g_variant_iter_loop(iter, "&s", &str)) {
-               if (g_strcmp0(str, "none") == 0)
-                       *pairwaise = *pairwaise | PAIRWISE_CAP_NONE;
-               else if (g_strcmp0(str, "ccmp") == 0)
-                       *pairwaise = *pairwaise | PAIRWISE_CAP_CCMP;
-               else if (g_strcmp0(str, "tkip") == 0)
-                       *pairwaise = *pairwaise | PAIRWISE_CAP_TKIP;
-       }
-       g_variant_iter_free(iter);
-}
-
-static inline void __get_group(GVariant *value, guint *group)
-{
-       GVariantIter *iter = NULL;
-       const gchar *str = NULL;
-
-       g_variant_get(value, "as", &iter);
-       if (!iter) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       *group = 0;
-       while (g_variant_iter_loop(iter, "&s", &str)) {
-               if (g_strcmp0(str, "none") == 0)
-                       *group = *group | GROUP_CAP_CCMP;
-               else if (g_strcmp0(str, "ccmp") == 0)
-                       *group = *group | GROUP_CAP_TKIP;
-               else if (g_strcmp0(str, "wep104") == 0)
-                       *group = *group | GROUP_CAP_WEP104;
-               else if (g_strcmp0(str, "wep40") == 0)
-                       *group = *group | GROUP_CAP_WEP40;
-       }
-
-       g_variant_iter_free(iter);
-}
-
-static inline void __get_key_mgmt(GVariant *value, guint *key_mgmt)
-{
-       GVariantIter *iter = NULL;
-       const gchar *str = NULL;
-
-       g_variant_get(value, "as", &iter);
-       if (!iter) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       *key_mgmt = 0;
-       while (g_variant_iter_loop(iter, "&s", &str)) {
-               if (g_strcmp0(str, "none") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_NONE;
-               else if (g_strcmp0(str, "wpa-psk") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_PSK;
-               else if (g_strcmp0(str, "wpa-ft-psk") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_FT_PSK;
-               else if (g_strcmp0(str, "wpa-psk-sha256") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_PSK_SHA256;
-               else if (g_strcmp0(str, "wpa-eap") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_EAP;
-               else if (g_strcmp0(str, "wpa-ft-eap") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_FT_EAP;
-               else if (g_strcmp0(str, "wpa-eap-sha256") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_EAP_SHA256;
-               else if (g_strcmp0(str, "ieee8021x") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_IEEE8021X;
-               else if (g_strcmp0(str, "wpa-none") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPA_NONE;
-               else if (g_strcmp0(str, "wps") == 0)
-                       *key_mgmt = *key_mgmt | KEY_MGMT_CAP_WPS;
-       }
-       g_variant_iter_free(iter);
-}
-*/
-
-static gboolean __unpack_ays(unsigned char *dst, GVariant *src, int size)
-{
-       GVariantIter *iter = NULL;
-       int length = 0;
-       int res = FALSE;
-
-       if (!dst || !src || size == 0) {
-               INM_LOGW("Invalid parameter");
-               return FALSE;
-       }
-
-       g_variant_get(src, "ay", &iter);
-       if (iter == NULL) {
-               INM_LOGW("failed to get iterator");
-               return FALSE;
-       }
-
-       while (g_variant_iter_loop(iter, "y", &dst[length])) {
-               length++;
-               if (length >= size)
-                       break;
-       }
-       g_variant_iter_free(iter);
-
-       return res;
-}
-
-static inline void __get_bss_bssid(GVariant *value, supplicant_bss_s *bss)
-{
-       __unpack_ays(bss->bssid, value, BSSID_LEN);
-}
-
-static inline void __get_bss_ssid(GVariant *value, supplicant_bss_s *bss)
-{
-       __unpack_ays((unsigned char *)bss->ssid, value, SSID_LEN);
-}
-
-static inline void __get_bss_privacy(GVariant *value, supplicant_bss_s *bss)
-{
-       g_variant_get(value, "b", &(bss->private));
-}
-
-static inline void __get_bss_mode(GVariant *value, supplicant_bss_s *bss)
-{
-       const gchar *str = NULL;
-       g_variant_get(value, "&s", &str);
-
-       bss->mode = 0;
-       if (g_strcmp0(str, "infrastructure") == 0)
-               bss->mode |= MODE_INFRA;
-       else if (g_strcmp0(str, "ad-hoc") == 0)
-               bss->mode |= MODE_ADHOC;
-       else if (g_strcmp0(str, "ap") == 0)
-               bss->mode |= MODE_AP;
-       else if (g_strcmp0(str, "p2p") == 0)
-               bss->mode |= MODE_P2P;
-}
-
-static inline void __get_bss_freq(GVariant *value, supplicant_bss_s *bss)
-{
-       g_variant_get(value, "q", &(bss->frequency));
-}
-
-static inline void __get_bss_signal(GVariant *value, supplicant_bss_s *bss)
-{
-       g_variant_get(value, "n", &(bss->signal));
-}
-
-static inline void __get_bss_property(const gchar *key, GVariant *value, supplicant_bss_s *bss)
-{
-       if (g_strcmp0(key, "BSSID") == 0)
-               __get_bss_bssid(value, bss);
-       else if (g_strcmp0(key, "SSID") == 0)
-               __get_bss_ssid(value, bss);
-       else if (g_strcmp0(key, "Privacy") == 0)
-               __get_bss_privacy(value, bss);
-       else if (g_strcmp0(key, "Mode") == 0)
-               __get_bss_mode(value, bss);
-       else if (g_strcmp0(key, "Frequency") == 0)
-               __get_bss_freq(value, bss);
-       else if (g_strcmp0(key, "Signal") == 0)
-               __get_bss_signal(value, bss);
-}
-
-static inline int __init_bss(const gchar *path, supplicant_bss_s *bss, GHashTable *bss_tbl)
-{
-       gchar *key = NULL;
-       gint ret = 0;
-       __INM_FUNC_ENTER__;
-
-       key = g_strdup(path);
-       if (g_hash_table_replace(bss_tbl, key, bss))
-               INM_LOGI("BSS replaced");
-
-       ret = __subscribe_bss_signal(path, bss);
-       if (ret != INM_GDBUS_ERROR_NONE) {
-               g_hash_table_steal(bss_tbl, key);
-               g_free(key);
-               __INM_FUNC_EXIT__;
-               return -1;
-       }
-
-       INM_LOGI("BSS replaced [%s]", path);
-       return 0;
-}
-
-int inm_supplicant_bss_add(const gchar *path, GVariantIter *iter, GHashTable *bss_tbl)
-{
-       supplicant_bss_s *bss = NULL;
-       const gchar *key = NULL;
-       GVariant *var = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-       if (!path || !iter) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       bss = (supplicant_bss_s *)g_try_malloc0(sizeof(supplicant_bss_s));
-       if (!bss) {
-               INM_LOGE("Error! Failed to allocate bss");
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       if (__init_bss(path, bss, bss_tbl) < 0) {
-               INM_LOGI("Error! Failed to init bss");
-               g_free(bss);
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       while (g_variant_iter_loop(iter, "{sv}", &key, &var))
-               __get_bss_property(key, var, bss);
-
-       __INM_FUNC_EXIT__;
-       return ret;
-}
-
-int inm_supplicant_bss_remove(const gchar *path, GHashTable *bss_tbl)
-{
-       supplicant_bss_s *bss = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-
-       if (!path || !bss_tbl) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       bss = g_hash_table_lookup(bss_tbl, path);
-       if (!bss) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       g_hash_table_remove(bss_tbl, path);
-       __INM_FUNC_EXIT__;
-       return ret;
-}
-
-void __get_bss_properties(GVariant *value, gpointer user_data)
-{
-       GVariantIter *iter = NULL;
-       const gchar *key = NULL;
-       GVariant *var = NULL;
-       supplicant_bss_s *bss = NULL;
-       __INM_FUNC_ENTER__;
-
-       if (!value || !user_data) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       g_variant_get(value, "(a{sv})", &iter);
-       if (!iter) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       bss = (supplicant_bss_s *)user_data;
-       while (g_variant_iter_loop(iter, "{sv}", &key, &var))
-               __get_bss_property(key, var, bss);
-
-       g_variant_iter_free(iter);
-
-       __INM_FUNC_EXIT__;
-       return;
-}
-
-static DECLARE_DBUS_SIGNAL_HANDLER_W_DATA(bss_properties_changed)
-{
-       supplicant_bss_s *bss = NULL;
-
-       __INM_FUNC_ENTER__;
-
-       DEBUG_SIGNAL(sender_name, object_path, interface_name, signal, parameters);
-       bss = (supplicant_bss_s *)user_data;
-       if (!bss) {
-               __INM_FUNC_EXIT__;
-               INM_LOGI("bss not found");
-               return;
-       }
-
-       if (parameters)
-               __get_bss_properties(parameters, bss);
-
-       __INM_FUNC_EXIT__;
-       return;
-}
-
-static inline gboolean __dbus_get_bss_properties(const gchar *path, supplicant_bss_s *bss)
-{
-       int ret = INM_GDBUS_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-       get_bss_property_method_param.object_path = path;
-       get_bss_property_method_param.parameters = g_variant_new("(s)",
-                       SUPPLICANT_IFACE_BSS);
-
-       ret = inm_gdbus_method_call(&get_bss_property_method_param,
-                       __get_bss_properties,
-                       (gpointer)bss);
-       if (ret != INM_GDBUS_ERROR_NONE) {
-               INM_LOGI("get property all failure");
-               return FALSE;
-       }
-
-       __INM_FUNC_EXIT__;
-       return TRUE;
-}
-
-int inm_supplicant_bss_add_by_path(const gchar *path, GHashTable *bsss)
-{
-       supplicant_bss_s *bss = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-
-       if (!path) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       bss = (supplicant_bss_s *)g_try_malloc0(sizeof(supplicant_bss_s));
-       if (!bss) {
-               INM_LOGE("Error! Failed to allocate bss");
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       if (__init_bss(path, bss, bsss) < 0) {
-               INM_LOGI("Error! Failed to init bss");
-               g_free(bss);
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-
-       __dbus_get_bss_properties(path, bss);
-
-       __INM_FUNC_EXIT__;
-       return ret;
-}
diff --git a/src/inm-supplicant-network.c b/src/inm-supplicant-network.c
deleted file mode 100644 (file)
index d729f91..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Network Monitoring Module
- *
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
- * This file implements functions for handling signal from WPA Supplicant network interface.
- *
- * @file        nm-supplicant-network.c
- * @author      Jiung Yu (jiung.yu@samsung.com)
- * @version     0.1
- */
-
-#include <string.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-
-#include "inm-util.h"
-#include "inm-manager-log.h"
-#include "inm-gdbus.h"
-#include "inm-supplicant.h"
-#include "inm-supplicant-internal.h"
-
-typedef enum {
-       NETWORK_SIGNAL_PROPERTIESCHANGED,
-       NETWORK_SIGNAL_MAX,
-} supplicant_network_signal_e;
-
-typedef struct {
-       gchar *path;
-       gboolean enable;
-       gboolean selected;
-       uint subscriber_id[NETWORK_SIGNAL_MAX];
-} supplicant_network_s;
-
-static method_param_s get_net_property_method_param = {
-               .bus_name = SUPPLICANT_SERVICE,
-               .object_path = NULL,
-               .interface_name = DBUS_PROPERTIES_INTERFACE,
-               .method_name = DBUS_PROPERTIES_METHOD_GETALL,
-               .parameters = NULL,
-};
-
-static inline void __get_network_enabled(GVariant *value, supplicant_network_s *net)
-{
-       g_variant_get(value, "b", &(net->enable));
-
-       INM_LOGI("Network %s", (net->enable) ? "Enabled" : "Disabled");
-}
-
-static inline void __get_network_property(const gchar *key, GVariant *value, supplicant_network_s *net)
-{
-       __INM_FUNC_ENTER__;
-
-       if (g_strcmp0(key, "Enabled") == 0)
-               __get_network_enabled(value, net);
-
-       __INM_FUNC_EXIT__;
-}
-
-void __get_network_properties(GVariant *value, gpointer user_data)
-{
-       GVariantIter *iter = NULL;
-       const gchar *key = NULL;
-       GVariant *var = NULL;
-       supplicant_network_s *net = NULL;
-       __INM_FUNC_ENTER__;
-
-       if (!value || !user_data) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       g_variant_get(value, "(a{sv})", &iter);
-       if (!iter) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-
-       net = (supplicant_network_s *)user_data;
-       while (g_variant_iter_loop(iter, "{sv}", &key, &var))
-               __get_network_property(key, var, net);
-
-       g_variant_iter_free(iter);
-
-       __INM_FUNC_EXIT__;
-       return;
-}
-
-static inline int __init_net(const gchar *path, supplicant_network_s *net)
-{
-       gchar *key = NULL;
-
-       __INM_FUNC_ENTER__;
-
-       key = g_strdup(path);
-       if (!key) {
-               INM_LOGE("Error! Failed to get key");
-               __INM_FUNC_EXIT__;
-               return -1;
-       }
-
-       if (net->path)
-               g_free(net->path);
-       net->path = key;
-
-       return 0;
-}
-
-int inm_supplicant_network_add(const gchar *path, GVariantIter *iter, gpointer *network)
-{
-       supplicant_network_s *net = NULL;
-       const gchar *key = NULL;
-       GVariant *var = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-       if (!path || !iter || !network) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       net = (supplicant_network_s *)g_try_malloc0(sizeof(supplicant_network_s));
-       if (!net) {
-               INM_LOGE("Error! Failed to allocate net");
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       if (__init_net(path, net) < 0) {
-               INM_LOGW("Error! Failed to init net");
-               g_free(net);
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       while (g_variant_iter_loop(iter, "{sv}", &key, &var))
-               __get_network_property(key, var, net);
-
-       *network = net;
-       __INM_FUNC_EXIT__;
-       return ret;
-
-}
-
-static inline void __dbus_get_net_properties(const gchar *path, supplicant_network_s *net)
-{
-       int ret = INM_GDBUS_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-       get_net_property_method_param.object_path = path;
-       get_net_property_method_param.parameters = g_variant_new("(s)",
-                       SUPPLICANT_IFACE_NETWORK);
-
-       ret = inm_gdbus_method_call(&get_net_property_method_param,
-                       __get_network_properties,
-                       (gpointer)net);
-       if (ret != INM_GDBUS_ERROR_NONE)
-               INM_LOGW("get property all failure");
-
-       __INM_FUNC_EXIT__;
-       return;
-}
-
-int inm_supplicant_network_add_by_path(const gchar *path, gpointer *network)
-{
-       supplicant_network_s *net = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-
-       if (!path) {
-               INM_LOGW("NULL obj");
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       net = (supplicant_network_s *)g_try_malloc0(sizeof(supplicant_network_s));
-       if (!net) {
-               INM_LOGE("Error! Failed to allocate net");
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       if (__init_net(path, net) < 0) {
-               __INM_FUNC_EXIT__;
-               g_free(net);
-               return INM_SUPPLICANT_ERROR_OPERATION_FAILED;
-       }
-
-       __dbus_get_net_properties(path, net);
-
-       *network = net;
-
-       __INM_FUNC_EXIT__;
-       return ret;
-}
-
-int inm_supplicant_network_remove(const gchar *path, gpointer network)
-{
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-
-       if (!path || !network) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       inm_supplicant_network_destroy(network);
-
-       __INM_FUNC_EXIT__;
-       return ret;
-}
-
-int inm_supplicant_network_select(const gchar *path, gpointer network)
-{
-       supplicant_network_s *net = NULL;
-       int ret = INM_SUPPLICANT_ERROR_NONE;
-       __INM_FUNC_ENTER__;
-
-
-       if (!path || !network) {
-               __INM_FUNC_EXIT__;
-               return INM_SUPPLICANT_ERROR_INVALID_PARAM;
-       }
-
-       net = (supplicant_network_s *)network;
-       net->selected = TRUE;
-
-       __INM_FUNC_EXIT__;
-       return ret;
-
-}
-
-void inm_supplicant_network_destroy(gpointer data)
-{
-       supplicant_network_s *network = NULL;
-       __INM_FUNC_ENTER__;
-
-
-       if (!data) {
-               __INM_FUNC_EXIT__;
-               return;
-       }
-       network = (supplicant_network_s *)data;
-
-       g_free(network->path);
-       g_free(network);
-
-       __INM_FUNC_EXIT__;
-       return;
-}
index 0d96fa08fc39efee77ca4a86c91061ac9d3a66a5..ffe8943ab373dbea4c80fa70e94dff6bc0cbaabd 100644 (file)
@@ -27,7 +27,7 @@ LIST(REMOVE_ITEM TEST_APP_SRCS ${CMAKE_SOURCE_DIR}/src/inm-manager-main.c)
 SET(TEST_APP_SRCS ${TEST_APP_SRCS} inm-test.c)
 
 INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(test_app_pkgs REQUIRED dlog glib-2.0 gio-2.0 vconf libnl-2.0 libcurl)
+PKG_CHECK_MODULES(test_app_pkgs REQUIRED dlog glib-2.0 gio-2.0 vconf libnl-2.0 libcurl libcares)
 
 FOREACH(flag ${test_app_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index f1e1e9aeab8e65621e75bbd29a98bb3e55145802..30cb9c4417ae34298e4a8216ec7118854848eaca 100644 (file)
@@ -611,7 +611,7 @@ void ip_con_callback(int state, char *if_name, unsigned char *arp_sha, gpointer
 
 void iface_mon_callback(char *iface_name, int state, void *user_data)
 {
-       printf("%s changed [%s]\n", iface_name, (state == 1)?"ATTACHED":"DETACHED");
+       printf("%s changed [%s]\n", iface_name, (state == 1) ? "ATTACHED" : "DETACHED");
 
        return;
 }
@@ -622,7 +622,7 @@ void congestion_mon_callback(int cong_status, void *user_data)
                printf("Alert very High Congestion(%d), Please take necessary action\n", cong_status);
        else if (cong_status > 25)
                printf("High Congestion(%d), Excessive re-transmissions\n", cong_status);
-       else if( cong_status > 15 )
+       else if (cong_status > 15)
                printf("Warning, moderate congestion(%d)\n", cong_status);
        else
                printf("Low congestion: %d\n", cong_status);
@@ -739,7 +739,7 @@ void test_inm_ip_conflict_is_detection_enabled()
        ret = inm_ip_conflict_is_detection_enabled("wlan0", &enabled);
        if (ret == INM_IP_CONFLICT_ERROR_NONE) {
                printf(MAKE_GREEN"inm_ip_conflict_is_detection_enabled"RESET_COLOR"\n");
-               printf("enabled : [%s]\n", (enabled)?"YES":"NO");
+               printf("enabled : [%s]\n", (enabled) ? "YES" : "NO");
        } else {
                printf(MAKE_RED"inm_ip_conflict_is_detection_enabled : %s ",
                                print_ip_conflict_err(ret));
@@ -872,7 +872,7 @@ void test_inm_dump_get_tcpdump_state()
        ret = inm_dump_get_tcpdump_state(&is_running);
        if (ret == INM_DUMP_ERROR_NONE) {
                printf(MAKE_GREEN"inm_dump_get_tcpdump_state"RESET_COLOR"\n");
-               printf("is_running : [%s]\n", (is_running)?"YES":"NO");
+               printf("is_running : [%s]\n", (is_running) ? "YES" : "NO");
        } else {
                printf(MAKE_RED"inm_dump_get_tcpdump_state : %s ",
                                print_dump_err(ret));
@@ -948,14 +948,14 @@ void test_inm_iface_mon_start_monitor()
 {
        char iface_name[17] = {0, };
        int ret = 0;
-    printf("Input iface_name :\n");
-    if (scanf(" %17[^\n]s", iface_name) < 0)
-            return;
+       printf("Input iface_name :\n");
+       if (scanf(" %17[^\n]s", iface_name) < 0)
+               return;
 
-    if (strlen(iface_name) <= 0) {
-            printf("invalid iface_name !!\n");
-            return;
-    }
+       if (strlen(iface_name) <= 0) {
+               printf("invalid iface_name !!\n");
+               return;
+       }
 
        ret = inm_iface_mon_start_monitor(iface_name, iface_mon_callback, NULL);
        if (ret == INM_IFACE_MON_ERROR_NONE) {
@@ -973,14 +973,14 @@ void test_inm_iface_mon_stop_monitor()
 {
        char iface_name[17] = {0, };
        int ret = 0;
-    printf("Input iface_name :\n");
-    if (scanf(" %17[^\n]s", iface_name) < 0)
-            return;
+       printf("Input iface_name :\n");
+       if (scanf(" %17[^\n]s", iface_name) < 0)
+               return;
 
-    if (strlen(iface_name) <= 0) {
-            printf("invalid iface_name !!\n");
-            return;
-    }
+       if (strlen(iface_name) <= 0) {
+               printf("invalid iface_name !!\n");
+               return;
+       }
 
        ret = inm_iface_mon_stop_monitor(iface_name);
        if (ret == INM_IFACE_MON_ERROR_NONE) {
@@ -999,14 +999,14 @@ void test_inm_iface_mon_get_iface_state()
        char iface_name[17] = {0, };
        int status = 0;
        int ret = 0;
-    printf("Input iface_name :\n");
-    if (scanf(" %17[^\n]s", iface_name) < 0)
-            return;
+       printf("Input iface_name :\n");
+       if (scanf(" %17[^\n]s", iface_name) < 0)
+               return;
 
-    if (strlen(iface_name) <= 0) {
-            printf("invalid iface_name !!\n");
-            return;
-    }
+       if (strlen(iface_name) <= 0) {
+               printf("invalid iface_name !!\n");
+               return;
+       }
 
        ret = inm_iface_mon_get_iface_state(iface_name, &status);
        if (ret == INM_IFACE_MON_ERROR_NONE) {
@@ -1084,22 +1084,6 @@ void test_inm_connman_deinit()
        return;
 }
 
-void test_inm_connman_mgr_get_properties()
-{
-       int ret = 0;
-
-       ret = inm_connman_mgr_get_properties();
-       if (ret == INM_CONNMAN_ERROR_NONE) {
-               printf(MAKE_GREEN"inm_connman_mgr_get_properties"RESET_COLOR"\n");
-       } else {
-               printf(MAKE_RED"inm_connman_mgr_get_properties : %s ",
-                               print_connman_err(ret));
-               printf(RESET_COLOR"\n");
-       }
-
-       return;
-}
-
 void test_inm_connman_mgr_get_services()
 {
        int ret = 0;
@@ -1290,7 +1274,7 @@ void test_inm_statistics_is_enabled()
        ret = inm_statistics_is_enabled(&is_enabled);
        if (ret == INM_STATISTICS_ERROR_NONE) {
                printf(MAKE_GREEN"inm_statistics_is_enabled"RESET_COLOR"\n");
-               printf("Enabled [%s]\n", is_enabled?"Yes":"No");
+               printf("Enabled [%s]\n", is_enabled ? "Yes" : "No");
        } else {
                printf(MAKE_RED"inm_statistics_is_enabled : %s ",
                                print_statistics_err(ret));
@@ -1433,7 +1417,7 @@ void test_inm_channel_interference_stop_monitor()
        return;
 }
 
-static void __arping_cb (gboolean found,
+static void __arping_cb(gboolean found,
                gchar *if_name,
                gchar *ip,
                gboolean is_gateway,
@@ -1651,7 +1635,7 @@ void test_inm_reacher_remove_url()
        free(url);
 }
 
-static void __reacher_callback (
+static void __reacher_callback(
                inm_reacher_error_e err,
                gboolean found,
                const char *url,
@@ -1765,7 +1749,6 @@ void test_inm_mgr_deinit()
 void test_inm_mgr_start_arping()
 {
        char *target_ip;
-       int timeout;
        int ret = 0;
 
        if (!is_manager_initialized) {
@@ -1782,17 +1765,11 @@ void test_inm_mgr_start_arping()
        else
                printf("IP: [%s]\n", target_ip);
 
-       printf("Input timeout :\n");
-       if (scanf(" %d", &timeout) < 1) {
-               free(target_ip);
-               return;
-       }
-
-       ret = inm_manager_start_arping(target_ip, timeout);
+       ret = inm_manager_arp_request_start(target_ip);
        if (ret == INM_MANAGER_ERROR_NONE) {
-               printf(MAKE_GREEN"inm_manager_start_arping"RESET_COLOR"\n");
+               printf(MAKE_GREEN"inm_manager_arp_request_start"RESET_COLOR"\n");
        } else {
-               printf(MAKE_RED"inm_manager_start_arping: %s ",
+               printf(MAKE_RED"inm_manager_arp_request_start: %s ",
                                print_arping_err(ret));
                printf(RESET_COLOR"\n");
        }
@@ -1819,11 +1796,11 @@ void test_inm_mgr_stop_arping()
        else
                printf("IP: [%s]\n", target_ip);
 
-       ret = inm_manager_stop_arping(target_ip);
+       ret = inm_manager_arp_request_stop(target_ip);
        if (ret == INM_MANAGER_ERROR_NONE) {
-               printf(MAKE_GREEN"inm_manager_stop_arping"RESET_COLOR"\n");
+               printf(MAKE_GREEN"inm_manager_arp_request_stop"RESET_COLOR"\n");
        } else {
-               printf(MAKE_RED"inm_manager_stop_arping: %s ",
+               printf(MAKE_RED"inm_manager_arp_request_stop: %s ",
                                print_arping_err(ret));
                printf(RESET_COLOR"\n");
        }
@@ -1833,18 +1810,22 @@ void test_inm_mgr_stop_arping()
 
 void test_inm_start_check_gateway()
 {
+       int timeout = 0;
        int ret = 0;
 
        if (!is_manager_initialized) {
                printf("INM Mgr Not initialized\n");
                return;
        }
+       printf("Input timeout :\n");
+       if (scanf(" %d", &timeout) < 1)
+               return;
 
-       ret = inm_manager_start_check_gateway();
+       ret = inm_manager_default_gateway_start_checking(timeout);
        if (ret == INM_MANAGER_ERROR_NONE) {
-               printf(MAKE_GREEN"inm_manager_start_check_gateway"RESET_COLOR"\n");
+               printf(MAKE_GREEN"inm_manager_default_gateway_start_checking"RESET_COLOR"\n");
        } else {
-               printf(MAKE_RED"inm_manager_start_check_gateway: %s ",
+               printf(MAKE_RED"inm_manager_default_gateway_start_checking: %s ",
                                print_arping_err(ret));
                printf(RESET_COLOR"\n");
        }
@@ -1859,17 +1840,17 @@ void test_inm_stop_check_gateway()
                return;
        }
 
-       ret = inm_manager_stop_check_gateway();
+       ret = inm_manager_default_gateway_stop_checking();
        if (ret == INM_MANAGER_ERROR_NONE) {
-               printf(MAKE_GREEN"inm_manager_stop_check_gateway"RESET_COLOR"\n");
+               printf(MAKE_GREEN"inm_manager_default_gateway_stop_checking"RESET_COLOR"\n");
        } else {
-               printf(MAKE_RED"inm_manager_stop_check_gateway: %s ",
+               printf(MAKE_RED"inm_manager_default_gateway_stop_checking: %s ",
                                print_arping_err(ret));
                printf(RESET_COLOR"\n");
        }
 }
 
-static void __icmp_ping_cb (gboolean found,
+static void __icmp_ping_cb(gboolean found,
                gchar *reason,
                gchar *ip,
                gpointer user_data)
@@ -2040,7 +2021,7 @@ void test_inm_tr_deinit()
        return;
 }
 
-void trace_route_cb (
+void trace_route_cb(
                inm_trace_route_error_e err,
                gboolean found,
                int ttl,
@@ -2158,7 +2139,6 @@ menu_func_s g_menu_func[] = {
 
                {CMD_CONNMAN_INIT, test_inm_connman_init},
                {CMD_CONNMAN_DEINIT, test_inm_connman_deinit},
-               {CMD_CONNMAN_MGR_GET_PROPERTIES, test_inm_connman_mgr_get_properties},
                {CMD_CONNMAN_MGR_GET_SERVICES, test_inm_connman_mgr_get_services},
                {CMD_CONNMAN_MGR_GET_TECHNOLOGIES, test_inm_connman_mgr_get_technologies},