Release 2.0 beta 2.0alpha master 2.0_alpha submit/master/20120920.151047
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 21 Aug 2012 10:33:34 +0000 (19:33 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 21 Aug 2012 10:33:34 +0000 (19:33 +0900)
20 files changed:
debian/changelog
debian/control
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/build.sh
test/main.c

index fb4501e..4d4c95d 100644 (file)
@@ -1,3 +1,11 @@
+libnet-client (0.1.73-2) unstable; urgency=low
+
+  * Change libnet-client package license to 'Flora'
+  * Git: slp/pkgs/l/libnet-client
+  * Tag: libnet-client_0.1.73-2
+
+ -- Kim sun il <sunil85.kim@samsung.com>  Fri, 10 Aug 2012 14:04:56 +0900
+
 libnet-client (0.1.64) unstable; urgency=low
 
   * Update license
index 11437f8..a0ff0f5 100644 (file)
@@ -2,7 +2,7 @@ Source: libnet-client
 Section: libs
 Priority: extra
 Maintainer: Jaehyun Kim <jeik01.kim@samsung.com>, Danny Jeongseok Seo <s.seo@samsung.com>
-Uploaders: Jaehyun Kim <jeik01.kim@samsung.com>, Misun Kim <ms0123.kim@samsung.com>, DongHoo Park <donghoo.park@samsung.com>
+Uploaders: Jaehyun Kim <jeik01.kim@samsung.com>, Misun Kim <ms0123.kim@samsung.com>, Sanghoon Cho <sanghoon80.cho@samsung.com>
 Build-Depends: debhelper (>= 5), libslp-setting-dev, libglib2.0-dev, dlog-dev, libdbus-glib-1-dev
 Standards-Version: 3.7.2
 
@@ -10,15 +10,15 @@ Package: libnetwork-0
 Section: libs
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, libglib2.0-0, libdbus-glib-1-2
-Description: network(connman) client library (Shared Library)
+Description: Network (ConnMan) Client library (Shared library)
 
 Package: libnetwork-dev
 Section: libs
 Architecture: any
 Depends: libnetwork-0 (= ${Source-Version}), ${misc:Depends} 
-Description: network(connman) client library (Development)
+Description: Network (ConnMan) Client library (Development)
 
 Package: libnetwork-dbg
 Architecture: any
 Depends: libnetwork-0 (= ${Source-Version}), ${misc:Depends}
-Description: debug symbols for network(connman) client library
+Description: debug symbols for Network (ConnMan) Client library
index 3cb9975..985ebcf 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
index da20a58..013a7fd 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -126,6 +129,12 @@ typedef enum
        /** Wi-Fi interface Power On/Off Response Event */
        NET_EVENT_WIFI_POWER_RSP,
 
+       /** Specific Scan Response Event */
+       NET_EVENT_SPECIFIC_SCAN_RSP,
+
+       /** Wi-Fi interface Scan Indication Event(Specific scan) */
+       NET_EVENT_SPECIFIC_SCAN_IND,
+
        /** Wi-Fi interface Power On/Off Indication Event */
        NET_EVENT_WIFI_POWER_IND,
 
@@ -158,6 +167,17 @@ typedef enum
 } net_cm_network_status_t;
 
 /**
+ * @brief Enumerations of statistics type.
+ */
+typedef enum
+{
+       NET_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0,  /**< Last received data */
+       NET_STATISTICS_TYPE_LAST_SENT_DATA = 1,  /**< Last sent data */
+       NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2,  /**< Total received data */
+       NET_STATISTICS_TYPE_TOTAL_SENT_DATA = 3,  /**< Total sent data */
+} net_statistics_type_e;
+
+/**
  * \}
  */
 
@@ -929,6 +949,79 @@ int net_is_connected(void);
  * \}
  */
 
+/**
+ * \addtogroup  pdp_specific
+ * \{
+*/
+
+/**
+ * \}
+ */
+
+/**
+ * \addtogroup  common_extended
+ * \{
+*/
+
+/**
+ * \brief      This API is only for Connection/Wi-Fi CAPI. Don't use this.
+ *
+ * \param[in] event_cb     Application Callback function pointer to receive ConnMan events
+ * \param[in] client_type  NET_DEVICE_DEFAULT : Connection CAPI, NET_DEVICE_WIFI : Wi-Fi CAPI
+ * \param[in] user_data    user data
+ *
+ ******************************************************************************************/
+int net_register_client_ext(net_event_cb_t event_cb, net_device_t client_type, void *user_data);
+
+/**
+ * \brief      This API is only for Connection/Wi-Fi CAPI. Don't use this.
+ *
+ * \param[in] client_type  NET_DEVICE_DEFAULT : Connection CAPI, NET_DEVICE_WIFI : Wi-Fi CAPI
+ *
+ ******************************************************************************************/
+int net_deregister_client_ext(net_device_t client_type);
+
+/**
+ * \brief      This API is only for Connection/Wi-Fi CAPI. Don't use this.
+ *
+ * \param[in]  service_type specific service type
+ * \param[out] profile_info The information of requested network profile.
+ *
+ ******************************************************************************************/
+int net_open_connection_with_preference_ext(net_service_type_t service_type, net_profile_name_t *prof_name);
+
+/**
+ * \}
+ */
+
+/**
+ * \addtogroup  common_info
+ * \{
+*/
+
+/**
+ * \brief      Gets the statistics information.
+ *
+ * \param[in]  device_type     specific device type(cellular/wifi).
+ * \param[in]  statistics_type specific statistics type.
+ * \param[out] statistics_type statistics value requested.
+ *
+ ******************************************************************************************/
+int net_get_statistics(net_device_t device_type, net_statistics_type_e statistics_type, unsigned long long *size);
+
+/**
+ * \brief      Resets the statistics information.
+ *
+ * \param[in]  device_type     specific device type(cellular/wifi).
+ * \param[in]  statistics_type specific statistics type.
+ *
+ ******************************************************************************************/
+int net_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type);
+
+/**
+ * \}
+ */
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 591d3df..9f09c52 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -107,8 +110,11 @@ typedef enum
        /** Serial USB device */
        NET_DEVICE_USB = 0x4,
 
+       /** Ethernet device */
+       NET_DEVICE_ETHERNET = 0x5,
+
        /** Count of device type */
-       NET_DEVICE_MAX = 0x5,
+       NET_DEVICE_MAX = 0x6,
 } net_device_t;
 
 /**
@@ -296,7 +302,7 @@ typedef struct
        /** Dns Server Address of the connection link */
        net_addr_t      DnsAddr[NET_DNS_ADDR_MAX];
        /** No of DNS Address for the connection link */
-       int                     DnsCount;
+       int             DnsCount;
 
        /** Net IP configuration Type */
        net_ip_config_type_t IpConfigType;
@@ -315,10 +321,10 @@ typedef struct
        /** Proxy Method type */
        net_proxy_type_t        ProxyMethod;
        /** Proxy address */
-       char            ProxyAddr[NET_PROXY_LEN_MAX+1];
+       char                    ProxyAddr[NET_PROXY_LEN_MAX+1];
 
        /** MAC address */
-       char            MacAddr[NET_MAX_MAC_ADDR_LEN+1];
+       char                    MacAddr[NET_MAX_MAC_ADDR_LEN+1];
 } net_dev_info_t;
 
 /**
index d3c0943..6e22900 100644 (file)
@@ -1,20 +1,23 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
-
 #ifndef __NETWORK_PM_INTF_H__
 #define __NETWORK_PM_INTF_H__
 
@@ -129,6 +132,15 @@ typedef struct
 } net_pdp_profile_info_t;
 
 /**
+ * Profile data structures: Ethernet Interface
+ */
+typedef struct
+{
+       /** network information */
+       net_dev_info_t net_info;
+} net_eth_profile_info_t;
+
+/**
  * Specific profile information related to each technology type
  */
 typedef union
@@ -137,6 +149,8 @@ typedef union
        net_pdp_profile_info_t       Pdp;
        /** Wifi Profile Information */
        net_wifi_profile_info_t      Wlan;
+       /** Wifi Profile Information */
+       net_eth_profile_info_t       Ethernet;
 } net_specific_profile_info_t;
 
 /**
index 8641a2e..4ef63ed 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -172,8 +175,7 @@ typedef enum
  * EAP type
  * @see wlan_eap_info_t
  */
- typedef enum
-{
+typedef enum {
        /** EAP PEAP type */
        WLAN_SEC_EAP_TYPE_PEAP = 0x01,
        /** EAP TLS type */
@@ -191,8 +193,7 @@ typedef enum
  * EAP phase2 authentication type
  * @see wlan_eap_info_t
  */
-typedef enum
-{
+typedef enum {
        /** EAP phase2 authentication none */
        WLAN_SEC_EAP_AUTH_NONE = 0x01,
        /** EAP phase2 authentication PAP */
index d6c3c32..0c127ac 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -75,12 +78,10 @@ typedef enum {
 * This enum indicates background scanning mode.
 */
 typedef enum {
-       /** scan cycle : 300s */
-       WIFI_BGSCAN_MODE_DEFAULT = 0x00,
+       /** scan cycle : 4, 8, 16, ...128s */
+       WIFI_BGSCAN_MODE_EXPONENTIAL = 0x00,
        /** scan cycle : 10s */
        WIFI_BGSCAN_MODE_PERIODIC,
-       /** scan cycle : 4, 8, 16, ...128s */
-       WIFI_BGSCAN_MODE_EXPONENTIAL,
 } net_wifi_background_scan_mode_t;
 
 /**
@@ -176,6 +177,23 @@ int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_name_t *prof
 
 int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t scan_mode);
 
+/**
+ * @fn   int net_specific_scan_wifi(const char *ssid)
+ *
+ * This function sends specific scan request to NetConfig daemon,
+ * with ssid - any AP name
+ *
+ * \par Sync (or) Async:
+ * This is Asynchronous API.
+ *
+ * @param[in]    ssid  Wi-Fi AP name
+ * @param[out]   none
+ *
+ * @return       NET_ERR_NONE on success, negative values for errors
+ */
+
+int net_specific_scan_wifi(const char *ssid);
+
 /*****************************************************************************
  *     ConnMan Wi-Fi Client Interface Asynchronous Function Declaration
  *****************************************************************************/
index 202bd97..5b07c1b 100644 (file)
@@ -1,11 +1,11 @@
 #sbs-git:slp/pkgs/l/libnet-client
 
 Name:       libnet-client
-Summary:    Network (ConnMan) Client library (Shared Library)
-Version:    0.1.64
+Summary:    Network (ConnMan) Client library (Shared library)
+Version:    0.1.73_2
 Release:    1
 Group:      System/Network
-License:    Flora Software License
+License:    Flora License
 Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
@@ -14,11 +14,11 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
 
 %description
-Network (ConnMan) Client library (Shared Library)
+Network (ConnMan) Client library (Shared library)
 
 %package devel
 Summary:    Network (ConnMan) Client library (Development)
-Group:      Development/Libraries
+Group:      Development/Library
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
index 69edd89..bedab0e 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
  *     Global Structures
  *****************************************************************************/
 
-typedef struct
-{
-       char* type;
-       char* mode;
-       char* ssid;
-       char* security;
-       char* passphrase; /** TODO handle EAP */
+typedef struct {
+       char *type;
+       char *mode;
+       char *ssid;
+       char *security;
+       char *passphrase;
+       char *eap_type;
+       char *eap_auth;
+       char *identity;
+       char *password;
+       char *ca_cert_file;
+       char *client_cert_file;
+       char *private_key_file;
+       char *private_key_password;
 } net_wifi_connect_service_info_t;
 
 
@@ -75,10 +85,8 @@ typedef struct
  *     Global Functions 
  *****************************************************************************/
 int _net_dbus_scan_request(void);
-int _net_dbus_provision_service(gchar * config_str, int len);
 int _net_dbus_set_bgscan_mode(net_wifi_background_scan_mode_t mode);
 int _net_dbus_get_state(char* state);
-int _net_send_dbus_request(const char* destination, char *param_array[], DBusMessage** result);
 int _net_dbus_open_connection(const char* profile_name);
 int _net_dbus_close_connection(const char* profile_name);
 int _net_dbus_get_network_status (net_device_t device_type, net_cm_network_status_t* network_status);
@@ -87,15 +95,21 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
 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_get_tech_state_info_t* tech_state);
-DBusMessage *_net_invoke_dbus_method(const char* dest, DBusConnection *connection,
-               const char* path, char* interface_name, char* method, int *dbus_error);
+DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
+               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);
 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);
+int _net_dbus_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type);
 int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info);
 int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *profile_name);
 dbus_bool_t _net_dbus_is_pending_call_used(void);
 void _net_dbus_set_pending_call_used(dbus_bool_t used);
 DBusPendingCall *_net_dbus_get_pending_call(void);
 void _net_dbus_set_pending_call(DBusPendingCall *call);
+void _net_dbus_clear_pending_call(void);
+int _net_dbus_specific_scan_request(const char *ssid);
 
 #endif /** __NETWORK_SIGNAL_HANDLER_H_ */
index 875d0a1..09ff391 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
 
 /** ConnMan Daemon Management interface */
 
-#define CONNMAN_SERVICE                 "net.connman" 
+#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_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_MANAGER_PATH            "/" 
-#define CONNMAN_PROFILE_PATH            "/profile/default" 
+#define CONNMAN_MANAGER_PATH                   "/"
+#define CONNMAN_PATH                                   "/net/connman"
 #define CONNMAN_TECHNOLOGY_PATH                        "/net/connman/technology"
 
 /** Network related Daemon interfaces */
 
 #define NETCONFIG_SERVICE                              "net.netconfig"
 #define NETCONFIG_WIFI_INTERFACE               NETCONFIG_SERVICE ".wifi"
+#define NETCONFIG_STATISTICS_INTERFACE         NETCONFIG_SERVICE ".network_statistics"
+
 #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_PROFILE_INTERFACE            TELEPHONY_SERVCE ".context"
 #define TELEPHONY_MASTER_PATH                  "/"
 
+/** Network related Daemon Signal Filters */
+
+#define NETCONFIG_WIFI_FILTER                  "type='signal',interface='net.netconfig.wifi'"
+
+/** Network related Daemon Signals */
+
+#define NETCONFIG_SIGNAL_POWERON_COMPLETED     "PowerOnCompleted"
+#define NETCONFIG_SIGNAL_POWEROFF_COMPLETED    "PowerOffCompleted"
+#define NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE    "SpecificScanCompleted"
+
 /** ConnMan Daemon Signal Filters */
 
 #define CONNMAN_MANAGER_SIGNAL_FILTER          "type='signal',interface='net.connman.Manager'"
 #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 */
+/** ConnMan Daemon Signals */
 
 #define CONNMAN_SIGNAL_PROPERTY_CHANGED                "PropertyChanged"
 #define CONNMAN_SIGNAL_STATE_CHANGED           "StateChanged"
 #define CONNMAN_SIGNAL_SCAN_COMPLETED          "ScanCompleted"
 
+/** ConnMan technology and profile prefixes for ConnMan 0.78 */
+
+#define CONNMAN_CELLULAR_TECHNOLOGY_PREFIX             CONNMAN_PATH "/technology/cellular"
+#define CONNMAN_WIFI_TECHNOLOGY_PREFIX                 CONNMAN_PATH "/technology/wifi"
+#define CONNMAN_ETHERNET_TECHNOLOGY_PREFIX             CONNMAN_PATH "/technology/ethernet"
+
+#define CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX        CONNMAN_PATH "/service/cellular_"
+#define CONNMAN_WIFI_SERVICE_PROFILE_PREFIX            CONNMAN_PATH "/service/wifi_"
+#define CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX        CONNMAN_PATH "/service/ethernet_"
+
+
 #ifdef VITA_FEATURE
 #include <dlog.h>
 
 
 #endif /** VITA_FEATURE */
 
-#define NETWORK_CALLBACK(x,y) \
-       if (NetworkInfo.ClientEventCb != NULL) { \
-               NetworkInfo.ClientEventCb(x, y); \
-       } else { \
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! NetworkInfo.ClientEventCb is NULL\n"); \
-       }
-
 
 /*****************************************************************************
  *     Global Enums
@@ -138,6 +157,7 @@ typedef enum
        NETWORK_REQUEST_TYPE_CLOSE_CONNECTION,
        NETWORK_REQUEST_TYPE_WIFI_POWER,
        NETWORK_REQUEST_TYPE_ENROLL_WPS,
+       NETWORK_REQUEST_TYPE_SPECIFIC_SCAN,
        NETWORK_REQUEST_TYPE_MAX
 } network_async_request_type_t;
 
@@ -162,6 +182,11 @@ typedef struct {
        net_wifi_state_t wifi_state;
        net_event_cb_t ClientEventCb;
        void* user_data;
+       net_event_cb_t ClientEventCb_conn;
+       void* user_data_conn;
+       net_event_cb_t ClientEventCb_wifi;
+       void* user_data_wifi;
+       int ref_count;
 } network_info_t;
 
 typedef struct
@@ -197,6 +222,7 @@ typedef struct
  *****************************************************************************/
 net_device_t _net_get_tech_type_from_path(const char *profile_name);
 char* _net_get_string(DBusMessage* msg);
+unsigned long long _net_get_uint64(DBusMessage* msg);
 char* _net_get_object(DBusMessage* msg);
 int _net_get_boolean(DBusMessage* msg);
 int _net_get_path(DBusMessage *msg, char *profile_name);
@@ -205,12 +231,12 @@ char* _net_print_error(net_err_t error);
 int _net_open_connection_with_wifi_info(const net_wifi_connection_info_t* wifi_info);
 int _net_check_profile_name(const char* ProfileName);
 int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile_info, int* profile_count);
-int _net_mutex_init();
-void _net_mutex_destroy();
+int _net_mutex_init(void);
+void _net_mutex_destroy(void);
 void _net_client_callback(net_event_info_t *event_data);
 int _net_get_service_profile(net_service_type_t service_type, net_profile_name_t *profile_name);
 int _net_get_default_profile_info(net_profile_info_t *profile_info);
-net_wifi_state_t _net_get_wifi_state();
-void _net_clear_request_table();
+net_wifi_state_t _net_get_wifi_state(void);
+void _net_clear_request_table(void);
 
 #endif /** __NETWORK_INTERNAL_H_ */
index 7fb5a4e..417ddcc 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
index 100a0cd..e37376f 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -77,7 +80,7 @@ static int __net_get_default_profile(void *param, net_profile_info_t *active_pro
 
        net_err_t Error = NET_ERR_NONE;
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -130,38 +133,102 @@ EXPORT_API int net_register_client(net_event_cb_t event_cb, void *user_data)
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
-       
+
        if (NetworkInfo.ClientEventCb != NULL) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application Already registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_ALREADY_REGISTERED;
        }
 
-       if (_net_mutex_init() != NET_ERR_NONE) {
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+               if (_net_mutex_init() != NET_ERR_NONE) {
+                       __NETWORK_FUNC_EXIT__;
+                       return NET_ERR_UNKNOWN;
+               }
 
-       Error = _net_register_signal();
-       if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_register_signal() failed. Error [%s]\n",
-                               _net_print_error(Error));
-               _net_mutex_destroy();
-               __NETWORK_FUNC_EXIT__;
-               return Error;
+               Error = _net_register_signal();
+               if (Error != NET_ERR_NONE) {
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_register_signal() failed. Error [%s]\n",
+                                       _net_print_error(Error));
+                       _net_mutex_destroy();
+                       __NETWORK_FUNC_EXIT__;
+                       return Error;
+               }
+
+               NetworkInfo.wifi_state = _net_get_wifi_state();
+               _net_init_service_state_table();
        }
 
+       g_atomic_int_inc(&NetworkInfo.ref_count);
+
        NetworkInfo.ClientEventCb = event_cb;
        NetworkInfo.user_data = user_data;
-       NetworkInfo.wifi_state = _net_get_wifi_state();
-       _net_init_service_state_table();
 
        NETWORK_LOG(NETWORK_HIGH, "Client Register Successfully\n");
 
-       __NETWORK_FUNC_EXIT__;  
+       __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
+int net_register_client_ext(net_event_cb_t event_cb, net_device_t client_type, void *user_data)
+{
+       net_err_t Error = NET_ERR_NONE;
+
+       if (event_cb == NULL || (client_type != NET_DEVICE_DEFAULT && client_type != NET_DEVICE_WIFI)) {
+                NETWORK_LOG(NETWORK_ASSERT, "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");
+                       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");
+                       return NET_ERR_APP_ALREADY_REGISTERED;
+               }
+       default:
+               break;
+       }
+
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+               if (_net_mutex_init() != NET_ERR_NONE)
+                       return NET_ERR_UNKNOWN;
+
+               Error = _net_register_signal();
+               if (Error != NET_ERR_NONE) {
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_register_signal() failed. Error [%s]\n",
+                                       _net_print_error(Error));
+                       _net_mutex_destroy();
+                       return Error;
+               }
+
+               NetworkInfo.wifi_state = _net_get_wifi_state();
+               _net_init_service_state_table();
+       }
+
+       g_atomic_int_inc(&NetworkInfo.ref_count);
+
+       switch (client_type) {
+       case NET_DEVICE_DEFAULT:
+               NetworkInfo.ClientEventCb_conn = event_cb;
+               NetworkInfo.user_data_conn = user_data;
+               break;
+       case NET_DEVICE_WIFI:
+               NetworkInfo.ClientEventCb_wifi = event_cb;
+               NetworkInfo.user_data_wifi = user_data;
+       default:
+               break;
+       }
+
+       NETWORK_LOG(NETWORK_HIGH, "Client Register Successfully\n");
+
+       return NET_ERR_NONE;
+}
 
 /**
  * @fn  EXPORT_API int net_deregister_client(void)
@@ -178,30 +245,63 @@ EXPORT_API int net_deregister_client(void)
 {
        __NETWORK_FUNC_ENTER__;
 
-       net_err_t Error = NET_ERR_NONE;
-       
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0 ||
+           NetworkInfo.ClientEventCb == NULL) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
-       Error = _net_deregister_signal();       
-       if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to deregister signal\n");
-               __NETWORK_FUNC_EXIT__;
-               return Error;
+       if (g_atomic_int_dec_and_test(&NetworkInfo.ref_count)) {
+               _net_deregister_signal();
+               _net_mutex_destroy();
+               _net_clear_request_table();
        }
 
-       _net_mutex_destroy();
-       _net_clear_request_table();
-
        NetworkInfo.ClientEventCb = NULL;
        NetworkInfo.user_data = NULL;
-       
        NETWORK_LOG(NETWORK_HIGH, "Client De-Register Successfull\n");
-       
-       __NETWORK_FUNC_EXIT__;  
+
+       __NETWORK_FUNC_EXIT__;
+       return NET_ERR_NONE;
+}
+
+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");
+               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");
+                       return NET_ERR_APP_NOT_REGISTERED;
+               }
+               NetworkInfo.ClientEventCb_conn = NULL;
+               NetworkInfo.user_data_conn = NULL;
+               break;
+       case NET_DEVICE_WIFI:
+               if (NetworkInfo.ClientEventCb_wifi == NULL) {
+                       NETWORK_LOG(NETWORK_ERROR, "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");
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       if (g_atomic_int_dec_and_test(&NetworkInfo.ref_count)) {
+               _net_deregister_signal();
+               _net_mutex_destroy();
+               _net_clear_request_table();
+       }
+
+       NETWORK_LOG(NETWORK_HIGH, "Client De-Register Successfull\n");
        return NET_ERR_NONE;
 }
 
@@ -255,6 +355,8 @@ EXPORT_API int net_get_active_ipaddress(net_addr_t *ip_address)
                net_info = &active_profile_info.ProfileInfo.Pdp.net_info;
        else if (active_profile_info.profile_type == NET_DEVICE_WIFI)
                net_info = &active_profile_info.ProfileInfo.Wlan.net_info;
+       else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET)
+               net_info = &active_profile_info.ProfileInfo.Ethernet.net_info;
        else
                Error = NET_ERR_UNKNOWN;
 
@@ -293,6 +395,8 @@ EXPORT_API int net_get_active_netmask(net_addr_t *netmask)
                net_info = &active_profile_info.ProfileInfo.Pdp.net_info;
        else if (active_profile_info.profile_type == NET_DEVICE_WIFI)
                net_info = &active_profile_info.ProfileInfo.Wlan.net_info;
+       else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET)
+               net_info = &active_profile_info.ProfileInfo.Ethernet.net_info;
        else
                Error = NET_ERR_UNKNOWN;
 
@@ -331,6 +435,8 @@ EXPORT_API int net_get_active_gateway(net_addr_t *gateway)
                net_info = &active_profile_info.ProfileInfo.Pdp.net_info;
        else if (active_profile_info.profile_type == NET_DEVICE_WIFI)
                net_info = &active_profile_info.ProfileInfo.Wlan.net_info;
+       else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET)
+               net_info = &active_profile_info.ProfileInfo.Ethernet.net_info;
        else
                Error = NET_ERR_UNKNOWN;
 
@@ -369,6 +475,8 @@ EXPORT_API int net_get_active_dns(net_addr_t *dns)
                net_info = &active_profile_info.ProfileInfo.Pdp.net_info;
        else if (active_profile_info.profile_type == NET_DEVICE_WIFI)
                net_info = &active_profile_info.ProfileInfo.Wlan.net_info;
+       else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET)
+               net_info = &active_profile_info.ProfileInfo.Ethernet.net_info;
        else
                Error = NET_ERR_UNKNOWN;
 
@@ -406,6 +514,9 @@ 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");
                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");
+               Error = NET_ERR_NO_SERVICE;
        } else if (active_profile_info.profile_type == NET_DEVICE_WIFI) {
                wlan_info = &active_profile_info.ProfileInfo.Wlan;
                memcpy(essid->essid, wlan_info->essid, NET_WLAN_ESSID_LEN+1);
@@ -444,6 +555,8 @@ EXPORT_API int net_get_active_proxy(net_proxy_t *proxy)
                net_info = &active_profile_info.ProfileInfo.Pdp.net_info;
        else if (active_profile_info.profile_type == NET_DEVICE_WIFI)
                net_info = &active_profile_info.ProfileInfo.Wlan.net_info;
+       else if (active_profile_info.profile_type == NET_DEVICE_ETHERNET)
+               net_info = &active_profile_info.ProfileInfo.Ethernet.net_info;
        else
                Error = NET_ERR_UNKNOWN;
 
@@ -471,7 +584,7 @@ EXPORT_API int net_is_connected(void)
 
        __NETWORK_FUNC_ENTER__;
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -512,7 +625,7 @@ EXPORT_API int net_get_network_status(net_device_t device_type, net_cm_network_s
 
        __NETWORK_FUNC_ENTER__;
 
-       if(NetworkInfo.ClientEventCb == NULL)
+       if(g_atomic_int_get(&NetworkInfo.ref_count) == 0)
        {
                NETWORK_LOG( NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
@@ -531,6 +644,29 @@ EXPORT_API int net_get_network_status(net_device_t device_type, net_cm_network_s
        return NET_ERR_NONE;
 }
 
+EXPORT_API int net_get_statistics(net_device_t device_type, net_statistics_type_e statistics_type, unsigned long long *size)
+{
+       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));
+
+       return Error;
+}
+
+EXPORT_API int net_set_statistics(net_device_t device_type, net_statistics_type_e 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));
+
+       return Error;
+}
 
 /*****************************************************************************
  *     ConnMan Wi-Fi Client Interface Async Function Definition
@@ -562,18 +698,24 @@ EXPORT_API int net_open_connection_with_profile(const char *profile_name)
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was 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_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
        }
-       
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
+       }
+
        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);
@@ -622,7 +764,7 @@ EXPORT_API int net_open_connection_with_preference(net_service_type_t service_ty
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -631,7 +773,13 @@ EXPORT_API int net_open_connection_with_preference(net_service_type_t service_ty
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
                NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
        }
 
        Error = _net_get_service_profile(service_type, &profile_name);
@@ -664,6 +812,69 @@ EXPORT_API int net_open_connection_with_preference(net_service_type_t service_ty
        return NET_ERR_NONE;
 }
 
+int net_open_connection_with_preference_ext(net_service_type_t service_type, net_profile_name_t *prof_name)
+{
+       net_err_t Error = NET_ERR_NONE;
+       net_profile_name_t profile_name;
+       memset(&profile_name, 0, sizeof(net_profile_name_t));
+
+       if (service_type != NET_SERVICE_INTERNET &&
+           service_type != NET_SERVICE_MMS &&
+           service_type != NET_SERVICE_WAP) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Service Type passed\n");
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       if (prof_name == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid profile name passed\n");
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
+               return NET_ERR_APP_NOT_REGISTERED;
+       }
+
+       if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       Error = _net_get_service_profile(service_type, &profile_name);
+       if (Error != NET_ERR_NONE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! Failed to find service\n");
+               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);
+
+       if ((Error = _net_dbus_open_connection(profile_name.ProfileName)) != NET_ERR_NONE) {
+               NETWORK_LOG(NETWORK_ERROR,
+                               "Error!! 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));
+
+               return Error;
+       }
+
+       NETWORK_LOG(NETWORK_HIGH, "Connect Request Success for ProfileName[%s]\n",
+                       profile_name.ProfileName);
+
+       memcpy(prof_name, &profile_name, sizeof(net_profile_name_t));
+       return NET_ERR_NONE;
+}
+
 /**
  * @fn   EXPORT_API int net_close_connection(const char *profile_name)
  *
@@ -689,18 +900,35 @@ EXPORT_API int net_close_connection(const char *profile_name)
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was 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_ASSERT, "Error!!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
        }
-       
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
+                       _net_dbus_clear_pending_call();
+                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                                                       0, sizeof(network_request_table_t));
+
+               } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE) {
+                       _net_dbus_clear_pending_call();
+                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS],
+                                                       0, sizeof(network_request_table_t));
+               } else {
+                       NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+                       __NETWORK_FUNC_EXIT__;
+                       return NET_ERR_IN_PROGRESS;
+               }
+       }
+
        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);
index c66e2a7..ff7eb90 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -352,32 +355,30 @@ static void __net_wifi_power_reply(DBusPendingCall *call, void *user_data)
 {
        __NETWORK_FUNC_ENTER__;
 
+       NETWORK_LOG(NETWORK_LOW, "__net_wifi_power_reply() called\n");
+
        DBusMessage *reply = dbus_pending_call_steal_reply(call);
        net_err_t Error = _net_get_error_from_netconfig_message(reply);
-
-       if (Error == NET_ERR_NONE)
-               goto done;
-
        net_event_info_t event_data = {0,};
-       net_wifi_state_t wifi_state = WIFI_UNKNOWN;
 
-       NETWORK_LOG(NETWORK_ERROR,
-               "Error!!! Wifi Power on/off failed. Error code : [%d]\n", Error);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Wifi Power on/off failed. Error code : [%d]\n", Error);
 
        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;
-               event_data.Error = Error;
-               event_data.Datalength = sizeof(net_wifi_state_t);
-               event_data.Data = &wifi_state;
                NETWORK_LOG(NETWORK_LOW,
-                       "Sending NET_EVENT_WIFI_POWER_RSP Error = %d\n", event_data.Error);
+                       "Sending NET_EVENT_WIFI_POWER_RSP wifi state : %d Error = %d\n",
+                       NetworkInfo.wifi_state, Error);
+
+               event_data.Datalength = sizeof(net_wifi_state_t);
+               event_data.Data = &(NetworkInfo.wifi_state);
+               event_data.Error = Error;
                _net_client_callback(&event_data);
        }
 
-done:
        dbus_message_unref(reply);
        dbus_pending_call_unref(call);
 
@@ -387,217 +388,190 @@ done:
        __NETWORK_FUNC_EXIT__;
 }
 
-static int __net_append_argument(DBusMessageIter *iter, int ArgType, const char *Value)
+static void __net_specific_scan_wifi_reply(DBusPendingCall *call, void *user_data)
 {
        __NETWORK_FUNC_ENTER__;
 
-       double Double = 0;
-       unsigned char ByteValue = 0;
-       dbus_bool_t booleanvalue = 0;
-
-       dbus_uint16_t Uint16 = 0;
-       dbus_int16_t Int16 = 0;
-       dbus_uint32_t Uint32 = 0;
-       dbus_int32_t Int32 = 0;
+       DBusMessage *reply = dbus_pending_call_steal_reply(call);
+       net_err_t Error = _net_get_error_from_netconfig_message(reply);
 
-       switch(ArgType) {
-       case DBUS_TYPE_BYTE:
-               ByteValue = strtoul(Value, NULL, 0);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &ByteValue);
-               break;
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Find hidden AP failed. Error code : [%d]\n", Error);
+       else
+               NETWORK_LOG(NETWORK_LOW, "Hidden AP response received for AP.\n");
+
+       if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
+               net_event_info_t event_data = {0,};
+               if (NET_ERR_NONE != Error) {
+                       /* An error occured. 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);
 
-       case DBUS_TYPE_DOUBLE:
-               Double = strtod(Value, NULL);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_DOUBLE, &Double);
-               break;
+               event_data.Datalength = sizeof(net_wifi_state_t);
+               event_data.Data = &(NetworkInfo.wifi_state);
+               event_data.Error = Error;
+               _net_client_callback(&event_data);
+       }
 
-       case DBUS_TYPE_INT16:
-               Int16 = strtol(Value, NULL, 0);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &Int16);
-               break;
+       dbus_message_unref(reply);
+       dbus_pending_call_unref(call);
 
-       case DBUS_TYPE_UINT16:
-               Uint16 = strtoul(Value, NULL, 0);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &Uint16);
-               break;
+       network_dbus_pending_call_data.is_used = FALSE;
+       network_dbus_pending_call_data.pcall = NULL;
 
-       case DBUS_TYPE_INT32:
-               Int32 = strtol(Value, NULL, 0);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &Int32);
-               break;
+       __NETWORK_FUNC_EXIT__;
+}
 
-       case DBUS_TYPE_UINT32:
-               Uint32 = strtoul(Value, NULL, 0);
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &Uint32);
-               break;
+static char *__net_make_group_name(const char *ssid, const char *net_mode, const char *sec)
+{
+       char *buf;
+       const char *g_sec;
+       char buf_tmp[32] = {0,};
+       int i;
+       int ssid_len;
 
-       case DBUS_TYPE_STRING:
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &Value);
-               break;
+       if (ssid == NULL || net_mode == NULL || sec == NULL)
+               return NULL;
 
-       case DBUS_TYPE_OBJECT_PATH:
-               dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &Value);
-               break;
+       ssid_len = strlen(ssid);
+       if (ssid_len < 1)
+               return NULL;
 
-       case DBUS_TYPE_BOOLEAN:
-               if( strcmp (Value, "true") == 0 ) {
-                       booleanvalue = TRUE;
-                       dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &booleanvalue);
-               } else if( strcmp (Value, "false") == 0 ) {
-                       booleanvalue = FALSE;
-                       dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &booleanvalue);
-               } else {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Expected \"true\" or \"false\" instead of \"%s\"\n", Value);
-                       __NETWORK_FUNC_EXIT__;
-                       return NET_ERR_UNKNOWN;
-               }
-               break;
+       if (g_strcmp0(net_mode, "managed") != 0)
+               return NULL;
 
-       default:
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! Unsupported data ArgType %c\n", (char) ArgType);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
+       if (!g_strcmp0(sec, "wpa") || !g_strcmp0(sec, "rsn"))
+               g_sec = "psk";
+       else
+               g_sec = sec;
 
-       __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
-}
+       buf = g_try_malloc0((ssid_len * 2) + strlen(net_mode) + strlen(sec) + 3);
+       if (buf == NULL)
+               return NULL;
 
-static int __net_append_array(DBusMessageIter *iter, int ArgType, const char *Value)
-{
-       __NETWORK_FUNC_ENTER__;
+       for (i = 0; i < ssid_len; i++) {
+               snprintf(buf_tmp, 3, "%02x", ssid[i]);
+               strcat(buf, buf_tmp);
+       }
 
-       const char *Val = NULL;
-       char *saveptr = NULL;
-       char *DupValue = strdup(Value);
+       snprintf(buf_tmp, 32, "_%s_%s", net_mode, g_sec);
+       strcat(buf, buf_tmp);
 
-       Val = strtok_r(DupValue, ",", &saveptr);
-       while(Val != NULL) {
-               if( __net_append_argument(iter, ArgType, Val) != NET_ERR_NONE ) {
-                       NET_MEMFREE(DupValue);
-                       __NETWORK_FUNC_EXIT__;
-                       return  NET_ERR_UNKNOWN;
-               }
-               Val = strtok_r(NULL, ",", &saveptr);
-       }
-       NET_MEMFREE(DupValue);
+       NETWORK_LOG(NETWORK_HIGH, "Group name : %s\n", buf);
 
-       __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
+       return buf;
 }
 
-static int __net_append_dict(DBusMessageIter *iter, int KeyType, int ValueType, const char *Value)
+static int __net_append_param(DBusMessage *message, char *param_array[])
 {
-       __NETWORK_FUNC_ENTER__;
+       int count = 0;
+       dbus_uint32_t uint32 = 0;
+       DBusMessageIter iter;
+       DBusMessageIter container_iter;
+       char *args = NULL;
+       char *ch = NULL;
 
-       const char *Val = NULL;
-       char *saveptr = NULL;
-       char *DupValue = strdup(Value);
+       if (param_array == NULL)
+               return NET_ERR_NONE;
 
-       Val = strtok_r(DupValue, ",", &saveptr);
-       while(Val != NULL) {
-               DBusMessageIter SubIter;
+       dbus_message_iter_init_append(message, &iter);
 
-               dbus_message_iter_open_container(iter,
-                               DBUS_TYPE_DICT_ENTRY,
-                               NULL,
-                               &SubIter);
+       while (param_array[count] != NULL) {
+               args = param_array[count];
+               NETWORK_LOG(NETWORK_HIGH, "parameter %d - [%s]", count, param_array[count]);
 
-               if( __net_append_argument (&SubIter, KeyType, Val) != NET_ERR_NONE ) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_argument() failed\n");
-                       NET_MEMFREE(DupValue);
-                       __NETWORK_FUNC_EXIT__;
-                       return  NET_ERR_UNKNOWN;
-               }
-
-               Val = strtok_r(NULL, ",", &saveptr);
-               if(Val == NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Crashed dictionary data\n");
-                       NET_MEMFREE(DupValue);
-                       __NETWORK_FUNC_EXIT__;
-                       return NET_ERR_UNKNOWN;
+               ch = strchr(args, ':');
+               if (ch == NULL) {
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter[\"%s\"]\n", args);
+                       return NET_ERR_INVALID_PARAM;
                }
+               *ch = 0; ch++;
+
+               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) {
+                       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);
+                               return NET_ERR_INVALID_PARAM;
+                       }
+                       *ch = 0; ch++;
 
-               if( __net_append_argument (&SubIter, ValueType, Val) != NET_ERR_NONE ) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_argument() failed\n");
-                       NET_MEMFREE(DupValue);
-                       __NETWORK_FUNC_EXIT__;
-                       return  NET_ERR_UNKNOWN;
+                       if (strcmp(args, CONNMAN_CLIENT_DBUS_TYPE_STRING) == 0) {
+                               dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+                                               DBUS_TYPE_STRING_AS_STRING, &container_iter);
+                               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);
+                               return NET_ERR_INVALID_PARAM;
+                       }
+               } else {
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Not supported data format[\"%s\"]\n", args);
+                       return NET_ERR_INVALID_PARAM;
                }
 
-               dbus_message_iter_close_container (iter, &SubIter);
-               Val = strtok_r(NULL, ",", &saveptr);
+               count++;
        }
-       NET_MEMFREE(DupValue);
-       __NETWORK_FUNC_EXIT__;
-       return  NET_ERR_NONE;
-}
 
-static int __net_datatype_from_stringname(const char *Args)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       int ArgType = 0;
-
-       if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_STRING) )
-               ArgType = DBUS_TYPE_STRING;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_INT16) )
-               ArgType = DBUS_TYPE_INT16;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_UINT16) )
-               ArgType = DBUS_TYPE_UINT16;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_INT32) )
-               ArgType = DBUS_TYPE_INT32;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_UINT32) )
-               ArgType = DBUS_TYPE_UINT32;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_INT64) )
-               ArgType = DBUS_TYPE_INT64;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_UINT64) )
-               ArgType = DBUS_TYPE_UINT64;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_DOUBLE) )
-               ArgType = DBUS_TYPE_DOUBLE;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_BYTE) )
-               ArgType = DBUS_TYPE_BYTE;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_BOOLEAN) )
-               ArgType = DBUS_TYPE_BOOLEAN;
-       else if( !strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_OBJECT_PATH) )
-               ArgType = DBUS_TYPE_OBJECT_PATH;
-       else {
-               NETWORK_LOG( NETWORK_ERROR, "Error!!! Unknown Argument Type \"%s\"\n", Args);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       __NETWORK_FUNC_EXIT__;
-       return ArgType;
+       return NET_ERR_NONE;
 }
-  
 /*****************************************************************************
  *     Global Functions Definition
  *****************************************************************************/
 
-DBusMessage *_net_invoke_dbus_method(const char* dest, DBusConnection *connection,
-               const char* path, char* interface_name, char* method, int *dbus_error)
+DBusMessage *_net_invoke_dbus_method(const char* dest, const char* path,
+               char* interface_name, char* method, char *param_array[], int *dbus_error)
 {
        __NETWORK_FUNC_ENTER__;
 
        DBusError error;
+       DBusConnection* conn = NULL;
        DBusMessage *reply = NULL;
        DBusMessage *message = NULL;
 
        *dbus_error = NET_ERR_NONE;
 
+       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_EXCEPTION, "Error!!! Can't get on 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");
+               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");
+               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(connection,
-                       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,
@@ -611,39 +585,51 @@ DBusMessage *_net_invoke_dbus_method(const char* dest, DBusConnection *connectio
                }
 
                dbus_message_unref(message);
+               dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NULL;
        }
 
        dbus_message_unref(message);
+       dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
        return reply;
 }
 
-int _net_invoke_dbus_method_nonblock(const char* dest, DBusConnection *connection,
-               const char* path, char* interface_name, char* method,
-               DBusPendingCallNotifyFunction notify_func)
+int _net_invoke_dbus_method_nonblock(const char* dest, const char* path,
+               char* interface_name, char* method, DBusPendingCallNotifyFunction notify_func)
 {
        __NETWORK_FUNC_ENTER__;
 
+       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);
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (conn == NULL) {
+               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on 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");
+               dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       result = dbus_connection_send_with_reply(connection,
-                       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");
                dbus_message_unref(message);
+               dbus_connection_unref(conn);
                return NET_ERR_UNKNOWN;
        }
 
@@ -652,401 +638,92 @@ int _net_invoke_dbus_method_nonblock(const char* dest, DBusConnection *connectio
        network_dbus_pending_call_data.is_used = TRUE;
 
        dbus_message_unref(message);
+       dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
-
-int _net_send_dbus_request(const char* destination, char *param_array[], DBusMessage** result)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       DBusConnection *connection = NULL;
-       DBusError error;
-       DBusMessage *message = NULL;
-       net_err_t Error = NET_ERR_NONE;
-       char *RequestMethod = NULL;
-       int i = 0;
-       const char *path = NULL;
-       const char *name = NULL;
-       int param_count = 0;
-       // const char *destination = CONNMAN_SERVICE;
-       DBusMessageIter iter;
-
-       for (param_count = 0; param_array[param_count] != NULL; param_count++) {
-               NETWORK_LOG(NETWORK_HIGH, "[%s]\n", param_array[param_count]);
-       }
-       NETWORK_LOG(NETWORK_HIGH, "Total Arguments [%d]\n", param_count);
-
-       path = param_array[i++]; /** 0th is path */
-       name = param_array[i++]; /** 1st is request name */
-
-       if ((strlen(path) == 0) || (strlen(name) == 0) ) {
-               NETWORK_LOG(NETWORK_ASSERT, "Error!!! Invalid parameters passed path [%s], requested name [%s]\n",
-                               path, name);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_PARAM;
-       }
-
-       dbus_error_init(&error);
-
-       connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-       if (connection == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Failed to get system dbus, error [%s]\n",
-                               error.message);
-               dbus_error_free(&error);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       RequestMethod = strrchr(name, '.');
-       if (RequestMethod == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid method in \"%s\"\n", name);
-               dbus_connection_unref(connection);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       *RequestMethod = '\0';
-       message = dbus_message_new_method_call(NULL, path, name, RequestMethod + 1);
-
-       if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
-               __NETWORK_FUNC_EXIT__;
-               Error = NET_ERR_UNKNOWN;
-               goto end_error;
-       }
-
-       if (destination && !dbus_message_set_destination(message, destination)) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! dbus_message_set_destination() failed\n");
-               __NETWORK_FUNC_EXIT__;
-               Error = NET_ERR_UNKNOWN;
-               goto end_error;
-       }
-
-       dbus_message_iter_init_append(message, &iter);
-
-       /** Two arguments name and path already extracted, so i == 2 */
-       while (i < param_count) {
-               char *Args = NULL;
-               char *Ch = NULL;
-               int ArgType = 0;
-               int SecondaryType = 0;
-               int ContainerType = 0;
-               DBusMessageIter *TargetIter = NULL;
-               DBusMessageIter ContainerIter;
-
-               ArgType = DBUS_TYPE_INVALID;
-               Args = param_array[i++];
-               Ch = strchr (Args, ':');
-
-               if (Ch == NULL) {
-                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid data format[\"%s\"]\n", Args);
-                       Error = NET_ERR_UNKNOWN;
-                       goto end_error;
-               }
-
-               *(Ch++) = 0;
-
-               if (strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_VARIANT) == 0) {
-                       ContainerType = DBUS_TYPE_VARIANT;
-               } else if (strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_ARRAY) == 0) {
-                       ContainerType = DBUS_TYPE_ARRAY;
-               } else if (strcmp(Args, CONNMAN_CLIENT_DBUS_TYPE_DICT_ENTRY) == 0) {
-                       ContainerType = DBUS_TYPE_DICT_ENTRY;
-               } else {
-                       ContainerType = DBUS_TYPE_INVALID;
-               }
-
-               if (ContainerType != DBUS_TYPE_INVALID) {
-                       Args = Ch;
-                       Ch = strchr(Args, ':');
-                       if (Ch == NULL) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid data format[\"%s\"]\n", Args);
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-                       *(Ch++) = 0;
-               }
-
-               if (Args[0] == 0) {
-                       ArgType = DBUS_TYPE_STRING;
-               } else {
-                       ArgType = __net_datatype_from_stringname(Args);
-                       if (ArgType == NET_ERR_UNKNOWN) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Unknown data type\n");
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-               }
-
-               if (ContainerType == DBUS_TYPE_DICT_ENTRY) {
-                       char Signature[5] = "";
-                       Args = Ch;
-                       Ch = strchr (Ch, ':');
-
-                       if (Ch == NULL) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid data format[\"%s\"]\n", Args);
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-
-                       *(Ch++) = 0;
-                       SecondaryType = __net_datatype_from_stringname(Args);
-
-                       if (SecondaryType == NET_ERR_UNKNOWN) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! Unknown datatype\n");
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-
-                       Signature[0] = DBUS_DICT_ENTRY_BEGIN_CHAR;
-                       Signature[1] = ArgType;
-                       Signature[2] = SecondaryType;
-                       Signature[3] = DBUS_DICT_ENTRY_END_CHAR;
-                       Signature[4] = '\0';
-
-                       dbus_message_iter_open_container(&iter,
-                                       DBUS_TYPE_ARRAY,
-                                       Signature,
-                                       &ContainerIter);
-                       TargetIter = &ContainerIter;
-               } else if (ContainerType != DBUS_TYPE_INVALID) {
-                       char Signature[2] = "";
-                       Signature[0] = ArgType;
-                       Signature[1] = '\0';
-
-                       dbus_message_iter_open_container(&iter,
-                                       ContainerType,
-                                       Signature,
-                                       &ContainerIter);
-                       TargetIter = &ContainerIter;
-               } else {
-                       TargetIter = &iter;
-               }
-
-               if (ContainerType == DBUS_TYPE_ARRAY) {
-                       if (__net_append_array(TargetIter, ArgType, Ch) != NET_ERR_NONE) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_array() failed\n");
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-               } else if (ContainerType == DBUS_TYPE_DICT_ENTRY) {
-                       if (__net_append_dict(TargetIter, ArgType, SecondaryType, Ch) != NET_ERR_NONE) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_dict() failed\n");
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-               } else {
-                       if (__net_append_argument(TargetIter, ArgType, Ch) != NET_ERR_NONE) {
-                               NETWORK_LOG(NETWORK_ERROR, "Error!!! __net_append_argument() failed\n");
-                               Error = NET_ERR_UNKNOWN;
-                               goto end_error;
-                       }
-               }
-
-               if (ContainerType != DBUS_TYPE_INVALID) {
-                       dbus_message_iter_close_container(&iter, &ContainerIter);
-               }
-       }
-
-       DBusMessage *reply = NULL;
-
-       dbus_error_init (&error);
-
-       reply = dbus_connection_send_with_reply_and_block(connection,
-                       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, Error[%s: %s]\n",
-                                       error.name,
-                                       error.message);
-                       Error = __net_error_string_to_enum(error.name);
-                       dbus_error_free(&error);
-               } else
-                       Error = NET_ERR_UNKNOWN;
-
-               goto end_error;
-       } else {
-               if (result != NULL) {
-                       *result = reply;
-               } else {
-                       dbus_message_unref(reply);
-               }
-       }
-
-end_error:
-       dbus_message_unref(message);
-       dbus_connection_unref(connection);
-
-       if (Error == NET_ERR_NONE)
-               NETWORK_LOG(NETWORK_HIGH, "Successfully requested\n");
-
-       __NETWORK_FUNC_EXIT__;
-       return Error;
-}
-
-
 int _net_dbus_open_connection(const char* profile_name)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
-
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
 
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-                       profile_name, CONNMAN_SERVICE_INTERFACE ".Connect");
-
-       Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE, conn, profile_name,
+       Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE, profile_name,
                        CONNMAN_SERVICE_INTERFACE, "Connect", __net_open_connection_reply);
 
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
 int _net_dbus_close_connection(const char* profile_name)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
-
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
 
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-                       profile_name, CONNMAN_SERVICE_INTERFACE ".Disconnect");
-
-       Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE, conn, profile_name,
+       Error = _net_invoke_dbus_method_nonblock(CONNMAN_SERVICE, profile_name,
                        CONNMAN_SERVICE_INTERFACE, "Disconnect", __net_close_connection_reply);
 
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
-int _net_dbus_scan_request(void)
-{
-       __NETWORK_FUNC_ENTER__;
-
-       net_err_t Error = NET_ERR_NONE;
-
-       /** dbus-send --system --print-reply --dest=net.connman / net.connman.Manager.RequestScan string:wifi */
-       char request[] = CONNMAN_MANAGER_INTERFACE ".RequestScan";
-       char param1[] = "string:wifi";
-       char path[CONNMAN_MAX_BUFLEN] = "/";
-       char* param_array[] = {NULL, NULL, NULL, NULL};
-       param_array[0] = path;
-       param_array[1] = request;
-       param_array[2] = param1;
-
-       NETWORK_LOG(NETWORK_HIGH, "path [%s]\n", path);
-       NETWORK_LOG(NETWORK_HIGH, "Requesting [%s %s %s]\n", param_array[0], param_array[1], param_array[2]);
-
-       if( (Error = _net_send_dbus_request(CONNMAN_SERVICE, param_array, NULL)) != NET_ERR_NONE ) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_send_dbus_request failed\n");
-               __NETWORK_FUNC_EXIT__;
-               return Error;
-       }
-
-       __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
-}
-
-int _net_dbus_provision_service(gchar * config_str, int len)
+int _net_dbus_scan_request(void)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
+       DBusMessage *message = NULL;
 
-       /** dbus-send --system --print-reply --dest=net.connman / net.connman.Manager.ProvisionService string:xxx..*/
-       char request[] = CONNMAN_MANAGER_INTERFACE ".ProvisionService";
-       char *param1 = NULL;
-       int param1_len = len + strlen("string:");
+       char param1[] = "string:wifi";
        char path[CONNMAN_MAX_BUFLEN] = "/";
-       char* param_array[] = {NULL, NULL, NULL, NULL};
+       char* param_array[] = {NULL, NULL};
 
-       param1 = (char*)calloc(param1_len, sizeof(char));
-       if(param1 == NULL)
-               return NET_ERR_UNKNOWN;
+       param_array[0] = param1;
 
-       snprintf(param1, param1_len, "string:%s", config_str);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, path,
+                       CONNMAN_MANAGER_INTERFACE, "RequestScan", param_array, &Error);
 
-       param_array[0] = path;
-       param_array[1] = request;
-       param_array[2] = param1;
+       if (Error == NET_ERR_IN_PROGRESS)
+               Error = NET_ERR_NONE;
 
-       if( (Error = _net_send_dbus_request(CONNMAN_SERVICE, param_array, NULL)) != NET_ERR_NONE ) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_send_dbus_request failed\n");
-               NET_MEMFREE(param1);
-               __NETWORK_FUNC_EXIT__;
-               return Error;
-       }
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method failed\n");
+
+       if (message)
+               dbus_message_unref(message);
 
-       NET_MEMFREE(param1);
        __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
+       return Error;
 }
 
-
 int _net_dbus_set_bgscan_mode(net_wifi_background_scan_mode_t mode)
 {
        __NETWORK_FUNC_ENTER__;
 
-       /** TODO device interface missing */
-
        net_err_t Error = NET_ERR_NONE;
-       /** dbus-send --system --print-reply --dest=net.connman / net.connman.Manager.SetProperty string:ScanMode variant:uint16:0/1/2 */
-       char request[] = NETCONFIG_WIFI_INTERFACE ".SetBgscan";
+       DBusMessage *message = NULL;
+
        char param1[64] = "";
        char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH;
-       char* param_array[] = {NULL, NULL, NULL, NULL};
-
-       NETWORK_LOG(NETWORK_HIGH, "path [%s]\n", path);
+       char* param_array[] = {NULL, NULL};
 
        snprintf(param1, 64, "uint32:%d", mode);
-       
-       param_array[0] = path;
-       param_array[1] = request;
-       param_array[2] = param1;
+       param_array[0] = param1;
 
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s %s]\n",
-               param_array[0],
-               param_array[1],
-               param_array[2]
-               );
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path,
+                       NETCONFIG_WIFI_INTERFACE, "SetBgscan", param_array, &Error);
 
-       Error = _net_send_dbus_request(NETCONFIG_SERVICE, param_array, NULL);
-       if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! Request failed\n");
-               __NETWORK_FUNC_EXIT__;
-               return Error;
-       }
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_invoke_dbus_method failed\n");
+
+       if (message)
+               dbus_message_unref(message);
 
        __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
+       return Error;
 }
 
 int _net_dbus_get_technology_state(network_get_tech_state_info_t* tech_state)
@@ -1054,7 +731,6 @@ int _net_dbus_get_technology_state(network_get_tech_state_info_t* tech_state)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
 
        if ((tech_state == NULL) || (strlen(tech_state->technology) == 0)) {
@@ -1063,14 +739,6 @@ int _net_dbus_get_technology_state(network_get_tech_state_info_t* tech_state)
                return NET_ERR_INVALID_PARAM;
        }
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION,
-                               "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
        if (strcmp(tech_state->technology, "wifi") == 0) {
                int hotspot_state = 0;
                vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
@@ -1079,12 +747,11 @@ int _net_dbus_get_technology_state(network_get_tech_state_info_t* tech_state)
                        goto done;
        }
 
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, CONNMAN_MANAGER_PATH,
-                       CONNMAN_MANAGER_INTERFACE, "GetProperties", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
+                       CONNMAN_MANAGER_INTERFACE, "GetProperties", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get technology info\n");
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get technology info\n");
                goto done;
        }
 
@@ -1105,12 +772,10 @@ int _net_dbus_get_technology_state(network_get_tech_state_info_t* tech_state)
        dbus_message_unref(message);
 
 done:
-       dbus_connection_unref(conn);
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
 int _net_dbus_get_network_status(net_device_t device_type, net_cm_network_status_t* network_status)
 {
        __NETWORK_FUNC_ENTER__;
@@ -1145,31 +810,125 @@ done:
        return Error;
 }
 
+int _net_dbus_get_statistics(net_device_t device_type, net_statistics_type_e statistics_type, unsigned long long *size)
+{
+       net_err_t Error = NET_ERR_NONE;
+       DBusMessage *message = NULL;
+       char *method = NULL;
+
+       if (device_type == NET_DEVICE_WIFI) {
+               switch (statistics_type) {
+               case NET_STATISTICS_TYPE_LAST_RECEIVED_DATA:
+                       method = "GetWifiLastRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_LAST_SENT_DATA:
+                       method = "GetWifiLastTxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
+                       method = "GetWifiTotalRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_SENT_DATA:
+                       method = "GetWifiTotalTxBytes";
+                       break;
+               default:
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       return NET_ERR_INVALID_PARAM;
+               }
+       } else {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       message = _net_invoke_dbus_method(
+                       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");
+               return Error;
+       }
+
+       *size = _net_get_uint64(message);
+
+       NETWORK_LOG(NETWORK_HIGH, "success [%s] statistics size : [%llu]\n", method, *size);
+       dbus_message_unref(message);
+
+       return Error;
+}
+
+int _net_dbus_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type)
+{
+       net_err_t Error = NET_ERR_NONE;
+       DBusMessage *message = NULL;
+       char *method = NULL;
+
+       if (device_type == NET_DEVICE_CELLULAR) {
+               switch (statistics_type) {
+               case NET_STATISTICS_TYPE_LAST_RECEIVED_DATA:
+                       method = "ResetCellularLastRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_LAST_SENT_DATA:
+                       method = "ResetCellularLastTxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
+                       method = "ResetCellularTotalRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_SENT_DATA:
+                       method = "ResetCellularTotalTxBytes";
+                       break;
+               default:
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       return NET_ERR_INVALID_PARAM;
+               }
+       } else if (device_type == NET_DEVICE_WIFI) {
+               switch (statistics_type) {
+               case NET_STATISTICS_TYPE_LAST_RECEIVED_DATA:
+                       method = "ResetWifiLastRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_LAST_SENT_DATA:
+                       method = "ResetWifiLastTxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
+                       method = "ResetWifiTotalRxBytes";
+                       break;
+               case NET_STATISTICS_TYPE_TOTAL_SENT_DATA:
+                       method = "ResetWifiTotalTxBytes";
+                       break;
+               default:
+                       NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+                       return NET_ERR_INVALID_PARAM;
+               }
+       } else {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid ProfileName passed\n");
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       message = _net_invoke_dbus_method(
+                       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");
+               return Error;
+       }
+
+       NETWORK_LOG(NETWORK_HIGH, "reset [%s] statistics success\n", method);
+       dbus_message_unref(message);
+
+       return Error;
+}
 
 int _net_dbus_get_state(char* state)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
        char *net_state = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION,
-                               "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
        message = _net_invoke_dbus_method(
-                       CONNMAN_SERVICE, conn, CONNMAN_MANAGER_PATH,
-                       CONNMAN_MANAGER_INTERFACE, "GetState", &Error);
+                       CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
+                       CONNMAN_MANAGER_INTERFACE, "GetState", NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get service properties\n");
-               dbus_connection_unref(conn);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service properties\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -1180,119 +939,205 @@ int _net_dbus_get_state(char* state)
        NETWORK_LOG( NETWORK_HIGH, "State : [%s]\n", state);
 
        dbus_message_unref(message);
-       dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
 
-
-int _net_dbus_connect_service(const net_wifi_connect_service_info_t* wifi_connection_info)
+int _net_dbus_connect_service(const net_wifi_connect_service_info_t *wifi_connection_info)
 {
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusError error;
 
        const char *prop_type = "Type";
        const char *prop_mode = "Mode";
        const char *prop_ssid = "SSID";
        const char *prop_security = "Security";
        const char *prop_passphrase = "Passphrase";
-
-       DBusMessage* msg = NULL;
-       DBusMessage* reply = NULL;
-       DBusMessageIter dict, entry, array,value;
+       const char *prop_eap_type = "EAPType";
+       const char *prop_eap_auth = "EAPAuth";
+       const char *prop_identity = "Identity";
+       const char *prop_password = "Password";
+       const char *prop_ca_cert_file = "CACert";
+       const char *prop_client_cert_file = "ClientCert";
+       const char *prop_private_key_file = "PrivateKeyFile";
+       const char *prop_private_key_password = "PrivateKeyPassword";
+
+       DBusMessage* message = NULL;
+       DBusMessageIter dict, entry, array, value;
        DBusConnection* conn = NULL;
+       DBusPendingCall *call;
+       dbus_bool_t result;
+       char *group_name = NULL;
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
-       if(conn == NULL) {
+       if (conn == NULL) {
                NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       msg = dbus_message_new_method_call(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "ConnectService");
-       if(msg == NULL) {
+       message = dbus_message_new_method_call(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "ConnectService");
+
+       if (message == NULL) {
                NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! dbus_message_new_method_call() failed\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       dbus_message_iter_init_append(msg, &array);
+       dbus_message_iter_init_append(message, &array);
        dbus_message_iter_open_container(&array, DBUS_TYPE_ARRAY, "{sv}", &dict);
 
-       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
-       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_type);
-       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
-       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->type);
-       dbus_message_iter_close_container(&entry, &value);
-       dbus_message_iter_close_container(&dict, &entry);
-
-       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
-       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_mode);
-       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
-       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->mode);
-       dbus_message_iter_close_container(&entry, &value);
-       dbus_message_iter_close_container(&dict, &entry);
-
-       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
-       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_ssid);
-       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
-       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->ssid);
-       dbus_message_iter_close_container(&entry, &value);
-       dbus_message_iter_close_container(&dict, &entry);
-
-       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
-       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_security);
-       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
-       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->security);
-       dbus_message_iter_close_container(&entry, &value);
-       dbus_message_iter_close_container(&dict, &entry);
-
-       if( strcmp(wifi_connection_info->security, "ieee8021x") == 0 ) {
-               /** TODO Handle EAP */
-       } else {
-               /** none, wep, psk, rsn */
+       if (wifi_connection_info->type != NULL) {
                dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
-               dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_passphrase);
+               dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_type);
                dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
-               dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->passphrase);
+               dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->type);
                dbus_message_iter_close_container(&entry, &value);
                dbus_message_iter_close_container(&dict, &entry);
        }
 
-       dbus_message_iter_close_container(&array, &dict);
+       if (wifi_connection_info->mode != NULL) {
+               dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+               dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_mode);
+               dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+               dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->mode);
+               dbus_message_iter_close_container(&entry, &value);
+               dbus_message_iter_close_container(&dict, &entry);
+       }
 
-       dbus_error_init(&error);
-       reply = dbus_connection_send_with_reply_and_block(conn,
-                       msg,
-                       6 * DBUS_REPLY_TIMEOUT, /** Special case - here profile is created and returned so this need more time */
-                       &error);
+       if (wifi_connection_info->ssid != NULL) {
+               dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+               dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_ssid);
+               dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+               dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->ssid);
+               dbus_message_iter_close_container(&entry, &value);
+               dbus_message_iter_close_container(&dict, &entry);
+       }
 
-       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);
-                       Error = __net_error_string_to_enum(error.name);
-                       dbus_error_free(&error);
-                       dbus_message_unref(msg);
-                       __NETWORK_FUNC_EXIT__;
-                       return Error;
+       if (wifi_connection_info->security != NULL) {
+               dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+               dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_security);
+               dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+               dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->security);
+               dbus_message_iter_close_container(&entry, &value);
+               dbus_message_iter_close_container(&dict, &entry);
+       }
+
+       if (g_str_equal(wifi_connection_info->security, "ieee8021x") == TRUE) {
+               /** EAP */
+               if (wifi_connection_info->eap_type != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_eap_type);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->eap_type);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->eap_auth != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_eap_auth);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->eap_auth);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->identity != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_identity);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->identity);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
                }
-               dbus_message_unref(msg);
+
+               if (wifi_connection_info->password != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_password);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->password);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->ca_cert_file != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_ca_cert_file);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->ca_cert_file);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->client_cert_file != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_client_cert_file);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->client_cert_file);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->private_key_file != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_private_key_file);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->private_key_file);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+
+               if (wifi_connection_info->private_key_password != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_private_key_password);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->private_key_password);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+       } else {
+               /** none, wep, psk, rsn */
+               if (wifi_connection_info->passphrase != NULL) {
+                       dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, 0, &entry);
+                       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &prop_passphrase);
+                       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value);
+                       dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &wifi_connection_info->passphrase);
+                       dbus_message_iter_close_container(&entry, &value);
+                       dbus_message_iter_close_container(&dict, &entry);
+               }
+       }
+
+       dbus_message_iter_close_container(&array, &dict);
+
+       group_name = __net_make_group_name(wifi_connection_info->ssid,
+                               wifi_connection_info->mode, wifi_connection_info->security);
+       if (group_name == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! can't make a group name\n");
+               dbus_message_unref(message);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
-       } else {
-               char *ProfileName = NULL;
-               ProfileName = _net_get_object(reply);
-               NETWORK_LOG(NETWORK_HIGH, "ObjectPath/ProfileName [%s]\n", ProfileName);
        }
 
-       dbus_message_unref(reply);
-       dbus_message_unref(msg);
+       snprintf(request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].ProfileName,
+                                       NET_PROFILE_NAME_LEN_MAX+1, "%s", group_name);
+
+       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");
+               dbus_message_unref(message);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
+       dbus_pending_call_set_notify(call, __net_open_connection_reply, NULL, NULL);
+       network_dbus_pending_call_data.pcall = call;
+       network_dbus_pending_call_data.is_used = TRUE;
+
+       dbus_message_unref(message);
 
        NETWORK_LOG(NETWORK_HIGH, "Successfully configured\n");
 
@@ -1301,7 +1146,6 @@ int _net_dbus_connect_service(const net_wifi_connect_service_info_t* wifi_connec
        return Error;
 }
 
-
 int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name)
 {
        __NETWORK_FUNC_ENTER__;
@@ -1326,7 +1170,7 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        char *netmask = netmask_buffer;
        char *gateway = gateway_buffer; 
 
-       DBusMessage *msg = NULL;
+       DBusMessage *message = NULL;
        DBusMessage *reply = NULL;
        DBusMessageIter itr, variant, dict, entry;
        DBusConnection* conn = NULL;
@@ -1355,9 +1199,9 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        }
 
        /** Send ipaddress, netmask, gateway configuration */
-       msg = dbus_message_new_method_call(CONNMAN_SERVICE,
+       message = dbus_message_new_method_call(CONNMAN_SERVICE,
                        profile_name, CONNMAN_SERVICE_INTERFACE, "SetProperty");
-       if (msg == NULL) {
+       if (message == NULL) {
                NETWORK_LOG( NETWORK_ERROR,  "Error!!! dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
@@ -1366,7 +1210,7 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        NETWORK_LOG(NETWORK_ASSERT, "DBus Message 1/2 : %s %s %s %s\n", CONNMAN_SERVICE,
                        profile_name, CONNMAN_SERVICE_INTERFACE, "SetProperty");
 
-       dbus_message_iter_init_append(msg, &itr);
+       dbus_message_iter_init_append(message, &itr);
        dbus_message_iter_append_basic(&itr, DBUS_TYPE_STRING, &prop_ipv4_configuration);
 
        dbus_message_iter_open_container
@@ -1439,7 +1283,7 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
        dbus_error_init(&error);
 
        reply = dbus_connection_send_with_reply_and_block(conn,
-                       msg, DBUS_REPLY_TIMEOUT,                        
+                       message, DBUS_REPLY_TIMEOUT,
                        &error);
 
        if (reply == NULL) {
@@ -1450,18 +1294,18 @@ int _net_dbus_set_profile_ipv4(net_profile_info_t* prof_info, char* profile_name
                                error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error); 
-                       dbus_message_unref(msg);
+                       dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
 
-               dbus_message_unref(msg);
+               dbus_message_unref(message);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        dbus_message_unref(reply);
-       dbus_message_unref(msg);
+       dbus_message_unref(message);
 
        NETWORK_LOG(NETWORK_HIGH, "Successfully configured IPv4.Configuration\n");
        
@@ -1482,7 +1326,7 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
        char dns_buffer[NET_DNS_ADDR_MAX][NETPM_IPV4_STR_LEN_MAX+1];
        char *dns_address[NET_DNS_ADDR_MAX];
 
-       DBusMessage *msg = NULL;
+       DBusMessage *message = NULL;
        DBusMessage *reply = NULL;
        DBusMessageIter itr;
        DBusConnection* conn = NULL;
@@ -1513,17 +1357,17 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
        }
 
        if (prof_info->ProfileInfo.Wlan.net_info.IpConfigType == NET_IP_CONFIG_TYPE_STATIC) {
-               msg = dbus_message_new_method_call(CONNMAN_SERVICE,
+               message = dbus_message_new_method_call(CONNMAN_SERVICE,
                                profile_name, CONNMAN_SERVICE_INTERFACE, "SetProperty");
 
-               if (msg == NULL) {
+               if (message == NULL) {
                        NETWORK_LOG(NETWORK_ERROR,
                                        "Error!!! dbus_message_new_method_call() failed\n");
                        __NETWORK_FUNC_EXIT__;
                        return NET_ERR_UNKNOWN;
                }
 
-               dbus_message_iter_init_append(msg, &itr);
+               dbus_message_iter_init_append(message, &itr);
                dbus_message_iter_append_basic(&itr, DBUS_TYPE_STRING, &prop_nameserver_configuration);
 
                DBusMessageIter value, array;
@@ -1543,7 +1387,7 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
                dbus_error_init(&error);
 
                reply = dbus_connection_send_with_reply_and_block(conn,
-                               msg, DBUS_REPLY_TIMEOUT,
+                               message, DBUS_REPLY_TIMEOUT,
                                &error);
 
                if (reply == NULL) {
@@ -1554,16 +1398,16 @@ int _net_dbus_set_profile_dns(net_profile_info_t* prof_info, char* profile_name)
                                                error.message);
                                Error = __net_error_string_to_enum(error.name);
                                dbus_error_free(&error);
-                               dbus_message_unref(msg);
+                               dbus_message_unref(message);
                                __NETWORK_FUNC_EXIT__;
                                return Error;
                        }
-                       dbus_message_unref(msg);
+                       dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return NET_ERR_UNKNOWN;
                }
                dbus_message_unref(reply);
-               dbus_message_unref(msg);
+               dbus_message_unref(message);
                NETWORK_LOG(NETWORK_HIGH, "Successfully configured Nameservers.Configuration\n");
        }
 
@@ -1590,7 +1434,7 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        char proxy_buffer[NET_PROXY_LEN_MAX+1] = "";
        char *proxy_address = proxy_buffer;
 
-       DBusMessage *msg = NULL;
+       DBusMessage *message = NULL;
        DBusMessage *reply = NULL;
        DBusMessageIter itr, variant, dict, entry, sub_variant, str_array;
        DBusConnection* conn = NULL;
@@ -1614,15 +1458,15 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        }
 
        /** Send proxy method, url, servers configuration */
-       msg = dbus_message_new_method_call(CONNMAN_SERVICE, profile_name,
+       message = dbus_message_new_method_call(CONNMAN_SERVICE, profile_name,
                        CONNMAN_SERVICE_INTERFACE, "SetProperty");
-       if (msg == NULL) {
+       if (message == NULL) {
                NETWORK_LOG(NETWORK_ERROR,  "Error!!! dbus_message_new_method_call() failed\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
-       dbus_message_iter_init_append(msg, &itr);
+       dbus_message_iter_init_append(message, &itr);
        dbus_message_iter_append_basic(&itr, DBUS_TYPE_STRING, &prop_proxy_configuration);
 
        dbus_message_iter_open_container
@@ -1696,7 +1540,7 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
        dbus_error_init(&error);
 
        reply = dbus_connection_send_with_reply_and_block(conn,
-                       msg, DBUS_REPLY_TIMEOUT,                        
+                       message, DBUS_REPLY_TIMEOUT,
                        &error);
 
        if (reply == NULL) {
@@ -1707,18 +1551,18 @@ int _net_dbus_set_proxy(net_profile_info_t* prof_info, char* profile_name)
                                        error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error); 
-                       dbus_message_unref(msg);
+                       dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
 
-               dbus_message_unref(msg);
+               dbus_message_unref(message);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
        }
 
        dbus_message_unref(reply);
-       dbus_message_unref(msg);
+       dbus_message_unref(message);
 
        NETWORK_LOG( NETWORK_HIGH, "Successfully configured Proxy.Configuration\n");
        
@@ -1747,7 +1591,7 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        char buff_auth_type[10] = "";
        char *temp_ptr = NULL;
 
-       DBusMessage *msg = NULL;
+       DBusMessage *message = NULL;
        DBusMessage *reply = NULL;
        DBusMessageIter iter, dict, entry;
        DBusConnection* conn = NULL;
@@ -1766,9 +1610,9 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        }
 
        /** Create message */
-       msg = dbus_message_new_method_call(TELEPHONY_SERVCE,
+       message = dbus_message_new_method_call(TELEPHONY_SERVCE,
                        TELEPHONY_MASTER_PATH, TELEPHONY_MASTER_INTERFACE, "AddProfile");
-       if (msg == NULL) {
+       if (message == NULL) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
@@ -1778,7 +1622,7 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
        NETWORK_LOG(NETWORK_ASSERT, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVCE,
                        TELEPHONY_MASTER_PATH, TELEPHONY_MASTER_INTERFACE, ".AddProfile");
 
-       dbus_message_iter_init_append(msg, &iter);
+       dbus_message_iter_init_append(message, &iter);
 
        dbus_message_iter_open_container
                (&iter, DBUS_TYPE_ARRAY,
@@ -1881,7 +1725,7 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
 
        /** Send message */
        reply = dbus_connection_send_with_reply_and_block(conn,
-                       msg, DBUS_REPLY_TIMEOUT,
+                       message, DBUS_REPLY_TIMEOUT,
                        &error);
 
        /** Check Error */
@@ -1893,12 +1737,12 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
                                error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error);
-                       dbus_message_unref(msg);
+                       dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
 
-               dbus_message_unref(msg);
+               dbus_message_unref(message);
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -1921,7 +1765,7 @@ int _net_dbus_add_pdp_profile(net_profile_info_t *prof_info)
                Error = NET_ERR_UNKNOWN;
 
        dbus_message_unref(reply);
-       dbus_message_unref(msg);
+       dbus_message_unref(message);
        dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
@@ -1948,7 +1792,7 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        char buff_auth_type[10] = "";
        char *temp_ptr = NULL;
 
-       DBusMessage *msg = NULL;
+       DBusMessage *message = NULL;
        DBusMessage *reply = NULL;
        DBusMessageIter iter, dict, entry;
        DBusConnection* conn = NULL;
@@ -1967,9 +1811,9 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        }
 
        /** Create message */
-       msg = dbus_message_new_method_call(TELEPHONY_SERVCE,
+       message = dbus_message_new_method_call(TELEPHONY_SERVCE,
                        profile_name, TELEPHONY_PROFILE_INTERFACE, "ModifyProfile");
-       if (msg == NULL) {
+       if (message == NULL) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_message_new_method_call() failed\n");
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
@@ -1979,7 +1823,7 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
        NETWORK_LOG(NETWORK_ASSERT, "DBus Message 1/2 : %s %s %s %s\n", TELEPHONY_SERVCE,
                        profile_name, TELEPHONY_PROFILE_INTERFACE, ".ModifyProfile");
 
-       dbus_message_iter_init_append(msg, &iter);
+       dbus_message_iter_init_append(message, &iter);
 
        dbus_message_iter_open_container
                (&iter, DBUS_TYPE_ARRAY,
@@ -2082,7 +1926,7 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
 
        /** Send message */
        reply = dbus_connection_send_with_reply_and_block(conn,
-                       msg, DBUS_REPLY_TIMEOUT,
+                       message, DBUS_REPLY_TIMEOUT,
                        &error);
 
        /** Check Error */
@@ -2094,12 +1938,12 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
                                error.message);
                        Error = __net_error_string_to_enum(error.name);
                        dbus_error_free(&error);
-                       dbus_message_unref(msg);
+                       dbus_message_unref(message);
                        __NETWORK_FUNC_EXIT__;
                        return Error;
                }
 
-               dbus_message_unref(msg);
+               dbus_message_unref(message);
                dbus_connection_unref(conn);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -2122,7 +1966,7 @@ int _net_dbus_modify_pdp_profile(net_profile_info_t *prof_info, const char *prof
                Error = NET_ERR_UNKNOWN;
 
        dbus_message_unref(reply);
-       dbus_message_unref(msg);
+       dbus_message_unref(message);
        dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
@@ -2135,24 +1979,10 @@ int _net_dbus_load_wifi_driver(void)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
-
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-                       NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE ".LoadDriver");
 
-       Error = _net_invoke_dbus_method_nonblock(NETCONFIG_SERVICE, conn, NETCONFIG_WIFI_PATH,
+       Error = _net_invoke_dbus_method_nonblock(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
                        NETCONFIG_WIFI_INTERFACE, "LoadDriver", __net_wifi_power_reply);
 
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
@@ -2162,24 +1992,10 @@ int _net_dbus_remove_wifi_driver(void)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
-
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-                       NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE ".RemoveDriver");
 
-       Error = _net_invoke_dbus_method_nonblock(NETCONFIG_SERVICE, conn, NETCONFIG_WIFI_PATH,
+       Error = _net_invoke_dbus_method_nonblock(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
                        NETCONFIG_WIFI_INTERFACE, "RemoveDriver", __net_wifi_power_reply);
 
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
@@ -2204,6 +2020,63 @@ void _net_dbus_set_pending_call(DBusPendingCall *call)
        network_dbus_pending_call_data.pcall = call;
 }
 
+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);
+       }
+}
+
+int _net_dbus_specific_scan_request(const char *ssid)
+{
+       __NETWORK_FUNC_ENTER__;
+
+       DBusMessage* message = NULL;
+       DBusConnection* conn = NULL;
+       DBusPendingCall *call = NULL;
+       dbus_bool_t result = FALSE;
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (conn == NULL) {
+               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on 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");
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_EXCEPTION, "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);
+       if (result == FALSE || call == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! dbus_connection_send_with_reply() Failed\n");
+               dbus_message_unref(message);
+               dbus_connection_unref(conn);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
+       NETWORK_LOG(NETWORK_HIGH, "Successfully configured\n");
+
+       dbus_pending_call_set_notify(call, __net_specific_scan_wifi_reply, 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);
+
+       __NETWORK_FUNC_EXIT__;
+       return NET_ERR_NONE;
+}
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index c9bc0b2..134694d 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -51,33 +54,10 @@ extern "C"
  *     Macros and Typedefs
  *****************************************************************************/
 
-#define EAP_CONFIG_KEY_TYPE                    "Type"
-#define EAP_CONFIG_KEY_NAME                    "Name"
-#define EAP_CONFIG_KEY_SSID                    "SSID"
-#define EAP_CONFIG_KEY_EAP                             "EAP"
-#define EAP_CONFIG_KEY_IDENTITY                "Identity"
-#define EAP_CONFIG_KEY_PASSPHRASE      "Passphrase"
-
-#define EAP_CONFIG_KEY_CA_CERT         "CACertFile"
-#define EAP_CONFIG_KEY_CL_CERT         "ClientCertFile"
-#define EAP_CONFIG_KEY_PRV_KEY         "PrivateKeyFile"
-#define EAP_CONFIG_KEY_PRV_KEY_PASS    "PrivateKeyPassphrase"
-#define EAP_CONFIG_KEY_PRV_KEY_PASS_TYPE  "PrivateKeyPassphraseType"
-#define EAP_CONFIG_KEY_PHASE2                  "Phase2"
-
-#define EAP_TYPE_LEN_MAX                       8               //tls / ttls / peap
-#define EAP_AUTH_TYPE_LEN_MAX          16
-#define EAP_TYPE_STR_TLS       "tls"
-#define EAP_TYPE_STR_TTLS      "ttls"
-#define EAP_TYPE_STR_PEAP      "peap"
-
-#define CONNMAN_STORAGE_DIR            "/var/lib/connman"
-
 /*****************************************************************************
  *     Local Functions Declaration
  *****************************************************************************/
 
-
 /*****************************************************************************
  *     Global Functions
  *****************************************************************************/
@@ -87,7 +67,6 @@ extern "C"
  *****************************************************************************/
 extern network_info_t NetworkInfo;
 
-
 /*****************************************************************************
  *     Global Variables
  *****************************************************************************/
@@ -104,161 +83,55 @@ struct {
  *     Local Functions Definition
  *****************************************************************************/
 
-gboolean __convert_eap_type_to_string(gchar eap_type, char * eap_str)
-{
-       switch(eap_type)
-       {
-               case WLAN_SEC_EAP_TYPE_PEAP:
-                       memcpy(eap_str, EAP_TYPE_STR_PEAP, EAP_TYPE_LEN_MAX);
-                       return TRUE;
-               case WLAN_SEC_EAP_TYPE_TLS:
-                       memcpy(eap_str, EAP_TYPE_STR_TLS, EAP_TYPE_LEN_MAX);
-                       return TRUE;
-               case WLAN_SEC_EAP_TYPE_TTLS:
-                       memcpy(eap_str, EAP_TYPE_STR_TTLS, EAP_TYPE_LEN_MAX);
-                       return TRUE;
-               case WLAN_SEC_EAP_TYPE_SIM:             //Not supported yet
-               case WLAN_SEC_EAP_TYPE_AKA:             //Not supported yet
-               default:
-                       return FALSE;
-       }
-
-}
-
-void __convert_eap_auth_to_string(gchar eap_auth, char * auth_str)
+char *__convert_eap_type_to_string(gchar eap_type)
 {
-       switch(eap_auth)
-       {
-               case WLAN_SEC_EAP_AUTH_NONE:
-                       return ;
-               case WLAN_SEC_EAP_AUTH_PAP:
-                       memcpy(auth_str, "PAP", strlen("PAP")+1);
-                       break;
-               case WLAN_SEC_EAP_AUTH_MSCHAP:
-                       memcpy(auth_str, "MSCHAP", strlen("MSCHAP")+1);
-                       break;
-               case WLAN_SEC_EAP_AUTH_MSCHAPV2:
-                       memcpy(auth_str, "MSCHAPV2", strlen("MSCHAPV2")+1);
-                       break;
-               case WLAN_SEC_EAP_AUTH_GTC:
-                       memcpy(auth_str, "GTC", strlen("GTC")+1);
-                       break;
-               case WLAN_SEC_EAP_AUTH_MD5:
-                       memcpy(auth_str, "MD5", strlen("MD5")+1);
-                       break;
-               default:
-                       return ;
-
-       }
-}
-
-static void __update_config(GKeyFile * keyfile, char * group,
-                                                       const wlan_eap_info_t * eap_info, const char * essid,
-                                                       char * eap_type, char * auth_type)
-{
-       g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_TYPE, "wifi");
-
-       NETWORK_LOG(NETWORK_HIGH, "------------eap info------------------");
-       NETWORK_LOG(NETWORK_HIGH, "-essid : %s", essid);
-       NETWORK_LOG(NETWORK_HIGH, "-eap type : %s", eap_type);
-       NETWORK_LOG(NETWORK_HIGH, "-phase2 authentication type : %s", auth_type);
-       NETWORK_LOG(NETWORK_HIGH, "-username : %s", eap_info->username);
-       NETWORK_LOG(NETWORK_HIGH, "-password : %s", eap_info->password);
-       NETWORK_LOG(NETWORK_HIGH, "-ca certi filename : %s", eap_info->ca_cert_filename);
-       NETWORK_LOG(NETWORK_HIGH, "-client certi filename : %s", eap_info->client_cert_filename);
-       NETWORK_LOG(NETWORK_HIGH, "-private key filename : %s", eap_info->private_key_filename);
-       NETWORK_LOG(NETWORK_HIGH, "-private key password : %s", eap_info->private_key_passwd);
-       NETWORK_LOG(NETWORK_HIGH, "--------------------------------------");
-
-       if(essid != NULL)
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_NAME, essid);
+       switch (eap_type) {
+       case WLAN_SEC_EAP_TYPE_PEAP:
+               return "peap";
 
-       if(eap_type != NULL)
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_EAP, eap_type);
+       case WLAN_SEC_EAP_TYPE_TLS:
+               return "tls";
 
-       if(auth_type != NULL)
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_PHASE2, auth_type);
+       case WLAN_SEC_EAP_TYPE_TTLS:
+               return "ttls";
 
-       if((eap_info->username != NULL) && (strlen(eap_info->username) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_IDENTITY, eap_info->username);
+       case WLAN_SEC_EAP_TYPE_SIM:
+               return "sim";
 
-       if((eap_info->password != NULL) && (strlen(eap_info->password) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_PASSPHRASE, eap_info->password);
+       case WLAN_SEC_EAP_TYPE_AKA:
+               return "aka";
 
-       if((eap_info->ca_cert_filename != NULL) && (strlen(eap_info->ca_cert_filename) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_CA_CERT, eap_info->ca_cert_filename);
-
-       if((eap_info->client_cert_filename != NULL) && (strlen(eap_info->client_cert_filename) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_CL_CERT, eap_info->client_cert_filename);
-
-       if((eap_info->private_key_filename != NULL) && (strlen(eap_info->private_key_filename) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_PRV_KEY, eap_info->private_key_filename);
-
-       if((eap_info->private_key_passwd != NULL) && (strlen(eap_info->private_key_passwd) > 0))
-               g_key_file_set_string(keyfile, group, EAP_CONFIG_KEY_PRV_KEY_PASS, eap_info->private_key_passwd);
+       default:
+               return NULL;
+       }
 }
 
-static net_err_t __net_add_eap_config(const wlan_eap_info_t * eap_info, const char * essid)
+char *__convert_eap_auth_to_string(gchar eap_auth)
 {
-       GKeyFile * keyfile;
-       char group[16];
-       char * eap_str;
-       char * auth_str;
-       gchar *data = NULL;
-       gsize length = 0;
-       net_err_t Error = NET_ERR_NONE;
-
-       __NETWORK_FUNC_ENTER__;
-
-       if((eap_info->eap_type < WLAN_SEC_EAP_TYPE_PEAP) || (eap_info->eap_type > WLAN_SEC_EAP_TYPE_AKA)) {
-               NETWORK_LOG(NETWORK_HIGH, "Invalid EAP type (%d)\n", eap_info->eap_type);
-               return NET_ERR_INVALID_PARAM;
-       }
-
-       eap_str = (char*)calloc(EAP_TYPE_LEN_MAX, sizeof(char));
-       if(eap_str == NULL)
-               return NET_ERR_UNKNOWN;
-
-       if(__convert_eap_type_to_string(eap_info->eap_type, eap_str) == FALSE) {
-               NETWORK_LOG(NETWORK_HIGH, "Invalid EAP type (%d)\n", eap_info->eap_type);
-               NET_MEMFREE(eap_str);
-               return NET_ERR_INVALID_PARAM;
-       }
-
-       auth_str = (char*)calloc(EAP_AUTH_TYPE_LEN_MAX, sizeof(char));
-       if(auth_str == NULL) {
-               NET_MEMFREE(eap_str);
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       __convert_eap_auth_to_string(eap_info->eap_auth, auth_str);
-
-       sprintf(group, "service_%s", eap_str);
-       NETWORK_LOG(NETWORK_HIGH, "group (%s)\n", group);
+       switch (eap_auth) {
+       case WLAN_SEC_EAP_AUTH_NONE:
+               return "NONE";
 
-       keyfile = g_key_file_new();
+       case WLAN_SEC_EAP_AUTH_PAP:
+               return "PAP";
 
-       __update_config(keyfile, group, eap_info, essid, eap_str, auth_str);
+       case WLAN_SEC_EAP_AUTH_MSCHAP:
+               return "MSCHAP";
 
-       data = g_key_file_to_data(keyfile, &length, NULL);
+       case WLAN_SEC_EAP_AUTH_MSCHAPV2:
+               return "MSCHAPV2";
 
-       NETWORK_LOG(NETWORK_ERROR, "-----length of data : %d\n", length);
-       Error = _net_dbus_provision_service(data, length+1);
-       if(Error != NET_ERR_NONE)
-               NETWORK_LOG(NETWORK_ERROR, "Failed to update EAP info in ConnMan\n");
+       case WLAN_SEC_EAP_AUTH_GTC:
+               return "GTC";
 
-       NET_MEMFREE(eap_str);
-       NET_MEMFREE(auth_str);
-
-       g_key_file_free(keyfile);
-       g_free(data);
-
-       return Error;
+       case WLAN_SEC_EAP_AUTH_MD5:
+               return "MD5";
 
+       default:
+               return NULL;
+       }
 }
 
-
 /*****************************************************************************
  *     Global Functions Definition
  *****************************************************************************/
@@ -357,10 +230,12 @@ net_device_t _net_get_tech_type_from_path(const char *profile_name)
 
        net_device_t device_type = NET_DEVICE_UNKNOWN;
 
-       if (strstr(profile_name, "/wifi_") != NULL)
+       if (g_str_has_prefix(profile_name, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE)
                device_type = NET_DEVICE_WIFI;
-       else if (strstr(profile_name, "/cellular_") != NULL)
+       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)
+               device_type = NET_DEVICE_ETHERNET;
 
        __NETWORK_FUNC_EXIT__;
        return device_type;
@@ -385,6 +260,22 @@ char* _net_get_string(DBusMessage* msg)
        return sigvalue;
 }
 
+unsigned long long _net_get_uint64(DBusMessage* msg)
+{
+       DBusMessageIter args;
+       unsigned long long sigvalue = 0;
+
+       if (!dbus_message_iter_init(msg, &args)) {
+               NETWORK_LOG(NETWORK_LOW, "Message does not have parameters\n");
+       } else if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_UINT64) {
+               NETWORK_LOG(NETWORK_LOW, "Argument is not uint64\n");
+       } else {
+               dbus_message_iter_get_basic(&args, &sigvalue);
+       }
+
+       return sigvalue;
+}
+
 char* _net_get_object(DBusMessage* msg)
 {
        __NETWORK_FUNC_ENTER__;
@@ -497,9 +388,8 @@ int _net_get_tech_state(DBusMessage* msg, network_get_tech_state_info_t* tech_st
 
                        if (dbus_message_iter_get_arg_type(&sub_iter1) == DBUS_TYPE_STRING) {
                                dbus_message_iter_get_basic(&sub_iter1, &tech_name);
-                               if (tech_name != NULL &&
-                                   strcmp(tech_name, tech_state->technology) == 0)
-                                       tech_state->AvailableTechnology = TRUE;
+                               if (tech_name != NULL && strcmp(tech_name, tech_state->technology) == 0)
+                                       tech_state->DefaultTechnology = TRUE;
                        }
                }
 next_dict:
@@ -511,60 +401,80 @@ done:
        return Error;
 }
 
-
 /** This function is used only to open Wi-Fi connection with hidden APs */
 int _net_open_connection_with_wifi_info(const net_wifi_connection_info_t* wifi_info)
 {
        __NETWORK_FUNC_ENTER__;
 
-       /** path = manager.ConnectService(({ "Type": "wifi", "Mode": "managed",
-        "SSID": sys.argv[1],
-        "Security": security,
-        "Passphrase": passphrase }));
-       */
-
        net_err_t Error = NET_ERR_NONE;
-       char type[] = "wifi";
-       char mode[128] = "";
-       char essid[NET_WLAN_ESSID_LEN + 1] = "";
-       char security[128] = "";
-       char passphrase[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN] = "";
+
        net_wifi_connect_service_info_t wifi_connection_info;
+       memset(&wifi_connection_info, 0, sizeof(net_wifi_connect_service_info_t));
 
-       snprintf(mode, 128, "%s", (wifi_info->wlan_mode == NETPM_WLAN_CONNMODE_ADHOC)?"adhoc":"managed");
+       wifi_connection_info.type = g_strdup("wifi");
 
-       switch(wifi_info->security_info.sec_mode) {
+       if (wifi_info->wlan_mode == NETPM_WLAN_CONNMODE_ADHOC)
+               wifi_connection_info.mode = g_strdup("adhoc");
+       else
+               wifi_connection_info.mode = g_strdup("managed");
+
+       wifi_connection_info.ssid = g_strdup(wifi_info->essid);
+
+       switch (wifi_info->security_info.sec_mode) {
        case WLAN_SEC_MODE_NONE:
-               snprintf(security, 128, "%s", "none");
-               snprintf(passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN, "%s", "");
+               wifi_connection_info.security = g_strdup("none");
                break;
 
        case WLAN_SEC_MODE_WEP:
-               snprintf(security, 128, "%s", "wep");
-               snprintf(passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN, "%s", wifi_info->security_info.authentication.wep.wepKey);
+               wifi_connection_info.security = g_strdup("wep");
+               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:
-               snprintf(security, 128, "%s", "psk");
-               snprintf(passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN, "%s", wifi_info->security_info.authentication.psk.pskKey);
+               wifi_connection_info.security = g_strdup("psk");
+               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:
-               snprintf(security, 128, "%s", "rsn");
-               snprintf(passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN, "%s", wifi_info->security_info.authentication.psk.pskKey);
+               wifi_connection_info.security = g_strdup("rsn");
+               wifi_connection_info.passphrase = g_strdup(wifi_info->security_info.authentication.psk.pskKey);
                break;
 
        case WLAN_SEC_MODE_IEEE8021X:
-               snprintf(security, 128, "%s", "ieee8021x");
-               snprintf(passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN, "%s", "");
-               Error = __net_add_eap_config(&(wifi_info->security_info.authentication.eap), wifi_info->essid);
-               if(Error != NET_ERR_NONE) {
-                       __NETWORK_FUNC_EXIT__;
-                       return Error;
-               }
+               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));
+               wifi_connection_info.eap_auth = g_strdup(
+                               __convert_eap_auth_to_string(wifi_info->security_info.authentication.eap.eap_auth));
+
+               if (wifi_info->security_info.authentication.eap.username != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.username) > 0)
+                               wifi_connection_info.identity = g_strdup(wifi_info->security_info.authentication.eap.username);
+
+               if (wifi_info->security_info.authentication.eap.password != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.password) > 0)
+                               wifi_connection_info.password = g_strdup(wifi_info->security_info.authentication.eap.password);
+
+               if (wifi_info->security_info.authentication.eap.ca_cert_filename != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.ca_cert_filename) > 0)
+                               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 != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.client_cert_filename) > 0)
+                               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 != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.private_key_filename) > 0)
+                               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 != NULL)
+                       if (strlen(wifi_info->security_info.authentication.eap.private_key_passwd) > 0)
+                               wifi_connection_info.private_key_password = g_strdup(wifi_info->security_info.authentication.eap.private_key_passwd);
+
                break;
 
        default:
@@ -573,34 +483,48 @@ int _net_open_connection_with_wifi_info(const net_wifi_connection_info_t* wifi_i
                return NET_ERR_INVALID_PARAM;
        }
 
-       snprintf(essid, NET_WLAN_ESSID_LEN + 1, "%s", wifi_info->essid);
-
-       wifi_connection_info.type = type;
-       wifi_connection_info.mode = mode;
-       wifi_connection_info.ssid = essid;
-       wifi_connection_info.security = security;
-       wifi_connection_info.passphrase = passphrase;
-
-       NETWORK_LOG( NETWORK_HIGH,
+       NETWORK_LOG(NETWORK_HIGH,
                        "Parameters: type:\t%s\nmode:\t%s\nssid:\t%s\nsecurity:\t%s\npassphrase:\t%s\n",
                        wifi_connection_info.type, wifi_connection_info.mode,
                        wifi_connection_info.ssid, wifi_connection_info.security,
                        wifi_connection_info.passphrase);
 
-       if( (Error = _net_dbus_connect_service(&wifi_connection_info)) != NET_ERR_NONE ) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Failed to request connect_service. Error [%s]\n",
-                               _net_print_error(Error));
-               __NETWORK_FUNC_EXIT__;
-               return Error;
+       if (wifi_info->security_info.sec_mode == WLAN_SEC_MODE_IEEE8021X) {
+               NETWORK_LOG(NETWORK_HIGH,
+                               "Wi-Fi Enterprise type:\t%s\nauth:\t%s\nidentity:\t%s\npassword:\t%s\n",
+                               wifi_connection_info.eap_type, wifi_connection_info.eap_auth,
+                               wifi_connection_info.identity, wifi_connection_info.password);
+               NETWORK_LOG(NETWORK_HIGH,
+                               "CA cert:\t%s\nClient cert:\t%s\nPrivate key:\t%s\nPrivate key password:\t%s\n",
+                               wifi_connection_info.ca_cert_file, wifi_connection_info.client_cert_file,
+                               wifi_connection_info.private_key_file, wifi_connection_info.private_key_password);
        }
 
-       NETWORK_LOG(NETWORK_HIGH, "Successfully requested to ConnMan\n");
+       if ((Error = _net_dbus_connect_service(&wifi_connection_info)) != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_EXCEPTION, "Failed to request connect service. Error [%s]\n",
+                               _net_print_error(Error));
+       else
+               NETWORK_LOG(NETWORK_HIGH, "Successfully requested to connect service\n");
+
+       g_free(wifi_connection_info.type);
+       g_free(wifi_connection_info.mode);
+       g_free(wifi_connection_info.ssid);
+       g_free(wifi_connection_info.security);
+       g_free(wifi_connection_info.passphrase);
+       g_free(wifi_connection_info.eap_type);
+       g_free(wifi_connection_info.eap_auth);
+       g_free(wifi_connection_info.identity);
+       g_free(wifi_connection_info.password);
+       g_free(wifi_connection_info.ca_cert_file);
+       g_free(wifi_connection_info.client_cert_file);
+       g_free(wifi_connection_info.private_key_file);
+       g_free(wifi_connection_info.private_key_password);
 
        __NETWORK_FUNC_EXIT__;
-       return NET_ERR_NONE;
+       return Error;
 }
 
-int _net_mutex_init()
+int _net_mutex_init(void)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -621,7 +545,7 @@ int _net_mutex_init()
        return NET_ERR_NONE;
 }
 
-void _net_mutex_destroy()
+void _net_mutex_destroy(void)
 {
        __NETWORK_FUNC_ENTER__;
 
@@ -636,13 +560,20 @@ void _net_client_callback(net_event_info_t *event_data)
        pthread_mutex_lock(&networkinfo_mutex.callback_mutex);
        __NETWORK_FUNC_ENTER__;
 
-       NETWORK_CALLBACK(event_data, NetworkInfo.user_data);
+       if (NetworkInfo.ClientEventCb != NULL)
+               NetworkInfo.ClientEventCb(event_data, NetworkInfo.user_data);
+
+       if (NetworkInfo.ClientEventCb_conn != NULL)
+               NetworkInfo.ClientEventCb_conn(event_data, NetworkInfo.user_data_conn);
+
+       if (NetworkInfo.ClientEventCb_wifi != NULL)
+               NetworkInfo.ClientEventCb_wifi(event_data, NetworkInfo.user_data_wifi);
 
        __NETWORK_FUNC_EXIT__;
        pthread_mutex_unlock(&networkinfo_mutex.callback_mutex);
 }
 
-net_wifi_state_t _net_get_wifi_state()
+net_wifi_state_t _net_get_wifi_state(void)
 {
        pthread_mutex_lock(&networkinfo_mutex.wifi_state_mutex);
        __NETWORK_FUNC_ENTER__;
@@ -672,7 +603,7 @@ state_done:
        return wifi_state;
 }
 
-void _net_clear_request_table()
+void _net_clear_request_table(void)
 {
        __NETWORK_FUNC_ENTER__;
 
index 802df40..53c94b8 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -59,11 +62,14 @@ static int __net_extract_wifi_services(DBusMessage* message,
                DBusMessageIter* dict, network_services_list_t* service_info);
 static int __net_extract_mobile_services(DBusMessage* message, DBusMessageIter* dict, 
                network_services_list_t* service_info, net_service_type_t network_type);
+static int __net_extract_ethernet_services(DBusMessage* message,
+               DBusMessageIter* dict, network_services_list_t* service_info);
 static int __net_extract_services(DBusMessage *message, net_device_t device_type,
                net_profile_info_t** profile_info, int* profile_count);
 static int __net_extract_ip(DBusMessageIter *iter, net_addr_t *ipAddr);
 static int __net_extract_common_info(const char *key, DBusMessageIter *variant, net_profile_info_t* ProfInfo);
 static int __net_extract_mobile_info(DBusMessageIter *array, net_profile_info_t* ProfInfo);
+static int __net_extract_ethernet_info(DBusMessageIter *array, net_profile_info_t* ProfInfo);
 static int __net_telephony_search_pdp_profile(char* ProfileName, net_profile_name_t* PdpProfName);
 static int __net_telephony_modify_profile(const char* ProfileName,
                net_profile_info_t* ProfInfo, net_profile_info_t* exProfInfo);
@@ -101,7 +107,9 @@ static int __net_pm_init_profile_info(net_device_t profile_type, net_profile_inf
        net_dev_info_t* net_info = NULL;
        
        if (ProfInfo == NULL ||
-               (profile_type != NET_DEVICE_WIFI && profile_type != NET_DEVICE_CELLULAR)) {
+          (profile_type != NET_DEVICE_WIFI &&
+           profile_type != NET_DEVICE_CELLULAR &&
+           profile_type != NET_DEVICE_ETHERNET)) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid Parameter\n");
                return NET_ERR_INVALID_PARAM;
        }
@@ -148,6 +156,8 @@ static int __net_pm_init_profile_info(net_device_t profile_type, net_profile_inf
                ProfInfo->ProfileInfo.Pdp.SetupRequired = FALSE;
 
                net_info = &(ProfInfo->ProfileInfo.Pdp.net_info);
+       } else if(profile_type == NET_DEVICE_ETHERNET) {
+               net_info = &(ProfInfo->ProfileInfo.Ethernet.net_info);
        }
        
        memset(net_info->ProfileName, '\0', NET_PROFILE_NAME_LEN_MAX+1);
@@ -217,18 +227,11 @@ static int __net_telephony_get_profile_info(net_profile_name_t* ProfileName, net
                return NET_ERR_INVALID_PARAM;
        }
 
-       char request[] = TELEPHONY_PROFILE_INTERFACE ".GetProfile";
-       char* param_array[] = {NULL, NULL, NULL};
-       
-       param_array[0] = ProfileName->ProfileName;
-       param_array[1] = request;
+       result = _net_invoke_dbus_method(TELEPHONY_SERVCE, ProfileName->ProfileName,
+                       TELEPHONY_PROFILE_INTERFACE, "GetProfile", NULL, &Error);
 
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-               param_array[0],
-               param_array[1]);
-       
-       if ((Error = _net_send_dbus_request(TELEPHONY_SERVCE, param_array, &result)) != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_send_dbus_request failed\n");
+       if (result == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method failed\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -333,28 +336,18 @@ static int __net_telephony_get_profile_list(net_profile_name_t** ProfileName, in
        DBusMessageIter iter, array;
        int count = 0;
 
-       char request[] = TELEPHONY_MASTER_INTERFACE ".GetProfileList";
-       char path[] = TELEPHONY_MASTER_PATH;
-       char* param_array[] = {NULL, NULL, NULL};
-       
-       param_array[0] = path;
-       param_array[1] = request;
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s]\n",
-               param_array[0],
-               param_array[1]);
-       
-       Error = _net_send_dbus_request(TELEPHONY_SERVCE, param_array, &result);
+       result = _net_invoke_dbus_method(TELEPHONY_SERVCE, TELEPHONY_MASTER_PATH,
+                       TELEPHONY_MASTER_INTERFACE, "GetProfileList", NULL, &Error);
 
-       if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_send_dbus_request failed\n");
+       if (result == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! _net_invoke_dbus_method failed\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
        dbus_message_iter_init(result, &iter);
        if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
-               NETWORK_LOG(NETWORK_HIGH,  "There is no profiles\n");
+               NETWORK_LOG(NETWORK_HIGH, "There is no profiles\n");
                *ProfileCount = 0;
                dbus_message_unref(result);
                __NETWORK_FUNC_EXIT__;
@@ -475,17 +468,15 @@ static int __net_extract_wifi_services(DBusMessage* message,
        int count = 0;
        int i = 0;
 
-       __NETWORK_FUNC_ENTER__; 
+       __NETWORK_FUNC_ENTER__;
 
-       if(message == NULL || dict == NULL || service_info == NULL)
-       {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid prarameter \n");
+       if (message == NULL || dict == NULL || service_info == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
-       
-       while(dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY)
-       {
+
+       while (dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY) {
                DBusMessageIter keyValue, array, value;
                const char *key = NULL;
                const char *objPath = NULL;
@@ -493,41 +484,38 @@ static int __net_extract_wifi_services(DBusMessage* message,
                dbus_message_iter_recurse(dict, &keyValue);
                dbus_message_iter_get_basic(&keyValue, &key);
 
-               if(strcmp(key, "Services") == 0)
-               {
+               if (strcmp(key, "Services") == 0) {
                        dbus_message_iter_next(&keyValue);
                        dbus_message_iter_recurse(&keyValue, &array);
-                       if(dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY)
-                       {
+
+                       if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY) {
                                NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get service list\n");
                                __NETWORK_FUNC_EXIT__;
                                return NET_ERR_NO_SERVICE;
                        }
-                               
+
                        dbus_message_iter_recurse(&array, &value);
-                       if(dbus_message_iter_get_arg_type(&value) != DBUS_TYPE_OBJECT_PATH)
-                       {
+
+                       if (dbus_message_iter_get_arg_type(&value) != DBUS_TYPE_OBJECT_PATH) {
                                NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get service list\n");
                                __NETWORK_FUNC_EXIT__;
                                return NET_ERR_NO_SERVICE;
                        }
 
-                       while(dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH)
-                       {
+                       while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH) {
                                dbus_message_iter_get_basic(&value, &objPath);
 
-                               if(strstr(objPath, "wifi_") != NULL)
-                               {
+                               if (g_str_has_prefix(objPath, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE) {
                                        service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
-                                       if(service_info->ProfileName[count] == NULL)
-                                       {
+
+                                       if (service_info->ProfileName[count] == NULL) {
                                                NETWORK_LOG(NETWORK_EXCEPTION,
                                                                "Error!!! Failed to allocate memory\n");
 
-                                               for(i = 0;i < count;i++)
+                                               for (i = 0; i < count; i++)
                                                        NET_MEMFREE(service_info->ProfileName[i]);
-                                               
-                                               __NETWORK_FUNC_EXIT__;  
+
+                                               __NETWORK_FUNC_EXIT__;
                                                return NET_ERR_UNKNOWN;
                                        }
 
@@ -541,10 +529,10 @@ static int __net_extract_wifi_services(DBusMessage* message,
 
                        service_info->num_of_services = count;
                        return NET_ERR_NONE;
-               }                               
+               }
 
                dbus_message_iter_next(dict);
-       }               
+       }
 
        __NETWORK_FUNC_EXIT__;
 
@@ -564,7 +552,7 @@ static int __net_extract_mobile_services(DBusMessage* message, DBusMessageIter*
        __NETWORK_FUNC_ENTER__; 
        
        if (message == NULL || dict == NULL || service_info == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid prarameter \n");
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -599,7 +587,7 @@ static int __net_extract_mobile_services(DBusMessage* message, DBusMessageIter*
                        while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH) {
                                dbus_message_iter_get_basic(&value, &objPath);
 
-                               if (strstr(objPath, "cellular_") != NULL) {
+                               if (g_str_has_prefix(objPath, CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE) {
                                        found = FALSE;
 
                                        suffix = strrchr(objPath, '_');
@@ -619,7 +607,7 @@ static int __net_extract_mobile_services(DBusMessage* message, DBusMessageIter*
                                                        NETWORK_LOG(NETWORK_EXCEPTION,
                                                                        "Error!!! Failed to allocate memory\n");
 
-                                                       for (i = 0;i < count;i++)
+                                                       for (i = 0; i < count; i++)
                                                                NET_MEMFREE(service_info->ProfileName[i]);
                                                        
                                                        __NETWORK_FUNC_EXIT__;  
@@ -648,6 +636,83 @@ static int __net_extract_mobile_services(DBusMessage* message, DBusMessageIter*
        return NET_ERR_NONE;
 }
 
+static int __net_extract_ethernet_services(DBusMessage* message,
+               DBusMessageIter* dict, network_services_list_t* service_info)
+{
+       int count = 0;
+       int i = 0;
+
+       __NETWORK_FUNC_ENTER__;
+
+       if (message == NULL || dict == NULL || service_info == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_INVALID_PARAM;
+       }
+
+       while (dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY) {
+               DBusMessageIter keyValue, array, value;
+               const char *key = NULL;
+               const char *objPath = NULL;
+
+               dbus_message_iter_recurse(dict, &keyValue);
+               dbus_message_iter_get_basic(&keyValue, &key);
+
+               if (strcmp(key, "Services") == 0) {
+                       dbus_message_iter_next(&keyValue);
+                       dbus_message_iter_recurse(&keyValue, &array);
+
+                       if (dbus_message_iter_get_arg_type(&array) != DBUS_TYPE_ARRAY) {
+                               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get service list\n");
+                               __NETWORK_FUNC_EXIT__;
+                               return NET_ERR_NO_SERVICE;
+                       }
+
+                       dbus_message_iter_recurse(&array, &value);
+
+                       if (dbus_message_iter_get_arg_type(&value) != DBUS_TYPE_OBJECT_PATH) {
+                               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get service list\n");
+                               __NETWORK_FUNC_EXIT__;
+                               return NET_ERR_NO_SERVICE;
+                       }
+
+                       while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_OBJECT_PATH) {
+                               dbus_message_iter_get_basic(&value, &objPath);
+
+                               if (g_str_has_prefix(objPath, CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX) == TRUE) {
+                                       service_info->ProfileName[count] = (char*)malloc(NET_PROFILE_NAME_LEN_MAX+1);
+
+                                       if (service_info->ProfileName[count] == NULL) {
+                                               NETWORK_LOG(NETWORK_EXCEPTION,
+                                                               "Error!!! Failed to allocate memory\n");
+
+                                               for(i = 0; i < count; i++)
+                                                       NET_MEMFREE(service_info->ProfileName[i]);
+
+                                               __NETWORK_FUNC_EXIT__;
+                                               return NET_ERR_UNKNOWN;
+                                       }
+
+                                       g_strlcpy(service_info->ProfileName[count], objPath, NET_PROFILE_NAME_LEN_MAX);
+
+                                       count++;
+                               }
+
+                               dbus_message_iter_next(&value);
+                       }
+
+                       service_info->num_of_services = count;
+                       return NET_ERR_NONE;
+               }
+
+               dbus_message_iter_next(dict);
+       }
+
+       __NETWORK_FUNC_EXIT__;
+
+       return NET_ERR_NONE;
+}
+
 static int __net_extract_services(DBusMessage *message, net_device_t device_type,
                net_profile_info_t** profile_info, int* profile_count)
 {
@@ -674,6 +739,9 @@ static int __net_extract_services(DBusMessage *message, net_device_t device_type
        case NET_DEVICE_CELLULAR :
                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);
+               break;
        default :
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NOT_SUPPORTED;
@@ -790,6 +858,8 @@ static int __net_extract_common_info(const char *key, DBusMessageIter *variant,
                net_info = &(ProfInfo->ProfileInfo.Pdp.net_info);
        } else if (ProfInfo->profile_type == NET_DEVICE_WIFI) {
                net_info = &(ProfInfo->ProfileInfo.Wlan.net_info);
+       } else if (ProfInfo->profile_type == NET_DEVICE_ETHERNET) {
+               net_info = &(ProfInfo->ProfileInfo.Ethernet.net_info);
        } else {
                NETWORK_LOG(NETWORK_ERROR,
                                "Error!!! Invalid Profile type. [%d]\n", ProfInfo->profile_type);
@@ -1069,6 +1139,44 @@ static int __net_extract_common_info(const char *key, DBusMessageIter *variant,
        return Error;
 }
 
+static wlan_eap_type_t __convert_eap_type_from_string(const char *eap_type)
+{
+       if (eap_type == NULL)
+               return WLAN_SEC_EAP_TYPE_PEAP;
+       else if (g_str_equal(eap_type, "peap") == TRUE)
+               return WLAN_SEC_EAP_TYPE_PEAP;
+       else if (g_str_equal(eap_type, "tls") == TRUE)
+               return WLAN_SEC_EAP_TYPE_TLS;
+       else if (g_str_equal(eap_type, "ttls") == TRUE)
+               return WLAN_SEC_EAP_TYPE_TTLS;
+       else if (g_str_equal(eap_type, "sim") == TRUE)
+               return WLAN_SEC_EAP_TYPE_SIM;
+       else if (g_str_equal(eap_type, "aka") == TRUE)
+               return WLAN_SEC_EAP_TYPE_AKA;
+       else
+               return WLAN_SEC_EAP_TYPE_PEAP;
+}
+
+static wlan_eap_auth_type_t __convert_eap_auth_from_string(const char *eap_auth)
+{
+       if (eap_auth == NULL)
+               return WLAN_SEC_EAP_AUTH_NONE;
+       else if (g_str_equal(eap_auth, "NONE") == TRUE)
+               return WLAN_SEC_EAP_AUTH_NONE;
+       else if (g_str_equal(eap_auth, "PAP") == TRUE)
+               return WLAN_SEC_EAP_AUTH_PAP;
+       else if (g_str_equal(eap_auth, "MSCHAP") == TRUE)
+               return WLAN_SEC_EAP_AUTH_MSCHAP;
+       else if (g_str_equal(eap_auth, "MSCHAPV2") == TRUE)
+               return WLAN_SEC_EAP_AUTH_MSCHAPV2;
+       else if (g_str_equal(eap_auth, "GTC") == TRUE)
+               return WLAN_SEC_EAP_AUTH_GTC;
+       else if (g_str_equal(eap_auth, "MD5") == TRUE)
+               return WLAN_SEC_EAP_AUTH_MD5;
+       else
+               return WLAN_SEC_EAP_AUTH_NONE;
+}
+
 static int __net_extract_wifi_info(DBusMessageIter *array, net_profile_info_t* ProfInfo)
 {
        __NETWORK_FUNC_ENTER__;
@@ -1190,6 +1298,62 @@ static int __net_extract_wifi_info(DBusMessageIter *array, net_profile_info_t* P
 
                        Wlan->frequency = (unsigned int)frequency;
 
+               } else if (g_str_equal(key, "EAP") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               Wlan->security_info.authentication.eap.eap_type =
+                                               __convert_eap_type_from_string(value);
+
+               } else if (g_str_equal(key, "Phase2") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               Wlan->security_info.authentication.eap.eap_auth =
+                                               __convert_eap_auth_from_string(value);
+
+               } else if (g_str_equal(key, "Identity") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.username,
+                                               value, NETPM_WLAN_USERNAME_LEN+1);
+
+               } else if (g_str_equal(key, "Password") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.password,
+                                               value, NETPM_WLAN_PASSWORD_LEN+1);
+
+               } else if (g_str_equal(key, "CACertFile") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.ca_cert_filename,
+                                               value, NETPM_WLAN_CA_CERT_FILENAME_LEN+1);
+
+               } else if (g_str_equal(key, "ClientCertFile") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.client_cert_filename,
+                                               value, NETPM_WLAN_CLIENT_CERT_FILENAME_LEN+1);
+
+               } else if (g_str_equal(key, "PrivateKeyFile") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.private_key_filename,
+                                               value, NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN+1);
+
+               } else if (g_str_equal(key, "PrivateKeyPassphrase") == TRUE) {
+                       dbus_message_iter_get_basic(&variant, &value);
+
+                       if (value != NULL)
+                               g_strlcpy(Wlan->security_info.authentication.eap.private_key_passwd,
+                                               value, NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN+1);
+
                } else {
                        __net_extract_common_info(key, &variant, ProfInfo);
                }
@@ -1206,7 +1370,7 @@ static int __net_extract_mobile_info(DBusMessageIter *array, net_profile_info_t*
 {
        net_err_t Error = NET_ERR_NONE;
 
-       __NETWORK_FUNC_ENTER__; 
+       __NETWORK_FUNC_ENTER__;
 
        while (dbus_message_iter_get_arg_type(array) == DBUS_TYPE_DICT_ENTRY) {
                DBusMessageIter entry, variant;
@@ -1303,6 +1467,32 @@ static int __net_extract_mobile_info(DBusMessageIter *array, net_profile_info_t*
        return Error;
 }
 
+static int __net_extract_ethernet_info(DBusMessageIter *array, net_profile_info_t* ProfInfo)
+{
+       net_err_t Error = NET_ERR_NONE;
+
+       __NETWORK_FUNC_ENTER__;
+
+       while (dbus_message_iter_get_arg_type(array) == DBUS_TYPE_DICT_ENTRY) {
+               DBusMessageIter entry, variant;
+               const char *key = NULL;
+
+               dbus_message_iter_recurse(array, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_recurse(&entry, &variant);
+
+               __net_extract_common_info(key, &variant, ProfInfo);
+
+               dbus_message_iter_next(array);
+       }
+
+       __NETWORK_FUNC_EXIT__;
+
+       return Error;
+}
+
 static int __net_extract_service_info(const char* ProfileName, DBusMessage *message, net_profile_info_t* ProfInfo)
 {
        __NETWORK_FUNC_ENTER__;
@@ -1330,6 +1520,8 @@ static int __net_extract_service_info(const char* ProfileName, DBusMessage *mess
                                profileType = NET_DEVICE_WIFI;
                        else if (strcmp(temp, "cellular") == 0)
                                profileType = NET_DEVICE_CELLULAR;
+                       else if (strcmp(temp, "ethernet") == 0)
+                               profileType = NET_DEVICE_ETHERNET;
 
                        break;
                }
@@ -1367,6 +1559,19 @@ static int __net_extract_service_info(const char* ProfileName, DBusMessage *mess
                                ProfileName, NET_PROFILE_NAME_LEN_MAX);
                
                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_EXCEPTION, "Error!!! Can't init profile\n");
+                       __NETWORK_FUNC_EXIT__;
+                       return Error;
+               }
+
+               ProfInfo->profile_type = NET_DEVICE_ETHERNET;
+               g_strlcpy(ProfInfo->ProfileName, ProfileName, NET_PROFILE_NAME_LEN_MAX);
+               g_strlcpy(ProfInfo->ProfileInfo.Ethernet.net_info.ProfileName,
+                               ProfileName, NET_PROFILE_NAME_LEN_MAX);
+
+               Error = __net_extract_ethernet_info(&array, ProfInfo);
        } else {
                NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Not supported profile type\n");
                __NETWORK_FUNC_EXIT__;
@@ -1390,66 +1595,48 @@ static int __net_get_profile_info(const char* ProfileName, net_profile_info_t* P
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
-       
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, ProfileName,
-                       CONNMAN_SERVICE_INTERFACE, "GetProperties", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, ProfileName,
+                       CONNMAN_SERVICE_INTERFACE, "GetProperties", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get service(profile) information\n");
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service(profile) information\n");
                goto done;
        }
 
        Error = __net_extract_service_info(ProfileName, message, ProfInfo);
-
-       dbus_message_unref(message); 
+       dbus_message_unref(message);
 done:
-       dbus_connection_unref(conn); 
-
        __NETWORK_FUNC_EXIT__;
 
        return Error;
 }
 
-
 static int __net_set_profile_property(char* path, char* key, char* value)
 {
        __NETWORK_FUNC_ENTER__;
        
        net_err_t Error = NET_ERR_NONE;
+       DBusMessage *message = NULL;
 
-       char request[] = CONNMAN_SERVICE_INTERFACE ".SetProperty";
-       char* param_array[] = {NULL, NULL, NULL, NULL, NULL};
-       
-       param_array[0] = path;
-       param_array[1] = request;
-       param_array[2] = key;
-       param_array[3] = value;
-
-       NETWORK_LOG(NETWORK_HIGH,  "Requesting [%s %s %s %s]\n",
-               param_array[0],
-               param_array[1],
-               param_array[2],
-               param_array[3]);
-       
-       Error = _net_send_dbus_request(CONNMAN_SERVICE, param_array, NULL);
-       if (Error != NET_ERR_NONE) {
-               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_send_dbus_request failed\n");
+       char* param_array[] = {NULL, NULL, NULL};
+
+       param_array[0] = key;
+       param_array[1] = value;
+
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, path,
+                       CONNMAN_SERVICE_INTERFACE, "SetProperty", param_array, &Error);
+
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_ERROR,  "Error!!! _net_invoke_dbus_method failed\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
 
+       dbus_message_unref(message);
        __NETWORK_FUNC_EXIT__;
+
        return NET_ERR_NONE;
 }
 
@@ -1566,30 +1753,18 @@ static int __net_wifi_delete_profile(net_profile_name_t* WifiProfName)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, WifiProfName->ProfileName,
-                       CONNMAN_SERVICE_INTERFACE, "Remove", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, WifiProfName->ProfileName,
+                       CONNMAN_SERVICE_INTERFACE, "Remove", NULL, &Error);
 
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to Remove service(profile)\n");
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to Remove service(profile)\n");
                goto done;
        }
 
        dbus_message_unref(message);
 done:
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
@@ -1650,23 +1825,13 @@ static int __net_telephony_delete_profile(net_profile_name_t* PdpProfName)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION, "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(TELEPHONY_SERVCE, conn, PdpProfName->ProfileName,
-                       TELEPHONY_PROFILE_INTERFACE, "RemoveProfile", &Error);
+       message = _net_invoke_dbus_method(TELEPHONY_SERVCE, 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, "Error!!! Failed to Remove service(profile)\n");
                goto done;
        }
 
@@ -1688,8 +1853,6 @@ static int __net_telephony_delete_profile(net_profile_name_t* PdpProfName)
        dbus_message_unref(message);
 
 done:
-       dbus_connection_unref(conn);
-
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
@@ -1731,6 +1894,8 @@ static int __net_extract_defult_device(DBusMessageIter* dict, net_device_t *devi
                                *device_type = NET_DEVICE_WIFI;
                        else if (strcmp(objPath, "cellular") == 0)
                                *device_type = NET_DEVICE_CELLULAR;
+                       else if (strcmp(objPath, "ethernet") == 0)
+                               *device_type = NET_DEVICE_ETHERNET;
 
                        break;
                }
@@ -1756,7 +1921,7 @@ static int __net_extract_defult_profile(DBusMessageIter* iter, net_profile_name_
        const char *objPath = NULL;
 
        if (iter == NULL || profile_name == NULL) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid prarameter \n");
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Invalid parameter \n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_INVALID_PARAM;
        }
@@ -1796,16 +1961,16 @@ static int __net_extract_defult_profile(DBusMessageIter* iter, net_profile_name_
                                dbus_message_iter_get_basic(&value, &objPath);
 
                                if (device_type == NET_DEVICE_CELLULAR &&
-                                   strstr(objPath, "/cellular_") != NULL) {
-
+                                               g_str_has_prefix(objPath, CONNMAN_CELLULAR_SERVICE_PROFILE_PREFIX) == TRUE) {
                                        suffix = strrchr(objPath, '_');
 
-                                       if (strcmp(suffix, net_suffix) == 0) {
+                                       if (strcmp(suffix, net_suffix) == 0)
                                                goto found;
-                                       }
-
                                } else if (device_type == NET_DEVICE_WIFI &&
-                                          strstr(objPath, "/wifi_") != NULL)
+                                               g_str_has_prefix(objPath, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE)
+                                       goto found;
+                               else if (device_type == NET_DEVICE_ETHERNET &&
+                                               g_str_has_prefix(objPath, CONNMAN_ETHERNET_SERVICE_PROFILE_PREFIX) == TRUE)
                                        goto found;
                                else
                                        break;
@@ -1837,7 +2002,7 @@ int _net_check_profile_name(const char* ProfileName)
 {
        __NETWORK_FUNC_ENTER__;
 
-       const char *profileHeader = "/profile/";
+       const char *profileHeader = CONNMAN_PATH"/service/";
        int i = 0;
        int stringLen = 0;
 
@@ -1872,23 +2037,12 @@ int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION,
-                               "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, CONNMAN_MANAGER_PATH,
-                       CONNMAN_MANAGER_INTERFACE, "GetProperties", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
+                       CONNMAN_MANAGER_INTERFACE, "GetProperties", NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get service(profile) list\n");
-               dbus_connection_unref(conn);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service(profile) list\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -1896,6 +2050,7 @@ int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile
        switch (device_type) {
        case NET_DEVICE_CELLULAR:
        case NET_DEVICE_WIFI:
+       case NET_DEVICE_ETHERNET:
                Error = __net_extract_services(message, device_type, profile_info, profile_count);
                break;
        default :
@@ -1904,9 +2059,7 @@ int _net_get_profile_list(net_device_t device_type, net_profile_info_t** profile
        }
 
        NETWORK_LOG(NETWORK_HIGH, "Error = %d\n", Error);
-
-       dbus_message_unref(message); 
-       dbus_connection_unref(conn); 
+       dbus_message_unref(message);
 
        __NETWORK_FUNC_EXIT__;
        return Error;
@@ -1917,26 +2070,15 @@ int _net_get_service_profile(net_service_type_t service_type, net_profile_name_t
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
        DBusMessageIter iter, dict;
        network_services_list_t service_info = {0,};
        int i = 0;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION,
-                               "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, CONNMAN_MANAGER_PATH,
-                       CONNMAN_MANAGER_INTERFACE, "GetProperties", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
+                       CONNMAN_MANAGER_INTERFACE, "GetProperties", NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get service(profile) list\n");
-               dbus_connection_unref(conn);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service(profile) list\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -1960,7 +2102,6 @@ int _net_get_service_profile(net_service_type_t service_type, net_profile_name_t
 
 done:
        dbus_message_unref(message);
-       dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
        return Error;
@@ -1971,26 +2112,15 @@ int _net_get_default_profile_info(net_profile_info_t *profile_info)
        __NETWORK_FUNC_ENTER__;
 
        net_err_t Error = NET_ERR_NONE;
-       DBusConnection* conn = NULL;
        DBusMessage *message = NULL;
        DBusMessageIter iter;
        net_profile_name_t profile_name;
        const char *prof_name = NULL;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-       if (conn == NULL) {
-               NETWORK_LOG(NETWORK_EXCEPTION,
-                               "Error!!! Can't get on system bus\n");
-               __NETWORK_FUNC_EXIT__;
-               return NET_ERR_UNKNOWN;
-       }
-
-       message = _net_invoke_dbus_method(CONNMAN_SERVICE, conn, CONNMAN_MANAGER_PATH,
-                       CONNMAN_MANAGER_INTERFACE, "GetProperties", &Error);
+       message = _net_invoke_dbus_method(CONNMAN_SERVICE, CONNMAN_MANAGER_PATH,
+                       CONNMAN_MANAGER_INTERFACE, "GetProperties", NULL, &Error);
        if (message == NULL) {
-               NETWORK_LOG(NETWORK_ERROR,
-                               "Error!!! Failed to get service(profile) list\n");
-               dbus_connection_unref(conn);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Failed to get service(profile) list\n");
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -2006,7 +2136,6 @@ int _net_get_default_profile_info(net_profile_info_t *profile_info)
 
 done:
        dbus_message_unref(message);
-       dbus_connection_unref(conn);
 
        __NETWORK_FUNC_EXIT__;
        return Error;
@@ -2023,7 +2152,7 @@ EXPORT_API int net_add_profile(net_service_type_t network_type, net_profile_info
        
        __NETWORK_FUNC_ENTER__;
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -2061,7 +2190,7 @@ EXPORT_API int net_delete_profile(const char* profile_name)
        net_profile_name_t wifi_prof_name;
        net_profile_info_t prof_info;
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -2128,7 +2257,7 @@ EXPORT_API int net_get_profile_info(const char *profile_name, net_profile_info_t
        
        net_err_t Error = NET_ERR_NONE;
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -2158,7 +2287,7 @@ EXPORT_API int net_modify_profile(const char* profile_name, net_profile_info_t*
        net_err_t Error = NET_ERR_NONE;
        net_profile_info_t exProfInfo;
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -2214,13 +2343,15 @@ EXPORT_API int net_get_profile_list(net_device_t device_type, net_profile_info_t
                return NET_ERR_INVALID_PARAM;
        }
        
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
        }       
 
-       if (device_type != NET_DEVICE_CELLULAR && device_type != NET_DEVICE_WIFI) {
+       if (device_type != NET_DEVICE_CELLULAR &&
+           device_type != NET_DEVICE_WIFI &&
+           device_type != NET_DEVICE_ETHERNET) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Not Supported\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NOT_SUPPORTED;
index 5dcb426..efb3714 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -60,6 +63,7 @@ static int __net_handle_wifi_power_rsp(const char *state);
 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
@@ -238,14 +242,12 @@ static int __net_handle_wifi_power_rsp(const char *state)
                event_data.Error = NET_ERR_NONE;
 
                if(request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE)
-                       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));
 
        } else if (strcmp(state, "enabled") == 0 && NetworkInfo.wifi_state != WIFI_ON) {
                NetworkInfo.wifi_state = WIFI_ON;
                wifi_state_flag = 1;
                event_data.Error = NET_ERR_NONE;
-               usleep(300000); /* This will be removed after connman upgrade */
        }
 
        if (wifi_state_flag != 0) {
@@ -257,6 +259,7 @@ static int __net_handle_wifi_power_rsp(const char *state)
                        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,
@@ -273,21 +276,47 @@ static int __net_handle_wifi_power_rsp(const char *state)
        return NET_ERR_NONE;
 }
 
+static int __net_handle_specific_scan_resp(GSList *bss_info_list)
+{
+       __NETWORK_FUNC_ENTER__;
+
+       net_event_info_t event_data = {0,};
+
+       if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
+               memset(&request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN],
+                               0, sizeof(network_request_table_t));
+
+               _net_dbus_clear_pending_call();
+
+               event_data.Event = NET_EVENT_SPECIFIC_SCAN_IND;
+               NETWORK_LOG(NETWORK_LOW,
+                               "Sending NET_EVENT_SPECIFIC_SCAN_IND  wifi state : %d\n",
+                               NetworkInfo.wifi_state);
+
+               NETWORK_LOG(NETWORK_LOW, "bss_info_list : 0x%x\n", bss_info_list);
+               event_data.Data = bss_info_list;
+               _net_client_callback(&event_data);
+       }
+
+       __NETWORK_FUNC_EXIT__;
+       return NET_ERR_NONE;
+}
+
 static int __net_svc_error_string_to_enum(const char *error)
 {
        if (strcmp(error, "out-of-range") == 0)
                return NET_ERR_CONNECTION_OUT_OF_RANGE;
-       else if(strcmp(error, "pin-missing") == 0)
+       else if (strcmp(error, "pin-missing") == 0)
                return NET_ERR_CONNECTION_PIN_MISSING;
-       else if(strcmp(error, "dhcp-failed") == 0)
+       else if (strcmp(error, "dhcp-failed") == 0)
                return NET_ERR_CONNECTION_DHCP_FAILED;
-       else if(strcmp(error, "connect-failed") == 0)
+       else if (strcmp(error, "connect-failed") == 0)
                return NET_ERR_CONNECTION_CONNECT_FAILED;
-       else if(strcmp(error, "login-failed") == 0)
+       else if (strcmp(error, "login-failed") == 0)
                return NET_ERR_CONNECTION_LOGIN_FAILED;
-       else if(strcmp(error, "auth-failed") == 0)
+       else if (strcmp(error, "auth-failed") == 0)
                return NET_ERR_CONNECTION_AUTH_FAILED;
-       else if(strcmp(error, "invalid-key") == 0)
+       else if (strcmp(error, "invalid-key") == 0)
                return NET_ERR_CONNECTION_INVALID_KEY;
 
        return NET_ERR_UNKNOWN;
@@ -304,13 +333,14 @@ static void __net_handle_svc_failure_ind(const char *profile_name, const char *s
        char *svc_name2 = request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].ProfileName;
 
        if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE &&
-           strcmp(profile_name, svc_name1) == 0) {
+           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) {
 
@@ -319,6 +349,7 @@ static void __net_handle_svc_failure_ind(const char *profile_name, const char *s
 
                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__;
@@ -361,6 +392,20 @@ static void __net_handle_state_ind(const char* profile_name, net_state_type_t pr
        __NETWORK_FUNC_EXIT__;
 }
 
+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 DBusHandlerResult
 __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
 {
@@ -382,139 +427,173 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
        net_err_t Error = NET_ERR_NONE;
        net_device_t device_type = NET_DEVICE_UNKNOWN;
        
-       if(msg == NULL)
-       {
-               NETWORK_LOG( NETWORK_LOW, "Invalid Message. Ignore\n");
+       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 (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE, CONNMAN_SIGNAL_PROPERTY_CHANGED))
-       {
+
+       if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE, CONNMAN_SIGNAL_PROPERTY_CHANGED)) {
                sigvalue = _net_get_string(msg);
-               if(sigvalue == NULL)
-               {
+               if (sigvalue == 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] Got Signal with value [%s]\n", sigvalue);
 
-               if(strcmp(sigvalue, "Services") == 0)
-               {
+               NETWORK_LOG(NETWORK_LOW, "[Manager : PropertyChanged] Got Signal with value [%s]\n", sigvalue);
+
+               if (strcmp(sigvalue, "Services") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "ConnectedTechnologies") == 0)
-               {
+               } else if (strcmp(sigvalue, "ConnectedTechnologies") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "State") == 0)
-               {
+               } else if (strcmp(sigvalue, "State") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "DefaultTechnology") == 0)
-               {
+               } else if (strcmp(sigvalue, "DefaultTechnology") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else
-               {
-                       NETWORK_LOG( NETWORK_LOW, "-------[Manager : PropertyChanged]--------\n");
+               } else {
+                       NETWORK_LOG(NETWORK_LOW, "-------[Manager : PropertyChanged]--------\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_MANAGER_INTERFACE, CONNMAN_SIGNAL_STATE_CHANGED))
-       {
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE, CONNMAN_SIGNAL_STATE_CHANGED)) {
                sigvalue = _net_get_string(msg);
-               if(sigvalue == NULL)
-               {
+               if (sigvalue == NULL) {
                        /* We have handled this message, don't pass it on */
                        __NETWORK_FUNC_EXIT__;
                        return DBUS_HANDLER_RESULT_HANDLED;
                }
-               NETWORK_LOG( NETWORK_LOW, "[Manager : StateChanged] Got Signal with value [%s]\n", sigvalue);
 
-               if(strcmp(sigvalue, "online") == 0)
-               {
+               NETWORK_LOG(NETWORK_LOW, "[Manager : StateChanged] Got Signal with value [%s]\n", sigvalue);
+
+               if (strcmp(sigvalue, "online") == 0) {
                        /** Ignore - compared for future use */
                }
 
                /* 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_SCAN_COMPLETED))
-       {
+       } else if (dbus_message_is_signal(msg, CONNMAN_MANAGER_INTERFACE, CONNMAN_SIGNAL_SCAN_COMPLETED)) {
                __net_handle_scan_rsp(msg);
 
                /* 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))
-       {
+       } else if (dbus_message_is_signal(msg, NETCONFIG_WIFI_INTERFACE, NETCONFIG_SIGNAL_POWERON_COMPLETED)) {
+               __net_handle_wifi_power_rsp("enabled");
+
+               /* 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("offline");
+
+               /* 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;
+                       }
+                       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);
+
+               /* 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)) {
                char* property = NULL;
 
                sigvalue = __net_get_property(msg, &property);
-               if(sigvalue == NULL)
-               {
+               if (sigvalue == NULL) {
                        /* We have handled this message, don't pass it on */
                        __NETWORK_FUNC_EXIT__;
                        return DBUS_HANDLER_RESULT_HANDLED;
                }
-               
+
                memset(ProfileName, 0, sizeof(ProfileName));
                _net_get_path(msg, ProfileName);
 
-               NETWORK_LOG( NETWORK_LOW,
+               NETWORK_LOG(NETWORK_LOW,
                                "[Technology : PropertyChanged] Got Signal with value [%s] path [%s] state [%s]\n",
                                sigvalue, ProfileName, property);
 
-               if(strstr(ProfileName, "/wifi") == NULL)
-               {
-                       __NETWORK_FUNC_EXIT__;
-                       return DBUS_HANDLER_RESULT_HANDLED;
-               }
-
-               if(strcmp(sigvalue, "State") == 0 && property != NULL)
-               {
-                       __net_handle_wifi_power_rsp(property);
-               }
                /* 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))
-       {
+       } else if (dbus_message_is_signal(msg, CONNMAN_SERVICE_INTERFACE, CONNMAN_SIGNAL_PROPERTY_CHANGED)) {
                sigvalue = _net_get_string(msg);
-               if(sigvalue == NULL)
-               {
+               if (sigvalue == NULL) {
                        /* We have handled this message, don't pass it on */
                        __NETWORK_FUNC_EXIT__;
                        return DBUS_HANDLER_RESULT_HANDLED;
                }
-               NETWORK_LOG( NETWORK_LOW, "[Service : PropertyChanged] Got Signal with value [%s]\n", sigvalue);
 
-               if(strcmp(sigvalue, "Strength") == 0)
-               {
-                       /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "PassphraseRequired") == 0)
-               {
+               if(strcmp(sigvalue, "Strength") != 0) /** Ignore Strength signal */
+                       NETWORK_LOG(NETWORK_LOW, "[Service : PropertyChanged] Got Signal with value [%s]\n", sigvalue);
+
+               if (strcmp(sigvalue, "PassphraseRequired") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "State") == 0)
-               {
+               } else if (strcmp(sigvalue, "State") == 0) {
                        memset(ProfileName, 0, sizeof(ProfileName));
                        _net_get_path(msg, ProfileName);
 
                        device_type = _net_get_tech_type_from_path(ProfileName);
 
-                       if(device_type == NET_DEVICE_UNKNOWN)
-                       {
+                       if (device_type == NET_DEVICE_UNKNOWN) {
                                /* We have handled this message, don't pass it on */
                                __NETWORK_FUNC_EXIT__;
                                return DBUS_HANDLER_RESULT_HANDLED;
@@ -529,71 +608,57 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
                                        svc_state, svc_error, ProfileName);
 
                        if (device_type == NET_DEVICE_WIFI &&
-                           NetworkInfo.wifi_state == WIFI_OFF) {
+                                       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;;
                        }
-               
-                       if(strcmp(svc_state, "idle") == 0)
-                       {
+
+                       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)
-                       {
+                       } 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)
-                       {
+                       } 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)
-                               {
+                       } 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 &&
-                                          strcmp(sig_path, svc_name1) == 0)
-                                       {
+
+                                       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");
-                                       }
-                                       else if(request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE &&
-                                          strcmp(sig_path, svc_name2) == 0)
-                                       {
+                                               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");
-                                       }
-                                       else
-                                       {
+                                               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");
+                                               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",
+                                       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
-                                       {
+                                       } else {
                                                event_data.Datalength = sizeof(net_profile_info_t);
                                                event_data.Data = &prof_info;
                                        }
@@ -602,9 +667,7 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
                                        snprintf(event_data.ProfileName, NET_PROFILE_NAME_LEN_MAX + 1, "%s", ProfileName);
                                        open_connection_rsp_sent = TRUE;
                                        _net_client_callback(&event_data);
-                               }
-                               else
-                               {
+                               } else {
                                        if (strcmp(svc_state, "ready") == 0)
                                                __net_handle_state_ind(ProfileName, NET_STATE_TYPE_READY);
                                        else
@@ -615,16 +678,13 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
                                        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)
-                       {
+                       } 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 &&
-                                  strcmp(sig_path, svc_name2) == 0)
-                               {
+                               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));
 
@@ -636,12 +696,11 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
 
                                        event_data.Datalength = 0;
                                        event_data.Data = NULL;
-                                       NETWORK_LOG( NETWORK_LOW, "Sending NET_EVENT_OPEN_RSP\n");
+                                       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)
-                               {
+                               } 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));
 
@@ -653,13 +712,12 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
 
                                        event_data.Datalength = 0;
                                        event_data.Data = NULL;
-                                       NETWORK_LOG( NETWORK_LOW, "Sending NET_EVENT_WIFI_WPS_RSP\n");
+                                       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, 
+                               } 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 */
@@ -670,12 +728,10 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
 
                                        event_data.Datalength = 0;
                                        event_data.Data = NULL;
-                                       NETWORK_LOG( NETWORK_LOW, "Sending NET_EVENT_CLOSE_RSP\n");
+                                       NETWORK_LOG(NETWORK_LOW, "Sending NET_EVENT_CLOSE_RSP\n");
+                                       _net_dbus_clear_pending_call();
                                        _net_client_callback(&event_data);
-
-                               }
-                               else
-                               {
+                               } else {
                                        /** Send Close Ind */
                                        event_data.Error = Error;
                                        event_data.Event =  NET_EVENT_CLOSE_IND;
@@ -684,44 +740,30 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
 
                                        event_data.Datalength = 0;
                                        event_data.Data = NULL;
-                                       NETWORK_LOG( NETWORK_LOW, "Sending NET_EVENT_CLOSE_IND\n");
+                                       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)
-                       {
+                       } 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(sigvalue, "Nameservers") == 0)
-               {
+               } else if (strcmp(sigvalue, "Nameservers") == 0) {
                        /* We have handled this message, don't pass it on */
                        __NETWORK_FUNC_EXIT__;
                        return DBUS_HANDLER_RESULT_HANDLED;
-               }
-               else if(strcmp(sigvalue, "IPv4") == 0)
-               {
+               } else if (strcmp(sigvalue, "IPv4") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "Ethernet") == 0)
-               {
+               } else if (strcmp(sigvalue, "Ethernet") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "Domains") == 0)
-               {
+               } else if (strcmp(sigvalue, "Domains") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else if(strcmp(sigvalue, "IPv4.Configuration") == 0)
-               {
+               } else if (strcmp(sigvalue, "IPv4.Configuration") == 0) {
                        /** Ignore - compared for future use */
-               }
-               else
-               {
+               } else {
                        /** Ignore - compared for future use */
                }
 
@@ -730,20 +772,26 @@ __net_signal_filter (DBusConnection* conn, DBusMessage* msg, void* user_data)
                return DBUS_HANDLER_RESULT_HANDLED;
        }
 
-       if (dbus_message_is_signal(msg, CONNMAN_COUNTER_INTERFACE, "Usage"))
-       {
-               NETWORK_LOG( NETWORK_LOW, "Received [COUNTER_USAGE_SIGNAL] signal from modman\n");
-       }
-       else if (dbus_message_is_signal(msg, CONNMAN_COUNTER_INTERFACE, "Release"))
-       {
-               NETWORK_LOG( NETWORK_LOW, "Received [COUNTER_RELEASE_SIGNAL] signal from modman\n");
+       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");
        }
 
-       NETWORK_LOG( NETWORK_LOW, "Useless signal. Ignored !!!\n");
+       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;
+       }
+}
+
 /*****************************************************************************
  *     Global Functions
  *****************************************************************************/
@@ -752,37 +800,85 @@ int _net_deregister_signal(void)
 {
        __NETWORK_FUNC_ENTER__;
 
+       DBusError err;
+       dbus_error_init(&err);
+
        if (signal_conn == NULL) {
                NETWORK_LOG(NETWORK_HIGH, "Already de-registered. Nothing to be done\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_NONE;
        }
 
+       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);
+               dbus_error_free(&err);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
+       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);
+               dbus_error_free(&err);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
+       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);
+               dbus_error_free(&err);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
+       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);
+               dbus_error_free(&err);
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_UNKNOWN;
+       }
+
        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");
 
        /* If DBusPendingCall remains, it should be released */
-       if (_net_dbus_is_pending_call_used() == TRUE)
-       {
-               dbus_pending_call_cancel(_net_dbus_get_pending_call());
-               _net_dbus_set_pending_call(NULL);
-               _net_dbus_set_pending_call_used(FALSE);
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               _net_dbus_clear_pending_call();
                NETWORK_LOG(NETWORK_HIGH, "DBus pending call successfully removed\n");
        }
 
        dbus_connection_unref(signal_conn);
        signal_conn = NULL;
+
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
 
 int _net_register_signal(void)
 {
+       __NETWORK_FUNC_ENTER__;
+
        DBusConnection* conn = NULL;
        DBusError err;
 
-       __NETWORK_FUNC_ENTER__;
+       __net_init_dbus_thread();
 
        dbus_error_init(&err);
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 
@@ -802,7 +898,7 @@ int _net_register_signal(void)
        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!!! Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -811,7 +907,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!!! Match Error (%s)\n", err.message);
+               NETWORK_LOG(NETWORK_ERROR, "Error!!! Add Match Error (%s)\n", err.message);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -820,16 +916,25 @@ 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!!! Match Error (%s)\n", err.message);
+               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_bus_add_match(conn, CONNMAN_NETWORK_COUNTER_FILTER, &err);
        dbus_connection_flush(conn);
        if (dbus_error_is_set(&err)) {
-               NETWORK_LOG(NETWORK_ERROR, "Error!!! Match Error (%s)\n", err.message);
+               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, 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);
                dbus_error_free(&err);
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_UNKNOWN;
@@ -842,6 +947,7 @@ int _net_register_signal(void)
        }
        
        NETWORK_LOG(NETWORK_LOW, "Successfully set signal filter rules\n");
+
        __NETWORK_FUNC_EXIT__;
        return NET_ERR_NONE;
 }
@@ -853,7 +959,7 @@ int _net_init_service_state_table(void)
        net_err_t Error = NET_ERR_NONE;
        net_cm_network_status_t network_status;
 
-       Error = net_get_network_status(NET_DEVICE_WIFI, &network_status);
+       Error = _net_dbus_get_network_status(NET_DEVICE_WIFI, &network_status);
        if (Error != NET_ERR_NONE) {
                __NETWORK_FUNC_EXIT__;
                return Error;
@@ -862,7 +968,7 @@ int _net_init_service_state_table(void)
        if (network_status == NET_STATUS_AVAILABLE)
                service_state_table[NET_DEVICE_WIFI] = NET_STATE_TYPE_READY;
 
-       Error = net_get_network_status(NET_DEVICE_CELLULAR, &network_status);
+       Error = _net_dbus_get_network_status(NET_DEVICE_CELLULAR, &network_status);
        if (Error != NET_ERR_NONE) {
                __NETWORK_FUNC_EXIT__;
                return Error;
index 8e2f260..502d225 100644 (file)
@@ -1,17 +1,20 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
 
@@ -129,6 +132,56 @@ 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__;
+
+       net_err_t Error = NET_ERR_NONE;
+
+       if (ssid == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "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_FUNC_EXIT__;
+               return NET_ERR_APP_NOT_REGISTERED;
+       }
+
+       if (request_table[NETWORK_REQUEST_TYPE_SPECIFIC_SCAN].flag == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! Find hidden AP request already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already 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_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",
+                               _net_print_error(Error));
+
+               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__;
@@ -141,22 +194,38 @@ EXPORT_API int net_open_connection_with_wifi_info(const net_wifi_connection_info
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was 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_ASSERT, "Error!! Connection open request already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already 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_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",
                                _net_print_error(Error));
+
+               memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION], 0, sizeof(network_request_table_t));
+
                __NETWORK_FUNC_EXIT__;
                return Error;
        }
@@ -173,7 +242,7 @@ EXPORT_API int net_wifi_power_on(void)
        net_err_t Error = NET_ERR_NONE;
        int hotspot_state = 0;
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -195,13 +264,19 @@ EXPORT_API int net_wifi_power_on(void)
        if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
                NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+               __NETWORK_FUNC_EXIT__;
+               return NET_ERR_IN_PROGRESS;
        }
 
        request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag = TRUE;
 
        Error = _net_dbus_load_wifi_driver();
-       if (Error != NET_ERR_NONE ) {
+       if (Error != NET_ERR_NONE) {
                NETWORK_LOG(NETWORK_EXCEPTION,
                                "Error!!! Failed to request wifi power on/off. Error [%s]\n",
                                _net_print_error(Error));
@@ -221,7 +296,7 @@ EXPORT_API int net_wifi_power_off(void)
 
        net_err_t Error = NET_ERR_NONE;
 
-       if(NetworkInfo.ClientEventCb == NULL) {
+       if(g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -236,7 +311,27 @@ EXPORT_API int net_wifi_power_off(void)
        if (request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag == TRUE) {
                NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
+       }
+
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               if (request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION].flag == TRUE) {
+                       _net_dbus_clear_pending_call();
+                       memset(&request_table[NETWORK_REQUEST_TYPE_OPEN_CONNECTION],
+                                                       0, sizeof(network_request_table_t));
+               } else if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE) {
+                       _net_dbus_clear_pending_call();
+                       memset(&request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS],
+                                                       0, sizeof(network_request_table_t));
+               } else if (request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION].flag == TRUE) {
+                       _net_dbus_clear_pending_call();
+                       memset(&request_table[NETWORK_REQUEST_TYPE_CLOSE_CONNECTION],
+                                                       0, sizeof(network_request_table_t));
+               } else {
+                       NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already in progress\n");
+                       __NETWORK_FUNC_EXIT__;
+                       return NET_ERR_IN_PROGRESS;
+               }
        }
 
        request_table[NETWORK_REQUEST_TYPE_WIFI_POWER].flag = TRUE;
@@ -264,7 +359,7 @@ EXPORT_API int net_scan_wifi(void)
 
        net_err_t Error = NET_ERR_NONE;
 
-       if(NetworkInfo.ClientEventCb == NULL) {
+       if(g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -273,7 +368,7 @@ EXPORT_API int net_scan_wifi(void)
        if(request_table[NETWORK_REQUEST_TYPE_SCAN].flag == TRUE) {
                NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
        }
 
        if (_net_get_wifi_state() != WIFI_ON) {
@@ -312,24 +407,30 @@ EXPORT_API int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t
                return NET_ERR_INVALID_PARAM;
        }
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was 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");
+       if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
                __NETWORK_FUNC_EXIT__;
-               return NET_ERR_INVALID_OPERATION;
+               return NET_ERR_IN_PROGRESS;
        }
 
-       if (request_table[NETWORK_REQUEST_TYPE_ENROLL_WPS].flag == TRUE) {
-               NETWORK_LOG(NETWORK_ASSERT, "Error!! Request already in progress\n");
+       if (_net_dbus_is_pending_call_used() == TRUE) {
+               NETWORK_LOG(NETWORK_ASSERT, "Error!! pending call already 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_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);
@@ -360,6 +461,7 @@ EXPORT_API int net_wifi_enroll_wps(const char *profile_name, net_wifi_wps_info_t
        return NET_ERR_NONE;
 }
 
+
 /*****************************************************************************
  *     ConnMan Wi-Fi Client Interface Sync Function Definition
  *****************************************************************************/
@@ -371,7 +473,7 @@ EXPORT_API int net_get_wifi_state(net_wifi_state_t *current_state, net_profile_n
 
        net_wifi_state_t wifi_state;
 
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application was not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -408,7 +510,7 @@ EXPORT_API int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t
 
        net_err_t Error = NET_ERR_NONE;
                
-       if (NetworkInfo.ClientEventCb == NULL) {
+       if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
                NETWORK_LOG(NETWORK_ERROR, "Error!!! Application not registered\n");
                __NETWORK_FUNC_EXIT__;
                return NET_ERR_APP_NOT_REGISTERED;
@@ -437,7 +539,6 @@ EXPORT_API int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_t
        return NET_ERR_NONE;
 }
 
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 7b02dbb..9eaa6b7 100755 (executable)
@@ -2,5 +2,5 @@
 
 rm -f network_client
 
-gcc -Wall -g -O2 -o ./network_client ./main.c `pkg-config dbus-1 glib-2.0 dbus-glib-1 network --cflags --libs` 
+gcc -Wall -g -O2 -o ./network_client ./main.c `pkg-config glib-2.0 dbus-glib-1 gthread-2.0 network --cflags --libs` 
 
index 54c7eac..4c1846e 100644 (file)
@@ -1,20 +1,23 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ *  Network Client Library
  *
- * 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://www.tizenopensource.org/license
+* Copyright 2012  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://www.tizenopensource.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.
+* See the License for the specific language governing permissions and
+* limitations under the 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
  */
 
-
 #ifdef HAVE_CONFIG_H 
 #include <config.h> 
 #endif 
@@ -70,6 +73,7 @@ static void __network_print_profile(net_profile_info_t* ProfInfo, profile_print_
 {
        net_pdp_profile_info_t *pdp_info = &ProfInfo->ProfileInfo.Pdp;
        net_wifi_profile_info_t *wlan_info = &ProfInfo->ProfileInfo.Wlan;
+       net_eth_profile_info_t *eth_info = &ProfInfo->ProfileInfo.Ethernet;
 
        int di = 0;
        unsigned char *ipaddr;
@@ -87,6 +91,11 @@ static void __network_print_profile(net_profile_info_t* ProfInfo, profile_print_
                netmaskaddr = (unsigned char *)&pdp_info->net_info.SubnetMask.Data.Ipv4.s_addr;
                gwaddr = (unsigned char *)&pdp_info->net_info.GatewayAddr.Data.Ipv4.s_addr;
                net_info = &(pdp_info->net_info);
+       } else if (ProfInfo->profile_type == NET_DEVICE_ETHERNET) {
+               ipaddr = (unsigned char *)&eth_info->net_info.IpAddr.Data.Ipv4.s_addr;
+               netmaskaddr = (unsigned char *)&eth_info->net_info.SubnetMask.Data.Ipv4.s_addr;
+               gwaddr = (unsigned char *)&eth_info->net_info.GatewayAddr.Data.Ipv4.s_addr;
+               net_info = &(eth_info->net_info);
        } else {
                debug_print("Error!!! Invalid profile type\n");
                return ;
@@ -187,6 +196,8 @@ static void __network_print_profile(net_profile_info_t* ProfInfo, profile_print_
                        debug_print("Profile Setup Required = [%d]\n",
                                        (int)pdp_info->SetupRequired);
                }
+       } else if (ProfInfo->profile_type == NET_DEVICE_ETHERNET) {
+               debug_print("Profile Type = [ethernet]\n");
        }
 
        if (print_type == PROFILE_FULL_INFO) {
@@ -1142,7 +1153,7 @@ static gpointer network_main_gthread(gpointer data)
                        break;
 
                case 'd':
-                       debug_print("\nInput profile type - 1:wifi, 2:mobile (Enter for skip):\n");
+                       debug_print("\nInput profile type - 1:wifi, 2:mobile 3:ethernet(Enter for skip):\n");
                        memset(input_str, 0, 100);
                        read(0, input_str, 100);
 
@@ -1160,6 +1171,8 @@ static gpointer network_main_gthread(gpointer data)
                                        deviceType = NET_DEVICE_WIFI;
                                else if (strcmp(input_str, "2") == 0)
                                        deviceType = NET_DEVICE_CELLULAR;
+                               else if (strcmp(input_str, "3") == 0)
+                                       deviceType = NET_DEVICE_ETHERNET;
 
                                net_error = net_get_profile_list(deviceType,
                                                &profList, &profListCount);
@@ -1309,7 +1322,7 @@ static gpointer network_main_gthread(gpointer data)
                case 'i': {
                        net_wifi_connection_info_t wifi_info = {{0,}, };
 
-                       debug_print("Enter essid: \n");
+                       debug_print("Enter essid:\n");
                        scanf("%s", wifi_info.essid);
 
                        wifi_info.wlan_mode = NETPM_WLAN_CONNMODE_INFRA;
@@ -1350,7 +1363,7 @@ static gpointer 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("Error!! net_wifi_enroll_wps() failed.\n");
                                break;
                        }
 
@@ -1363,17 +1376,42 @@ static gpointer network_main_gthread(gpointer data)
                        break;
 
                case 'l': {
+                       int eap_type = 0;
+                       int eap_auth = 0;
                        net_wifi_connection_info_t info;
                        memset(&info, 0, sizeof(net_wifi_connection_info_t));
 
                        info.wlan_mode = NETPM_WLAN_CONNMODE_INFRA;
                        info.security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
-                       memcpy(info.essid,  "test01", strlen("test01")+1);
 
-                       info.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_TLS;
-                       info.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_MSCHAP;
-                       memcpy(info.security_info.authentication.eap.username, "test01", strlen("test01")+1);
-                       memcpy(info.security_info.authentication.eap.password, "test01", strlen("test01")+1);
+                       debug_print("Enter essid:\n");
+                       scanf("%s", info.essid);
+
+                       debug_print("Enter EAP type PEAP 1, TLS 2, TTLS 3, SIM 4, AKA 5:\n");
+                       scanf("%d", &eap_type);
+                       info.security_info.authentication.eap.eap_type = (wlan_eap_type_t) eap_type;
+
+                       debug_print("Enter EAP auth None 1, PAP 2, MSCHAP 3, MSCHAPV2 4, GTC 5, MD5 6:\n");
+                       scanf("%d", &eap_auth);
+                       info.security_info.authentication.eap.eap_auth = (wlan_eap_auth_type_t) eap_auth;
+
+                       debug_print("Enter user name:\n");
+                       scanf("%s", info.security_info.authentication.eap.username);
+
+                       debug_print("Enter password:\n");
+                       scanf("%s", info.security_info.authentication.eap.password);
+
+                       debug_print("Enter CA Cert filename:\n");
+                       scanf("%s", info.security_info.authentication.eap.ca_cert_filename);
+
+                       debug_print("Enter Client Cert filename:\n");
+                       scanf("%s", info.security_info.authentication.eap.client_cert_filename);
+
+                       debug_print("Enter private key filename:\n");
+                       scanf("%s", info.security_info.authentication.eap.private_key_filename);
+
+                       debug_print("Enter private key password:\n");
+                       scanf("%s", info.security_info.authentication.eap.private_key_passwd);
 
                        net_open_connection_with_wifi_info(&info);
                }