From: Yu Jiung Date: Thu, 9 Mar 2017 01:34:19 +0000 (+0900) Subject: Add Header and basic packaging files X-Git-Tag: submit/tizen/20170424.082918~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F118123%2F18;p=platform%2Fcore%2Fapi%2Fasp.git Add Header and basic packaging files Change-Id: I4a8076e7ce8cc87533a11651932e15ee31eae67a Signed-off-by: Yu jiung --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..84e7537 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @file CMakeLists.txt +# + +############################# Check minimum CMake version ##################### + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3) +PROJECT(capi-network-asp) + +############################# cmake packages ################################## + +INCLUDE(FindPkgConfig) + +########################## search for packages ################################ + +SET(COMMON_DEPS "dlog glib-2.0 gio-2.0 capi-base-common capi-system-info gio-unix-2.0") +SET(PC_DEPS "capi-base-common") + + +PKG_CHECK_MODULES(ASP_DEPS REQUIRED ${COMMON_DEPS}) + +######################## directory configuration ############################ + +############################# compiler flags ################################## +FOREACH(flag ${ASP_DEPS_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2 -g") + +# Don't export symbols by default +ADD_DEFINITIONS("-fvisibility=hidden") +ADD_DEFINITIONS("-DUSE_DLOG") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}") + +SET(TARGET_ASP "asp") +SET(TARGET_ASP_TEST "asp-test") + + +ADD_SUBDIRECTORY(include) diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..a50093d --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ +Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/capi-network-asp.manifest b/capi-network-asp.manifest new file mode 100755 index 0000000..a76fdba --- /dev/null +++ b/capi-network-asp.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/doc/asp_doc.h b/doc/asp_doc.h new file mode 100755 index 0000000..181feaa --- /dev/null +++ b/doc/asp_doc.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __TIZEN_NETWORK_ASP_DOC_H__ +#define __TIZEN_NETWORK_ASP_DOC_H__ + + +/** + * @defgroup CAPI_NETWORK_ASP_MODULE Application Service Platform + * @brief Wi-Fi Direct provides API to manage Application Service Platform. + * @ingroup CAPI_NETWORK_FRAMEWORK + * + * @section CAPI_NETWORK_ASP_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_NETWORK_ASP_MODULE_OVERVIEW Overview + * This set of functions is used to manage the settings of Application Service Platform. + * In addition, This set provides functions to discovery and manage sessions using Application Service Platform. + * @section CAPI_NETWORK_ASP_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.wifi\n + * - http://tizen.org/feature/network.wifi.direct\n + * - http://tizen.org/feature/network.wifi.direct.asp\n + * - http://tizen.org/feature/network.wifi.direct.display\n + * - http://tizen.org/feature/network.wifi.direct.service_discovery\n + * + * It is recommended to use feature related code in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using + * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * 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 using features in your application can be found in the + * feature element description. + * + */ + + +#endif /* __TIZEN_NETWORK_ASP_DOC_H__ */ diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100755 index 0000000..29e24f0 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @file CMakeLists.txt +# + +INSTALL(FILES + ${CMAKE_SOURCE_DIR}/include/asp.h + DESTINATION ${INCLUDE_DIR}/asp + ) diff --git a/include/asp.h b/include/asp.h new file mode 100755 index 0000000..ad518cc --- /dev/null +++ b/include/asp.h @@ -0,0 +1,1817 @@ +/* + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Sungsik Jang , Dongwook Lee + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ +#ifndef __TIZEN_NET_ASP_H__ +#define __TIZEN_NET_ASP_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @addtogroup CAPI_NETWORK_ASP_MODULE + * @{ + */ + +#ifndef TIZEN_ERROR_ASP +#define TIZEN_ERROR_ASP -0x02F60000 +#endif + +/** + * @brief Enumeration for Application Service Platform (ASP) error code. + * @since_tizen 4.0 + */ +typedef enum { + ASP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + ASP_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted(1) */ + ASP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory(12) */ + ASP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied(13) */ + ASP_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy(16) */ + ASP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter(22) */ + ASP_ERROR_CONNECTION_TIME_OUT = TIZEN_ERROR_CONNECTION_TIME_OUT, /**< Connection timed out(110) */ + ASP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ + ASP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_ASP|0x01, /**< Not initialized */ + ASP_ERROR_ALREADY_INITIALIZED = TIZEN_ERROR_ASP|0x02, /**< Already initialized */ + ASP_ERROR_COMMUNICATION_FAILED = TIZEN_ERROR_ASP|0x03, /**< I/O error */ + ASP_ERROR_OPERATION_FAILED = TIZEN_ERROR_ASP|0x04, /**< Operation failed */ + ASP_ERROR_IN_PROGRESS = TIZEN_ERROR_ASP|0x05, /**< In progress */ + ASP_ERROR_SERVICE_NOT_FOUND = TIZEN_ERROR_ASP|0x06, /**< Service not found */ + ASP_ERROR_SESSION_NOT_FOUND = TIZEN_ERROR_ASP|0x07, /**< Session not found */ + ASP_ERROR_NETWORK_ROLE_REJECTED = TIZEN_ERROR_ASP|0x08 /**< Requested network role rejected */ +} asp_error_e; + +/** + * @brief Enumeration for Advertise Status event reason. + * @since_tizen 4.0 + */ +typedef enum { + ASP_ADVERT_STATUS_REASON_SUCCESS, /**< Status reason: Success */ + ASP_ADVERT_STATUS_REASON_SERVICE_DUPLICATED, /**< Status reason: Service duplicated */ + ASP_ADVERT_STATUS_REASON_OTHER_FAILURE, /**< Status reason: Other failure */ +} asp_advert_status_reason_e; + +/** + * @brief Enumeration for the Wi-Fi P2P role assignment scheme. + * @since_tizen 4.0 + * @see asp_advert_set_p2p_role_scheme() + * @see asp_advert_get_p2p_role_scheme() + * @see asp_session_set_p2p_role() + * @see asp_session_get_p2p_role() + */ +typedef enum { + ASP_ADVERT_P2P_ROLE_SCHEME_ANY, /**< All roles are acceptable */ + ASP_ADVERT_P2P_ROLE_SCHEME_GO, /**< The interface should assume the GO role */ + ASP_ADVERT_P2P_ROLE_SCHEME_GC, /**< The interface should assume the GC role */ +} asp_advert_p2p_role_scheme_e; + +/** + * @brief Enumeration for service discovery mechanism. + * @since_tizen 4.0 + * @see asp_advert_set_tech() + * @see asp_advert_get_tech() + * @see asp_seek_set_tech() + */ +typedef enum { + ASP_DISCOVERY_TECH_P2P = 1 << 0, /**< Use Wi-Fi P2P for discovery mechanism */ + ASP_DISCOVERY_TECH_BLE = 1 << 1, /**< Use BLE for discovery mechanism */ + ASP_DISCOVERY_TECH_NFC = 1 << 2, /**< Use NFC for discovery mechanism */ + ASP_DISCOVERY_TECH_INFRA = 1 << 3, /**< Use Wi-Fi Infrastructured for discovery mechanism */ + ASP_DISCOVERY_TECH_NAN = 1 << 4, /**< Use Wi-Fi NAN for discovery mechanism */ +} asp_discovery_tech_e; + +/** + * @brief Enumeration for Wi-Fi WPS type. + * @see asp_advert_set_p2p_config_method() + * @see asp_advert_get_p2p_config_method() + * @see asp_session_set_p2p_config_method() + * @see asp_session_get_p2p_config_method() + * @since_tizen 4.0 + */ +typedef enum { + ASP_WPS_TYPE_NONE, /**< No WPS type */ + ASP_WPS_TYPE_DEFAULT, /**< Default WPS type both P2PS and PIN */ + ASP_WPS_TYPE_PIN_BOTH, /**< WPS type PIN code both display and keypad*/ + ASP_WPS_TYPE_PIN_DISPLAY, /**< WPS type display PIN code only*/ + ASP_WPS_TYPE_PIN_KEYPAD, /**< WPS type keypad to input the PIN only*/ +} asp_wps_type_e; + +/** + * @brief Enumeration for Application Service Platform (ASP) Session connect status. + * @since_tizen 4.0 +*/ +typedef enum { + ASP_CONNECT_STATUS_NETWORK_ROLE_REJECTED, /**< Network role rejected */ + ASP_CONNECT_STATUS_CONNECTION_LIMIT_REACHED, /**< The device's connection limit has been reached */ + ASP_CONNECT_STATUS_REQUEST_SENT, /**< Session request sent */ + ASP_CONNECT_STATUS_REQUEST_RECEIVED, /**< Session request received */ + ASP_CONNECT_STATUS_REQUEST_DEFERRED, /**< Session request deferred */ + ASP_CONNECT_STATUS_REQUEST_ACCEPTED, /**< Session request accepted */ + ASP_CONNECT_STATUS_REQUEST_FAILED, /**< Session request failed */ + ASP_CONNECT_STATUS_GROUP_FORMATION_STARTED, /**< Group formation started */ + ASP_CONNECT_STATUS_GROUP_FORMATION_COMPLETED, /**< Group formation completed */ + ASP_CONNECT_STATUS_GROUP_FORMATION_FAILED, /**< Group formation failed*/ +} asp_connect_status_e; + +/** + * @brief Enumeration for Application Service Platform (ASP) general session state. + * @since_tizen 4.0 +*/ +typedef enum { + ASP_SESSION_STATE_ERROR, /**< Session state error*/ + ASP_SESSION_STATE_CLOSED, /**< Session state closed*/ + ASP_SESSION_STATE_INITIATED, /**< Session state initiated*/ + ASP_SESSION_STATE_REQUESTED, /**< Session state requested*/ + ASP_SESSION_STATE_OPEN, /**< Session state open*/ +} asp_session_state_e; + +/** + * @brief Enumeration for Application Service Platform (ASP) session close status. + * @since_tizen 4.0 +*/ +typedef enum { + ASP_SESSION_CLOSE_OK, /**< Session closed without error */ + ASP_SESSION_CLOSE_DISASSOCIATED, /**< Session closed by disassociation (Wi-Fi Direct connection was broken) */ + ASP_SESSION_CLOSE_LOCAL_CLOSE, /**< Session closed with local close */ + ASP_SESSION_CLOSE_REMOTE_CLOSE, /**< Session closed with remote close */ + ASP_SESSION_CLOSE_SYSTEM_FAILURE, /**< Session closed with system failure */ + ASP_SESSION_CLOSE_NO_RESPONSE, /**< Session closed with no response from remote */ +} asp_session_close_status_e; + +/** + * @brief Enumeration for Application Service Platform (ASP) port status. + * @since_tizen 4.0 +*/ +typedef enum { + ASP_PORT_STATUS_LOCAL_PORT_ALLOWED, /**< Incoming connections are allowed on this local port for this ASP session */ + ASP_PORT_STATUS_LOCAL_PORT_BLOCKED, /**< Incoming connections are no longer allowed in the ASP session for this local port */ + ASP_PORT_STATUS_FAILURE, /**< The ASP was unable to set up this local port */ + ASP_PORT_STATUS_REMOTE_PORT_ALLOWED, /**< The remote service has allowed access to the given remote port for the given protocol */ +} asp_port_status_e; + +/** + * @brief Enumeration for service status. + * @since_tizen 4.0 +*/ +typedef enum { + ASP_SERVICE_STATUS_NOT_ADVERTISED , /**< Service status not advertised */ + ASP_SERVICE_STATUS_ADVERTISED, /**< Service status advertised */ +} asp_service_status_e; + +/** + * @brief The advertised service description. + * @since_tizen 4.0 + */ +typedef void *asp_advert_service_h; + +/** + * @brief The searching service description. + * @since_tizen 4.0 + */ +typedef void *asp_seek_service_h; + +/** + * @brief The Application Service Platform (ASP) session description. + * @since_tizen 4.0 + */ +typedef void *asp_session_h; + +/** +* @brief Called when the Application Service Platform (ASP) Service is found. +* @since_tizen 4.0 +* @remarks @a service_mac, @a instance_name and @a service_info are valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code. \n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] seek_service The seek service which found the current result; +* the handle to the same object for which the search was started +* @param[in] service_mac The P2P device address of the device which provides the service; +* NULL if not available +* @param[in] adv_id The service advertisement ID defined by remote P2P device +* @param[in] config_method The preferred Wi-Fi Simple Config (WSC) configuration method +* @param[in] instance_name The advertised service name defined by the remote P2P device; +* NULL if not available +* @param[in] service_info The advertised service information defined by the remote P2P device; +* NULL if not available +* @param[in] info_size The advertised service information payload size; +* if the information is not available, this is set to -1 +* @param[in] status The status of the service +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_seek_set_search_result_cb().\n +* asp_seek_start() must be called to invoke this callback. +* @see asp_seek_set_search_result_cb() +* @see asp_seek_unset_search_result_cb() +* @see asp_seek_start() +*/ +typedef void (*asp_seek_search_result_cb) (int error_code, + asp_seek_service_h seek_service, + const char *service_mac, + unsigned int adv_id, + asp_wps_type_e config_method, + const char *instance_name, + const char *service_info, + int info_size, + unsigned char status, + void *user_data); + +/** +* @brief Called when the status of an advertisement to a service is changed. +* @since_tizen 4.0 +* @param[in] adv_service The service whose status has changed; +* the handle to the same object for which the callback was set +* @param[in] status The status of the service +* @param[in] reason The reason of the state change +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_advert_set_status_cb().\n +* asp_advert_start_advertising() and asp_change_service_state() invoke this callback. +* @see asp_advert_set_status_changed_cb() +* @see asp_advert_unset_status_changed_cb() +* @see asp_advert_start_advertising() +*/ +typedef void (*asp_advert_status_changed_cb) (asp_advert_service_h adv_service, + asp_service_status_e status, + asp_advert_status_reason_e reason, + void *user_data); + +/** +* @brief Called when a remote device is attempting to initiate an ASP session. +* @since_tizen 4.0 +* @remarks @a network_config_pin, @a device_name and @a info are valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code.\n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] adv_service Service descriptor handle provided by the asp_advert_create() +* it is the "original" object not created specifically for the callback +* @param[in] session The session for which the request is made; +* the handle to the same object for which the callback was set +* @param[in] device_name Device name of the remote peer +* @param[in] info The service-specific data payload (up to 144 bytes); +* NULL if not available +* @param[in] info_size The service-specific data payload size (up to 144) +* @param[in] get_network_config_pin (@c true = requires WSC PIN to be entered by +* the asp_session_confirm(), +* @c false = does not require PIN) +* @param[in] network_config_pin The WSC PIN value to be displayed; NULL if not available +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_session_set_request_cb(). +* @see asp_session_set_request_cb() +*/ +typedef void (*asp_session_request_cb) (int error_code, + asp_advert_service_h adv_service, + asp_session_h session, + const char *device_name, + const char *info, + int info_size, + bool get_network_config_pin, + const char *network_config_pin, + void *user_data); + +/** +* @brief Called when the Application Service Platform (ASP) has to provide +* a PIN value or collect a PIN value. +* @since_tizen 4.0 +* @remarks @a config_pin is valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code.\n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] session The session for which the request is made; +* the handle to the same object for which the callback was set +* @param[in] get_pin (@c true = instruct the user to enter the PIN, +* @c false = display the PIN provided in the @a config_pin parameter) +* @param[in] config_pin The WSC PIN value used for setting up; ignored if @a get_pin is @c true +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_session_set_config_request_cb().\n +* asp_session_connect() must be called to invoke this callback. +* @see asp_session_set_request_cb() +* @see asp_session_connect() +*/ +typedef void (*asp_session_config_request_cb) (int error_code, + asp_session_h session, + bool get_pin, + const char *config_pin, + void *user_data); + +/** +* @brief Called when the Application Service Platform (ASP) reports progress on group formation. +* @since_tizen 4.0 +* @remarks @a deferred_resp is valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code.\n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] session The session for which progress is reported; +* the handle to the same object for which the callback was set +* @param[in] status The connection progress status +* @param[in] deferred_resp The service-specific data payload up to 144 bytes +* @param[in] resp_size The service-specific data payload size(up to 144) +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_session_set_connect_status_cb() +* @see asp_session_set_connect_status_cb() +*/ +typedef void (*asp_session_connect_status_cb) (int error_code, + asp_session_h session, + asp_connect_status_e status, + const char *deferred_resp, + int resp_size, + void *user_data); + +/** +* @brief Called when the Application Service Platform (ASP) reports the state and status of an ASP session. +* @since_tizen 4.0 +* @remarks @a additional_info is valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code.\n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] session The session for which status is reported; +* the handle to the same object for which the callback was set +* @param[in] state The session state +* @param[in] additional_info Additional information related to the SessionStatus event +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_session_set_status_cb() +* @see asp_session_set_status_cb() +*/ +typedef void (*asp_session_status_cb) (int error_code, + asp_session_h session, + asp_session_state_e state, + const char *additional_info, + void *user_data); + +/** +* @brief Called when the Application Service Platform (ASP) reports the status of the network port on the local and remote end of the ASP session. +* @since_tizen 4.0 +* @remarks @a ip_address is valid only in the callback. +* To use outside the callback, make a copy. +* @param[in] error_code The error code.\n +* #ASP_ERROR_NONE Successful\n +* #ASP_ERROR_OUT_OF_MEMORY Out of memory\n +* #ASP_ERROR_OPERATION_FAILED Operation failed\n +* @param[in] session Application Service Platform session descriptor handle +* @param[in] ip_address The IP address for the port, local or remote +* @param[in] port The port number +* @param[in] proto The IANA protocol number +* @param[in] status The port status +* @param[in] user_data The user data passed from the callback registration function +* @pre The callback must be registered using asp_session_set_port_status_cb() +* @see asp_set_session_port_status_cb() +*/ +typedef void (*asp_session_port_status_cb) (int error_code, + asp_session_h session, + const char *ip_address, + int port, + int proto, + asp_port_status_e status, + void *user_data); + +/** + * @brief Initializes Application Service Platform (ASP). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @return 0 on success, otherwise a negative error value. + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_RESOURCE_BUSY Device or resource busy + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_COMMUNICATION_FAILED Communication failed + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @see asp_deinitialize() + */ +int asp_initialize(void); + +/** + * @brief Deinitializes Application Service Platform (ASP). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @return 0 on success, otherwise a negative error value. + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_COMMUNICATION_FAILED Communication failed + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + */ +int asp_deinitialize(void); + +/** + * @brief Registers the callback function that will be invoked when a service found. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @post asp_search_result_cb will be called under certain conditions, + * after calling asp_seek_start() + * @see asp_initialize() + * @see asp_seek_unset_search_result_cb() + * @see asp_seek_start() + */ +int asp_seek_set_search_result_cb(asp_seek_search_result_cb cb, void *user_data); + +/** + * @brief Unregisters the callback function that will invoked when a service found. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_seek_set_search_result_cb() + */ +int asp_seek_unset_search_result_cb(void); + +/** + * @brief Registers the callback function that will invoked when the status of an advertisement to a service is changed. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @post asp_seek_search_result_cb() will be called under certain conditions, + * after calling asp_seek_start() + * @see asp_initialize() + * @see asp_advert_unset_status_changed_cb() + * @see asp_advert_start_advertising() + */ +int asp_advert_set_status_changed_cb(asp_advert_status_changed_cb cb, + void *user_data); + +/** + * @brief Unregisters the callback function that will invoked when the status of an advertisement to a service is changed. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_advert_set_status_changed_cb() + */ +int asp_advert_unset_status_changed_cb(void); + +/** + * @brief Registers the callback called when ASP session connection is requested. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_unset_request_cb() + */ +int asp_session_set_request_cb(asp_session_request_cb cb, void *user_data); + +/** + * @brief Unregisters the callback called ASP when session connection is requested. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_set_request_cb() + */ +int asp_session_unset_request_cb(void); + +/** + * @brief Registers the callback called when the session configuration is requested. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_unset_config_request_cb() + * @see asp_session_config_request_cb() + */ +int asp_session_set_config_request_cb(asp_session_config_request_cb cb, + void *user_data); + +/** + * @brief Unregisters the callback called when the session configuration is requested. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_config_request_cb() + */ +int asp_session_unset_config_request_cb(void); + +/** + * @brief Registers the callback called when the state of the session connection is changed. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_unset_connection_status_changed_cb() + * @see asp_session_connect_status_cb() + */ +int asp_session_set_connect_status_cb(asp_session_connect_status_cb cb, void *user_data); + +/** + * @brief Unregisters the callback called when the state of the session connection is changed. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_set_connection_status_changed_cb() + */ +int asp_session_unset_connect_status_cb(void); + +/** + * @brief Registers the callback called when the state of the session is changed. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_unset_status_cb() + * @see asp_session_status_cb() + */ +int asp_session_set_status_cb(asp_session_status_cb cb, void *user_data); + +/** + * @brief Unregisters the callback called when the state of the session is changed. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_set_status_cb() + */ +int asp_session_unset_status_cb(void); + +/** + * @brief Registers the callback called when the state of the port is changed. + * @since_tizen 4.0 + * @privlevel public + * @param[in] cb The callback function to invoke + * @param[in] user_data The user data passed from the callback registration function + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_unset_status_cb() + */ +int asp_session_set_port_status_cb(asp_session_port_status_cb cb, void *user_data); + +/** + * @brief Unregisters the callback called when the state of the port is changed. + * @since_tizen 4.0 + * @privlevel public + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_initialize() + * @see asp_session_set_port_status_cb() + */ +int asp_session_unset_port_status_cb(void); + +/** + * @brief Creates the description of a service to be advertised. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] instance_name Service instance name of a service type to be advertised. + * The length of this parameter be 63 byte or less and + * encoding shall be single-byte or multi-byte UTF-8 characters. + * If you want to advertise one of the original P2PS defined services, + * this shall be NULL. + * @param[out] adv_service service descriptor handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_advert_destroy() + */ +int asp_advert_create(char *instance_name, asp_advert_service_h *adv_service); + +/** + * @brief Destroys the description of a service to be advertised. + * @details If asp_advert_start_advertising() was called for a service, + * asp_advert_stop_advertising() should be called for it before destroying it. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_create_service() before use + * @see asp_advert_create() + */ +int asp_advert_destroy(asp_advert_service_h adv_service); + +/** + * @brief Sets the service type for a service to be advertised. + * @details Application should set service type after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] service_type The unique type of a particular service. + * this shall be at least 1 character and no more than 15 characters long + * contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and + * 'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45) + * contain at least one letter ('A' - 'Z' or 'a' - ‘z') + * not begin or end with a hyphen. If you want to advertise one of the + * original P2PS defined services, this means service name. + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_service_type(asp_advert_service_h adv_service, + char *service_type); + +/** + * @brief Sets auto accept for a service to be advertised. + * @details Application should set service auto accept after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] auto_accept Enables/Disables auto accept based on the value TRUE/FALSE + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_auto_accept(asp_advert_service_h adv_service, + bool auto_accept); + +/** + * @brief Adds the information for a service to be advertised. + * @details Application should set service information after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] key Service-defined key data specified in Section 6 of RFC6763 + * @param[in] value Service-defined value data specified in Section 6 of RFC6763 + * Only one value can be added for a given key. If a value is set for a key, + * and another value was set for the key before, the old value will be + * overwritten with the new one. + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_add_info(asp_advert_service_h adv_service, + const char *key, const char *value); + + +/** + * @brief Sets the information for a service to be advertised. + * @details Application should set service information after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @remarks @a value should not be freed. + * It is recommended to make a copy of it to use. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] key Service-defined key data specified in Section 6 of RFC6763 + * @param[in] length Length of service-defined value data specified in Section 6 of RFC6763 + * @param[in] value Service-defined value data specified in Section 6 of RFC6763 + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_get_info(asp_advert_service_h adv_service, const char *key, + int *length, char **value); + + +/** + * @brief Sets the information for a service to be advertised. + * @details Application should set service information after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] key Service-defined key data specified to be removed + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_remove_info(asp_advert_service_h adv_service, const char *key); + +/** + * @brief Sets the status for a service to be advertised. + * @details Application should set service status after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] status Status of the service: + * (@c 1 = available to use, @c 0 = not available to use, + * @c 2-255 = service specific information) + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_status(asp_advert_service_h adv_service, + unsigned char status); + + +/** + * @brief Sets the discovery mechanism for a service to be advertised. + * @details Application should set discovery mechanism after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] discovery_tech The discovery mechanism; values of + * #asp_discovery_tech_e combined with bitwise 'or' + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_discovery_tech(asp_advert_service_h adv_service, int discovery_tech); + +/** + * @brief Sets the preferred connection for a service to be advertised. + * @details Application should set preferred connection after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] preferred_connection The preferred connection + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_preferred_connection(asp_advert_service_h adv_service, + unsigned char preferred_connection); + +/** + * @brief Sets the Wi-Fi P2P role for a service to be advertised. + * @details Application should set role after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] role The role of the service: \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GO - The receiving interface should assume \n + * the GO role, if it's not possible, #ASP_ERROR_NETWORK_ROLE_REJECTED \n + * is returned \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GC - + * The receiving interface should assume the GC role + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @retval #ASP_ERROR_NETWORK_ROLE_REJECTED Network role rejected + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_p2p_role_scheme(asp_advert_service_h adv_service, + asp_advert_p2p_role_scheme_e role); + +/** + * @brief Gets the Wi-Fi P2P role for a service to be advertised. + * @details Application should Get role after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] role The role of the service: \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GO - The receiving interface should assume \n + * the GO role \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GC - + * The receiving interface should assume the GC role + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_get_p2p_role_scheme(asp_advert_service_h adv_service, + asp_advert_p2p_role_scheme_e *role); + +/** + * @brief Sets the P2P configuration method for a service to be advertised. + * @details Application should set configuration method after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] config_method preferred Wi-Fi Simple Config (WSC) configuration method. + * Default value is ASP_WPS_TYPE_DEFAULT. + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_p2p_config_method(asp_advert_service_h adv_service, + asp_wps_type_e config_method); +/** + * @brief Gets the P2P configuration method for a service to be advertised. + * @details Application should Get configuration method after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] config_method preferred Wi-Fi Simple Config (WSC)configuration method. + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_get_p2p_config_method(asp_advert_service_h adv_service, + asp_wps_type_e *config_method); + +/** + * @brief Sets the service response for an advertised service. + * @details Application should set service response after creating service using + * asp_advert_create() and before advertising service using + * asp_advert_create(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @param[in] rsp_info Specified for a particular service up to 144 bytes. + * You can refer to Wi-Fi Peer-to-Peer Services Technical Specification, + * Wi-Fi Alliance. Available at:http://www.wi-fi.org + * @param[in] length The length of @a rsp_info in bytes, maximum length is 144 + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + */ +int asp_advert_set_p2p_response(asp_advert_service_h adv_service, + char *rsp_info, int length); + +/** + * @brief Starts to advertise a service. + * @details Application should start to advertise after creating service using + * asp_advert_create(). If the service is being advertised, no changes can be made to it. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_create() before use + * @see asp_advert_create() + * @see asp_advert_stop_advertising() + */ +int asp_advert_start_advertising(asp_advert_service_h adv_service); + +/** + * @brief Stops a service advertisement. + * @details Application should cancel to advertise after advertising service using + * asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_advert_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_start_advertising() before use + * @see asp_advert_start_advertising() + */ +int asp_advert_stop_advertising(asp_advert_service_h adv_service); + +/** + * @brief Changes the advertising service status. + * @details Application should change the advertising service + * status after advertising service using asp_advert_start_advertising(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_create_service() + * @param[in] status Status of the service: + * (@c 1 = available to use, @c 0 = not available to use, + * @c 2-255 = service specific information) + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_advert_start_advertising() before use + * @see asp_advert_start_advertising() + */ +int asp_advert_change_service_status(asp_advert_service_h adv_service, + unsigned char status); + +/** + * @brief Creates the description of a seek operation. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] service_type Service Type of a service being searched. + * this shall be at least 1 character and no more than 15 characters long + * contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and + * 'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45) + * contain at least one letter ('A' - 'Z' or 'a' - ‘z') + * not begin or end with a hyphen. If you want to seek one of the + * original P2PS defined services, this means service name. + * @param[out] seek_service Service seek handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @pre Application Service Platform (ASP) must be initialized by asp_initialize(). + * @see asp_seek_destroy() + */ +int asp_seek_create(char *service_type, asp_seek_service_h *seek_service); + +/** + * @brief Destroys the description of a seek operation. + * @details If asp_seek_start() was called for a service, + * asp_seek_stop() should be called for it before destroying it. + * asp_seek_stop(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] seek_service Service seek handle provided by the asp_seek_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre A seek service handle must be created with asp_seek_create(). + * @see asp_seek_create + */ +int asp_seek_destroy(asp_seek_service_h seek_service); + +/** + * @brief Adds the information for a service to be sought. + * @details Application should set service information after creating service using + * asp_seek_create() and before seeking service using asp_seek_start(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] seek_service Service descriptor handle provided by the asp_seek_create() + * @param[in] key Service-defined key data to be searched, + * specified in Section 6 of RFC6763 + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_seek_create() before use + * @see asp_seek_create() + */ +int asp_seek_add_info(asp_seek_service_h seek_service, const char *key); + +/** + * @brief Removes the information for a service to be sought. + * @details Application should set service information after creating service using + * asp_seek_create() and before seeking service using asp_seek_start(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] seek_service Service descriptor handle provided by the asp_seek_create() + * @param[in] key Service-defined key data to be searched, + * specified in Section 6 of RFC6763 + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_seek_create() before use + * @see asp_seek_create() + */ +int asp_seek_remove_info(asp_seek_service_h seek_service, const char *key); + +/** + * @brief Sets the discovery mechanism for a service to be sought. + * @details Application should set service information after creating service using + * asp_seek_create() and before seeking service using asp_seek_start(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_seek_create() + * @param[in] discovery_tech The discovery mechanism, values of + * #asp_discovery_tech_e combined with bitiwse 'or' + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_seek_create() before use + * @see asp_seek_create() + */ +int asp_seek_set_discovery_tech(asp_seek_service_h seek_service, int discovery_tech); + +/** + * @brief Sets the preferred connection for a service to be sought. + * @details Application should set service information after creating service using + * asp_seek_create() and before seeking service using asp_seek_start(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] adv_service Service descriptor handle provided by the asp_seek_create() + * @param[in] preferred_connection The preferred connection + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre This API needs asp_seek_create() before use + * @see asp_seek_create() + */ +int asp_seek_set_preferred_connection(asp_seek_service_h seek_service, + unsigned char preferred_connection); + +/** + * @brief Starts to seek services on peer devices. + * @details If the service is currently seeking, no changes can be made to it. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] seek_service Service seek handle provided by the asp_seek_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre A seek service handle must be created with asp_seek_create(). + * @see asp_seek_create() + * @see asp_seek_stop() + */ +int asp_seek_start(asp_seek_service_h seek_service); + +/** + * @brief Stops seeking services. + * @details Application should cancel to seek service after searching service using + * asp_seek_start(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] seek_service Service seek handle provided by the asp_seek_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SERVICE_NOT_FOUND Service not found + * @pre A seek service handle must be created with asp_seek_create(). + * @see asp_seek_start() + */ +int asp_seek_stop(asp_seek_service_h seek_service); + +/** + * @brief Creates a local Application Service Platform (ASP) session. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] service_mac P2P device address of remote P2P device provided by + * asp_seek_search_result_cb() + * @param[in] adv_id The advertisement ID provided by + * asp_seek_search_result_cb() + * @param[in] session ASP session descriptor handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @see asp_session_destroy() + */ +int asp_session_create(char *service_mac, unsigned int adv_id, + asp_session_h *session); + +/** + * @brief Destroys a local Application Service Platform (ASP) session. + * @details Application should create session by asp_session_create(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_destroy(asp_session_h session); + +/** + * @brief Gets the session MAC for an Application Service Platform session. + * @details Application should request to connect session by + * asp_session_connect() or receive request by asp_session_request_cb(). + * @remarks @a session_mac should not be freed. + * It is recommended to make a copy of it to use. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * @param[out] session_mac The session MAC is the MAC address of + * P2P device which assigned the session ID + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_connect() before use. + * @see asp_session_connect() + * @see asp_session_request_cb() + */ +int asp_session_get_mac(asp_session_h session, char **session_mac); + +/** + * @brief Gets the ID of an Application Service Platform session. + * @details Application should create local session by + * asp_session_create() or receive request by asp_session_request_cb(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * @param[out] session_id The session ID + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + * @see asp_session_request_cb() + */ +int asp_session_get_id(asp_session_h session, unsigned int *session_id); + +/** + * @brief Sets the information for an Application Service Platform session. + * @details Application should set session_info after creating session by + * asp_session_create() and before requesting to connect + * session by asp_session_connect(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[in] session_info Detailed information about the session. + * The session_info parameter is defined for each service section + * and up to 144 bytes. You can refer to Wi-Fi Peer-to-Peer Services + * Technical Specification, Wi-Fi Alliance. + * Available at:http://www.wi-fi.org + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_set_info(asp_session_h session, char *session_info); + +/** + * @brief Gets the information for an Application Service Platform session. + * @details Application should get session_info after creating session by + * asp_session_create() and before requesting to connect + * session by asp_session_connect(). + * @remarks @a session_info should not be freed. + * It is recommended to make a copy of it to use. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[out] session_info detailed information about session + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_get_info(asp_session_h session, char **session_info); + +/** + * @brief Sets the Wi-Fi Direct group role in session. + * @details Application should set role after creating session by + * asp_session_create() and before requesting to connect + * session by asp_session_connect(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[in] role The role of the service: \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GO - The receiving interface should assume \n + * the GO role, if it's not possible, #ASP_ERROR_NETWORK_ROLE_REJECTED \n + * is returned \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GC - + * The receiving interface should assume the GC role + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @retval #ASP_ERROR_NETWORK_ROLE_REJECTED Network role rejected + * @pre This API needs asp_create_service() before use. + * @see asp_create_session() + */ +int asp_session_set_p2p_role_scheme(asp_session_h session, + asp_advert_p2p_role_scheme_e role); + +/** + * @brief Gets the Wi-Fi Direct group role in session. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[in] role The role of the service: \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GO - The receiving interface should assume \n + * the GO role\n + * #ASP_ADVERT_P2P_ROLE_SCHEME_GC - + * The receiving interface should assume the GC role + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_get_p2p_role_scheme(asp_session_h session, + asp_advert_p2p_role_scheme_e *role); + +/** + * @brief Sets the Preferred WSC Configuration method. + * @details Application should set the config method after creating session by + * asp_session_create() and before requesting to connect + * session by asp_session_connect(). + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[in] config_method Preferred WSC Configuration method. + * Default value is #ASP_WPS_TYPE_DEFAULT. + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_set_p2p_config_method(asp_session_h session, + asp_wps_type_e config_method); + +/** + * @brief Gets the Preferred WSC Configuration method. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * provided by the asp_session_create() + * @param[out] config_method Preferred WSC Configuration method + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_get_p2p_config_method(asp_session_h session, + asp_wps_type_e *config_method); + +/** + * @brief Gets the session close status. + * @details This call is valid only for closed sessions (sessions in the #ASP_SESSION_STATE_CLOSED + * state). If the @a session does not identify a closed session, + * #ASP_ERROR_NOT_PERMITTED is returned. + * @since_tizen 4.0 + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback, + * asp_session_create(), or asp_session_get_handle() + * @param[out] status The session close status + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + */ +int asp_session_get_close_status(asp_session_h session, int *status); + +/** + * @brief Starts to connect the Application Service Platform session. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session Application Service Platform session descriptor handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre This API needs asp_session_create() before use. + * @see asp_session_create() + */ +int asp_session_connect(asp_session_h session); + +/** + * @brief Confirms the Application Service Platform(ASP) session request. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback or + * asp_session_create() if pin is requested. + * @param[in] confirmed (@c true = confirm session, @c false = reject session) + * @param[in] pin If session requests the WSC PIN + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @see asp_advert_start_advertising() + * @see asp_session_create() + */ +int asp_session_confirm(asp_session_h session, bool confirmed, char *pin); + +/** + * @brief Gets the Description of Application Service Platform (ASP) session to be connected. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session_mac The MAC address of the P2P device that assigned + * the value of session_id, as provided by + * the asp_session_request_cb() callback or + * asp_session_create() if pin is requested. + * @param[in] session_id The session ID + * @param[out] session Peer-to-Peer service session descriptor handle + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @see asp_session_create() + */ +int asp_session_get_handle(char *session_mac, unsigned int session_id, + asp_session_h *session); + +/** + * @brief Moves an Application Service Platform (ASP) session from Requested state to the Open state. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @pre Peer-to-Peer service must be advertised by asp_advert_start_advertising().\n + * Local device should be listening or finding remote P2P device by + * asp_advert_start_advertising() + * @see asp_advert_start_advertising() + */ +int asp_session_set_state_ready(asp_session_h session); + +/** + * @brief Ends an Application Service Platform (ASP) session and releases associated resources. + * @details The ASP may tear down the underlying ASP P2P group + * if not other ASP sessions are using it. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback or + * asp_session_create() + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @see asp_session_create() + * @see asp_session_request_cb() + */ +int asp_session_close(asp_session_h session); + +/** + * @brief Requests that incoming connections be allowed on a given port. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback or + * asp_session_create() + * @param[in] ip_address The IP address on which the port is being used + * @param[in] port The port number + * @param[in] proto The IANA protocol number + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @see asp_session_create() + * @see asp_session_request_cb() + */ +int asp_session_bind_port(asp_session_h session, char *ip_address, + int port, int proto); + +/** + * @brief Indicates that the service is no longer utilizing the port in the ASP session. + * @since_tizen 4.0 + * @privlevel public + * @privilege http://tizen.org/privilege/wifidirect + * @param[in] session ASP session descriptor handle provided by + * the asp_session_request_cb() callback or + * asp_session_create() + * @param[in] ip_address The IP address on which the port is being used + * @param[in] port The port number + * @param[in] proto The IANA protocol number + * @return 0 on success, otherwise a negative error value + * @retval #ASP_ERROR_NONE Successful + * @retval #ASP_ERROR_NOT_PERMITTED Operation not permitted + * @retval #ASP_ERROR_OUT_OF_MEMORY Out of memory + * @retval #ASP_ERROR_PERMISSION_DENIED Permission denied + * @retval #ASP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ASP_ERROR_NOT_SUPPORTED Not supported + * @retval #ASP_ERROR_NOT_INITIALIZED Not initialized + * @retval #ASP_ERROR_OPERATION_FAILED Operation failed + * @retval #ASP_ERROR_SESSION_NOT_FOUND Session not found + * @see asp_session_create() + * @see asp_session_request_cb() + */ +int asp_session_release_port(asp_session_h session, char *ip_address, + int port, int proto); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_NET_ASP_H__ */ + diff --git a/packaging/capi-network-asp.spec b/packaging/capi-network-asp.spec new file mode 100755 index 0000000..bd20e08 --- /dev/null +++ b/packaging/capi-network-asp.spec @@ -0,0 +1,97 @@ +%define file_transfer_test yes + +Name: capi-network-asp +Summary: An Application Service Platform(ASP) libraries in Native API +Version: 0.0.9 +Release: 1 +Group: Network & Connectivity/API +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz + +BuildRequires: cmake +BuildRequires: pkgconfig(gobject-2.0) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-system-info) +%if "%{file_transfer_test}" == "yes" +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(libsoup-2.4) +BuildRequires: pkgconfig(gssdp-1.0) +BuildRequires: pkgconfig(gupnp-1.0) +%endif + +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description +Application Service Platform(ASP) library in Tizen C API + +%package devel +Summary: An Application Service Platform(ASP) in Native API (Development) +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: capi-base-common-devel + +%description devel +An Application Service Platform(ASP) library in Tizen CAPI (Shared Library) (Development) + +%package test +Summary: ASP - ASP test binaries + +%description test +Test Application for Application Service Platform(ASP) + +%prep +%setup -q +chmod 644 %{SOURCE0} + +%ifarch %{arm} +export ARCH=arm +%else +export ARCH=i586 +%endif + +%build +%if 0%{?sec_build_binary_debug_enable} +export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" +export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" +%endif + + +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%cmake . \ +%if "%{file_transfer_test}" == "yes" + -DTZ_SYS_RO_ETC=%{TZ_SYS_RO_ETC} \ + -DFILE_TRANSFER_TEST=1 \ +%endif + -DCMAKE_BUILD_TYPE=%{?build_type} \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DLIB_DIR:PATH=%{_libdir} \ + -DBIN_DIR:PATH=%{_bindir} \ + -DINCLUDE_DIR:PATH=%{_includedir} \ + -DLOCAL_STATE_DIR:PATH=%{_localstatedir} \ + -DDATA_ROOT_DIR:PATH=%{_datadir} \ + -DFULLVER=%{version} \ + -DMAJORVER=${MAJORVER} +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%manifest capi-network-asp.manifest +%license LICENSE +%defattr(-,root,root,-) + +%files devel +%defattr(-,root,root,-) +%{_includedir}/asp/*.h