Code refactoring
authorJaehyun Kim <jeik01.kim@samsung.com>
Sun, 21 Apr 2013 10:55:10 +0000 (19:55 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Sun, 21 Apr 2013 10:55:10 +0000 (19:55 +0900)
17 files changed:
include/common/network-cm-error.h
include/common/network-cm-intf.h
include/profile/network-pm-config.h
include/profile/network-pm-intf.h
include/profile/network-pm-wlan.h
include/wifi/network-wifi-intf.h
packaging/libnet-client.spec
src/include/network-dbus-request.h
src/include/network-internal.h
src/include/network-signal-handler.h
src/network-cm-intf.c
src/network-dbus-request.c
src/network-internal.c
src/network-profile-intf.c
src/network-signal-handler.c
src/network-wifi-intf.c
test/main.c

index c142776..df6fd35 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
 #ifndef __NETWORK_CM_ERROR_H__
 #define __NETWORK_CM_ERROR_H__
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -62,12 +60,6 @@ extern "C" {
 
 /*
 ==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================
-*/
-
-/*
-==================================================================================================
                                            CONSTANTS
 ==================================================================================================
 */
@@ -176,4 +168,3 @@ typedef enum {
 #endif
  
 #endif
-
index 624eb86..0f387ef 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifndef __NETWORK_CM_INTF_H__        /* To prevent inclusion of a header file twice */
+#ifndef __NETWORK_CM_INTF_H__
 #define __NETWORK_CM_INTF_H__
 
+#include "network-pm-intf.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__((deprecated))
+#endif
+
 /**
  * @file network-cm-intf.h
  * @brief This file defines the interface of Connection Manager with the application.
@@ -37,42 +41,6 @@ extern "C" {
 */
 
 /*==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================*/
-
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <sys/un.h>
-#include <errno.h>
-
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include <pthread.h>
-#include <signal.h>
-
-#include <sys/poll.h>
-
-#include <semaphore.h>
-#include <linux/unistd.h>
-
-#include "network-pm-intf.h"
-#include "network-cm-error.h"
-
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-
-/*==================================================================================================
                                            CONSTANTS
 ==================================================================================================*/
 
@@ -226,7 +194,7 @@ typedef struct
 
 /*****************************************************************************************/
 /* Callback function prototype
- * typedef void (*net_event_cb_t ) ( const net_event_info_t* net_event, void* user_data);
+ * typedef void (*net_event_cb_t)(const net_event_info_t* net_event, void* user_data);
  */
 
 /**
@@ -315,7 +283,7 @@ typedef struct
  *
  */
 
-typedef void (*net_event_cb_t ) ( const net_event_info_t* net_event, void* user_data);
+typedef void (*net_event_cb_t)(const net_event_info_t* net_event, void* user_data);
 
 /*==================================================================================================
                                      FUNCTION PROTOTYPES
index d1d4d27..834229c 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
 #ifndef __NETWORK_PM_CONFIG_H__
 #define __NETWORK_PM_CONFIG_H__
 
+#include <netinet/in.h>
+
+#include "network-cm-error.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -38,14 +40,6 @@ extern "C"
 */
 
 /*==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================*/
-
-#include <netinet/in.h>
-
-#include "network-cm-error.h"
-
-/*==================================================================================================
                                            CONSTANTS
 ==================================================================================================*/
 
@@ -348,5 +342,3 @@ typedef struct
 #endif /* __cplusplus */
 
 #endif
-
-
index 1306028..4fd8fe7 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
 #ifndef __NETWORK_PM_INTF_H__
 #define __NETWORK_PM_INTF_H__
 
+#include "network-pm-wlan.h"
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__((deprecated))
+#endif
+
 /**
  * @file network-pm-intf.h
  * @brief This file defines the interface of Profile Manager with the application/Connection Manager.
@@ -37,15 +41,6 @@ extern "C"
  * \{
 */
 
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-/*==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================*/
-
-#include "network-pm-wlan.h"
-
 /*==================================================================================================
                                            CONSTANTS
 ==================================================================================================*/
@@ -226,8 +221,8 @@ typedef struct
  * \par Example of how this function would be called:
  *
  * net_profile_info_t prof_info;\n
- * int result; \n
- * result = net_add_profile( NET_SERVICE_MMS, &prof_info ); \n
+ * int result;\n
+ * result = net_add_profile(NET_SERVICE_MMS, &prof_info);\n
  * if(result == NET_ERR_NONE)
  *
 ******************************************************************************************/
@@ -431,5 +426,3 @@ int net_set_default_cellular_service_profile_async(const char *profile_name);
 #endif /* __cplusplus */
 
 #endif
-
-
index 40774f9..36e0ce4 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
 #ifndef __NETWORK_PM_WLAN_H__
 #define __NETWORK_PM_WLAN_H__
 
+#include "network-pm-config.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -39,14 +39,6 @@ extern "C"
 
 /*
 ==================================================================================================
-                                         INCLUDE FILES
-==================================================================================================
-*/
-
-#include "network-pm-config.h"
-
-/*
-==================================================================================================
                                            CONSTANTS
 ==================================================================================================
 */
@@ -54,7 +46,6 @@ extern "C"
 /** Length of essid */
 #define NET_WLAN_ESSID_LEN      128
 
-
 /** 
  * Length of WPS PIN code 
  * WPS PIN code should be 4 or 8 digits
@@ -76,7 +67,6 @@ extern "C"
  */
 #define NETPM_WLAN_MAX_WEP_KEY_LEN        26
 
-
 /**
  * These lengths depends on authentication server being used,
  * In case of freeradius server Max allowed length for username/password is 255
@@ -84,6 +74,7 @@ extern "C"
  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
  */
 #define NETPM_WLAN_USERNAME_LEN               50
+
 /**
  * These lengths depends on authentication server being used,
  * In case of freeradius server Max allowed length for username/password is 255
@@ -97,16 +88,19 @@ extern "C"
  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
  */
 #define NETPM_WLAN_CA_CERT_FILENAME_LEN       50
+
 /**
  * length of Client Cert file name
  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
  */
 #define NETPM_WLAN_CLIENT_CERT_FILENAME_LEN   50
+
 /**
  * length of private key file name
  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
  */
 #define NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN   50
+
 /**
  * length of Private key password
  * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
@@ -228,7 +222,6 @@ typedef struct
        char essid[NET_WLAN_ESSID_LEN+1];
 } net_essid_t;
 
-
 /**
  * Below structure is used by WPA-PSK or WPA2-PSK
  * @remark To see the maximum length of PSK passphrase key.
@@ -240,7 +233,6 @@ typedef struct
        char pskKey[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN + 1];
 } wlan_psk_info_t;
 
-
 /**
  * Below structure is used by WEP
  * @remark To see the maximum length of WEP key.
@@ -252,7 +244,6 @@ typedef struct
        char wepKey[NETPM_WLAN_MAX_WEP_KEY_LEN + 1];
 } wlan_wep_info_t;
 
-
 /**
  * Below structure is used by EAP
  * @see wlan_auth_info_t
@@ -271,7 +262,8 @@ typedef struct
        /**
         * For EAP-TTLS and EAP-PEAP only ca_cert_filename[] can also be provided
         */
-       char ca_cert_filename[NETPM_WLAN_CA_CERT_FILENAME_LEN+1]; /* Used to authenticate server */
+       /* Used to authenticate server */
+       char ca_cert_filename[NETPM_WLAN_CA_CERT_FILENAME_LEN+1];
        /** client certificate file name */
        char client_cert_filename[NETPM_WLAN_CLIENT_CERT_FILENAME_LEN+1];
        /** private key file name */
@@ -285,7 +277,6 @@ typedef struct
        wlan_eap_auth_type_t eap_auth;
 } wlan_eap_info_t;
 
-
 /**
  * At any point of time only one security mechanism is supported
  * @see wlan_security_info_t
@@ -300,7 +291,6 @@ typedef union
        wlan_eap_info_t eap;
 } wlan_auth_info_t;
 
-
 /**
  * This is main security information structure
  * @see net_pm_wlan_profile_info_t
@@ -317,7 +307,6 @@ typedef struct
        char wps_support;
 } wlan_security_info_t;
 
-
 /**
  * AP Profile information
  */
@@ -355,5 +344,3 @@ typedef struct
 #endif /* __cplusplus */
 
 #endif /* __NETPM_WLAN_H__ */
-
-
index 9c36dc0..1d7b919 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
+#ifndef __NETWORK_WIFI_INTF_H__
+#define __NETWORK_WIFI_INTF_H__
 
-#ifndef __NETWORK_WIFI_INTF_H_
-#define __NETWORK_WIFI_INTF_H_
+#include "network-cm-intf.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -34,16 +35,6 @@ extern "C" {
  * \addtogroup  wifi_specific
  * \{
 */
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-
-#include "network-pm-wlan.h"
-#include "network-cm-intf.h"
 
 /*****************************************************************************
  *     Macros and Typedefs
@@ -71,7 +62,7 @@ typedef enum {
        WIFI_CONNECTED,
        /** Trying to disconnect(connected, but disconnecting process is on going) */
        WIFI_DISCONNECTING,
-} net_wifi_state_t; 
+} net_wifi_state_t;
 
 /**
 *@enum net_wifi_background_scan_mode_t
@@ -99,7 +90,6 @@ typedef enum
 /*****************************************************************************
  *     Global Structures
  *****************************************************************************/
-
 /**
  * This is the structure to connect with WPS network.
  */
@@ -139,7 +129,6 @@ typedef struct {
  *     ConnMan Wi-Fi Client Interface Synchronous API Declaration
  *****************************************************************************/
 
-
 /**
  * @fn   int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *profile_name)
  *
@@ -158,7 +147,6 @@ typedef struct {
 
 int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *profile_name);
 
-
 /**
  * @fn   int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode)
  *
@@ -219,7 +207,6 @@ int net_specific_scan_wifi(const char *ssid);
 
 int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info);
 
-
 /**
  * @fn   int net_scan_wifi(void)
  *
@@ -242,7 +229,6 @@ int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_in
 
 int net_scan_wifi(void);
 
-
 /**
  * @fn   int net_wifi_power_on(void)
  *
@@ -263,7 +249,6 @@ int net_scan_wifi(void);
 
 int net_wifi_power_on(void);
 
-
 /**
  * @fn   int net_wifi_power_off(void)
  *
@@ -284,7 +269,6 @@ int net_wifi_power_on(void);
 
 int net_wifi_power_off(void);
 
-
 /**
  * @fn   int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info)
  *
@@ -307,7 +291,6 @@ int net_wifi_power_off(void);
 
 int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info);
 
-
 /**
  * \}
  */
@@ -316,4 +299,4 @@ int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info)
 }
 #endif
 
-#endif /** __NETWORK_WIFI_INTF_H_ */
+#endif /** __NETWORK_WIFI_INTF_H__ */
index 09e1333..14d11eb 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libnet-client
 Summary:    Network Client library (Shared library)
-Version:    0.1.77_20
+Version:    0.1.77_21
 Release:    1
 Group:      System/Network
 License:    Flora License
index 6f9f0d3..f13d938 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
+#ifndef __NETWORK_DBUS_REQUEST_H__
+#define __NETWORK_DBUS_REQUEST_H__
 
-#ifndef __NETWORK_DBUS_REQUEST_H_
-#define __NETWORK_DBUS_REQUEST_H_
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h>
-#include <glib.h>
-
-#include <dbus/dbus.h> 
-
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-
+#include "network-internal.h"
+#include "network-wifi-intf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*****************************************************************************
  *     Macros and Typedefs
@@ -95,7 +83,6 @@ typedef struct {
        char *private_key_password;
 } net_wifi_connect_service_info_t;
 
-
 /*****************************************************************************
  *     Global Functions 
  *****************************************************************************/
@@ -113,9 +100,11 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
 int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name);
 int _net_dbus_get_technology_state(network_tech_state_info_t* tech_state);
 DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
-               char* interface_name, char* method, char *param_array[], int *dbus_error);
+               char* interface_name, char* method,
+               char* param_array[], int* dbus_error);
 int _net_invoke_dbus_method_nonblock(const char* dest, const char* path,
-               char* interface_name, char* method, DBusPendingCallNotifyFunction notify_func);
+               char* interface_name, char* method,
+               DBusPendingCallNotifyFunction notify_func);
 int _net_dbus_load_wifi_driver(void);
 int _net_dbus_remove_wifi_driver(void);
 int _net_dbus_get_statistics(net_device_t device_type, net_statistics_type_e statistics_type, unsigned long long *size);
@@ -131,4 +120,8 @@ gboolean __net_dbus_abort_open_request(const char *profile_name);
 int _net_dbus_specific_scan_request(const char *ssid);
 int _net_dbus_set_default(const char* profile_name);
 
-#endif /** __NETWORK_SIGNAL_HANDLER_H_ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __NETWORK_SIGNAL_HANDLER_H__ */
index 15decdd..54f0eb1 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
+#ifndef __NETWORK_INTERNAL_H__
+#define __NETWORK_INTERNAL_H__
 
-#ifndef __NETWORK_INTERNAL_H_
-#define __NETWORK_INTERNAL_H_
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h>
 #include <glib.h>
+#include <stdlib.h>
+#include <dbus/dbus.h>
 
-#include <dbus/dbus.h> 
-
-#include <net/if.h>                    /** for IFNAMSIZ and co... */
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-#include "network-pm-intf.h"
 #include "network-cm-intf.h"
 #include "network-wifi-intf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*****************************************************************************
  *     Macros and Typedefs
  *****************************************************************************/
 
 #define        NET_MEMFREE(x)  {if(x != NULL) free(x); x = NULL;}
 
-/** ConnMan Daemon Management interface */
+/** ConnMan interfaces */
 #define CONNMAN_SERVICE                 "net.connman"
-
 #define CONNMAN_MANAGER_INTERFACE              CONNMAN_SERVICE ".Manager"
 #define CONNMAN_TECHNOLOGY_INTERFACE           CONNMAN_SERVICE ".Technology"
 #define CONNMAN_SERVICE_INTERFACE              CONNMAN_SERVICE ".Service"
 #define CONNMAN_PROFILE_INTERFACE              CONNMAN_SERVICE ".Profile"
-#define CONNMAN_COUNTER_INTERFACE              CONNMAN_SERVICE ".Counter"
 #define CONNMAN_ERROR_INTERFACE                        CONNMAN_SERVICE ".Error"
 #define CONNMAN_AGENT_INTERFACE                        CONNMAN_SERVICE ".Agent"
 
 #define NETCONFIG_WIFI_PATH                            "/net/netconfig/wifi"
 #define NETCONFIG_STATISTICS_PATH                      "/net/netconfig/network_statistics"
 
-#define TELEPHONY_SERVCE                               "com.tcore.ps"
-#define TELEPHONY_MASTER_INTERFACE             TELEPHONY_SERVCE ".master"
-#define TELEPHONY_NETWORK_INTERFACE            TELEPHONY_SERVCE ".network"
-#define TELEPHONY_PROFILE_INTERFACE            TELEPHONY_SERVCE ".context"
-#define TELEPHONY_MASTER_PATH                  "/"
-
-/** Network related Daemon Signal Filters */
-#define NETCONFIG_WIFI_FILTER                  "type='signal',interface='net.netconfig.wifi'"
+#define TELEPHONY_SERVICE                              "com.tcore.ps"
+#define TELEPHONY_MASTER_INTERFACE             TELEPHONY_SERVICE ".master"
+#define TELEPHONY_NETWORK_INTERFACE            TELEPHONY_SERVICE ".network"
+#define TELEPHONY_PROFILE_INTERFACE            TELEPHONY_SERVICE ".context"
 
-/** Network related Daemon Signals */
-#define NETCONFIG_SIGNAL_POWERON_COMPLETED     "PowerOnCompleted"
-#define NETCONFIG_SIGNAL_POWEROFF_COMPLETED    "PowerOffCompleted"
-#define NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE    "SpecificScanCompleted"
+#define TELEPHONY_MASTER_PATH                  "/"
 
-/** ConnMan Daemon Signal Filters */
+/** Signal Filters */
 #define CONNMAN_MANAGER_SIGNAL_FILTER          "type='signal',interface='net.connman.Manager'"
 #define CONNMAN_TECHNOLOGY_SIGNAL_FILTER       "type='signal',interface='net.connman.Technology'"
 #define CONNMAN_SERVICE_SIGNAL_FILTER          "type='signal',interface='net.connman.Service'"
 #define CONNMAN_PROFILE_SIGNAL_FILTER          "type='signal',interface='net.connman.Profile'"
-#define CONNMAN_NETWORK_COUNTER_FILTER         "type='signal',interface='net.connman.Counter'"
-
-/** ConnMan Daemon Signals */
-#define CONNMAN_SIGNAL_PROPERTY_CHANGED "PropertyChanged"
+#define NETCONFIG_WIFI_FILTER                  "type='signal',interface='net.netconfig.wifi'"
 
-/* Newly added manager interface signals */
-#define CONNMAN_SIGNAL_TECHNOLOGY_ADDED "TechnologyAdded"
-#define CONNMAN_SIGNAL_TECHNOLOGY_REMOVED "TechnologyRemoved"
-#define CONNMAN_SIGNAL_SERVICES_CHANGED "ServicesChanged"
+/** Signals */
+#define SIGNAL_PROPERTY_CHANGED "PropertyChanged"
+#define SIGNAL_TECHNOLOGY_ADDED "TechnologyAdded"
+#define SIGNAL_TECHNOLOGY_REMOVED "TechnologyRemoved"
+#define SIGNAL_SERVICES_CHANGED "ServicesChanged"
 
 /** ConnMan technology and profile prefixes for ConnMan */
 #define CONNMAN_CELLULAR_TECHNOLOGY_PREFIX             CONNMAN_PATH "/technology/cellular"
 #define CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX        CONNMAN_PATH "/service/ethernet_"
 #define CONNMAN_BLUETOOTH_SERVICE_PROFILE_PREFIX       CONNMAN_PATH "/service/bluetooth_"
 
+/** Network related Daemon Signals */
+#define NETCONFIG_SIGNAL_POWERON_COMPLETED     "PowerOnCompleted"
+#define NETCONFIG_SIGNAL_POWEROFF_COMPLETED    "PowerOffCompleted"
+#define NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE    "SpecificScanCompleted"
 
 #ifdef VITA_FEATURE
 #include <dlog.h>
 
 #endif /** VITA_FEATURE */
 
-
 /*****************************************************************************
  *     Global Enums
  *****************************************************************************/
@@ -171,10 +153,9 @@ typedef enum
        NETWORK_REQUEST_TYPE_MAX
 } network_async_request_type_t;
 
-
 typedef struct
 {
-       int flag; /** TRUE/FALSE */
+       int flag;
        char ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
 } network_request_table_t;
 
@@ -201,12 +182,12 @@ typedef struct {
 
 typedef struct
 {
-       char technology[NET_TECH_LENGTH_MAX]; /** wifi, ethernet, cellular - strings */
+       char technology[NET_TECH_LENGTH_MAX];
        char AvailableTechnology;
        char EnabledTechnology;
        char ConnectedTechnology;
        char DefaultTechnology;
-       /* Connman 1.3 */
+       /* Connman 1.x */
        char Connected;
        char Powered;
 } network_tech_state_info_t;
@@ -257,4 +238,8 @@ int _net_get_default_profile_info(net_profile_info_t *profile_info);
 net_wifi_state_t _net_get_wifi_state(void);
 void _net_clear_request_table(void);
 
-#endif /** __NETWORK_INTERNAL_H_ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __NETWORK_INTERNAL_H__*/
index 29fcb85..6963c7c 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
+#ifndef __NETWORK_SIGNAL_HANDLER_H__
+#define __NETWORK_SIGNAL_HANDLER_H__
 
-#ifndef __NETWORK_SIGNAL_HANDLER_H_
-#define __NETWORK_SIGNAL_HANDLER_H_
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-
-#include <dbus/dbus.h> 
-
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*****************************************************************************
  *     Macros and Typedefs
@@ -53,6 +40,8 @@ int network_register_and_recieve_signal(void);
 int _net_register_signal(void);
 int _net_init_service_state_table(void);
 
+#ifdef __cplusplus
+}
+#endif
 
-#endif /** __NETWORK_SIGNAL_HANDLER_H_ */
-
+#endif /** __NETWORK_SIGNAL_HANDLER_H__ */
index 278e304..9f937e7 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h>
-#include <glib.h>
-
-#include <dbus/dbus.h> 
-
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-
-#include "network-internal.h"
-#include "network-signal-handler.h"
 #include "network-dbus-request.h"
-
-/*****************************************************************************
- *     Macros and Typedefs
- *****************************************************************************/
+#include "network-signal-handler.h"
 
 /*****************************************************************************
  *     Local Functions Declaration
@@ -81,13 +53,13 @@ static int __net_get_default_profile(void *param, net_profile_info_t *active_pro
        net_err_t Error = NET_ERR_NONE;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (param == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -96,7 +68,7 @@ static int __net_get_default_profile(void *param, net_profile_info_t *active_pro
 
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! _net_get_default_profile_info() failed. Error [%s]\n",
+                               "_net_get_default_profile_info() failed. Error [%s]\n",
                                _net_print_error(Error));
 
                __NETWORK_FUNC_EXIT__;
@@ -130,7 +102,7 @@ static int __net_add_route(const char *ip_addr, const char *interface)
                        NETCONFIG_NETWORK_INTERFACE, "AddRoute", param_array, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to Add route\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to add route\n");
                goto done;
        }
 
@@ -179,7 +151,7 @@ static int __net_remove_route(const char *ip_addr, const char *interface)
                        NETCONFIG_NETWORK_INTERFACE, "RemoveRoute", param_array, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to Remove route\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to remove route\n");
                goto done;
        }
 
@@ -245,13 +217,13 @@ EXPORT_API int net_register_client(net_event_cb_t event_cb, void *user_data)
        net_err_t Error = NET_ERR_NONE;
 
        if (event_cb == NULL) {
-                NETWORK_LOG(NETWORK_ERROR, "Error!! Invalid EventCb parameter\n");
+                NETWORK_LOG(NETWORK_ERROR, "Invalid EventCb parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (NetworkInfo.ClientEventCb != NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application Already registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application Already registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_ALREADY_REGISTERED;
        }
@@ -291,21 +263,23 @@ int net_register_client_ext(net_event_cb_t event_cb, net_device_t client_type, v
 {
        net_err_t Error = NET_ERR_NONE;
 
-       if (event_cb == NULL || (client_type != NET_DEVICE_DEFAULT && client_type != NET_DEVICE_WIFI)) {
-                NETWORK_LOG(NETWORK_ERROR, "Error!! Invalid EventCb parameter\n");
+       if (event_cb == NULL ||
+                       (client_type != NET_DEVICE_DEFAULT &&
+                        client_type != NET_DEVICE_WIFI)) {
+               NETWORK_LOG(NETWORK_ERROR, "Invalid EventCb parameter\n");
                return NET_ERR_INVALID_PARAM;
        }
 
        switch (client_type) {
        case NET_DEVICE_DEFAULT:
                if (NetworkInfo.ClientEventCb_conn != NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Connection CAPI Already registered\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Connection CAPI Already registered\n");
                        return NET_ERR_APP_ALREADY_REGISTERED;
                }
                break;
        case NET_DEVICE_WIFI:
                if (NetworkInfo.ClientEventCb_wifi != NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Wi-Fi CAPI Already registered\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Wi-Fi CAPI Already registered\n");
                        return NET_ERR_APP_ALREADY_REGISTERED;
                }
        default:
@@ -364,7 +338,7 @@ EXPORT_API int net_deregister_client(void)
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0 ||
            NetworkInfo.ClientEventCb == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
@@ -386,14 +360,14 @@ EXPORT_API int net_deregister_client(void)
 int net_deregister_client_ext(net_device_t client_type)
 {
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application was not registered\n");
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        switch (client_type) {
        case NET_DEVICE_DEFAULT:
                if (NetworkInfo.ClientEventCb_conn == NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Connection CAPI was not registered\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Connection CAPI was not registered\n");
                        return NET_ERR_APP_NOT_REGISTERED;
                }
                NetworkInfo.ClientEventCb_conn = NULL;
@@ -401,14 +375,14 @@ int net_deregister_client_ext(net_device_t client_type)
                break;
        case NET_DEVICE_WIFI:
                if (NetworkInfo.ClientEventCb_wifi == NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Wi-Fi CAPI was not registered\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Wi-Fi CAPI was not registered\n");
                        return NET_ERR_APP_NOT_REGISTERED;
                }
                NetworkInfo.ClientEventCb_wifi = NULL;
                NetworkInfo.user_data_wifi = NULL;
                break;
        default:
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid client_type parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid client_type parameter\n");
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -601,10 +575,10 @@ EXPORT_API int net_get_active_essid(net_essid_t *essid)
        }
 
        if (active_profile_info.profile_type == NET_DEVICE_CELLULAR) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Active(default) network is cellular type.\n");
+               NETWORK_LOG(NETWORK_ERROR, "Active network is cellular type.\n");
                Error = NET_ERR_NO_SERVICE;
        } else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Active(default) network is ethernet type.\n");
+               NETWORK_LOG(NETWORK_ERROR, "Active network is ethernet type.\n");
                Error = NET_ERR_NO_SERVICE;
        } else if (active_profile_info.profile_type == NET_DEVICE_WIFI) {
                wlan_info = &active_profile_info.ProfileInfo.Wlan;
@@ -661,35 +635,35 @@ EXPORT_API int net_get_active_proxy(net_proxy_t *proxy)
  */
 EXPORT_API int net_is_connected(void)
 {
-       char state[CONNMAN_STATE_STRLEN] = ""; /** Possible value are "online", "offline" and "connected" */
+       char state[CONNMAN_STATE_STRLEN] = "";
        net_err_t Error = NET_ERR_NONE;
 
        __NETWORK_FUNC_ENTER__;
        
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if ((Error = _net_dbus_get_state(state)) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! failed to get state. Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get state. Error [%s]\n",
                                _net_print_error(Error));
                __NETWORK_FUNC_EXIT__;
                return FALSE;
        }
 
-       if ((strcmp(state, "online") == 0) || (strcmp(state, "connected") == 0)) {
+       if ((g_strcmp0(state, "online") == 0) || (g_strcmp0(state, "connected") == 0)) {
                NETWORK_LOG(NETWORK_HIGH, "State [%s]\n", state);
+
                __NETWORK_FUNC_EXIT__;
-               return TRUE; 
+               return TRUE;
        }
 
-       __NETWORK_FUNC_EXIT__;  
+       __NETWORK_FUNC_EXIT__;
        return FALSE;
 }
 
-
 /**
  * @fn   EXPORT_API int net_get_network_status(net_service_type_t network_type, net_cm_network_status_t* pNetworkStatus)
  *
@@ -708,13 +682,13 @@ EXPORT_API int net_get_network_status(net_device_t device_type, net_cm_network_s
        __NETWORK_FUNC_ENTER__;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if ((Error = _net_dbus_get_network_status(device_type, network_status)) != NET_ERR_NONE) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! failed to get network status. Error [%s]\n",  
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get network status. Error [%s]\n",
                                _net_print_error(Error));
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -752,9 +726,8 @@ EXPORT_API int net_get_statistics(net_device_t device_type, net_statistics_type_
        net_err_t Error = NET_ERR_NONE;
 
        if ((Error = _net_dbus_get_statistics(device_type, statistics_type, size)) != NET_ERR_NONE )
-               NETWORK_LOG(NETWORK_ERROR,
-                       "Error!!! Failed to get statistics info. error : [%s]\n",
-                       _net_print_error(Error));
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get statistics. error: [%s]\n",
+                               _net_print_error(Error));
 
        return Error;
 }
@@ -764,9 +737,8 @@ EXPORT_API int net_set_statistics(net_device_t device_type, net_statistics_type_
        net_err_t Error = NET_ERR_NONE;
 
        if ((Error = _net_dbus_set_statistics(device_type, statistics_type)) != NET_ERR_NONE )
-               NETWORK_LOG(NETWORK_ERROR,
-                       "Error!!! Failed to set statistics info. error : [%s]\n",
-                       _net_print_error(Error));
+               NETWORK_LOG(NETWORK_ERROR, "Failed to set statistics. error: [%s]\n",
+                               _net_print_error(Error));
 
        return Error;
 }
@@ -776,16 +748,16 @@ EXPORT_API int net_add_route(const char *ip_addr, const char *interface)
        net_err_t Error = NET_ERR_NONE;
 
        if (ip_addr == NULL || strlen(ip_addr) < 7 || interface == NULL || strlen(interface) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        Error = __net_add_route(ip_addr, interface);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to add route. Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR, "Failed to add route. Error [%s]\n",
                                _net_print_error(Error));
+
                return Error;
        }
 
@@ -797,16 +769,17 @@ EXPORT_API int net_remove_route(const char *ip_addr, const char *interface)
        net_err_t Error = NET_ERR_NONE;
 
        if (ip_addr == NULL || strlen(ip_addr) < 7 || interface == NULL || strlen(interface) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        Error = __net_remove_route(ip_addr, interface);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to remove route. Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR, "Failed to remove route. Error [%s]\n",
                                _net_print_error(Error));
+
                return Error;
        }
 
@@ -817,7 +790,6 @@ EXPORT_API int net_remove_route(const char *ip_addr, const char *interface)
  *     ConnMan Wi-Fi Client Interface Async Function Definition
  *****************************************************************************/
 
-
 /**
  * @fn   EXPORT_API int net_open_connection_with_profile(const char *profile_name)
  *
@@ -828,58 +800,59 @@ EXPORT_API int net_remove_route(const char *ip_addr, const char *interface)
  * @param[in]    char *ProfileName - Profile Name to be connected
  * @param[out]   none
  */
-
 EXPORT_API int net_open_connection_with_profile(const char *profile_name)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-               
+
        NETWORK_LOG(NETWORK_HIGH, "ProfileName [%s] passed\n", profile_name);
 
        if (_net_check_profile_name(profile_name) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
        if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
        request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag = TRUE;
-       snprintf(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
+                       profile_name, NET_PROFILE_NAME_LEN_MAX+1);
 
-       if ((Error = _net_dbus_open_connection(profile_name)) != NET_ERR_NONE) {
+       Error = _net_dbus_open_connection(profile_name);
+       if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!! Failed to request open connection, Error [%s]\n", 
+                               "Failed to request open connection, Error [%s]\n",
                                _net_print_error(Error));
 
-               if(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE)
-                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
-                                       0, sizeof(network_request_table_t));
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                               0, sizeof(network_request_table_t));
 
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
-       NETWORK_LOG(NETWORK_HIGH, "Connect Request Success for ProfileName[%s]\n", profile_name);
-       __NETWORK_FUNC_EXIT__;  
+       NETWORK_LOG(NETWORK_HIGH, "Successfully request to connect %s\n",
+                       profile_name);
+
+       __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
@@ -902,48 +875,48 @@ EXPORT_API int net_open_connection_with_preference(net_service_type_t service_ty
        memset(&profile_name, 0, sizeof(net_profile_name_t));
 
        if (_net_is_valid_service_type(service_type) == FALSE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Service Type passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Service Type\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
        if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
        Error = _net_get_service_profile(service_type, &profile_name);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Failed to find service\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to find service\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag = TRUE;
-       snprintf(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name.ProfileName);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
+                       profile_name.ProfileName, NET_PROFILE_NAME_LEN_MAX+1);
 
-       if ((Error = _net_dbus_open_connection(profile_name.ProfileName)) != NET_ERR_NONE) {
+       Error = _net_dbus_open_connection(profile_name.ProfileName);
+       if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!! Failed to request open connection, Error [%s]\n",
+                               "Failed to request open connection, Error [%s]\n",
                                _net_print_error(Error));
 
-               if(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE)
-                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
-                                       0, sizeof(network_request_table_t));
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                               0, sizeof(network_request_table_t));
 
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -951,61 +924,71 @@ EXPORT_API int net_open_connection_with_preference(net_service_type_t service_ty
 
        NETWORK_LOG(NETWORK_HIGH, "Connect Request Success for ProfileName[%s]\n",
                        profile_name.ProfileName);
+
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
-int net_open_connection_with_preference_ext(net_service_type_t service_type, net_profile_name_t *prof_name)
+int net_open_connection_with_preference_ext(net_service_type_t service_type,
+               net_profile_name_t *prof_name)
 {
+       __NETWORK_FUNC_ENTER__;
+
        net_err_t Error = NET_ERR_NONE;
        net_profile_name_t profile_name;
        memset(&profile_name, 0, sizeof(net_profile_name_t));
 
        if (_net_is_valid_service_type(service_type) == FALSE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Service Type passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid service type\n");
+               __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (prof_name == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid profile name passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
+               __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
+               __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
+               __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
        if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
        Error = _net_get_service_profile(service_type, &profile_name);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Failed to find service\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to find service\n");
+               __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag = TRUE;
-       snprintf(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name.ProfileName);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
+                       profile_name.ProfileName, NET_PROFILE_NAME_LEN_MAX+1);
 
-       if ((Error = _net_dbus_open_connection(profile_name.ProfileName)) != NET_ERR_NONE) {
+       Error = _net_dbus_open_connection(profile_name.ProfileName);
+       if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!! Failed to request open connection, Error [%s]\n",
+                               "Failed to request open connection, Error [%s]\n",
                                _net_print_error(Error));
 
-               if(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE)
-                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
-                                       0, sizeof(network_request_table_t));
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                               0, sizeof(network_request_table_t));
 
+               __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
@@ -1013,6 +996,8 @@ int net_open_connection_with_preference_ext(net_service_type_t service_type, net
                        profile_name.ProfileName);
 
        memcpy(prof_name, &profile_name, sizeof(net_profile_name_t));
+
+       __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
@@ -1030,25 +1015,25 @@ int net_open_connection_with_preference_ext(net_service_type_t service_type, net
 EXPORT_API int net_close_connection(const char *profile_name)
 {
        __NETWORK_FUNC_ENTER__;
-       
+
        net_err_t Error = NET_ERR_NONE;
 
        NETWORK_LOG(NETWORK_HIGH, "ProfileName [%s] passed\n", profile_name);
 
        if (_net_check_profile_name(profile_name) != NET_ERR_NONE) {
-                NETWORK_LOG(NETWORK_ERROR, "Error!! Invalid ProfileName parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
@@ -1061,17 +1046,17 @@ EXPORT_API int net_close_connection(const char *profile_name)
        }
 
        request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag = TRUE;
-       snprintf(request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].ProfileName,
+                       profile_name, NET_PROFILE_NAME_LEN_MAX+1);
 
-       if ((Error = _net_dbus_close_connection(profile_name)) != NET_ERR_NONE) {
+       Error = _net_dbus_close_connection(profile_name);
+       if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!! Failed to request close connection, Error [%s]\n", 
+                               "Failed to request close connection, Error [%s]\n",
                                _net_print_error(Error));
-       
-               if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE)
-                       memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION],
-                                       0, sizeof(network_request_table_t));
+
+               memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION],
+                               0, sizeof(network_request_table_t));
 
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -1080,7 +1065,3 @@ EXPORT_API int net_close_connection(const char *profile_name)
        __NETWORK_FUNC_EXIT__;  
        return NET_ERR_NONE;
 }
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
index 763786f..2c978ad 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h> 
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <vconf.h>
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
+#include <arpa/inet.h>
+#include <netinet/in.h>
 
 #include "network-internal.h"
 #include "network-dbus-request.h"
@@ -48,30 +27,15 @@ extern "C"
 /*****************************************************************************
  *     Macros and Typedefs
  *****************************************************************************/
-
 #define DBUS_REPLY_TIMEOUT (120 * 1000)
 
 /*****************************************************************************
- *     Local Functions Declaration
- *****************************************************************************/
-
-static int __net_error_string_to_enum(const char* error);
-static int __net_netconfig_error_string_to_enum(const char* error);
-static int _net_get_error_from_message(DBusMessage *message);
-static int _net_get_error_from_netconfig_message(DBusMessage *message);
-static void __net_open_connection_reply(DBusPendingCall *call, void *user_data);
-static void __net_close_connection_reply(DBusPendingCall *call, void *user_data);
-static void __net_wifi_power_reply(DBusPendingCall *call, void *user_data);
-
-/*****************************************************************************
  *     Global Functions
  *****************************************************************************/
 
-
 /*****************************************************************************
  *     Global Variables
  *****************************************************************************/
-
 struct dbus_pending_call_data {
        DBusPendingCall *pcall;
        dbus_bool_t is_used;
@@ -85,11 +49,9 @@ static struct dbus_pending_call_data network_dbus_pending_call_data = {
 /*****************************************************************************
  *     Extern Variables
  *****************************************************************************/
-
 extern network_info_t NetworkInfo;
 extern network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX];
 
-
 /*****************************************************************************
  *     Extern Functions 
  *****************************************************************************/
@@ -97,7 +59,6 @@ extern network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX];
 /*****************************************************************************
  *     Local Functions Definition
  *****************************************************************************/
-
 static int __net_error_string_to_enum(const char* error)
 {
        NETWORK_LOG(NETWORK_HIGH, "Passed error value [%s]\n", error);
@@ -174,10 +135,11 @@ static int _net_get_error_from_message(DBusMessage *message)
        MessageType = dbus_message_get_type(message);
 
        if (MessageType == DBUS_MESSAGE_TYPE_ERROR) {
-               const char* ptr = dbus_message_get_error_name(message);
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Error message received [%s]\n", ptr);
+               const char* str = dbus_message_get_error_name(message);
+
+               NETWORK_LOG(NETWORK_ERROR, "message %s\n", str);
                __NETWORK_FUNC_EXIT__;
-               return __net_error_string_to_enum(ptr);
+               return __net_error_string_to_enum(str);
        }
 
        __NETWORK_FUNC_EXIT__;
@@ -193,10 +155,10 @@ static int _net_get_error_from_netconfig_message(DBusMessage *message)
        MessageType = dbus_message_get_type(message);
 
        if (MessageType == DBUS_MESSAGE_TYPE_ERROR) {
-               const char* ptr = dbus_message_get_error_name(message);
+               const char* str = dbus_message_get_error_name(message);
                const char* err_msg = _net_get_string(message);
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Error message received [%s] [%s]\n", ptr, err_msg);
+
+               NETWORK_LOG(NETWORK_ERROR, "message %s %s\n", str, err_msg);
                __NETWORK_FUNC_EXIT__;
                return __net_netconfig_error_string_to_enum(err_msg);
        }
@@ -214,8 +176,10 @@ static void __net_open_connection_reply(DBusPendingCall *call, void *user_data)
        int callback_flag = FALSE;
        net_event_info_t event_data = {0,};
        net_profile_info_t prof_info;
-       network_request_table_t *open_info = &request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION];
-       network_request_table_t *wps_info = &request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS];
+       network_request_table_t *open_info =
+                       &request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION];
+       network_request_table_t *wps_info =
+                       &request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS];
 
        DBusMessage *reply = dbus_pending_call_steal_reply(call);
        net_err_t Error = _net_get_error_from_message(reply);
@@ -223,20 +187,17 @@ static void __net_open_connection_reply(DBusPendingCall *call, void *user_data)
        if (Error == NET_ERR_NONE)
                goto done;
 
-       NETWORK_LOG(NETWORK_ERROR,
-               "Error!!! Connection open failed. Error code : [%d]\n", Error);
+       NETWORK_LOG(NETWORK_ERROR, "Connection open failed. Error [%d]\n", Error);
 
        if (open_info->flag == TRUE) {
-               net_device_t device_type = _net_get_tech_type_from_path(open_info->ProfileName);
+               net_device_t device_type =
+                               _net_get_tech_type_from_path(open_info->ProfileName);
 
-               if (Error == NET_ERR_IN_PROGRESS &&
-                   device_type == NET_DEVICE_CELLULAR)
+               if (Error == NET_ERR_IN_PROGRESS && device_type == NET_DEVICE_CELLULAR)
                        goto done;
 
-               snprintf(event_data.ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX + 1, "%s",
-                       open_info->ProfileName);
-
+               g_strlcpy(event_data.ProfileName, open_info->ProfileName,
+                               NET_PROFILE_NAME_LEN_MAX + 1);
                memset(open_info, 0, sizeof(network_request_table_t));
 
                event_data.Error = Error;
@@ -248,9 +209,9 @@ static void __net_open_connection_reply(DBusPendingCall *call, void *user_data)
                                event_data.Error = NET_ERR_NONE;
 
                        if (Error != NET_ERR_NONE) {
-                               NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! net_get_profile_info() failed [%s]\n",
-                                       _net_print_error(Error));
+                               NETWORK_LOG(NETWORK_ERROR, "Fail to get profile info [%s]\n",
+                                               _net_print_error(Error));
+
                                event_data.Datalength = 0;
                                event_data.Data = NULL;
                        } else {
@@ -265,11 +226,8 @@ static void __net_open_connection_reply(DBusPendingCall *call, void *user_data)
 
                callback_flag = TRUE;
        } else if (wps_info->flag == TRUE) {
-
-               snprintf(event_data.ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX + 1, "%s",
-                       wps_info->ProfileName);
-
+               g_strlcpy(event_data.ProfileName, wps_info->ProfileName,
+                               NET_PROFILE_NAME_LEN_MAX + 1);
                memset(wps_info, 0, sizeof(network_request_table_t));
 
                event_data.Error = Error;
@@ -277,9 +235,9 @@ static void __net_open_connection_reply(DBusPendingCall *call, void *user_data)
                if (Error == NET_ERR_ACTIVE_CONNECTION_EXISTS) {
                        Error = net_get_profile_info(event_data.ProfileName, &prof_info);
                        if (Error != NET_ERR_NONE) {
-                               NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! net_get_profile_info() failed [%s]\n",
-                                       _net_print_error(Error));
+                               NETWORK_LOG(NETWORK_ERROR, "Fail to get profile info [%s]\n",
+                                               _net_print_error(Error));
+
                                event_data.Datalength = 0;
                                event_data.Data = NULL;
                        } else {
@@ -317,7 +275,8 @@ static void __net_close_connection_reply(DBusPendingCall *call, void *user_data)
 
        int callback_flag = FALSE;
        net_event_info_t event_data = {0,};
-       network_request_table_t *close_info = &request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION];
+       network_request_table_t *close_info =
+                       &request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION];
 
        DBusMessage *reply = dbus_pending_call_steal_reply(call);
        net_err_t Error = _net_get_error_from_message(reply);
@@ -325,26 +284,25 @@ static void __net_close_connection_reply(DBusPendingCall *call, void *user_data)
        if (Error == NET_ERR_NONE)
                goto done;
 
-       NETWORK_LOG(NETWORK_ERROR,
-               "Error!!! Connection close failed. Error code : [%d]\n", Error);
+       NETWORK_LOG(NETWORK_ERROR, "Connection close failed. Error [%d]\n", Error);
 
        if (close_info->flag == TRUE) {
-               net_device_t device_type = _net_get_tech_type_from_path(close_info->ProfileName);
+               net_device_t device_type =
+                               _net_get_tech_type_from_path(close_info->ProfileName);
 
                if (Error == NET_ERR_ACTIVE_CONNECTION_EXISTS &&
                    device_type == NET_DEVICE_CELLULAR)
                        Error = NET_ERR_NONE;
 
-               snprintf(event_data.ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX + 1, "%s",
-                       close_info->ProfileName);
-
+               g_strlcpy(event_data.ProfileName, close_info->ProfileName,
+                               NET_PROFILE_NAME_LEN_MAX + 1);
                memset(close_info, 0, sizeof(network_request_table_t));
 
                event_data.Error = Error;
                event_data.Datalength = 0;
                event_data.Data = NULL;
                event_data.Event = NET_EVENT_CLOSE_RSP;
+
                NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_RSP Error = %s\n",
                                _net_print_error(event_data.Error));
 
@@ -376,7 +334,8 @@ static void __net_wifi_power_reply(DBusPendingCall *call, void *user_data)
        net_event_info_t event_data = {0,};
 
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Wifi Power on/off failed. Error code : [%d]\n", Error);
+               NETWORK_LOG(NETWORK_ERROR,
+                               "Wi-Fi power operation failed. Error [%d]\n", Error);
 
                if (Error != NET_ERR_WIFI_DRIVER_LOAD_INPROGRESS) {
                        if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
@@ -384,9 +343,10 @@ static void __net_wifi_power_reply(DBusPendingCall *call, void *user_data)
                                                0, sizeof(network_request_table_t));
 
                                event_data.Event = NET_EVENT_WIFI_POWER_RSP;
+
                                NETWORK_LOG(NETWORK_LOW,
-                                       "Sending NET_EVENT_WIFI_POWER_RSP wifi state : %d Error = %d\n",
-                                       NetworkInfo.wifi_state, Error);
+                                               "Sending NET_EVENT_WIFI_POWER_RSP Wi-Fi: %d Error = %d\n",
+                                               NetworkInfo.wifi_state, Error);
 
                                event_data.Datalength = sizeof(net_wifi_state_t);
                                event_data.Data = &(NetworkInfo.wifi_state);
@@ -419,21 +379,23 @@ static void __net_specific_scan_wifi_reply(DBusPendingCall *call, void *user_dat
        net_event_info_t event_data = {0,};
 
        if (Error != NET_ERR_NONE)
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Find hidden AP failed. Error code : [%d]\n", Error);
+               NETWORK_LOG(NETWORK_ERROR, "Find hidden AP failed. Error [%d]\n", Error);
        else
-               NETWORK_LOG(NETWORK_LOW, "Hidden AP response received for AP.\n");
+               NETWORK_LOG(NETWORK_LOW, "Hidden AP found\n");
 
        if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
                if (NET_ERR_NONE != Error) {
-                       /* An error occured. So lets reset specific scan request entry in the request table */
+                       /* An error occurred.
+                        * So lets reset specific scan request entry in the request table */
                        memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN],
                                        0, sizeof(network_request_table_t));
                }
 
                event_data.Event = NET_EVENT_SPECIFIC_SCAN_RSP;
+
                NETWORK_LOG(NETWORK_LOW,
-                       "Sending NET_EVENT_SPECIFIC_SCAN_RSP wifi state : %d Error = %d\n",
-                       NetworkInfo.wifi_state, Error);
+                               "Sending NET_EVENT_SPECIFIC_SCAN_RSP Wi-Fi: %d Error = %d\n",
+                               NetworkInfo.wifi_state, Error);
 
                event_data.Datalength = sizeof(net_wifi_state_t);
                event_data.Data = &(NetworkInfo.wifi_state);
@@ -549,7 +511,8 @@ static void __net_set_default_reply(DBusPendingCall *call, void *user_data)
 
 static char *__net_make_group_name(const char *ssid, const char *net_mode, const char *sec)
 {
-       char *buf;
+       char *buf = NULL;
+       char *pbuf = NULL;
        const char *hidden_str = "hidden";
        const char *g_sec;
        char buf_tmp[32] = {0,};
@@ -581,16 +544,18 @@ static char *__net_make_group_name(const char *ssid, const char *net_mode, const
                return NULL;
 
        if (NULL != ssid) {
+               pbuf = buf;
                for (i = 0; i < ssid_len; i++) {
-                       snprintf(buf_tmp, 3, "%02x", ssid[i]);
-                       strcat(buf, buf_tmp);
+                       g_snprintf(pbuf, 3, "%02x", ssid[i]);
+                       pbuf += 2;
                }
-       } else {
-               strcat(buf, hidden_str);
-       }
+       } else
+               g_strlcat(buf, hidden_str,
+                               actual_len + strlen(net_mode) + strlen(sec) + 3);
 
-       snprintf(buf_tmp, 32, "_%s_%s", net_mode, g_sec);
-       strcat(buf, buf_tmp);
+       g_snprintf(buf_tmp, 32, "_%s_%s", net_mode, g_sec);
+       g_strlcat(buf, buf_tmp,
+                       actual_len + strlen(net_mode) + strlen(sec) + 3);
 
        NETWORK_LOG(NETWORK_HIGH, "Group name : %s\n", buf);
 
@@ -617,21 +582,21 @@ static int __net_append_param(DBusMessage *message, char *param_array[])
 
                ch = strchr(args, ':');
                if (ch == NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter[\"%s\"]\n", args);
+                       NETWORK_LOG(NETWORK_ERROR, "Invalid parameter[\"%s\"]\n", args);
                        return NET_ERR_INVALID_PARAM;
                }
                *ch = 0; ch++;
 
-               if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_STRING) == 0) {
+               if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_STRING) == 0)
                        dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &ch);
-               else if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_UINT32) == 0) {
+               else if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_UINT32) == 0) {
                        uint32 = strtoul(ch, NULL, 0);
                        dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &uint32);
                } else if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_VARIANT) == 0) {
                        args = ch;
                        ch = strchr(args, ':');
                        if (ch == NULL) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid data format[\"%s\"]\n", args);
+                               NETWORK_LOG(NETWORK_ERROR, "Invalid data format[\"%s\"]\n", args);
                                return NET_ERR_INVALID_PARAM;
                        }
                        *ch = 0; ch++;
@@ -642,11 +607,11 @@ static int __net_append_param(DBusMessage *message, char *param_array[])
                                dbus_message_iter_append_basic(&container_iter, DBUS_TYPE_STRING, &ch);
                                dbus_message_iter_close_container(&iter, &container_iter);
                        } else {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Not supported data format[\"%s\"]\n", args);
+                               NETWORK_LOG(NETWORK_ERROR, "Not supported data format[\"%s\"]\n", args);
                                return NET_ERR_INVALID_PARAM;
                        }
                } else {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Not supported data format[\"%s\"]\n", args);
+                       NETWORK_LOG(NETWORK_ERROR, "Not supported data format[\"%s\"]\n", args);
                        return NET_ERR_INVALID_PARAM;
                }
 
@@ -667,12 +632,13 @@ static inline void __net_dict_append_strings(DBusMessageIter *dict,
        dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &value);
        dbus_message_iter_close_container(dict, &entry);
 }
+
 /*****************************************************************************
  *     Global Functions Definition
  *****************************************************************************/
-
 DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
-               char* interface_name, char* method, char *param_array[], int *dbus_error)
+               char* interface_name, char* method,
+               char* param_array[], int* dbus_error)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -683,51 +649,64 @@ DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
 
        *dbus_error = NET_ERR_NONE;
 
-       NETWORK_LOG(NETWORK_HIGH, "[DBUS Sync] %s.%s, %s\n", interface_name, method, path);
+       NETWORK_LOG(NETWORK_HIGH, "[DBUS Sync] %s.%s, %s\n",
+                       interface_name, method, path);
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
+
                *dbus_error = NET_ERR_UNKNOWN;
+
                __NETWORK_FUNC_EXIT__;
                return NULL;
        }
 
        message = dbus_message_new_method_call(dest, path, interface_name, method);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
+
                dbus_connection_unref(conn);
                *dbus_error = NET_ERR_UNKNOWN;
+
                __NETWORK_FUNC_EXIT__;
                return NULL;
        }
 
        if (__net_append_param(message, param_array) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_param() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "__net_append_param() failed\n");
+
                dbus_message_unref(message);
                dbus_connection_unref(conn);
+
                *dbus_error = NET_ERR_INVALID_PARAM;
+
                __NETWORK_FUNC_EXIT__;
                return NULL;
        }
 
        dbus_error_init(&error);
 
-       reply = dbus_connection_send_with_reply_and_block(conn, message, DBUS_REPLY_TIMEOUT, &error);
+       reply = dbus_connection_send_with_reply_and_block(conn, message,
+                                                               DBUS_REPLY_TIMEOUT, &error);
        if (reply == NULL) {
                if (dbus_error_is_set(&error) == TRUE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! dbus_connection_send_with_reply_and_block() failed. dbus error [%s: %s]\n",
-                                       error.name, error.message);
+                                       "dbus_connection_send_with_reply_and_block() failed."
+                                       "error [%s: %s]\n", error.name, error.message);
+
                        *dbus_error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error);
                } else {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_connection_send_with_reply_and_block() failed\n");
+                       NETWORK_LOG(NETWORK_ERROR,
+                                       "dbus_connection_send_with_reply_and_block() failed\n");
+
                        *dbus_error = NET_ERR_UNKNOWN;
                }
 
                dbus_message_unref(message);
                dbus_connection_unref(conn);
+
                __NETWORK_FUNC_EXIT__;
                return NULL;
        }
@@ -740,44 +719,57 @@ DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
 }
 
 int _net_invoke_dbus_method_nonblock(const char* dest, const char* path,
-               char* interface_name, char* method, DBusPendingCallNotifyFunction notify_func)
+               char* interface_name, char* method,
+               DBusPendingCallNotifyFunction notify_func)
 {
        __NETWORK_FUNC_ENTER__;
 
-       DBusConnectionconn = NULL;
+       DBusConnection *conn = NULL;
        DBusMessage *message = NULL;
        DBusPendingCall *call;
        dbus_bool_t result;
 
-       NETWORK_LOG(NETWORK_HIGH, "[DBUS Async] %s.%s, %s\n", interface_name, method, path);
+       NETWORK_LOG(NETWORK_HIGH, "[DBUS Async] %s.%s, %s\n",
+                       interface_name, method, path);
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        message = dbus_message_new_method_call(dest, path, interface_name, method);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() Failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() Failed\n");
+
                dbus_connection_unref(conn);
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       result = dbus_connection_send_with_reply(conn, message, &call, DBUS_REPLY_TIMEOUT);
-
+       result = dbus_connection_send_with_reply(conn, message, &call,
+                       DBUS_REPLY_TIMEOUT);
        if (result == FALSE || call == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_connection_send_with_reply() Failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_connection_send_with_reply() Failed\n");
+
                dbus_message_unref(message);
                dbus_connection_unref(conn);
+
+               __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       dbus_pending_call_set_notify(call, notify_func, NULL, NULL);
-       network_dbus_pending_call_data.pcall = call;
-       network_dbus_pending_call_data.is_used = TRUE;
+       if (notify_func == NULL)
+               dbus_pending_call_cancel(call);
+       else {
+               dbus_pending_call_set_notify(call, notify_func, NULL, NULL);
+
+               network_dbus_pending_call_data.pcall = call;
+               network_dbus_pending_call_data.is_used = TRUE;
+       }
 
        dbus_message_unref(message);
        dbus_connection_unref(conn);
@@ -825,9 +817,6 @@ int _net_dbus_scan_request(void)
        if (Error == NET_ERR_IN_PROGRESS)
                Error = NET_ERR_NONE;
 
-       if (Error != NET_ERR_NONE)
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method_nonblock failed\n");
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
@@ -838,7 +827,7 @@ int _net_dbus_set_default(const char* profile_name)
 
        net_err_t Error = NET_ERR_NONE;
 
-       Error = _net_invoke_dbus_method_nonblock(TELEPHONY_SERVCE,
+       Error = _net_invoke_dbus_method_nonblock(TELEPHONY_SERVICE,
                        profile_name, TELEPHONY_PROFILE_INTERFACE,
                        "SetDefaultConnection", __net_set_default_reply);
 
@@ -864,7 +853,7 @@ int _net_dbus_set_bgscan_mode(net_wifi_background_scan_mode_t mode)
                        NETCONFIG_WIFI_INTERFACE, "SetBgscan", param_array, &Error);
 
        if (Error != NET_ERR_NONE)
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_invoke_dbus_method failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed\n");
 
        if (message)
                dbus_message_unref(message);
@@ -881,25 +870,17 @@ int _net_dbus_get_technology_state(network_tech_state_info_t* tech_state)
        DBusMessage *message = NULL;
 
        if ((tech_state == NULL) || (strlen(tech_state->technology) == 0)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (strcmp(tech_state->technology, "wifi") == 0) {
-               int hotspot_state = 0;
-               vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
-
-               if (hotspot_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI)
-                       goto done;
-       }
-
        message = _net_invoke_dbus_method(CONNMAN_SERVICE,
                        CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
                        "GetTechnologies", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get technology info\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get technology info\n");
                goto done;
        }
 
@@ -926,13 +907,13 @@ int _net_dbus_get_network_status(net_device_t device_type, net_cm_network_status
        network_tech_state_info_t tech_state = {{0,},};
 
        if (device_type == NET_DEVICE_WIFI)
-               snprintf(tech_state.technology, NET_TECH_LENGTH_MAX, "%s", "wifi");
+               g_strlcpy(tech_state.technology, "wifi", NET_TECH_LENGTH_MAX);
        else if (device_type == NET_DEVICE_CELLULAR)
-               snprintf(tech_state.technology, NET_TECH_LENGTH_MAX, "%s", "cellular");
+               g_strlcpy(tech_state.technology, "cellular", NET_TECH_LENGTH_MAX);
        else if (device_type == NET_DEVICE_ETHERNET)
-               snprintf(tech_state.technology, NET_TECH_LENGTH_MAX, "%s", "ethernet");
+               g_strlcpy(tech_state.technology, "ethernet", NET_TECH_LENGTH_MAX);
        else if (device_type == NET_DEVICE_BLUETOOTH)
-               snprintf(tech_state.technology, NET_TECH_LENGTH_MAX, "%s", "bluetooth");
+               g_strlcpy(tech_state.technology, "bluetooth", NET_TECH_LENGTH_MAX);
        else {
                Error = NET_ERR_INVALID_PARAM;
                goto done;
@@ -941,7 +922,7 @@ int _net_dbus_get_network_status(net_device_t device_type, net_cm_network_status
        Error = _net_dbus_get_technology_state(&tech_state);
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                       "Error!!! _net_dbus_get_technology_state() failed. Error [%s]\n",
+                       "_net_dbus_get_technology_state() failed. Error [%s]\n",
                        _net_print_error(Error));
                goto done;
        }
@@ -1020,11 +1001,11 @@ int _net_dbus_get_statistics(net_device_t device_type, net_statistics_type_e sta
                        method = "GetWifiTotalTxBytes";
                        break;
                default:
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                        return NET_ERR_INVALID_PARAM;
                }
        } else {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -1032,7 +1013,7 @@ int _net_dbus_get_statistics(net_device_t device_type, net_statistics_type_e sta
                        NETCONFIG_SERVICE, NETCONFIG_STATISTICS_PATH,
                        NETCONFIG_STATISTICS_INTERFACE, method, NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service properties\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get service properties\n");
                return Error;
        }
 
@@ -1065,7 +1046,7 @@ int _net_dbus_set_statistics(net_device_t device_type, net_statistics_type_e sta
                        method = "ResetCellularTotalTxBytes";
                        break;
                default:
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                        return NET_ERR_INVALID_PARAM;
                }
        } else if (device_type == NET_DEVICE_WIFI) {
@@ -1083,11 +1064,11 @@ int _net_dbus_set_statistics(net_device_t device_type, net_statistics_type_e sta
                        method = "ResetWifiTotalTxBytes";
                        break;
                default:
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                        return NET_ERR_INVALID_PARAM;
                }
        } else {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -1095,7 +1076,7 @@ int _net_dbus_set_statistics(net_device_t device_type, net_statistics_type_e sta
                        NETCONFIG_SERVICE, NETCONFIG_STATISTICS_PATH,
                        NETCONFIG_STATISTICS_INTERFACE, method, NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service properties\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get service properties\n");
                return Error;
        }
 
@@ -1124,9 +1105,9 @@ int _net_dbus_get_state(char* state)
        }
 
        net_state = _net_get_string(message);
-       snprintf(state, CONNMAN_STATE_STRLEN, "%s", net_state);
+       g_strlcpy(state, net_state, CONNMAN_STATE_STRLEN);
 
-       NETWORK_LOG( NETWORK_HIGH, "State: %s\n", state);
+       NETWORK_LOG(NETWORK_HIGH, "State: %s\n", state);
 
        dbus_message_unref(message);
 
@@ -1148,7 +1129,7 @@ int _net_dbus_set_eap_config_fields(
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (NULL == conn) {
-               NETWORK_LOG(NETWORK_ERROR, "Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1157,7 +1138,7 @@ int _net_dbus_set_eap_config_fields(
                        NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE,
                        "CreateConfig");
        if (NULL == message) {
-               NETWORK_LOG( NETWORK_ERROR, "dbus_message_new_method_call() "
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() "
                                "failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
@@ -1302,7 +1283,7 @@ int _net_dbus_set_agent_fields(const char *name, const char *passphrase)
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (NULL == conn) {
-               NETWORK_LOG(NETWORK_ERROR, "Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1311,7 +1292,7 @@ int _net_dbus_set_agent_fields(const char *name, const char *passphrase)
                        NETCONFIG_WIFI_PATH, CONNMAN_AGENT_INTERFACE,
                        "SetField");
        if (NULL == message) {
-               NETWORK_LOG( NETWORK_ERROR, "dbus_message_new_method_call() "
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() "
                                "failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
@@ -1403,7 +1384,7 @@ int _net_dbus_connect_service(const net_wifi_connect_service_info_t *wifi_connec
                        wifi_connection_info->mode,
                        wifi_connection_info->security);
        if (NULL == grp_name) {
-               NETWORK_LOG(NETWORK_ERROR, "Error! can't make a group name\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to make a group name\n");
 
                NET_MEMFREE(hidden_grp_name);
 
@@ -1411,12 +1392,12 @@ int _net_dbus_connect_service(const net_wifi_connect_service_info_t *wifi_connec
                return NET_ERR_UNKNOWN;
        }
 
-       Error = _net_get_profile_list(NET_DEVICE_WIFI, &profile_info,
-                       &profile_count);
+       Error = _net_get_profile_list(NET_DEVICE_WIFI, &profile_info, &profile_count);
        if (NET_ERR_NONE != Error) {
                NETWORK_LOG(NETWORK_ERROR,
                                "_net_get_profile_list fail. Error [%s]\n",
                                _net_print_error(Error));
+
                goto done;
        } else {
                for (i = 0; i < profile_count; i++) {
@@ -1472,23 +1453,19 @@ int _net_dbus_connect_service(const net_wifi_connect_service_info_t *wifi_connec
 
        /* Caching the group_name which has 'ssid' in hex, as the connection
         * response contains the profile with 'ssid' */
-       snprintf(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", grp_name);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
+                       grp_name, NET_PROFILE_NAME_LEN_MAX+1);
 
        Error = _net_dbus_open_connection(profile_info[i].ProfileName);
        if (NET_ERR_NONE != Error) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "_net_dbus_open_connection fail, Error [%s]\n",
+                               "Failed to request open connection, Error [%s]\n",
                                _net_print_error(Error));
 
-               if(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE)
-                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
-                                       0, sizeof(network_request_table_t));
-
-               goto done;
-       }
-
-       NETWORK_LOG(NETWORK_HIGH, "Sent Connect request\n");
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                               0, sizeof(network_request_table_t));
+       } else
+               NETWORK_LOG(NETWORK_HIGH, "Sent Connect request\n");
 
 done:
        NET_MEMFREE(profile_info);
@@ -1504,7 +1481,8 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusError error; 
+       DBusError error;
+
        const char *manual_method = "manual";
        const char *dhcp_method = "dhcp";
        const char *off_method = "off";
@@ -1529,26 +1507,29 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        DBusConnection* conn = NULL;
 
        if ((prof_info == NULL) || (profile_name == NULL) || (strlen(profile_name) == 0)) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Invalid argument\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid argument\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
-       snprintf(ip_buffer, NETPM_IPV4_STR_LEN_MAX + 1, "%s",
-               inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4));
+       g_strlcpy(ip_buffer,
+                       inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4),
+                       NETPM_IPV4_STR_LEN_MAX + 1);
 
-       snprintf(netmask_buffer, NETPM_IPV4_STR_LEN_MAX + 1, "%s",
-               inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4));
+       g_strlcpy(netmask_buffer,
+                       inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4),
+                       NETPM_IPV4_STR_LEN_MAX + 1);
 
-       snprintf(gateway_buffer, NETPM_IPV4_STR_LEN_MAX + 1, "%s",
-               inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4));
+       g_strlcpy(gateway_buffer,
+                       inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4),
+                       NETPM_IPV4_STR_LEN_MAX + 1);
 
-       NETWORK_LOG(NETWORK_HIGH, "ipaddress : %s, netmask : %s, gateway : %s\n",
+       NETWORK_LOG(NETWORK_HIGH, "ipaddress: %s, netmask: %s, gateway: %s\n",
                        ipaddress, netmask, gateway);
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1557,12 +1538,12 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        message = dbus_message_new_method_call(CONNMAN_SERVICE,
                        profile_name, CONNMAN_SERVICE_INTERFACE, "SetProperty");
        if (message == NULL) {
-               NETWORK_LOG( NETWORK_ERROR,  "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
-       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2 : %s %s %s %s\n", CONNMAN_SERVICE,
+       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2: %s %s %s %s\n", CONNMAN_SERVICE,
                        profile_name, CONNMAN_SERVICE_INTERFACE, "SetProperty");
 
        dbus_message_iter_init_append(message, &itr);
@@ -1595,7 +1576,7 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
                dbus_message_iter_close_container(&entry, &sub_variant);
 
                dbus_message_iter_close_container(&dict, &entry);
-               NETWORK_LOG(NETWORK_HIGH,  "DBus Message 2/2 : %s %s\n", prop_method, dhcp_method);
+               NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2: %s %s\n", prop_method, dhcp_method);
        } else if (prof_info->ProfileInfo.Wlan.net_info.IpConfigType == NET_IP_CONFIG_TYPE_OFF) {
                dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
 
@@ -1606,7 +1587,7 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
                dbus_message_iter_close_container(&entry, &sub_variant);
 
                dbus_message_iter_close_container(&dict, &entry);
-               NETWORK_LOG(NETWORK_HIGH,  "DBus Message 2/2 : %s %s\n", prop_method, off_method);
+               NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2: %s %s\n", prop_method, off_method);
        } else if (prof_info->ProfileInfo.Wlan.net_info.IpConfigType == NET_IP_CONFIG_TYPE_STATIC) {
                dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
 
@@ -1648,11 +1629,11 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
 
                dbus_message_iter_close_container(&dict, &entry);
 
-               NETWORK_LOG(NETWORK_HIGH,  "DBus Message 2/2 : %s %s %s %s %s %s %s %s\n",
+               NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2: %s %s %s %s %s %s %s %s\n",
                                prop_method, manual_method, prop_address, ipaddress,
                                prop_netmask, netmask, prop_gateway, gateway);
        } else {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Invalid argument\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid argument\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -1669,11 +1650,10 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        if (reply == NULL) {
                if (dbus_error_is_set (&error) == TRUE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
-                               error.name,
-                               error.message);
+                               "dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
+                               error.name, error.message);
                        Error = __net_error_string_to_enum(error.name);
-                       dbus_error_free(&error); 
+                       dbus_error_free(&error);
                        dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
@@ -1700,7 +1680,7 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusError error; 
+       DBusError error;
 
        const char *prop_nameserver_configuration = "Nameservers.Configuration";
        char dns_buffer[NET_DNS_ADDR_MAX][NETPM_IPV4_STR_LEN_MAX+1];
@@ -1714,7 +1694,7 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
 
        if ((prof_info == NULL) || (profile_name == NULL) || (strlen(profile_name) == 0) ||
            (prof_info->ProfileInfo.Wlan.net_info.DnsCount > NET_DNS_ADDR_MAX)) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -1724,15 +1704,16 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
                dns_address[i] = NULL;
 
                if (prof_info->ProfileInfo.Wlan.net_info.DnsAddr[i].Data.Ipv4.s_addr != 0)
-                       snprintf(dns_buffer[i],  NETPM_IPV4_STR_LEN_MAX + 1, "%s",
-                               inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.DnsAddr[i].Data.Ipv4));
+                       g_strlcpy(dns_buffer[i],
+                                       inet_ntoa(prof_info->ProfileInfo.Wlan.net_info.DnsAddr[i].Data.Ipv4),
+                                       NETPM_IPV4_STR_LEN_MAX + 1);
 
                dns_address[i] = dns_buffer[i];
        }
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1743,7 +1724,7 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
 
                if (message == NULL) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! dbus_message_new_method_call() failed\n");
+                                       "dbus_message_new_method_call() failed\n");
                        __NETWORK_FUNC_EXIT__;
                        return NET_ERR_UNKNOWN;
                }
@@ -1774,9 +1755,8 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
                if (reply == NULL) {
                        if (dbus_error_is_set (&error) == TRUE) {
                                NETWORK_LOG(NETWORK_ERROR,
-                                               "Error!!! dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
-                                               error.name,
-                                               error.message);
+                                       "dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
+                                       error.name, error.message);
                                Error = __net_error_string_to_enum(error.name);
                                dbus_error_free(&error);
                                dbus_message_unref(message);
@@ -1803,9 +1783,9 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        net_err_t Error = NET_ERR_NONE;
        DBusError error;
 
-       const char *direct_method = "direct"; /* not method[] as gcc screws it with dbus */
-       const char *auto_method = "auto"; /* not method[] as gcc screws it with dbus */
-       const char *manual_method = "manual"; /* not method[] as gcc screws it with dbus */
+       const char *direct_method = "direct";
+       const char *auto_method = "auto";
+       const char *manual_method = "manual";
 
        const char *prop_proxy_configuration = "Proxy.Configuration";
        const char *prop_method = "Method";
@@ -1821,19 +1801,20 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        DBusConnection* conn = NULL;
 
        if ((prof_info == NULL) || (profile_name == NULL) || (strlen(profile_name) == 0)) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Invalid argument\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid argument\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
-       snprintf(proxy_buffer, NET_PROXY_LEN_MAX + 1, "%s", prof_info->ProfileInfo.Wlan.net_info.ProxyAddr);
+       g_strlcpy(proxy_buffer,
+                       prof_info->ProfileInfo.Wlan.net_info.ProxyAddr, NET_PROXY_LEN_MAX+1);
 
        NETWORK_LOG(NETWORK_HIGH, "Method : %d, proxy address : %s\n",
                        prof_info->ProfileInfo.Wlan.net_info.ProxyMethod, proxy_address);
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1842,7 +1823,7 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        message = dbus_message_new_method_call(CONNMAN_SERVICE, profile_name,
                        CONNMAN_SERVICE_INTERFACE, "SetProperty");
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -1928,12 +1909,11 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
 
        if (reply == NULL) {
                if (dbus_error_is_set(&error) == TRUE) {
-                       NETWORK_LOG( NETWORK_ERROR,
-                                       "Error!!! dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
-                                       error.name,
-                                       error.message);
+                       NETWORK_LOG(NETWORK_ERROR,
+                               "dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
+                               error.name, error.message);
                        Error = __net_error_string_to_enum(error.name);
-                       dbus_error_free(&error); 
+                       dbus_error_free(&error);
                        dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
@@ -1947,7 +1927,7 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        dbus_message_unref(reply);
        dbus_message_unref(message);
 
-       NETWORK_LOG( NETWORK_HIGH, "Successfully configured Proxy.Configuration\n");
+       NETWORK_LOG(NETWORK_HIGH, "Successfully configured Proxy.Configuration\n");
 
        dbus_connection_unref(conn);
 
@@ -1981,29 +1961,29 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        DBusConnection* conn = NULL;
 
        if (prof_info == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid argument\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid argument\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        /** Create message */
-       message = dbus_message_new_method_call(TELEPHONY_SERVCE,
+       message = dbus_message_new_method_call(TELEPHONY_SERVICE,
                        TELEPHONY_MASTER_PATH, TELEPHONY_MASTER_INTERFACE, "AddProfile");
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVCE,
+       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVICE,
                        TELEPHONY_MASTER_PATH, TELEPHONY_MASTER_INTERFACE, ".AddProfile");
 
        dbus_message_iter_init_append(message, &iter);
@@ -2016,7 +1996,7 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
                  DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
                 &dict);
 
-       snprintf(buff_svc_type, 10, "%d", prof_info->ProfileInfo.Pdp.ServiceType);
+       g_snprintf(buff_svc_type, 10, "%d", prof_info->ProfileInfo.Pdp.ServiceType);
        temp_ptr = buff_svc_type;
 
        NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2 : %s : %s\n",
@@ -2076,8 +2056,10 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        }
 
        if (prof_info->ProfileInfo.Pdp.AuthInfo.AuthType >= NET_PDP_AUTH_NONE &&
-           prof_info->ProfileInfo.Pdp.AuthInfo.AuthType <= NET_PDP_AUTH_CHAP) {
-               snprintf(buff_auth_type, 10, "%d", prof_info->ProfileInfo.Pdp.AuthInfo.AuthType);
+                       prof_info->ProfileInfo.Pdp.AuthInfo.AuthType <= NET_PDP_AUTH_CHAP) {
+               g_snprintf(buff_auth_type, 10, "%d",
+                               prof_info->ProfileInfo.Pdp.AuthInfo.AuthType);
+
                temp_ptr = buff_auth_type;
 
                NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2 : %s : %s\n",
@@ -2125,9 +2107,8 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        if (reply == NULL) {
                if (dbus_error_is_set (&error) == TRUE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
-                               error.name,
-                               error.message);
+                               "dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
+                               error.name, error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error);
                        dbus_message_unref(message);
@@ -2195,29 +2176,29 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        DBusConnection* conn = NULL;
 
        if ((prof_info == NULL) || (profile_name == NULL)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid argument\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid argument\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        /** Create message */
-       message = dbus_message_new_method_call(TELEPHONY_SERVCE,
+       message = dbus_message_new_method_call(TELEPHONY_SERVICE,
                        profile_name, TELEPHONY_PROFILE_INTERFACE, "ModifyProfile");
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVCE,
+       NETWORK_LOG(NETWORK_HIGH, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVICE,
                        profile_name, TELEPHONY_PROFILE_INTERFACE, ".ModifyProfile");
 
        dbus_message_iter_init_append(message, &iter);
@@ -2230,7 +2211,7 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
                  DBUS_DICT_ENTRY_END_CHAR_AS_STRING),
                 &dict);
 
-       snprintf(buff_svc_type, 10, "%d", prof_info->ProfileInfo.Pdp.ServiceType);
+       g_snprintf(buff_svc_type, 10, "%d", prof_info->ProfileInfo.Pdp.ServiceType);
        temp_ptr = buff_svc_type;
 
        NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2 : %s : %s\n",
@@ -2291,7 +2272,8 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
 
        if (prof_info->ProfileInfo.Pdp.AuthInfo.AuthType >= NET_PDP_AUTH_NONE &&
            prof_info->ProfileInfo.Pdp.AuthInfo.AuthType <= NET_PDP_AUTH_CHAP) {
-               snprintf(buff_auth_type, 10, "%d", prof_info->ProfileInfo.Pdp.AuthInfo.AuthType);
+               g_snprintf(buff_auth_type, 10, "%d",
+                               prof_info->ProfileInfo.Pdp.AuthInfo.AuthType);
                temp_ptr = buff_auth_type;
 
                NETWORK_LOG(NETWORK_HIGH, "DBus Message 2/2 : %s : %s\n",
@@ -2378,9 +2360,8 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        if (reply == NULL) {
                if (dbus_error_is_set (&error) == TRUE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
-                               error.name,
-                               error.message);
+                               "dbus_connection_send_with_reply_and_block() failed, Error[%s: %s]\n",
+                               error.name, error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error);
                        dbus_message_unref(message);
@@ -2418,7 +2399,6 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        return Error;
 }
 
-
 int _net_dbus_load_wifi_driver(void)
 {
        __NETWORK_FUNC_ENTER__;
@@ -2469,6 +2449,7 @@ void _net_dbus_clear_pending_call(void)
 {
        if (_net_dbus_is_pending_call_used()) {
                dbus_pending_call_cancel(_net_dbus_get_pending_call());
+
                _net_dbus_set_pending_call(NULL);
                _net_dbus_set_pending_call_used(FALSE);
        }
@@ -2507,7 +2488,7 @@ gboolean __net_dbus_abort_open_request(const char *profile_name)
                return FALSE;
        }
 
-       snprintf(event_data.ProfileName, NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name);
+       g_strlcpy(event_data.ProfileName, profile_name, NET_PROFILE_NAME_LEN_MAX+1);
        event_data.Error = NET_ERR_OPERATION_ABORTED;
        event_data.Datalength = 0;
        event_data.Data = NULL;
@@ -2530,26 +2511,34 @@ int _net_dbus_specific_scan_request(const char *ssid)
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't get on system bus\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get a system bus\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       message = dbus_message_new_method_call(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE, "RequestSpecificScan");
+       message = dbus_message_new_method_call(NETCONFIG_SERVICE,
+                       NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE,
+                       "RequestSpecificScan");
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_message_new_method_call() failed\n");
+
                dbus_connection_unref(conn);
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        dbus_message_append_args(message, DBUS_TYPE_STRING, &ssid, NULL);
 
-       result = dbus_connection_send_with_reply(conn, message, &call, 6 * DBUS_REPLY_TIMEOUT);
+       result = dbus_connection_send_with_reply(conn, message, &call,
+                       6 * DBUS_REPLY_TIMEOUT);
        if (result == FALSE || call == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_connection_send_with_reply() Failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_connection_send_with_reply() failed\n");
+
                dbus_message_unref(message);
                dbus_connection_unref(conn);
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -2566,7 +2555,3 @@ int _net_dbus_specific_scan_request(const char *ssid)
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
index a5a5a95..3606b17 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h> 
-#include <glib.h>
-
-#include <dbus/dbus.h> 
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <linux/if_ether.h>
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-
 #include "network-internal.h"
 #include "network-dbus-request.h"
 
@@ -72,7 +42,7 @@ extern network_info_t NetworkInfo;
  *****************************************************************************/
 
 /** set all request to FALSE (0) */
-network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX] = {{0, }, };
+network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX] = {{0,},};
 
 struct {
        pthread_mutex_t callback_mutex;
@@ -253,13 +223,17 @@ net_device_t _net_get_tech_type_from_path(const char *profile_name)
 
        net_device_t device_type = NET_DEVICE_UNKNOWN;
 
-       if (g_str_has_prefix(profile_name, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE)
+       if (g_str_has_prefix(profile_name,
+                       CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE)
                device_type = NET_DEVICE_WIFI;
-       else if (g_str_has_prefix(profile_name, CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE)
+       else if (g_str_has_prefix(profile_name,
+                       CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE)
                device_type = NET_DEVICE_CELLULAR;
-       else if (g_str_has_prefix(profile_name, CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX) == TRUE)
+       else if (g_str_has_prefix(profile_name,
+                       CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX) == TRUE)
                device_type = NET_DEVICE_ETHERNET;
-       else if (g_str_has_prefix(profile_name, CONNMAN_BLUETOOTH_SERVICE_PROFILE_PREFIX) == TRUE)
+       else if (g_str_has_prefix(profile_name,
+                       CONNMAN_BLUETOOTH_SERVICE_PROFILE_PREFIX) == TRUE)
                device_type = NET_DEVICE_BLUETOOTH;
 
        __NETWORK_FUNC_EXIT__;
@@ -420,19 +394,20 @@ int _net_get_tech_state(DBusMessage* msg, network_tech_state_info_t* tech_state)
                        if (dbus_message_iter_get_arg_type(&value1) ==
                                        DBUS_TYPE_BOOLEAN) {
                                dbus_message_iter_get_basic(&value1, &data);
-                               NETWORK_LOG(NETWORK_LOW, "key-[%s]-[%s]", key, data ? "True" : "False");
+                               NETWORK_LOG(NETWORK_LOW, "key-[%s]-[%s]",
+                                               key, data ? "True" : "False");
 
-                               if (strcmp(key, "Powered") == 0) {
+                               if (g_strcmp0(key, "Powered") == 0) {
                                        if (data)
                                                tech_state->Powered = TRUE;
                                        else
                                                tech_state->Powered = FALSE;
-                               } else if (strcmp(key, "Connected") == 0) {
+                               } else if (g_strcmp0(key, "Connected") == 0) {
                                        if (data)
                                                tech_state->Connected = TRUE;
                                        else
                                                tech_state->Connected = FALSE;
-                               } else if (strcmp(key, "Tethering") == 0) {
+                               } else if (g_strcmp0(key, "Tethering") == 0) {
                                        /* For further use */
                                }
                        } else if (dbus_message_iter_get_arg_type(&value1) ==
@@ -477,52 +452,64 @@ int _net_open_connection_with_wifi_info(const net_wifi_connection_info_t* wifi_i
 
        case WLAN_SEC_MODE_WEP:
                wifi_connection_info.security = g_strdup("wep");
-               wifi_connection_info.passphrase = g_strdup(wifi_info->security_info.authentication.wep.wepKey);
+               wifi_connection_info.passphrase =
+                               g_strdup(wifi_info->security_info.authentication.wep.wepKey);
                break;
 
        /** WPA-PSK(equivalent to WPA-NONE in case of Ad-Hoc) */
        case WLAN_SEC_MODE_WPA_PSK:
                wifi_connection_info.security = g_strdup("psk");
-               wifi_connection_info.passphrase = g_strdup(wifi_info->security_info.authentication.psk.pskKey);
+               wifi_connection_info.passphrase =
+                               g_strdup(wifi_info->security_info.authentication.psk.pskKey);
                break;
 
        /** WPA2-PSK */
        /** WPA-PSK / WPA2-PSK supported */
        case WLAN_SEC_MODE_WPA2_PSK:
                wifi_connection_info.security = g_strdup("rsn");
-               wifi_connection_info.passphrase = g_strdup(wifi_info->security_info.authentication.psk.pskKey);
+               wifi_connection_info.passphrase =
+                               g_strdup(wifi_info->security_info.authentication.psk.pskKey);
                break;
 
        case WLAN_SEC_MODE_IEEE8021X:
                wifi_connection_info.security = g_strdup("ieee8021x");
 
                wifi_connection_info.eap_type = g_strdup(
-                               __convert_eap_type_to_string(wifi_info->security_info.authentication.eap.eap_type));
+                               __convert_eap_type_to_string(
+                                               wifi_info->security_info.authentication.eap.eap_type));
                wifi_connection_info.eap_auth = g_strdup(
-                               __convert_eap_auth_to_string(wifi_info->security_info.authentication.eap.eap_auth));
+                               __convert_eap_auth_to_string(
+                                               wifi_info->security_info.authentication.eap.eap_auth));
 
                if (wifi_info->security_info.authentication.eap.username[0] != '\0')
-                       wifi_connection_info.identity = g_strdup(wifi_info->security_info.authentication.eap.username);
+                       wifi_connection_info.identity =
+                                       g_strdup(wifi_info->security_info.authentication.eap.username);
 
                if (wifi_info->security_info.authentication.eap.password[0] != '\0')
-                       wifi_connection_info.password = g_strdup(wifi_info->security_info.authentication.eap.password);
+                       wifi_connection_info.password =
+                                       g_strdup(wifi_info->security_info.authentication.eap.password);
 
                if (wifi_info->security_info.authentication.eap.ca_cert_filename[0] != '\0')
-                       wifi_connection_info.ca_cert_file = g_strdup(wifi_info->security_info.authentication.eap.ca_cert_filename);
+                       wifi_connection_info.ca_cert_file =
+                                       g_strdup(wifi_info->security_info.authentication.eap.ca_cert_filename);
 
                if (wifi_info->security_info.authentication.eap.client_cert_filename[0] != '\0')
-                       wifi_connection_info.client_cert_file = g_strdup(wifi_info->security_info.authentication.eap.client_cert_filename);
+                       wifi_connection_info.client_cert_file =
+                                       g_strdup(wifi_info->security_info.authentication.eap.client_cert_filename);
 
                if (wifi_info->security_info.authentication.eap.private_key_filename[0] != '\0')
-                       wifi_connection_info.private_key_file = g_strdup(wifi_info->security_info.authentication.eap.private_key_filename);
+                       wifi_connection_info.private_key_file =
+                                       g_strdup(wifi_info->security_info.authentication.eap.private_key_filename);
 
                if (wifi_info->security_info.authentication.eap.private_key_passwd[0] != '\0')
-                       wifi_connection_info.private_key_password = g_strdup(wifi_info->security_info.authentication.eap.private_key_passwd);
+                       wifi_connection_info.private_key_password =
+                                       g_strdup(wifi_info->security_info.authentication.eap.private_key_passwd);
 
                break;
 
        default:
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid security type\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid security type\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -544,7 +531,8 @@ int _net_open_connection_with_wifi_info(const net_wifi_connection_info_t* wifi_i
                                wifi_connection_info.private_key_file, wifi_connection_info.private_key_password);
        }
 
-       if ((Error = _net_dbus_connect_service(&wifi_connection_info)) != NET_ERR_NONE)
+       Error = _net_dbus_connect_service(&wifi_connection_info);
+       if (Error != NET_ERR_NONE)
                NETWORK_LOG(NETWORK_ERROR, "Failed to request connect service. Error [%s]\n",
                                _net_print_error(Error));
        else
@@ -626,11 +614,11 @@ net_wifi_state_t _net_get_wifi_state(void)
        network_tech_state_info_t tech_state = {{0,},};
        net_wifi_state_t wifi_state = WIFI_UNKNOWN;
 
-       snprintf(tech_state.technology, NET_TECH_LENGTH_MAX, "%s", "wifi");
+       g_strlcpy(tech_state.technology, "wifi", NET_TECH_LENGTH_MAX);
        Error = _net_dbus_get_technology_state(&tech_state);
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                       "Error!!! _net_dbus_get_technology_state() failed. Error [%s]\n",
+                       "_net_dbus_get_technology_state() failed. Error [%s]\n",
                        _net_print_error(Error));
                goto state_done;
        }
@@ -656,8 +644,4 @@ void _net_clear_request_table(void)
                memset(&request_table[i], 0, sizeof(network_request_table_t));
 
        __NETWORK_FUNC_EXIT__;
-}
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+}
\ No newline at end of file
index 763077a..53f24b2 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h> 
-#include <ctype.h> 
-
-
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
+#include <ctype.h>
 
 #include "network-internal.h"
 #include "network-dbus-request.h"
@@ -107,7 +87,7 @@ static int __net_pm_init_profile_info(net_device_t profile_type, net_profile_inf
            profile_type != NET_DEVICE_CELLULAR &&
            profile_type != NET_DEVICE_ETHERNET &&
            profile_type != NET_DEVICE_BLUETOOTH)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -173,7 +153,7 @@ static int __net_telephony_init_profile_info(net_telephony_profile_info_t* ProfI
        __NETWORK_FUNC_ENTER__;
        
        if (ProfInfo == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -208,16 +188,16 @@ static int __net_telephony_get_profile_info(net_profile_name_t* ProfileName, net
        DBusMessageIter iter, array;
        
        if (ProfileName == NULL || ProfileInfo == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter!\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
-       result = _net_invoke_dbus_method(TELEPHONY_SERVCE, ProfileName->ProfileName,
+       result = _net_invoke_dbus_method(TELEPHONY_SERVICE, ProfileName->ProfileName,
                        TELEPHONY_PROFILE_INTERFACE, "GetProfile", NULL, &Error);
 
        if (result == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -357,11 +337,11 @@ static int __net_telephony_get_profile_list(net_profile_name_t** ProfileName, in
        DBusMessageIter iter, array;
        int count = 0;
 
-       result = _net_invoke_dbus_method(TELEPHONY_SERVCE, TELEPHONY_MASTER_PATH,
+       result = _net_invoke_dbus_method(TELEPHONY_SERVICE, TELEPHONY_MASTER_PATH,
                        TELEPHONY_MASTER_INTERFACE, "GetProfileList", NULL, &Error);
 
        if (result == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -393,7 +373,7 @@ static int __net_telephony_get_profile_list(net_profile_name_t** ProfileName, in
        }
 
        if (profileList == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to allocate memory\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to allocate memory\n");
                *ProfileCount = 0;
                dbus_message_unref(result);
                __NETWORK_FUNC_EXIT__;
@@ -441,14 +421,14 @@ static int __net_telephony_search_pdp_profile(char* ProfileName, net_profile_nam
        /* Get pdp profile list from telephony service */
        Error = __net_telephony_get_profile_list(&ProfileList, &ProfileCount);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! failed to get profile list from telephony service\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get profile list from telephony service\n");
                NET_MEMFREE(ProfileList);
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        if (ProfileList == NULL || ProfileCount <= 0) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! There is no PDP profiles\n");
+               NETWORK_LOG(NETWORK_ERROR, "There is no PDP profiles\n");
                NET_MEMFREE(ProfileList);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NO_SERVICE;
@@ -471,7 +451,7 @@ static int __net_telephony_search_pdp_profile(char* ProfileName, net_profile_nam
        }
 
        if (i >= ProfileCount) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! There is no matching PDP profiles\n");
+               NETWORK_LOG(NETWORK_ERROR, "There is no matching PDP profiles\n");
                NET_MEMFREE(ProfileList);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NO_SERVICE;
@@ -510,7 +490,8 @@ static int __net_extract_wifi_services(DBusMessage *message,
                }
 
                if (g_str_has_prefix(obj, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE) {
-                       if (g_strrstr(obj + strlen(CONNMAN_WIFI_SERVICE_PROFILE_PREFIX), "hidden") != NULL)
+                       if (g_strrstr(obj + strlen(CONNMAN_WIFI_SERVICE_PROFILE_PREFIX),
+                                                       "hidden") != NULL)
                                goto get_next;
 
                        service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
@@ -528,6 +509,7 @@ static int __net_extract_wifi_services(DBusMessage *message,
 
                        count++;
                }
+
 get_next:
                dbus_message_iter_next(array);
        }
@@ -553,7 +535,7 @@ static int __net_extract_mobile_services(DBusMessage *message,
        __NETWORK_FUNC_ENTER__;
 
        if (message == NULL || array == NULL || service_info == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter \n");
 
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
@@ -579,19 +561,25 @@ static int __net_extract_mobile_services(DBusMessage *message,
 
                        if (network_type == NET_SERVICE_UNKNOWN)
                                found = TRUE;
-                       else if (network_type == NET_SERVICE_INTERNET && strcmp(suffix, net_suffix) == 0)
+                       else if (network_type == NET_SERVICE_INTERNET &&
+                                                                               strcmp(suffix, net_suffix) == 0)
                                found = TRUE;
-                       else if (network_type == NET_SERVICE_MMS &&  strcmp(suffix, mms_suffix) == 0)
+                       else if (network_type == NET_SERVICE_MMS &&
+                                                                               strcmp(suffix, mms_suffix) == 0)
                                found = TRUE;
-                       else if (network_type == NET_SERVICE_PREPAID_INTERNET && strcmp(suffix, pre_net_suffix) == 0)
+                       else if (network_type == NET_SERVICE_PREPAID_INTERNET &&
+                                                                               strcmp(suffix, pre_net_suffix) == 0)
                                found = TRUE;
-                       else if (network_type == NET_SERVICE_PREPAID_MMS && strcmp(suffix, pre_mms_suffix) == 0)
+                       else if (network_type == NET_SERVICE_PREPAID_MMS &&
+                                                                               strcmp(suffix, pre_mms_suffix) == 0)
                                found = TRUE;
-                       else if (network_type == NET_SERVICE_TETHERING && strcmp(suffix, tethering_suffix) == 0)
+                       else if (network_type == NET_SERVICE_TETHERING &&
+                                                                               strcmp(suffix, tethering_suffix) == 0)
                                found = TRUE;
 
                        if (found == TRUE) {
-                               service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
+                               service_info->ProfileName[count] =
+                                                                       (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
                                if (service_info->ProfileName[count] == NULL) {
                                        NETWORK_LOG(NETWORK_ERROR, "Failed to allocate memory\n");
 
@@ -602,7 +590,8 @@ static int __net_extract_mobile_services(DBusMessage *message,
                                        return NET_ERR_UNKNOWN;
                                }
 
-                               g_strlcpy(service_info->ProfileName[count], obj, NET_PROFILE_NAME_LEN_MAX+1);
+                               g_strlcpy(service_info->ProfileName[count], obj,
+                                                                               NET_PROFILE_NAME_LEN_MAX+1);
 
                                count++;
                        }
@@ -644,7 +633,8 @@ static int __net_extract_ethernet_services(DBusMessage *message,
                }
 
                if (g_str_has_prefix(obj, CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX) == TRUE) {
-                       service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
+                       service_info->ProfileName[count] =
+                                                                       (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
                        if (service_info->ProfileName[count] == NULL) {
                                NETWORK_LOG(NETWORK_ERROR, "Failed to allocate memory\n");
 
@@ -696,7 +686,8 @@ static int __net_extract_bluetooth_services(DBusMessage* message,
                }
 
                if (g_str_has_prefix(obj, CONNMAN_BLUETOOTH_SERVICE_PROFILE_PREFIX) == TRUE) {
-                       service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
+                       service_info->ProfileName[count] =
+                                                                       (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
                        if (service_info->ProfileName[count] == NULL) {
                                NETWORK_LOG(NETWORK_ERROR, "Failed to allocate memory\n");
 
@@ -744,7 +735,8 @@ static int __net_extract_services(DBusMessage *message, net_device_t device_type
                Error = __net_extract_wifi_services(message, &dict, &service_info);
                break;
        case NET_DEVICE_CELLULAR :
-               Error = __net_extract_mobile_services(message, &dict, &service_info, NET_SERVICE_UNKNOWN);
+               Error = __net_extract_mobile_services(message, &dict, &service_info,
+                               NET_SERVICE_UNKNOWN);
                break;
        case NET_DEVICE_ETHERNET :
                Error = __net_extract_ethernet_services(message, &dict, &service_info);
@@ -761,7 +753,7 @@ static int __net_extract_services(DBusMessage *message, net_device_t device_type
        }
        
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't extract services from received message\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to extract services from received message\n");
                *profile_count = 0;
                *profile_info = NULL;
                __NETWORK_FUNC_EXIT__;
@@ -772,7 +764,7 @@ static int __net_extract_services(DBusMessage *message, net_device_t device_type
 
        ProfilePtr = (net_profile_info_t*)malloc(service_info.num_of_services * sizeof(net_profile_info_t));
        if (ProfilePtr == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to allocate memory\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to allocate memory\n");
 
                for (i = 0; i < service_info.num_of_services; i++)
                        NET_MEMFREE(service_info.ProfileName[i]);
@@ -788,7 +780,7 @@ static int __net_extract_services(DBusMessage *message, net_device_t device_type
 
                Error = __net_get_profile_info(service_info.ProfileName[i], &ProfileInfo);
                if (Error != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! failed to get service(profile) information. Error [%s]\n",
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to get service(profile) information. Error [%s]\n",
                                        _net_print_error(Error));
                        NETWORK_LOG(NETWORK_HIGH, "Continuing with next profile\n");
 
@@ -877,7 +869,7 @@ static int __net_extract_common_info(const char *key, DBusMessageIter *variant,
                net_info = &(ProfInfo->ProfileInfo.Bluetooth.net_info);
        } else {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Invalid Profile type. [%d]\n", ProfInfo->profile_type);
+                               "Invalid Profile type. [%d]\n", ProfInfo->profile_type);
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -1541,7 +1533,6 @@ static int __net_extract_bluetooth_info(DBusMessageIter *array, net_profile_info
        }
 
        __NETWORK_FUNC_EXIT__;
-
        return Error;
 }
 
@@ -1590,7 +1581,7 @@ static int __net_extract_service_info(
 
        if (profileType == NET_DEVICE_WIFI) {
                if ((Error = __net_pm_init_profile_info(NET_DEVICE_WIFI, ProfInfo)) != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't init profile\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to init profile\n");
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -1604,7 +1595,7 @@ static int __net_extract_service_info(
 
        } else if (profileType == NET_DEVICE_CELLULAR) {
                if ((Error = __net_pm_init_profile_info(NET_DEVICE_CELLULAR, ProfInfo)) != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't init profile\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to init profile\n");
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -1617,7 +1608,7 @@ static int __net_extract_service_info(
                Error = __net_extract_mobile_info(&array, ProfInfo);
        } else if (profileType == NET_DEVICE_ETHERNET) {
                if ((Error = __net_pm_init_profile_info(NET_DEVICE_ETHERNET, ProfInfo)) != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't init profile\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to init profile\n");
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -1630,7 +1621,7 @@ static int __net_extract_service_info(
                Error = __net_extract_ethernet_info(&array, ProfInfo);
        } else if (profileType == NET_DEVICE_BLUETOOTH) {
                if ((Error = __net_pm_init_profile_info(NET_DEVICE_BLUETOOTH, ProfInfo)) != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Can't init profile\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to init profile\n");
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -1642,24 +1633,25 @@ static int __net_extract_service_info(
 
                Error = __net_extract_bluetooth_info(&array, ProfInfo);
        } else {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Not supported profile type\n");
+               NETWORK_LOG(NETWORK_ERROR, "Not supported profile type\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NOT_SUPPORTED;
        }               
 
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Can't extract service information from received message\n");
+                               "Failed to extract service information from received message\n");
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        __NETWORK_FUNC_EXIT__;
-
-       return Error;   
+       return Error;
 }
 
-static int __net_get_profile_info(const char* ProfileName, net_profile_info_t* ProfInfo)
+static int __net_get_profile_info(
+               const char* ProfileName, net_profile_info_t* ProfInfo)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -1700,11 +1692,11 @@ static int __net_set_default_cellular_service_profile_sync(const char* ProfileNa
                return Error;
        }
 
-       message = _net_invoke_dbus_method(TELEPHONY_SERVCE, telephony_profile.ProfileName,
+       message = _net_invoke_dbus_method(TELEPHONY_SERVICE, telephony_profile.ProfileName,
                        TELEPHONY_PROFILE_INTERFACE, "SetDefaultConnection", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to set default cellular service(profile)\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to set default cellular service(profile)\n");
                goto done;
        }
 
@@ -1762,20 +1754,23 @@ static int __net_modify_wlan_profile_info(const char* ProfileName,
        int i = 0;
        char profilePath[NET_PROFILE_NAME_LEN_MAX+1] = "";
 
-       wlan_security_info_t *security_info = &(ProfInfo->ProfileInfo.Wlan.security_info);
-       wlan_security_info_t *ex_security_info = &(exProfInfo->ProfileInfo.Wlan.security_info);
+       wlan_security_info_t *security_info =
+                                                               &(ProfInfo->ProfileInfo.Wlan.security_info);
+       wlan_security_info_t *ex_security_info =
+                                                               &(exProfInfo->ProfileInfo.Wlan.security_info);
 
        net_dev_info_t *net_info = &(ProfInfo->ProfileInfo.Wlan.net_info);
        net_dev_info_t *ex_net_info = &(exProfInfo->ProfileInfo.Wlan.net_info);
 
-       snprintf(profilePath, NET_PROFILE_NAME_LEN_MAX+1, "%s", ProfileName);
+       g_strlcpy(profilePath, ProfileName, NET_PROFILE_NAME_LEN_MAX+1);
 
        /* Compare and Set 'Passphrase' */
        if (ex_security_info->sec_mode == WLAN_SEC_MODE_WEP) {
                if (strcmp(security_info->authentication.wep.wepKey,
-                       ex_security_info->authentication.wep.wepKey) != 0) {
+                                               ex_security_info->authentication.wep.wepKey) != 0) {
                        Error = _net_dbus_set_agent_fields(NULL,
-                                       security_info->authentication.wep.wepKey);
+                                                                       security_info->authentication.wep.wepKey);
+
                        if (NET_ERR_NONE != Error) {
                                NETWORK_LOG(NETWORK_ERROR, "Failed to set agent field\n");
 
@@ -1788,7 +1783,8 @@ static int __net_modify_wlan_profile_info(const char* ProfileName,
                if (strcmp(security_info->authentication.psk.pskKey,
                        ex_security_info->authentication.psk.pskKey) != 0) {
                        Error = _net_dbus_set_agent_fields(NULL,
-                                       security_info->authentication.psk.pskKey);
+                                                                       security_info->authentication.psk.pskKey);
+
                        if (NET_ERR_NONE != Error) {
                                NETWORK_LOG(NETWORK_ERROR, "Failed to set agent field\n");
 
@@ -1813,14 +1809,16 @@ static int __net_modify_wlan_profile_info(const char* ProfileName,
        /* Compare and Set 'IPv4 addresses' */
        if ((ex_net_info->IpConfigType != net_info->IpConfigType) ||
            (net_info->IpConfigType == NET_IP_CONFIG_TYPE_STATIC &&
-            (net_info->IpAddr.Data.Ipv4.s_addr != ex_net_info->IpAddr.Data.Ipv4.s_addr ||
-             net_info->SubnetMask.Data.Ipv4.s_addr != ex_net_info->SubnetMask.Data.Ipv4.s_addr ||
-             net_info->GatewayAddr.Data.Ipv4.s_addr != ex_net_info->GatewayAddr.Data.Ipv4.s_addr))) {
-
+            (net_info->IpAddr.Data.Ipv4.s_addr !=
+                                                               ex_net_info->IpAddr.Data.Ipv4.s_addr ||
+             net_info->SubnetMask.Data.Ipv4.s_addr !=
+                                                               ex_net_info->SubnetMask.Data.Ipv4.s_addr ||
+             net_info->GatewayAddr.Data.Ipv4.s_addr !=
+                                                               ex_net_info->GatewayAddr.Data.Ipv4.s_addr))) {
                Error = _net_dbus_set_profile_ipv4(ProfInfo, profilePath);
-               
+
                if (Error != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR,  "Error!!! Can't set IPv4\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to set IPv4\n");
 
                        __NETWORK_FUNC_EXIT__;
                        return Error;
@@ -1844,7 +1842,7 @@ static int __net_modify_wlan_profile_info(const char* ProfileName,
                Error = _net_dbus_set_profile_dns(ProfInfo, profilePath);
 
                if (Error != NET_ERR_NONE) {
-                       NETWORK_LOG(NETWORK_ERROR,  "Error!!! Can't set dns\n");
+                       NETWORK_LOG(NETWORK_ERROR, "Failed to set DNS\n");
 
                        __NETWORK_FUNC_EXIT__;
                        return Error;
@@ -1881,7 +1879,7 @@ static int __net_wifi_delete_profile(net_profile_name_t* WifiProfName,
        }
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to Remove service(profile)\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to Remove service(profile)\n");
                goto done;
        }
 
@@ -1921,7 +1919,7 @@ static int __net_telephony_modify_profile(const char *ProfileName,
        char connman_profile[NET_PROFILE_NAME_LEN_MAX+1] = "";
 
        if (_net_is_valid_service_type(exProfInfo->ProfileInfo.Pdp.ServiceType) == FALSE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -1955,11 +1953,11 @@ static int __net_telephony_delete_profile(net_profile_name_t* PdpProfName)
        net_err_t Error = NET_ERR_NONE;
        DBusMessage *message = NULL;
 
-       message = _net_invoke_dbus_method(TELEPHONY_SERVCE, PdpProfName->ProfileName,
+       message = _net_invoke_dbus_method(TELEPHONY_SERVICE, PdpProfName->ProfileName,
                        TELEPHONY_PROFILE_INTERFACE, "RemoveProfile", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to Remove service(profile)\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to Remove service(profile)\n");
                goto done;
        }
 
@@ -1996,7 +1994,7 @@ static int __net_extract_defult_profile(
        __NETWORK_FUNC_ENTER__;
 
        if (array == NULL || profile_name == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter \n");
 
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
@@ -2015,7 +2013,8 @@ static int __net_extract_defult_profile(
                        continue;
                }
 
-               if (g_str_has_prefix(objPath, CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE) {
+               if (g_str_has_prefix(objPath,
+                                                       CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE) {
                        suffix = strrchr(objPath, '_');
 
                        if (strcmp(suffix, net_suffix) == 0)
@@ -2049,7 +2048,7 @@ int _net_check_profile_name(const char* ProfileName)
        int stringLen = 0;
 
        if (ProfileName == NULL || strlen(ProfileName) <= strlen(profileHeader)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Profile name is invalid\n");
+               NETWORK_LOG(NETWORK_ERROR, "Profile name is invalid\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2059,13 +2058,13 @@ int _net_check_profile_name(const char* ProfileName)
        if (strncmp(profileHeader, ProfileName, strlen(profileHeader)) == 0) {
                for (i = 0;i < stringLen;i++) {
                        if (isgraph(ProfileName[i]) == 0) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Profile name is invalid\n");
+                               NETWORK_LOG(NETWORK_ERROR, "Profile name is invalid\n");
                                __NETWORK_FUNC_EXIT__;
                                return NET_ERR_INVALID_PARAM;
                        }
                }
        } else {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Profile name is invalid\n");
+               NETWORK_LOG(NETWORK_ERROR, "Profile name is invalid\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2074,7 +2073,8 @@ int _net_check_profile_name(const char* ProfileName)
        return NET_ERR_NONE;
 }
 
-int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile_info, int* profile_count)
+int _net_get_profile_list(net_device_t device_type,
+               net_profile_info_t** profile_info, int* profile_count)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -2084,7 +2084,8 @@ int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile
        message = _net_invoke_dbus_method(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
                        CONNMAN_MANAGER_INTERFACE, "GetServices", NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service(profile) list\n");
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get service(profile) list\n");
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -2096,6 +2097,7 @@ int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile
        case NET_DEVICE_BLUETOOTH:
                Error = __net_extract_services(message, device_type, profile_info, profile_count);
                break;
+
        default :
                Error = NET_ERR_UNKNOWN;
                break;
@@ -2199,13 +2201,13 @@ EXPORT_API int net_add_profile(net_service_type_t network_type, net_profile_info
        __NETWORK_FUNC_ENTER__;
        
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (prof_info == NULL || _net_is_valid_service_type(network_type) == FALSE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2213,7 +2215,7 @@ EXPORT_API int net_add_profile(net_service_type_t network_type, net_profile_info
        Error = __net_telephony_add_profile(prof_info, network_type);
 
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! failed to add service(profile). Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR, "Failed to add service(profile). Error [%s]\n",
                                _net_print_error(Error));
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -2234,13 +2236,13 @@ EXPORT_API int net_delete_profile(const char* profile_name)
        net_profile_info_t prof_info;
        
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (_net_check_profile_name(profile_name) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2248,8 +2250,9 @@ EXPORT_API int net_delete_profile(const char* profile_name)
        Error = __net_get_profile_info(profile_name, &prof_info);
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to get service(profile) information. Error [%s]\n",
+                               "Failed to get service(profile) information. Error [%s]\n",
                                _net_print_error(Error));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -2261,8 +2264,9 @@ EXPORT_API int net_delete_profile(const char* profile_name)
                                prof_info.ProfileInfo.Wlan.security_info.sec_mode);
                if (Error != NET_ERR_NONE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! failed to delete service(profile). Error [%s]\n",
+                                       "Failed to delete service(profile). Error [%s]\n",
                                        _net_print_error(Error));
+
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -2270,8 +2274,9 @@ EXPORT_API int net_delete_profile(const char* profile_name)
                Error = __net_telephony_search_pdp_profile(wifi_prof_name.ProfileName, &pdp_prof_name);
                if (Error != NET_ERR_NONE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! failed to get service(profile) information. Error [%s]\n",
+                                       "Failed to get service(profile) information. Error [%s]\n",
                                        _net_print_error(Error));
+
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
@@ -2279,22 +2284,23 @@ EXPORT_API int net_delete_profile(const char* profile_name)
                Error = __net_telephony_delete_profile(&pdp_prof_name);
                if (Error != NET_ERR_NONE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!!! failed to delete service(profile). Error [%s]\n",
+                                       "Failed to delete service(profile). Error [%s]\n",
                                        _net_print_error(Error));
+
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
        } else {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
-       __NETWORK_FUNC_EXIT__;  
+       __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_get_profile_info(const char *profile_name, net_profile_info_t *prof_info)
 {
        __NETWORK_FUNC_ENTER__;
@@ -2302,28 +2308,29 @@ EXPORT_API int net_get_profile_info(const char *profile_name, net_profile_info_t
        net_err_t Error = NET_ERR_NONE;
        
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
-       if (_net_check_profile_name(profile_name) != NET_ERR_NONE || prof_info == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+       if (prof_info == NULL ||
+                       _net_check_profile_name(profile_name) != NET_ERR_NONE) {
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
-       }       
+       }
 
        Error = __net_get_profile_info(profile_name, prof_info);
        if (Error != NET_ERR_NONE)
                NETWORK_LOG(NETWORK_ERROR,
-                       "Error!!! failed to get service(profile) information. Error [%s]\n",
-                       _net_print_error(Error));
-       
+                               "Failed to get service(profile) information. Error [%s]\n",
+                               _net_print_error(Error));
+
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
 EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t* prof_info)
 {
        __NETWORK_FUNC_ENTER__;
@@ -2332,7 +2339,7 @@ EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t*
        net_profile_info_t exProfInfo;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
@@ -2340,8 +2347,9 @@ EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t*
        Error = net_get_profile_info(profile_name, &exProfInfo);
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to get service(profile) information. Error [%s]\n",
+                               "Failed to get service(profile) information. Error [%s]\n",
                                _net_print_error(Error));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -2349,7 +2357,7 @@ EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t*
        if (prof_info == NULL ||
            (exProfInfo.profile_type != NET_DEVICE_WIFI &&
             exProfInfo.profile_type != NET_DEVICE_CELLULAR)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2361,18 +2369,17 @@ EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t*
 
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to modify service(profile) information. Error [%s]\n",
+                               "Failed to modify service(profile) information. Error [%s]\n",
                                _net_print_error(Error));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        __NETWORK_FUNC_EXIT__;
-
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_get_profile_list(net_device_t device_type, net_profile_info_t **profile_list, int *count)
 {
        __NETWORK_FUNC_ENTER__;
@@ -2382,13 +2389,13 @@ EXPORT_API int net_get_profile_list(net_device_t device_type, net_profile_info_t
        net_profile_info_t* profile_info = NULL;
 
        if (count == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
        
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }       
@@ -2397,7 +2404,7 @@ EXPORT_API int net_get_profile_list(net_device_t device_type, net_profile_info_t
            device_type != NET_DEVICE_WIFI &&
            device_type != NET_DEVICE_ETHERNET &&
            device_type != NET_DEVICE_BLUETOOTH) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Not Supported\n");
+               NETWORK_LOG(NETWORK_ERROR, "Not Supported\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NOT_SUPPORTED;
        }
@@ -2406,7 +2413,7 @@ EXPORT_API int net_get_profile_list(net_device_t device_type, net_profile_info_t
 
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to get service(profile) list. Error [%s]\n",
+                               "Failed to get service(profile) list. Error [%s]\n",
                                _net_print_error(Error));
                
                NET_MEMFREE(profile_info);
@@ -2427,13 +2434,13 @@ EXPORT_API int net_set_default_cellular_service_profile(const char *profile_name
        net_err_t Error = NET_ERR_NONE;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (_net_check_profile_name(profile_name) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -2441,7 +2448,7 @@ EXPORT_API int net_set_default_cellular_service_profile(const char *profile_name
        Error = __net_set_default_cellular_service_profile_sync(profile_name);
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to set default cellular service(profile). Error [%s]\n",
+                               "Failed to set default cellular service(profile). Error [%s]\n",
                                _net_print_error(Error));
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -2450,6 +2457,10 @@ EXPORT_API int net_set_default_cellular_service_profile(const char *profile_name
        return NET_ERR_NONE;
 }
 
+/*****************************************************************************
+ *     ConnMan Wi-Fi Client Interface Async Function Definition
+ *****************************************************************************/
+
 EXPORT_API int net_set_default_cellular_service_profile_async(const char *profile_name)
 {
        net_err_t Error = NET_ERR_NONE;
@@ -2493,12 +2504,3 @@ EXPORT_API int net_set_default_cellular_service_profile_async(const char *profil
 
        return NET_ERR_NONE;
 }
-
-/*****************************************************************************
- *     ConnMan Wi-Fi Client Interface Async Function Definition
- *****************************************************************************/
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
index 675d588..cecb144 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-
 #include <vconf.h>
+
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
-
 #include "network-internal.h"
-#include "network-signal-handler.h"
 #include "network-dbus-request.h"
-
-/*****************************************************************************
- *     Macros and Typedefs
- *****************************************************************************/
-
-
-/*****************************************************************************
- *     Local Functions Declaration
- *****************************************************************************/
-static DBusHandlerResult __net_signal_filter
-      (DBusConnection *conn, DBusMessage *msg, void *user_data);
-
-static int __net_get_state(DBusMessage *msg, char *state, char *error);
-static int __net_handle_wifi_power_rsp(int value);
-static int __net_svc_error_string_to_enum(const char *error);
-static void __net_handle_svc_failure_ind(const char *profile_name, const char *svc_error);
-static void __net_handle_state_ind(const char* profile_name, net_state_type_t profile_state);
-static void __net_init_dbus_thread();
-
-/*****************************************************************************
- *     Global Functions
- *****************************************************************************/
-
+#include "network-signal-handler.h"
 
 /*****************************************************************************
  *     Extern Global Variables
@@ -75,85 +33,46 @@ extern network_info_t NetworkInfo;
 extern network_request_table_t request_table[NETWORK_REQUEST_TYPE_MAX];
 
 /*****************************************************************************
- *     Extern Functions Declarations 
- *****************************************************************************/
-
-/*****************************************************************************
  *     Global Variables
  *****************************************************************************/
 DBusConnection* signal_conn = NULL;
 static net_state_type_t service_state_table[NET_DEVICE_MAX] = {NET_STATE_TYPE_UNKNOWN,};
 
+static int net_service_error = NET_ERR_NONE;
+
 /*****************************************************************************
  *     Local Functions Definition
  *****************************************************************************/
 
-static int __net_get_state(DBusMessage *msg, char *state, char *error)
+static int __net_get_dbus_property_changed_basic(DBusMessage *message,
+               char **key, int type, void *value)
 {
-       __NETWORK_FUNC_ENTER__;
+       int Error = NET_ERR_UNKNOWN_METHOD;
+       DBusMessageIter iter, iter_variant;
 
-       char *key_name = NULL;
-       char *svc_state = NULL;
-       char *svc_error = NULL;
-       DBusMessageIter iter, sub_iter;
-       int Error = NET_ERR_UNKNOWN;
-
-       /* Get state */
-       dbus_message_iter_init(msg, &iter);
-       int ArgType = dbus_message_iter_get_arg_type(&iter);
-
-       if (ArgType != DBUS_TYPE_STRING)
-               goto done;
-
-       dbus_message_iter_get_basic(&iter, &key_name);
-       if (strcmp(key_name, "State") != 0)
-               goto done;
-
-       dbus_message_iter_next(&iter);
-       ArgType = dbus_message_iter_get_arg_type(&iter);
-       if (ArgType != DBUS_TYPE_VARIANT)
-               goto done;
-
-       dbus_message_iter_recurse(&iter, &sub_iter);
-       ArgType = dbus_message_iter_get_arg_type(&sub_iter);
-       if (ArgType != DBUS_TYPE_STRING)
-               goto done;
-
-       dbus_message_iter_get_basic(&sub_iter, &svc_state);
-       snprintf(state, strlen(svc_state) + 1, "%s", svc_state);
-       Error = NET_ERR_NONE;
-
-       /* Get error */
-       dbus_message_iter_next(&iter);
-       ArgType = dbus_message_iter_get_arg_type(&iter);
-       if (ArgType != DBUS_TYPE_STRING)
-               goto done;
+       dbus_message_iter_init(message, &iter);
+       if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+               return Error;
 
-       dbus_message_iter_get_basic(&iter, &key_name);
-       if (strcmp(key_name, "Error") != 0)
-               goto done;
+       dbus_message_iter_get_basic(&iter, key);
 
        dbus_message_iter_next(&iter);
-       ArgType = dbus_message_iter_get_arg_type(&iter);
-       if (ArgType != DBUS_TYPE_VARIANT)
-               goto done;
+       if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+               return Error;
 
-       dbus_message_iter_recurse(&iter, &sub_iter);
-       ArgType = dbus_message_iter_get_arg_type(&sub_iter);
-       if (ArgType != DBUS_TYPE_STRING)
-               goto done;
+       dbus_message_iter_recurse(&iter, &iter_variant);
+       if (dbus_message_iter_get_arg_type(&iter_variant) != type)
+               return Error;
 
-       dbus_message_iter_get_basic(&sub_iter, &svc_error);
-       snprintf(error, strlen(svc_error) + 1, "%s", svc_error);
+       dbus_message_iter_get_basic(&iter_variant, value);
 
-done:
-       __NETWORK_FUNC_EXIT__;
-       return Error;
+       return NET_ERR_NONE;
 }
 
 static int __net_handle_services_changed_signal(DBusMessage* msg)
 {
        __NETWORK_FUNC_ENTER__;
+
        net_event_info_t event_data = { 0, };
 
        if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE)
@@ -187,57 +106,57 @@ static int __net_handle_wifi_power_rsp(int value)
 {
        __NETWORK_FUNC_ENTER__;
 
-       int wifi_state_flag = 0;
        net_event_info_t event_data = {0,};
-       int hotspot_state = 0;
-
-       vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
-       if (hotspot_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) {
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_NONE;
-       }
 
-       if (value == FALSE && NetworkInfo.wifi_state != WIFI_OFF) {
+       if (value == TRUE) {
+               NetworkInfo.wifi_state = WIFI_ON;
+               event_data.Error = NET_ERR_NONE;
+       } else {
                NetworkInfo.wifi_state = WIFI_OFF;
-               wifi_state_flag = 1;
                event_data.Error = NET_ERR_NONE;
 
-               if(request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE)
+               if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE)
                        memset(&request_table[NETWORK_REQUEST_TYPE_SCAN],
                                        0, sizeof(network_request_table_t));
-
-       } else if (value == TRUE && NetworkInfo.wifi_state != WIFI_ON) {
-               NetworkInfo.wifi_state = WIFI_ON;
-               wifi_state_flag = 1;
-               event_data.Error = NET_ERR_NONE;
        }
 
-       if (wifi_state_flag != 0) {
-               if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
-                       memset(&request_table[NETWORK_REQUEST_TYPE_WIFI_POWER],
-                                       0, sizeof(network_request_table_t));
+       if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
+               memset(&request_table[NETWORK_REQUEST_TYPE_WIFI_POWER],
+                               0, sizeof(network_request_table_t));
 
-                       event_data.Event = NET_EVENT_WIFI_POWER_RSP;
-                       NETWORK_LOG(NETWORK_LOW,
-                                       "Sending NET_EVENT_WIFI_POWER_RSP  wifi state : %d\n",
-                                       NetworkInfo.wifi_state);
-                       _net_dbus_clear_pending_call();
-               } else {
-                       event_data.Event = NET_EVENT_WIFI_POWER_IND;
-                       NETWORK_LOG(NETWORK_LOW,
-                                       "Sending NET_EVENT_WIFI_POWER_IND  wifi state : %d\n",
-                                       NetworkInfo.wifi_state);
-               }
+               event_data.Event = NET_EVENT_WIFI_POWER_RSP;
+               NETWORK_LOG(NETWORK_LOW, "NET_EVENT_WIFI_POWER_RSP wifi state: %d\n",
+                               NetworkInfo.wifi_state);
 
-               event_data.Datalength = sizeof(net_wifi_state_t);
-               event_data.Data = &(NetworkInfo.wifi_state);
-               _net_client_callback(&event_data);
+               _net_dbus_clear_pending_call();
+       } else {
+               event_data.Event = NET_EVENT_WIFI_POWER_IND;
+               NETWORK_LOG(NETWORK_LOW, "NET_EVENT_WIFI_POWER_IND wifi state: %d\n",
+                               NetworkInfo.wifi_state);
        }
 
+       event_data.Datalength = sizeof(net_wifi_state_t);
+       event_data.Data = &(NetworkInfo.wifi_state);
+       _net_client_callback(&event_data);
+
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
+static wlan_security_mode_type_t __net_get_wlan_sec_mode(int security)
+{
+       switch (security) {
+       default:
+               return WLAN_SEC_MODE_NONE;
+       case 2:
+               return WLAN_SEC_MODE_WEP;
+       case 3:
+               return WLAN_SEC_MODE_WPA_PSK;
+       case 4:
+               return WLAN_SEC_MODE_IEEE8021X;
+       }
+}
+
 static int __net_handle_specific_scan_resp(GSList *bss_info_list)
 {
        __NETWORK_FUNC_ENTER__;
@@ -257,6 +176,7 @@ static int __net_handle_specific_scan_resp(GSList *bss_info_list)
 
                NETWORK_LOG(NETWORK_LOW, "bss_info_list : 0x%x\n", bss_info_list);
                event_data.Data = bss_info_list;
+
                _net_client_callback(&event_data);
        }
 
@@ -264,473 +184,459 @@ static int __net_handle_specific_scan_resp(GSList *bss_info_list)
        return NET_ERR_NONE;
 }
 
-static int __net_svc_error_string_to_enum(const char *error)
+static int __net_handle_wifi_specific_scan_rsp(DBusMessage *msg)
 {
-       if (strcmp(error, "out-of-range") == 0)
-               return NET_ERR_CONNECTION_OUT_OF_RANGE;
-       else if (strcmp(error, "pin-missing") == 0)
-               return NET_ERR_CONNECTION_PIN_MISSING;
-       else if (strcmp(error, "dhcp-failed") == 0)
-               return NET_ERR_CONNECTION_DHCP_FAILED;
-       else if (strcmp(error, "connect-failed") == 0)
-               return NET_ERR_CONNECTION_CONNECT_FAILED;
-       else if (strcmp(error, "login-failed") == 0)
-               return NET_ERR_CONNECTION_LOGIN_FAILED;
-       else if (strcmp(error, "auth-failed") == 0)
-               return NET_ERR_CONNECTION_AUTH_FAILED;
-       else if (strcmp(error, "invalid-key") == 0)
-               return NET_ERR_CONNECTION_INVALID_KEY;
+       net_err_t Error = NET_ERR_UNKNOWN_METHOD;
+       DBusMessageIter iter, array;
 
-       return NET_ERR_UNKNOWN;
+       dbus_message_iter_init(msg, &iter);
+       dbus_message_iter_recurse(&iter, &array);
+
+       GSList *bss_info_list = NULL;
+
+       while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
+               DBusMessageIter entry, dict;
+               const char *key = NULL;
+               const char *ssid = NULL;
+               const int security = 0;
+
+               dbus_message_iter_recurse(&array, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+
+               if (g_strcmp0(key, "ssid"))
+                       return Error;
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_recurse(&entry, &dict);
+               dbus_message_iter_get_basic(&dict, &ssid);
+               NETWORK_LOG(NETWORK_LOW, "Got an ssid: %s", ssid);
+
+               dbus_message_iter_next(&array);
+               if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_DICT_ENTRY)
+                       return Error;
+
+               dbus_message_iter_recurse(&array, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+               if (g_strcmp0(key, "security"))
+                       return Error;
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_recurse(&entry, &dict);
+               dbus_message_iter_get_basic(&dict, (void *)&security);
+               NETWORK_LOG(NETWORK_LOW, "with security: %d", security);
+
+               net_wifi_connection_info_t *resp_data = g_try_new0(
+                               net_wifi_connection_info_t, 1);
+               g_strlcpy(resp_data->essid, ssid, NET_WLAN_ESSID_LEN);
+               resp_data->security_info.sec_mode = __net_get_wlan_sec_mode(security);
+               bss_info_list = g_slist_append(bss_info_list, resp_data);
+
+               dbus_message_iter_next(&array);
+       }
+
+       NETWORK_LOG(NETWORK_LOW,
+                       "Received the signal: %s with total bss count = %d(Error = %d)",
+                       NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE,
+                       g_slist_length(bss_info_list), Error);
+
+       __net_handle_specific_scan_resp(bss_info_list);
+
+       /* Specific Scan response handled. Release/Destroy the list */
+       g_slist_free_full(bss_info_list, g_free);
+
+       return NET_ERR_NONE;
 }
 
-static void __net_handle_svc_failure_ind(const char *profile_name, const char *svc_error)
+static void __net_handle_state_ind(const char* profile_name,
+               net_state_type_t profile_state)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_event_info_t event_data = {0,};
-       char event_string[64] = {0,};
 
-       char *svc_name1 = request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
-       char *svc_name2 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
+       event_data.Error = NET_ERR_NONE;
+       event_data.Event = NET_EVENT_NET_STATE_IND;
 
-       if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-           strstr(profile_name, svc_name1) != NULL) {
+       g_strlcpy(event_data.ProfileName, profile_name,
+                       sizeof(event_data.ProfileName));
+
+       event_data.Datalength = sizeof(net_state_type_t);
+       event_data.Data = &profile_state;
+
+       NETWORK_LOG(NETWORK_LOW,
+                       "Sending NET_EVENT_NET_STATE_IND, state: %d, profile name: %s\n",
+                       profile_state, event_data.ProfileName);
+
+       _net_client_callback(&event_data);
+
+       __NETWORK_FUNC_EXIT__;
+}
+
+static void __net_handle_failure_ind(const char *profile_name)
+{
+       __NETWORK_FUNC_ENTER__;
 
+       net_event_info_t event_data = { 0, };
+
+       const char *svc_name1 =
+                       request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
+       const char *svc_name2 =
+                       request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
+
+       if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
+                       strstr(profile_name, svc_name1) != NULL) {
                memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
                                sizeof(network_request_table_t));
 
                event_data.Event = NET_EVENT_OPEN_RSP;
-               g_strlcpy(event_string, "Sending NET_EVENT_OPEN_RSP", 64);
+
                _net_dbus_clear_pending_call();
        } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                  strcmp(profile_name, svc_name2) == 0) {
-
+                       strcmp(profile_name, svc_name2) == 0) {
                memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
                                sizeof(network_request_table_t));
 
                event_data.Event = NET_EVENT_WIFI_WPS_RSP;
-               g_strlcpy(event_string, "Sending NET_EVENT_WIFI_WPS_RSP", 64);
+
                _net_dbus_clear_pending_call();
        } else {
                __net_handle_state_ind(profile_name, NET_STATE_TYPE_FAILURE);
+
                __NETWORK_FUNC_EXIT__;
                return;
        }
 
-       snprintf(event_data.ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name);
+       g_strlcpy(event_data.ProfileName,
+                       profile_name, NET_PROFILE_NAME_LEN_MAX+1);
 
-       event_data.Error = __net_svc_error_string_to_enum(svc_error);
+       event_data.Error = net_service_error;
        event_data.Datalength = 0;
        event_data.Data = NULL;
 
-       NETWORK_LOG(NETWORK_LOW, "%s, Error : %d\n", event_string, event_data.Error);
+       net_service_error = NET_ERR_NONE;
+
+       NETWORK_LOG(NETWORK_ERROR, "State failure %d\n", event_data.Error);
        _net_client_callback(&event_data);
 
        __NETWORK_FUNC_EXIT__;
 }
 
-static void __net_handle_state_ind(const char* profile_name, net_state_type_t profile_state)
+static int string2state(const char *state)
 {
-       __NETWORK_FUNC_ENTER__;
-       
-       net_event_info_t event_data = {0,};
-       
-       event_data.Error = NET_ERR_NONE;
-       event_data.Event = NET_EVENT_NET_STATE_IND;
-
-       g_strlcpy(event_data.ProfileName, profile_name,
-                       sizeof(event_data.ProfileName));
-       
-       event_data.Datalength = sizeof(net_state_type_t);
-       event_data.Data = &profile_state;
-       
-       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_NET_STATE_IND, state : %d, profile name : %s\n",
-                       profile_state, event_data.ProfileName);
-
-       _net_client_callback(&event_data);
-       
-       __NETWORK_FUNC_EXIT__;
+       if (g_strcmp0(state, "idle") == 0)
+               return NET_STATE_TYPE_IDLE;
+       else if (g_strcmp0(state, "association") == 0)
+               return NET_STATE_TYPE_ASSOCIATION;
+       else if (g_strcmp0(state, "configuration") == 0)
+               return NET_STATE_TYPE_CONFIGURATION;
+       else if (g_strcmp0(state, "ready") == 0)
+               return NET_STATE_TYPE_READY;
+       else if (g_strcmp0(state, "online") == 0)
+               return NET_STATE_TYPE_ONLINE;
+       else if (g_strcmp0(state, "disconnect") == 0)
+               return NET_STATE_TYPE_DISCONNECT;
+       else if (g_strcmp0(state, "failure") == 0)
+               return NET_STATE_TYPE_FAILURE;
+
+       return NET_STATE_TYPE_UNKNOWN;
 }
 
-static wlan_security_mode_type_t __net_get_wlan_sec_mode(int security)
+static int __net_handle_service_state_changed(DBusMessage *message,
+               const char *key, const char *state)
 {
-       switch (security) {
-       default:
-               return WLAN_SEC_MODE_NONE;
-       case 2:
-               return WLAN_SEC_MODE_WEP;
-       case 3:
-               return WLAN_SEC_MODE_WPA_PSK;
-       case 4:
-               return WLAN_SEC_MODE_IEEE8021X;
+       net_err_t Error = NET_ERR_NONE;
+       const char *sig_path = NULL;
+       net_state_type_t old_state, new_state;
+
+       net_event_info_t event_data = { 0, };
+       net_device_t device_type = NET_DEVICE_UNKNOWN;
+
+       sig_path = dbus_message_get_path(message);
+
+       device_type = _net_get_tech_type_from_path(sig_path);
+       if (device_type == NET_DEVICE_UNKNOWN)
+               return Error;
+
+       NETWORK_LOG(NETWORK_LOW, "[%s] %s\n", state, sig_path);
+
+       if (device_type == NET_DEVICE_WIFI && NetworkInfo.wifi_state == WIFI_OFF) {
+               NETWORK_LOG(NETWORK_LOW, "Wi-Fi is off\n");
+               return Error;
        }
-}
 
-static DBusHandlerResult
-__net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
-{
-       __NETWORK_FUNC_ENTER__;
+       old_state = service_state_table[device_type];
+       new_state = string2state(state);
 
-       static char svc_state[CONNMAN_MAX_BUFLEN] = "";
-       static char svc_error[CONNMAN_MAX_BUFLEN] = "";
-       static char ProfileName[NET_PROFILE_NAME_LEN_MAX + 1] = "";
+       if (old_state == new_state)
+               return Error;
 
-       static int open_connection_rsp_sent = FALSE;
+       service_state_table[device_type] = new_state;
 
-       const char* sig_path = NULL;
-       const char* svc_name1 = NULL;
-       const char* svc_name2 = NULL;
-       const char* svc_name3 = NULL;
+       switch (new_state) {
+       case NET_STATE_TYPE_IDLE:
+       case NET_STATE_TYPE_ASSOCIATION:
+       case NET_STATE_TYPE_CONFIGURATION:
+               __net_handle_state_ind(sig_path, new_state);
+               break;
 
-       char* property = NULL;
-       net_event_info_t event_data = {0,};
-       net_err_t Error = NET_ERR_NONE;
-       net_device_t device_type = NET_DEVICE_UNKNOWN;
+       case NET_STATE_TYPE_READY:
+       case NET_STATE_TYPE_ONLINE:
+       {
+               if (old_state != NET_STATE_TYPE_READY &&
+                               old_state != NET_STATE_TYPE_ONLINE) {
+                       const char *svc_name1 =
+                                       request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
+                       const char *svc_name2 =
+                                       request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
 
-       if (msg == NULL) {
-               NETWORK_LOG(NETWORK_LOW, "Invalid Message. Ignore\n");
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       }
+                       if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
+                                       strstr(sig_path, svc_name1) != NULL) {
+                               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
+                                               sizeof(network_request_table_t));
 
-       if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
-                       CONNMAN_SIGNAL_PROPERTY_CHANGED)) {
-               property = _net_get_string(msg);
-               if(property == NULL) {
-                       /* We have handled this message, don't pass it on */
-                       __NETWORK_FUNC_EXIT__;
-                       return DBUS_HANDLER_RESULT_HANDLED;
-               }
-               NETWORK_LOG(NETWORK_LOW, "[Manager : PropertyChanged] Property - [%s]\n", property);
+                               event_data.Event = NET_EVENT_OPEN_RSP;
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
-                       CONNMAN_SIGNAL_TECHNOLOGY_ADDED)) {
-               NETWORK_LOG(NETWORK_LOW, "[Manager : TechnologyAdded]\n");
-       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
-                       CONNMAN_SIGNAL_TECHNOLOGY_REMOVED)) {
-               NETWORK_LOG(NETWORK_LOW, "[Manager : TechnologyRemoved]\n");
-       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
-                       CONNMAN_SIGNAL_SERVICES_CHANGED)) {
-               NETWORK_LOG(NETWORK_LOW, "[Manager : ServicesChanged]\n");
+                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_RSP\n");
 
-               __net_handle_services_changed_signal(msg);
+                               _net_dbus_clear_pending_call();
+                       } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
+                                       g_strcmp0(sig_path, svc_name2) == 0) {
+                               memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
+                                               sizeof(network_request_table_t));
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE, NETCONFIG_SIGNAL_POWERON_COMPLETED)) {
-               __net_handle_wifi_power_rsp(TRUE);
+                               event_data.Event = NET_EVENT_WIFI_WPS_RSP;
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE, NETCONFIG_SIGNAL_POWEROFF_COMPLETED)) {
-               __net_handle_wifi_power_rsp(FALSE);
+                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_WIFI_WPS_RSP\n");
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE, NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE)) {
-               DBusMessageIter iter, array;
-               dbus_message_iter_init(msg, &iter);
-               dbus_message_iter_recurse(&iter, &array);
-
-               GSList *bss_info_list = NULL;
-
-               /* The dbus message will be packed in this format: {{"ssid", <ssid name>}{"security", <security mode>}....}*/
-               while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
-                       DBusMessageIter entry, dict;
-                       const char *key = NULL;
-                       const char *ssid = NULL;
-                       const int security = 0;
-
-                       dbus_message_iter_recurse(&array, &entry);
-                       dbus_message_iter_get_basic(&entry, &key);
-
-                       if (g_strcmp0(key, "ssid")) {
-                               Error = NET_ERR_UNKNOWN;
-                               break;
-                       }
-                       dbus_message_iter_next(&entry);
-                       dbus_message_iter_recurse(&entry, &dict);
-                       dbus_message_iter_get_basic(&dict, &ssid);
-                       NETWORK_LOG(NETWORK_LOW, "Got an ssid: %s", ssid);
-
-                       dbus_message_iter_next(&array);
-                       if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_DICT_ENTRY) {
-                               Error = NET_ERR_UNKNOWN;
-                               break;
-                       }
-                       dbus_message_iter_recurse(&array, &entry);
-                       dbus_message_iter_get_basic(&entry, &key);
-                       if (g_strcmp0(key, "security")) {
-                               Error = NET_ERR_UNKNOWN;
-                               break;
+                               _net_dbus_clear_pending_call();
+                       } else {
+                               event_data.Event = NET_EVENT_OPEN_IND;
+
+                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_IND\n");
                        }
-                       dbus_message_iter_next(&entry);
-                       dbus_message_iter_recurse(&entry, &dict);
-                       dbus_message_iter_get_basic(&dict, (void *)&security);
-                       NETWORK_LOG(NETWORK_LOW, "with security: %d", security);
 
-                       net_wifi_connection_info_t *resp_data = g_try_new0(net_wifi_connection_info_t, 1);
-                       g_strlcpy(resp_data->essid, ssid, NET_WLAN_ESSID_LEN);
-                       resp_data->security_info.sec_mode = __net_get_wlan_sec_mode(security);
-                       bss_info_list = g_slist_append(bss_info_list, resp_data);
+                       net_profile_info_t prof_info;
+                       if ((Error = net_get_profile_info(sig_path, &prof_info)) != NET_ERR_NONE) {
+                               NETWORK_LOG(NETWORK_ERROR, "net_get_profile_info() failed [%s]\n",
+                                               _net_print_error(Error));
 
-                       dbus_message_iter_next(&array);
-               }
+                               event_data.Datalength = 0;
+                               event_data.Data = NULL;
+                       } else {
+                               event_data.Datalength = sizeof(net_profile_info_t);
+                               event_data.Data = &prof_info;
+                       }
 
-               NETWORK_LOG(NETWORK_LOW, "Received the signal: %s with total bss count = %d(Error = %d)", NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE, g_slist_length(bss_info_list), Error);
+                       event_data.Error = Error;
+                       g_strlcpy(event_data.ProfileName, sig_path, NET_PROFILE_NAME_LEN_MAX+1);
 
-               __net_handle_specific_scan_resp(bss_info_list);
+                       _net_client_callback(&event_data);
+               } else
+                       __net_handle_state_ind(sig_path, new_state);
 
-               /* Specific Scan response handled. Release/Destroy the list */
-               g_slist_free_full(bss_info_list, g_free);
+               break;
+       }
+       case NET_STATE_TYPE_DISCONNECT:
+       {
+               const char *svc_name1 =
+                               request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].ProfileName;
+               const char *svc_name2 =
+                               request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
+               const char *svc_name3 =
+                               request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
+
+               if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
+                               strstr(sig_path, svc_name2) != NULL) {
+                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
+                                       sizeof(network_request_table_t));
+
+                       /** Send Open Resp */
+                       event_data.Error = NET_ERR_OPERATION_ABORTED;
+                       event_data.Event =  NET_EVENT_OPEN_RSP;
+                       g_strlcpy(event_data.ProfileName, sig_path, NET_PROFILE_NAME_LEN_MAX+1);
+
+                       event_data.Datalength = 0;
+                       event_data.Data = NULL;
+
+                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_RSP\n");
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, CONNMAN_TECHNOLOGY_INTERFACE,
-                       CONNMAN_SIGNAL_PROPERTY_CHANGED)) {
-#if 0
-               char* prop_value = NULL;
-               int value = FALSE;
-
-               property = __net_get_property(msg, &prop_value, &value);
-               if (property == NULL) {
-                       /* We have handled this message, don't pass it on */
-                       __NETWORK_FUNC_EXIT__;
-                       return DBUS_HANDLER_RESULT_HANDLED;
-               }
+                       _net_dbus_clear_pending_call();
 
-               memset(ProfileName, 0, sizeof(ProfileName));
-               _net_get_path(msg, ProfileName);
+                       _net_client_callback(&event_data);
+               } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
+                               g_strcmp0(sig_path, svc_name3) == 0) {
+                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
+                                       sizeof(network_request_table_t));
 
-               NETWORK_LOG(NETWORK_LOW,
-                               "[Technology : PropertyChanged]"
-                               "Property-[%s] path [%s] state [%s]\n",
-                               property, ProfileName, prop_value);
-#endif
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_signal(msg, CONNMAN_SERVICE_INTERFACE, CONNMAN_SIGNAL_PROPERTY_CHANGED)) {
-               property = _net_get_string(msg);
-               if (property == NULL) {
-                       /* We have handled this message, don't pass it on */
-                       __NETWORK_FUNC_EXIT__;
-                       return DBUS_HANDLER_RESULT_HANDLED;
-               }
+                       /** Send WPS Resp */
+                       event_data.Error = NET_ERR_OPERATION_ABORTED;
+                       event_data.Event =  NET_EVENT_WIFI_WPS_RSP;
+                       g_strlcpy(event_data.ProfileName, sig_path, NET_PROFILE_NAME_LEN_MAX+1);
 
-               if(strcmp(property, "Strength") != 0) /** Ignore Strength signal */
-                       NETWORK_LOG(NETWORK_LOW, "[Service : PropertyChanged]"
-                                       "Got Signal with value [%s]\n", property);
+                       event_data.Datalength = 0;
+                       event_data.Data = NULL;
 
-               if (strcmp(property, "State") == 0) {
-                       memset(ProfileName, 0, sizeof(ProfileName));
-                       _net_get_path(msg, ProfileName);
+                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_WIFI_WPS_RSP\n");
 
-                       device_type = _net_get_tech_type_from_path(ProfileName);
+                       _net_dbus_clear_pending_call();
 
-                       if (device_type == NET_DEVICE_UNKNOWN) {
-                               /* We have handled this message, don't pass it on */
-                               __NETWORK_FUNC_EXIT__;
-                               return DBUS_HANDLER_RESULT_HANDLED;
-                       }
+                       _net_client_callback(&event_data);
+               } else if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE &&
+                               g_strcmp0(sig_path, svc_name1) == 0) {
+                       memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION], 0,
+                                       sizeof(network_request_table_t));
 
-                       sig_path = ProfileName;
+                       /** Send Close Resp */
+                       event_data.Error = Error;
+                       event_data.Event =  NET_EVENT_CLOSE_RSP;
+                       g_strlcpy(event_data.ProfileName, sig_path, NET_PROFILE_NAME_LEN_MAX+1);
 
-                       memset(svc_state, 0, sizeof(svc_state));
-                       memset(svc_error, 0, sizeof(svc_error));
-                       __net_get_state(msg, svc_state, svc_error);
-                       NETWORK_LOG(NETWORK_LOW, "Current ConnMan svc_state [%s] and svc_error [%s] for ProfileName [%s]\n",
-                                       svc_state, svc_error, ProfileName);
+                       event_data.Datalength = 0;
+                       event_data.Data = NULL;
 
-                       if (device_type == NET_DEVICE_WIFI &&
-                                       NetworkInfo.wifi_state == WIFI_OFF) {
-                               NETWORK_LOG(NETWORK_LOW, "Warning!! Wi-Fi is already off!!\n");
-                               /* We have handled this message, don't pass it on */
-                               __NETWORK_FUNC_EXIT__;
-                               return DBUS_HANDLER_RESULT_HANDLED;;
-                       }
+                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_RSP\n");
 
-                       if (strcmp(svc_state, "idle") == 0) {
-                               service_state_table[device_type] = NET_STATE_TYPE_IDLE;
-                               __net_handle_state_ind(ProfileName, NET_STATE_TYPE_IDLE);
-                       } else if (strcmp(svc_state, "association") == 0) {
-                               service_state_table[device_type] = NET_STATE_TYPE_ASSOCIATION;
-                               __net_handle_state_ind(ProfileName, NET_STATE_TYPE_ASSOCIATION);
-                       } else if (strcmp(svc_state, "configuration") == 0) {
-                               service_state_table[device_type] = NET_STATE_TYPE_CONFIGURATION;
-                               __net_handle_state_ind(ProfileName, NET_STATE_TYPE_CONFIGURATION);
-                       } else if (strcmp(svc_state, "ready") == 0 ||
-                                       strcmp(svc_state, "online") == 0) {
-                               if (service_state_table[device_type] != NET_STATE_TYPE_READY &&
-                                               service_state_table[device_type] != NET_STATE_TYPE_ONLINE) {
-                                       svc_name1 = request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
-                                       svc_name2 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
-
-                                       if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-                                           strstr(sig_path, svc_name1) != NULL) {
-                                               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
-                                                               sizeof(network_request_table_t));
-
-                                               event_data.Event =  NET_EVENT_OPEN_RSP;
-                                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_RSP\n");
-                                               _net_dbus_clear_pending_call();
-                                       } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                                                       strcmp(sig_path, svc_name2) == 0) {
-                                               memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
-                                                               sizeof(network_request_table_t));
-
-                                               event_data.Event =  NET_EVENT_WIFI_WPS_RSP;
-                                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_WIFI_WPS_RSP\n");
-                                               _net_dbus_clear_pending_call();
-                                       } else {
-                                               event_data.Event =  NET_EVENT_OPEN_IND;
-                                               NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_IND\n");
-                                       }
-
-                                       net_profile_info_t prof_info;
-                                       if ((Error = net_get_profile_info(ProfileName, &prof_info)) != NET_ERR_NONE) {
-                                               NETWORK_LOG(NETWORK_ERROR, "Error!!! net_get_profile_info() failed [%s]\n",
-                                                               _net_print_error(Error));
-                                               event_data.Datalength = 0;
-                                               event_data.Data = NULL;
-                                       } else {
-                                               event_data.Datalength = sizeof(net_profile_info_t);
-                                               event_data.Data = &prof_info;
-                                       }
-
-                                       event_data.Error = Error;
-                                       snprintf(event_data.ProfileName, NET_PROFILE_NAME_LEN_MAX + 1, "%s", ProfileName);
-                                       open_connection_rsp_sent = TRUE;
-                                       _net_client_callback(&event_data);
-                               } else {
-                                       if (strcmp(svc_state, "ready") == 0)
-                                               __net_handle_state_ind(ProfileName, NET_STATE_TYPE_READY);
-                                       else
-                                               __net_handle_state_ind(ProfileName, NET_STATE_TYPE_ONLINE);
-                               }
-
-                               if (strcmp(svc_state, "ready") == 0)
-                                       service_state_table[device_type] = NET_STATE_TYPE_READY;
-                               else
-                                       service_state_table[device_type] = NET_STATE_TYPE_ONLINE;
-                       } else if (strcmp(svc_state, "disconnect") == 0) {
-                               svc_name1 = request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].ProfileName;
-                               svc_name2 = request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName;
-                               svc_name3 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
-
-                               if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-                                   strstr(sig_path, svc_name2) != NULL) {
-                                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
-                                                       sizeof(network_request_table_t));
-
-                                       /** Send Open Resp */
-                                       event_data.Error = NET_ERR_OPERATION_ABORTED;
-                                       event_data.Event =  NET_EVENT_OPEN_RSP;
-                                       snprintf(event_data.ProfileName,
-                                                       NET_PROFILE_NAME_LEN_MAX+1, "%s", ProfileName);
-
-                                       event_data.Datalength = 0;
-                                       event_data.Data = NULL;
-                                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_OPEN_RSP\n");
-                                       _net_dbus_clear_pending_call();
-                                       _net_client_callback(&event_data);
-                               } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                                               strcmp(sig_path, svc_name3) == 0) {
-                                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
-                                                       sizeof(network_request_table_t));
-
-                                       /** Send WPS Resp */
-                                       event_data.Error = NET_ERR_OPERATION_ABORTED;
-                                       event_data.Event =  NET_EVENT_WIFI_WPS_RSP;
-                                       snprintf(event_data.ProfileName,
-                                                       NET_PROFILE_NAME_LEN_MAX+1, "%s", ProfileName);
-
-                                       event_data.Datalength = 0;
-                                       event_data.Data = NULL;
-                                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_WIFI_WPS_RSP\n");
-                                       _net_dbus_clear_pending_call();
-                                       _net_client_callback(&event_data);
-                               } else if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE &&
-                                               strcmp(sig_path, svc_name1) == 0) {
-                                       memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION], 0,
-                                                       sizeof(network_request_table_t));
-
-                                       /** Send Close Resp */
-                                       event_data.Error = Error;
-                                       event_data.Event =  NET_EVENT_CLOSE_RSP;
-                                       snprintf(event_data.ProfileName,
-                                                       NET_PROFILE_NAME_LEN_MAX+1, "%s", ProfileName);
-
-                                       event_data.Datalength = 0;
-                                       event_data.Data = NULL;
-                                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_RSP\n");
-                                       _net_dbus_clear_pending_call();
-                                       _net_client_callback(&event_data);
-                               } else {
-                                       /** Send Close Ind */
-                                       event_data.Error = Error;
-                                       event_data.Event =  NET_EVENT_CLOSE_IND;
-                                       snprintf(event_data.ProfileName,
-                                                       NET_PROFILE_NAME_LEN_MAX+1, "%s", ProfileName);
-
-                                       event_data.Datalength = 0;
-                                       event_data.Data = NULL;
-                                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_IND\n");
-                                       _net_client_callback(&event_data);
-                               }
-
-                               service_state_table[device_type] = NET_STATE_TYPE_DISCONNECT;
-                       } else if (strcmp(svc_state, "failure") == 0) {
-                               __net_handle_svc_failure_ind(sig_path, (char*)svc_error);
-                               service_state_table[device_type] = NET_STATE_TYPE_FAILURE;
-                               __NETWORK_FUNC_EXIT__;
-                               return DBUS_HANDLER_RESULT_HANDLED;
-                       }
-               } else if (strcmp(property, "Nameservers") == 0) {
-                       /* We have handled this message, don't pass it on */
-                       __NETWORK_FUNC_EXIT__;
-                       return DBUS_HANDLER_RESULT_HANDLED;
-               } else if (strcmp(property, "IPv4") == 0) {
-                       /** Ignore - compared for future use */
-               } else if (strcmp(property, "Ethernet") == 0) {
-                       /** Ignore - compared for future use */
-               } else if (strcmp(property, "Domains") == 0) {
-                       /** Ignore - compared for future use */
-               } else if (strcmp(property, "IPv4.Configuration") == 0) {
-                       /** Ignore - compared for future use */
+                       _net_dbus_clear_pending_call();
+
+                       _net_client_callback(&event_data);
                } else {
-                       /** Ignore - compared for future use */
+                       /** Send Close Ind */
+                       event_data.Error = Error;
+                       event_data.Event =  NET_EVENT_CLOSE_IND;
+                       g_strlcpy(event_data.ProfileName, sig_path, NET_PROFILE_NAME_LEN_MAX+1);
+
+                       event_data.Datalength = 0;
+                       event_data.Data = NULL;
+
+                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_IND\n");
+
+                       _net_client_callback(&event_data);
                }
 
-               /* We have handled this message, don't pass it on */
-               __NETWORK_FUNC_EXIT__;
-               return DBUS_HANDLER_RESULT_HANDLED;
+               break;
        }
+       case NET_STATE_TYPE_FAILURE:
+               __net_handle_failure_ind(sig_path);
+               break;
 
-       if (dbus_message_is_signal(msg, CONNMAN_COUNTER_INTERFACE, "Usage")) {
-               NETWORK_LOG(NETWORK_LOW, "Received [COUNTER_USAGE_SIGNAL] signal\n");
-       } else if (dbus_message_is_signal(msg, CONNMAN_COUNTER_INTERFACE, "Release")) {
-               NETWORK_LOG(NETWORK_LOW, "Received [COUNTER_RELEASE_SIGNAL] signal\n");
+       default:
+               Error = NET_ERR_UNKNOWN_METHOD;
+               break;
+       }
+
+       return Error;
+}
+
+static int string2error(const char *error)
+{
+       if (g_strcmp0(error, "out-of-range") == 0)
+               return NET_ERR_CONNECTION_OUT_OF_RANGE;
+       else if (g_strcmp0(error, "pin-missing") == 0)
+               return NET_ERR_CONNECTION_PIN_MISSING;
+       else if (g_strcmp0(error, "dhcp-failed") == 0)
+               return NET_ERR_CONNECTION_DHCP_FAILED;
+       else if (g_strcmp0(error, "connect-failed") == 0)
+               return NET_ERR_CONNECTION_CONNECT_FAILED;
+       else if (g_strcmp0(error, "login-failed") == 0)
+               return NET_ERR_CONNECTION_LOGIN_FAILED;
+       else if (g_strcmp0(error, "auth-failed") == 0)
+               return NET_ERR_CONNECTION_AUTH_FAILED;
+       else if (g_strcmp0(error, "invalid-key") == 0)
+               return NET_ERR_CONNECTION_INVALID_KEY;
+
+       return NET_ERR_UNKNOWN;
+}
+
+static int __net_handle_service_set_error(DBusMessage *message,
+               const char *key, const char *error)
+{
+       NETWORK_LOG(NETWORK_LOW, "[%s] %s\n", key, error);
+
+       net_service_error = string2error(error);
+
+       return NET_ERR_NONE;
+}
+
+static int __net_handle_service_property_changed(DBusMessage *message)
+{
+       int Error = NET_ERR_NONE;
+       char *key = NULL;
+       char *value = NULL;
+
+       Error = __net_get_dbus_property_changed_basic(message,
+                                       &key, DBUS_TYPE_STRING, &value);
+       if (Error != NET_ERR_NONE)
+               return Error;
+
+       if (g_strcmp0(key, "State") == 0) {
+               Error = __net_handle_service_state_changed(message, key, value);
+       } else if (g_strcmp0(key, "Error") == 0) {
+               Error = __net_handle_service_set_error(message, key, value);
+       } else if (g_strcmp0(key, "Nameservers") == 0) {
+               /** Ignore - compared for future use */
+       } else if (g_strcmp0(key, "IPv4") == 0) {
+               /** Ignore - compared for future use */
+       } else if (g_strcmp0(key, "Ethernet") == 0) {
+               /** Ignore - compared for future use */
+       } else if (g_strcmp0(key, "Domains") == 0) {
+               /** Ignore - compared for future use */
+       } else if (g_strcmp0(key, "IPv4.Configuration") == 0) {
+               /** Ignore - compared for future use */
+       } else {
+               /** Ignore - compared for future use */
+       }
+
+       return Error;
+}
+
+static DBusHandlerResult
+__net_signal_filter(DBusConnection* conn, DBusMessage* msg, void* user_data)
+{
+       if (msg == NULL)
+               return DBUS_HANDLER_RESULT_HANDLED;
+
+       if (dbus_message_is_signal(msg, CONNMAN_SERVICE_INTERFACE,
+                       SIGNAL_PROPERTY_CHANGED)) {
+               __net_handle_service_property_changed(msg);
+
+               return DBUS_HANDLER_RESULT_HANDLED;
+       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE,
+                       NETCONFIG_SIGNAL_POWERON_COMPLETED)) {
+               __net_handle_wifi_power_rsp(TRUE);
+
+               return DBUS_HANDLER_RESULT_HANDLED;
+       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE,
+                       NETCONFIG_SIGNAL_POWEROFF_COMPLETED)) {
+               __net_handle_wifi_power_rsp(FALSE);
+
+               return DBUS_HANDLER_RESULT_HANDLED;
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
+                       SIGNAL_PROPERTY_CHANGED)) {
+               /* reserved */
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
+                       SIGNAL_TECHNOLOGY_ADDED)) {
+               /* reserved */
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
+                       SIGNAL_TECHNOLOGY_REMOVED)) {
+               /* reserved */
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE,
+                       SIGNAL_SERVICES_CHANGED)) {
+               __net_handle_services_changed_signal(msg);
+               /* reserved */
+       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE,
+                       NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE)) {
+               __net_handle_wifi_specific_scan_rsp(msg);
+
+               return DBUS_HANDLER_RESULT_HANDLED;
        }
 
-       NETWORK_LOG(NETWORK_LOW, "Useless signal. Ignored !!!\n");
-       __NETWORK_FUNC_EXIT__;
        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void __net_init_dbus_thread()
 {
        static dbus_bool_t init_required = TRUE;
+
        if (init_required) {
                dbus_g_thread_init();
                init_required = FALSE;
@@ -740,7 +646,6 @@ static void __net_init_dbus_thread()
 /*****************************************************************************
  *     Global Functions
  *****************************************************************************/
-
 int _net_deregister_signal(void)
 {
        __NETWORK_FUNC_ENTER__;
@@ -749,7 +654,8 @@ int _net_deregister_signal(void)
        dbus_error_init(&err);
 
        if (signal_conn == NULL) {
-               NETWORK_LOG(NETWORK_HIGH, "Already de-registered. Nothing to be done\n");
+               NETWORK_LOG(NETWORK_HIGH, "Already de-registered\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NONE;
        }
@@ -757,7 +663,7 @@ int _net_deregister_signal(void)
        dbus_bus_remove_match(signal_conn, CONNMAN_MANAGER_SIGNAL_FILTER, &err);
        dbus_connection_flush(signal_conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Remove Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Remove Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -766,7 +672,7 @@ int _net_deregister_signal(void)
        dbus_bus_remove_match(signal_conn, CONNMAN_TECHNOLOGY_SIGNAL_FILTER, &err);
        dbus_connection_flush(signal_conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Remove Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Remove Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -775,16 +681,7 @@ int _net_deregister_signal(void)
        dbus_bus_remove_match(signal_conn, CONNMAN_SERVICE_SIGNAL_FILTER, &err);
        dbus_connection_flush(signal_conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Remove Match Error (%s)\n", err.message);
-               dbus_error_free(&err);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       dbus_bus_remove_match(signal_conn, CONNMAN_NETWORK_COUNTER_FILTER, &err);
-       dbus_connection_flush(signal_conn);
-       if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Remove Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Remove Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -793,7 +690,7 @@ int _net_deregister_signal(void)
        dbus_bus_remove_match(signal_conn, NETCONFIG_WIFI_FILTER, &err);
        dbus_connection_flush(signal_conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Remove Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Remove Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -801,13 +698,10 @@ int _net_deregister_signal(void)
 
        dbus_connection_remove_filter(signal_conn, __net_signal_filter, NULL);
        NETWORK_LOG(NETWORK_HIGH, "dbus_connection_remove_filter() successful\n");
-       NETWORK_LOG(NETWORK_LOW, "Successfully removed signal filter rules\n");
+       NETWORK_LOG(NETWORK_LOW, "Successfully remove signal filters\n");
 
        /* If DBusPendingCall remains, it should be released */
-       if (_net_dbus_is_pending_call_used() == TRUE) {
-               _net_dbus_clear_pending_call();
-               NETWORK_LOG(NETWORK_HIGH, "DBus pending call successfully removed\n");
-       }
+       _net_dbus_clear_pending_call();
 
        dbus_connection_unref(signal_conn);
        signal_conn = NULL;
@@ -826,10 +720,13 @@ int _net_register_signal(void)
        __net_init_dbus_thread();
 
        dbus_error_init(&err);
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (conn == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to connect to the D-BUS daemon: [%s]\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR,
+                               "Failed to connect to the D-BUS daemon: [%s]\n", err.message);
                dbus_error_free(&err);
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
@@ -840,10 +737,10 @@ int _net_register_signal(void)
 
        /** listening to messages from all objects as no path is specified */
        /** see signals from the given interface */
-       dbus_bus_add_match(conn, CONNMAN_MANAGER_SIGNAL_FILTER, &err); 
+       dbus_bus_add_match(conn, CONNMAN_MANAGER_SIGNAL_FILTER, &err);
        dbus_connection_flush(conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -852,7 +749,7 @@ int _net_register_signal(void)
        dbus_bus_add_match(conn, CONNMAN_TECHNOLOGY_SIGNAL_FILTER, &err); 
        dbus_connection_flush(conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -861,16 +758,7 @@ int _net_register_signal(void)
        dbus_bus_add_match(conn, CONNMAN_SERVICE_SIGNAL_FILTER, &err);
        dbus_connection_flush(conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
-               dbus_error_free(&err);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       dbus_bus_add_match(conn, CONNMAN_NETWORK_COUNTER_FILTER, &err);
-       dbus_connection_flush(conn);
-       if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -879,19 +767,20 @@ int _net_register_signal(void)
        dbus_bus_add_match(conn, NETCONFIG_WIFI_FILTER, &err);
        dbus_connection_flush(conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        if (dbus_connection_add_filter(conn, __net_signal_filter, NULL, NULL) == FALSE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_connection_add_filter() failed\n");
+               NETWORK_LOG(NETWORK_ERROR, "dbus_connection_add_filter() failed\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
-       
-       NETWORK_LOG(NETWORK_LOW, "Successfully set signal filter rules\n");
+
+       NETWORK_LOG(NETWORK_LOW, "Successfully register signal filters\n");
 
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
@@ -950,7 +839,3 @@ int _net_init_service_state_table(void)
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
index db0cde0..82e77a9 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/*****************************************************************************
- *     Standard headers
- *****************************************************************************/
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h>
-#include <glib.h>
-
 #include <vconf.h>
-#include <dbus/dbus.h> 
-
-/*****************************************************************************
- *     Platform headers
- *****************************************************************************/
 
 #include "network-internal.h"
-#include "network-signal-handler.h"
 #include "network-dbus-request.h"
+#include "network-signal-handler.h"
 
 /*****************************************************************************
  *     Macros and Typedefs
@@ -58,7 +37,6 @@ static net_wifi_state_t __net_get_wifi_service_state();
  *     Global Functions
  *****************************************************************************/
 
-
 /*****************************************************************************
  *     Extern Variables
  *****************************************************************************/
@@ -88,7 +66,7 @@ static net_wifi_state_t __net_get_wifi_service_state(char *profile_name)
 
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! failed to get service(profile) list. Error [%s]\n",
+                               "Failed to get service(profile) list. Error [%s]\n",
                                _net_print_error(Error));
 
                NET_MEMFREE(profile_info);
@@ -131,7 +109,6 @@ static net_wifi_state_t __net_get_wifi_service_state(char *profile_name)
 /*****************************************************************************
  *     ConnMan Wi-Fi Client Interface Async API Definition
  *****************************************************************************/
-
 EXPORT_API int net_specific_scan_wifi(const char *ssid)
 {
        __NETWORK_FUNC_ENTER__;
@@ -139,49 +116,51 @@ EXPORT_API int net_specific_scan_wifi(const char *ssid)
        net_err_t Error = NET_ERR_NONE;
 
        if (ssid == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Find hidden AP request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Find hidden AP request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
-       if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+       if (_net_get_wifi_state() != WIFI_ON) {
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered off!\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
-       if (_net_get_wifi_state() != WIFI_ON) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! wifi is powered off!\n");
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ERROR, "pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag = TRUE;
+
        Error = _net_dbus_specific_scan_request(ssid);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_dbus_specific_scan_request() failed. Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR,
+                               "_net_dbus_specific_scan_request() failed. Error [%s]\n",
                                _net_print_error(Error));
 
-               memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN], 0, sizeof(network_request_table_t));
+               memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN], 0,
+                               sizeof(network_request_table_t));
        }
 
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
 EXPORT_API int net_open_connection_with_wifi_info(const net_wifi_connection_info_t *wifi_info)
 {
        __NETWORK_FUNC_ENTER__;
@@ -189,42 +168,45 @@ EXPORT_API int net_open_connection_with_wifi_info(const net_wifi_connection_info
        net_err_t Error = NET_ERR_NONE;
 
        if (wifi_info == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid parameter\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Connection open request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Connection open request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
-       if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+       if (_net_get_wifi_state() != WIFI_ON) {
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered off!\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
-       if (_net_get_wifi_state() != WIFI_ON) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! wifi is powered off!\n");
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ERROR, "pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag = TRUE;
+
        Error = _net_open_connection_with_wifi_info(wifi_info);
        if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! net_open_connection_with_wifi_info() failed. Error [%s]\n",
+               NETWORK_LOG(NETWORK_ERROR,
+                               "net_open_connection_with_wifi_info() failed. Error [%s]\n",
                                _net_print_error(Error));
 
-               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0, sizeof(network_request_table_t));
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0,
+                               sizeof(network_request_table_t));
 
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -234,7 +216,6 @@ EXPORT_API int net_open_connection_with_wifi_info(const net_wifi_connection_info
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_wifi_power_on(void)
 {
        __NETWORK_FUNC_ENTER__;
@@ -243,26 +224,26 @@ EXPORT_API int net_wifi_power_on(void)
        int hotspot_state = 0;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
        if (hotspot_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Wi-Fi hotspot is enabled!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi hotspot is enabled!\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        if (NetworkInfo.wifi_state != WIFI_OFF) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! wifi is powered on already!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered on already!\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
@@ -270,7 +251,7 @@ EXPORT_API int net_wifi_power_on(void)
        if (_net_dbus_is_pending_call_used() == TRUE) {
                NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
        request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag = TRUE;
@@ -278,9 +259,12 @@ EXPORT_API int net_wifi_power_on(void)
        Error = _net_dbus_load_wifi_driver();
        if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to request wifi power on/off. Error [%s]\n",
+                               "Failed to request Wi-Fi power on/off. Error [%s]\n",
                                _net_print_error(Error));
-               memset(&request_table[NETWORK_REQUEST_TYPE_WIFI_POWER], 0, sizeof(network_request_table_t));
+
+               memset(&request_table[NETWORK_REQUEST_TYPE_WIFI_POWER], 0,
+                               sizeof(network_request_table_t));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -291,7 +275,6 @@ EXPORT_API int net_wifi_power_on(void)
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_wifi_power_off(void)
 {
        __NETWORK_FUNC_ENTER__;
@@ -299,41 +282,36 @@ EXPORT_API int net_wifi_power_off(void)
        net_err_t Error = NET_ERR_NONE;
 
        if(g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if(NetworkInfo.wifi_state == WIFI_OFF) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! wifi is powered off already!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered off already!\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
-       if (_net_dbus_is_pending_call_used() == TRUE &&
-           request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
-       } else {
-               _net_dbus_clear_pending_call();
-               memset(request_table, 0, sizeof(request_table));
-       }
+       _net_dbus_clear_pending_call();
+       memset(request_table, 0, sizeof(request_table));
 
        request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag = TRUE;
 
        Error = _net_dbus_remove_wifi_driver();
        if (Error != NET_ERR_NONE ) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to request wifi power on/off. Error [%s]\n",
+                               "Failed to request Wi-Fi power on/off. Error [%s]\n",
                                _net_print_error(Error));
+
                memset(&request_table[NETWORK_REQUEST_TYPE_WIFI_POWER], 0, sizeof(network_request_table_t));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -344,55 +322,61 @@ EXPORT_API int net_wifi_power_off(void)
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_scan_wifi(void)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
 
-       if(g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
-       if(request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
-       }
-
-       if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+       if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
        if (_net_get_wifi_state() != WIFI_ON) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! wifi is powered off!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi powered off!\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               if (request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
+                       NETWORK_LOG(NETWORK_ERROR, "Pending call already in progress\n");
+                       __NETWORK_FUNC_EXIT__;
+                       return NET_ERR_IN_PROGRESS;
+               } else {
+                       __NETWORK_FUNC_EXIT__;
+                       return NET_ERR_INVALID_OPERATION;
+               }
+       }
+
        request_table[NETWORK_REQUEST_TYPE_SCAN].flag = TRUE;
 
-       if ((Error = _net_dbus_scan_request()) != NET_ERR_NONE ) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to request scan. Error [%s]\n",
+       Error = _net_dbus_scan_request();
+       if (Error != NET_ERR_NONE) {
+               NETWORK_LOG(NETWORK_ERROR, "Failed to request scan. Error [%s]\n",
                                _net_print_error(Error));
-               memset(&request_table[NETWORK_REQUEST_TYPE_SCAN], 0, sizeof(network_request_table_t));
+
+               memset(&request_table[NETWORK_REQUEST_TYPE_SCAN], 0,
+                               sizeof(network_request_table_t));
+
                __NETWORK_FUNC_EXIT__;
-               return Error;;
+               return Error;
        }
 
-       NETWORK_LOG(NETWORK_HIGH, "Scan request was sent successfully to connman.\n");
+       NETWORK_LOG(NETWORK_HIGH, "Wi-Fi scan requested successfully\n");
 
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t *wps_info)
 {
        __NETWORK_FUNC_ENTER__;
@@ -400,71 +384,66 @@ EXPORT_API int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t
        net_err_t Error = NET_ERR_NONE;
 
        if (_net_check_profile_name(profile_name) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               NETWORK_LOG(NETWORK_ERROR, "Invalid profile name\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! Request already in progress\n");
+               NETWORK_LOG(NETWORK_ERROR, "Request in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_IN_PROGRESS;
        }
 
-       if (_net_dbus_is_pending_call_used() == TRUE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!! pending call already in progress\n");
+       if (_net_get_wifi_state() != WIFI_ON) {
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered off!\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_IN_PROGRESS;
+               return NET_ERR_INVALID_OPERATION;
        }
 
-       if (_net_get_wifi_state() != WIFI_ON) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! wifi is powered off!\n");
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ERROR, "pending call in progress\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
        request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag = TRUE;
-       snprintf(request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName,
-                       NET_PROFILE_NAME_LEN_MAX+1, "%s", profile_name);
+       g_strlcpy(request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName,
+                       profile_name, NET_PROFILE_NAME_LEN_MAX+1);
 
-       if(wps_info->type == WIFI_WPS_PBC) {
+       if (wps_info->type == WIFI_WPS_PBC) {
                Error = _net_dbus_open_connection(profile_name);
-               if(Error != NET_ERR_NONE)
-               {
+               if (Error != NET_ERR_NONE) {
                        NETWORK_LOG(NETWORK_ERROR,
-                                       "Error!! Failed to request open connection, Error [%s]\n", 
+                                       "Failed to request open connection, Error [%s]\n",
                                        _net_print_error(Error));
-                       
-                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0, sizeof(network_request_table_t));
-                       
+
+                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS], 0,
+                                       sizeof(network_request_table_t));
+
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
-       }
-       else if(wps_info->type == WIFI_WPS_PIN) {
+       } else if(wps_info->type == WIFI_WPS_PIN) {
                // TODO: handle wps pin
-       }
-       else {
+       } else {
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
-       
+
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
-
 /*****************************************************************************
  *     ConnMan Wi-Fi Client Interface Sync Function Definition
  *****************************************************************************/
-
-
 EXPORT_API int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *profile_name)
 {
        __NETWORK_FUNC_ENTER__;
@@ -472,13 +451,13 @@ EXPORT_API int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_n
        net_wifi_state_t wifi_state;
 
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (profile_name == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! profile_name is NULL\n");
+               NETWORK_LOG(NETWORK_ERROR, "profile_name is NULL\n");
                return NET_ERR_INVALID_PARAM;
        }
 
@@ -501,43 +480,37 @@ EXPORT_API int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_n
        return NET_ERR_NONE;
 }
 
-
 EXPORT_API int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-               
+
        if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application not registered\n");
+               NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
        if (_net_get_wifi_state() != WIFI_ON) {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! wifi is powered off!\n");
+               NETWORK_LOG(NETWORK_ERROR, "Wi-Fi is powered off!\n");
+
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_OPERATION;
        }
 
-       NETWORK_LOG(NETWORK_HIGH,  "BGScan Mode [%d]\n", scan_mode);
+       NETWORK_LOG(NETWORK_HIGH, "BGScan Mode [%d]\n", scan_mode);
 
        if ((Error = _net_dbus_set_bgscan_mode(scan_mode)) != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to set bgscan mode. Error [%s]\n",
+                               "Failed to set bgscan mode. Error [%s]\n",
                                _net_print_error(Error));
 
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
-               
-       NETWORK_LOG(NETWORK_HIGH, "Set BGScan mode Request to connman is successfull\n");
-       
-       __NETWORK_FUNC_EXIT__;  
-       return NET_ERR_NONE;
-}
 
-#ifdef __cplusplus
+       __NETWORK_FUNC_EXIT__;
+       return NET_ERR_NONE;
 }
-#endif /* __cplusplus */
-
index 5f4ee0c..433f142 100644 (file)
@@ -1,14 +1,14 @@
 /*
- *  Network Client Library
+ * Network Client Library
  *
  * Copyright 2011-2013 Samsung Electronics Co., Ltd
-
+ *
  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
-
+ *
  * 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.
  *
  */
 
-#ifdef HAVE_CONFIG_H 
-#include <config.h> 
-#endif 
-#include <stdio.h> 
-#include <errno.h> 
-#include <stdlib.h> 
-#include <string.h> 
-#include <glib.h>
-
-#include <dbus/dbus.h> 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
-#include <network-pm-config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dbus/dbus.h>
 #include <network-cm-intf.h>
 #include <network-pm-intf.h>
 #include <network-wifi-intf.h>
+#include <network-pm-config.h>
 
 #define debug_print(format, args...) printf("[%s][Ln: %d] " format, __FILE__, __LINE__, ##args)
 
@@ -125,7 +122,7 @@ static void __network_print_profile(net_profile_info_t* ProfInfo, profile_print_
                gwaddr = (unsigned char *)&bt_info->net_info.GatewayAddr.Data.Ipv4.s_addr;
                net_info = &(bt_info->net_info);
        } else {
-               debug_print("Error!!! Invalid profile type\n");
+               debug_print("Invalid profile type\n");
                return ;
        }
 
@@ -325,10 +322,10 @@ static void __network_evt_cb(net_event_info_t* event_cb, void* user_data)
 
                Error = net_get_profile_list(NET_DEVICE_WIFI, &Profiles, &num_of_profile);
                if (Error != NET_ERR_NONE) {
-                       debug_print("Error!!! failed to get service(profile) list. Error [%d]\n",
+                       debug_print("Failed to get service(profile) list. Error [%d]\n",
                                        Error);
                } else {
-                       debug_print("network_dbus_get_scan_result() successfull\n");
+                       debug_print("network_dbus_get_scan_result() successfully\n");
                        debug_print("........................Scan Table.......................\n");
                        __print_profile_list(num_of_profile, Profiles, PROFILE_BASIC_INFO);
                        debug_print(".........................................................\n");
@@ -394,7 +391,7 @@ static void __network_evt_cb(net_event_info_t* event_cb, void* user_data)
                        debug_print("Activation Failed!\n");
                        break;
                default:
-                       debug_print("Unknown Error!\n");
+                       debug_print("Unknown Error\n");
                        break;
                }
 
@@ -428,7 +425,7 @@ static void __network_evt_cb(net_event_info_t* event_cb, void* user_data)
                        debug_print("Deactivation Failed!\n");
                        break;
                default:
-                       debug_print("Unknown Error!\n");
+                       debug_print("Unknown Error\n");
                        break;
                }
 
@@ -533,7 +530,7 @@ static void __network_evt_cb(net_event_info_t* event_cb, void* user_data)
                break;
 
        default :
-               debug_print("Error! Unknown Event\n\n");
+               debug_print("Unknown Event\n\n");
                break;
        }
 
@@ -933,7 +930,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_wifi_power_on() != NET_ERR_NONE) {
-                       debug_print("Error!! net_wifi_power_on() failed.\n");
+                       debug_print("net_wifi_power_on() failed.\n");
                        break;
                }
 
@@ -949,7 +946,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_wifi_power_off() != NET_ERR_NONE ) {
-                       debug_print("Error!! net_wifi_power_off() failed.\n");
+                       debug_print("net_wifi_power_off() failed.\n");
                        break;
                }
 
@@ -965,7 +962,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_scan_wifi() != NET_ERR_NONE ) {
-                       debug_print("Error!! net_scan_wifi() failed.\n");
+                       debug_print("net_scan_wifi() failed.\n");
                        break;
                }
 
@@ -985,7 +982,7 @@ static gboolean network_main_gthread(gpointer data)
 
                if (net_wifi_set_background_scan_mode(input_int) != NET_ERR_NONE) {
                        debug_print(
-                               "Error!! network_wifi_set_scan_interval() failed.\n");
+                               "network_wifi_set_scan_interval() failed.\n");
                        break;
                }
 
@@ -997,7 +994,7 @@ static gboolean network_main_gthread(gpointer data)
                break;
 
        case '4':
-               debug_print( "Enter Service Type(1:Internet, 2:MMS): \n");
+               debug_print("Enter Service Type(1:Internet, 2:MMS): \n");
                scanf("%d", &input_int);
 
                net_service_type_t service_type = NET_SERVICE_UNKNOWN;
@@ -1017,8 +1014,7 @@ static gboolean network_main_gthread(gpointer data)
                if (service_type != NET_SERVICE_UNKNOWN) {
                        net_error = net_open_connection_with_preference(service_type);
                        if (net_error != NET_ERR_NONE) {
-                               debug_print(
-                                 "Error!! net_open_connection_with_profile() failed.\n");
+                               debug_print("net_open_connection_with_profile() failed.\n");
                                break;
                        }
                }
@@ -1041,7 +1037,7 @@ static gboolean network_main_gthread(gpointer data)
 
                if (net_open_connection_with_profile(ProfileName) != NET_ERR_NONE) {
                        debug_print(
-                               "Error!! net_open_connection_with_profile() failed.\n");
+                               "net_open_connection_with_profile() failed.\n");
                        break;
                }
 
@@ -1063,7 +1059,7 @@ static gboolean network_main_gthread(gpointer data)
 
                if (net_close_connection(ProfileName) != NET_ERR_NONE) {
                        debug_print(
-                               "Error!! net_close_connection() failed.\n");
+                               "net_close_connection() failed.\n");
                        break;
                }
 
@@ -1082,7 +1078,7 @@ static gboolean network_main_gthread(gpointer data)
                net_profile_name_t profile_name;
 
                if (net_get_wifi_state(&wlanstate, &profile_name) != NET_ERR_NONE) {
-                       debug_print("Error!! net_get_wifi_state() failed.\n");
+                       debug_print("net_get_wifi_state() failed.\n");
                        break;
                }
 
@@ -1112,6 +1108,7 @@ static gboolean network_main_gthread(gpointer data)
                        break;
                default :
                        debug_print("wlanstate : Unknown\n");
+                       break;
                }
                break;
 
@@ -1158,7 +1155,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_get_network_status(device_type, &NetworkStatus) != NET_ERR_NONE) {
-                       debug_print("Error!!! net_get_network_status() failed\n");
+                       debug_print("net_get_network_status() failed\n");
                        break;
                }
 
@@ -1188,43 +1185,43 @@ static gboolean network_main_gthread(gpointer data)
                switch (input_int) {
                case 1:
                        if (net_get_active_net_info(&profile_info) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_net_info() failed\n");
+                               debug_print("net_get_active_net_info() failed\n");
                        else
                                __network_print_profile(&profile_info, PROFILE_FULL_INFO);
                        break;
                case 2:
                        if (net_get_active_ipaddress(&ip_address) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_ipaddress() failed\n");
+                               debug_print("net_get_active_ipaddress() failed\n");
                        else
                                __network_print_ipaddress(&ip_address);
                        break;
                case 3:
                        if (net_get_active_netmask(&ip_address) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_netmask() failed\n");
+                               debug_print("net_get_active_netmask() failed\n");
                        else
                                __network_print_ipaddress(&ip_address);
                        break;
                case 4:
                        if (net_get_active_gateway(&ip_address) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_gateway() failed\n");
+                               debug_print("net_get_active_gateway() failed\n");
                        else
                                __network_print_ipaddress(&ip_address);
                        break;
                case 5:
                        if (net_get_active_dns(&ip_address) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_dns() failed\n");
+                               debug_print("net_get_active_dns() failed\n");
                        else
                                __network_print_ipaddress(&ip_address);
                        break;
                case 6:
                        if (net_get_active_essid(&essid) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_essid() failed\n");
+                               debug_print("net_get_active_essid() failed\n");
                        else
                                debug_print("Profile ESSID = [%s]\n", essid.essid);
                        break;
                case 7:
                        if (net_get_active_proxy(&proxy) != NET_ERR_NONE)
-                               debug_print("Error!!! net_get_active_proxy() failed\n");
+                               debug_print("net_get_active_proxy() failed\n");
                        else
                                debug_print("Profile Proxy = [%s]\n", proxy.proxy_addr);
                        break;
@@ -1270,7 +1267,7 @@ static gboolean network_main_gthread(gpointer data)
                                &profList, &profListCount);
 
                if (net_error != NET_ERR_NONE) {
-                       debug_print("Error!!! net_get_profile_list() failed\n");
+                       debug_print("net_get_profile_list() failed\n");
                        break;
                }
 
@@ -1293,7 +1290,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_get_profile_info(ProfileName, &profile_info) != NET_ERR_NONE) {
-                       debug_print("Error!!! net_get_profile_info() failed\n");
+                       debug_print("net_get_profile_info() failed\n");
                        break;
                }
 
@@ -1314,7 +1311,7 @@ static gboolean network_main_gthread(gpointer data)
                net_error = net_get_profile_info(ProfileName, &profile_info);
 
                if (net_error != NET_ERR_NONE) {
-                       debug_print("Error!!! net_get_profile_info() failed\n");
+                       debug_print("net_get_profile_info() failed\n");
                        break;
                }
 
@@ -1325,7 +1322,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_modify_profile(ProfileName, &profile_info) != NET_ERR_NONE) {
-                       debug_print("Error!!! net_modify_profile() failed\n");
+                       debug_print("net_modify_profile() failed\n");
                        break;
                }
 
@@ -1345,7 +1342,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_delete_profile(ProfileName) != NET_ERR_NONE) {
-                       debug_print("Error!!! net_delete_profile() failed\n");
+                       debug_print("net_delete_profile() failed\n");
                        break;
                }
 
@@ -1375,7 +1372,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_add_profile(network_type, &profile_info) != NET_ERR_NONE) {
-                       debug_print("Error!!! net_add_profile() failed\n");
+                       debug_print("net_add_profile() failed\n");
                        break;
                }
 
@@ -1408,8 +1405,7 @@ static gboolean network_main_gthread(gpointer data)
                net_error = net_open_connection_with_wifi_info(&wifi_info);
 
                if (net_error != NET_ERR_NONE) {
-                       debug_print("Error!!! "
-                                   "net_open_connection_with_wifi_info() failed.\n");
+                       debug_print("net_open_connection_with_wifi_info() failed.\n");
                        break;
                }
 
@@ -1436,7 +1432,7 @@ static gboolean network_main_gthread(gpointer data)
                wps_info.type = WIFI_WPS_PBC;
 
                if (net_wifi_enroll_wps(ProfileName, &wps_info) != NET_ERR_NONE) {
-                       debug_print("Error!! net_wifi_enroll_wps() failed.\n");
+                       debug_print("net_wifi_enroll_wps() failed.\n");
                        break;
                }
 
@@ -1525,12 +1521,12 @@ static gboolean network_main_gthread(gpointer data)
 
                if (user_sel == 1) {
                        if (net_set_default_cellular_service_profile(ProfileName) != NET_ERR_NONE) {
-                               debug_print("Error!! net_set_default_cellular_service_profile() failed.\n");
+                               debug_print("net_set_default_cellular_service_profile() failed.\n");
                                break;
                        }
                } else {
                        if (net_set_default_cellular_service_profile_async(ProfileName) != NET_ERR_NONE) {
-                               debug_print("Error!! net_set_default_cellular_service_profile_async() failed.\n");
+                               debug_print("net_set_default_cellular_service_profile_async() failed.\n");
                                break;
                        }
                }
@@ -1561,7 +1557,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_add_route(ip_addr, if_name) != NET_ERR_NONE) {
-                       debug_print("Error!! net_add_route() failed.\n");
+                       debug_print("net_add_route() failed.\n");
                        break;
                }
 
@@ -1591,7 +1587,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_remove_route(ip_addr, if_name) != NET_ERR_NONE) {
-                       debug_print("Error!! net_remove_route() failed.\n");
+                       debug_print("net_remove_route() failed.\n");
                        break;
                }
 
@@ -1615,7 +1611,7 @@ static gboolean network_main_gthread(gpointer data)
                start_time = Convert_time2double(timevar);
 
                if (net_specific_scan_wifi(essid) != NET_ERR_NONE) {
-                       debug_print("Error!! net_specific_scan_wifi() failed.\n");
+                       debug_print("net_specific_scan_wifi() failed.\n");
                        break;
                }
 
@@ -1668,33 +1664,33 @@ static gboolean network_main_gthread(gpointer data)
                break;
 
        case 'z':
-               debug_print( "Exiting...!!!\n");
+               debug_print("Exiting...!!!\n");
 
                if (net_deregister_client () != NET_ERR_NONE)
-                       debug_print("Error!! net_deregister_client() failed.\n");
+                       debug_print("net_deregister_client() failed.\n");
                else
-                       debug_print( "net_deregister_client() success\n");
+                       debug_print("net_deregister_client() success\n");
 
                exit(1);
 
        default:
-               debug_print( "default...!!!\n");
+               debug_print("default...!!!\n");
+               break;
        }
 
        return TRUE;
 }
 
-
 int main(int argc, char *argv[])
 {
        GMainLoop* mainloop = NULL;
 
        if (net_register_client ((net_event_cb_t)__network_evt_cb, NULL) != NET_ERR_NONE) {
-               debug_print("Error!! net_register_client() failed.\n");
+               debug_print("net_register_client() failed.\n");
                return 0;
        }
 
-       debug_print( "net_register_client() successfull\n");
+       debug_print("net_register_client() successfull\n");
 
        g_idle_add(network_main_gthread, NULL);
 
@@ -1706,4 +1702,3 @@ int main(int argc, char *argv[])
 
        return 0;
 }
-