From: hyunuktak Date: Fri, 7 Aug 2015 08:03:22 +0000 (+0900) Subject: Base Code merged to SPIN 2.4 X-Git-Tag: submit/tizen/20150810.034432^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99c16afcd1ef74fb2efd7490feee4246f0db0f56;p=platform%2Fcore%2Fapi%2Fwifi.git Base Code merged to SPIN 2.4 Signed-off-by: hyunuktak Change-Id: Id827a72cf8e0d3900caf031c8d78f8d7a99e74ef --- diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 5c2063d..0000000 --- a/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Jeik Jaehyun Kim -ByungWoo Lee diff --git a/CMakeLists.txt b/CMakeLists.txt index 82df0a7..76db0c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,22 +3,39 @@ SET(fw_name "capi-network-wifi") PROJECT(${fw_name}) -SET(CMAKE_INSTALL_PREFIX /usr) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(LIB ${LIB_PATH}) +SET(LIBDIR ${PREFIX}/${LIB_PATH}) + SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "dlog vconf capi-base-common glib-2.0 network") +SET(dependents "dlog vconf capi-base-common glib-2.0 network capi-system-info") SET(pc_dependents "capi-base-common") +IF(TIZEN_DUALSIM_ENABLE) + ADD_DEFINITIONS(-DTIZEN_DUALSIM_ENABLE) +ENDIF(TIZEN_DUALSIM_ENABLE) +IF(TIZEN_WEARABLE) + ADD_DEFINITIONS(-DTIZEN_WEARABLE) +ENDIF(TIZEN_WEARABLE) +IF(TIZEN_MOBILE) + ADD_DEFINITIONS(-DTIZEN_MOBILE) +ENDIF(TIZEN_MOBILE) + +IF(TIZEN_TV) + ADD_DEFINITIONS(-DTIZEN_TV) +ENDIF(TIZEN_TV) + INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name} REQUIRED ${dependents}) +pkg_check_modules(${fw_name} REQUIRED ${dependents} ${APPFW_REQUIRED_PKGS}) FOREACH(flag ${${fw_name}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden") +#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") IF("${ARCH}" STREQUAL "arm") @@ -28,7 +45,7 @@ ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}") aux_source_directory(src SOURCES) ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) @@ -42,7 +59,7 @@ SET_TARGET_PROPERTIES(${fw_name} CLEAN_DIRECT_OUTPUT 1 ) -INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(TARGETS ${fw_name} DESTINATION ${LIB}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/network FILES_MATCHING @@ -59,7 +76,7 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc @ONLY ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB}/pkgconfig) ADD_SUBDIRECTORY(test) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..100c877 --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 deleted file mode 100644 index d645695..0000000 --- a/LICENSE.APLv2 +++ /dev/null @@ -1,202 +0,0 @@ - - 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/NOTICE b/NOTICE index 0e0f016..ccdad52 100644 --- a/NOTICE +++ b/NOTICE @@ -1,3 +1,3 @@ Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. Except as noted, this software is licensed under Apache License, Version 2. -Please, see the LICENSE.APLv2 file for Apache License terms and conditions. +Please, see the LICENSE file for Apache License terms and conditions. diff --git a/capi-network-wifi.manifest b/capi-network-wifi.manifest new file mode 100644 index 0000000..5d417ef --- /dev/null +++ b/capi-network-wifi.manifest @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/debian/capi-network-wifi-dev.install b/debian/capi-network-wifi-dev.install deleted file mode 100644 index 761a28b..0000000 --- a/debian/capi-network-wifi-dev.install +++ /dev/null @@ -1,4 +0,0 @@ -/usr/include/* -/usr/include/*/* -/usr/lib/pkgconfig/*.pc - diff --git a/debian/capi-network-wifi.install b/debian/capi-network-wifi.install deleted file mode 100644 index 4a755a4..0000000 --- a/debian/capi-network-wifi.install +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/lib*.so* diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 83faf17..0000000 --- a/debian/changelog +++ /dev/null @@ -1,231 +0,0 @@ -capi-network-wifi (0.1.2-24) unstable; urgency=low - - * Clean the unnecessary things up - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-24 - - -- Taesub Kim Fri, 29 Nov 2013 14:50:46 +0900 - -capi-network-wifi (0.1.2-23) unstable; urgency=low - - * Use 'Already exists' error msg if applicable - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-23 - - -- Taesub Kim Fri, 29 Nov 2013 14:35:46 +0900 - -capi-network-wifi (0.1.2-22) unstable; urgency=low - - * Revise wifi_ap_set_eap_private_key_info() - admit to set without password - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-22 - - -- Taesub Kim Fri, 29 Nov 2013 14:05:46 +0900 - -capi-network-wifi (0.1.2-21) unstable; urgency=low - - * Avoid resetting IP, subnet mask and gateway to 0 in case of static type - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-21 - - -- Taesub Kim Fri, 29 Nov 2013 13:52:46 +0900 - -capi-network-wifi (0.1.2-20) unstable; urgency=low - - * Set CFLAGS fvisibility hidden - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-20 - - -- Taesub Kim Fri, 29 Nov 2013 13:31:46 +0900 - -capi-network-wifi (0.1.2-19) unstable; urgency=low - - * Fix Wi-Fi open connection - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-19 - - -- Taesub Kim Fri, 29 Nov 2013 12:04:46 +0900 - -capi-network-wifi (0.1.2-17) unstable; urgency=low - - * Handle NET_ERR_ACTIVE_CONNECTION_EXISTS event and correct the unit of data transfer rate - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-17 - - -- JaeHyun Kim Fri, 22 Mar 2013 18:30:06 +0900 - -capi-network-wifi (0.1.2-16) unstable; urgency=low - - * Revise wifi_is_activated() to fix performance issue - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-16 - - -- JaeHyun Kim Tue, 19 Mar 2013 01:01:15 +0900 - -capi-network-wifi (0.1.2-15) unstable; urgency=low - - * Added specific(hidden) scan support - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-15 - - -- JaeHyun Kim Tue, 26 Feb 2013 11:19:52 +0900 - -capi-network-wifi (0.1.2-14) unstable; urgency=low - - * Fix memory corruption - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-14 - - -- JaeHyun Kim Mon, 28 Jan 2013 21:04:51 +0900 - -capi-network-wifi (0.1.2-13) unstable; urgency=low - - * Set default address if there is no manual proxy to be restored - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-13 - - -- JaeHyun Kim Wed, 23 Jan 2013 12:17:18 +0900 - -capi-network-wifi (0.1.2-12) unstable; urgency=low - - * Revise wifi_ap_is_passphrase_required() to fit connman 1.3 - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-12 - - -- JaeHyun Kim Wed, 16 Jan 2013 17:15:16 +0900 - -capi-network-wifi (0.1.2-11) unstable; urgency=low - - * Use libnet-client API instead of vconf value to get Wi-Fi state in wifi_is_activated() API - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-11 - - -- JaeHyun Kim Tue, 15 Jan 2013 00:07:57 +0900 - -capi-network-wifi (0.1.2-10) unstable; urgency=low - - * Add WIFI_ERROR_SECURITY_RESTRICTED - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-10 - - -- JaeHyun Kim Fri, 04 Jan 2013 14:19:09 +0900 - -capi-network-wifi (0.1.2-9) unstable; urgency=low - - * In case of setting IP address, Gateway, Subnet and proxy, it is allowed that a value is set to NULL - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-9 - - -- JaeHyun Kim Fri, 04 Jan 2013 13:43:46 +0900 - -capi-network-wifi (0.1.2-8) unstable; urgency=low - - * Fix a bug, the api for dns setting is not work properly - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-8 - - -- JaeHyun Kim Thu, 13 Dec 2012 19:48:24 +0900 - -capi-network-wifi (0.1.2-7) unstable; urgency=low - - * Fix a bug, the list handle not reset to NULL after clearing the AP list. - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-7 - - -- Praveen C Sat, 01 Dec 2012 18:56:38 +0530 - -capi-network-wifi (0.1.2-6) unstable; urgency=low - - * Fix a bug, the setters of proxy/ip method are not work properly - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-6 - - -- JaeHyun Kim Fri, 23 Nov 2012 17:33:40 +0900 - -capi-network-wifi (0.1.2-5) unstable; urgency=low - - * Revise minor things - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-5 - - -- Danny Jeongseok Seo Tue, 13 Nov 2012 14:14:26 +0900 - -capi-network-wifi (0.1.2-4) unstable; urgency=low - - * Revise test code - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-4 - - -- JaeHyun Kim Tue, 06 Nov 2012 20:31:31 +0900 - -capi-network-wifi (0.1.2-3) unstable; urgency=low - - * Add wifi_ap_get_eap_passphrase() - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-3 - - -- JaeHyun Kim Mon, 15 Oct 2012 17:07:31 +0900 - -capi-network-wifi (0.1.2-2) unstable; urgency=low - - * Install license - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-2 - - -- Danny Jeongseok Seo Thu, 11 Oct 2012 19:06:52 +0900 - -capi-network-wifi (0.1.2-1) unstable; urgency=low - - * Extend some APIs to fit requirements from osp - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.2-1 - - -- JaeHyun Kim Thu, 27 Sep 2012 17:25:19 +0900 - -capi-network-wifi (0.1.1-4) unstable; urgency=low - - * Update manifest - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.1-4 - - -- Danny Jeongseok Seo Fri, 21 Sep 2012 15:54:22 +0900 - -capi-network-wifi (0.1.1-3) unstable; urgency=low - - * Remove unused codes from the UTC file - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.1-3 - - -- JaeHyun Kim Tue, 04 Sep 2012 16:21:28 +0900 - -capi-network-wifi (0.1.1-2) unstable; urgency=low - - * Add UTC files - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.1-2 - - -- JaeHyun Kim Wed, 04 Jul 2012 11:41:10 +0900 - -capi-network-wifi (0.1.1-1) unstable; urgency=low - - * Add AP initialization functions for user creation - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.1-1 - - -- JaeHyun Kim Mon, 02 Jul 2012 11:01:10 +0900 - -capi-network-wifi (0.1.1-0) unstable; urgency=low - - * Package implementation - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.1-0 - - -- JaeHyun Kim Mon, 21 May 2012 19:31:01 +0900 - -capi-network-wifi (0.1.0-1) unstable; urgency=low - - * Initial Upload - * Git: framework/api/wifi - * Tag: capi-network-wifi_0.1.0-1 - - -- JaeHyun Kim Mon, 09 Apr 2012 20:54:57 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7f8f011..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian/control b/debian/control deleted file mode 100644 index 7fb1ee7..0000000 --- a/debian/control +++ /dev/null @@ -1,21 +0,0 @@ -Source: capi-network-wifi -Section: libs -Priority: extra -Maintainer: JaeHyun Kim -Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev, libglib2.0-dev, libdbus-glib-1-dev, libnetwork-dev - -Package: capi-network-wifi -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Network Wi-Fi library in TIZEN C API - -Package: capi-network-wifi-dev -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version}), capi-base-common-dev -Description: Network Wi-Fi library in TIZEN C API (DEV) - -Package: capi-network-wifi-dbg -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-wifi (= ${Source-Version}) -Description: Network Wi-Fi library in TIZEN C API (DBG) - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 3ae0922..0000000 --- a/debian/rules +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/make -f - -CFLAGS = -Wall -g -FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1) -MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1) - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif -CMAKE_ROOT_DIR ?= $(CURDIR) -CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp - -configure: configure-stamp -configure-stamp: - dh_testdir - mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER} - touch configure-stamp - - -build: build-stamp -build-stamp: configure-stamp - dh_testdir - cd $(CMAKE_BUILD_DIR) && $(MAKE) - touch $@ - -clean: - cd $(CMAKE_ROOT_DIR) - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - rm -f `find . -name *.pc` - rm -rf $(CMAKE_BUILD_DIR) - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp - dh_installman - dh_link - dh_strip --dbg-package=capi-network-wifi-dbg - dh_fixperms - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure - diff --git a/doc/wifi_doc.h b/doc/wifi_doc.h index 465e46e..6e63093 100755 --- a/doc/wifi_doc.h +++ b/doc/wifi_doc.h @@ -40,7 +40,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -68,7 +68,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -92,7 +92,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -117,7 +117,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -141,7 +141,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -165,7 +165,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ @@ -189,7 +189,7 @@ * * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n * - * More details on featuring your application can be found from Feature Element. + * More details on featuring your application can be found from Feature List. * */ diff --git a/include/net_wifi_private.h b/include/net_wifi_private.h old mode 100644 new mode 100755 index 3ce51d7..8f3c072 --- a/include/net_wifi_private.h +++ b/include/net_wifi_private.h @@ -20,9 +20,14 @@ #include #include #include +#include #include "wifi.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #undef LOG_TAG #define LOG_TAG "CAPI_NETWORK_WIFI" @@ -30,6 +35,26 @@ #define WIFI_ERROR 2 #define WIFI_WARN 3 +#define WIFI_FEATURE "http://tizen.org/feature/network.wifi" + +#if !defined TIZEN_TV +#define CHECK_FEATURE_SUPPORTED(feature_name) \ + do { \ + bool feature_supported = FALSE; \ + if (!system_info_get_platform_bool(feature_name, &feature_supported)) { \ + if (feature_supported == FALSE) { \ + LOGE("%s feature is disabled", feature_name); \ + return WIFI_ERROR_NOT_SUPPORTED; \ + } \ + } else { \ + LOGE("Error - Feature getting from System Info"); \ + return WIFI_ERROR_OPERATION_FAILED; \ + } \ + } while(0) +#else +#define CHECK_FEATURE_SUPPORTED(feature_name) +#endif + #define WIFI_LOG(log_level, format, args...) \ do { \ switch (log_level) { \ @@ -44,9 +69,19 @@ } \ } while(0) -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#define SECURE_WIFI_LOG(log_level, format, args...) \ + do { \ + switch (log_level) { \ + case WIFI_ERROR: \ + SECURE_LOGE(format, ## args); \ + break; \ + case WIFI_WARN: \ + SECURE_LOGW(format, ## args); \ + break; \ + default: \ + SECURE_LOGI(format, ## args); \ + } \ + } while(0) bool _wifi_is_init(void); diff --git a/include/wifi.h b/include/wifi.h old mode 100644 new mode 100755 index 51ccdbe..126d8cc --- a/include/wifi.h +++ b/include/wifi.h @@ -34,7 +34,7 @@ extern "C" { /** * @brief Enumeration for the Wi-Fi error type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -68,7 +68,7 @@ typedef enum /** * @brief Enumeration for the state of the Wi-Fi device. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -78,7 +78,7 @@ typedef enum /** * @brief Enumeration for the state of the Wi-Fi connection. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -91,7 +91,7 @@ typedef enum /** * @brief Enumeration for the RSSI level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -114,7 +114,7 @@ typedef enum /** * @brief Enumeration for the Net IP configuration type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -127,7 +127,7 @@ typedef enum /** * @brief Enumeration for the address type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -137,7 +137,7 @@ typedef enum /** * @brief Enumeration for the proxy method type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -161,7 +161,7 @@ typedef enum * @details The following security modes are used in infrastructure and ad-hoc mode. * For now all EAP security mechanisms are provided only in infrastructure mode. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -175,7 +175,7 @@ typedef enum /** * @brief Enumeration for Wi-Fi encryption type. * @details The following encryption modes are used in infrastructure and ad-hoc mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -198,7 +198,7 @@ typedef enum /** * @brief Enumeration for EAP type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -211,7 +211,7 @@ typedef enum /** * @brief Enumeration for EAP phase2 authentication type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -235,7 +235,7 @@ typedef enum /** * @brief The Wi-Fi access point handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef void* wifi_ap_h; @@ -251,7 +251,7 @@ typedef void* wifi_ap_h; /** * @brief Called when you get the found access point repeatedly. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks @a ap is valid only in this function. In order to use @a ap outside this function, you must copy the ap with wifi_ap_clone(). * @param[in] ap The access point * @param[in] user_data The user data passed from the request function @@ -266,7 +266,7 @@ typedef bool(*wifi_found_ap_cb)(wifi_ap_h ap, void *user_data); /** * @brief Called when the scan is finished. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] error_code The error code * @param[in] user_data The user data passed from the callback registration function * @see wifi_scan() @@ -277,7 +277,7 @@ typedef void(*wifi_scan_finished_cb)(wifi_error_e error_code, void *user_data); /** * @brief Called after wifi_activate() or wifi_activate_with_wifi_picker_tested() is completed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] result The result * @param[in] user_data The user data passed from wifi_activate() and wifi_activate_with_wifi_picker_tested() * @pre wifi_activate() or wifi_activate_with_wifi_picker_tested() will invoke this callback function. @@ -288,7 +288,7 @@ typedef void(*wifi_activated_cb)(wifi_error_e result, void *user_data); /** * @brief Called after wifi_deactivate() is completed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] result The result * @param[in] user_data The user data passed from wifi_deactivate() * @pre wifi_deactivate() will invoke this callback function. @@ -298,7 +298,7 @@ typedef void(*wifi_deactivated_cb)(wifi_error_e result, void *user_data); /** * @brief Called after either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() are completed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] result The result * @param[in] user_data The user data passed from either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() * @pre Either wifi_connect() or wifi_connect_by_wps_pbc() or wifi_connect_by_wps_pin() will invoke this callback function. @@ -310,7 +310,7 @@ typedef void(*wifi_connected_cb)(wifi_error_e result, void *user_data); /** * @brief Called after wifi_disconnect() is completed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] result The result * @param[in] user_data The user data passed from wifi_disconnect() * @pre wifi_disconnect() will invoke this callback function. @@ -330,7 +330,7 @@ typedef void(*wifi_disconnected_cb)(wifi_error_e result, void *user_data); /** * @brief Called when the device state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] state The device state * @param[in] user_data The user data passed from the callback registration function * @see wifi_set_device_state_changed_cb() @@ -340,7 +340,7 @@ typedef void(*wifi_device_state_changed_cb)(wifi_device_state_e state, void *use /** * @brief Called when the connection state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] state The connection state * @param[in] ap The access point * @param[in] user_data The user data passed from the callback registration function @@ -351,7 +351,7 @@ typedef void(*wifi_connection_state_changed_cb)(wifi_connection_state_e state, w /** * @brief Called when the RSSI of connected Wi-Fi is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] rssi_level The level of RSSI * @param[in] user_data The user data passed from the callback registration function * @see wifi_set_rssi_level_changed_cb() @@ -371,7 +371,7 @@ typedef void(*wifi_rssi_level_changed_cb)(wifi_rssi_level_e rssi_level, void *us /** * @brief Initializes Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @return @c 0 on success, otherwise negative error value @@ -384,7 +384,7 @@ int wifi_initialize(void); /** * @brief Deinitializes Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation @@ -405,7 +405,7 @@ int wifi_deinitialize(void); /** * @brief Activates Wi-Fi asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -428,7 +428,7 @@ int wifi_activate(wifi_activated_cb callback, void *user_data); /** * @brief Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -451,7 +451,7 @@ int wifi_activate_with_wifi_picker_tested(wifi_activated_cb callback, void *user /** * @brief Deactivates Wi-Fi asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -473,7 +473,7 @@ int wifi_deactivate(wifi_deactivated_cb callback, void *user_data); /** * @brief Checks whether Wi-Fi is activated. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @param[out] activated @c ture if Wi-Fi is activated, @@ -489,7 +489,7 @@ int wifi_is_activated(bool* activated); /** * @brief Gets the local MAC address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a mac_address using free(). * @param[out] mac_address The MAC address * @return 0 on success, otherwise negative error value @@ -502,7 +502,7 @@ int wifi_get_mac_address(char** mac_address); /** * @brief Gets the name of the network interface. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @remarks You must release @a name using free(). @@ -519,7 +519,7 @@ int wifi_get_network_interface_name(char** name); /** * @brief Starts scan asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -560,7 +560,7 @@ int wifi_scan_specific_ap(const char* essid, wifi_scan_finished_cb callback, voi /** * @brief Gets the handle of the connected access point. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @remarks You must release @a handle using wifi_ap_destroy(). @@ -577,7 +577,7 @@ int wifi_get_connected_ap(wifi_ap_h* ap); /** * @brief Gets the result of the scan. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @param[in] callback The callback to be called @@ -612,7 +612,7 @@ int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* user_data); /** * @brief Connects the access point asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -638,7 +638,7 @@ int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void *user_data); /** * @brief Disconnects the access point asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.set \n * %http://tizen.org/privilege/network.get @@ -664,7 +664,7 @@ int wifi_disconnect(wifi_ap_h ap, wifi_disconnected_cb callback, void *user_data /** * @brief Connects the access point with WPS PBC asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -690,7 +690,7 @@ int wifi_connect_by_wps_pbc(wifi_ap_h ap, wifi_connected_cb callback, void *user /** * @brief Connects the access point with WPS PIN asynchronously. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -718,7 +718,7 @@ int wifi_connect_by_wps_pin(wifi_ap_h ap, const char *pin, wifi_connected_cb cal * @brief Deletes the information of stored access point and disconnects it when it connected. * @details If an AP is connected, then connection information will be stored. * This information is used when a connection to that AP is established automatically. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -746,7 +746,7 @@ int wifi_forget_ap(wifi_ap_h ap); /** * @brief Gets the connection state. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @param[out] connection_state The connection state @@ -761,7 +761,7 @@ int wifi_get_connection_state(wifi_connection_state_e* connection_state); /** * @brief Registers the callback called when the device state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function * @return 0 on success, otherwise negative error value @@ -774,7 +774,7 @@ int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void /** * @brief Unregisters the callback called when the device state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation @@ -784,7 +784,7 @@ int wifi_unset_device_state_changed_cb(void); /** * @brief Registers the callback called when the background scan is finished periodically. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function * @return 0 on success, otherwise negative error value @@ -797,7 +797,7 @@ int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void *user_data) /** * @brief Unregisters the callback called when the scan is finished periodically. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation @@ -807,7 +807,7 @@ int wifi_unset_background_scan_cb(void); /** * @brief Registers the callback called when the connection state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function * @return 0 on success, otherwise negative error value @@ -820,7 +820,7 @@ int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callba /** * @brief Unregisters the callback called when the connection state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation @@ -830,7 +830,7 @@ int wifi_unset_connection_state_changed_cb(void); /** * @brief Registers callback called when the RSSI of connected Wi-Fi is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function * @return 0 on success, otherwise negative error value @@ -843,7 +843,7 @@ int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void *us /** * @brief Unregisters callback called when the RSSI of connected Wi-Fi is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation @@ -863,7 +863,7 @@ int wifi_unset_rssi_level_changed_cb(void); /** * @brief Creates the access point handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -882,7 +882,7 @@ int wifi_ap_create(const char* essid, wifi_ap_h* ap); /** * @brief Creates the hidden access point handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a ap using wifi_ap_destroy(). * @param[in] essid The ESSID (Extended Service Set Identifier) should be null-terminated and can be UTF-8 encoded * @param[out] ap The access point handle @@ -897,7 +897,7 @@ int wifi_ap_hidden_create(const char* essid, wifi_ap_h* ap); /** * @brief Destroys the access point handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @return 0 on success, otherwise negative error value * @retval #WIFI_ERROR_NONE Successful @@ -909,7 +909,7 @@ int wifi_ap_destroy(wifi_ap_h ap); /** * @brief Clones the access point handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a cloned_ap using wifi_ap_destroy(). * @param[out] cloned_ap The cloned access point handle * @param[in] origin The origin access point handle @@ -924,7 +924,7 @@ int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin); /** * @brief Refreshes the access point information. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.get * @remarks You should call this function in order to get the current access point information, because the information can be changed. @@ -951,7 +951,7 @@ int wifi_ap_refresh(wifi_ap_h ap); /** * @brief Gets ESSID (Extended Service Set Identifier). - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a essid using free(). * @param[in] ap The access point handle * @param[out] essid The ESSID @@ -965,7 +965,7 @@ int wifi_ap_get_essid(wifi_ap_h ap, char** essid); /** * @brief Gets BSSID (Basic Service Set Identifier). - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a bssid using free(). * @param[in] ap The access point handle * @param[out] bssid The BSSID @@ -979,7 +979,7 @@ int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid); /** * @brief Gets the RSSI. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] rssi The RSSI * @return 0 on success, otherwise negative error value @@ -992,7 +992,7 @@ int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi); /** * @brief Gets the frequency band (MHz). - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] frequency The frequency * @return 0 on success, otherwise negative error value @@ -1005,7 +1005,7 @@ int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency); /** * @brief Gets the max speed (Mbps). - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] max_speed The max speed * @return 0 on success, otherwise negative error value @@ -1018,7 +1018,7 @@ int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed); /** * @brief Checks whether the access point is favorite or not. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] favorite @c true if access point is favorite, * otherwise @c false if access point is not favorite @@ -1032,7 +1032,7 @@ int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite); /** * @brief Checks whether the access point is passpoint or not. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] passpoint @c ture if access point is passpoint, * otherwise @c false if access point is not passpoint. @@ -1046,7 +1046,7 @@ int wifi_ap_is_passpoint(wifi_ap_h ap, bool* passpoint); /** * @brief Gets the connection state. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] state The connection state * @return 0 on success, otherwise negative error value @@ -1059,7 +1059,7 @@ int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state); /** * @brief Gets the config type of IP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] address_family The address family * @param[out] type The type of IP config @@ -1076,7 +1076,7 @@ int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_famil * @brief Sets the config type of IP. * @details If you set IP config type to #WIFI_IP_CONFIG_TYPE_STATIC, * then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0". - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1096,7 +1096,7 @@ int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_famil /** * @brief Gets the IP address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a ip_address using free(). * @param[in] ap The access point handle * @param[in] address_family The address family @@ -1112,7 +1112,7 @@ int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, c /** * @brief Sets the IP address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1132,7 +1132,7 @@ int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, c /** * @brief Gets the subnet mask. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a subnet_mask using free(). * @param[in] ap The access point handle * @param[in] address_family The address family @@ -1148,7 +1148,7 @@ int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, /** * @brief Sets the subnet mask. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1168,7 +1168,7 @@ int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, /** * @brief Gets the gateway address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a gateway_address using free(). * @param[in] ap The access point handle * @param[in] address_family The address family @@ -1184,7 +1184,7 @@ int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_fami /** * @brief Sets the gateway address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1205,7 +1205,7 @@ int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_fami /** * @brief Gets the proxy address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a proxy_address using free(). * @param[in] ap The access point handle * @param[in] address_family The address family @@ -1221,7 +1221,7 @@ int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family /** * @brief Sets the proxy address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1242,7 +1242,7 @@ int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family /** * @brief Gets the Proxy type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] type The type of proxy * @return 0 on success, otherwise negative error value @@ -1256,7 +1256,7 @@ int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type); /** * @brief Sets the Proxy address. * @details If you set Proxy type to #WIFI_PROXY_TYPE_AUTO or #WIFI_PROXY_TYPE_MANUAL, then Proxy will be restored. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1274,7 +1274,7 @@ int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type); /** * @brief Gets the DNS address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The allowance of DNS address is @c 2.You must release @a dns_address using free(). * @param[in] ap The access point handle * @param[in] order The order of DNS address; it starts from 1, which means first DNS address @@ -1291,7 +1291,7 @@ int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e addre /** * @brief Sets the DNS address. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/network.profile \n * %http://tizen.org/privilege/network.get @@ -1325,7 +1325,7 @@ int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e addre /** * @brief Gets the Wi-Fi security mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] type The type of Wi-Fi security * @return 0 on success, otherwise negative error value @@ -1338,7 +1338,7 @@ int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type); /** * @brief Sets the Wi-Fi security mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] type The type of Wi-Fi security * @return 0 on success, otherwise negative error value @@ -1351,7 +1351,7 @@ int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type); /** * @brief Gets the Wi-Fi encryption type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] type The type of Wi-Fi encryption * @return 0 on success, otherwise negative error value @@ -1364,7 +1364,7 @@ int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type); /** * @brief Sets the Wi-Fi encryption type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] type The type of Wi-Fi encryption * @return 0 on success, otherwise negative error value @@ -1377,7 +1377,7 @@ int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type); /** * @brief Checks whether the passphrase is required or not. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is not valid if security type is #WIFI_SECURITY_TYPE_EAP. * @param[in] ap The access point handle * @param[out] required @c true if passphrase is required, @@ -1392,7 +1392,7 @@ int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required); /** * @brief Sets the passphrase. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] passphrase The passphrase of access point * @return 0 on success, otherwise negative error value @@ -1405,7 +1405,7 @@ int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase); /** * @brief Checks whether the WPS(Wi-Fi Protected Setup) is supported or not. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] supported @c ture if WPS is supported, * otherwise @c false is WPS is not supported. @@ -1434,7 +1434,7 @@ int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported); * @details You can set one of @a user_name and @a password as @c NULL. * In this case, the value of a parameter which is set as @c NULL will be the previous value. * But it is not allowed that both @a user_name and @a password are set as @c NULL. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS. * @param[in] ap The access point handle * @param[in] user_name The user name \n @@ -1451,7 +1451,7 @@ int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* /** * @brief Gets the passphrase of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS. * You must release @a user_name using free(). * @param[in] ap The access point handle @@ -1469,7 +1469,7 @@ int wifi_ap_get_eap_passphrase(wifi_ap_h ap, char** user_name, bool* is_password /** * @brief Gets the CA Certificate of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * You must release @a file using free(). * @param[in] ap The access point handle @@ -1485,7 +1485,7 @@ int wifi_ap_get_eap_ca_cert_file(wifi_ap_h ap, char** file); /** * @brief Sets the CA Certificate of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * @param[in] ap The access point handle * @param[in] file The file path of CA Certificate @@ -1499,7 +1499,7 @@ int wifi_ap_set_eap_ca_cert_file(wifi_ap_h ap, const char* file); /** * @brief Gets the Client Certificate of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * You must release @a file using free(). * @param[in] ap The access point handle @@ -1515,7 +1515,7 @@ int wifi_ap_get_eap_client_cert_file(wifi_ap_h ap, char** file); /** * @brief Sets the CA Certificate of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * @param[in] ap The access point handle * @param[in] file The file path of Client Certificate @@ -1529,7 +1529,7 @@ int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file); /** * @brief Gets the private key file of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * You must release @a file using free(). * @param[in] ap The access point handle @@ -1545,7 +1545,7 @@ int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file); /** * @brief Sets the private key information of EAP. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS. * @param[in] ap The access point handle * @param[in] file The file path of private key @@ -1560,7 +1560,7 @@ int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* /** * @brief Gets the EAP type of Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] type The type of EAP * @return 0 on success, otherwise negative error value @@ -1574,7 +1574,7 @@ int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type); /** * @brief Sets the EAP type of Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] type The type of EAP * @return 0 on success, otherwise negative error value @@ -1587,7 +1587,7 @@ int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type); /** * @brief Gets the type of EAP phase2 authentication of Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[out] type The type of EAP phase2 authentication * @return 0 on success, otherwise negative error value @@ -1601,7 +1601,7 @@ int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type); /** * @brief Sets the type of EAP phase2 authentication of Wi-Fi. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] ap The access point handle * @param[in] type The type of EAP phase2 authentication * @return 0 on success, otherwise negative error value diff --git a/packaging/capi-network-wifi.manifest b/packaging/capi-network-wifi.manifest deleted file mode 100644 index 017d22d..0000000 --- a/packaging/capi-network-wifi.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packaging/capi-network-wifi.spec b/packaging/capi-network-wifi.spec index d98f02e..a6249f7 100644 --- a/packaging/capi-network-wifi.spec +++ b/packaging/capi-network-wifi.spec @@ -1,37 +1,60 @@ -Name: capi-network-wifi -Summary: Network Wi-Fi library in TIZEN C API -Version: 0.1.2_34 -Release: 1 -Group: System/Network -License: Apache-2.0 -Source0: %{name}-%{version}.tar.gz -Source1001: capi-network-wifi.manifest -BuildRequires: cmake -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(capi-base-common) -BuildRequires: pkgconfig(network) +Name: capi-network-wifi +Summary: Network Wi-Fi library in TIZEN C API +Version: 1.0.55 +Release: 1 +Group: System/Network +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(network) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: model-build-features +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%if "%{?tizen_profile_name}" == "wearable" +BuildRequires: pkgconfig(capi-appfw-application) +%endif %description Network Wi-Fi library in Tizen C API %package devel -Summary: Network Wi-Fi library in Tizen C API (Development) -Group: System/Network -Requires: %{name} = %{version}-%{release} +Summary: Network Wi-Fi library in Tizen C API (Development) +Group: System/Network +Requires: %{name} = %{version}-%{release} %description devel Network Wi-Fi library in Tizen C API (Development) %prep %setup -q -cp %{SOURCE1001} . %build +export CFLAGS+=' -Wno-unused-local-typedefs' MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +cmake -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ + -DLIB_PATH=%{_lib} \ +%if 0%{?model_build_feature_network_dsds} == 1 + -DTIZEN_DUALSIM_ENABLE=1 \ +%endif +%if "%{?tizen_profile_name}" == "wearable" + -DTIZEN_WEARABLE=1 \ +%else +%if "%{?tizen_profile_name}" == "mobile" + -DTIZEN_MOBILE=1 \ +%else +%if "%{?tizen_profile_name}" == "tv" + -DTIZEN_TV=1 \ +%endif +%endif +%endif + . make %{?_smp_mflags} @@ -41,7 +64,7 @@ make %{?_smp_mflags} #License mkdir -p %{buildroot}%{_datadir}/license -cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/capi-network-wifi +cp LICENSE %{buildroot}%{_datadir}/license/capi-network-wifi %post -p /sbin/ldconfig @@ -49,13 +72,12 @@ cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/capi-network-wifi %files -%manifest %{name}.manifest +%manifest capi-network-wifi.manifest %attr(644,-,-) %{_libdir}/libcapi-network-wifi.so.* %{_datadir}/license/capi-network-wifi %{_bindir}/wifi_test %files devel -%manifest %{name}.manifest %{_includedir}/network/*.h %{_libdir}/pkgconfig/*.pc %{_libdir}/libcapi-network-wifi.so diff --git a/src/libnetwork.c b/src/libnetwork.c index 1554ba8..7ff72c5 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -14,10 +14,11 @@ * limitations under the License. */ +#include +#include #include #include -#include -#include + #include "net_wifi_private.h" static __thread bool is_init = false; @@ -255,44 +256,102 @@ static int __libnet_connect_with_wifi_info(net_profile_info_t *ap_info) return WIFI_ERROR_NONE; } +static gboolean __wifi_state_changed_cb(gpointer data) +{ + wifi_ap_h ap_info; + struct _wifi_state_notify *notify = (struct _wifi_state_notify *)data; + + if (notify == NULL) + return FALSE; + + if (notify->ap_info == NULL) { + g_free(notify); + return FALSE; + } + + ap_info = (wifi_ap_h)notify->ap_info; + + _wifi_libnet_add_to_ap_list(ap_info); + + if (wifi_callbacks.connection_state_cb != NULL) + wifi_callbacks.connection_state_cb(notify->state, ap_info, + wifi_callbacks.connection_state_user_data); + + _wifi_libnet_remove_from_ap_list(ap_info); + + g_free(notify); + + return FALSE; +} + static void __libnet_state_changed_cb(char *profile_name, net_profile_info_t *profile_info, wifi_connection_state_e state) { + guint id; + net_profile_info_t *ap_info = NULL; + struct _wifi_state_notify *notify = NULL; + + if (_wifi_is_init() != true) { + WIFI_LOG(WIFI_ERROR, "Application is not registered" + "If multi-threaded, thread integrity be broken."); + return; + } + + if (wifi_callbacks.connection_state_cb == NULL) + return; + if (profile_name == NULL) return; if (profile_info == NULL) { - WIFI_LOG(WIFI_ERROR, "Error!! Profile info not found! : %s\n", profile_name); + SECURE_WIFI_LOG(WIFI_ERROR, "Failed to find: %s", profile_name); return; } - ap_handle_list = g_slist_append(ap_handle_list, (wifi_ap_h)profile_info); + ap_info = g_try_malloc0(sizeof(net_profile_info_t)); + if (ap_info == NULL) { + WIFI_LOG(WIFI_ERROR, "Memory allocation error"); + return; + } - if (wifi_callbacks.connection_state_cb) - wifi_callbacks.connection_state_cb(state, (wifi_ap_h)profile_info, - wifi_callbacks.connection_state_user_data); + memcpy(ap_info, profile_info, sizeof(net_profile_info_t)); - ap_handle_list = g_slist_remove(ap_handle_list, (wifi_ap_h)profile_info); + notify = g_try_new0(struct _wifi_state_notify, 1); + if (notify == NULL) { + g_free(ap_info); + return; + } + + notify->ap_info = ap_info; + notify->state = state; + + id = _wifi_callback_add(__wifi_state_changed_cb, (gpointer)notify); + if (!id) + g_free(notify); } static void __libnet_set_activated_cb(wifi_activated_cb user_cb, void *user_data) { - if (user_cb) { + if (user_cb != NULL) { wifi_callbacks.activated_cb = user_cb; wifi_callbacks.activated_user_data = user_data; } } -static void __libnet_activated_cb(wifi_error_e result) +static gboolean __activated_cb_idle(gpointer data) { - if (wifi_callbacks.activated_cb) + wifi_error_e result = (wifi_error_e)data; + + if (wifi_callbacks.activated_cb != NULL) wifi_callbacks.activated_cb(result, wifi_callbacks.activated_user_data); wifi_callbacks.activated_cb = NULL; wifi_callbacks.activated_user_data = NULL; + + return FALSE; } -static void __libnet_set_deactivated_cb(wifi_disconnected_cb user_cb, void *user_data) +static void __libnet_set_deactivated_cb(wifi_deactivated_cb user_cb, void *user_data) { if (user_cb != NULL) { wifi_callbacks.deactivated_cb = user_cb; @@ -300,13 +359,27 @@ static void __libnet_set_deactivated_cb(wifi_disconnected_cb user_cb, void *user } } -static void __libnet_deactivated_cb(wifi_error_e result) +static gboolean __deactivated_cb_idle(gpointer data) { - if (wifi_callbacks.deactivated_cb) + wifi_error_e result = (wifi_error_e)data; + + if (wifi_callbacks.deactivated_cb != NULL) wifi_callbacks.deactivated_cb(result, wifi_callbacks.deactivated_user_data); wifi_callbacks.deactivated_cb = NULL; wifi_callbacks.deactivated_user_data = NULL; + + return FALSE; +} + +static gboolean __device_state_cb_idle(gpointer data) +{ + wifi_device_state_e state = (wifi_device_state_e)data; + + if (wifi_callbacks.device_state_cb != NULL) + wifi_callbacks.device_state_cb(state, wifi_callbacks.device_state_user_data); + + return FALSE; } static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_requested) @@ -335,7 +408,6 @@ static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_request WIFI_LOG(WIFI_INFO, "Wi-Fi power off"); state = WIFI_DEVICE_STATE_DEACTIVATED; __libnet_clear_profile_list(&profile_iterator); - __libnet_clear_profile_list(&specific_profile_iterator); } else { WIFI_LOG(WIFI_ERROR, "Error Wi-Fi state %d", *wifi_state); error_code = WIFI_ERROR_OPERATION_FAILED; @@ -352,31 +424,82 @@ static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_request state = WIFI_DEVICE_STATE_DEACTIVATED; } - __libnet_activated_cb(error_code); - __libnet_deactivated_cb(error_code); + if (wifi_callbacks.activated_cb != NULL) + _wifi_callback_add(__activated_cb_idle, (gpointer)error_code); - if (wifi_callbacks.device_state_cb) - wifi_callbacks.device_state_cb(state, wifi_callbacks.device_state_user_data); + if (wifi_callbacks.deactivated_cb != NULL) + _wifi_callback_add(__deactivated_cb_idle, (gpointer)error_code); + + if (wifi_callbacks.device_state_cb != NULL) + _wifi_callback_add(__device_state_cb_idle, (gpointer)state); } -static void __libnet_scan_cb(net_event_info_t *event_cb) +static gboolean __scan_request_cb_idle(gpointer data) +{ + wifi_error_e error_code = (wifi_error_e)data; + + if (wifi_callbacks.scan_request_cb != NULL) + wifi_callbacks.scan_request_cb(error_code, wifi_callbacks.scan_request_user_data); + + wifi_callbacks.scan_request_cb = NULL; + wifi_callbacks.scan_request_user_data = NULL; + + return FALSE; +} + +static void __libnet_set_specific_scan_cb(wifi_scan_finished_cb user_cb, void *user_data) +{ + if (user_cb != NULL) { + wifi_callbacks.specific_scan_cb = user_cb; + wifi_callbacks.specific_scan_user_data = user_data; + } +} + +static gboolean __specific_scan_cb_idle(gpointer data) +{ + wifi_error_e error_code = (wifi_error_e)data; + + if (wifi_callbacks.specific_scan_cb != NULL) + wifi_callbacks.specific_scan_cb(error_code, wifi_callbacks.specific_scan_user_data); + + wifi_callbacks.specific_scan_cb = NULL; + wifi_callbacks.specific_scan_user_data = NULL; + + return FALSE; +} + +static gboolean __bgscan_cb_idle(gpointer data) +{ + wifi_error_e error_code = (wifi_error_e)data; + + if (wifi_callbacks.bg_scan_cb != NULL) + wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data); + + return FALSE; +} + +static void __libnet_scan_cb(net_event_info_t *event_cb, bool is_requested) { wifi_error_e error_code = WIFI_ERROR_NONE; + if (_wifi_is_init() != true) { + WIFI_LOG(WIFI_ERROR, "Application is not registered" + "If multi-threaded, thread integrity be broken."); + return; + } + if (event_cb->Error != NET_ERR_NONE) { - WIFI_LOG(WIFI_ERROR, "Scan failed!, Error [%d]\n", event_cb->Error); + WIFI_LOG(WIFI_ERROR, "Scan failed[%d]", event_cb->Error); error_code = WIFI_ERROR_OPERATION_FAILED; } - if (wifi_callbacks.scan_request_cb) { - wifi_callbacks.scan_request_cb(error_code, wifi_callbacks.scan_request_user_data); - wifi_callbacks.scan_request_cb = NULL; - wifi_callbacks.scan_request_user_data = NULL; + if (wifi_callbacks.scan_request_cb != NULL) { + _wifi_callback_add(__scan_request_cb_idle, (gpointer)error_code); return; } if (wifi_callbacks.bg_scan_cb != NULL) - wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data); + _wifi_callback_add(__bgscan_cb_idle, (gpointer)error_code); } static void __libnet_specific_scan_cb(net_event_info_t *event_cb) @@ -393,45 +516,74 @@ static void __libnet_specific_scan_cb(net_event_info_t *event_cb) __libnet_update_specific_profile_iterator(ap_list); } - if (wifi_callbacks.specific_scan_cb) { - wifi_callbacks.specific_scan_cb(error_code, wifi_callbacks.specific_scan_user_data); - wifi_callbacks.specific_scan_cb = NULL; - wifi_callbacks.specific_scan_user_data = NULL; - } + if (wifi_callbacks.specific_scan_cb != NULL) + _wifi_callback_add(__specific_scan_cb_idle, (gpointer)error_code); } static void __libnet_set_connected_cb(wifi_connected_cb user_cb, void *user_data) { - if (user_cb) { + if (user_cb != NULL) { wifi_callbacks.connected_cb = user_cb; wifi_callbacks.connected_user_data = user_data; } } -static void __libnet_connected_cb(wifi_error_e result) +static gboolean __connected_cb_idle(gpointer data) { - if (wifi_callbacks.connected_cb) + wifi_error_e result = (wifi_error_e)data; + + if (wifi_callbacks.connected_cb != NULL) wifi_callbacks.connected_cb(result, wifi_callbacks.connected_user_data); wifi_callbacks.connected_cb = NULL; wifi_callbacks.connected_user_data = NULL; + + return FALSE; +} + +static void __libnet_connected_cb(wifi_error_e result) +{ + if (_wifi_is_init() != true) { + WIFI_LOG(WIFI_ERROR, "Application is not registered" + "If multi-threaded, thread integrity be broken."); + return; + } + + if (wifi_callbacks.connected_cb != NULL) + _wifi_callback_add(__connected_cb_idle, (gpointer)result); } static void __libnet_set_disconnected_cb(wifi_disconnected_cb user_cb, void *user_data) { - if (user_cb) { + if (user_cb != NULL) { wifi_callbacks.disconnected_cb = user_cb; wifi_callbacks.disconnected_user_data = user_data; } } -static void __libnet_disconnected_cb(wifi_error_e result) +static gboolean __disconnected_cb_idle(gpointer data) { - if (wifi_callbacks.disconnected_cb) + wifi_error_e result = (wifi_error_e)data; + + if (wifi_callbacks.disconnected_cb != NULL) wifi_callbacks.disconnected_cb(result, wifi_callbacks.disconnected_user_data); wifi_callbacks.disconnected_cb = NULL; wifi_callbacks.disconnected_user_data = NULL; + + return FALSE; +} + +static void __libnet_disconnected_cb(wifi_error_e result) +{ + if (_wifi_is_init() != true) { + WIFI_LOG(WIFI_ERROR, "Application is not registered" + "If multi-threaded, thread integrity be broken."); + return; + } + + if (wifi_callbacks.disconnected_cb != NULL) + _wifi_callback_add(__disconnected_cb_idle, (gpointer)result); } static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) @@ -440,6 +592,8 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) net_profile_info_t *prof_info_p = NULL; net_profile_info_t prof_info; wifi_error_e result = WIFI_ERROR_NONE; + int i = 0; + bool is_profile_exists = false; switch (event_cb->Event) { case NET_EVENT_OPEN_RSP: @@ -451,8 +605,8 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) return; result = __libnet_convert_to_ap_error_type(event_cb->Error); - WIFI_LOG(WIFI_INFO, "Got Open RSP/IND : %s\n", - __libnet_convert_ap_error_type_to_string(result)); + WIFI_LOG(WIFI_INFO, "Connection open error %s", + __libnet_convert_ap_error_type_to_string(result)); if (is_requested) __libnet_connected_cb(result); @@ -487,8 +641,8 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) return; result = __libnet_convert_to_ap_error_type(event_cb->Error); - WIFI_LOG(WIFI_INFO, "Got Close RSP/IND : %s\n", - __libnet_convert_ap_error_type_to_string(result)); + WIFI_LOG(WIFI_ERROR, "Connection close error %s", + __libnet_convert_ap_error_type_to_string(result)); if (is_requested) __libnet_disconnected_cb(result); @@ -517,21 +671,34 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data) net_state_type_t *profile_state = (net_state_type_t *)event_cb->Data; wifi_connection_state_e ap_state = _wifi_convert_to_ap_state(*profile_state); - WIFI_LOG(WIFI_INFO, - "Profile State : %s, profile name : %s\n", - __libnet_convert_ap_state_to_string(ap_state), - event_cb->ProfileName); + WIFI_LOG(WIFI_INFO, "state: %s", __libnet_convert_ap_state_to_string(ap_state)); + SECURE_WIFI_LOG(WIFI_INFO, "profile name: %s", event_cb->ProfileName); if (net_get_profile_info(event_cb->ProfileName, &prof_info) == NET_ERR_NONE) __libnet_state_changed_cb(event_cb->ProfileName, &prof_info, ap_state); - else + else if (ap_state == WIFI_CONNECTION_STATE_DISCONNECTED) { + for (i = 0; i < profile_iterator.count; i++) { + if (!g_strcmp0(event_cb->ProfileName, + profile_iterator.profiles[i].ProfileName)) { + is_profile_exists = true; + break; + } + } + + if (is_profile_exists == true) { + profile_iterator.profiles[i].ProfileState = *profile_state; + __libnet_state_changed_cb(event_cb->ProfileName, + &profile_iterator.profiles[i], ap_state); + } else + __libnet_state_changed_cb(event_cb->ProfileName, + NULL, ap_state); + } else __libnet_state_changed_cb(event_cb->ProfileName, NULL, ap_state); break; case NET_EVENT_WIFI_SCAN_RSP: case NET_EVENT_WIFI_SCAN_IND: - WIFI_LOG(WIFI_INFO, "Got Wi-Fi scan IND\n"); - __libnet_scan_cb(event_cb); + __libnet_scan_cb(event_cb, is_requested); break; case NET_EVENT_SPECIFIC_SCAN_RSP: WIFI_LOG(WIFI_INFO, "Got Wi-Fi specific scan RSP\n"); @@ -570,7 +737,6 @@ bool _wifi_libnet_deinit(void) return false; __libnet_clear_profile_list(&profile_iterator); - __libnet_clear_profile_list(&specific_profile_iterator); g_slist_free_full(ap_handle_list, g_free); ap_handle_list = NULL; memset(&wifi_callbacks, 0, sizeof(struct _wifi_cb_s)); @@ -585,7 +751,7 @@ int _wifi_activate(wifi_activated_cb callback, gboolean wifi_picker_test, { int rv = NET_ERR_NONE; - rv = net_wifi_power_on(); + rv = net_wifi_power_on(wifi_picker_test); if (rv == NET_ERR_NONE) { __libnet_set_activated_cb(callback, user_data); return WIFI_ERROR_NONE; @@ -722,6 +888,12 @@ int _wifi_libnet_get_wifi_state(wifi_connection_state_e* connection_state) case WIFI_ON: *connection_state = WIFI_CONNECTION_STATE_DISCONNECTED; break; + case WIFI_ASSOCIATION: + *connection_state = WIFI_CONNECTION_STATE_ASSOCIATION; + break; + case WIFI_CONFIGURATION: + *connection_state = WIFI_CONNECTION_STATE_CONFIGURATION; + break; case WIFI_CONNECTED: *connection_state = WIFI_CONNECTION_STATE_CONNECTED; break; @@ -782,12 +954,11 @@ int _wifi_libnet_scan_specific_ap(const char *essid, wifi_scan_finished_cb callback, void *user_data) { int rv; - rv = net_specific_scan_wifi(essid); + rv = net_specific_scan_wifi(essid); - if (rv == NET_ERR_NONE) { + if (rv == NET_ERR_NONE) { g_strlcpy(specific_profile_essid, essid, NET_WLAN_ESSID_LEN+1); - wifi_callbacks.specific_scan_cb = callback; - wifi_callbacks.specific_scan_user_data = user_data; + __libnet_set_specific_scan_cb(callback, user_data); return WIFI_ERROR_NONE; } else if (rv == NET_ERR_ACCESS_DENIED) { WIFI_LOG(WIFI_ERROR, "Access denied"); @@ -908,7 +1079,8 @@ int _wifi_libnet_open_profile(wifi_ap_h ap_h, wifi_connected_cb callback, void * rv = net_open_connection_with_profile(ap_info->ProfileName); else if (valid_profile == true && ap_info->ProfileInfo.Wlan.is_hidden != TRUE && - ap_info->ProfileInfo.Wlan.security_info.sec_mode == WLAN_SEC_MODE_NONE) + ap_info->ProfileInfo.Wlan.security_info.sec_mode == + WLAN_SEC_MODE_NONE) rv = net_open_connection_with_profile(ap_info->ProfileName); else rv = __libnet_connect_with_wifi_info(ap_info); @@ -1089,6 +1261,54 @@ int _wifi_update_ap_info(net_profile_info_t *ap_info) return WIFI_ERROR_NONE; } +static void __wifi_idle_destroy_cb(gpointer data) +{ + if (!data) + return; + + managed_idler_list = g_slist_remove(managed_idler_list, data); + g_free(data); +} + +static gboolean __wifi_idle_cb(gpointer user_data) +{ + struct managed_idle_data *data = (struct managed_idle_data *)user_data; + + if (!data) + return FALSE; + + return data->func(data->user_data); +} + +guint _wifi_callback_add(GSourceFunc func, gpointer user_data) +{ + guint id; + struct managed_idle_data *data; + + if (!func) + return 0; + + data = g_try_new0(struct managed_idle_data, 1); + if (!data) + return 0; + + data->func = func; + data->user_data = user_data; + + id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __wifi_idle_cb, data, + __wifi_idle_destroy_cb); + if (!id) { + g_free(data); + return id; + } + + data->id = id; + + managed_idler_list = g_slist_append(managed_idler_list, data); + + return id; +} + void _wifi_callback_cleanup(void) { GSList *cur = managed_idler_list; diff --git a/src/net_wifi.c b/src/net_wifi.c index 181a27f..4a9d8ab 100755 --- a/src/net_wifi.c +++ b/src/net_wifi.c @@ -14,26 +14,53 @@ * limitations under the License. */ +#include #include #include -#include #include +#include +#include +#include #include "net_wifi_private.h" -static wifi_rssi_level_changed_cb rssi_level_changed_cb = NULL; -static void *rssi_level_changed_user_data = NULL; +#define WIFI_MAC_ADD_LENGTH 17 +#define WIFI_MAC_ADD_PATH "/sys/class/net/wlan0/address" + +static __thread wifi_rssi_level_changed_cb rssi_level_changed_cb = NULL; +static __thread void *rssi_level_changed_user_data = NULL; + +static gboolean __rssi_level_changed_cb_idle(gpointer data) +{ + int rssi_level = 0; + + if (vconf_get_int(VCONFKEY_WIFI_STRENGTH, &rssi_level) != 0) + return FALSE; + + if (rssi_level_changed_cb != NULL) + rssi_level_changed_cb(rssi_level, rssi_level_changed_user_data); + + return FALSE; +} static void __rssi_level_changed_cb(keynode_t *node, void *user_data) { - int rssi_level = vconf_keynode_get_int(node); - rssi_level_changed_cb(rssi_level, rssi_level_changed_user_data); + if (_wifi_is_init() != true) { + WIFI_LOG(WIFI_ERROR, "Application is not registered" + "If multi-threaded, thread integrity be broken."); + return; + } + + if (rssi_level_changed_cb != NULL) + _wifi_callback_add(__rssi_level_changed_cb_idle, NULL); } EXPORT_API int wifi_initialize(void) { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == true) { WIFI_LOG(WIFI_ERROR, "Already initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -56,6 +83,8 @@ EXPORT_API int wifi_initialize(void) EXPORT_API int wifi_deinitialize(void) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -78,6 +107,8 @@ EXPORT_API int wifi_activate(wifi_activated_cb callback, void* user_data) { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -95,6 +126,8 @@ EXPORT_API int wifi_activate_with_wifi_picker_tested( { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -111,6 +144,8 @@ EXPORT_API int wifi_deactivate(wifi_deactivated_cb callback, void* user_data) { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -128,6 +163,8 @@ EXPORT_API int wifi_is_activated(bool* activated) int rv; wifi_device_state_e device_state; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (activated == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -146,23 +183,60 @@ EXPORT_API int wifi_is_activated(bool* activated) EXPORT_API int wifi_get_mac_address(char** mac_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + + FILE *fp = NULL; + char buf[WIFI_MAC_ADD_LENGTH+ 1]; + if (mac_address == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; } - *mac_address = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS); +#if defined TIZEN_TV + if (0 == access(WIFI_MAC_ADD_PATH, F_OK)) + fp = fopen(WIFI_MAC_ADD_PATH, "r"); + + if (fp == NULL) { + WIFI_LOG(WIFI_ERROR, "Failed to open file" + " %s\n", WIFI_MAC_ADD_PATH); + return WIFI_ERROR_OPERATION_FAILED; + } + + if (fgets(buf, sizeof(buf), fp) == NULL) { + WIFI_LOG(WIFI_ERROR, "Failed to get MAC" + " info from %s\n", WIFI_MAC_ADD_PATH); + fclose(fp); + return WIFI_ERROR_OPERATION_FAILED; + } + + WIFI_LOG(WIFI_INFO, "%s : %s\n", WIFI_MAC_ADD_PATH, buf); + *mac_address = (char *)g_try_malloc0(WIFI_MAC_ADD_LENGTH + 1); if (*mac_address == NULL) { - WIFI_LOG(WIFI_ERROR, "vconf_get_str Failed"); + WIFI_LOG(WIFI_ERROR, "malloc() failed"); + fclose(fp); + return WIFI_ERROR_OUT_OF_MEMORY; + } + g_strlcpy(*mac_address, buf, WIFI_MAC_ADD_LENGTH + 1); + fclose(fp); +#else + *mac_address = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS); + + if(*mac_address == NULL) { + WIFI_LOG(WIFI_ERROR, "Failed to get vconf" + " from %s", VCONFKEY_WIFI_BSSID_ADDRESS); return WIFI_ERROR_OPERATION_FAILED; } +#endif return WIFI_ERROR_NONE; } EXPORT_API int wifi_get_network_interface_name(char** name) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (name == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -175,6 +249,8 @@ EXPORT_API int wifi_scan(wifi_scan_finished_cb callback, void* user_data) { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -196,6 +272,8 @@ EXPORT_API int wifi_scan_specific_ap(const char* essid, wifi_scan_finished_cb ca { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (essid == NULL || callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -214,10 +292,14 @@ EXPORT_API int wifi_scan_specific_ap(const char* essid, wifi_scan_finished_cb ca return rv; } + + EXPORT_API int wifi_get_connected_ap(wifi_ap_h* ap) { int rv; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (ap == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -231,6 +313,8 @@ EXPORT_API int wifi_get_connected_ap(wifi_ap_h* ap) EXPORT_API int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -241,6 +325,8 @@ EXPORT_API int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data EXPORT_API int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -251,6 +337,8 @@ EXPORT_API int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* EXPORT_API int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -266,13 +354,15 @@ EXPORT_API int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void* user EXPORT_API int wifi_disconnect(wifi_ap_h ap, wifi_disconnected_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; } if (_wifi_libnet_check_ap_validity(ap) == false) { - WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n"); + WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; } @@ -281,6 +371,8 @@ EXPORT_API int wifi_disconnect(wifi_ap_h ap, wifi_disconnected_cb callback, void EXPORT_API int wifi_connect_by_wps_pbc(wifi_ap_h ap, wifi_connected_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -296,6 +388,8 @@ EXPORT_API int wifi_connect_by_wps_pbc(wifi_ap_h ap, wifi_connected_cb callback, EXPORT_API int wifi_connect_by_wps_pin(wifi_ap_h ap, const char *pin, wifi_connected_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -316,6 +410,8 @@ EXPORT_API int wifi_connect_by_wps_pin(wifi_ap_h ap, const char *pin, wifi_conne EXPORT_API int wifi_forget_ap(wifi_ap_h ap) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_is_init() == false) { WIFI_LOG(WIFI_ERROR, "Not initialized"); return WIFI_ERROR_INVALID_OPERATION; @@ -331,6 +427,8 @@ EXPORT_API int wifi_forget_ap(wifi_ap_h ap) EXPORT_API int wifi_get_connection_state(wifi_connection_state_e* connection_state) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (connection_state == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -341,6 +439,8 @@ EXPORT_API int wifi_get_connection_state(wifi_connection_state_e* connection_sta EXPORT_API int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -356,11 +456,15 @@ EXPORT_API int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb cal EXPORT_API int wifi_unset_device_state_changed_cb(void) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + return _wifi_unset_power_on_off_cb(); } EXPORT_API int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -376,11 +480,15 @@ EXPORT_API int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* EXPORT_API int wifi_unset_background_scan_cb(void) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + return _wifi_unset_background_scan_cb(); } EXPORT_API int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -396,11 +504,15 @@ EXPORT_API int wifi_set_connection_state_changed_cb(wifi_connection_state_change EXPORT_API int wifi_unset_connection_state_changed_cb(void) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + return _wifi_unset_connection_state_cb(); } EXPORT_API int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void* user_data) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (callback == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -419,6 +531,8 @@ EXPORT_API int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callbac EXPORT_API int wifi_unset_rssi_level_changed_cb(void) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (rssi_level_changed_cb != NULL) vconf_ignore_key_changed(VCONFKEY_WIFI_STRENGTH, __rssi_level_changed_cb); else diff --git a/src/net_wifi_ap.c b/src/net_wifi_ap.c index 0386e00..49a83ca 100755 --- a/src/net_wifi_ap.c +++ b/src/net_wifi_ap.c @@ -14,22 +14,37 @@ * limitations under the License. */ +#include #include #include +#include #include -#include +#include + #include "net_wifi_private.h" -static char* __ap_convert_ip_to_string(net_addr_t *ip_addr) +#define MAX_PREFIX_LENGTH 6 + +static char *__ap_convert_ip_to_string(net_addr_t *ip_addr, wifi_address_family_e address_family) { - unsigned char *ipaddr = (unsigned char *)&ip_addr->Data.Ipv4.s_addr; + unsigned char *ipaddr = NULL; + char *ipstr = NULL; - char *ipstr = g_try_malloc0(16); - if (ipstr == NULL) - return NULL; + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) { + ipaddr = (unsigned char *)&ip_addr->Data.Ipv4.s_addr; + ipstr = g_try_malloc0(INET_ADDRSTRLEN); + if (ipstr == NULL) + return NULL; - g_snprintf(ipstr, 16, "%d.%d.%d.%d", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); + inet_ntop(AF_INET, ipaddr, ipstr, INET_ADDRSTRLEN); + } else { + ipaddr = (unsigned char *)&ip_addr->Data.Ipv6; + ipstr = g_try_malloc0(INET6_ADDRSTRLEN); + if (ipstr == NULL) + return NULL; + inet_ntop(AF_INET6, ipaddr, ipstr, INET6_ADDRSTRLEN); + } return ipstr; } @@ -124,7 +139,7 @@ static bool _wifi_set_profile_name_to_ap(net_profile_info_t *ap_info) profile_name = __wifi_create_profile_name( ap_info->ProfileInfo.Wlan.is_hidden == TRUE ? - NULL : ap_info->ProfileInfo.Wlan.essid, + NULL : ap_info->ProfileInfo.Wlan.essid, ap_info->ProfileInfo.Wlan.wlan_mode, ap_info->ProfileInfo.Wlan.security_info.sec_mode); if (profile_name == NULL) { @@ -173,6 +188,8 @@ wifi_connection_state_e _wifi_convert_to_ap_state(net_state_type_t state) /* Wi-Fi AP ******************************************************************/ EXPORT_API int wifi_ap_create(const char* essid, wifi_ap_h* ap) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (essid == NULL || ap == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -192,6 +209,8 @@ EXPORT_API int wifi_ap_create(const char* essid, wifi_ap_h* ap) EXPORT_API int wifi_ap_hidden_create(const char* essid, wifi_ap_h* ap) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (essid == NULL || ap == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -212,6 +231,8 @@ EXPORT_API int wifi_ap_hidden_create(const char* essid, wifi_ap_h* ap) EXPORT_API int wifi_ap_destroy(wifi_ap_h ap) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -224,6 +245,8 @@ EXPORT_API int wifi_ap_destroy(wifi_ap_h ap) EXPORT_API int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(origin) == false || cloned_ap == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -243,6 +266,8 @@ EXPORT_API int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin) EXPORT_API int wifi_ap_refresh(wifi_ap_h ap) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + net_profile_info_t ap_info_local; net_profile_info_t *ap_info = ap; @@ -269,6 +294,8 @@ EXPORT_API int wifi_ap_refresh(wifi_ap_h ap) /* Wi-Fi network information *************************************************/ EXPORT_API int wifi_ap_get_essid(wifi_ap_h ap, char** essid) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || essid == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -284,6 +311,8 @@ EXPORT_API int wifi_ap_get_essid(wifi_ap_h ap, char** essid) EXPORT_API int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || bssid == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -299,6 +328,8 @@ EXPORT_API int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid) EXPORT_API int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || rssi == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -312,6 +343,8 @@ EXPORT_API int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi) EXPORT_API int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || frequency == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -325,6 +358,8 @@ EXPORT_API int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency) EXPORT_API int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || max_speed == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -338,6 +373,8 @@ EXPORT_API int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed) EXPORT_API int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || favorite == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -355,6 +392,8 @@ EXPORT_API int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite) EXPORT_API int wifi_ap_is_passpoint(wifi_ap_h ap, bool* passpoint) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || passpoint == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -372,6 +411,8 @@ EXPORT_API int wifi_ap_is_passpoint(wifi_ap_h ap, bool* passpoint) EXPORT_API int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || state == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -389,6 +430,9 @@ EXPORT_API int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_ EXPORT_API int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + net_ip_config_type_t profileType ; + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -397,31 +441,53 @@ EXPORT_API int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e ad return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; + net_profile_info_t *profile_info = ap; + + if (address_family == WIFI_ADDRESS_FAMILY_IPV4){ + profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType ; + } else { + profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ; } - net_profile_info_t *profile_info = ap; + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) { + switch (profileType) { + case NET_IP_CONFIG_TYPE_STATIC: + *type = WIFI_IP_CONFIG_TYPE_STATIC; + break; - switch (profile_info->ProfileInfo.Wlan.net_info.IpConfigType) { - case NET_IP_CONFIG_TYPE_STATIC: - *type = WIFI_IP_CONFIG_TYPE_STATIC; - break; - case NET_IP_CONFIG_TYPE_DYNAMIC: - *type = WIFI_IP_CONFIG_TYPE_DYNAMIC; - break; - case NET_IP_CONFIG_TYPE_AUTO_IP: - *type = WIFI_IP_CONFIG_TYPE_AUTO; - break; - case NET_IP_CONFIG_TYPE_FIXED: - *type = WIFI_IP_CONFIG_TYPE_FIXED; - break; - case NET_IP_CONFIG_TYPE_OFF: - *type = WIFI_IP_CONFIG_TYPE_NONE; - break; - default: - return WIFI_ERROR_OPERATION_FAILED; + case NET_IP_CONFIG_TYPE_DYNAMIC: + *type = WIFI_IP_CONFIG_TYPE_DYNAMIC; + break; + + case NET_IP_CONFIG_TYPE_AUTO_IP: + *type = WIFI_IP_CONFIG_TYPE_AUTO; + break; + + case NET_IP_CONFIG_TYPE_FIXED: + *type = WIFI_IP_CONFIG_TYPE_FIXED; + break; + + case NET_IP_CONFIG_TYPE_OFF: + *type = WIFI_IP_CONFIG_TYPE_NONE; + break; + + default: + return WIFI_ERROR_OPERATION_FAILED; + } + } else { + switch (profileType) { + case NET_IP_CONFIG_TYPE_STATIC: + *type = WIFI_IP_CONFIG_TYPE_STATIC; + break; + case NET_IP_CONFIG_TYPE_AUTO_IP: + *type = WIFI_IP_CONFIG_TYPE_AUTO; + break; + case NET_IP_CONFIG_TYPE_OFF: + *type = WIFI_IP_CONFIG_TYPE_NONE; + break; + default: + return WIFI_ERROR_OPERATION_FAILED; + } } return WIFI_ERROR_NONE; @@ -429,6 +495,9 @@ EXPORT_API int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e ad EXPORT_API int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + net_ip_config_type_t *profileType = NULL; + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6)) { @@ -436,31 +505,59 @@ EXPORT_API int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e ad return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; + net_profile_info_t *profile_info = ap; + + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) { + profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType ; + } else { + profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ; } - net_profile_info_t *profile_info = ap; + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) { + switch (type) { + case WIFI_IP_CONFIG_TYPE_STATIC: + *profileType = NET_IP_CONFIG_TYPE_STATIC; + profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0; + profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0; + profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0 ; + break; - switch (type) { - case WIFI_IP_CONFIG_TYPE_STATIC: - profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_STATIC; - break; - case WIFI_IP_CONFIG_TYPE_DYNAMIC: - profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_DYNAMIC; - break; - case WIFI_IP_CONFIG_TYPE_AUTO: - profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_AUTO_IP; - break; - case WIFI_IP_CONFIG_TYPE_FIXED: - profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_FIXED; - break; - case WIFI_IP_CONFIG_TYPE_NONE: - profile_info->ProfileInfo.Wlan.net_info.IpConfigType = NET_IP_CONFIG_TYPE_OFF; - break; - default: - return WIFI_ERROR_INVALID_PARAMETER; + case WIFI_IP_CONFIG_TYPE_DYNAMIC: + *profileType = NET_IP_CONFIG_TYPE_DYNAMIC; + break; + + case WIFI_IP_CONFIG_TYPE_AUTO: + *profileType = NET_IP_CONFIG_TYPE_AUTO_IP; + break; + + case WIFI_IP_CONFIG_TYPE_FIXED: + *profileType = NET_IP_CONFIG_TYPE_FIXED; + break; + + case WIFI_IP_CONFIG_TYPE_NONE: + *profileType = NET_IP_CONFIG_TYPE_OFF; + break; + + default: + return WIFI_ERROR_INVALID_PARAMETER; + } + } else { + switch (type) { + case WIFI_IP_CONFIG_TYPE_STATIC: + *profileType = NET_IP_CONFIG_TYPE_STATIC; + inet_pton(AF_INET6, "::", &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6); + profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = 0 ; + inet_pton(AF_INET6, "::", &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6); + break; + case WIFI_IP_CONFIG_TYPE_AUTO: + *profileType = NET_IP_CONFIG_TYPE_AUTO_IP; + break; + case WIFI_IP_CONFIG_TYPE_NONE: + *profileType = NET_IP_CONFIG_TYPE_OFF; + break; + default: + return WIFI_ERROR_INVALID_PARAMETER; + } } if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false) @@ -471,6 +568,8 @@ EXPORT_API int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e ad EXPORT_API int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, char** ip_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -479,13 +578,16 @@ EXPORT_API int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e addres return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - *ip_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.IpAddr); + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) + *ip_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.IpAddr, + address_family); + else + *ip_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.IpAddr6, + address_family); + if (*ip_address == NULL) return WIFI_ERROR_OUT_OF_MEMORY; @@ -494,6 +596,8 @@ EXPORT_API int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e addres EXPORT_API int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* ip_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6)) { @@ -501,17 +605,22 @@ EXPORT_API int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e addres return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - if (ip_address == NULL) - profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0; - else if (inet_aton(ip_address, &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0) - return WIFI_ERROR_INVALID_PARAMETER; + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) { + if (ip_address == NULL) + profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4.s_addr = 0; + else if (inet_aton(ip_address, + &(profile_info->ProfileInfo.Wlan.net_info.IpAddr.Data.Ipv4)) == 0) + return WIFI_ERROR_INVALID_PARAMETER; + } else { + if (ip_address == NULL) + inet_pton(AF_INET6, "::", + &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6); + else if (inet_pton(AF_INET6, ip_address, + &profile_info->ProfileInfo.Wlan.net_info.IpAddr6.Data.Ipv6) == 0) + return WIFI_ERROR_INVALID_PARAMETER; + } if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false) return WIFI_ERROR_NONE; @@ -521,6 +630,9 @@ EXPORT_API int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e addres EXPORT_API int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, char** subnet_mask) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + char* prefixlen; + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -529,13 +641,21 @@ EXPORT_API int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e addre return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; + net_profile_info_t *profile_info = ap; + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) + *subnet_mask = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.SubnetMask, + address_family); + else { + prefixlen = g_try_malloc0(MAX_PREFIX_LENGTH); + if (prefixlen != NULL) { + snprintf(prefixlen, MAX_PREFIX_LENGTH, "%d", + profile_info->ProfileInfo.Wlan.net_info.PrefixLen6); + *subnet_mask = prefixlen; + } else + *subnet_mask = NULL; } - net_profile_info_t *profile_info = ap; - *subnet_mask = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.SubnetMask); if (*subnet_mask == NULL) return WIFI_ERROR_OUT_OF_MEMORY; @@ -544,6 +664,8 @@ EXPORT_API int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e addre EXPORT_API int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, const char* subnet_mask) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6)) { @@ -551,17 +673,30 @@ EXPORT_API int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e addre return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - if (subnet_mask == NULL) - profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0; - else if (inet_aton(subnet_mask, &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) == 0) - return WIFI_ERROR_INVALID_PARAMETER; + /* Based on the family of address provided subnet mask should be set. + * For IPv6 address subnet mask is prefix length, an integer, while for + * Ipv6 address subnet mask is a ipv6 address. + */ + if (address_family == WIFI_ADDRESS_FAMILY_IPV6){ + if (subnet_mask == NULL) + profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = 0; + else { + /* subnet mask provided as input parameter is a string + * while for IPv6 address subnet mask in prefix length + * which should be in integer form */ + profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = + atoi(subnet_mask) ; + } + } else { + if (subnet_mask == NULL) + profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4.s_addr = 0; + else if (inet_pton(AF_INET, subnet_mask, + &(profile_info->ProfileInfo.Wlan.net_info.SubnetMask.Data.Ipv4)) < 1) + return WIFI_ERROR_INVALID_PARAMETER; + } + if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false) return WIFI_ERROR_NONE; @@ -571,6 +706,8 @@ EXPORT_API int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e addre EXPORT_API int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, char** gateway_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -579,13 +716,21 @@ EXPORT_API int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e a return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - *gateway_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.GatewayAddr); + + /* Based on the family of address provided, gateway should be set. + * For IPv6 address gateway is of form GatewayAddr6 but for IPv4 + * gateway is of form GatewayAddr. + */ + if (address_family == WIFI_ADDRESS_FAMILY_IPV4) + *gateway_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr, + address_family); + else + *gateway_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6, + address_family); + if (*gateway_address == NULL) return WIFI_ERROR_OUT_OF_MEMORY; @@ -594,6 +739,8 @@ EXPORT_API int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e a EXPORT_API int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* gateway_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6)) { @@ -601,18 +748,22 @@ EXPORT_API int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e a return WIFI_ERROR_INVALID_PARAMETER; } + net_profile_info_t *profile_info = ap; if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; + if (gateway_address == NULL) + inet_pton(AF_INET6, "::", + &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6); + else if (inet_pton(AF_INET6, gateway_address, + &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr6.Data.Ipv6) < 1) + return WIFI_ERROR_INVALID_PARAMETER; + } else { + if (gateway_address == NULL) + profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0; + else if (inet_pton(AF_INET, gateway_address, + &profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4) < 1) + return WIFI_ERROR_INVALID_PARAMETER; } - net_profile_info_t *profile_info = ap; - - if (gateway_address == NULL) - profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4.s_addr = 0; - else if (inet_aton(gateway_address, &(profile_info->ProfileInfo.Wlan.net_info.GatewayAddr.Data.Ipv4)) == 0) - return WIFI_ERROR_INVALID_PARAMETER; - if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false) return WIFI_ERROR_NONE; @@ -621,6 +772,8 @@ EXPORT_API int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e a EXPORT_API int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, char** proxy_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -629,11 +782,6 @@ EXPORT_API int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e add return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; *proxy_address = g_strdup(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr); if (*proxy_address == NULL) @@ -644,6 +792,8 @@ EXPORT_API int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e add EXPORT_API int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* proxy_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6)) { @@ -651,11 +801,6 @@ EXPORT_API int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e add return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; if (proxy_address == NULL) @@ -672,6 +817,8 @@ EXPORT_API int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e add EXPORT_API int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -701,6 +848,8 @@ EXPORT_API int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type) EXPORT_API int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -739,6 +888,8 @@ EXPORT_API int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type EXPORT_API int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, char** dns_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -749,14 +900,17 @@ EXPORT_API int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_fam return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - *dns_address = __ap_convert_ip_to_string(&profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1]); + if(address_family == WIFI_ADDRESS_FAMILY_IPV4) + *dns_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1], + address_family); + else + *dns_address = __ap_convert_ip_to_string( + &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1], + address_family); + if (*dns_address == NULL) return WIFI_ERROR_OUT_OF_MEMORY; @@ -765,6 +919,8 @@ EXPORT_API int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_fam EXPORT_API int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, const char* dns_address) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (address_family != WIFI_ADDRESS_FAMILY_IPV4 && address_family != WIFI_ADDRESS_FAMILY_IPV6) || @@ -774,20 +930,32 @@ EXPORT_API int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_fam return WIFI_ERROR_INVALID_PARAMETER; } - if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { - WIFI_LOG(WIFI_ERROR, "Not supported yet"); - return WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED; - } - net_profile_info_t *profile_info = ap; - if (dns_address == NULL) - profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4.s_addr = 0; - else if (inet_aton(dns_address, &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4)) == 0) - return WIFI_ERROR_INVALID_PARAMETER; + if (address_family == WIFI_ADDRESS_FAMILY_IPV6) { + profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Type = + NET_ADDR_IPV6; + if (dns_address == NULL) + inet_pton(AF_INET6, "::", + &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Data.Ipv6); + else if (inet_pton(AF_INET6, dns_address, + &profile_info->ProfileInfo.Wlan.net_info.DnsAddr6[order-1].Data.Ipv6) < 1) + return WIFI_ERROR_INVALID_PARAMETER; + + if (profile_info->ProfileInfo.Wlan.net_info.DnsCount6 < order) + profile_info->ProfileInfo.Wlan.net_info.DnsCount6 = order; + } else { + profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Type = + NET_ADDR_IPV4; + if (dns_address == NULL) + profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4.s_addr = 0; + else if (inet_pton(AF_INET, dns_address, + &(profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1].Data.Ipv4)) < 1) + return WIFI_ERROR_INVALID_PARAMETER; - if (profile_info->ProfileInfo.Wlan.net_info.DnsCount < order) - profile_info->ProfileInfo.Wlan.net_info.DnsCount = order; + if (profile_info->ProfileInfo.Wlan.net_info.DnsCount < order) + profile_info->ProfileInfo.Wlan.net_info.DnsCount = order; + } if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false) return WIFI_ERROR_NONE; @@ -798,6 +966,8 @@ EXPORT_API int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_fam /* Wi-Fi security information ************************************************/ EXPORT_API int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -830,6 +1000,8 @@ EXPORT_API int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* typ EXPORT_API int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -864,6 +1036,8 @@ EXPORT_API int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type EXPORT_API int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -896,6 +1070,8 @@ EXPORT_API int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* EXPORT_API int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -928,6 +1104,8 @@ EXPORT_API int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e EXPORT_API int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || required == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -942,10 +1120,10 @@ EXPORT_API int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required) switch (profile_info->ProfileInfo.Wlan.security_info.sec_mode) { case WLAN_SEC_MODE_NONE: - case WLAN_SEC_MODE_IEEE8021X: *required = false; break; case WLAN_SEC_MODE_WEP: + case WLAN_SEC_MODE_IEEE8021X: case WLAN_SEC_MODE_WPA_PSK: case WLAN_SEC_MODE_WPA2_PSK: *required = true; @@ -959,6 +1137,8 @@ EXPORT_API int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required) EXPORT_API int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || passphrase == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -987,6 +1167,8 @@ EXPORT_API int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase) EXPORT_API int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || supported == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1005,6 +1187,8 @@ EXPORT_API int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported) /* Wi-Fi EAP *****************************************************************/ EXPORT_API int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* password) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || (user_name == NULL && password == NULL)) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1027,6 +1211,8 @@ EXPORT_API int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, c EXPORT_API int wifi_ap_get_eap_passphrase(wifi_ap_h ap, char** user_name, bool* is_password_set) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false ||user_name == NULL || is_password_set == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1053,6 +1239,8 @@ EXPORT_API int wifi_ap_get_eap_ca_cert_file(wifi_ap_h ap, char** file) { net_profile_info_t *profile_info = NULL; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1073,6 +1261,8 @@ EXPORT_API int wifi_ap_set_eap_ca_cert_file(wifi_ap_h ap, const char* file) { net_profile_info_t *profile_info = NULL; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1092,6 +1282,8 @@ EXPORT_API int wifi_ap_get_eap_client_cert_file(wifi_ap_h ap, char** file) { net_profile_info_t *profile_info = NULL; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1112,6 +1304,8 @@ EXPORT_API int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file) { net_profile_info_t *profile_info = NULL; + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1129,6 +1323,8 @@ EXPORT_API int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file) EXPORT_API int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1147,6 +1343,8 @@ EXPORT_API int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file) EXPORT_API int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* password) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || file == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1169,6 +1367,8 @@ EXPORT_API int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, EXPORT_API int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1203,6 +1403,8 @@ EXPORT_API int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type) EXPORT_API int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1237,6 +1439,8 @@ EXPORT_API int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type) EXPORT_API int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false || type == NULL) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; @@ -1274,6 +1478,8 @@ EXPORT_API int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* typ EXPORT_API int wifi_ap_set_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e type) { + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + if (_wifi_libnet_check_ap_validity(ap) == false) { WIFI_LOG(WIFI_ERROR, "Invalid parameter"); return WIFI_ERROR_INVALID_PARAMETER; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 421549b..a251e5f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,9 @@ +PROJECT(wifi_test C) + SET(fw_test "${fw_name}-test") SET(dependents "capi-base-common glib-2.0 network") +SET(pc_dependents "capi-base-common") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_test} REQUIRED ${dependents}) @@ -8,7 +11,8 @@ FOREACH(flag ${${fw_test}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") aux_source_directory(. sources) FOREACH(src ${sources}) @@ -17,4 +21,5 @@ FOREACH(src ${sources}) ADD_EXECUTABLE(${src_name} ${src}) TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) ENDFOREACH() + INSTALL(TARGETS wifi_test RUNTIME DESTINATION bin/) diff --git a/test/wifi_test.c b/test/wifi_test.c old mode 100644 new mode 100755 index d908984..1bc1063 --- a/test/wifi_test.c +++ b/test/wifi_test.c @@ -91,6 +91,9 @@ static void __test_bg_scan_completed_callback(wifi_error_e error_code, void* use static void __test_scan_request_callback(wifi_error_e error_code, void* user_data) { + if(user_data != NULL) + printf("user_data : %s\n", (char *)user_data); + printf("Scan Completed from scan request, error code : %s\n", __test_convert_error_to_string(error_code)); } @@ -133,7 +136,7 @@ static void __test_activated_callback(wifi_error_e result, void* user_data) if (result == WIFI_ERROR_NONE) printf("Wi-Fi Activation Succeeded\n"); else - printf("Wi-Fi Activation Failed! error : %s", __test_convert_error_to_string(result)); + printf("Wi-Fi Activation Failed! error : %s\n", __test_convert_error_to_string(result)); } static void __test_deactivated_callback(wifi_error_e result, void* user_data) @@ -141,7 +144,7 @@ static void __test_deactivated_callback(wifi_error_e result, void* user_data) if (result == WIFI_ERROR_NONE) printf("Wi-Fi Deactivation Succeeded\n"); else - printf("Wi-Fi Deactivation Failed! error : %s", __test_convert_error_to_string(result)); + printf("Wi-Fi Deactivation Failed! error : %s\n", __test_convert_error_to_string(result)); } static void __test_connected_callback(wifi_error_e result, void* user_data) @@ -149,7 +152,7 @@ static void __test_connected_callback(wifi_error_e result, void* user_data) if (result == WIFI_ERROR_NONE) printf("Wi-Fi Connection Succeeded\n"); else - printf("Wi-Fi Connection Failed! error : %s", __test_convert_error_to_string(result)); + printf("Wi-Fi Connection Failed! error : %s\n", __test_convert_error_to_string(result)); } static void __test_disconnected_callback(wifi_error_e result, void* user_data) @@ -157,7 +160,7 @@ static void __test_disconnected_callback(wifi_error_e result, void* user_data) if (result == WIFI_ERROR_NONE) printf("Wi-Fi Disconnection Succeeded\n"); else - printf("Wi-Fi Disconnection Failed! error : %s", __test_convert_error_to_string(result)); + printf("Wi-Fi Disconnection Failed! error : %s\n", __test_convert_error_to_string(result)); } static void __test_rssi_level_callback(wifi_rssi_level_e rssi_level, void* user_data) @@ -222,7 +225,11 @@ static bool __test_found_connect_ap_callback(wifi_ap_h ap, void *user_data) if (strstr(ap_name, ap_name_part) != NULL) { bool required = false; - wifi_ap_is_passphrase_required(ap, &required); + + if (wifi_ap_is_passphrase_required(ap, &required) == WIFI_ERROR_NONE) + printf("Passphrase required : %s\n", required ? "TRUE" : "FALSE"); + else + printf("Fail to get Passphrase required\n"); if (required) { char passphrase[100]; @@ -365,8 +372,12 @@ static bool __test_found_eap_ap_callback(wifi_ap_h ap, void *user_data) } if (strstr(ap_name, ap_name_part) != NULL) { - wifi_security_type_e type;; - wifi_ap_get_security_type(ap, &type); + wifi_security_type_e type; + + if (wifi_ap_get_security_type(ap, &type) == WIFI_ERROR_NONE) + printf("Security type : %d\n", type); + else + printf("Fail to get Security type\n"); if (type != WIFI_SECURITY_TYPE_EAP) { g_free(ap_name); @@ -414,6 +425,23 @@ static bool __test_found_eap_ap_callback(wifi_ap_h ap, void *user_data) return true; } +static bool test_get_user_int(const char *msg, int *num) +{ + if (msg == NULL || num == NULL) + return false; + + int rv; + char buf[32] = {0,}; + printf("%s\n", msg); + rv = read(0, buf, 32); + + if (rv < 0 || *buf == 0 || *buf == '\n' || *buf == '\r') + return false; + + *num = atoi(buf); + return true; +} + static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data) { int rv; @@ -429,6 +457,7 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data if (strstr(ap_name, ap_name_part) != NULL) { wifi_ip_config_type_e type; int method; + int address_type; printf("Input new method type (1:dhcp, 2:manual, 3:auto) :\n"); rv = scanf("%9d", &method); @@ -437,6 +466,14 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data return false; } + rv = test_get_user_int("Input Address type to get" + "(0:IPV4, 1:IPV6):", &address_type); + + if (rv == false || (address_type != 0 && address_type != 1)) { + printf("Invalid input!!\n"); + return false; + } + switch (method) { case 1: type = WIFI_IP_CONFIG_TYPE_DYNAMIC; @@ -453,7 +490,7 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data return false; } - rv = wifi_ap_set_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, type); + rv = wifi_ap_set_ip_config_type(ap, address_type, type); if (rv != WIFI_ERROR_NONE) printf("Fail to set ip method type[%s]\n", __test_convert_error_to_string(rv)); @@ -468,10 +505,10 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data rv = WIFI_ERROR_NONE; break; case '0': - rv = wifi_ap_set_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL); + rv = wifi_ap_set_ip_address(ap, address_type, NULL); break; default: - rv = wifi_ap_set_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr); + rv = wifi_ap_set_ip_address(ap, address_type, ip_addr); } if (rv != WIFI_ERROR_NONE) @@ -487,10 +524,10 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data rv = WIFI_ERROR_NONE; break; case '0': - rv = wifi_ap_set_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL); + rv = wifi_ap_set_subnet_mask(ap, address_type, NULL); break; default: - rv = wifi_ap_set_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr); + rv = wifi_ap_set_subnet_mask(ap, address_type, ip_addr); } if (rv != WIFI_ERROR_NONE) @@ -506,10 +543,10 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data rv = WIFI_ERROR_NONE; break; case '0': - rv = wifi_ap_set_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL); + rv = wifi_ap_set_gateway_address(ap, address_type, NULL); break; default: - rv = wifi_ap_set_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, ip_addr); + rv = wifi_ap_set_gateway_address(ap, address_type, ip_addr); } if (rv != WIFI_ERROR_NONE) @@ -528,7 +565,7 @@ static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_data) { - int rv; + int rv, address_type; char *ap_name; char *ap_name_part = (char*)user_data; @@ -551,6 +588,14 @@ static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_d return false; } + rv = test_get_user_int("Input Address type to get" + "(0:IPV4, 1:IPV6):", &address_type); + + if (rv == false || (address_type != 0 && address_type != 1)) { + printf("Invalid input!!\n"); + return false; + } + switch (method) { case 1: type = WIFI_PROXY_TYPE_DIRECT; @@ -580,10 +625,10 @@ static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_d rv = WIFI_ERROR_NONE; break; case '0': - rv = wifi_ap_set_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, NULL); + rv = wifi_ap_set_proxy_address(ap, address_type, NULL); break; default: - rv = wifi_ap_set_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, proxy_addr); + rv = wifi_ap_set_proxy_address(ap, address_type, proxy_addr); } if (rv != WIFI_ERROR_NONE) @@ -600,7 +645,7 @@ static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_d static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data) { - int rv; + int rv, address_type = 0; char *ap_name; char *str_value; int int_value; @@ -658,24 +703,32 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data) else printf("Fail to get Connection State\n"); - if (wifi_ap_get_ip_config_type(ap, WIFI_ADDRESS_FAMILY_IPV4, &ip_type) == WIFI_ERROR_NONE) + rv = test_get_user_int("Input Address type to get" + "(0:IPV4, 1:IPV6):", &address_type); + + if (rv == false || (address_type != 0 && address_type != 1)) { + printf("Invalid input!!\n"); + return false; + } + + if (wifi_ap_get_ip_config_type(ap, address_type, &ip_type) == WIFI_ERROR_NONE) printf("IP config type : %d\n", ip_type); else printf("Fail to get IP config type\n"); - if (wifi_ap_get_ip_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_ip_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) { printf("IP : %s\n", str_value); g_free(str_value); } else printf("Fail to get IP\n"); - if (wifi_ap_get_subnet_mask(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_subnet_mask(ap, address_type, &str_value) == WIFI_ERROR_NONE) { printf("Subnet mask : %s\n", str_value); g_free(str_value); } else printf("Fail to get Subnet mask\n"); - if (wifi_ap_get_gateway_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_gateway_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) { printf("Gateway : %s\n", str_value); g_free(str_value); } else @@ -686,19 +739,19 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data) else printf("Fail to get Proxy type\n"); - if (wifi_ap_get_proxy_address(ap, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_proxy_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) { printf("Proxy : %s\n", str_value); g_free(str_value); } else printf("Fail to get Proxy\n"); - if (wifi_ap_get_dns_address(ap, 1, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_dns_address(ap, 1, address_type, &str_value) == WIFI_ERROR_NONE) { printf("DNS1 : %s\n", str_value); g_free(str_value); } else printf("Fail to get DNS1\n"); - if (wifi_ap_get_dns_address(ap, 2, WIFI_ADDRESS_FAMILY_IPV4, &str_value) == WIFI_ERROR_NONE) { + if (wifi_ap_get_dns_address(ap, 2, address_type, &str_value) == WIFI_ERROR_NONE) { printf("DNS2 : %s\n", str_value); g_free(str_value); } else @@ -1300,6 +1353,7 @@ int test_get_ap_info(void) int main(int argc, char **argv) { GMainLoop *mainloop; + g_type_init(); mainloop = g_main_loop_new (NULL, FALSE); GIOChannel *channel = g_io_channel_unix_new(0);