Release TIZEN 2.0 beta 2.0alpha master 2.0_alpha submit/master/20120920.151035
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 21 Aug 2012 12:11:58 +0000 (21:11 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 21 Aug 2012 12:11:58 +0000 (21:11 +0900)
18 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
capi-network-wifi.pc.in [new file with mode: 0644]
debian/capi-network-wifi-dev.install [new file with mode: 0644]
debian/capi-network-wifi.install [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/net_wifi_private.h [new file with mode: 0644]
include/wifi.h [new file with mode: 0644]
packaging/capi-network-wifi.spec [new file with mode: 0644]
src/libnetwork.c [new file with mode: 0755]
src/net_wifi.c [new file with mode: 0755]
src/net_wifi_ap.c [new file with mode: 0755]
test/CMakeLists.txt [new file with mode: 0644]
test/wifi_test.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..ee5aeac
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+JaeHyun Kim <jeik01.kim@samsung.com>
+ByungWoo Lee <bw1212.lee@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bfff87f
--- /dev/null
@@ -0,0 +1,96 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-network-wifi")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog vconf capi-base-common glib-2.0 network")
+SET(pc_dependents "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     VERSION ${FULLVER}
+     SOVERSION ${MAJORVER}
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/network
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+ADD_SUBDIRECTORY(test)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+        DEPENDS clean
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    .
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM
+)
+
+ENDIF(UNIX)
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..a06208b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/capi-network-wifi.pc.in b/capi-network-wifi.pc.in
new file mode 100644 (file)
index 0000000..127da21
--- /dev/null
@@ -0,0 +1,14 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/network
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/debian/capi-network-wifi-dev.install b/debian/capi-network-wifi-dev.install
new file mode 100644 (file)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-network-wifi.install b/debian/capi-network-wifi.install
new file mode 100644 (file)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..30b7a6b
--- /dev/null
@@ -0,0 +1,31 @@
+capi-network-wifi (0.1.1-2) unstable; urgency=low
+
+  * Ad UTC files
+  * Git: api/wifi
+  * Tag: capi-network-wifi_0.1.1-2
+
+ -- JaeHyun Kim <jeik01.kim@samsung.com>  Wed, 04 Jul 2012 11:41:10 +0900
+
+capi-network-wifi (0.1.1-1) unstable; urgency=low
+
+  * Add AP initialization functions for user creation
+  * Git: api/wifi
+  * Tag: capi-network-wifi_0.1.1-1
+
+ -- JaeHyun Kim <jeik01.kim@samsung.com>  Mon, 02 Jul 2012 11:01:10 +0900
+
+capi-network-wifi (0.1.1-0) unstable; urgency=low
+
+  * Package implementation
+  * Git: api/wifi
+  * Tag: capi-network-wifi_0.1.1-0
+
+ -- JaeHyun Kim <jeik01.kim@samsung.com>  Mon, 21 May 2012 19:31:01 +0900
+
+capi-network-wifi (0.1.0-1) unstable; urgency=low
+
+  * Initial Upload
+  * Git: api/wifi
+  * Tag: capi-network-wifi_0.1.0-1
+
+ -- JaeHyun Kim <jeik01.kim@samsung.com>  Mon, 09 Apr 2012 20:54:57 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..7fb1ee7
--- /dev/null
@@ -0,0 +1,21 @@
+Source: capi-network-wifi
+Section: libs
+Priority: extra
+Maintainer: JaeHyun Kim <jeik01.kim@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev, libglib2.0-dev, libdbus-glib-1-dev, libnetwork-dev
+
+Package: capi-network-wifi
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Network Wi-Fi library in TIZEN C API
+
+Package: capi-network-wifi-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version}), capi-base-common-dev
+Description: Network Wi-Fi library in TIZEN C API (DEV)
+
+Package: capi-network-wifi-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version})
+Description: Network Wi-Fi library in TIZEN C API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..3ae0922
--- /dev/null
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f `find . -name *.pc`
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-network-wifi-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/include/net_wifi_private.h b/include/net_wifi_private.h
new file mode 100644 (file)
index 0000000..0f4fc9c
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef __NET_CONNECTION_PRIVATE_H__        /* To prevent inclusion of a header file twice */
+#define __NET_CONNECTION_PRIVATE_H__
+
+#include <dlog.h>
+#include <network-cm-intf.h>
+#include <network-wifi-intf.h>
+#include "wifi.h"
+
+#define TIZEN_NET_CONNECTION "net_wifi"
+
+#define WIFI_INFO      LOG_VERBOSE
+#define WIFI_ERROR     LOG_ERROR
+#define WIFI_WARN      LOG_WARN
+
+#define WIFI_LOG(log_level, format, args...) \
+       SLOG(log_level,TIZEN_NET_CONNECTION, "[%s][Ln: %d] " format, __FILE__, __LINE__, ##args)
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+bool _wifi_libnet_init(void);
+bool _wifi_libnet_deinit(void);
+int _wifi_activate(void);
+int _wifi_deactivate(void);
+
+bool _wifi_libnet_check_ap_validity(wifi_ap_h ap_h);
+void _wifi_libnet_add_to_ap_list(wifi_ap_h ap_h);
+void _wifi_libnet_remove_from_ap_list(wifi_ap_h ap_h);
+bool _wifi_libnet_check_profile_name_validity(const char *profile_name);
+
+bool _wifi_libnet_get_wifi_state(wifi_connection_state_e* connection_state);
+int _wifi_libnet_get_intf_name(char** name);
+int _wifi_libnet_scan_request(wifi_scan_finished_cb callback, void* user_data);
+int _wifi_libnet_get_connected_profile(wifi_ap_h *ap);
+bool _wifi_libnet_foreach_found_aps(wifi_found_ap_cb callback, void *user_data);
+
+int _wifi_libnet_open_profile(wifi_ap_h ap_h);
+int _wifi_libnet_close_profile(wifi_ap_h ap_h);
+int _wifi_libnet_connect_with_wps(wifi_ap_h ap_h, wifi_wps_type_e type, const char *pin);
+
+int _wifi_set_power_on_off_cb(wifi_device_state_changed_cb callback, void *user_data);
+int _wifi_unset_power_on_off_cb(void);
+int _wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void *user_data);
+int _wifi_unset_background_scan_cb(void);
+int _wifi_set_connection_state_cb(wifi_connection_state_changed_cb callback, void *user_data);
+int _wifi_unset_connection_state_cb();
+
+int _wifi_update_ap_info(net_profile_info_t *ap_info);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/include/wifi.h b/include/wifi.h
new file mode 100644 (file)
index 0000000..5c132e8
--- /dev/null
@@ -0,0 +1,1076 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_NETWORK_WIFI_H__
+#define __TIZEN_NETWORK_WIFI_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_MODULE
+* @{
+*/
+
+/**
+* @brief The Wi-Fi error type
+*/
+typedef enum
+{
+    WIFI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+    WIFI_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+    WIFI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
+    WIFI_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+    WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
+    WIFI_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0301, /**< Operation failed */
+    WIFI_ERROR_NO_CONNECTION = TIZEN_ERROR_NETWORK_CLASS|0x0302, /**< There is no connected AP */
+} wifi_error_e;
+
+/**
+* @brief The state of Wi-Fi connection
+*/
+typedef enum
+{
+    WIFI_CONNECTION_STATE_CONNECTING = 0,  /**< Trying to connect(association/configuration) */
+    WIFI_CONNECTION_STATE_CONNECTED = 1,  /**< Wi-Fi is connected to an AP(ready/online) */
+    WIFI_CONNECTION_STATE_DISCONNECTING = 2,  /**< Trying to disconnect(connected, but disconnecting process is on going) */
+    WIFI_CONNECTION_STATE_DISCONNECTED = 3,  /**< Wi-Fi is disconnected */
+} wifi_connection_state_e;
+
+/**
+* @brief The WPS(Wi-Fi Protected Setup) type
+*/
+typedef enum
+{
+    WIFI_WPS_TYPE_PBC = 0,  /**< PBC */
+    WIFI_WPS_TYPE_PIN = 1,   /**< PIN */
+} wifi_wps_type_e;
+
+/**
+* @brief The state of Wi-Fi device
+*/
+typedef enum
+{
+    WIFI_DEVICE_STATE_DEACTIVATED = 0,  /**< Wi-Fi is Deactivated */
+    WIFI_DEVICE_STATE_ACTIVATED = 1,  /**< Wi-Fi is activated */
+} wifi_device_state_e;
+
+/**
+* @brief The RSSI level
+*/
+typedef enum
+{
+    WIFI_RSSI_LEVEL_0 = 0,  /**< level 0 */
+    WIFI_RSSI_LEVEL_1 = 1,  /**< level 1 */
+    WIFI_RSSI_LEVEL_2 = 2,  /**< level 2 */
+    WIFI_RSSI_LEVEL_3 = 3,  /**< level 3 */
+    WIFI_RSSI_LEVEL_4 = 4,  /**< level 4 */
+} wifi_rssi_level_e;
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_NETWORK_MODULE
+* @{
+*/
+
+/**
+* @brief Net IP configuration Type
+*/
+typedef enum
+{
+    WIFI_IP_CONFIG_TYPE_NONE = 0,  /**< Not defined */
+    WIFI_IP_CONFIG_TYPE_STATIC  = 1,  /**< Manual IP configuration */
+    WIFI_IP_CONFIG_TYPE_DYNAMIC = 2,  /**< Config IP using DHCP client*/
+    WIFI_IP_CONFIG_TYPE_AUTO = 3,  /**< Config IP from Auto IP pool (169.254/16). Later with DHCP client, if available */
+    WIFI_IP_CONFIG_TYPE_FIXED = 4,  /**< Indicates an IP address that can not be modified */
+} wifi_ip_config_type_e;
+
+/**
+* @brief Address type
+*/
+typedef enum
+{
+    WIFI_ADDRESS_FAMILY_IPV4 = 0,  /**< IPV4 Address family */
+    WIFI_ADDRESS_FAMILY_IPV6 = 1,  /**< IPV6 Address family */
+} wifi_address_family_e;
+
+/**
+* @brief This enumeration defines the proxy method type.
+*/
+typedef enum
+{
+    WIFI_PROXY_TYPE_DIRECT = 0, /**< Direct connection */
+    WIFI_PROXY_TYPE_AUTO = 1, /**< Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried */
+    WIFI_PROXY_TYPE_MANUAL  = 2  /**< Manual configuration */
+} wifi_proxy_type_e;
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_MODULE
+* @{
+*/
+
+/**
+* @brief Below security modes are used in infrastructure and ad-hoc mode
+* For now all EAP security mechanisms are provided only in infrastructure mode
+*/
+typedef enum
+{
+    WIFI_SECURITY_TYPE_NONE = 0,  /**< Security disabled */
+    WIFI_SECURITY_TYPE_WEP = 1,  /**< WEP */
+    WIFI_SECURITY_TYPE_WPA_PSK = 2,  /**< WPA-PSK */
+    WIFI_SECURITY_TYPE_WPA2_PSK = 3,  /**< WPA2-PSK */
+    WIFI_SECURITY_TYPE_EAP = 4,  /**< EAP */
+} wifi_security_type_e;
+
+/**
+* @brief Below encryption modes are used in infrastructure and ad-hoc mode
+*/
+typedef enum
+{
+    WIFI_ENCRYPTION_TYPE_NONE = 0,  /**< Encryption disabled */
+    WIFI_ENCRYPTION_TYPE_WEP = 1,  /**< WEP */
+    WIFI_ENCRYPTION_TYPE_TKIP = 2,  /**< TKIP */
+    WIFI_ENCRYPTION_TYPE_AES = 3,  /**< AES */
+    WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED = 4,  /**< TKIP and AES are both supported */
+} wifi_encryption_type_e;
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_EAP_MODULE
+* @{
+*/
+
+/**
+* @brief EAP type
+*/
+typedef enum
+{
+    WIFI_EAP_TYPE_PEAP = 0,  /**< EAP PEAP type */
+    WIFI_EAP_TYPE_TLS = 1,  /**< EAP TLS type */
+    WIFI_EAP_TYPE_TTLS = 2,  /**< EAP TTLS type */
+    WIFI_EAP_TYPE_SIM = 3,  /**< EAP SIM type */
+    WIFI_EAP_TYPE_AKA = 4,  /**< EAP AKA type */
+} wifi_eap_type_e;
+
+/**
+* @brief EAP phase2 authentication type
+*/
+typedef enum
+{
+    WIFI_EAP_AUTH_TYPE_NONE = 0,  /**< EAP phase2 authentication none */
+    WIFI_EAP_AUTH_TYPE_PAP = 1,  /**< EAP phase2 authentication PAP */
+    WIFI_EAP_AUTH_TYPE_MSCHAP = 2,  /**< EAP phase2 authentication MSCHAP */
+    WIFI_EAP_AUTH_TYPE_MSCHAPV2 = 3,  /**< EAP phase2 authentication MSCHAPv2 */
+    WIFI_EAP_AUTH_TYPE_GTC = 4,  /**< EAP phase2 authentication GTC */
+    WIFI_EAP_AUTH_TYPE_MD5 = 5,  /**< EAP phase2 authentication MD5 */
+} wifi_eap_auth_type_e;
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_MODULE
+* @{
+*/
+
+/**
+* @brief  The handle for Wi-Fi access point.
+*/
+typedef void* wifi_ap_h;
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_MODULE
+* @{
+*/
+
+/**
+* @brief Called when you get the found access point repeatedly.
+* @remarks  @a ap is valid only in this function. In order to use the ap outside this function, you must copy the ap with wifi_ap_clone().
+* @param[in]  ap  The access point
+* @param[in]  user_data  The user data passed from the request function
+* @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
+* @pre  wifi_foreach_found_aps() will invoke this callback.
+* @see  wifi_foreach_found_aps()
+*/
+typedef bool(*wifi_found_ap_cb)(wifi_ap_h ap, void* user_data);
+
+/**
+* @brief Called when the device state is changed.
+* @param[in] error_code  The error code
+* @param[in] state  The device state
+* @param[in] is_requested  Indicates whether this change is requested by you
+* @param[in] user_data The user data passed from the callback registration function
+* @see wifi_set_device_state_changed_cb()
+* @see wifi_unset_device_state_changed_cb()
+*/
+typedef void(*wifi_device_state_changed_cb)(wifi_error_e error_code, wifi_device_state_e state, bool is_requested, void* user_data);
+
+/**
+* @brief Called when the scan is finished.
+* @param[in] error_code  The error code
+* @param[in] user_data The user data passed from the callback registration function
+* @see wifi_scan()
+* @see wifi_set_background_scan_cb()
+* @see wifi_unset_background_scan_cb()
+*/
+typedef void(*wifi_scan_finished_cb)(wifi_error_e error_code, void* user_data);
+
+/**
+* @brief Called when the connection state is changed.
+* @param[in] error_code  The error code
+* @param[in] state  The connection state
+* @param[in] ap  The access point
+* @param[in] is_requested  Indicates whether this change is requested by you
+* @param[in] user_data The user data passed from the callback registration function
+* @see wifi_set_connection_state_changed_cb()
+* @see wifi_unset_connection_state_changed_cb()
+*/
+typedef void(*wifi_connection_state_changed_cb)(wifi_error_e error_code, wifi_connection_state_e state, wifi_ap_h ap, bool is_requested, void* user_data);
+
+/**
+* @brief Called when the RSSI of connected Wi-Fi changed.
+* @param[in] rssi_level  The level of RSSI
+* @param[in] user_data The user data passed from the callback registration function
+* @see wifi_set_rssi_level_changed_cb()
+* @see wifi_unset_rssi_level_changed_cb()
+*/
+typedef void(*wifi_rssi_level_changed_cb)(wifi_rssi_level_e rssi_level, void* user_data);
+
+/**
+* @brief Initializes Wi-Fi
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_initialize(void);
+
+/**
+* @brief Deinitializes Wi-Fi
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_deinitialize(void);
+
+/**
+* @brief Activates Wi-Fi, asynchronously.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_activate(void);
+
+/**
+* @brief Deactivates Wi-Fi, asynchronously.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_deactivate(void);
+
+/**
+* @brief Check whether Wi-Fi is activated
+* @param[out] is_requested  Indicates whether wifi is activated or not
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_is_activated(bool* activated);
+
+/**
+* @brief Gets connection state
+* @param[out] connection_state  The connection state
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_get_connection_state(wifi_connection_state_e* connection_state);
+
+/**
+* @brief Gets the local MAC address.
+* @remarks @a mac_address must be released with free() by you.
+* @param[out] mac_address  The mac address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_get_mac_address(char** mac_address);
+
+/**
+* @brief Gets the name of network interface.
+* @remarks @a name must be released with free() by you.
+* @param[out] name  The name of network interface
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_get_network_interface_name(char** name);
+
+/**
+* @brief Starts scan, asynchronously.
+* @param[in] callback  The callback function to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @post This function invokes wifi_scan_finished_cb().
+*/
+int wifi_scan(wifi_scan_finished_cb callback, void* user_data);
+
+/**
+* @brief Gets the handle of connected access point.
+* @remarks @a handle must be released with wifi_ap_destroy().
+* @param[out] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_NO_CONNECTION  There is no connected AP
+*/
+int wifi_get_connected_ap(wifi_ap_h* ap);
+
+/**
+* @brief Gets the result of scan.
+* @param[in] callback  The callback to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @post This function invokes wifi_found_ap_cb().
+*/
+int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data);
+
+/**
+* @brief Connects the access point, asynchronously.
+* @param[in] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @post This function invokes wifi_connection_state_changed_cb().
+*/
+int wifi_connect(wifi_ap_h ap);
+
+/**
+* @brief Disconnects the access point, asynchronously.
+* @param[in] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @post This function invokes wifi_connection_state_changed_cb().
+*/
+int wifi_disconnect(wifi_ap_h ap);
+
+/**
+* @brief Connects the access point with WPS, asynchronously.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of WPS
+* @param[in] pin  The pin value, which is valid only when type is WIFI_WPS_TYPE_PIN.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @post This function invokes wifi_connection_state_changed_cb().
+*/
+int wifi_connect_with_wps(wifi_ap_h ap, wifi_wps_type_e type, const char* pin);
+
+/**
+* @brief Deletes the information of stored access point.
+* @details If an AP is connected, then connection information will be stored.
+* This information is used when a connection to that AP is established automatically.
+* @param[in] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_forget_ap(wifi_ap_h ap);
+
+/**
+* @brief Registers the callback called when the device state is changed.
+* @param[in] callback  The callback function to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
+*/
+int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void* user_data);
+
+/**
+* @brief Unregisters the callback called when the device state is changed.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_unset_device_state_changed_cb(void);
+
+/**
+* @brief Registers the callback called when the background scan is finished periodically.
+* @param[in] callback  The callback function to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
+*/
+int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* user_data);
+
+/**
+* @brief Unregisters the callback called when the scan is finished periodically.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_unset_background_scan_cb(void);
+
+/**
+* @brief Registers the callback called when the connection state is changed.
+* @param[in] callback  The callback function to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
+*/
+int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callback, void* user_data);
+
+/**
+* @brief Unregisters the callback called when the connection state is changed.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_unset_connection_state_changed_cb(void);
+
+/**
+* @brief Registers callback called when the RSSI of connected Wi-Fi changed.
+* @param[in] callback  The callback function to be called
+* @param[in] user_data The user data passed to the callback function
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
+*/
+int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void* user_data);
+
+/**
+* @brief Unregisters callback called when the RSSI of connected Wi-Fi changed.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_unset_rssi_level_changed_cb(void);
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_MODULE
+* @{
+*/
+
+/**
+* @brief Creates the handle of access point.
+* @remarks @a ap must be released with wifi_ap_destroy().
+* @param[in] essid  The ESSID(Extended Service Set Identifier)
+* @param[out] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @see wifi_ap_destroy()
+*/
+int wifi_ap_create(const char* essid, wifi_ap_h* ap);
+
+/**
+* @brief Destroys the handle of access point.
+* @param[in] ap  The handle of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_ap_create()
+*/
+int wifi_ap_destroy(wifi_ap_h ap);
+
+/**
+* @brief Clons the handle of access point.
+* @remarks @a cloned_ap must be released with wifi_ap_destroy().
+* @param[out] cloned_ap  The handle of cloned access point
+* @param[in] origin  The handle of origin access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @see wifi_ap_destroy()
+*/
+int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin);
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_NETWORK_MODULE
+* @{
+*/
+
+/**
+* @brief Gets ESSID(Extended Service Set Identifier).
+* @remarks @a essid must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[out] essid  The ESSID
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+*/
+int wifi_ap_get_essid(wifi_ap_h ap, char** essid);
+
+/**
+* @brief Gets BSSID(Basic Service Set Identifier).
+* @remarks @a bssid must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[out] bssid  The BSSID
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+*/
+int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid);
+
+/**
+* @brief Gets the RSSI.
+* @param[in] ap  The handle of access point
+* @param[out] rssi  The RSSI
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi);
+
+/**
+* @brief Gets the Frequency band (MHz).
+* @param[in] ap  The handle of access point
+* @param[out] frequency  The frequency
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency);
+
+/**
+* @brief Gets the max speed (Mbps).
+* @param[in] ap  The handle of access point
+* @param[out] max_speed  The max speed
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed);
+
+/**
+* @brief Indicates whether the access point is favorite or not.
+* @param[in] ap  The handle of access point
+* @param[out] favourite  Indicates whether access point is favorite or not.
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite);
+
+/**
+* @brief Gets the connection state.
+* @param[in] ap  The handle of access point
+* @param[out] state  The connection state
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state);
+
+/**
+* @brief Gets the config type of IP.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[out] type  The type of IP config
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e* type);
+
+/**
+* @brief Sets the config type of IP.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[in] type  The type of IP config
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e type);
+
+/**
+* @brief Gets the IP address.
+* @remarks @a ip_address must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[out] ip_address  The IP address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, char** ip_address);
+
+/**
+* @brief Sets the IP address.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[in] ip_address  The IP address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* ip_address);
+
+/**
+* @brief Gets the subnet mask.
+* @remarks @a subnet_mask must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[out] subnet_mask  The subnet mask
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, char** subnet_mask);
+
+/**
+* @brief Sets the subnet mask.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[in] subnet_mask  The subnet mask
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, const char* subnet_mask);
+
+/**
+* @brief Gets the gateway address.
+* @remarks @a gateway_address must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[out] gateway_address  The gateway address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, char** gateway_address);
+
+/**
+* @brief Sets the gateway address.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[in] gateway_address  The gateway address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* gateway_address);
+
+/**
+* @brief Gets the proxy address.
+* @remarks @a proxy_address must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[out] proxy_address  The proxy address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, char** proxy_address);
+
+/**
+* @brief Sets the proxy address.
+* @param[in] ap  The handle of access point
+* @param[in] address_family  The address family
+* @param[in] proxy_address  The proxy address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* proxy_address);
+
+/**
+* @brief Gets the Proxy type.
+* @param[in] ap  The handle of access point
+* @param[out] type  The type of proxy
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type);
+
+/**
+* @brief Sets the Proxy address.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of proxy
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type);
+
+/**
+* @brief Gets the DNS address.
+* @remarks The allowance of DNS address is 2. @a dns_address must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[in] order  The order of DNS address. It starts from 1, which means first DNS address.
+* @param[in] address_family  The address family
+* @param[out] dns_address  The DNS address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, char** dns_address);
+
+/**
+* @brief Sets the DNS address.
+* @remarks The allowance of DNS address is 2.
+* @param[in] ap  The handle of access point
+* @param[in] order  The order of DNS address. It starts from 1, which means first DNS address.
+* @param[in] address_family  The address family
+* @param[in] dns_address  The DNS address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
+*/
+int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, const char* dns_address);
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_MODULE
+* @{
+*/
+
+/**
+* @brief Gets the security mode of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[out] type  The type of Wi-Fi security
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type);
+
+/**
+* @brief Sets the security mode of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of Wi-Fi security
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type);
+
+/**
+* @brief Gets the encryption type of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[out] type  The type of Wi-Fi encryption
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type);
+
+/**
+* @brief Sets the encryption type of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of Wi-Fi encryption
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type);
+
+/**
+* @brief Indicates whether the passphrase is required or not.
+* @param[in] ap  The handle of access point
+* @param[out] required  Indicates whether passphrase is required or not
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required);
+
+/**
+* @brief Sets the passphrase.
+* @param[in] ap  The handle of access point
+* @param[in] passphrase  The passphrase of access point
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase);
+
+/**
+* @brief Indicates whether the WPS is supported or not.
+* @param[in] ap  The handle of access point
+* @param[out] supported  Indicates whether WPS is supported or not
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported);
+
+/**
+* @}
+*/
+
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_EAP_MODULE
+* @{
+*/
+
+/**
+* @brief Sets the passphrase of EAP.
+* @param[in] ap  The handle of access point
+* @param[in] user_name  The user name
+* @param[in] password  The password
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* password);
+
+/**
+* @brief Gets the CA Certificate of EAP.
+* @remarks @a file must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[out] file  The file path of CA Certificate
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_get_eap_ca_cert_file(wifi_ap_h ap, char** file);
+
+/**
+* @brief Sets the CA Certificate of EAP.
+* @param[in] ap  The handle of access point
+* @param[in] file  The file path of CA Certificate
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_ca_cert_file(wifi_ap_h ap, const char* file);
+
+/**
+* @brief Gets the Client Certificate of EAP.
+* @remarks @a file must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[out] file  The file path of Client Certificate
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_get_eap_client_cert_file(wifi_ap_h ap, char** file);
+
+/**
+* @brief Sets the CA Certificate of EAP.
+* @param[in] ap  The handle of access point
+* @param[in] file  The file path of Client Certificate
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file);
+
+/**
+* @brief Gets the private key file of EAP.
+* @remarks @a file must be released with free() by you.
+* @param[in] ap  The handle of access point
+* @param[out] file  The file path of private key
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file);
+
+/**
+* @brief Sets the private key information of EAP.
+* @param[in] ap  The handle of access point
+* @param[in] file  The file path of private key
+* @param[in] password  The password
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* password);
+
+/**
+* @brief Gets the EAP type of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[out] type  The type of EAP
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type);
+
+/**
+* @brief Sets the EAP type of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of EAP
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type);
+
+/**
+* @brief Gets the type of EAP phase2 authentication of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[out] type  The type of EAP phase2 authentication
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+*/
+int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type);
+
+/**
+* @brief Sets the type of EAP phase2 authentication of Wi-Fi.
+* @param[in] ap  The handle of access point
+* @param[in] type  The type of EAP phase2 authentication
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_ERROR_NONE  Successful
+* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+*/
+int wifi_ap_set_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e type);
+
+/**
+* @}
+*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_WIFI_H__ */
diff --git a/packaging/capi-network-wifi.spec b/packaging/capi-network-wifi.spec
new file mode 100644 (file)
index 0000000..6788e36
--- /dev/null
@@ -0,0 +1,57 @@
+#sbs-git:api/wifi
+
+Name:       capi-network-wifi
+Summary:    Network Wi-Fi library in TIZEN C API
+Version:    0.1.1_2
+Release:    1
+Group:      System/Network
+License:    Apache License Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(network)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+Network Wi-Fi library in Tizen C API
+
+%package devel
+Summary:  Network Wi-Fi library in Tizen C API (Development)
+Group:    System/Network
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Network Wi-Fi library in Tizen C API (Development)
+
+
+%prep
+%setup -q
+
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-network-wifi.so.*
+
+%files devel
+%{_includedir}/network/*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-network-wifi.so
diff --git a/src/libnetwork.c b/src/libnetwork.c
new file mode 100755 (executable)
index 0000000..86b11b5
--- /dev/null
@@ -0,0 +1,668 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <glib.h>
+#include "net_wifi_private.h"
+
+static GSList *ap_handle_list = NULL;
+
+struct _wifi_cb_s {
+       wifi_device_state_changed_cb device_state_cb;
+       void *device_state_user_data;
+       wifi_scan_finished_cb bg_scan_cb;
+       void *bg_scan_user_data;
+       wifi_scan_finished_cb scan_request_cb;
+       void *scan_request_user_data;
+       wifi_connection_state_changed_cb connection_state_cb;
+       void *connection_state_user_data;
+};
+
+struct _profile_list_s {
+       int count;
+       net_profile_info_t *profiles;
+};
+
+static struct _wifi_cb_s wifi_callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+static struct _profile_list_s profile_iterator = {0, NULL};
+
+
+static void __libnet_clear_profile_list(struct _profile_list_s *profile_list)
+{
+       if (profile_list->count > 0)
+               g_free(profile_list->profiles);
+
+       profile_list->count = 0;
+       profile_list->profiles = NULL;
+}
+
+static void __libnet_update_profile_iterator(void)
+{
+       struct _profile_list_s wifi_profiles = {0, NULL};
+
+       __libnet_clear_profile_list(&profile_iterator);
+
+       net_get_profile_list(NET_DEVICE_WIFI, &wifi_profiles.profiles, &wifi_profiles.count);
+       WIFI_LOG(WIFI_INFO, "Wifi profile count : %d\n", wifi_profiles.count);
+
+       if (wifi_profiles.count == 0)
+               return;
+
+       profile_iterator.count = wifi_profiles.count;
+       profile_iterator.profiles = wifi_profiles.profiles;
+}
+
+static void __libnet_convert_profile_info_to_wifi_info(net_wifi_connection_info_t *wifi_info,
+                                                               net_profile_info_t *ap_info)
+{
+       g_strlcpy(wifi_info->essid, ap_info->ProfileInfo.Wlan.essid, NET_WLAN_ESSID_LEN+1);
+       wifi_info->wlan_mode = ap_info->ProfileInfo.Wlan.wlan_mode;
+       memcpy(&wifi_info->security_info, &ap_info->ProfileInfo.Wlan.security_info, sizeof(wlan_security_info_t));
+}
+
+static int __libnet_connect_with_wifi_info(net_profile_info_t *ap_info)
+{
+       net_wifi_connection_info_t wifi_info;
+       memset(&wifi_info, 0, sizeof(net_wifi_connection_info_t));
+
+       __libnet_convert_profile_info_to_wifi_info(&wifi_info, ap_info);
+
+       if (net_open_connection_with_wifi_info(&wifi_info) != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+static void __libnet_state_changed_cb(char *profile_name, net_profile_info_t *profile_info,
+               wifi_error_e error, wifi_connection_state_e state, bool is_requested)
+{
+       if (profile_name == NULL)
+               return;
+
+       if (profile_info == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Error!! Profile info not found! : %s\n", profile_name);
+               return;
+       }
+
+       ap_handle_list = g_slist_append(ap_handle_list, (wifi_ap_h)profile_info);
+
+       if (wifi_callbacks.connection_state_cb)
+               wifi_callbacks.connection_state_cb(error, state, (wifi_ap_h)profile_info,
+                               is_requested, wifi_callbacks.connection_state_user_data);
+
+       ap_handle_list = g_slist_remove(ap_handle_list, (wifi_ap_h)profile_info);
+}
+
+static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_requested)
+{
+       if (wifi_callbacks.device_state_cb == NULL)
+               return;
+
+       wifi_error_e error_code = WIFI_ERROR_NONE;
+       wifi_device_state_e state;
+       net_wifi_state_t *wifi_state = (net_wifi_state_t*)event_cb->Data;
+
+       if (event_cb->Error == NET_ERR_NONE &&
+           event_cb->Datalength == sizeof(net_wifi_state_t)) {
+
+               if (*wifi_state == WIFI_ON) {
+                       WIFI_LOG(WIFI_INFO, "Wi-Fi State : Power ON\n");
+                       state = WIFI_DEVICE_STATE_ACTIVATED;
+               } else if (*wifi_state == WIFI_OFF) {
+                       WIFI_LOG(WIFI_INFO, "Wi-Fi State : Power OFF\n");
+                       state = WIFI_DEVICE_STATE_DEACTIVATED;
+               } else {
+                       WIFI_LOG(WIFI_INFO, "Wi-Fi State : Unknown\n");
+                       error_code = WIFI_ERROR_OPERATION_FAILED;
+                       state = WIFI_DEVICE_STATE_DEACTIVATED;
+               }
+       } else {
+               WIFI_LOG(WIFI_ERROR, "Wi-Fi Power on/off request failed! Error [%d]\n", event_cb->Error);
+               error_code = WIFI_ERROR_OPERATION_FAILED;
+               state = WIFI_DEVICE_STATE_DEACTIVATED;
+       }
+
+       wifi_callbacks.device_state_cb(error_code, state, is_requested, wifi_callbacks.device_state_user_data);
+}
+
+static void __libnet_scan_cb(net_event_info_t *event_cb, bool is_requested)
+{
+       wifi_error_e error_code = WIFI_ERROR_NONE;
+
+       if (event_cb->Error != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Scan failed!, Error [%d]\n", event_cb->Error);
+               error_code = WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       if (wifi_callbacks.scan_request_cb) {
+               wifi_callbacks.scan_request_cb(error_code, wifi_callbacks.scan_request_user_data);
+               wifi_callbacks.scan_request_cb = NULL;
+               wifi_callbacks.scan_request_user_data = NULL;
+               return;
+       }
+
+       if (wifi_callbacks.bg_scan_cb != NULL)
+               wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data);
+}
+
+static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
+{
+       bool is_requested = false;
+       net_profile_info_t *prof_info_p = NULL;
+       net_profile_info_t prof_info;
+
+       switch (event_cb->Event) {
+       case NET_EVENT_OPEN_RSP:
+       case NET_EVENT_WIFI_WPS_RSP:
+               is_requested = true;
+       case NET_EVENT_OPEN_IND:
+               if (strstr(event_cb->ProfileName, "/wifi_") == NULL) return;
+
+               WIFI_LOG(WIFI_INFO,
+                       "Received ACTIVATION(Open RSP/IND) response: %d \n", event_cb->Error);
+
+               switch (event_cb->Error) {
+               case NET_ERR_NONE:
+                       WIFI_LOG(WIFI_INFO, "Activation succeeded\n");
+
+                       if (event_cb->Datalength == sizeof(net_profile_info_t))
+                               prof_info_p = (net_profile_info_t*)event_cb->Data;
+
+                       __libnet_state_changed_cb(event_cb->ProfileName, prof_info_p,
+                                               WIFI_ERROR_NONE,
+                                               WIFI_CONNECTION_STATE_CONNECTED,
+                                               is_requested);
+                       return;
+               case NET_ERR_TIME_OUT:
+                       WIFI_LOG(WIFI_ERROR, "Request time out!\n");
+                       break;
+               case NET_ERR_OPERATION_ABORTED:
+                       WIFI_LOG(WIFI_ERROR, "Connction is aborted!\n");
+                       break;
+               case NET_ERR_UNKNOWN_METHOD:
+                       WIFI_LOG(WIFI_ERROR, "Method not found!\n");
+                       break;
+               case NET_ERR_UNKNOWN:
+                       WIFI_LOG(WIFI_ERROR, "Activation Failed!\n");
+                       break;
+               default:
+                       WIFI_LOG(WIFI_ERROR, "Unknown Error!\n");
+                       break;
+               }
+
+               if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE)
+                       __libnet_state_changed_cb(event_cb->ProfileName, &prof_info,
+                                               WIFI_ERROR_OPERATION_FAILED,
+                                               WIFI_CONNECTION_STATE_DISCONNECTED,
+                                               is_requested);
+               else
+                       __libnet_state_changed_cb(event_cb->ProfileName, NULL,
+                                               WIFI_ERROR_OPERATION_FAILED,
+                                               WIFI_CONNECTION_STATE_DISCONNECTED,
+                                               is_requested);
+
+               break;
+       case NET_EVENT_CLOSE_RSP:
+               is_requested = true;
+       case NET_EVENT_CLOSE_IND:
+               if (strstr(event_cb->ProfileName, "/wifi_") == NULL) return;
+
+               WIFI_LOG(WIFI_INFO, "Got Close RSP/IND\n");
+
+               switch (event_cb->Error) {
+               case NET_ERR_NONE:
+                       /* Successful PDP Deactivation */
+                       WIFI_LOG(WIFI_INFO, "Deactivation succeeded!\n");
+                       if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE)
+                               __libnet_state_changed_cb(event_cb->ProfileName, &prof_info,
+                                                       WIFI_ERROR_NONE,
+                                                       WIFI_CONNECTION_STATE_DISCONNECTED,
+                                                       is_requested);
+                       else
+                               __libnet_state_changed_cb(event_cb->ProfileName, NULL,
+                                                       WIFI_ERROR_NONE,
+                                                       WIFI_CONNECTION_STATE_DISCONNECTED,
+                                                       is_requested);
+                       return;
+               case NET_ERR_TIME_OUT:
+                       WIFI_LOG(WIFI_ERROR, "Request time out!\n");
+                       break;
+               case NET_ERR_IN_PROGRESS:
+                       WIFI_LOG(WIFI_ERROR, "Disconncting is in progress!\n");
+                       break;
+               case NET_ERR_OPERATION_ABORTED:
+                       WIFI_LOG(WIFI_ERROR, "Disconnction is aborted!\n");
+                       break;
+               case NET_ERR_UNKNOWN_METHOD:
+                       WIFI_LOG(WIFI_ERROR, "Service not found!\n");
+                       break;
+               case NET_ERR_UNKNOWN:
+                       WIFI_LOG(WIFI_ERROR, "Deactivation Failed!\n");
+                       break;
+               default:
+                       WIFI_LOG(WIFI_ERROR, "Unknown Error!\n");
+                       break;
+               }
+
+               if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE)
+                       __libnet_state_changed_cb(event_cb->ProfileName, &prof_info,
+                                               WIFI_ERROR_OPERATION_FAILED,
+                                               WIFI_CONNECTION_STATE_DISCONNECTED,
+                                               is_requested);
+               else
+                       __libnet_state_changed_cb(event_cb->ProfileName, NULL,
+                                               WIFI_ERROR_OPERATION_FAILED,
+                                               WIFI_CONNECTION_STATE_DISCONNECTED,
+                                               is_requested);
+
+               break;
+       case NET_EVENT_NET_STATE_IND:
+               if (strstr(event_cb->ProfileName, "/wifi_") == NULL) return;
+
+               WIFI_LOG(WIFI_INFO, "Got State changed IND\n");
+               net_state_type_t *profile_state = (net_state_type_t*)event_cb->Data;
+
+               if (event_cb->Error == NET_ERR_NONE &&
+                   event_cb->Datalength == sizeof(net_state_type_t)) {
+                       switch (*profile_state) {
+                       case NET_STATE_TYPE_ASSOCIATION:
+                               WIFI_LOG(WIFI_INFO,
+                                       "Profile State : Association, profile name : %s\n",
+                                       event_cb->ProfileName);
+                               break;
+                       case NET_STATE_TYPE_CONFIGURATION:
+                               WIFI_LOG(WIFI_INFO,
+                                       "Profile State : Configuration, profile name : %s\n",
+                                       event_cb->ProfileName);
+                               break;
+                       case NET_STATE_TYPE_IDLE:
+                       case NET_STATE_TYPE_FAILURE:
+                       case NET_STATE_TYPE_READY:
+                       case NET_STATE_TYPE_ONLINE:
+                       case NET_STATE_TYPE_DISCONNECT:
+                       case NET_STATE_TYPE_UNKNOWN:
+                       default:
+                               WIFI_LOG(WIFI_INFO,
+                                       "Profile State : %d, profile name : %s\n", *profile_state,
+                                       event_cb->ProfileName);
+                               return;
+                       }
+
+                       if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE)
+                               __libnet_state_changed_cb(event_cb->ProfileName, &prof_info,
+                                                       WIFI_ERROR_NONE,
+                                                       WIFI_CONNECTION_STATE_CONNECTING,
+                                                       is_requested);
+                       else
+                               __libnet_state_changed_cb(event_cb->ProfileName, NULL,
+                                                       WIFI_ERROR_NONE,
+                                                       WIFI_CONNECTION_STATE_CONNECTING,
+                                                       is_requested);
+               }
+
+               break;
+       case NET_EVENT_WIFI_SCAN_RSP:
+       case NET_EVENT_WIFI_SCAN_IND:
+               WIFI_LOG(WIFI_ERROR, "Got wifi scan IND\n");
+               __libnet_scan_cb(event_cb, is_requested);
+               break;
+       case NET_EVENT_WIFI_POWER_RSP:
+               is_requested = true;
+       case NET_EVENT_WIFI_POWER_IND:
+               WIFI_LOG(WIFI_ERROR, "Got wifi power IND\n");
+               __libnet_power_on_off_cb(event_cb, is_requested);
+               break;
+       default :
+               WIFI_LOG(WIFI_ERROR, "Error! Unknown Event\n\n");
+       }
+}
+
+bool _wifi_libnet_init(void)
+{
+       int rv;
+
+       rv = net_register_client_ext((net_event_cb_t)__libnet_evt_cb, NET_DEVICE_WIFI, NULL);
+       if (rv != NET_ERR_NONE)
+               return false;
+
+       return true;
+}
+
+bool _wifi_libnet_deinit(void)
+{
+       if (net_deregister_client_ext(NET_DEVICE_WIFI) != NET_ERR_NONE)
+               return false;
+
+       __libnet_clear_profile_list(&profile_iterator);
+       g_slist_free_full(ap_handle_list, g_free);
+       memset(&wifi_callbacks, 0, sizeof(struct _wifi_cb_s));
+
+       return true;
+}
+
+int _wifi_activate(void)
+{
+       int rv;
+
+       rv = net_wifi_power_on();
+       if (rv == NET_ERR_NONE)
+               return WIFI_ERROR_NONE;
+       else if (rv == NET_ERR_INVALID_OPERATION)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       return WIFI_ERROR_OPERATION_FAILED;
+}
+
+int _wifi_deactivate(void)
+{
+       int rv;
+
+       rv = net_wifi_power_off();
+       if (rv == NET_ERR_NONE)
+               return WIFI_ERROR_NONE;
+       else if (rv == NET_ERR_INVALID_OPERATION)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       return WIFI_ERROR_OPERATION_FAILED;
+}
+
+bool _wifi_libnet_check_ap_validity(wifi_ap_h ap_h)
+{
+       GSList *list;
+       int i = 0;
+
+       for (list = ap_handle_list; list; list = list->next)
+               if (ap_h == list->data) return true;
+
+       for (;i < profile_iterator.count;i++)
+               if (ap_h == &profile_iterator.profiles[i]) return true;
+
+       return false;
+}
+
+void _wifi_libnet_add_to_ap_list(wifi_ap_h ap_h)
+{
+       ap_handle_list = g_slist_append(ap_handle_list, ap_h);
+}
+
+void _wifi_libnet_remove_from_ap_list(wifi_ap_h ap_h)
+{
+       ap_handle_list = g_slist_remove(ap_handle_list, ap_h);
+       g_free(ap_h);
+}
+
+bool _wifi_libnet_check_profile_name_validity(const char *profile_name)
+{
+       const char *profile_header = "/net/connman/service/wifi_";
+       int i = 0;
+       int string_len = 0;
+
+       if (profile_name == NULL || strlen(profile_name) <= strlen(profile_header)) {
+               WIFI_LOG(WIFI_ERROR, "Error!!! Profile name is invalid\n");
+               return false;
+       }
+
+       string_len = strlen(profile_name);
+
+       if (strncmp(profile_header, profile_name, strlen(profile_header)) == 0) {
+               for (;i < string_len;i++) {
+                       if (isgraph(profile_name[i]) == 0) {
+                               WIFI_LOG(WIFI_ERROR, "Error!!! Profile name is invalid\n");
+                               return false;
+                       }
+               }
+       } else {
+               WIFI_LOG(WIFI_ERROR, "Error!!! Profile name is invalid\n");
+               return false;
+       }
+
+       return NET_ERR_NONE;
+}
+
+bool _wifi_libnet_get_wifi_state(wifi_connection_state_e* connection_state)
+{
+       net_wifi_state_t wlan_state = 0;
+       net_profile_name_t profile_name;
+
+       if (net_get_wifi_state(&wlan_state, &profile_name) != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Error!! net_get_wifi_state() failed.\n");
+               return false;
+       }
+
+       switch (wlan_state) {
+       case WIFI_OFF:
+       case WIFI_ON:
+               *connection_state = WIFI_CONNECTION_STATE_DISCONNECTED;
+               break;
+       case WIFI_CONNECTING:
+               *connection_state = WIFI_CONNECTION_STATE_CONNECTING;
+               break;
+       case WIFI_CONNECTED:
+               *connection_state = WIFI_CONNECTION_STATE_CONNECTED;
+               break;
+       case WIFI_DISCONNECTING:
+               *connection_state = WIFI_CONNECTION_STATE_DISCONNECTING;
+               break;
+       default :
+               WIFI_LOG(WIFI_ERROR, "Error!! Unknown state\n");
+               return false;
+       }
+
+       return true;
+}
+
+int _wifi_libnet_get_intf_name(char** name)
+{
+       if (profile_iterator.count == 0)
+               __libnet_update_profile_iterator();
+
+       if (profile_iterator.count == 0) {
+               WIFI_LOG(WIFI_ERROR, "Error!! There is no AP\n");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       *name = g_strdup(profile_iterator.profiles->ProfileInfo.Wlan.net_info.DevName);
+       if (*name == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_libnet_scan_request(wifi_scan_finished_cb callback, void* user_data)
+{
+       int rv;
+       rv = net_scan_wifi();
+
+       if (rv == NET_ERR_NONE) {
+               wifi_callbacks.scan_request_cb = callback;
+               wifi_callbacks.scan_request_user_data = user_data;
+               return WIFI_ERROR_NONE;
+       } else if (rv == NET_ERR_INVALID_OPERATION)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       return WIFI_ERROR_OPERATION_FAILED;
+}
+
+int _wifi_libnet_get_connected_profile(wifi_ap_h *ap)
+{
+       int i = 0;
+       wifi_ap_h ap_h = NULL;
+
+       __libnet_update_profile_iterator();
+
+       for (;i < profile_iterator.count;i++) {
+               if (profile_iterator.profiles[i].ProfileState == NET_STATE_TYPE_ONLINE ||
+                   profile_iterator.profiles[i].ProfileState == NET_STATE_TYPE_READY) {
+                       ap_h = (wifi_ap_h)(&profile_iterator.profiles[i]);
+                       break;
+               }
+       }
+
+       if (ap_h == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Error!! There is no connected AP.\n");
+               return WIFI_ERROR_NO_CONNECTION;
+       }
+
+       *ap = g_try_malloc0(sizeof(net_profile_info_t));
+       if (*ap == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       memcpy(*ap, ap_h, sizeof(net_profile_info_t));
+
+       _wifi_libnet_add_to_ap_list(*ap);
+
+       return WIFI_ERROR_NONE;
+}
+
+bool _wifi_libnet_foreach_found_aps(wifi_found_ap_cb callback, void *user_data)
+{
+       int i = 0;
+       bool rv = true;
+
+       __libnet_update_profile_iterator();
+
+       if (profile_iterator.count == 0) {
+               WIFI_LOG(WIFI_INFO, "There is no APs.\n");
+               return true;
+       }
+
+       for (;i < profile_iterator.count;i++) {
+               rv = callback((wifi_ap_h)(&profile_iterator.profiles[i]), user_data);
+               if (rv == false) break;
+       }
+
+       return true;
+}
+
+int _wifi_libnet_open_profile(wifi_ap_h ap_h)
+{
+       net_profile_info_t *ap_info = ap_h;
+
+       if (ap_info->ProfileInfo.Wlan.security_info.sec_mode == WLAN_SEC_MODE_IEEE8021X)
+               return __libnet_connect_with_wifi_info(ap_info);
+       else if (_wifi_libnet_check_profile_name_validity(ap_info->ProfileName) == false)
+               return __libnet_connect_with_wifi_info(ap_info);
+       else if (net_open_connection_with_profile(ap_info->ProfileName) != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_libnet_close_profile(wifi_ap_h ap_h)
+{
+       net_profile_info_t *ap_info = ap_h;
+
+       if (net_close_connection(ap_info->ProfileName) != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_libnet_connect_with_wps(wifi_ap_h ap_h, wifi_wps_type_e type, const char *pin)
+{
+       net_profile_info_t *ap_info = ap_h;
+       net_wifi_wps_info_t wps_info;
+       memset(&wps_info, 0 , sizeof(net_wifi_wps_info_t));
+
+       if (type == WIFI_WPS_TYPE_PIN) {
+               wps_info.type = WIFI_WPS_PIN;
+               g_strlcpy(wps_info.pin, pin, NET_WLAN_MAX_WPSPIN_LEN+1);
+       } else
+               wps_info.type = WIFI_WPS_PBC;
+
+       if (net_wifi_enroll_wps(ap_info->ProfileName, &wps_info) != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_set_power_on_off_cb(wifi_device_state_changed_cb callback, void *user_data)
+{
+       if (wifi_callbacks.device_state_cb)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.device_state_cb = callback;
+       wifi_callbacks.device_state_user_data = user_data;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_unset_power_on_off_cb(void)
+{
+       if (wifi_callbacks.device_state_cb == NULL)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.device_state_cb = NULL;
+       wifi_callbacks.device_state_user_data = NULL;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void *user_data)
+{
+       if (wifi_callbacks.bg_scan_cb)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.bg_scan_cb = callback;
+       wifi_callbacks.bg_scan_user_data = user_data;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_unset_background_scan_cb(void)
+{
+       if (wifi_callbacks.bg_scan_cb == NULL)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.bg_scan_cb = NULL;
+       wifi_callbacks.bg_scan_user_data = NULL;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_set_connection_state_cb(wifi_connection_state_changed_cb callback, void *user_data)
+{
+       if (wifi_callbacks.connection_state_cb)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.connection_state_cb = callback;
+       wifi_callbacks.connection_state_user_data = user_data;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_unset_connection_state_cb()
+{
+       if (wifi_callbacks.connection_state_cb == NULL)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       wifi_callbacks.connection_state_cb = NULL;
+       wifi_callbacks.connection_state_user_data = NULL;
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_update_ap_info(net_profile_info_t *ap_info)
+{
+       if (net_modify_profile(ap_info->ProfileName, ap_info) != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+
diff --git a/src/net_wifi.c b/src/net_wifi.c
new file mode 100755 (executable)
index 0000000..e36f429
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include <vconf/vconf.h>
+#include "net_wifi_private.h"
+
+static bool is_init = false;
+static wifi_rssi_level_changed_cb rssi_level_changed_cb = NULL;
+static void *rssi_level_changed_user_data = NULL;
+
+
+static void __rssi_level_changed_cb(keynode_t *node, void *user_data)
+{
+       int rssi_level = vconf_keynode_get_int(node);
+       rssi_level_changed_cb(rssi_level, rssi_level_changed_user_data);
+}
+
+int wifi_initialize(void)
+{
+       if (is_init) {
+               WIFI_LOG(WIFI_ERROR, "Already initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       if (_wifi_libnet_init() == false) {
+               WIFI_LOG(WIFI_ERROR, "Init failed!\n");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       is_init = true;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_deinitialize(void)
+{
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       if (_wifi_libnet_deinit() == false) {
+               WIFI_LOG(WIFI_ERROR, "Deinit failed!\n");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       is_init = false;
+       wifi_unset_rssi_level_changed_cb();
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_activate(void)
+{
+       int rv;
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       rv = _wifi_activate();
+       if (rv != WIFI_ERROR_NONE)
+               WIFI_LOG(WIFI_ERROR, "Error!! Wi-Fi Activation failed.\n");
+
+       return rv;
+}
+
+int wifi_deactivate(void)
+{
+       int rv;
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       rv = _wifi_deactivate();
+       if (rv != WIFI_ERROR_NONE)
+               WIFI_LOG(WIFI_ERROR, "Error!! Wi-Fi Deactivation failed.\n");
+
+       return rv;
+}
+
+int wifi_is_activated(bool* activated)
+{
+       int status = 0;
+
+       if (activated == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (!vconf_get_int(VCONFKEY_NETWORK_WIFI_STATE, &status)) {
+               WIFI_LOG(WIFI_INFO, "WiFi = %d\n", status);
+               if (status == VCONFKEY_NETWORK_WIFI_OFF)
+                       *activated = false;
+               else
+                       *activated = true;
+       } else {
+               WIFI_LOG(WIFI_ERROR, "vconf_get_int Failed = %d\n", status);
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_get_connection_state(wifi_connection_state_e* connection_state)
+{
+       if (connection_state == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (_wifi_libnet_get_wifi_state(connection_state) == false)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_get_mac_address(char** mac_address)
+{
+       if (mac_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       *mac_address = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+
+       if (*mac_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "vconf_get_str Failed\n");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       WIFI_LOG(WIFI_INFO, "MAC Address %s\n", *mac_address);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_get_network_interface_name(char** name)
+{
+       if (name == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       return _wifi_libnet_get_intf_name(name);
+}
+
+int wifi_scan(wifi_scan_finished_cb callback, void* user_data)
+{
+       int rv;
+
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       rv = _wifi_libnet_scan_request(callback, user_data);
+       if (rv != WIFI_ERROR_NONE)
+               WIFI_LOG(WIFI_ERROR, "Error!! Wi-Fi scan failed.\n");
+
+       return rv;
+}
+
+int wifi_get_connected_ap(wifi_ap_h* ap)
+{
+       int rv;
+
+       if (ap == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+        rv = _wifi_libnet_get_connected_profile(ap);
+       WIFI_LOG(WIFI_INFO, "Connected AP : %p, rv : %d\n", *ap, rv);
+
+       return rv;
+}
+
+int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data)
+{
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (_wifi_libnet_foreach_found_aps(callback, user_data) == false)
+               return WIFI_ERROR_OPERATION_FAILED;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_connect(wifi_ap_h ap)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_libnet_open_profile(ap);
+}
+
+int wifi_disconnect(wifi_ap_h ap)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_libnet_close_profile(ap);
+}
+
+int wifi_connect_with_wps(wifi_ap_h ap, wifi_wps_type_e type, const char* pin)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (type != WIFI_WPS_TYPE_PBC && type != WIFI_WPS_TYPE_PIN) ||
+           (type == WIFI_WPS_TYPE_PIN && pin == NULL)) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_libnet_connect_with_wps(ap, type, pin);
+}
+
+int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void* user_data)
+{
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_set_power_on_off_cb(callback, user_data);
+}
+
+int wifi_unset_device_state_changed_cb(void)
+{
+       return _wifi_unset_power_on_off_cb();
+}
+
+int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* user_data)
+{
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_set_background_scan_cb(callback, user_data);
+}
+
+int wifi_unset_background_scan_cb(void)
+{
+       return _wifi_unset_background_scan_cb();
+}
+
+int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callback, void* user_data)
+{
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (is_init == false) {
+               WIFI_LOG(WIFI_ERROR, "Not initialized\n");
+               return WIFI_ERROR_INVALID_OPERATION;
+       }
+
+       return _wifi_set_connection_state_cb(callback, user_data);
+}
+
+int wifi_unset_connection_state_changed_cb(void)
+{
+       return _wifi_unset_connection_state_cb();
+}
+
+int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void* user_data)
+{
+       if (callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (rssi_level_changed_cb == NULL)
+               vconf_notify_key_changed(VCONFKEY_WIFI_STRENGTH, __rssi_level_changed_cb, NULL);
+       else
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       rssi_level_changed_cb = callback;
+       rssi_level_changed_user_data = user_data;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_unset_rssi_level_changed_cb(void)
+{
+       if (rssi_level_changed_cb != NULL)
+               vconf_ignore_key_changed(VCONFKEY_WIFI_STRENGTH, __rssi_level_changed_cb);
+       else
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       rssi_level_changed_cb = NULL;
+       rssi_level_changed_user_data = NULL;
+
+       return WIFI_ERROR_NONE;
+}
+
diff --git a/src/net_wifi_ap.c b/src/net_wifi_ap.c
new file mode 100755 (executable)
index 0000000..474871e
--- /dev/null
@@ -0,0 +1,1071 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "net_wifi_private.h"
+
+
+static char* __ap_convert_ip_to_string(net_addr_t *ip_addr)
+{
+       unsigned char *ipaddr = (unsigned char *)&ip_addr->Data.Ipv4.s_addr;
+
+       char *ipstr = g_try_malloc0(16);
+       if (ipstr == NULL)
+               return NULL;
+
+       snprintf(ipstr, 16, "%d.%d.%d.%d", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
+
+       return ipstr;
+}
+
+static void __wifi_init_ap(net_profile_info_t *profile_info, const char *essid)
+{
+       profile_info->profile_type = NET_DEVICE_WIFI;
+       profile_info->ProfileState = NET_STATE_TYPE_IDLE;
+       profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_OFF;
+       profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_DIRECT;
+       profile_info->ProfileInfo.Wlan.wlan_mode = NETPM_WLAN_CONNMODE_AUTO;
+       profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_NONE;
+       profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_NONE;
+       g_strlcpy(profile_info->ProfileInfo.Wlan.essid, essid, NET_WLAN_ESSID_LEN+1);
+}
+
+/* Wi-Fi AP module ********************************************************************************/
+
+int wifi_ap_create(const char* essid, wifi_ap_h* ap)
+{
+       if (essid == NULL || ap == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *ap_info = g_try_malloc0(sizeof(net_profile_info_t));
+       if (ap_info == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       __wifi_init_ap(ap_info, essid);
+
+       _wifi_libnet_add_to_ap_list((wifi_ap_h)ap_info);
+       *ap = (wifi_ap_h)ap_info;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_destroy(wifi_ap_h ap)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       _wifi_libnet_remove_from_ap_list(ap);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin)
+{
+       if (_wifi_libnet_check_ap_validity(origin) == false || cloned_ap == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *ap_info = g_try_malloc0(sizeof(net_profile_info_t));
+       if (ap_info == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       memcpy(ap_info, origin, sizeof(net_profile_info_t));
+
+       _wifi_libnet_add_to_ap_list((wifi_ap_h)ap_info);
+       *cloned_ap = (wifi_ap_h)ap_info;
+
+       return WIFI_ERROR_NONE;
+}
+
+
+
+/* Wi-Fi network information module ***************************************************************/
+
+int wifi_ap_get_essid(wifi_ap_h ap, char** essid)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || essid == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *essid = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+       if (*essid == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || bssid == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *bssid = g_strdup(profile_info->ProfileInfo.Wlan.bssid);
+       if (*bssid == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || rssi == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *rssi = (int)profile_info->ProfileInfo.Wlan.Strength;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || frequency == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *frequency = (int)profile_info->ProfileInfo.Wlan.frequency;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || max_speed == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *max_speed = (int)profile_info->ProfileInfo.Wlan.max_rate;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || favorite == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       if (profile_info->Favourite)
+               *favorite = true;
+       else
+               *favorite = false;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || state == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileState) {
+       case NET_STATE_TYPE_IDLE:
+       case NET_STATE_TYPE_FAILURE:
+       case NET_STATE_TYPE_DISCONNECT:
+               *state = WIFI_CONNECTION_STATE_DISCONNECTED;
+               break;
+       case NET_STATE_TYPE_ASSOCIATION:
+       case NET_STATE_TYPE_CONFIGURATION:
+               *state = WIFI_CONNECTION_STATE_CONNECTING;
+               break;
+       case NET_STATE_TYPE_READY:
+       case NET_STATE_TYPE_ONLINE:
+               *state = WIFI_CONNECTION_STATE_CONNECTED;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileInfo.Wlan.net_info.IpConfigType) {
+       case NET_IP_CONFIG_TYPE_STATIC:
+               *type = WIFI_IP_CONFIG_TYPE_STATIC;
+               break;
+       case NET_IP_CONFIG_TYPE_DYNAMIC:
+               *type = WIFI_IP_CONFIG_TYPE_DYNAMIC;
+               break;
+       case NET_IP_CONFIG_TYPE_AUTO_IP:
+               *type = WIFI_IP_CONFIG_TYPE_AUTO;
+               break;
+       case NET_IP_CONFIG_TYPE_FIXED:
+               *type = WIFI_IP_CONFIG_TYPE_FIXED;
+               break;
+       case NET_IP_CONFIG_TYPE_OFF:
+               *type = WIFI_IP_CONFIG_TYPE_NONE;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6)) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (type) {
+       case WIFI_IP_CONFIG_TYPE_STATIC:
+               profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_STATIC;
+               break;
+       case WIFI_IP_CONFIG_TYPE_DYNAMIC:
+               profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_DYNAMIC;
+               break;
+       case WIFI_IP_CONFIG_TYPE_AUTO:
+               profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_AUTO_IP;
+               break;
+       case WIFI_IP_CONFIG_TYPE_FIXED:
+               profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_FIXED;
+               break;
+       case WIFI_IP_CONFIG_TYPE_NONE:
+               profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_OFF;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, char** ip_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           ip_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *ip_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.IpAddr);
+       if (*ip_address == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* ip_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           ip_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (inet_aton(ip_address, &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0)
+               return WIFI_ERROR_INVALID_PARAMETER;
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, char** subnet_mask)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           subnet_mask == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *subnet_mask = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.SubnetMask);
+       if (*subnet_mask == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, const char* subnet_mask)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           subnet_mask == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (inet_aton(subnet_mask, &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) == 0)
+               return WIFI_ERROR_INVALID_PARAMETER;
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, char** gateway_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           gateway_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *gateway_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.GatewayAddr);
+       if (*gateway_address == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* gateway_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           gateway_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (inet_aton(gateway_address, &(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4)) == 0)
+               return WIFI_ERROR_INVALID_PARAMETER;
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, char** proxy_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           proxy_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       *proxy_address = g_strdup(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr);
+       if (*proxy_address == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* proxy_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           proxy_address == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr, proxy_address, NET_PROXY_LEN_MAX+1);
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileInfo.Wlan.net_info.ProxyMethod) {
+       case NET_PROXY_TYPE_DIRECT:
+               *type = WIFI_PROXY_TYPE_DIRECT;
+               break;
+       case NET_PROXY_TYPE_AUTO:
+               *type = WIFI_PROXY_TYPE_AUTO;
+               break;
+       case NET_PROXY_TYPE_MANUAL:
+               *type = WIFI_PROXY_TYPE_MANUAL;
+               break;
+       case NET_PROXY_TYPE_UNKNOWN:
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (proxy_type) {
+       case WIFI_PROXY_TYPE_DIRECT:
+               profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_DIRECT;
+               break;
+       case WIFI_PROXY_TYPE_AUTO:
+               profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_AUTO;
+               break;
+       case WIFI_PROXY_TYPE_MANUAL:
+               profile_info->ProfileInfo.Wlan.net_info.ProxyMethod = NET_PROXY_TYPE_MANUAL;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, char** dns_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           dns_address == NULL ||
+           order <= 0 ||
+           order > NET_DNS_ADDR_MAX) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       *dns_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1]);
+       if (*dns_address == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, const char* dns_address)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false ||
+           (address_family != WIFI_ADDRESS_FAMILY_IPV4 &&
+            address_family != WIFI_ADDRESS_FAMILY_IPV6) ||
+           dns_address == NULL ||
+           order <= 0 ||
+           order > NET_DNS_ADDR_MAX) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
+               WIFI_LOG(WIFI_ERROR, "Not supported yet\n");
+               return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (inet_aton(dns_address, &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4)) == 0)
+               return WIFI_ERROR_INVALID_PARAMETER;
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+
+
+/* Wi-Fi security information module **************************************************************/
+
+int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) {
+       case WLAN_SEC_MODE_NONE:
+               *type = WIFI_SECURITY_TYPE_NONE;
+               break;
+       case WLAN_SEC_MODE_WEP:
+               *type = WIFI_SECURITY_TYPE_WEP;
+               break;
+       case WLAN_SEC_MODE_IEEE8021X:
+               *type = WIFI_SECURITY_TYPE_EAP;
+               break;
+       case WLAN_SEC_MODE_WPA_PSK:
+               *type = WIFI_SECURITY_TYPE_WPA_PSK;
+               break;
+       case WLAN_SEC_MODE_WPA2_PSK:
+               *type = WIFI_SECURITY_TYPE_WPA2_PSK;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (type) {
+       case WIFI_SECURITY_TYPE_NONE:
+               profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_NONE;
+               break;
+       case WIFI_SECURITY_TYPE_WEP:
+               profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_WEP;
+               break;
+       case WIFI_SECURITY_TYPE_EAP:
+               profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
+               break;
+       case WIFI_SECURITY_TYPE_WPA_PSK:
+               profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
+               break;
+       case WIFI_SECURITY_TYPE_WPA2_PSK:
+               profile_info->ProfileInfo.Wlan.security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileInfo.Wlan.security_info.enc_mode) {
+       case WLAN_ENC_MODE_NONE:
+               *type = WIFI_ENCRYPTION_TYPE_NONE;
+               break;
+       case WLAN_ENC_MODE_WEP:
+               *type = WIFI_ENCRYPTION_TYPE_WEP;
+               break;
+       case WLAN_ENC_MODE_TKIP:
+               *type = WIFI_ENCRYPTION_TYPE_TKIP;
+               break;
+       case WLAN_ENC_MODE_AES:
+               *type = WIFI_ENCRYPTION_TYPE_AES;
+               break;
+       case WLAN_ENC_MODE_TKIP_AES_MIXED:
+               *type = WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (type) {
+       case WIFI_ENCRYPTION_TYPE_NONE:
+               profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_NONE;
+               break;
+       case WIFI_ENCRYPTION_TYPE_WEP:
+               profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_WEP;
+               break;
+       case WIFI_ENCRYPTION_TYPE_TKIP:
+               profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_TKIP;
+               break;
+       case WIFI_ENCRYPTION_TYPE_AES:
+               profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_AES;
+               break;
+       case WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED:
+               profile_info->ProfileInfo.Wlan.security_info.enc_mode = WLAN_ENC_MODE_TKIP_AES_MIXED;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || required == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       if (profile_info->ProfileInfo.Wlan.PassphraseRequired)
+               *required = true;
+       else
+               *required = false;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || passphrase == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) {
+       case WLAN_SEC_MODE_WEP:
+               g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.wep.wepKey,
+                               passphrase, NETPM_WLAN_MAX_WEP_KEY_LEN+1);
+               break;
+       case WLAN_SEC_MODE_WPA_PSK:
+       case WLAN_SEC_MODE_WPA2_PSK:
+               g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.psk.pskKey,
+                               passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN+1);
+               break;
+       case WLAN_SEC_MODE_NONE:
+       case WLAN_SEC_MODE_IEEE8021X:
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
+               return WIFI_ERROR_NONE;
+
+       return _wifi_update_ap_info(profile_info);
+}
+
+int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || supported == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+
+       if (profile_info->ProfileInfo.Wlan.security_info.wps_support)
+               *supported = true;
+       else
+               *supported = false;
+
+       return WIFI_ERROR_NONE;
+}
+
+
+
+/* Wi-Fi EAP module *******************************************************************************/
+
+int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* password)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || user_name == NULL || password == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.username,
+                       user_name, NETPM_WLAN_USERNAME_LEN+1);
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.password,
+                       password, NETPM_WLAN_PASSWORD_LEN+1);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_eap_ca_cert_file(wifi_ap_h ap, char** file)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       *file = g_strdup(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.ca_cert_filename);
+       if (*file == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_eap_ca_cert_file(wifi_ap_h ap, const char* file)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.ca_cert_filename,
+                       file, NETPM_WLAN_CA_CERT_FILENAME_LEN+1);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_eap_client_cert_file(wifi_ap_h ap, char** file)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       *file = g_strdup(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.client_cert_filename);
+       if (*file == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.client_cert_filename,
+                       file, NETPM_WLAN_CLIENT_CERT_FILENAME_LEN+1);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       *file = g_strdup(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.private_key_filename);
+       if (*file == NULL)
+               return WIFI_ERROR_OUT_OF_MEMORY;
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* password)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL || password == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.private_key_filename,
+                       file, NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN+1);
+       g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.eap.private_key_passwd,
+                       password, NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN+1);
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       switch (profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type) {
+       case WLAN_SEC_EAP_TYPE_PEAP:
+               *type = WIFI_EAP_TYPE_PEAP;
+               break;
+       case WLAN_SEC_EAP_TYPE_TLS:
+               *type = WIFI_EAP_TYPE_TLS;
+               break;
+       case WLAN_SEC_EAP_TYPE_TTLS:
+               *type = WIFI_EAP_TYPE_TTLS;
+               break;
+       case WLAN_SEC_EAP_TYPE_SIM:
+               *type = WIFI_EAP_TYPE_SIM;
+               break;
+       case WLAN_SEC_EAP_TYPE_AKA:
+               *type = WIFI_EAP_TYPE_AKA;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       switch (type) {
+       case WIFI_EAP_TYPE_PEAP:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_PEAP;
+               break;
+       case WIFI_EAP_TYPE_TLS:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_TLS;
+               break;
+       case WIFI_EAP_TYPE_TTLS:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_TTLS;
+               break;
+       case WIFI_EAP_TYPE_SIM:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_SIM;
+               break;
+       case WIFI_EAP_TYPE_AKA:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_type = WLAN_SEC_EAP_TYPE_AKA;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       switch (profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth) {
+       case WLAN_SEC_EAP_AUTH_NONE:
+               *type = WIFI_EAP_AUTH_TYPE_NONE;
+               break;
+       case WLAN_SEC_EAP_AUTH_PAP:
+               *type = WIFI_EAP_AUTH_TYPE_PAP;
+               break;
+       case WLAN_SEC_EAP_AUTH_MSCHAP:
+               *type = WIFI_EAP_AUTH_TYPE_MSCHAP;
+               break;
+       case WLAN_SEC_EAP_AUTH_MSCHAPV2:
+               *type = WIFI_EAP_AUTH_TYPE_MSCHAPV2;
+               break;
+       case WLAN_SEC_EAP_AUTH_GTC:
+               *type = WIFI_EAP_AUTH_TYPE_GTC;
+               break;
+       case WLAN_SEC_EAP_AUTH_MD5:
+               *type = WIFI_EAP_AUTH_TYPE_MD5;
+               break;
+       default:
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+int wifi_ap_set_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e type)
+{
+       if (_wifi_libnet_check_ap_validity(ap) == false) {
+               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       if (profile_info->ProfileInfo.Wlan.security_info.sec_mode != WLAN_SEC_MODE_IEEE8021X)
+               return WIFI_ERROR_INVALID_OPERATION;
+
+       switch (type) {
+       case WIFI_EAP_AUTH_TYPE_NONE:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_NONE;
+               break;
+       case WIFI_EAP_AUTH_TYPE_PAP:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_PAP;
+               break;
+       case WIFI_EAP_AUTH_TYPE_MSCHAP:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_MSCHAP;
+               break;
+       case WIFI_EAP_AUTH_TYPE_MSCHAPV2:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_MSCHAPV2;
+               break;
+       case WIFI_EAP_AUTH_TYPE_GTC:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_GTC;
+               break;
+       case WIFI_EAP_AUTH_TYPE_MD5:
+               profile_info->ProfileInfo.Wlan.security_info.authentication.eap.eap_auth = WLAN_SEC_EAP_AUTH_MD5;
+               break;
+       default:
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       return WIFI_ERROR_NONE;
+}
+
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7715cac
--- /dev/null
@@ -0,0 +1,17 @@
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0)
+FOREACH(flag ${${fw_test}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+aux_source_directory(. sources)
+FOREACH(src ${sources})
+    GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+    MESSAGE("${src_name}")
+    ADD_EXECUTABLE(${src_name} ${src})
+    TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
diff --git a/test/wifi_test.c b/test/wifi_test.c
new file mode 100644 (file)
index 0000000..2a6f098
--- /dev/null
@@ -0,0 +1,540 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/un.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+#include "assert.h"
+#include "glib.h"
+#include <wifi.h>
+#include <tizen_error.h>
+
+
+gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
+
+
+static void __test_device_state_callback(wifi_error_e error_code, wifi_device_state_e state, bool is_requested, void* user_data)
+{
+       printf("Device state changed callback, error code : %d, requested : %d", error_code, is_requested);
+
+       if (state == WIFI_DEVICE_STATE_ACTIVATED)
+               printf(", state : Activated\n");
+       else
+               printf(", state : Deactivated\n");
+}
+
+static void __test_bg_scan_completed_callback(wifi_error_e error_code, void* user_data)
+{
+       printf("Background Scan Completed, error code : %d\n", error_code);
+}
+
+static void __test_scan_request_callback(wifi_error_e error_code, void* user_data)
+{
+       printf("Scan Completed from scan request, error code : %d\n", error_code);
+}
+
+static void __test_connection_state_callback(wifi_error_e error_code, wifi_connection_state_e state, wifi_ap_h ap, bool is_requested, void* user_data)
+{
+       int rv = 0;
+       char *ap_name = NULL;
+
+       printf("Connection state changed callback, error code : %d, requested : %d", error_code, is_requested);
+
+       switch (state) {
+       case WIFI_CONNECTION_STATE_CONNECTING:
+               printf(", state : Connecting");
+               break;
+       case WIFI_CONNECTION_STATE_CONNECTED:
+               printf(", state : Connected");
+               break;
+       case WIFI_CONNECTION_STATE_DISCONNECTING:
+               printf(", state : Disconnecting");
+               break;
+       case WIFI_CONNECTION_STATE_DISCONNECTED:
+               printf(", state : Disconnected");
+               break;
+       }
+
+       rv = wifi_ap_get_essid(ap, &ap_name);
+       if (rv != WIFI_ERROR_NONE)
+               printf(", Fail to get AP name [%d]\n", rv);
+       else {
+               printf(", AP name : %s\n", ap_name);
+               g_free(ap_name);
+       }
+}
+
+static void __test_rssi_level_callback(wifi_rssi_level_e rssi_level, void* user_data)
+{
+       printf("RSSI level changed callback, level = %d\n", rssi_level);
+}
+
+static const char* __test_print_state(wifi_connection_state_e state)
+{
+       switch (state) {
+       case WIFI_CONNECTION_STATE_DISCONNECTED:
+               return "Disconnected";
+       case WIFI_CONNECTION_STATE_CONNECTING:
+               return "Connecting";
+       case WIFI_CONNECTION_STATE_CONNECTED:
+               return "Connected";
+       case WIFI_CONNECTION_STATE_DISCONNECTING:
+               return "Disconnecting";
+       }
+
+       return "Unknown";
+}
+
+static bool __test_found_ap_callback(wifi_ap_h ap, void *user_data)
+{
+       int rv = 0;
+       char *ap_name = NULL;
+       wifi_connection_state_e state;
+
+       rv = wifi_ap_get_essid(ap, &ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get AP name [%d]\n", rv);
+               return false;
+       }
+
+       rv = wifi_ap_get_connection_state(ap, &state);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get State [%d]\n", rv);
+               g_free(ap_name);
+               return false;
+       }
+
+       printf("AP name : %s, state : %s\n", ap_name, __test_print_state(state));
+       g_free(ap_name);
+
+       return true;
+}
+
+static bool __test_found_connect_ap_callback(wifi_ap_h ap, void *user_data)
+{
+       int rv = 0;
+       char *ap_name = NULL;
+       char *ap_name_part = (char*)user_data;
+
+       rv = wifi_ap_get_essid(ap, &ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get AP name [%d]\n", rv);
+               return false;
+       }
+
+       if (strstr(ap_name, ap_name_part) != NULL) {
+               bool required = false;
+               wifi_ap_is_passphrase_required(ap, &required);
+
+               if (required) {
+                       char passphrase[100];
+                       printf("Input passphrase for %s : ", ap_name);
+                       rv = scanf("%100s", passphrase);
+
+                       rv = wifi_ap_set_passphrase(ap, passphrase);
+                       if (rv != WIFI_ERROR_NONE) {
+                               printf("Fail to set passphrase : %d\n", rv);
+                               g_free(ap_name);
+                               return false;
+                       }
+               }
+
+               rv = wifi_connect(ap);
+               if (rv != WIFI_ERROR_NONE)
+                       printf("Fail to connect [%s] : %d\n", ap_name, rv);
+               else
+                       printf("Success to connect [%s]\n", ap_name);
+
+               g_free(ap_name);
+               return false;
+       }
+
+       g_free(ap_name);
+       return true;
+}
+
+static bool __test_found_disconnect_ap_callback(wifi_ap_h ap, void *user_data)
+{
+       int rv = 0;
+       char *ap_name = NULL;
+       char *ap_name_part = (char*)user_data;
+
+       rv = wifi_ap_get_essid(ap, &ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get AP name [%d]\n", rv);
+               return false;
+       }
+
+       if (strstr(ap_name, ap_name_part) != NULL) {
+               rv = wifi_disconnect(ap);
+               if (rv != WIFI_ERROR_NONE)
+                       printf("Fail to disconnect %s : [%d]\n", ap_name, rv);
+               else
+                       printf("Success to disconnect %s\n", ap_name);
+
+               g_free(ap_name);
+               return false;
+       }
+
+       g_free(ap_name);
+       return true;
+}
+
+int test_wifi_init(void)
+{
+       int rv = wifi_initialize();
+
+       if (rv == WIFI_ERROR_NONE) {
+               wifi_set_device_state_changed_cb(__test_device_state_callback, NULL);
+               wifi_set_background_scan_cb(__test_bg_scan_completed_callback, NULL);
+               wifi_set_connection_state_changed_cb(__test_connection_state_callback, NULL);
+               wifi_set_rssi_level_changed_cb(__test_rssi_level_callback, NULL);
+       } else {
+               printf("Wifi init failed [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Wifi init succeeded\n");
+       return 1;
+}
+int  test_wifi_deinit(void)
+{
+       int rv = 0;
+
+       rv = wifi_deinitialize();
+
+       if (rv != WIFI_ERROR_NONE){
+               printf("Wifi deinit failed [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Wifi deinit succeeded\n");
+       return 1;
+}
+
+int test_wifi_activate(void)
+{
+       int rv = 0;
+
+       rv = wifi_activate();
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to activate Wi-Fi device [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Success to activate Wi-Fi device\n");
+
+       return 1;
+}
+
+int test_wifi_deactivate(void)
+{
+       int rv = 0;
+
+       rv = wifi_deactivate();
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to deactivate Wi-Fi device [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Success to deactivate Wi-Fi device\n");
+
+       return 1;
+}
+
+int test_is_activated(void)
+{
+       int rv = 0;
+       bool state;
+
+       rv = wifi_is_activated(&state);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get Wi-Fi device state [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Success to get Wi-Fi device state : %s\n", (state) ? "TRUE" : "FALSE");
+
+       return 1;
+}
+
+int test_get_connection_state(void)
+{
+       int rv = 0;
+       wifi_connection_state_e connection_state;
+
+       rv = wifi_get_connection_state(&connection_state);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get connection state [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Success to get connection state : ");
+       switch (connection_state) {
+       case WIFI_CONNECTION_STATE_CONNECTING:
+               printf("Connecting\n");
+               break;
+       case WIFI_CONNECTION_STATE_CONNECTED:
+               printf("Connected\n");
+               break;
+       case WIFI_CONNECTION_STATE_DISCONNECTING:
+               printf("Disconnecting\n");
+               break;
+       case WIFI_CONNECTION_STATE_DISCONNECTED:
+               printf("Disconnected\n");
+               break;
+       default:
+               printf("Unknown\n");
+       }
+
+       return 1;
+}
+
+int test_get_mac_address(void)
+{
+       int rv = 0;
+       char *mac_addr = NULL;
+
+       rv = wifi_get_mac_address(&mac_addr);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get MAC address [%d]\n", rv);
+               return -1;
+       }
+
+       printf("MAC address : %s\n", mac_addr);
+       g_free(mac_addr);
+
+       return 1;
+}
+
+int test_get_interface_name(void)
+{
+       int rv = 0;
+       char *if_name = NULL;
+
+       rv = wifi_get_network_interface_name(&if_name);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get Interface name [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Interface name : %s\n", if_name);
+       g_free(if_name);
+
+       return 1;
+}
+
+int test_scan_request(void)
+{
+       int rv = 0;
+
+       rv = wifi_scan(__test_scan_request_callback, NULL);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Scan request failed [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Scan request succeeded\n");
+
+       return 1;
+}
+
+int test_get_connected_ap(void)
+{
+       int rv = 0;
+       char *ap_name = NULL;
+       wifi_ap_h ap_h;
+
+       rv = wifi_get_connected_ap(&ap_h);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get connected AP [%d]\n", rv);
+               return -1;
+       }
+
+       rv = wifi_ap_get_essid(ap_h, &ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get connected AP [%d]\n", rv);
+               wifi_ap_destroy(ap_h);
+               return -1;
+       }
+
+       printf("Connected AP : %s\n", ap_name);
+       g_free(ap_name);
+       wifi_ap_destroy(ap_h);
+
+       return 1;
+}
+
+int test_foreach_found_aps(void)
+{
+       int rv = 0;
+
+       rv = wifi_foreach_found_aps(__test_found_ap_callback, NULL);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get AP list [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Get AP list finished\n");
+
+       return 1;
+}
+
+int test_connect_ap(void)
+{
+       int rv = 0;
+       char ap_name[32];
+
+       printf("Input a part of AP name to connect : ");
+       rv = scanf("%32s", ap_name);
+
+       rv = wifi_foreach_found_aps(__test_found_connect_ap_callback, ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to connect (can't get AP list) [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Connection step finished\n");
+       return 1;
+}
+
+int test_disconnect_ap(void)
+{
+       int rv = 0;
+       char ap_name[32];
+
+       printf("Input a part of AP name to disconnect : ");
+       rv = scanf("%32s", ap_name);
+
+       rv = wifi_foreach_found_aps(__test_found_disconnect_ap_callback, ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to disconnect (can't get AP list) [%d]\n", rv);
+               return -1;
+       }
+
+       printf("Disconnection step finished\n");
+       return 1;
+}
+
+int main(int argc, char **argv)
+{
+       GMainLoop *mainloop;
+       mainloop = g_main_loop_new (NULL, FALSE);
+
+       GIOChannel *channel = g_io_channel_unix_new(0);
+       g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread,NULL );
+
+       printf("Test Thread created...\n");
+
+       g_main_loop_run (mainloop);
+
+       return 0;
+}
+
+gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
+{
+       int rv = 0;
+       char a[100];
+
+       memset(a, '\0', 100);
+       printf("Event received from stdin\n");
+
+       rv = read(0, a, 100);
+
+       if (rv < 0 || a[0] == '0') exit(1);
+
+       if (*a == '\n' || *a == '\r'){
+               printf("\n\n Network Connection API Test App\n\n");
+               printf("Options..\n");
+               printf("1       - Wi-Fi init and set callbacks\n");
+               printf("2       - Wi-Fi deinit(unset callbacks automatically)\n");
+               printf("3       - Activate Wi-Fi device\n");
+               printf("4       - Deactivate Wi-Fi device\n");
+               printf("5       - Is Wi-Fi activated?\n");
+               printf("6       - Get connection state\n");
+               printf("7       - Get MAC address\n");
+               printf("8       - Get Wi-Fi interface name\n");
+               printf("9       - Scan request\n");
+               printf("a       - Get Connected AP\n");
+               printf("b       - Get AP list\n");
+               printf("c       - Connect\n");
+               printf("d       - Disconnect\n");
+               printf("0       - Exit \n");
+
+               printf("ENTER  - Show options menu.......\n");
+       }
+
+       switch (a[0]) {
+               case '1': {
+                       rv = test_wifi_init();
+               } break;
+               case '2': {
+                       rv = test_wifi_deinit();
+               } break;
+               case '3': {
+                       rv = test_wifi_activate();
+               } break;
+               case '4': {
+                       rv = test_wifi_deactivate();
+               } break;
+               case '5': {
+                       rv = test_is_activated();
+               } break;
+               case '6': {
+                       rv = test_get_connection_state();
+               } break;
+               case '7': {
+                       rv = test_get_mac_address();
+               } break;
+               case '8': {
+                       rv = test_get_interface_name();
+               } break;
+               case '9': {
+                       rv = test_scan_request();
+               } break;
+               case 'a': {
+                       rv = test_get_connected_ap();
+               } break;
+               case 'b': {
+                       rv = test_foreach_found_aps();
+               } break;
+               case 'c': {
+                       rv = test_connect_ap();
+               } break;
+               case 'd': {
+                       rv = test_disconnect_ap();
+               } break;
+       }
+       return TRUE;
+}
+