Tizen 2.0 Release tizen_2.0 accepted/tizen_2.0/20130215.203853 submit/tizen_2.0/20130215.191721
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:12:31 +0000 (00:12 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:12:31 +0000 (00:12 +0900)
18 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [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/libwifi-direct-dev.install.in [new file with mode: 0644]
debian/libwifi-direct.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/wifi-direct-internal.h [new file with mode: 0644]
include/wifi-direct.h [new file with mode: 0644]
libwifi-direct.manifest [new file with mode: 0644]
packaging/libwifi-direct.spec [new file with mode: 0755]
src/CMakeLists.txt [new file with mode: 0644]
src/include/wifi-direct-client-proxy.h [new file with mode: 0644]
src/wifi-direct-client-proxy.c [new file with mode: 0644]
src/wifi-direct-utils.c [new file with mode: 0644]
src/wifi-direct.pc.in [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..1929bb3
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Dongwook Lee <dwmax.lee@samsung.com>
+Sungsik Jang <sungsik.jang@samsung.com>
+Gibyoung Kim <lastkgb.kim@samsung.com>
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..702526d
--- /dev/null
@@ -0,0 +1,10 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(libwifi-direct C)
+
+#SET(PREFIX $(CMAKE_INSTALL_PREFIX))
+SET(prefix "/usr")
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+
+ADD_SUBDIRECTORY(src)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 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/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..4d2f461
--- /dev/null
@@ -0,0 +1,328 @@
+libwifi-direct (0.3.4) unstable; urgency=low
+
+  * Fix bug of invitation behavior
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.3.4
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Sun, 3 Jan 2013 02:53:04 +0900
+
+libwifi-direct (0.3.3) unstable; urgency=low
+
+  * Package Update
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.3.3
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Fri, 25 Jan 2013 21:09:15 +0900
+
+libwifi-direct (0.3.2) unstable; urgency=low
+
+  * DLog macro is changed
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.3.2
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Tue, 18 Dec 2012 20:00:45 +0900
+
+libwifi-direct (0.3.1) unstable; urgency=low
+
+  * Implementation of wifi_direct_get_device_name / wifi_direct_set_device_name
+  * Implementation of persistent mode
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.3.1
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Tue, 11 Dec 2012 17:52:11 +0900
+
+libwifi-direct (0.3.0) unstable; urgency=low
+
+  * Update from private
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.3.0
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Fri, 23 Nov 2012 22:26:45 +0900
+
+libwifi-direct (0.2.15) unstable; urgency=low
+
+  * Install vconf keys with -i option
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.15
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Fri, 07 Sep 2012 19:38:12 +0900
+
+libwifi-direct (0.2.14) unstable; urgency=low
+
+  * changed writing option of vconftool to solve get ip address problerm.
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.14
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Fri, 07 Sep 2012 11:08:12 +0900
+
+libwifi-direct (0.2.13) unstable; urgency=low
+
+  * modified the activation problerm (changed plugin so)
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.13
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Mon, 03 Sep 2012 12:33:33 +0900
+
+libwifi-direct (0.2.12) unstable; urgency=low
+
+  * modified the activation problerm
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.12
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Fri, 31 Aug 2012 18:03:23 +0900
+
+libwifi-direct (0.2.11) unstable; urgency=low
+
+  * Fix emulator build errro.
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.11
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Wed, 29 Aug 2012 17:48:39 +0900
+
+libwifi-direct (0.2.10) unstable; urgency=low
+
+  * changed the binary of wifi-direct-manager.
+  * Git : rsa/framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.10
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Tue, 28 Aug 2012 17:46:39 +0900
+
+libwifi-direct (0.2.9) unstable; urgency=low
+
+  * modified to loading binary of wifi-direct-manager when installing package.
+  * Git : framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.9
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Fri, 24 Aug 2012 18:45:19 +0900
+
+libwifi-direct (0.2.8) unstable; urgency=low
+
+  * tagging "tizen_build"
+  * Git : framework/connectivity/libwifi-direct
+  * Tag : libwifi-direct_0.2.8
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Mon, 13 Aug 2012 15:37:09 +0900
+
+libwifi-direct (0.2.7) unstable; urgency=low
+
+  * stripped package
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.7
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Mon, 16 Jul 2012 13:08:38 +0900
+
+libwifi-direct (0.2.5) unstable; urgency=low
+
+  * applied new APIs.
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.5
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Fri, 01 Jun 2012 15:20:07 +0900
+
+libwifi-direct (0.2.4) unstable; urgency=low
+
+  * package version update
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.4
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Thu, 24 May 2012 02:05:08 +0900
+
+libwifi-direct (0.2.3) unstable; urgency=low
+
+  * IP lease (DHCP) event is added.
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.3
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Mon, 21 May 2012 11:46:18 +0900
+
+libwifi-direct (0.2.2) unstable; urgency=low
+
+  * package update
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.2
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Sat, 19 May 2012 01:39:34 +0900
+
+libwifi-direct (0.2.1) unstable; urgency=low
+
+  * added new APIs for bada
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.1
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Wed, 09 May 2012 13:39:38 +0900
+
+libwifi-direct (0.2.0) unstable; urgency=low
+
+  * Wi-Fi Direct Library initial upload
+  * Git : slp/pkgs/l/libwifi-direct
+  * Tag : libwifi-direct_0.2.0
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Mon, 23 Apr 2012 11:49:23 +0900
+
+wifi-direct (0.1.8) unstable; urgency=low
+
+  * fixed i386 build break
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.8
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 19 Apr 2012 23:03:05 +0900
+
+wifi-direct (0.1.7) unstable; urgency=low
+
+  * fixed i386 build break
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.7
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 19 Apr 2012 22:51:36 +0900
+
+wifi-direct (0.1.6) unstable; urgency=low
+
+  * modified the defect of displaying popup
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.6
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 19 Apr 2012 22:28:09 +0900
+
+wifi-direct (0.1.5) unstable; urgency=low
+
+  * modified spec file / modified the foreach API
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.5
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 29 Mar 2012 15:20:25 +0900
+
+wifi-direct (0.1.4) unstable; urgency=low
+
+  * Check socket fd is writable to avoid accessing a closed socket fd.
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.4
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>  Tue, 20 Mar 2012 13:14:25 +0900
+
+wifi-direct (0.1.3) unstable; urgency=low
+
+  * applied the changed dbus interface name of SONET
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.3
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Tue, 20 Mar 2012 09:57:15 +0900
+
+wifi-direct (0.1.2) unstable; urgency=low
+
+  * fixed build dependancy problerm
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.2
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Fri, 16 Mar 2012 13:41:24 +0900
+
+wifi-direct (0.1.1) unstable; urgency=low
+
+  * Applied C API style (Phase 2)
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.1
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Wed, 14 Mar 2012 13:57:03 +0900
+
+wifi-direct (0.1.0) unstable; urgency=low
+
+  * Applied C API style (Phase 2)
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.1.0
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Wed, 14 Mar 2012 13:03:46 +0900
+
+wifi-direct (0.0.11) unstable; urgency=low
+
+  * changed connection callback function / changed deactivation oem to excute wifi-direct drive off
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.11
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Tue, 28 Feb 2012 16:40:34 +0900
+
+wifi-direct (0.0.10) unstable; urgency=low
+
+  * added launching system popup application / fixed disconnection defect
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.10
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Tue, 21 Feb 2012 17:29:54 +0900
+
+wifi-direct (0.0.9) unstable; urgency=low
+
+  * fixed i386 build error
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.9
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 16 Feb 2012 21:47:42 +0900
+
+wifi-direct (0.0.8) unstable; urgency=low
+
+  * Applied C API style
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.8
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 16 Feb 2012 13:57:02 +0900
+
+wifi-direct (0.0.7) unstable; urgency=low
+
+  * Rollback to wifi-direct_0.0.6 + sonet dbus name change(com.samsung.sonet->net.sonet)
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.7
+
+ -- Dongwook Lee <dwmax.lee@samsung.com>>  Fri, 10 Feb 2012 10:15:01 +0900
+
+wifi-direct (0.0.6) unstable; urgency=low
+
+  * Fixed S1-1045 (wl0.1 default interface issue) / updated doxygen
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.6
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Wed, 01 Feb 2012 19:12:44 +0900
+
+wifi-direct (0.0.5) unstable; urgency=low
+
+  * Fixed i386 build error issue
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.5
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 19 Jan 2012 14:28:15 +0900
+
+wifi-direct (0.0.4) unstable; urgency=low
+
+  * Fixed i386 build error issue
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.4
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Thu, 19 Jan 2012 14:15:44 +0900
+
+wifi-direct (0.0.3) unstable; urgency=low
+
+  * Fixed i386 build error issue
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.3
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Tue, 17 Jan 2012 00:01:17 +0900
+
+wifi-direct (0.0.2) unstable; urgency=low
+
+  * Fixed uploading issue
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.2
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Mon, 16 Jan 2012 23:39:22 +0900
+
+wifi-direct (0.0.1) unstable; urgency=low
+
+  * Applied new release
+  * Git : slp/pkgs/w/wifi-direct
+  * Tag : wifi-direct_0.0.1
+
+ -- Sungsik Jang <sungsik.jang@samsung.com>  Mon, 16 Jan 2012 21:42:30 +0900
+
+wifi-direct (0.0.1) unstable; urgency=low
+
+  * debian/changelog
+
+ -- Misun Kim <ms0123.kim@samsung.com>  Tue, 22 Feb 2011 16:54:20 +0900
+
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..bb6ba23
--- /dev/null
@@ -0,0 +1,20 @@
+Source: libwifi-direct
+Section: net
+Priority: extra
+Maintainer: Dongwook Lee <dwmax.lee@samsung.com>, Sungsik Jang <sungsik.jang@samsung.com>
+Uploaders: Dongwook Lee <dwmax.lee@samsung.com> Sungsik Jang <sungsik.jang@samsung.com>, Taeksu Shin <taeksu.shin@samsung.com>
+Build-Depends: debhelper (>= 5), autotools-dev, libslp-setting-dev, libglib2.0-dev, dlog-dev, libdbus-glib-1-dev
+Standards-Version: 3.7.2
+
+Package: libwifi-direct
+Section: libs
+Architecture: any 
+Depends: ${shlibs:Depends}, ${misc:Depends},  libslp-setting-0, libglib2.0-0 
+Description: wifi direct library (Shared Library)
+
+Package: libwifi-direct-dev
+Section: libs
+Architecture: any 
+Depends: libwifi-direct (= ${Source-Version}), libslp-setting-dev, libglib2.0-dev
+Description: wifi direct (Development)
+
diff --git a/debian/libwifi-direct-dev.install.in b/debian/libwifi-direct-dev.install.in
new file mode 100644 (file)
index 0000000..7689c5c
--- /dev/null
@@ -0,0 +1,3 @@
+@PREFIX@/include/wifi-direct/*.h
+@PREFIX@/lib/*.la
+@PREFIX@/lib/pkgconfig/wifi-direct.pc
diff --git a/debian/libwifi-direct.install.in b/debian/libwifi-direct.install.in
new file mode 100644 (file)
index 0000000..43ae715
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/libwifi*.so*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..20f4d76
--- /dev/null
@@ -0,0 +1,136 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?= 
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+CFLAGS += -DX1SETTING -D_DLOG_UTIL
+#LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib
+
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE) -j5
+
+       dpkg-architecture
+       echo "deb-arch = ${DEB_BUILD_ARCH}"
+               
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+        done
+       
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       -$(MAKE) clean
+       rm -rf CMakeCache.txt
+       rm -rf CMakeFiles
+       rm -rf cmake_install.cmake
+       rm -rf Makefile
+       rm -rf install_manifest.txt
+       
+       rm -rf data/CMakeCache.txt
+       rm -rf data/CMakeFiles
+       rm -rf data/cmake_install.cmake
+       rm -rf data/install_manifest.txt
+       rm -rf data/Makefile
+       
+       rm -rf data/po/CMakeCache.txt
+       rm -rf data/po/CMakeFiles
+       rm -rf data/po/cmake_install.cmake
+       rm -rf data/po/install_manifest.txt
+       rm -rf data/po/Makefile
+       rm -rf data/po/*.mo
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+#      dh_strip --dbg-package=
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       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/wifi-direct-internal.h b/include/wifi-direct-internal.h
new file mode 100644 (file)
index 0000000..e9ccb73
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * libwifi-direct
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
+ *
+ * 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 __WIFI_DIRECT_INTERNAL_H_
+#define __WIFI_DIRECT_INTERNAL_H_
+
+#include "wifi-direct.h"
+
+
+#define true 1
+#define false 0
+
+#define WFD_INVALID_ID -1
+
+
+#ifndef O_NONBLOCK
+#define O_NONBLOCK  O_NDELAY
+#endif /** O_NONBLOCK */
+
+
+#ifndef _UINT32_TYPE_H_
+#define _UINT32_TYPE_H_
+typedef unsigned int uint32;
+#endif /** _UINT32_TYPE_H_ */
+
+typedef unsigned int ipv4_addr_t;
+
+#ifndef TRUE
+#define TRUE 1
+#endif /** TRUE */
+
+#ifndef FALSE
+#define FALSE 0
+#endif /** FALSE */
+
+#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+#define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
+
+#define IPSTR "%d.%d.%d.%d"
+
+#define WIFI_DIRECT_MAX_SSID_LEN 32
+#define WIFI_DIRECT_MAX_DEVICE_NAME_LEN 32
+#define WIFI_DIRECT_WPS_PIN_LEN 8
+#define WIFI_DIRECT_MAC_ADDRESS_INFO_FILE "/opt/etc/.mac.info"
+
+#define VCONFKEY_IFNAME "memory/private/wifi_direct_manager/p2p_ifname"
+#define VCONFKEY_LOCAL_IP "memory/private/wifi_direct_manager/p2p_local_ip"
+#define VCONFKEY_SUBNET_MASK "memory/private/wifi_direct_manager/p2p_subnet_mask"
+#define VCONFKEY_GATEWAY "memory/private/wifi_direct_manager/p2p_gateway"
+
+typedef enum
+{
+       WIFI_DIRECT_CMD_INVALID,
+       WIFI_DIRECT_CMD_REGISTER,
+       WIFI_DIRECT_CMD_INIT_ASYNC_SOCKET,
+       WIFI_DIRECT_CMD_DEREGISTER,
+       WIFI_DIRECT_CMD_ACTIVATE,
+       WIFI_DIRECT_CMD_DEACTIVATE,
+       WIFI_DIRECT_CMD_START_DISCOVERY,
+       WIFI_DIRECT_CMD_CANCEL_DISCOVERY,
+       WIFI_DIRECT_CMD_GET_DISCOVERY_RESULT,
+       WIFI_DIRECT_CMD_GET_LINK_STATUS,
+       WIFI_DIRECT_CMD_CONNECT,
+       WIFI_DIRECT_CMD_DISCONNECT_ALL,
+       WIFI_DIRECT_CMD_CREATE_GROUP,
+       WIFI_DIRECT_CMD_IS_GROUPOWNER,
+       WIFI_DIRECT_CMD_GET_SSID,
+       WIFI_DIRECT_CMD_SET_SSID,
+       WIFI_DIRECT_CMD_GET_IP_ADDR,
+       WIFI_DIRECT_CMD_GET_CONFIG,
+       WIFI_DIRECT_CMD_SET_CONFIG,
+       WIFI_DIRECT_CMD_SEND_PROVISION_DISCOVERY_REQ,
+       WIFI_DIRECT_CMD_SEND_CONNECT_REQ,
+       WIFI_DIRECT_CMD_ACTIVATE_PUSHBUTTON,
+       WIFI_DIRECT_CMD_SET_WPS_PIN,
+       WIFI_DIRECT_CMD_GET_WPS_PIN,
+       WIFI_DIRECT_CMD_GENERATE_WPS_PIN,
+       WIFI_DIRECT_CMD_GET_INCOMMING_PEER_INFO,
+       WIFI_DIRECT_CMD_SET_WPA,
+       WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE,
+       WIFI_DIRECT_CMD_SET_CURRENT_WPS_MODE,
+       WIFI_DIRECT_CMD_GET_CONNECTED_PEERS_INFO,
+       WIFI_DIRECT_CMD_CANCEL_GROUP,
+       WIFI_DIRECT_CMD_DISCONNECT,
+       WIFI_DIRECT_CMD_SET_GO_INTENT,
+       WIFI_DIRECT_CMD_GET_GO_INTENT,
+       WIFI_DIRECT_CMD_GET_DEVICE_MAC,
+       WIFI_DIRECT_CMD_IS_AUTONOMOUS_GROUP,
+       WIFI_DIRECT_CMD_SET_MAX_CLIENT,
+       WIFI_DIRECT_CMD_GET_MAX_CLIENT,
+       WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE,
+       WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE, 
+       WIFI_DIRECT_CMD_IS_DISCOVERABLE,
+       WIFI_DIRECT_CMD_IS_LISTENING_ONLY,
+       WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL,
+       WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP,
+       WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP,
+       WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP,
+       WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO,
+       WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP,
+       WIFI_DIRECT_CMD_GET_DEVICE_NAME,
+       WIFI_DIRECT_CMD_SET_DEVICE_NAME,
+
+       WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL,
+
+       WIFI_DIRECT_CMD_MAX
+} wifi_direct_cmd_e;
+
+/**
+ * Wi-Fi Direct client event for IPC
+ */
+typedef enum
+{
+       WIFI_DIRECT_CLI_EVENT_INVALID = -1,                                     /**< */
+
+       WIFI_DIRECT_CLI_EVENT_ACTIVATION,                                               /**< */
+       WIFI_DIRECT_CLI_EVENT_DEACTIVATION,                                     /**< */
+
+       WIFI_DIRECT_CLI_EVENT_DISCOVER_START,                           /**< 80211 scan*/
+       WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY,       /**< listen only mode*/
+       WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN,     /**< search, listen*/
+       WIFI_DIRECT_CLI_EVENT_DISCOVER_END,                                     /**< */
+       WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS,                     /**< */
+
+       WIFI_DIRECT_CLI_EVENT_CONNECTION_START,                         /**< */
+       WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ,                           /**< */
+       WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP,                           /**< */
+       WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ,                       /**< */
+
+       WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP,                                /**< */
+       WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND,                                /**< */
+       WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND,                               /**< */
+
+       WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP,                         /**< */
+       WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP,                                /**< */
+
+       WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND,                            /**< */
+       WIFI_DIRECT_CLI_EVENT_INVITATION_REQ,
+} wfd_client_event_e;
+
+/**
+ * Wi-Fi Direct configuration data structure for IPC
+ */
+typedef struct
+{
+       char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
+       int channel;
+       wifi_direct_wps_type_e wps_config;
+       int max_clients;
+       bool hide_SSID;
+       int group_owner_intent;
+       bool want_persistent_group;
+       bool listen_only;
+       bool auto_connection;
+       wifi_direct_primary_device_type_e primary_dev_type;
+       wifi_direct_secondary_device_type_e secondary_dev_type;
+} wfd_config_data_s;
+
+
+/**
+ * Wi-Fi Direct buffer structure to store result of peer discovery for IPC
+ */
+typedef struct
+{
+       bool is_group_owner;
+       char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
+       unsigned char mac_address[6];
+       int channel;
+       bool is_connected;
+       unsigned int services;
+       bool is_persistent_go;
+       unsigned char intf_mac_address[6];
+       unsigned int wps_device_pwd_id;
+       unsigned int wps_cfg_methods;
+       unsigned int category;
+       unsigned int subcategory;
+       bool is_wfd_device      ;
+} wfd_discovery_entry_s;
+
+
+/**
+ * Wi-Fi Direct buffer structure to store information of connected peer
+ */
+typedef struct
+{
+       char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
+       unsigned char ip_address[4];
+       unsigned char mac_address[6];
+       unsigned char intf_mac_address[6];
+       unsigned int services;
+       bool is_p2p;
+       unsigned short category;
+       int channel;
+} wfd_connected_peer_info_s;
+
+typedef struct
+{
+       int network_id;
+       char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
+       unsigned char go_mac_address[6];
+} wfd_persistent_group_info_s;
+
+typedef struct
+{
+       bool listen_only;
+       int timeout;
+
+       int peer_index;
+       unsigned char mac_addr[6];
+
+} wifi_direct_client_request_data_s;
+
+
+typedef struct
+{
+       wifi_direct_cmd_e cmd;
+       int client_id;
+       wifi_direct_client_request_data_s data;
+} wifi_direct_client_request_s;
+
+typedef struct
+{
+       wifi_direct_cmd_e cmd;
+       wifi_direct_error_e result;
+       int client_id;
+       int param1;
+       char param2[64];
+       char param3[32];
+       int data_length;
+} wifi_direct_client_response_s;
+
+typedef struct
+{
+       wfd_client_event_e event;
+       wifi_direct_error_e error;
+       char param1[64];
+       char param2[64];
+} wifi_direct_client_noti_s;
+
+
+#endif                                                 //__WIFI_DIRECT_INTERNAL_H_
diff --git a/include/wifi-direct.h b/include/wifi-direct.h
new file mode 100644 (file)
index 0000000..eec9963
--- /dev/null
@@ -0,0 +1,2603 @@
+/*
+ * libwifi-direct
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
+ *
+ * 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 __WIFI_DIRECT_INTERFACE_H_
+#define __WIFI_DIRECT_INTERFACE_H_
+
+#include <errno.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/**
+ * @addtogroup CAPI_NET_WIFI_DIRECT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for Wi-Fi Direct error code
+ */
+typedef enum
+{
+       WIFI_DIRECT_ERROR_NONE = 0,  /**< Successful */
+       WIFI_DIRECT_ERROR_OUT_OF_MEMORY = -ENOMEM,  /**< Out of memory */
+       WIFI_DIRECT_ERROR_NOT_PERMITTED = -EPERM,  /**< Operation not permitted */
+       WIFI_DIRECT_ERROR_INVALID_PARAMETER = -EINVAL,  /**< Invalid function parameter */
+       WIFI_DIRECT_ERROR_RESOURCE_BUSY = -EBUSY,  /**< Device or resource busy */
+       WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT = -ETIMEDOUT,  /**< Connection timed out */
+       WIFI_DIRECT_ERROR_NOT_INITIALIZED = -0x00008000|0x0201,  /**< Not initialized */
+       WIFI_DIRECT_ERROR_COMMUNICATION_FAILED = -0x00008000|0x0202,  /**< I/O error */
+       WIFI_DIRECT_ERROR_WIFI_USED = -0x00008000|0x0203,  /**< WiFi is being used */
+       WIFI_DIRECT_ERROR_MOBILE_AP_USED = -0x00008000|0x0204,  /**< Mobile AP is being used */
+       WIFI_DIRECT_ERROR_CONNECTION_FAILED = -0x00008000|0x0205,  /**< Connection failed */
+       WIFI_DIRECT_ERROR_AUTH_FAILED = -0x00008000|0x0206,  /**< Authentication failed */
+       WIFI_DIRECT_ERROR_OPERATION_FAILED = -0x00008000|0x0207,  /**< Operation failed */
+       WIFI_DIRECT_ERROR_TOO_MANY_CLIENT = -0x00008000|0x0208,  /**< Too many client */
+} wifi_direct_error_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct link status
+ */
+typedef enum
+{
+       WIFI_DIRECT_STATE_DEACTIVATED = 0,
+                                                                       /**< */
+       WIFI_DIRECT_STATE_DEACTIVATING, /**< */
+       WIFI_DIRECT_STATE_ACTIVATING,           /**< */
+       WIFI_DIRECT_STATE_ACTIVATED,            /**< */
+       WIFI_DIRECT_STATE_DISCOVERING,  /**< */
+       WIFI_DIRECT_STATE_CONNECTING,   /**< */
+       WIFI_DIRECT_STATE_DISCONNECTING,        /**< */
+       WIFI_DIRECT_STATE_CONNECTED,            /**< */
+       WIFI_DIRECT_STATE_GROUP_OWNER   /**< */
+} wifi_direct_state_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct device state
+ */
+typedef enum
+{
+       WIFI_DIRECT_DEVICE_STATE_ACTIVATED,
+       WIFI_DIRECT_DEVICE_STATE_DEACTIVATED,
+} wifi_direct_device_state_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct discovery state
+ */
+typedef enum
+{
+       WIFI_DIRECT_ONLY_LISTEN_STARTED,
+       WIFI_DIRECT_DISCOVERY_STARTED,
+       WIFI_DIRECT_DISCOVERY_FOUND,
+       WIFI_DIRECT_DISCOVERY_FINISHED,
+} wifi_direct_discovery_state_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct connection state
+ */
+typedef enum
+{
+       WIFI_DIRECT_CONNECTION_REQ,                     /**< */
+       WIFI_DIRECT_CONNECTION_WPS_REQ,         /**< */
+       WIFI_DIRECT_CONNECTION_IN_PROGRESS,                     /**< */
+       WIFI_DIRECT_CONNECTION_RSP,                     /**< */
+       WIFI_DIRECT_DISASSOCIATION_IND,                 /**< */
+       WIFI_DIRECT_DISCONNECTION_RSP,                  /**< */
+       WIFI_DIRECT_DISCONNECTION_IND,                  /**< */
+       WIFI_DIRECT_GROUP_CREATED,                      /**< */
+       WIFI_DIRECT_GROUP_DESTROYED,                    /**< */
+       WIFI_DIRECT_INVITATION_REQ,
+} wifi_direct_connection_state_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct secondary device type
+ */
+typedef enum
+{
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_PC = 1,                              /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_SERVER = 2,          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MEDIA_CTR = 3,       /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_UMPC = 4,            /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NOTEBOOK = 5,        /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_DESKTOP = 6,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MID = 7,                     /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NETBOOK = 8,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_KEYBOARD = 1,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_MOUSE = 2,                      /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_JOYSTICK = 3,           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TRACKBALL = 4,          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_CONTROLLER = 5,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_REMOTE = 6,                     /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TOUCHSCREEN = 7,/**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BIO_READER = 8,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BAR_READER = 9,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_PRINTER = 1,          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_SCANNER = 2,          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_FAX = 3,                              /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_COPIER = 4,           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_ALLINONE = 5,         /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_DIGITAL_STILL = 1,             /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_VIDEO = 2,                     /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_WEBCAM = 3,            /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_SECONDARYURITY = 4,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_STORAGE_NAS = 1,                      /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_AP = 1,                                 /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_ROUTER = 2,                     /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_SWITCH = 3,                     /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_GATEWAY = 4,            /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV = 1,                               /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PIC_FRAME = 2,        /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PROJECTOR = 3,        /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_MONITOR = 4,          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_DAR = 1,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVR = 2,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MCX = 3,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB = 4,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MSMAME = 5,                /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP = 6,                           /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX = 1,                /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX_360 = 2,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PS = 3,                          /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_CONSOLE = 4,             /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PORTABLE = 5,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_WM = 1,                 /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SINGLE = 2,             /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_DUAL = 3,               /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_SINGLE = 4,
+                                                                                                               /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL = 5,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER = 1,              /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_SPEAKER = 2,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_PMP = 3,                /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADSET = 4,    /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADPHONE = 5,
+                                                                                                               /**< */
+       WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_MIC = 6,                /**< */
+} wifi_direct_secondary_device_type_e;
+
+/**
+ * @brief Enumeration for Wi-Fi Direct primary device type
+ */
+typedef enum
+{
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER = 1,           /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_INPUT_DEVICE = 2,       /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_PRINTER = 3,            /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA = 4,             /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE = 5,            /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_NETWORK_INFRA = 6,              /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY = 7,            /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_MULTIMEDIA_DEVICE = 8,          /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_GAME_DEVICE = 9,        /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE = 10, /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_AUDIO = 11,             /**< */
+       WIFI_DIRECT_PRIMARY_DEVICE_TYPE_OTHER = 255                     /**< */
+} wifi_direct_primary_device_type_e;
+
+
+/**
+* @brief Enumeration for Wi-Fi WPS type
+*/
+typedef enum {
+       WIFI_DIRECT_WPS_TYPE_NONE = 0x00,  /**< No WPS type */
+       WIFI_DIRECT_WPS_TYPE_PBC = 0x01,  /**< Push Button Configuration */
+       WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY = 0x02,  /**< Display PIN code */
+       WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD = 0x04,  /**< Provide the keypad to input the PIN */
+} wifi_direct_wps_type_e;
+
+
+/**
+ * @struct wifi_direct_discovered_peer_info_s
+ * Wi-Fi Direct buffer structure to store result of peer discovery
+ */
+typedef struct
+{
+       char* device_name;  /** Null-terminated device friendly name. */
+       char *mac_address;  /** Device's P2P Device Address */
+       char* interface_address;  /** Device's P2P Interface Address.  Valid only if device is a P2P GO. */    
+       int channel;  /** Channel the device is listening on. */
+       bool is_connected;  /** Is peer connected*/
+       bool is_group_owner;  /** Is an active P2P Group Owner */    
+       bool is_persistent_group_owner;  /** Is a stored Persistent GO */
+       wifi_direct_primary_device_type_e primary_device_type;  /** Primary category of device */
+       wifi_direct_secondary_device_type_e secondary_device_type;  /** Sub category of device */
+       int supported_wps_types;  /** The list of supported WPS type. \n
+       The OR operation on #wifi_direct_wps_type_e can be used like #WIFI_DIRECT_WPS_TYPE_PBC | #WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY */
+       char* ssid;  /**< Service set identifier - DEPRECATED */
+} wifi_direct_discovered_peer_info_s;
+
+
+/**
+ * @struct wifi_direct_connected_peer_info_s
+ * Wi-Fi Direct buffer structure to store information of connected peer
+ */
+typedef struct
+{
+       char* device_name;  /** Device friendly name. */
+       char* ip_address;  /**< The IP address */
+       char* mac_address;  /** Device's P2P Device Address */
+       char* interface_address;  /** Device's P2P Interface Address */
+       bool p2p_supported;  /* whether peer is a P2P device */
+       wifi_direct_primary_device_type_e       primary_device_type;  /* primary category of device */
+       int channel;  /* Operating channel */
+       char* ssid;  /**< Service set identifier - DEPRECATED */
+} wifi_direct_connected_peer_info_s;
+
+/**
+ * Notification callback function type. \n
+ *
+ * Discover notifications can occur at the peers or P2P groups are found.
+ *
+ * @param event             Specifies the types of notifications.
+ *                          - WIFI_DIRECT_DISCOVERY_STARTED
+ *                          - WIFI_DIRECT_ONLY_LISTEN_STARTED
+ *                          - WIFI_DIRECT_DISCOVERY_FOUND
+ *                          - WIFI_DIRECT_DISCOVERY_FINISHED
+ * @param error_code        In failure case.
+ * @param user_data         User can transfer the user specific data in callback.
+ *
+ */
+typedef void (*wifi_direct_discovery_state_chagned_cb) (int error_code,
+                                                                                                               wifi_direct_discovery_state_e
+                                                                                                               discovery_state,
+                                                                                                               void *user_data);
+
+/**
+ * Notification callback function type. \n
+ *
+ * Activation notifications callback function type.
+ *
+ * @param event             Specifies the types of notifications.
+ *                          - WIFI_DIRECT_DEVICE_STATE_ACTIVATED
+ *                          - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED
+ * @param error_code        In failure case.
+ * @param user_data         User can transfer the user specific data in callback.
+ *
+ */
+typedef void (*wifi_direct_device_state_changed_cb) (int error_code,
+                                                                                                        wifi_direct_device_state_e
+                                                                                                        device_state,
+                                                                                                        void *user_data);
+
+/**
+ * connection notification callback function type. \n
+ *
+ * @param event             Specifies the types of notifications.
+ *                          - WIFI_DIRECT_CONNECTION_REQ
+ *                          - WIFI_DIRECT_CONNECTION_WPS_REQ
+ *                          - WIFI_DIRECT_CONNECTION_IN_PROGRESS
+ *                          - WIFI_DIRECT_CONNECTION_RSP
+ *                          - WIFI_DIRECT_DISASSOCIATION_IND
+ *                          - WIFI_DIRECT_DISCONNECTION_RSP
+ *                          - WIFI_DIRECT_DISCONNECTION_IND
+ *                          - WIFI_DIRECT_GROUP_CREATED
+ *                          - WIFI_DIRECT_GROUP_DESTROYED
+ *
+ * @param error_code        In failure case.
+ *
+ * @param param1        additional data for connection. ex) MAC
+ * @param param2        additional data for connection. ex) SSID
+ *
+ * @param user_data         User can transfer the user specific data in callback.
+ *
+ */
+typedef void (*wifi_direct_connection_state_changed_cb) (int error_code,
+                                                                                                                wifi_direct_connection_state_e
+                                                                                                                connection_state,
+                                                                                                                const char
+                                                                                                                *mac_address,
+                                                                                                                void *user_data);
+
+
+
+/**
+* @brief Called when IP address of client is assigned when your device is group owner.
+* @param[in] mac_address  The MAC address of connection peer
+* @param[in] ip_address  The IP address of connection peer
+* @param[in] interface_address  The interface address of connection peer
+* @param[in] user_data  The user data passed from the callback registration function
+* @see wifi_direct_set_client_ip_address_assigned_cb()
+* @see wifi_direct_unset_client_ip_address_assigned_cb()
+*/
+typedef void (*wifi_direct_client_ip_address_assigned_cb) (const char* mac_address,
+                                                                                                                const char* ip_address,
+                                                                                                                const char* interface_address,
+                                                                                                                void *user_data);
+
+
+
+/*=============================================================================
+                                        Wifi Direct Client APIs
+=============================================================================*/
+
+/*****************************************************************************/
+/* wifi_direct_initialize API function prototype
+ * int wifi_direct_initialize (void);
+ */
+/**
+ * \brief      This API shall register the client application with the Wi-Fi Direct server and  initialize the various variables. \n
+ *
+ * \pre None.
+ *
+ * \post Application is registered.
+ *
+ * \see wifi_direct_device_state_changed_cb
+ * \see wifi_direct_discovery_state_chagned_cb
+ * \see wifi_direct_connection_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for "Too many users" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_initialize();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully connected to the wifi direct server
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_initialize(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_deinitialize API function prototype
+ * int wifi_direct_deinitialize(void);
+ */
+
+/**
+ * \brief This API shall deregister the client application with the Wi-Fi Direct server and releases all resources.
+ *
+ * \pre Application must be already registered to the Wi-Fi Direct server.
+ *
+ * \post Application is de-registered.
+ *
+ * \see wifi_direct_initialize
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *        None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_deinitialize();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deregister is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_deinitialize(void);
+
+
+/*****************************************************************************/
+/* wifi_direct_set_connection_state_changed_cb API function prototype
+ * int wifi_direct_set_connection_state_changed_cb(wifi_direct_device_state_changed_cb cb, void* user_data)
+ */
+/**
+ * \brief      This API shall register the activation callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_device_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
+ * \param[in] user_data    user data
+ * 
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_set_connection_state_changed_cb(_cb_activation, void* user_data);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void *user_data);
+
+
+/*****************************************************************************/
+/* wifi_direct_unset_connection_state_changed_cb API function prototype
+ * int wifi_direct_unset_connection_state_changed_cb(void)
+ */
+/**
+ * \brief      This API shall deregister the activation callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_set_connection_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_unset_connection_state_changed_cb();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_unset_device_state_changed_cb(void);
+
+
+
+/*****************************************************************************/
+/* wifi_direct_set_discovery_state_changed_cb API function prototype
+ * int wifi_direct_set_discover_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void* user_data)
+ */
+/**
+ * \brief      This API shall register the discover callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_discovery_state_chagned_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
+ * \param[in] user_data    user data
+ * 
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, void* user_data);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void *user_data);
+
+
+/*****************************************************************************/
+/* wifi_direct_unset_discovery_state_changed_cb API function prototype
+ * int wifi_direct_unset_discovery_state_changed_cb(void)
+ */
+/**
+ * \brief      This API shall deregister the discover callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_set_discovery_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_unset_discovery_state_changed_cb();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_unset_discovery_state_changed_cb(void);
+
+
+
+/*****************************************************************************/
+/* wifi_direct_set_connection_state_changed_cb API function prototype
+ * int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void* user_data)
+ */
+/**
+ * \brief      This API shall register the connection callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_connection_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
+ * \param[in] user_data    user data
+ * 
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_set_connection_state_changed_cb(_cb_connection, void* user_data);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void *user_data);
+
+
+/*****************************************************************************/
+/* wifi_direct_unset_connection_state_changed_cb API function prototype
+ * int wifi_direct_unset_connection_state_changed_cb(void)
+ */
+/**
+ * \brief      This API shall deregister the connection callback function and user data from client. \n
+ *
+ * \pre The Client should be initialized.
+ *
+ * \see wifi_direct_initialize
+ * \see wifi_direct_set_connection_state_changed_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ *
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \remarks None.
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ *
+ * int result;
+ * 
+ * result = wifi_direct_unset_connection_state_changed_cb();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
+ *
+ * \endcode
+ ******************************************************************************/
+int wifi_direct_unset_connection_state_changed_cb(void);
+
+
+/**
+* @brief Registers the callback called when IP address of client is assigned when your device is group owner.
+* @param[in] cb  The callback function to invoke
+* @param[in] user_data  The user data to be passed to the callback function
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_unset_client_ip_address_assigned_cb()
+* @see wifi_direct_client_ip_address_assigned_cb()
+*/
+int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void* user_data);
+
+
+/**
+* @brief Unregisters the callback called when IP address of client is assigned when your device is group owner.
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_set_connection_state_changed_cb()
+*/
+int wifi_direct_unset_client_ip_address_assigned_cb(void);
+
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_activate API function prototype
+ * int wifi_direct_activate(void);
+ */
+
+/**
+ * \brief This API shall open a wireless adapter device for P2P use.
+
+ * \pre Application must be already registered to the Wi-Fi Direct server.
+ *
+ * \post wireless adapter device will be ready to use.
+ *
+ * \see wifi_direct_initialize
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *  - WIFI_DIRECT_DEVICE_STATE_ACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when activation  process is completed. \n
+ *
+ *
+ * \return Return Type (int*) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ * - WIFI_DIRECT_ERROR_WIFI_USED for "WiFi is being used" \n
+ * - WIFI_DIRECT_ERROR_MOBILE_AP_USED for "Mobile AP is being used" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_activate();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // activation is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_activate(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_deactivate API function prototype
+ * int wifi_direct_deactivate(void);
+ */
+
+/**
+ * \brief This API shall close a wireless adapter device for P2P use
+
+ * \pre Wireless adapter device must be already opened.
+ *
+ * \post wireless adapter device will be closed.
+ *
+ * \see wifi_direct_activate
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *  - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when deactivation  process is completed. \n
+
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+ * int result;
+ *
+ * result = wifi_direct_deactivate();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deactivation is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_deactivate(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_start_discovery API function prototype
+ * int wifi_direct_start_discovery(bool listen_only, int timeout);
+ */
+/**
+ * \brief This API shall Start a discovery to find all P2P capable devices. \n
+ *        Applications will be notified event via wifi_direct_discovery_state_chagned_cb(). \n
+ *
+ * @param listen_only    if true, skip the initial 802.11 scan and then enter
+ *                       Listen state instead of cycling between Search and Listen.
+ * @param timeout        Specifies the duration of discovery period, in seconds.
+ *                       APs. If 0, a default value will be used, which depends on UX guideline.
+ *
+ * \pre Wireless adapter device must be already opened.
+ *
+ *
+ * \see wifi_direct_get_discovery_result
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *  - WIFI_DIRECT_DISCOVERY_STARTED : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when discover process (80211 Scan) started. \n
+ *  - WIFI_DIRECT_ONLY_LISTEN_STARTED : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when discover process (listen only mode) started. \n
+ *  - WIFI_DIRECT_DISCOVERY_FOUND : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when peer or group is found. \n
+ *  - WIFI_DIRECT_DISCOVERY_FINISHED : Once the whole discovery process is completed, applications will receive it via wifi_direct_discovery_state_chagned_cb (). \n
+ *                                 Applications may then call wifi_direct_foreach_discovered_peers() to get the final result.  \n
+ *                                 With the intermediate or final list of P2P capable devices, applications can update their UI if needed. \n
+ *                                 It is up to the applications to control how often to update their UI display. \n
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_start_discovery(TRUE, 0);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery request is successful
+ *
+ *\endcode
+ *
+ *\remarks If discover is over, peer can not find the device and the device can not find peer, too. 
+ * 
+ ******************************************************************************/
+int wifi_direct_start_discovery(bool listen_only, int timeout);
+
+
+/*****************************************************************************************/
+/* wifi_direct_cancel_discovery API function prototype
+ * int wifi_direct_cancel_discovery(void);
+ */
+/**
+ * \brief This API shall cancel the discovery process started from wifi_direct_start_discovery. \n
+ *
+ * \pre discovery process must be started.
+ *
+ * \post discovery process stopped.
+ *
+ * \see wifi_direct_client_start_discovery
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_DISCOVERY_FINISHED :  Applications will receive a this event
+ *                                   via callback when the discovery process is cancelled or completed.
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_cancel_discovery();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery cancel request is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_cancel_discovery(void);
+
+
+/**
+ * discorverd peers notification callback function type. \n
+ *
+ * @param peer The discovered peer information.
+ * @param user_data The user data passed from the foreach function.
+ * @return @c true to continue with the next iteration of the loop,
+ * \n @c false to break out of the loop.
+ *
+ * @pre wifi_direct_foreach_discovered_peers() will invoke this function.
+ *
+ * @see wifi_direct_foreach_discovered_peers()
+ *
+ */
+typedef bool(*wifi_direct_discovered_peer_cb)  (wifi_direct_discovered_peer_info_s * peer, void *user_data);
+
+
+/*****************************************************************************************/
+/* wifi_direct_foreach_discovered_peers API function prototype
+ * int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb, void* user_data)
+ */
+/**
+ * \brief This API shall get the information of all discovered peers. \n
+ *
+ * @param callback The callback function to invoke.
+ * @param user_data The user data passed from the foreach function.
+ *
+ * \see wifi_direct_discovered_peer_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* user_data)
+ * {
+ *     struct appdata* ad = (struct appdata*) user_data;
+ *     
+ *     if(NULL != peer)
+ *     {
+ *             if ( ad->peer_count >= MAX_PEER_NUM )
+ *                     return false;   // break out of the loop
+ *
+ *             memcpy(&ad->peer_list[ad->peer_count], peer, sizeof(wifi_direct_discovered_peer_info_s));
+ *             ad->peer_count++;
+ *     }
+ *
+ *     return true;    // continue with the next iteration of the loop
+ * }
+ *
+ *
+ * void foo()
+ * {
+ *     int result;
+ *
+ *     ad->peer_list = NULL;
+ *     ad->peer_count = 0;
+ *     ad ->selected_peer_index = 0;
+ *     result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
+ *
+ *     if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb
+                                                                                callback, void *user_data);
+
+
+/*****************************************************************************************/
+/* wifi_direct_connect API function prototype
+ * int wifi_direct_connect(const char* mac_address);
+ */
+/**
+ * \brief This API shall connect to specified peer by automatically determining whether to perform group \n
+ * formation, join an existing group, invite, re-invoke a group. The decision is \n
+ * based on the current state of the peers (i.e. GO, STA, not connected) and the \n
+ * availability of persistent data. \n
+ *
+ * @param mac_addr Device address of target peer.
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
+ *                                   via callback when the connection process is started.
+ *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
+ *                                   via callback when the connection process is completed or failed.
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
+ * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(unsigned char* mac_addr)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_connect(mac_addr);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
+ *
+ *\endcode
+ *
+ *\remarks This API will try to send provisioning request befre connecting.
+ *
+ ******************************************************************************/
+int wifi_direct_connect(const char *mac_address);
+
+
+/*****************************************************************************************/
+/* wifi_direct_disconnect_all API function prototype
+ * int wifi_direct_disconnect_all(void);
+ */
+/**
+ * \brief This API shall tear down all connected links to peers (stop soft AP, and close interface).  \n
+ *
+ * \see wifi_direct_connect
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive this event
+ *                                   via callback when the disconnection process is completed.
+ *                          
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_disconnect_all();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_disconnect_all(void);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_disconnect API function prototype
+ * int wifi_direct_disconnect(const char* mac_address);
+ */
+/**
+ * \brief This API shall disconnect the specified peer by mac address. 
+ *
+ * @param mac_addr Device address of target peer.
+ *
+ * \see
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive a this event
+ *                                   via callback when a peer is disconnected.
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(unsigned char* mac_addr)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_disconnect(mac_addr);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_disconnect(const char *mac_address);
+
+
+
+/**
+ * connected peers notification callback function type. \n
+ *
+ * @param peer The connected peer information.
+ * @param user_data The user data passed from the foreach function.
+ * @return @c true to continue with the next iteration of the loop,
+ * \n @c false to break out of the loop.
+ *
+ * @pre wifi_direct_foreach_connected_peers() will invoke this function.
+ *
+ * @see wifi_direct_foreach_connected_peers()
+ *
+ */
+typedef bool(*wifi_direct_connected_peer_cb) (wifi_direct_connected_peer_info_s
+                                                                                 * peer, void *user_data);
+
+
+/*****************************************************************************************/
+/* wifi_direct_foreach_connected_peers API function prototype
+ * int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb, void* user_data)
+ */
+/**
+ * \brief This API shall get the information of all connected peers. \n
+ *
+ * @param callback The callback function to invoke.
+ * @param user_data The user data passed from the foreach function.
+ *
+ * \see wifi_direct_connected_peer_cb
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * bool _cb_connected_peers_impl(wifi_direct_connected_peer_info_s* peer, void* user_data)
+ *{
+ *     
+ *     struct appdata* ad = (struct appdata*) user_data;
+ *
+ *     if(NULL != peer)
+ *     {
+ *             if ( ad->connected_peer_count >= MAX_PEER_NUM )
+ *                     return false;   // break out of the loop
+ *             
+ *             memcpy(&ad->connected_peer_list[ad->connected_peer_count], peer, sizeof(wifi_direct_connected_peer_info_s));
+ *             ad->connected_peer_count++;
+ *             
+ *     }
+ *
+ *     return true;    // continue with the next iteration of the loop
+ *}
+ *
+ * void foo()
+ * {
+ *     int result;
+ *
+ *     ad->connected_peer_list = NULL;
+ *     ad->connected_peer_count = 0;
+ *
+ *     result = wifi_direct_foreach_connected_peers(_cb_connected_peers_impl, (void*)ad);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
+                                                                               callback, void *user_data);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_create_group API function prototype
+ * int wifi_direct_create_group();
+ */
+/**
+ * \brief This API shall set up device as a Group Owner and wait for clients to connect. \n
+ * Create a soft AP, start the WPS registrar, start the DHCP server. \n
+ *
+ * \see wifi_direct_destroy_group
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_GROUP_CREATED :  Applications will receive this event
+ *                                   via callback when the group creating request is successful. \n
+ *                               Errorcode will be set to the WFD_ERROR_CREATE_LINK_FAIL value. \n
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
+ * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_create_group();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // create group request is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_create_group(void);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_destroy_group API function prototype
+ * int wifi_direct_destroy_group();
+ */
+/**
+ * \brief This API shall cancel P2P Group create or tear down a P2P Group that we own. \n
+ *
+ * \see wifi_direct_create_group
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_GROUP_DESTROYED :  Applications will receive this event via callback when the group is cancelled. \n
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
+ * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_destroy_group();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // cancel group request is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_destroy_group(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_is_group_owner API function prototype
+ * int wifi_direct_is_group_owner(bool *owner);
+ */
+/**
+ * \brief This API shall check whether the currunt client is group owner or not.
+ * @param owner              Memory to store the value of TURE or FALSE. Application must allocate memory.
+ *
+ * \see wifi_direct_create_group
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ * bool owner;
+ *
+ * result = wifi_direct_is_group_owner(&owner);
+ *
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_is_group_owner(bool * is_group_owner);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_is_autonomous_group API function prototype
+ * int wifi_direct_is_autonomous_group(bool *autonomous_group);
+ */
+/**
+ * \brief This API shall check whether the currunt group is autonomous group or not.
+ * @param autonomous_group              Memory to store the value of TURE or FALSE. Application must allocate memory.
+ *
+ * \see wifi_direct_create_group
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ * bool autonomous_group;
+ *
+ * result = wifi_direct_is_autonomous_group(&autonomous_group);
+ *
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_is_autonomous_group(bool * is_autonomous_group);
+
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_set_ssid API function prototype
+ * int wifi_direct_set_ssid(const char* ssid);
+ */
+/**
+ * \brief This API shall set or update ssid of local device. \n 
+ * @param ssid              new ssid to set. Application must set the new ssid before.
+ *
+ * \see wifi_direct_get_ssid
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char ssid[11] = {0,};
+ *
+ * memset(pin, 0x00, sizeof(pin));
+ * printf("Input 8 digit PIN number :\n");
+ * scanf("%s", pin);
+ *
+ *if( strlen(ssid) > 0 )
+ *     result = wifi_direct_set_ssid(ssid);
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting ssid is successful
+ *
+ *\endcode
+ *
+ *\remarks When the wifi direct is re-activated, ssid will be reset to the device name. \n
+ *             
+ *
+ ******************************************************************************/
+int wifi_direct_set_ssid(const char *ssid);
+
+
+/**
+ * @brief Sets the friendly name of local device.
+ * @details This device name is shown to other devices during device discovery.
+ * @remarks The name set by you is only valid during activated state.
+ * After Wi-Fi Direct is deactivated, this name will be as the phone name.
+ * @param[in] device_name  The name to local device
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_DIRECT_ERROR_NONE  Successful
+ * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+ * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitteds
+ * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+ * @pre Wi-Fi Direct must be activated by wifi_direct_activate().
+ * @see wifi_direct_activate()
+ * @see wifi_direct_get_device_name()
+ */
+int wifi_direct_set_device_name(const char* device_name);
+
+/**
+ * @brief Gets the name of local device.
+ * @remarks @a device_name must be released with free() by you.
+ * @param[out] device_name  The name to local device
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_DIRECT_ERROR_NONE  Successful
+ * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+ * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+ * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+ * @see wifi_direct_initialize()
+ * @see wifi_direct_set_device_name()
+ */
+int wifi_direct_get_device_name(char** device_name);
+
+/*****************************************************************************************/
+/* wifi_direct_get_ssid API function prototype
+ * int wifi_direct_get_ssid(char** ssid)
+ */
+/**
+ * \brief This API shall get ssid of local device. \n
+ * @param ssid              Pointer to store ssid. Application must free this memory.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char* ssid = NULL;
+ *
+ * result = wifi_direct_get_ssid(&ssid);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting ssid is successful
+ *
+ * free(ssid); // Application should free the memory.
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_ssid(char **ssid);
+
+
+/**
+* @brief Gets the name of network interface. For example, eth0 and pdp0.
+* @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_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
+* @see wifi_direct_activate()
+*/
+int wifi_direct_get_network_interface_name(char** name);
+
+
+/*****************************************************************************************/
+/* wifi_direct_get_ip_address API function prototype
+ * int wifi_direct_get_ip_address(char** ip_address)
+ */
+/**
+ * \brief This API shall get IP address of local device interface. \n
+ * @param ip_addr              Pointer to store ip address. Application must free this memory.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char* ip = NULL;
+ *
+ * result = wifi_direct_get_ip_address(&ip);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting IP is successful
+ *
+ * free(ip); // Application should free the memory.
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_ip_address(char **ip_address);
+
+/**
+* @brief Gets the Subnet Mask.
+* @remarks @a subnet_mask must be released with free() by you.
+* @param[out] subnet_mask  The subnet mask
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
+* @see wifi_direct_activate()
+*/
+int wifi_direct_get_subnet_mask(char** subnet_mask);
+
+
+/**
+* @brief Gets the Gateway address.
+* @remarks @a gateway_address must be released with free() by you.
+* @param[out] gateway_address  The gateway address
+* @return 0 on success, otherwise negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
+* @see wifi_direct_activate()
+*/
+int wifi_direct_get_gateway_address(char** gateway_address);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_get_mac_addr API function prototype
+ * int wifi_direct_get_mac_address(char **mac_address)
+ */
+/**
+ * \brief This API shall get device MAC address of local device.\n
+ * @param mac_addr              Pointer to store MAC address. Application must free this memory.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char* mac_addr =NULL;
+ *
+ * result = wifi_direct_get_mac_addr(&mac_addr);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting device MAC is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_mac_address(char **mac_address);
+
+
+/*****************************************************************************************/
+/* wifi_direct_get_state API function prototype
+ * int wifi_direct_get_state(wifi_direct_state_e * status);
+ */
+/**
+ * \brief This API shall get current Wi-Fi direct link status. \n
+ * @param status Memory to store link status information. Application must allocate memory.
+ *
+ * \see wifi_direct_state_e
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int result;
+ * wifi_direct_state_e status;
+ *
+ * result = wifi_direct_get_state(&status);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting link status is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_state(wifi_direct_state_e * state);
+
+
+
+/**
+* @brief Checks whether this device is discoverable or not by P2P discovery.
+* @details If you call wifi_direct_start_discovery(), then your device can be discoverable.
+* @param[out] discoverable  The status of discoverable: (@c true = discoverable, @c false = non-discoverable)
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_start_discovery()
+* @see wifi_direct_cancel_discovery()
+*/
+int wifi_direct_is_discoverable(bool* discoverable);
+
+/**
+* @brief Checks whether the local device is listening only.
+* @details If you call wifi_direct_start_discovery() with @a listen_only as @c true,
+* then skip the initial 802.11 Scan and then enter Listen state instead of cycling between Scan andListen.
+* @param[out] listen_only  The status of listen only: (@c true = listen only, @c false = cycling between Scan and Listen or not in discovery state)
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
+* @see wifi_direct_start_discovery()
+* @see wifi_direct_cancel_discovery()
+* @see wifi_direct_is_discoverable()
+*/
+int wifi_direct_is_listening_only(bool* listen_only);
+
+/**
+* @brief Gets the primary device type of local device.
+* @param[out] type  The primary device type
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+*/
+int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type);
+
+ /**
+* @brief Gets the secondary device type of local device.
+* @param[out] type  The secondary device type
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+*/
+int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type);
+
+
+/*****************************************************************************************/
+/* wifi_direct_accept_connection API function prototype
+ * int wifi_direct_accept_connection(char* mac_address);
+ */
+/**
+ * \brief This API shall accept connection request from specified peer. \n
+ * This API shall be used to respond the connection request event, WIFI_DIRECT_CONNECTION_REQ.
+ *
+ * @param mac_addr Device address of target peer.
+ *
+ * \see wifi_direct_connect
+ *
+ * \par Sync (or) Async:
+ * This is a Asynchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \par Async Response Message:
+ *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
+ *                                   via callback when the connection process is started.
+ *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
+ *                                   via callback when the connection process is completed or failed.
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
+ * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(unsigned char* mac_addr)
+ * {
+ * int result;
+ *
+ * result = wifi_direct_accept_connection(mac_addr);
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
+ *
+ *\endcode
+ *
+ *\remarks This API will not try to send provisioning request.
+ *
+ ******************************************************************************/
+int wifi_direct_accept_connection(char *mac_address);
+
+
+
+/*****************************************************************************************/
+/* wifi_direct_set_wpa_passphrase API function prototype
+ * int wifi_direct_set_wpa_passphrase(char* passphrase)
+ */
+/**
+ * \brief This API shall set or update wpa password. If a client create Group (Soft AP), this password will be used. \n
+ * @param passphrase              new wpa password to set. Application must set the new password before.
+ *
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char new_wpa[64+1] = {0,};
+ *
+ * printf("Input new WPA:\n");
+ * scanf("%s",new_wpa);
+ *
+ *if( strlen(new_wpa) > 0 )
+ *     result = wifi_direct_set_wpa_passphrase(new_wpa);
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting password is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_set_wpa_passphrase(char *passphrase);
+
+
+/*****************************************************************************************/
+/* wifi_direct_activate_pushbutton API function prototype
+ * int wifi_direct_activate_pushbutton(void);
+ */
+/**
+ * \brief This API shall start wps PBC.
+
+ * \pre Device must support the pbc button mode.
+ *
+ * \see wifi_direct_foreach_supported_wps_types
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo(void)
+ * {
+
+ * int result;
+ *
+ * result = wifi_direct_activate_pushbutton();
+ *
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // activating push button is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_activate_pushbutton(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_set_wps_pin API function prototype
+ * int wifi_direct_set_wps_pin(char* pin)
+ */
+/**
+ * \brief This API shall set or update the WPS PIN number user expects. \n
+ * @param pin              new pin to set. Application must set the new pin number before.
+ *
+ * \see wifi_direct_generate_wps_pin.
+ * \see wifi_direct_get_wps_pin
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char pin[WIFI_DIRECT_WPS_PIN_LEN+1]= { 0, };
+ *
+ * memset(pin, 0x00, sizeof(pin));
+ * printf("Input 8 digit PIN number :\n");
+ * scanf("%s", pin);
+ *
+ *if( strlen(pin) > 0 )
+ *     result = wifi_direct_set_wps_pin(pin);
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting wps pin number is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_set_wps_pin(char *pin);
+
+
+/*****************************************************************************************/
+/* wifi_direct_get_wps_pin API function prototype
+ * int wifi_direct_get_wps_pin(char** pin)
+ */
+/**
+ * \brief This API shall get the WPS PIN number. \n
+ * @param pin              Pointer to store pin number. Application must free this memory.
+ *
+ * \see wifi_direct_set_wps_pin
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * char* pin = NULL;
+ *
+ * result = wifi_direct_get_wps_pin(&pin);
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting wps pin number is successful
+ *
+ * free(pin); // Application should free the memory.
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_wps_pin(char **pin);
+
+
+/*****************************************************************************************/
+/* wifi_direct_generate_wps_pin API function prototype
+ * wifi_direct_generate_wps_pin(void);
+ */
+/**
+ * \brief This API shall generate the random WPS PIN number.\n
+ *             To get the generated PIN number, use wifi_direct_get_wps_pin() API.
+ *
+ * \see wifi_direct_set_wps_pin
+ * \see wifi_direct_get_wps_pin
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ *
+ * result = wifi_direct_generate_wps_pin();
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // generating wps pin number is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_generate_wps_pin(void);
+
+
+/*****************************************************************************************/
+/* wifi_direct_get_supported_wps_mode API function prototype
+ * int wifi_direct_get_supported_wps_mode(int *wps_mode);
+ */
+/**
+ * \brief This API shall get the supported wps mode. \n
+ *             The result is bit flag.
+ *
+ * @param wps_mode              Memory to store supported wps mode. Application must allocate memory.
+ *
+ * \see wifi_direct_wps_type_e
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ * - WIFI_DIRECT_ERROR_NONE on success \n
+ * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
+ * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
+ * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
+ * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
+ * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
+ * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
+ * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
+ *
+ *
+ * \par Prospective Clients:
+ * External Apps.
+ *
+ * \code
+ *
+ * #include <wifi-direct.h>
+ *
+ * void foo()
+ * {
+ * int  result;
+ * int supported_wps_mode = 0;
+ *
+ * result = wifi_direct_get_supported_wps_mode(&supported_wps_mode);
+ * 
+ * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting supported wps mode is successful
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_get_supported_wps_mode(int *wps_mode);
+
+
+/**
+* @brief Called when you get the supported WPS(Wi-Fi Protected Setup) type repeatedly.
+* @param[in] type  The type of WPS
+* @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_direct_foreach_supported_wps_types() will invoke this callback.
+* @see  wifi_direct_foreach_supported_wps_types()
+*/
+typedef bool(*wifi_direct_supported_wps_type_cb)(wifi_direct_wps_type_e type, void* user_data);
+
+/**
+* @brief Gets the supported WPS(Wi-Fi Protected Setup) types.
+* @param[in] callback  The callback function to invoke
+* @param[in] user_data  The user data to be passed to the callback function
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_direct_supported_wps_type_cb()
+*/
+int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void* user_data);
+
+/**
+ * @brief Sets the WPS(Wi-Fi Protected Setup) type.
+ * @param[in] type  The type of WPS
+ * @retval #WIFI_DIRECT_ERROR_NONE  Successful
+ * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see wifi_direct_foreach_supported_wps_types()
+ */
+int wifi_direct_set_wps_type(wifi_direct_wps_type_e type);
+/**
+ * @brief Gets the WPS(Wi-Fi Protected Setup) type.
+ * @param[out] type  The type of WPS
+ * @retval #WIFI_DIRECT_ERROR_NONE  Successful
+ * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see wifi_direct_foreach_supported_wps_types()
+ */
+int wifi_direct_get_wps_type(wifi_direct_wps_type_e* type);
+
+/**
+* @brief Sets the intent of a group owner.
+* @remakrs The range of intent is 0 ~ 15.
+* @param[in] intent  The intent of a group owner
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_direct_get_group_owner_intent()
+*/
+int wifi_direct_set_group_owner_intent(int intent);
+
+/**
+* @brief Gets the intent of a group owner.
+* @param[out] intent  The intent of a group owner
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_direct_set_group_owner_intent()
+*/
+int wifi_direct_get_group_owner_intent(int* intent);
+       
+/**
+* @brief Sets the max number of clients.
+* @param[in] max  The max number of clients
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_direct_get_max_clients()
+*/
+int wifi_direct_set_max_clients(int max);
+       
+/**
+* @brief Gets the max number of clients.
+* @param[in] max  The max number of clients
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @see wifi_direct_set_max_clients()
+*/
+int wifi_direct_get_max_clients(int* max);
+
+
+/**
+* @brief Gets the channel of own group. - DEPRECATED 
+* @param[out] channel  The channel of own group
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+*/
+int wifi_direct_get_own_group_channel(int* channel);
+
+
+/**
+* @brief Gets the operating channel.
+* @param[out] channel  The operating channel
+* @return 0 on success, otherwise a negative error value.
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+*/
+int wifi_direct_get_operating_channel(int* channel);
+
+/**
+ * @brief Sets the Autoconnection mode.
+ * @param[in]
+ * @retval #WIFI_DIRECT_ERROR_NONE  Successful
+ * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see wifi_direct_foreach_supported_wps_types()
+ */
+int wifi_direct_set_autoconnection_mode(bool mode);
+
+int wifi_direct_is_autoconnection_mode(bool* mode);
+
+/**  
+* @brief Enables the persistent group.
+* @details If @a enabled is true, then P2P persisten group will be used when creating a group and establishing a connection.
+* @param[in] enabled  The status of persistent group: (@c true = enabled, @c false = disabled)
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_is_persistent_group_enabled()
+*/
+int wifi_direct_set_persistent_group_enabled(bool enabled);
+
+/**
+* @brief Checks whether the persistent group is enabled or disabled.
+* @param[out] enabled  The status of persistent group: (@c true = enabled, @c false = disabled)
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_set_persistent_group_enabled()
+*/
+int wifi_direct_is_persistent_group_enabled(bool* enabled);
+
+
+/**
+* @brief Called when you get the persistent groups repeatedly.
+* @param[in] mac_address  The MAC address of persistent group owner
+* @param[in] ssid  The SSID(Service Set Identifier) of persistent group owner
+* @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 theloop
+* @pre  wifi_direct_foreach_persistent_groups() will invoke this callback.
+* @see  wifi_direct_foreach_persistent_groups()
+*/
+typedef bool(*wifi_direct_persistent_group_cb)(const char* mac_address, const char* ssid, void* user_data);
+
+/**
+* @brief Gets the persistent groups.
+* @param[in] callback  The callback function to invoke
+* @param[in] user_data  The user data to be passed to the callback function
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @post wifi_direct_persistent_group_cb() will be called.
+* @see wifi_direct_initialize()
+* @see wifi_direct_persistent_group_cb()
+*/
+int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb callback, void* user_data);
+
+/**
+* @brief Remove a persistent group.
+* @param[in] mac_address  The MAC address of persistent group owner
+* @param[in] ssid  The SSID(Service Set Identifier) of persistent group owner
+* @retval #WIFI_DIRECT_ERROR_NONE  Successful
+* @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
+* @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
+* @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
+* @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
+* @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
+* @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
+* @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
+* @see wifi_direct_initialize()
+* @see wifi_direct_foreach_persistent_groups()
+*/
+int wifi_direct_remove_persistent_group(const char* mac_address, const char* ssid);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                                                 //__WIFI_DIRECT_INTERFACE_H_
diff --git a/libwifi-direct.manifest b/libwifi-direct.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/libwifi-direct.spec b/packaging/libwifi-direct.spec
new file mode 100755 (executable)
index 0000000..08ac4a1
--- /dev/null
@@ -0,0 +1,68 @@
+Name:       libwifi-direct
+Summary:    wifi direct library (Shared Library)
+Version:    0.3.4
+Release:    1
+Group:      TO_BE_FILLED
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(dbus-glib-1)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(vconf)
+
+BuildRequires:  cmake
+BuildRequires:  gettext-devel
+
+#%define debug_package %{nil}  
+
+%description
+wifi direct library (Shared Library)
+
+
+%package devel 
+Summary:    wifi direct library (Shared Library) (Developement)
+Group:      TO_BE_FILLED 
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+wifi direct library (Shared Library) (Developement)
+
+%prep
+%setup -q
+
+%ifarch %{arm}
+export ARCH=arm
+%else
+export ARCH=i586
+%endif
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+#make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+%__strip %{buildroot}%{_libdir}/libwifi-direct.so.0.0
+
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{buildsubdir}/LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+
+%post
+
+%postun
+
+
+%files
+%manifest libwifi-direct.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libwifi-direct.so
+%{_libdir}/libwifi-direct.so.0
+%{_libdir}/libwifi-direct.so.0.0
+/usr/share/license/%{name}
+
+%files devel 
+%defattr(-,root,root,-)
+%{_libdir}/pkgconfig/wifi-direct.pc
+%{_includedir}/wifi-direct/wifi-direct.h
+%{_includedir}/wifi-direct/wifi-direct-internal.h
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..59162d1
--- /dev/null
@@ -0,0 +1,112 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(wifi-direct C)
+
+# Global setting
+SET(VERSION 0.0)
+
+MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
+        GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
+        IF (${_variable} MATCHES NOTFOUND)
+                SET (${_variable} ${_default_value})
+        ENDIF (${_variable} MATCHES NOTFOUND)
+ENDMACRO (GET_TARGET_PROPERTY_WITH_DEFAULT)
+
+MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
+       GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
+       GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 0)
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
+        GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
+        GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
+        GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
+        SET(_laname2 ${_laname}.la)
+        SET(_laname ${PROJECT_BINARY_DIR}/${_laname}.la)
+        FILE(WRITE ${_laname} "# ${_laname2} - a libtool library file\n")
+        FILE(APPEND ${_laname} "# Generated by CMake ${CMAKE_VERSION} (like GNU libtool)\n")
+        FILE(APPEND ${_laname} "\n# Please DO NOT delete this file!\n# It is necessary for linking the library with libtool.\n\n" )
+        FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
+        FILE(APPEND ${_laname} "dlname='${_soname}'\n\n")
+        FILE(APPEND ${_laname} "# Names of this library.\n")
+        FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n\n")
+        FILE(APPEND ${_laname} "# The name of the static archive.\n")
+        FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n\n")
+        FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
+        FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n\n")
+        FILE(APPEND ${_laname} "# Names of additional weak libraries provided by this library\n")
+        FILE(APPEND ${_laname} "weak_library_names=\n\n")
+        FILE(APPEND ${_laname} "# Version information for ${_laname2}.\n")
+        FILE(APPEND ${_laname} "current=${_target_current}\n")
+        FILE(APPEND ${_laname} "age=${_target_age}\n")
+        FILE(APPEND ${_laname} "revision=${_target_revision}\n\n")
+        FILE(APPEND ${_laname} "# Is this an already installed library?\n")
+        FILE(APPEND ${_laname} "installed=${_target_installed}\n\n")
+        FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
+        FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n\n")
+        FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
+        FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
+        FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n\n")
+        FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
+        FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}${_install_DIR}'\n")
+        INSTALL( FILES ${_laname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
+ENDMACRO(CREATE_LIBTOOL_FILE)
+
+# Build type : Release
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED vconf glib-2.0 dbus-1 dbus-glib-1 gthread-2.0 dlog)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -g -DUSE_DLOG")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
+               ${CMAKE_SOURCE_DIR}/src/include)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -DUSE_DLOG")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" STREQUAL "arm")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS(" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" ")
+
+# Linker flags
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+# Build
+SET(SRCS
+               wifi-direct-client-proxy.c
+               wifi-direct-utils.c
+)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION} SOVERSION 0)
+CREATE_LIBTOOL_FILE(${PROJECT_NAME} /lib)
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(wifi-direct.pc.in wifi-direct.pc @ONLY)
+
+# Install
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) 
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/wifi-direct.h DESTINATION include/wifi-direct)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/wifi-direct-internal.h DESTINATION include/wifi-direct)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wifi-direct.pc DESTINATION lib/pkgconfig)
+
diff --git a/src/include/wifi-direct-client-proxy.h b/src/include/wifi-direct-client-proxy.h
new file mode 100644 (file)
index 0000000..5d0041f
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * libwifi-direct
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
+ *
+ * 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 __WIFI_DIRECT_CLIENT_PROXY_H_
+#define __WIFI_DIRECT_CLIENT_PROXY_H_
+
+/*****************************************************************************
+ *     Standard headers
+ *****************************************************************************/
+
+/*****************************************************************************
+ *     Platform headers
+ *****************************************************************************/
+#include <glib.h>
+
+/*****************************************************************************
+ *     Wi-Fi Manager headers
+ *****************************************************************************/
+#include "wifi-direct.h"
+
+/*****************************************************************************
+ *     Macro Definition
+ *****************************************************************************/
+#ifdef USE_DLOG
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "WIFI_DIRECT"
+
+#define WDC_LOGV(format, args...) LOGV(format, ##args)
+#define WDC_LOGD(format, args...) LOGD(format, ##args)
+#define WDC_LOGI(format, args...) LOGI(format, ##args)
+#define WDC_LOGW(format, args...) LOGW(format, ##args)
+#define WDC_LOGE(format, args...) LOGE(format, ##args)
+#define WDC_LOGF(format, args...) LOGF(format, ##args)
+
+#define __WDC_LOG_FUNC_START__ LOGV("Enter")
+#define __WDC_LOG_FUNC_END__ LOGV("Quit")
+
+#else /** _DLOG_UTIL */
+
+#define WDC_LOGV(format, args...) \
+       printf("[V/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+#define WDC_LOGD(format, args...) \
+       printf("[D/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+#define WDC_LOGI(format, args...) \
+       printf("[I/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+#define WDC_LOGW(format, args...) \
+       printf("[W/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+#define WDC_LOGE(format, args...) \
+       printf("[E/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+#define WDC_LOGF(format, args...) \
+       printf("[F/WIFI_DIRECT] %s: %s()(%4d)> "format, __FILE__, __FUNCTION__, __LINE__, ##args)
+
+#define __WDC_LOG_FUNC_START__ \
+       printf("[V/WIFI_DIRECT] %s: %s()(%4d)> Start", __FILE__, __FUNCTION__, __LINE__)
+#define __WDC_LOG_FUNC_END__ \
+       printf("[V/WIFI_DIRECT] %s: %s()(%4d)> End", __FILE__, __FUNCTION__, __LINE__)
+
+#endif /** _DLOG_UTIL */
+
+typedef struct
+{
+       bool is_registered;
+       int client_id;
+       int sync_sockfd;
+       int async_sockfd;
+       int g_client_info;
+       int g_source_id;
+       wifi_direct_device_state_changed_cb activation_cb;
+       wifi_direct_discovery_state_chagned_cb discover_cb;
+       wifi_direct_connection_state_changed_cb connection_cb;
+       wifi_direct_client_ip_address_assigned_cb ip_assigned_cb;       
+       void *user_data_for_cb_activation;
+       void *user_data_for_cb_discover;
+       void *user_data_for_cb_connection;
+       void *user_data_for_cb_ip_assigned;
+
+} wifi_direct_client_info_s;
+
+extern char *wfd_debug_print(char *file, int line, char *format, ...);
+
+#endif /** __WIFI_DIRECT_CLIENT_PROXY_H_ */
diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c
new file mode 100644 (file)
index 0000000..97967cd
--- /dev/null
@@ -0,0 +1,5698 @@
+/*
+ * libwifi-direct
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
+ *
+ * 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.
+ *
+ */
+
+
+
+/*****************************************************************************
+ *     Standard headers
+ *****************************************************************************/
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.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 <glib.h>
+#include <linux/unistd.h>
+#include <sys/poll.h>
+
+#include <vconf.h>
+
+/*****************************************************************************
+ *     Wi-Fi Direct Service headers
+ *****************************************************************************/
+#include "wifi-direct.h"
+#include "wifi-direct-client-proxy.h"
+#include "wifi-direct-internal.h"
+
+/*****************************************************************************
+ *     Macros and Typedefs
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ *     Global Variables
+ *****************************************************************************/
+wifi_direct_client_info_s g_client_info = {
+       .is_registered = FALSE,
+       .client_id = -1,
+       .sync_sockfd = -1,
+       .async_sockfd = -1,
+       .activation_cb = NULL,
+       .discover_cb = NULL,
+       .connection_cb = NULL,
+       .user_data_for_cb_activation = NULL,
+       .user_data_for_cb_discover = NULL,
+       .user_data_for_cb_connection = NULL
+};
+
+/*****************************************************************************
+ *     Local Functions Definition
+ *****************************************************************************/
+static int __wfd_client_read_socket(int sockfd, char *dataptr, int datalen);
+
+#ifdef __NR_gettid
+pid_t gettid(void)
+{
+       return syscall(__NR_gettid);
+}
+#else
+#error "__NR_gettid is not defined, please include linux/unistd.h "
+#endif
+
+static wifi_direct_client_info_s *__wfd_get_control()
+{
+       return &g_client_info;
+}
+
+static void __wfd_reset_control()
+{
+
+       if (g_client_info.g_source_id > 0)
+               g_source_remove(g_client_info.g_source_id);
+       g_client_info.g_source_id = -1;
+
+       // Protect standard input / output / error
+       if (g_client_info.sync_sockfd > 2)
+               close(g_client_info.sync_sockfd);
+       g_client_info.sync_sockfd = -1;
+
+       if (g_client_info.async_sockfd > 2)
+               close(g_client_info.async_sockfd);
+       g_client_info.async_sockfd = -1;
+
+       g_client_info.is_registered = FALSE;
+
+       // Initialize callbacks
+       g_client_info.activation_cb = NULL;
+       g_client_info.discover_cb = NULL;
+       g_client_info.connection_cb = NULL;
+       g_client_info.user_data_for_cb_activation = NULL;
+       g_client_info.user_data_for_cb_discover = NULL;
+       g_client_info.user_data_for_cb_connection = NULL;
+}
+
+
+static int macaddr_atoe(char *p, unsigned char mac[])
+{
+       int i = 0;
+
+       WDC_LOGD( "macaddr_atoe : input MAC = [%s]\n", p);
+
+       for (;;)
+       {
+               mac[i++] = (char) strtoul(p, &p, 16);
+               if (!*p++ || i == 6)
+                       break;
+       }
+
+       return (i == 6);
+}
+
+
+static char *__wfd_print_event(wfd_client_event_e event)
+{
+       switch (event)
+       {
+       case WIFI_DIRECT_CLI_EVENT_ACTIVATION:
+               return "ACTIVATION";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DEACTIVATION:
+               return "DEACTIVATION";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_INVALID:
+               return "WIFI_DIRECT_CLI_EVENT_INVALID";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START:
+               return "WIFI_DIRECT_CLI_EVENT_DISCOVER_START";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY:
+               return "WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN:
+               return "WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_END:
+               return "WIFI_DIRECT_CLI_EVENT_DISCOVER_END";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS:
+               return "WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS";
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ:
+               return "WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ";
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_START:
+               return "WIFI_DIRECT_CLI_EVENT_CONNECTION_START";
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP:
+               return "WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ:
+               return "WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ";
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP:
+               return "WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND:
+               return "WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND";
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP:
+               return "WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP:
+               return "WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP";
+               break;
+       case WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND:
+               return "WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND";
+               break;
+
+       default:
+               return "WIFI_DIRECT_CLI_EVENT_unknown";
+               break;
+       }
+}
+
+static char *__wfd_print_error(wifi_direct_error_e error)
+{
+       switch (error)
+       {
+       case WIFI_DIRECT_ERROR_OPERATION_FAILED:
+               return "WIFI_DIRECT_ERROR_OPERATION_FAILED";
+       case WIFI_DIRECT_ERROR_OUT_OF_MEMORY:
+               return "WIFI_DIRECT_ERROR_OUT_OF_MEMORY";
+       case WIFI_DIRECT_ERROR_COMMUNICATION_FAILED:
+               return "WIFI_DIRECT_ERROR_COMMUNICATION_FAILED";
+       case WIFI_DIRECT_ERROR_NOT_PERMITTED:
+               return "WIFI_DIRECT_ERROR_NOT_PERMITTED";
+       case WIFI_DIRECT_ERROR_INVALID_PARAMETER:
+               return "WIFI_DIRECT_ERROR_INVALID_PARAMETER";
+       case WIFI_DIRECT_ERROR_NOT_INITIALIZED:
+               return "WIFI_DIRECT_ERROR_NOT_INITIALIZED";
+       case WIFI_DIRECT_ERROR_TOO_MANY_CLIENT:
+               return "WIFI_DIRECT_ERROR_TOO_MANY_CLIENT";
+       case WIFI_DIRECT_ERROR_RESOURCE_BUSY:
+               return "WIFI_DIRECT_ERROR_RESOURCE_BUSY";
+       case WIFI_DIRECT_ERROR_NONE:
+               return "WIFI_DIRECT_ERROR_NONE";
+       default:
+               WDC_LOGE("Invalid error value: [%d]", error);
+               return "Invalid error";
+       }
+}
+
+static int __wfd_convert_client_event(wfd_client_event_e event)
+{
+       __WDC_LOG_FUNC_START__;
+
+       switch (event)
+       {
+       case WIFI_DIRECT_CLI_EVENT_ACTIVATION:
+               return WIFI_DIRECT_DEVICE_STATE_ACTIVATED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DEACTIVATION:
+               return WIFI_DIRECT_DEVICE_STATE_DEACTIVATED;
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY:
+               return WIFI_DIRECT_ONLY_LISTEN_STARTED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START:
+               return WIFI_DIRECT_DISCOVERY_STARTED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_END:
+               return WIFI_DIRECT_DISCOVERY_FINISHED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS:
+               return WIFI_DIRECT_DISCOVERY_FOUND;
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_START:
+               return WIFI_DIRECT_CONNECTION_IN_PROGRESS;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ:
+               return WIFI_DIRECT_CONNECTION_REQ;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP:
+               return WIFI_DIRECT_CONNECTION_RSP;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP:
+               return WIFI_DIRECT_DISCONNECTION_RSP;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ:
+               return WIFI_DIRECT_CONNECTION_WPS_REQ;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND:
+               return WIFI_DIRECT_DISCONNECTION_IND;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND:
+               return WIFI_DIRECT_DISASSOCIATION_IND;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP:
+               return WIFI_DIRECT_GROUP_CREATED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP:
+               return WIFI_DIRECT_GROUP_DESTROYED;
+               break;
+       case WIFI_DIRECT_CLI_EVENT_INVITATION_REQ:
+               return WIFI_DIRECT_INVITATION_REQ;
+               break;
+       default:
+               WDC_LOGE("Invalid event : [%d]", event);
+               break;
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+}
+
+static gboolean __wfd_client_process_event(GIOChannel * source,
+                                                                                  GIOCondition condition,
+                                                                                  gpointer data)
+{
+       wfd_client_event_e event = WIFI_DIRECT_CLI_EVENT_INVALID;
+       wifi_direct_client_info_s *client = __wfd_get_control();
+       int sockfd = client->async_sockfd;
+       wifi_direct_client_noti_s client_noti;
+       wifi_direct_error_e error = WIFI_DIRECT_ERROR_NONE;
+       char param1[64] = { 0, };
+       char param2[64] = { 0, };
+
+       memset(&client_noti, 0, sizeof(wifi_direct_client_noti_s));
+
+       // 1.Read socket
+       if (__wfd_client_read_socket(sockfd, (char *) &client_noti,
+                 sizeof(wifi_direct_client_noti_s)) <= 0)
+       {
+               WDC_LOGE("Error!!! Reading Async Event[%d]", sockfd);
+               //close(sockfd);
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return false;
+       }
+
+       WDC_LOGD( "Received Event is [%d,%s], error[%d]\n",
+                                  client_noti.event, __wfd_print_event(client_noti.event),
+                                  client_noti.error);
+
+       event = client_noti.event;
+       error = client_noti.error;
+       memcpy(param1, client_noti.param1, sizeof(client_noti.param1));
+       memcpy(param2, client_noti.param2, sizeof(client_noti.param2));
+
+
+       // 2. dispatch event
+
+       switch (event)
+       {
+       case WIFI_DIRECT_CLI_EVENT_ACTIVATION:
+       case WIFI_DIRECT_CLI_EVENT_DEACTIVATION:
+               if (client->activation_cb != NULL)
+                       client->activation_cb(error,
+                                                                 (wifi_direct_device_state_e)
+                                                                 __wfd_convert_client_event(event),
+                                                                 client->user_data_for_cb_activation);
+               else
+                       WDC_LOGE("activation_cb is NULL!!");
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START:
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY:
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN:
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_END:
+       case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS:
+               if (client->discover_cb != NULL)
+                       client->discover_cb(error,
+                                                               (wifi_direct_discovery_state_e)
+                                                               __wfd_convert_client_event(event),
+                                                               client->user_data_for_cb_discover);
+               else
+                       WDC_LOGE("discover_cb is NULL!!");
+               break;
+
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_START:
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ:
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP:
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP:
+       case WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ:
+       case WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND:
+       case WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND:
+       case WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP:
+       case WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP:
+       case WIFI_DIRECT_CLI_EVENT_INVITATION_REQ:
+               if (client->connection_cb != NULL)
+                       client->connection_cb(error,
+                                         (wifi_direct_connection_state_e)
+                                         __wfd_convert_client_event(event), param1,
+                                         client->user_data_for_cb_connection);
+               else
+                       WDC_LOGE("connection_cb is NULL!!");
+               break;
+
+       // ToDo:  Handling IP lease event...
+       case WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND:
+               if (client->ip_assigned_cb != NULL)
+               {
+                       char* ifname = NULL;
+                       ifname = vconf_get_str(VCONFKEY_IFNAME);
+
+                       if (ifname == NULL)
+                               WDC_LOGD("vconf (%s) value is NULL!!!", VCONFKEY_IFNAME);
+                       else
+                               WDC_LOGD("VCONFKEY_IFNAME(%s) : %s", VCONFKEY_IFNAME, ifname);
+
+                               client->ip_assigned_cb(param1,
+                                                                 param2,
+                                                                 ifname,
+                                                                 client->user_data_for_cb_ip_assigned);
+
+               }
+               else
+                       WDC_LOGE("ip_assigned_cb is NULL!!");
+               break;
+
+       default:
+               break;
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return TRUE;
+}
+
+static wifi_direct_error_e __wfd_client_send_request(int sockfd, void *req_data, int dataLength)
+{
+       int retval = 0;
+
+       __WDC_LOG_FUNC_START__;
+
+       if (sockfd > 0)
+       {
+               WDC_LOGD("Write [%d] bytes to socket [%d].", dataLength, sockfd);
+               errno = 0;
+               retval = write(sockfd, (char *) req_data, dataLength);
+
+               if (retval <= 0)
+               {
+                       WDC_LOGE("Error!!! writing to the socket. Error = %s", strerror(errno));
+                       __WDC_LOG_FUNC_END__;
+                       return WIFI_DIRECT_ERROR_NONE;
+               }
+
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NONE;
+       }
+
+       WDC_LOGE("Error!!! Invalid sockfd [%d]", sockfd);
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+static wifi_direct_error_e __wfd_client_async_event_init(int clientid)
+{
+       int len = 0;
+       int sockfd = 0;
+       struct sockaddr_un servAddr;
+       char *path = "/tmp/wfd_client_socket";
+
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       errno = 0;
+       if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+       {
+               WDC_LOGE("Error!!! creating async socket. Error = [%s].", strerror(errno));
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("Created async socket [%d]", sockfd);
+
+       memset(&servAddr, 0, sizeof(servAddr));
+       servAddr.sun_family = AF_UNIX;
+       strcpy(servAddr.sun_path, path);
+       len = sizeof(servAddr.sun_family) + strlen(path);
+
+       WDC_LOGD("Connecting to server socket to register async socket [%d]", sockfd);
+       errno = 0;
+       if ((connect(sockfd, (struct sockaddr *) &servAddr, len)) < 0)
+       {
+               WDC_LOGE("Error!!! connecting to server socket. Error = [%s].", strerror(errno));
+               close(sockfd);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               wifi_direct_client_request_s req;
+               int result = WIFI_DIRECT_ERROR_NONE;
+
+               memset(&req, 0, sizeof(wifi_direct_client_request_s));
+
+               req.cmd = WIFI_DIRECT_CMD_INIT_ASYNC_SOCKET;
+               req.client_id = clientid;
+
+               result =
+                       __wfd_client_send_request(sockfd, &req, sizeof(wifi_direct_client_request_s));
+
+               if (result != WIFI_DIRECT_ERROR_NONE)
+               {
+                       WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+                       WDC_LOGE("Error!!! [%s]", __wfd_print_error(result));
+                       close(sockfd);
+                       __WDC_LOG_FUNC_END__;
+                       return result;
+               }
+
+               client_info->async_sockfd = sockfd;
+
+               WDC_LOGE("Async socket is created= %d", sockfd);
+
+       }
+
+       return (sockfd);
+}
+
+
+static int __wfd_client_read_socket(int sockfd, char *dataptr, int datalen)
+{
+       int pollret = 0;
+       struct pollfd pollfd;
+       int timeout = 60000; /** for 60 sec */
+       int retval = 0;
+       int total_data_recd = 0;
+
+       __WDC_LOG_FUNC_START__;
+
+       if (sockfd <= 0)
+       {
+               WDC_LOGE("Error!!! Invalid socket FD [%d]", sockfd);
+               __WDC_LOG_FUNC_END__;
+               return -1;
+       }
+
+       if ((dataptr == NULL) || (datalen <= 0))
+       {
+               WDC_LOGE("Error!!! Invalid parameter");
+               __WDC_LOG_FUNC_END__;
+               return -1;
+       }
+
+       WDC_LOGE("@@@@@@@ len = %d  @@@@@@@@@@@", datalen);
+
+       pollfd.fd = sockfd;
+       pollfd.events = POLLIN | POLLERR | POLLHUP;
+       pollret = poll(&pollfd, 1, timeout);
+
+       WDC_LOGE("POLL ret = %d", pollret);
+
+       if (pollret > 0)
+       {
+               if (pollfd.revents == POLLIN)
+               {
+                       WDC_LOGE("POLLIN");
+
+                       while (datalen)
+                       {
+                               errno = 0;
+                               retval = read(sockfd, (char *) dataptr, datalen);
+                               WDC_LOGE("sockfd %d retval %d", sockfd,
+                                                          retval);
+                               if (retval <= 0)
+                               {
+                                       WDC_LOGE("Error!!! reading data, error [%s]", strerror(errno));
+                                       __WDC_LOG_FUNC_END__;
+                                       return retval;
+                               }
+                               total_data_recd += retval;
+                               dataptr += retval;
+                               datalen -= retval;
+                       }
+                       __WDC_LOG_FUNC_END__;
+                       return total_data_recd;
+               }
+               else if (pollfd.revents & POLLHUP)
+               {
+                       WDC_LOGE("POLLHUP");
+                       __WDC_LOG_FUNC_END__;
+                       return 0;
+               }
+               else if (pollfd.revents & POLLERR)
+               {
+                       WDC_LOGE("POLLERR");
+                       __WDC_LOG_FUNC_END__;
+                       return 0;
+               }
+       }
+       else if (pollret == 0)
+       {
+               WDC_LOGE("POLLing timeout");
+               __WDC_LOG_FUNC_END__;
+               return 0;
+       }
+       else
+       {
+               WDC_LOGE("Polling unknown error");
+               __WDC_LOG_FUNC_END__;
+               return -1;
+       }
+       __WDC_LOG_FUNC_END__;
+       return 1;
+}
+
+
+static int __wfd_client_read_more_data(int sockfd, void *pData, int Datalen)
+{
+       int retval = 0;
+
+       __WDC_LOG_FUNC_START__;
+
+       if (sockfd < 0)
+       {
+               WDC_LOGE("Error!!! Inavlid argument passed");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pData == NULL)
+       {
+               WDC_LOGE("Error!!! Inavlid argument passed");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (Datalen <= 0)
+       {
+               WDC_LOGE("Error!!! Inavlid argument passed");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       /** Initialising the structure variable */
+       memset(pData, 0, Datalen);
+       errno = 0;
+       retval = __wfd_client_read_socket(sockfd, (char *) pData, Datalen);
+       if (retval <= 0)
+       {
+               WDC_LOGE("Error!!! reading response from CM. errno = [%d]", errno);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+       }
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+void __wfd_client_print_entry_list(wfd_discovery_entry_s * list, int num)
+{
+       int i = 0;
+
+       WDC_LOGD("------------------------------------------");
+       for (i = 0; i < num; i++)
+       {
+               WDC_LOGD("== Peer index : %d ==", i);
+               WDC_LOGD("is Group Owner ? %s", list[i].is_group_owner ? "YES" : "NO");
+               WDC_LOGD("device_name : %s", list[i].device_name);
+               WDC_LOGD("MAC address : "MACSTR, MAC2STR(list[i].mac_address));
+               WDC_LOGD("wps cfg method : %x", list[i].wps_cfg_methods);
+       }
+       WDC_LOGD("------------------------------------------");
+}
+
+void __wfd_client_print_connected_peer_info(wfd_connected_peer_info_s * list, int num)
+{
+       int i = 0;
+
+       WDC_LOGD("------------------------------------------\n");
+       for (i = 0; i < num; i++)
+       {
+               WDC_LOGD("== Peer index : %d ==\n", i);
+               WDC_LOGD("device_name : %s\n", list[i].device_name);
+               WDC_LOGD("Device MAC : " MACSTR "\n", MAC2STR(list[i].mac_address));
+               WDC_LOGD("Interface MAC : " MACSTR "\n", MAC2STR(list[i].intf_mac_address));
+               WDC_LOGD("services : %d\n", list[i].services);
+               WDC_LOGD("is_p2p : %d\n", list[i].is_p2p);
+               WDC_LOGD("category : %d\n", list[i].category);
+               WDC_LOGD("channel : %d\n", list[i].channel);
+               WDC_LOGD("IP ["IPSTR"]\n", IP2STR(list[i].ip_address));
+       }
+       WDC_LOGD("------------------------------------------\n");
+}
+
+
+void __wfd_client_print_persistent_group_info(wfd_persistent_group_info_s * list, int num)
+{
+       int i = 0;
+
+       WDC_LOGD("------------------------------------------\n");
+       for (i = 0; i < num; i++)
+       {
+               WDC_LOGD("== Persistent Group index : %d ==\n", i);
+               WDC_LOGD("ssid : %s\n", list[i].ssid);
+               WDC_LOGD("GO MAC : " MACSTR "\n",
+                                          MAC2STR(list[i].go_mac_address));
+       }
+       WDC_LOGD("------------------------------------------\n");
+}
+
+
+
+void __wfd_client_print_config_data(wfd_config_data_s * config)
+{
+       if (config == NULL)
+               return;
+
+       WDC_LOGD("Operating channel = [%d]\n", config->channel);
+       WDC_LOGD("WPS method = [%d, %s]\n", config->wps_config,
+                               (config->wps_config == WIFI_DIRECT_WPS_TYPE_PBC) ? 
+                                               "Pushbutton" : (config-> wps_config == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY)
+                                                       ? "Display" : "Keypad");
+
+       WDC_LOGD("Max client = [%d]\n", config->max_clients);
+       WDC_LOGD("grp_owner_intent = [%d]\n", config->group_owner_intent);
+       WDC_LOGD("hide-SSID = [%d]\n", config->hide_SSID);
+       WDC_LOGD("want_persistent_group = [%d]\n", config->want_persistent_group);
+       WDC_LOGD("auto_connection = [%d]\n", config->auto_connection);
+       WDC_LOGD("primary_dev_type = [%d]\n", config->primary_dev_type);
+       WDC_LOGD("secondary_dev_type = [%d]\n",
+                                  config->secondary_dev_type);
+
+}
+
+
+int wifi_direct_initialize(void)
+{
+       struct sockaddr_un servAddr;
+       char *path = "/tmp/wfd_client_socket";
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       int sockfd = 0;
+       int len = 0;
+       int ret = 0;
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == TRUE)
+       {
+               WDC_LOGE("Warning!!! Already registered\nUpdate user data and callback!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NONE;
+       }
+
+       errno = 0;
+       if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+       {
+               WDC_LOGE("Error!!! creating sync socket. Error = [%s].", strerror(errno));
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("Created sync socket [%d]", sockfd);
+
+       memset(&servAddr, 0, sizeof(servAddr));
+       servAddr.sun_family = AF_UNIX;
+       strcpy(servAddr.sun_path, path);
+       len = sizeof(servAddr.sun_family) + strlen(path);
+
+       WDC_LOGD("Connecting to server socket to register sync socket [%d]", sockfd);
+
+       int retry_count = 2;
+       while (retry_count > 0)
+       {
+               errno = 0;
+               if ((ret = connect(sockfd, (struct sockaddr *) &servAddr, len)) < 0)
+               {
+                       WDC_LOGD("Launching wfd-server..\n");
+                       system("dbus-send --system --print-reply --dest=net.netconfig /net/netconfig/wifi net.netconfig.wifi.LaunchDirect");
+                       retry_count--;
+               }
+               else
+               {
+                       break;
+               }
+       }
+
+       if (ret < 0)
+       {
+               WDC_LOGE("Error!!! connecting to server socket. Error = [%d] %s.\n",
+                                          errno, strerror(errno));
+               if (sockfd > 0)
+                       close(sockfd);
+
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               wifi_direct_client_request_s req;
+               wifi_direct_client_response_s resp;
+
+               int status = WIFI_DIRECT_ERROR_NONE;
+
+               memset(&req, 0, sizeof(wifi_direct_client_request_s));
+               memset(&resp, 0, sizeof(wifi_direct_client_response_s));
+
+               req.cmd = WIFI_DIRECT_CMD_REGISTER;
+               req.client_id = gettid();
+               WDC_LOGD("Client ID = %d\n", req.client_id);
+
+               status = __wfd_client_send_request(sockfd, &req, sizeof(wifi_direct_client_request_s));
+
+               if (status != WIFI_DIRECT_ERROR_NONE)
+               {
+                       WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+                       WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+                       close(sockfd);
+                       __WDC_LOG_FUNC_END__;
+                       return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+               }
+
+               /*Get client id */
+               if ((status = __wfd_client_read_socket(sockfd, (char *) &resp, 
+                       sizeof(wifi_direct_client_response_s))) <= 0)
+               {
+                       WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+                       __WDC_LOG_FUNC_END__;
+                       return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+               }
+               else
+               {
+                       if (resp.cmd == WIFI_DIRECT_CMD_REGISTER)
+                       {
+                               if (resp.result == WIFI_DIRECT_ERROR_NONE)
+                               {
+                                       WDC_LOGD("Client ID received = %d \n",
+                                                                  resp.client_id);
+                                       WDC_LOGD("Connected sync socket %d to the wifi direct server socket\n",
+                                                                  sockfd);
+                                       client_info->sync_sockfd = sockfd;
+                                       client_info->client_id = resp.client_id;
+                                       client_info->is_registered = TRUE;
+                               }
+                               else
+                               {
+                                       WDC_LOGE("Error!!! Client Register = %d\n",
+                                                                  resp.result);
+                                       close(sockfd);
+                                       __WDC_LOG_FUNC_END__;
+                                       return resp.result;
+                               }
+
+                               int async_sockfd = -1;
+                               /* Send request for establishing async communication channel */
+                               if ((async_sockfd =
+                                        __wfd_client_async_event_init(client_info->client_id)) ==
+                                       WIFI_DIRECT_ERROR_COMMUNICATION_FAILED)
+                               {
+                                       WDC_LOGE("Error!!! creating Async Socket \n");
+                                       __wfd_reset_control();
+                                       __WDC_LOG_FUNC_END__;
+                                       return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+                               }
+
+                               client_info->async_sockfd = async_sockfd;
+                       }
+                       else
+                       {
+                               WDC_LOGE("Error!!! Invalid Response received from wfd Server. cmd = %d \n",
+                                                          resp.cmd);
+                               close(sockfd);
+                               __WDC_LOG_FUNC_END__;
+                               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+                       }
+               }
+       }
+
+       GIOChannel *gio = g_io_channel_unix_new(client_info->async_sockfd);
+
+       int g_source_id =
+               g_io_add_watch(gio, G_IO_IN | G_IO_ERR | G_IO_HUP,
+                                          (GIOFunc) __wfd_client_process_event, NULL);
+
+       g_io_channel_unref(gio);
+
+       WDC_LOGD("Scoket is successfully registered to g_main_loop.\n");
+
+       client_info->g_source_id = g_source_id;
+
+       // Initialize callbacks
+       client_info->activation_cb = NULL;
+       client_info->discover_cb = NULL;
+       client_info->connection_cb = NULL;
+       client_info->user_data_for_cb_activation = NULL;
+       client_info->user_data_for_cb_discover = NULL;
+       client_info->user_data_for_cb_connection = NULL;
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+
+int wifi_direct_deinitialize(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is already deregistered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+       }
+
+       client_info->activation_cb = NULL;
+       client_info->discover_cb = NULL;
+       client_info->connection_cb = NULL;
+       client_info->user_data_for_cb_activation = NULL;
+       client_info->user_data_for_cb_discover = NULL;
+       client_info->user_data_for_cb_connection = NULL;
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DEREGISTER;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       //
+       // Deinit protocol: Send the deregister cmd and wait for socket close...
+       //
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGD( "Deinit Successfull\n");
+
+               if (client_info->g_source_id > 0)
+                       g_source_remove(client_info->g_source_id);
+               client_info->g_source_id = -1;
+
+               close(client_info->sync_sockfd);
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NONE;
+       }
+       else
+       {
+               WDC_LOGD("Error.. Something wrong...!!!\n");
+       }
+
+       __wfd_reset_control();
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb
+                                                                                       cb, void *user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == cb)
+       {
+               WDC_LOGE("Callback is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->activation_cb = cb;
+       client_info->user_data_for_cb_activation = user_data;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_unset_device_state_changed_cb(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->activation_cb = NULL;
+       client_info->user_data_for_cb_activation = NULL;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int
+wifi_direct_set_discovery_state_changed_cb
+(wifi_direct_discovery_state_chagned_cb cb, void *user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == cb)
+       {
+               WDC_LOGE("Callback is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->discover_cb = cb;
+       client_info->user_data_for_cb_discover = user_data;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_unset_discovery_state_changed_cb(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->discover_cb = NULL;
+       client_info->user_data_for_cb_discover = NULL;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int
+wifi_direct_set_connection_state_changed_cb
+(wifi_direct_connection_state_changed_cb cb, void *user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == cb)
+       {
+               WDC_LOGE("Callback is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->connection_cb = cb;
+       client_info->user_data_for_cb_connection = user_data;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_unset_connection_state_changed_cb(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->connection_cb = NULL;
+       client_info->user_data_for_cb_connection = NULL;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void* user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == cb)
+       {
+               WDC_LOGE("Callback is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->ip_assigned_cb = cb;
+       client_info->user_data_for_cb_ip_assigned = user_data;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_unset_client_ip_address_assigned_cb(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (client_info->is_registered == false)
+       {
+               WDC_LOGE("Client is not initialized.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       client_info->ip_assigned_cb = NULL;
+       client_info->user_data_for_cb_ip_assigned = NULL;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_activate(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_ACTIVATE;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_ACTIVATE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("Activating device is successfull.\n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_deactivate(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DEACTIVATE;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_DEACTIVATE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("Device Deactivated! \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_start_discovery(bool listen_only, int timeout)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (timeout < 0)
+       {
+               WDC_LOGE("Nagative value. Param [timeout]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_START_DISCOVERY;
+       req.client_id = client_info->client_id;
+       req.data.listen_only = listen_only;
+       req.data.timeout = timeout;
+
+       WDC_LOGE("listen only (%d) timeout (%d) \n",
+                                  listen_only, timeout);
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_START_DISCOVERY)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_start_discovery() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_cancel_discovery(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_CANCEL_DISCOVERY;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_CANCEL_DISCOVERY)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_cancel_discovery() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb callback, void *user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (callback == NULL)
+       {
+               WDC_LOGE("NULL Param [callback]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int i;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_DISCOVERY_RESULT;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_DISCOVERY_RESULT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               int num = rsp.param1;
+                               int status = 0;
+                               wfd_discovery_entry_s *buff = NULL;
+
+                               WDC_LOGD("Num of found peers = %d \n",
+                                                          (int) rsp.param1);
+
+                               if (num > 0)
+                               {
+                                       buff =
+                                               (wfd_discovery_entry_s *) malloc(num * sizeof (wfd_discovery_entry_s));
+                                       if (buff == NULL)
+                                       {
+                                               WDC_LOGE("malloc() failed!!!.\n");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+
+                                       status =
+                                               __wfd_client_read_more_data(client_info->sync_sockfd,
+                                                                                       buff,
+                                                                                       num *
+                                                                                       sizeof
+                                                                                       (wfd_discovery_entry_s));
+                                       if (status != WIFI_DIRECT_ERROR_NONE)
+                                       {
+                                               if (NULL != buff)
+                                                       free(buff);
+                                               //peer_list = NULL;
+                                               WDC_LOGE("socket read error.\n");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+                               }
+
+                               __wfd_client_print_entry_list(buff, num);
+
+                               WDC_LOGD("wifi_direct_foreach_discovered_peers() SUCCESS\n");
+
+
+                               wifi_direct_discovered_peer_info_s *peer_list;
+
+                               for (i = 0; i < num; i++)
+                               {
+                                       peer_list = (wifi_direct_discovered_peer_info_s *) calloc(1, sizeof(wifi_direct_discovered_peer_info_s));
+                                       peer_list->is_group_owner = buff[i].is_group_owner;
+                                       peer_list->device_name = strdup(buff[i].device_name);
+                                       peer_list->mac_address = (char *) calloc(1, 18);
+                                       snprintf(peer_list->mac_address, 18, MACSTR, MAC2STR(buff[i].mac_address));
+                                       peer_list->channel = buff[i].channel;
+                                       peer_list->is_connected = buff[i].is_connected;
+                                       peer_list->is_persistent_group_owner = buff[i].is_persistent_go;
+                                       peer_list->interface_address = (char *) calloc(1, 18);
+                                       snprintf(peer_list->interface_address, 18, MACSTR, MAC2STR(buff[i].intf_mac_address));
+                                       peer_list->supported_wps_types= buff[i].wps_cfg_methods;
+                                       peer_list->primary_device_type = buff[i].category;
+                                       peer_list->secondary_device_type = buff[i].subcategory;
+
+                                       if (!callback(peer_list, user_data))
+                                               break;
+                               }
+
+                               if (NULL != buff)
+                                       free(buff);
+
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_connect(const char *mac_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       unsigned char la_mac_addr[6];
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (mac_address == NULL)
+       {
+               WDC_LOGE("mac_addr is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_CONNECT;
+       req.client_id = client_info->client_id;
+
+       macaddr_atoe(mac_address, la_mac_addr);
+
+       req.data.mac_addr[0] = la_mac_addr[0];
+       req.data.mac_addr[1] = la_mac_addr[1];
+       req.data.mac_addr[2] = la_mac_addr[2];
+       req.data.mac_addr[3] = la_mac_addr[3];
+       req.data.mac_addr[4] = la_mac_addr[4];
+       req.data.mac_addr[5] = la_mac_addr[5];
+
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_CONNECT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_connect() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_disconnect_all(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DISCONNECT_ALL;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_DISCONNECT_ALL)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_disconnect_all() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_disconnect(const char *mac_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       unsigned char la_mac_addr[6];
+
+       __WDC_LOG_FUNC_START__;
+
+       if (mac_address == NULL)
+       {
+               WDC_LOGE("mac_address is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DISCONNECT;
+       req.client_id = client_info->client_id;
+
+       macaddr_atoe(mac_address, la_mac_addr);
+
+       req.data.mac_addr[0] = la_mac_addr[0];
+       req.data.mac_addr[1] = la_mac_addr[1];
+       req.data.mac_addr[2] = la_mac_addr[2];
+       req.data.mac_addr[3] = la_mac_addr[3];
+       req.data.mac_addr[4] = la_mac_addr[4];
+       req.data.mac_addr[5] = la_mac_addr[5];
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_DISCONNECT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_disconnect() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+
+int wifi_direct_accept_connection(char *mac_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       unsigned char la_mac_addr[6];
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (mac_address == NULL)
+       {
+               WDC_LOGE("mac_addr is NULL.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SEND_CONNECT_REQ;
+       req.client_id = client_info->client_id;
+
+       macaddr_atoe(mac_address, la_mac_addr);
+
+       req.data.mac_addr[0] = la_mac_addr[0];
+       req.data.mac_addr[1] = la_mac_addr[1];
+       req.data.mac_addr[2] = la_mac_addr[2];
+       req.data.mac_addr[3] = la_mac_addr[3];
+       req.data.mac_addr[4] = la_mac_addr[4];
+       req.data.mac_addr[5] = la_mac_addr[5];
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SEND_CONNECT_REQ)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_connect() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb callback, void *user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (callback == NULL)
+       {
+               WDC_LOGE("NULL Param [callback]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int i;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_CONNECTED_PEERS_INFO;
+       req.client_id = client_info->client_id;
+
+       status = __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status = __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                               sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_CONNECTED_PEERS_INFO)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+
+                               int num = rsp.param1;
+                               int status = 0;
+                               wfd_connected_peer_info_s *buff = NULL;
+
+                               WDC_LOGD("Num of connected peers = %d \n",
+                                                          (int) rsp.param1);
+
+                               if (num > 0)
+                               {
+                                       buff =
+                                               (wfd_connected_peer_info_s *) malloc(num *
+                                                                                                                        sizeof
+                                                                                                                        (wfd_connected_peer_info_s));
+                                       if (buff == NULL)
+                                       {
+                                               WDC_LOGE("malloc() failed!!!.\n");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+
+                                       status =
+                                               __wfd_client_read_more_data(client_info->sync_sockfd,
+                                                                                                       buff,
+                                                                                                       num *
+                                                                                                       sizeof
+                                                                                                       (wfd_connected_peer_info_s));
+                                       if (status != WIFI_DIRECT_ERROR_NONE)
+                                       {
+                                               if (NULL != buff)
+                                                       free(buff);
+                                               WDC_LOGE("socket read error.\n");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+                               }
+
+                               __wfd_client_print_connected_peer_info(buff, num);
+
+                               WDC_LOGD("wifi_direct_foreach_connected_peers() SUCCESS\n");
+
+                               wifi_direct_connected_peer_info_s *peer_list;
+
+                               for (i = 0; i < num; i++)
+                               {
+                                       peer_list = (wifi_direct_connected_peer_info_s *) calloc(1, sizeof(wifi_direct_connected_peer_info_s));
+                                       peer_list->device_name = strdup(buff[i].device_name);
+                                       peer_list->ip_address= (char *) calloc(1, 16);
+                                       snprintf(peer_list->ip_address, 16, IPSTR, IP2STR(buff[i].ip_address));
+                                       peer_list->mac_address = (char *) calloc(1, 18);
+                                       snprintf(peer_list->mac_address, 18, MACSTR, MAC2STR(buff[i].mac_address));
+                                       peer_list->interface_address = (char *) calloc(1, 18);
+                                       snprintf(peer_list->interface_address, 18, MACSTR, MAC2STR(buff[i].intf_mac_address));
+                                       peer_list->p2p_supported = buff[i].is_p2p;
+                                       peer_list->primary_device_type = buff[i].category;
+                                       peer_list->channel = buff[i].channel;
+                                       
+                                       if (!callback(peer_list, user_data))
+                                               break;
+                               }
+
+                               if (NULL != buff)
+                                       free(buff);
+
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_create_group(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_CREATE_GROUP;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_CREATE_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_create_group() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_destroy_group(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_CANCEL_GROUP;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_CANCEL_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGE("wifi_direct_destroy_group() SUCCESS \n");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_is_group_owner(bool * owner)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (owner == NULL)
+       {
+               WDC_LOGE("NULL Param [owner]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_GROUPOWNER;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_GROUPOWNER)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_group_owner() %s SUCCESS \n", rsp.param2);
+                               *owner = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_is_autonomous_group(bool * autonomous_group)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (autonomous_group == NULL)
+       {
+               WDC_LOGE("NULL Param [autonomous_group]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_AUTONOMOUS_GROUP;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_AUTONOMOUS_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_autonomous_group() %s SUCCESS \n", rsp.param2);
+                               *autonomous_group = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_set_group_owner_intent(int intent)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (intent < 0 || intent > 15)
+       {
+               WDC_LOGE("Invalid Param : intent[%d]\n", intent);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_GO_INTENT;
+       req.client_id = client_info->client_id;
+
+       status =__wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &intent,
+                                                                 sizeof(int));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_GO_INTENT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_group_owner_intent(int* intent)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_GO_INTENT;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_GO_INTENT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("int wifi_direct_get_group_owner_intent() intent[%d] SUCCESS \n", rsp.param1);
+                               *intent = rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_set_max_clients(int max)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       WDC_LOGD("max client [%d]\n", max);
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_MAX_CLIENT;
+       req.client_id = client_info->client_id;
+
+       status =__wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &max,
+                                                                 sizeof(int));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_MAX_CLIENT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_max_clients(int* max)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_MAX_CLIENT;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_MAX_CLIENT)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("int wifi_direct_get_max_clients() max_client[%d] SUCCESS \n", rsp.param1);
+                               *max = rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+/* Deprecated */
+int wifi_direct_get_own_group_channel(int* channel)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL;
+       req.client_id = client_info->client_id;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", ret, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("channel = [%d]\n",
+                                                          (int) rsp.param1);
+                               *channel = rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_get_operating_channel(int* channel)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL;
+       req.client_id = client_info->client_id;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", ret, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("channel = [%d]\n", (int) rsp.param1);
+                               *channel = rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_set_wpa_passphrase(char *passphrase)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (NULL == passphrase)
+       {
+               WDC_LOGE("NULL Param [passphrase]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       WDC_LOGE("passphrase = [%s]\n", passphrase);
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_WPA;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, passphrase, 64);
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_WPA)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_activate_pushbutton(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_ACTIVATE_PUSHBUTTON;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n",
+                                          status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_ACTIVATE_PUSHBUTTON)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_activate_pushbutton() SUCCESS");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_set_wps_pin(char *pin)
+{
+
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (NULL == pin)
+       {
+               WDC_LOGE("NULL Param [pin]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+       WDC_LOGE("pin = [%s]\n", pin);
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_WPS_PIN;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, pin,
+                                                                 WIFI_DIRECT_WPS_PIN_LEN);
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE( "Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_WPS_PIN)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_wps_pin(char **pin)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       char la_pin[WIFI_DIRECT_WPS_PIN_LEN + 1] = { 0, };
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_WPS_PIN;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_WPS_PIN)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_get_wps_pin() SUCCESS");
+                               strncpy(la_pin, rsp.param2, WIFI_DIRECT_WPS_PIN_LEN);
+
+                               char *temp_pin;
+                               temp_pin = strdup(la_pin);
+
+                               *pin = temp_pin;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_generate_wps_pin(void)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GENERATE_WPS_PIN;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GENERATE_WPS_PIN)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_generate_wps_pin() SUCCESS");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_supported_wps_mode(int *wps_mode)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE;
+       req.client_id = client_info->client_id;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", ret, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("Supported wps config = [%d]\n",
+                                                          (int) rsp.param1);
+                               *wps_mode = rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void* user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (callback == NULL)
+       {
+               WDC_LOGE("NULL Param [callback]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE;
+       req.client_id = client_info->client_id;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE(
+                                          "Error!!! reading socket, status = %d errno = %s\n", ret,
+                                          strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD( "Supported wps config = [%d]\n",
+                                                          (int) rsp.param1);
+                               int wps_mode;
+                               bool result;
+                               
+                               wps_mode = rsp.param1;
+
+                               if (wps_mode & WIFI_DIRECT_WPS_TYPE_PBC)
+                                       result = callback(WIFI_DIRECT_WPS_TYPE_PBC, user_data);
+
+                               if ((result == true) && (wps_mode & WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY))
+                                       result = callback(WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY, user_data);
+                                       
+
+                               if ((result == true) && (wps_mode & WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD))
+                                       result = callback(WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD, user_data);
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_set_wps_type(wifi_direct_wps_type_e type)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (type == WIFI_DIRECT_WPS_TYPE_PBC
+               || type == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY
+               || type == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD)
+       {
+               WDC_LOGD("Param wps_mode [%d]\n", type);
+       }
+       else
+       {
+               WDC_LOGE("Invalid Param [wps_mode]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_CURRENT_WPS_MODE;
+       req.client_id = client_info->client_id;
+
+       status =__wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &type,
+                                                                 sizeof(wifi_direct_wps_type_e));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_CURRENT_WPS_MODE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_wps_type(wifi_direct_wps_type_e* type)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (type == NULL)
+       {
+               WDC_LOGE("NULL Param [type]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       wfd_config_data_s ls_config;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_CONFIG;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_CONFIG)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               int status = 0;
+
+                               WDC_LOGD("Link status = %d \n",
+                                                          (int) rsp.param1);
+
+                               status =
+                                       __wfd_client_read_more_data(client_info->sync_sockfd,
+                                                                                               &ls_config,
+                                                                                               sizeof(wfd_config_data_s));
+                               if (status != WIFI_DIRECT_ERROR_NONE)
+                               {
+                                       WDC_LOGE("socket read error.");
+                                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                               }
+
+                               __wfd_client_print_config_data(&ls_config);
+
+                               *type = ls_config.wps_config;
+
+                               WDC_LOGD("wifi_direct_get_wps_type() SUCCESS");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+/* DPRECATED */
+int wifi_direct_set_ssid(const char *ssid)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (NULL == ssid)
+       {
+               WDC_LOGE("NULL Param [ssid]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       WDC_LOGE("ssid = [%s]\n", ssid);
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_SSID;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, ssid,
+                                                                 WIFI_DIRECT_MAX_SSID_LEN);
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE(
+                                          "Error!!! writing to socket, Errno = %s\n",
+                                          strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_SSID)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",  __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_ssid(char **ssid)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == ssid)
+       {
+               WDC_LOGE("NULL Param [ssid]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       char la_ssid[WIFI_DIRECT_MAX_SSID_LEN + 1] = { 0, };
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_SSID;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_SSID)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD(
+                                                          "wifi_direct_get_ssid() %s SUCCESS \n",
+                                                          rsp.param2);
+                               strncpy(la_ssid, rsp.param2, WIFI_DIRECT_MAX_SSID_LEN);
+
+                               char *temp_ssid = NULL;
+                               temp_ssid = strdup(la_ssid);
+                               if (NULL == temp_ssid)
+                               {
+                                       WDC_LOGE("Failed to allocate memory for SSID\n");
+                                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+                               }
+
+                               *ssid = temp_ssid;
+                       }
+
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_device_name(char** device_name)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == device_name)
+       {
+               WDC_LOGE("NULL Param [device_name]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       char la_device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1] = { 0, };
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_DEVICE_NAME;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_DEVICE_NAME)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_get_device_name() %s SUCCESS \n", rsp.param2);
+                               strncpy(la_device_name, rsp.param2, WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
+
+                               char *temp_device_name = NULL;
+                               temp_device_name = strdup(la_device_name);
+                               if (NULL == temp_device_name)
+                               {
+                                       WDC_LOGE("Failed to allocate memory for device name\n");
+                                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+                               }
+
+                               *device_name = temp_device_name;
+                       }
+
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_set_device_name(const char *device_name)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (NULL == device_name)
+       {
+               WDC_LOGE("NULL Param [device_name]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       WDC_LOGE("device_name = [%s]\n", device_name);
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_DEVICE_NAME;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD( "writing msg hdr is success!\n");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, device_name,
+                                                                 WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_DEVICE_NAME)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d \n", rsp.result);
+                               WDC_LOGE("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_network_interface_name(char** name)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == name)
+       {
+               WDC_LOGE("NULL Param [name]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_state_e status = 0;
+       int result;
+       result = wifi_direct_get_state(&status);
+       WDC_LOGD("wifi_direct_get_state() state=[%d], result=[%d]\n", status, result);
+
+       if( status < WIFI_DIRECT_STATE_CONNECTED)
+       {
+               WDC_LOGE("Device is not connected!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+
+       char* get_str = NULL;
+       get_str = vconf_get_str(VCONFKEY_IFNAME);
+
+       if (get_str == NULL)
+       {
+               WDC_LOGD( "vconf (%s) value is NULL!!!\n", VCONFKEY_IFNAME);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+       else
+       {
+               WDC_LOGD( "VCONFKEY_IFNAME(%s) : %s\n", VCONFKEY_IFNAME, get_str);
+
+               char *temp_ifname = NULL;
+               temp_ifname = strdup(get_str);
+               if (NULL == temp_ifname)
+               {
+                       WDC_LOGE("Failed to allocate memory for ifname.\n");
+                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+               }
+
+               *name = temp_ifname;
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+
+int wifi_direct_get_ip_address(char **ip_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == ip_address)
+       {
+               WDC_LOGE("NULL Param [ip_address]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_state_e state = 0;
+       int result;
+       result = wifi_direct_get_state(&state);
+       WDC_LOGD( "wifi_direct_get_state() state=[%d], result=[%d]\n", state, result);
+
+       if( state < WIFI_DIRECT_STATE_CONNECTED)
+       {
+               WDC_LOGE("Device is not connected!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+
+       char* get_str = NULL;
+       get_str = vconf_get_str(VCONFKEY_LOCAL_IP);
+
+       if (get_str == NULL)
+       {
+               WDC_LOGD("vconf (%s) value is NULL!!!\n", VCONFKEY_LOCAL_IP);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+       else
+       {
+               WDC_LOGD("VCONFKEY_LOCAL_IP(%s) : %s\n", VCONFKEY_LOCAL_IP, get_str);
+
+               char *temp_ip = NULL;
+               temp_ip = strdup(get_str);
+               if (NULL == temp_ip)
+               {
+                       WDC_LOGE("Failed to allocate memory for local ip address.\n");
+                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+               }
+
+               *ip_address = temp_ip;
+       }
+
+
+#if 0
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       char la_ip[64] = { 0, };
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_IP_ADDR;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_IP_ADDR)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d \n",
+                                                          rsp.result);
+                               WDC_LOGD("Error!!! [%s]\n",
+                                                          __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_get_ip_address() SUCCESS \n");
+                               strncpy(la_ip, rsp.param2, strlen(rsp.param2));
+
+                               char *temp_ip = NULL;
+                               temp_ip = strdup(la_ip);
+                               if (NULL == temp_ip)
+                               {
+                                       WDC_LOGE("Failed to allocate memory for IP address\n");
+                                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+                               }
+
+                               *ip_address = temp_ip;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d\n",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+#endif
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_subnet_mask(char** subnet_mask)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == subnet_mask)
+       {
+               WDC_LOGE("NULL Param [subnet_mask]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_state_e status = 0;
+       int result;
+       result = wifi_direct_get_state(&status);
+       WDC_LOGD("wifi_direct_get_state() state=[%d], result=[%d]\n", status, result);
+
+       if( status < WIFI_DIRECT_STATE_CONNECTED)
+       {
+               WDC_LOGE("Device is not connected!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+
+
+       char* get_str = NULL;
+       get_str = vconf_get_str(VCONFKEY_SUBNET_MASK);
+
+       if (get_str == NULL)
+       {
+               WDC_LOGD("vconf (%s) value is NULL!!!\n", VCONFKEY_SUBNET_MASK);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+       else
+       {
+               WDC_LOGD("VCONFKEY_SUBNET_MASK(%s) : %s", VCONFKEY_SUBNET_MASK, get_str);
+
+               char *temp_subnetmask = NULL;
+               temp_subnetmask = strdup(get_str);
+               if (NULL == temp_subnetmask)
+               {
+                       WDC_LOGE("Failed to allocate memory for subnet mask.\n");
+                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+               }
+
+               *subnet_mask = temp_subnetmask;
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_gateway_address(char** gateway_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == gateway_address)
+       {
+               WDC_LOGE("NULL Param [gateway_address]!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_state_e status = 0;
+       int result;
+       result = wifi_direct_get_state(&status);
+       WDC_LOGD("wifi_direct_get_state() state=[%d], result=[%d]\n", status, result);
+
+       if( status < WIFI_DIRECT_STATE_CONNECTED)
+       {
+               WDC_LOGE("Device is not connected!\n");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+
+       char* get_str = NULL;
+       get_str = vconf_get_str(VCONFKEY_GATEWAY);
+
+       if (get_str == NULL)
+       {
+               WDC_LOGD("vconf (%s) value is NULL!!!\n", VCONFKEY_GATEWAY);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_PERMITTED;
+       }
+       else
+       {
+               WDC_LOGD("VCONFKEY_GATEWAY(%s) : %s", VCONFKEY_GATEWAY, get_str);
+
+               char *temp_gateway = NULL;
+               temp_gateway = strdup(get_str);
+               if (NULL == temp_gateway)
+               {
+                       WDC_LOGE("Failed to allocate memory for gateway address.");
+                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+               }
+
+               *gateway_address = temp_gateway;
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_mac_address(char **mac_address)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == mac_address)
+       {
+               WDC_LOGE("NULL Param [mac_address]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGD("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+#if 0
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       unsigned char la_mac_addr[6] = { 0, };
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_DEVICE_MAC;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGD("Error!!! writing to socket, Errno = %s\n", strerror(errno));
+               WDC_LOGD("Error!!! [%s]\n", __wfd_print_error(status));
+               close(client_info->sync_sockfd);
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGD("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_DEVICE_MAC)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_get_mac_addr() SUCCESS");
+                               strncpy((char *) la_mac_addr, (char *) rsp.param2,
+                                               strlen(rsp.param2));
+
+                               char *temp_mac = NULL;
+                               temp_mac = (char *) calloc(1, 18);
+                               if (NULL == temp_mac)
+                               {
+                                       WDC_LOGE("Failed to allocate memory for MAC address");
+                                       return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+                               }
+    
+                               sprintf(temp_mac, MACSTR, MAC2STR(la_mac_addr));
+
+                               *mac_address = temp_mac;
+
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d",
+                                                  rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+#else
+       int fd;
+       int n;
+       char mac_info[18];
+       unsigned char la_mac_addr[6];
+
+       memset(mac_info, 0, sizeof(mac_info));
+       
+       if( (fd = open(WIFI_DIRECT_MAC_ADDRESS_INFO_FILE, O_RDONLY)) == -1)
+       {
+               WDC_LOGE("[.mac.info] file open failed.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+       }
+
+       n = read(fd, mac_info, 18);
+       if(n < 0)
+       {
+               WDC_LOGE("[.mac.info] file read failed.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+       }
+
+       WDC_LOGD("mac_address = [%s]", mac_info);
+
+       memset(la_mac_addr, 0, sizeof(la_mac_addr));
+       macaddr_atoe(mac_info, la_mac_addr);
+       la_mac_addr[0] = la_mac_addr[0] | 0x02;
+       la_mac_addr[1] = la_mac_addr[1];
+       la_mac_addr[2] = la_mac_addr[2];
+       la_mac_addr[3] = la_mac_addr[3];
+       la_mac_addr[4] = la_mac_addr[4];
+       la_mac_addr[5] = la_mac_addr[5];
+
+       char *temp_mac = NULL;
+       temp_mac = (char *) calloc(1, 18);
+       if (NULL == temp_mac)
+       {
+               WDC_LOGE("Failed to allocate memory for MAC address");
+               return WIFI_DIRECT_ERROR_OUT_OF_MEMORY;
+       }
+
+       //strncpy(temp_mac, mac_info, strlen(mac_info));
+       snprintf(temp_mac, 18, MACSTR, MAC2STR(la_mac_addr));
+
+       *mac_address = temp_mac;
+       
+#endif
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_get_state(wifi_direct_state_e * state)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == state)
+       {
+               WDC_LOGE("NULL Param [state]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_LINK_STATUS;
+       req.client_id = client_info->client_id;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", ret,
+                                          strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_LINK_STATUS)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d %s", rsp.result, __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("Link Status = %d", (int) rsp.param1);
+                               *state = (wifi_direct_state_e) rsp.param1;
+
+                               /* for CAPI : there is no WIFI_DIRECT_STATE_GROUP_OWNER type in CAPI */
+                               if(*state == WIFI_DIRECT_STATE_GROUP_OWNER)
+                                       *state = WIFI_DIRECT_STATE_CONNECTED;
+                               
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_is_discoverable(bool* discoverable)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (discoverable == NULL)
+       {
+               WDC_LOGE("NULL Param [discoverable]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_DISCOVERABLE;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_DISCOVERABLE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_discoverable() %s SUCCESS", rsp.param2);
+                               *discoverable = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_is_listening_only(bool* listen_only)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (listen_only == NULL)
+       {
+               WDC_LOGE("NULL Param [listen_only]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_LISTENING_ONLY;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_LISTENING_ONLY)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_listening_only() %s SUCCESS", rsp.param2);
+                               *listen_only = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == type)
+       {
+               WDC_LOGE("NULL Param [type]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       WDC_LOGD("Current primary_dev_type [%d]", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE);
+
+       *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE;      // Telephone
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (NULL == type)
+       {
+               WDC_LOGE("NULL Param [type]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+
+       WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL);
+
+       *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL;        // smart phone dual mode (wifi and cellular)
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_set_autoconnection_mode(bool mode)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE;
+       req.client_id = client_info->client_id;
+
+       status =__wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!");
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &mode,
+                                                                 sizeof(bool));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_is_autoconnection_mode(bool* mode)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (mode == NULL)
+       {
+               WDC_LOGE("NULL Param [mode]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_autoconnection_mode() %s SUCCESS", rsp.param2);
+                               *mode = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+
+int wifi_direct_set_persistent_group_enabled(bool enabled)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       if (enabled == true)
+               req.cmd = WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP;
+       else
+               req.cmd = WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP;
+
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP
+                       || rsp.cmd == WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD( "Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD( "Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_set_persistent_group_enabled() SUCCESS");
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+
+int wifi_direct_is_persistent_group_enabled(bool* enabled)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if (enabled == NULL)
+       {
+               WDC_LOGE("NULL Param [enabled]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]\n",
+                                          __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+                               WDC_LOGD("wifi_direct_is_persistent_group_enabled() %s SUCCESS", rsp.param2);
+                               *enabled = (bool) rsp.param1;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+
+}
+
+int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb callback, void* user_data)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (callback == NULL)
+       {
+               WDC_LOGE("NULL Param [callback]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int i;
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGE("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGE("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+                       else
+                       {
+
+                               int num = rsp.param1;
+                               int status = 0;
+                               wfd_persistent_group_info_s *buff = NULL;
+
+                               WDC_LOGD("Num of persistent groups = %d", (int) rsp.param1);
+
+                               if (num > 0)
+                               {
+                                       buff = (wfd_persistent_group_info_s *) malloc(num * sizeof(wfd_persistent_group_info_s));
+                                       if (buff == NULL)
+                                       {
+                                               WDC_LOGE("malloc() failed!!!.");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+
+                                       status =
+                                               __wfd_client_read_more_data(client_info->sync_sockfd,
+                                                                                                       buff,
+                                                                                                       num *
+                                                                                                       sizeof
+                                                                                                       (wfd_persistent_group_info_s));
+                                       if (status != WIFI_DIRECT_ERROR_NONE)
+                                       {
+                                               if (NULL != buff)
+                                                       free(buff);
+                                               WDC_LOGE("socket read error.");
+                                               return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                                       }
+                               }
+
+                               __wfd_client_print_persistent_group_info(buff, num);
+
+                               WDC_LOGD("wifi_direct_foreach_persistent_groups() SUCCESS");
+
+                               char* ssid;
+                               char* go_mac_address;
+
+                               for (i = 0; i < num; i++)
+                               {
+                                       ssid = strdup(buff[i].ssid);
+                                       go_mac_address = (char *) calloc(1, 18);
+                                       snprintf(go_mac_address, 18, MACSTR, MAC2STR(buff[i].go_mac_address));
+
+                                       if (!callback(go_mac_address, ssid, user_data))
+                                               break;
+                               }
+
+                               if (NULL != buff)
+                                       free(buff);
+
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_remove_persistent_group(const char* mac_address, const char* ssid)
+{
+       __WDC_LOG_FUNC_START__;
+
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if ( NULL== mac_address )
+       {
+               WDC_LOGE("NULL Param [mac_address]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       if ( NULL== ssid )
+       {
+               WDC_LOGE("NULL Param [ssid]!");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       wfd_persistent_group_info_s persistent_group_info;
+       unsigned char la_mac_addr[6];
+
+       int status = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP;
+       req.client_id = client_info->client_id;
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       WDC_LOGD("writing msg hdr is success!");
+
+       strncpy(persistent_group_info.ssid, ssid, strlen(ssid));
+
+       memset(la_mac_addr, 0, sizeof(la_mac_addr));
+       macaddr_atoe(mac_address, la_mac_addr);
+       persistent_group_info.go_mac_address[0] = la_mac_addr[0];
+       persistent_group_info.go_mac_address[1] = la_mac_addr[1];
+       persistent_group_info.go_mac_address[2] = la_mac_addr[2];
+       persistent_group_info.go_mac_address[3] = la_mac_addr[3];
+       persistent_group_info.go_mac_address[4] = la_mac_addr[4];
+       persistent_group_info.go_mac_address[5] = la_mac_addr[5];
+
+       status =
+               __wfd_client_send_request(client_info->sync_sockfd, &persistent_group_info,
+                                                                 sizeof(wfd_persistent_group_info_s));
+       if (status != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(status));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((status =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s\n", status, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_set_p2poem_loglevel(int increase_log_level)
+{
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+
+       __WDC_LOG_FUNC_START__;
+
+       if ((client_info->is_registered == false)
+               || (client_info->client_id == WFD_INVALID_ID))
+       {
+               WDC_LOGE("Client is NOT registered.");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL;
+       req.client_id = client_info->client_id;
+       if (increase_log_level == 0)
+               req.data.listen_only = false;
+       else
+               req.data.listen_only = true;
+
+       ret =
+               __wfd_client_send_request(client_info->sync_sockfd, &req,
+                                                                 sizeof(wifi_direct_client_request_s));
+       if (ret != WIFI_DIRECT_ERROR_NONE)
+       {
+               WDC_LOGE("Error!!! writing to socket, Errno = %s", strerror(errno));
+               WDC_LOGE("Error!!! [%s]", __wfd_print_error(ret));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+
+       if ((ret =
+                __wfd_client_read_socket(client_info->sync_sockfd, (char *) &rsp,
+                                                                 sizeof(wifi_direct_client_response_s))) <= 0)
+       {
+               WDC_LOGE("Error!!! reading socket, status = %d errno = %s", ret, strerror(errno));
+               client_info->sync_sockfd = -1;
+               __wfd_reset_control();
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_COMMUNICATION_FAILED;
+       }
+       else
+       {
+               if (rsp.cmd == WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL)
+               {
+                       if (rsp.result != WIFI_DIRECT_ERROR_NONE)
+                       {
+                               WDC_LOGD("Error!!! Result received = %d", rsp.result);
+                               WDC_LOGD("Error!!! [%s]", __wfd_print_error(rsp.result));
+                               __WDC_LOG_FUNC_END__;
+                               return rsp.result;
+                       }
+               }
+               else
+               {
+                       WDC_LOGE("Error!!! Invalid resp cmd = %d", rsp.cmd);
+                       return WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       __WDC_LOG_FUNC_END__;
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
diff --git a/src/wifi-direct-utils.c b/src/wifi-direct-utils.c
new file mode 100644 (file)
index 0000000..c6b4a37
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * libwifi-direct
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com> 
+ *
+ * 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 <stdbool.h>
+#include <errno.h>
+#include <sys/time.h>
+
+#define _GNU_SOURCE            
+#include <unistd.h>
+#include <sys/syscall.h>               
+
+#include "wifi-direct.h"
+#include "wifi-direct-client-proxy.h"
+#include "wifi-direct-internal.h"
+
+int wfd_gettid()
+{
+#ifdef __NR_gettid
+       return syscall(__NR_gettid);
+#else
+       fprintf(stderr,
+                       "__NR_gettid is not defined, please include linux/unistd.h ");
+       return -1;
+#endif
+}
+
+char *wfd_trim_path(const char *filewithpath)
+{
+       static char *filename[100];
+       char *strptr = NULL;
+       int start = 0;
+       const char *space = "                                        ";
+       int len = strlen(filewithpath);
+
+       if (len > 20)
+       {
+               strptr = (char *) filewithpath + (len - 20);
+               start = 0;
+       }
+       else if (len < 20)
+       {
+               strptr = (char *) filewithpath;
+               start = 20 - len;
+       }
+       strncpy((char *) filename, space, strlen(space));
+       strncpy((char *) filename + start, strptr, 50);
+
+       return (char *) filename;
+}
+
+char *wfd_debug_print(char *file, int line, char *format, ...)
+{
+       static char buffer_internal[512];
+       char prefix_buffer[64];
+       char *prefix;
+       va_list args;
+       char buf[512];
+       int header_max = 35;
+
+       va_start(args, format);
+       vsnprintf(buf, 512, format, args);
+       va_end(args);
+
+       snprintf(prefix_buffer, 64, "[%s:%d,%d]", file, line, wfd_gettid());
+       int len = strlen(prefix_buffer);
+       if (len > header_max)
+       {
+               prefix = prefix_buffer + (len - header_max);
+       }
+       else
+       {
+               prefix = prefix_buffer;
+       }
+
+       snprintf(buffer_internal, 512, "%s%s", prefix, buf);
+
+       return buffer_internal;
+}
+
+char *wfd_print_state(wifi_direct_state_e s)
+{
+       switch (s)
+       {
+       case WIFI_DIRECT_STATE_DEACTIVATED:
+               return "DEACTIVATED";
+               break;
+
+       case WIFI_DIRECT_STATE_DEACTIVATING:
+               return "DEACTIVATING";
+               break;
+       case WIFI_DIRECT_STATE_ACTIVATING:
+               return "ACTIVATING";
+               break;
+       case WIFI_DIRECT_STATE_ACTIVATED:
+               return "ACTIVATED";
+               break;
+       case WIFI_DIRECT_STATE_DISCOVERING:
+               return "DISCOVERING";
+               break;
+       case WIFI_DIRECT_STATE_CONNECTING:
+               return "CONNECTING";
+               break;
+       case WIFI_DIRECT_STATE_DISCONNECTING:
+               return "DISCONNECTING";
+               break;
+       case WIFI_DIRECT_STATE_CONNECTED:
+               return "CONNECTED";
+               break;
+       case WIFI_DIRECT_STATE_GROUP_OWNER:
+               return "GROUP OWNER";
+               break;
+       default:
+               return "Unknown";
+       }
+       return "Unknown";
+}
diff --git a/src/wifi-direct.pc.in b/src/wifi-direct.pc.in
new file mode 100755 (executable)
index 0000000..cc614a4
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@prefix@
+libdir=@prefix@/lib
+includedir=@prefix@/include
+
+Name: wifi-direct
+Description: Wi-Fi Direct Library 
+Version: @VERSION@
+Libs: -L${libdir} -lwifi-direct
+Cflags: -I${includedir} -I${includedir}/wifi-direct
+