ACR-896 continued
[platform/core/api/asp.git] / include / asp.h
1 /*
2  *
3  * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
4  *
5  * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19 */
20 #ifndef __TIZEN_NET_ASP_H__
21 #define __TIZEN_NET_ASP_H__
22
23 #include <tizen.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30 /**
31  * @addtogroup CAPI_NETWORK_ASP_MODULE
32  * @{
33  */
34
35 #ifndef TIZEN_ERROR_ASP
36 #define TIZEN_ERROR_ASP   -0x02F60000
37 #endif
38
39 /**
40  * @brief Enumeration for Application Service Platform (ASP) error code.
41  * @since_tizen 4.0
42  */
43 typedef enum {
44         ASP_ERROR_NONE                   = TIZEN_ERROR_NONE,                 /**< Successful */
45         ASP_ERROR_NOT_PERMITTED          = TIZEN_ERROR_NOT_PERMITTED,        /**< Operation not permitted(1) */
46         ASP_ERROR_OUT_OF_MEMORY          = TIZEN_ERROR_OUT_OF_MEMORY,        /**< Out of memory(12) */
47         ASP_ERROR_PERMISSION_DENIED      = TIZEN_ERROR_PERMISSION_DENIED,    /**< Permission denied(13) */
48         ASP_ERROR_RESOURCE_BUSY          = TIZEN_ERROR_RESOURCE_BUSY,        /**< Device or resource busy(16) */
49         ASP_ERROR_INVALID_PARAMETER      = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid function parameter(22) */
50         ASP_ERROR_CONNECTION_TIME_OUT    = TIZEN_ERROR_CONNECTION_TIME_OUT,  /**< Connection timed out(110) */
51         ASP_ERROR_NOT_SUPPORTED          = TIZEN_ERROR_NOT_SUPPORTED,        /**< Not supported */
52         ASP_ERROR_NOT_INITIALIZED        = TIZEN_ERROR_ASP|0x01,             /**< Not initialized */
53         ASP_ERROR_ALREADY_INITIALIZED    = TIZEN_ERROR_ASP|0x02,             /**< Already initialized */
54         ASP_ERROR_COMMUNICATION_FAILED   = TIZEN_ERROR_ASP|0x03,             /**< I/O error */
55         ASP_ERROR_OPERATION_FAILED       = TIZEN_ERROR_ASP|0x04,             /**< Operation failed */
56         ASP_ERROR_IN_PROGRESS            = TIZEN_ERROR_ASP|0x05,             /**< In progress */
57         ASP_ERROR_SERVICE_NOT_FOUND      = TIZEN_ERROR_ASP|0x06,             /**< Service not found */
58         ASP_ERROR_SESSION_NOT_FOUND      = TIZEN_ERROR_ASP|0x07,             /**< Session not found */
59         ASP_ERROR_NETWORK_ROLE_REJECTED  = TIZEN_ERROR_ASP|0x08              /**< Requested network role rejected */
60 } asp_error_e;
61
62 /**
63  * @brief Enumeration for Advertise Status event reason.
64  * @since_tizen 4.0
65  */
66 typedef enum {
67     ASP_ADVERT_STATUS_REASON_SUCCESS,             /**< Status reason: Success */
68     ASP_ADVERT_STATUS_REASON_SERVICE_DUPLICATED,  /**< Status reason: Service duplicated */
69     ASP_ADVERT_STATUS_REASON_OTHER_FAILURE,       /**< Status reason: Other failure */
70 } asp_advert_status_reason_e;
71
72 /**
73  * @brief Enumeration for the Wi-Fi P2P role assignment scheme.
74  * @since_tizen 4.0
75  * @see asp_advert_set_p2p_role_scheme()
76  * @see asp_advert_get_p2p_role_scheme()
77  * @see asp_session_set_p2p_role()
78  * @see asp_session_get_p2p_role()
79  */
80 typedef enum {
81     ASP_ADVERT_P2P_ROLE_SCHEME_ANY,  /**< All roles are acceptable */
82     ASP_ADVERT_P2P_ROLE_SCHEME_GO,   /**< The interface should assume the GO role */
83     ASP_ADVERT_P2P_ROLE_SCHEME_GC,   /**< The interface should assume the GC role */
84 } asp_advert_p2p_role_scheme_e;
85
86 /**
87  * @brief Enumeration for service discovery mechanism.
88  * @since_tizen 4.0
89  * @see asp_advert_set_discovery_tech()
90  * @see asp_seek_set_discovery_tech()
91  */
92 typedef enum {
93         ASP_DISCOVERY_TECH_P2P    = 1 << 0,  /**< Use Wi-Fi P2P for discovery mechanism */
94         ASP_DISCOVERY_TECH_BLE    = 1 << 1,  /**< Use BLE for discovery mechanism */
95         ASP_DISCOVERY_TECH_NFC    = 1 << 2,  /**< Use NFC for discovery mechanism */
96         ASP_DISCOVERY_TECH_INFRA  = 1 << 3,  /**< Use Wi-Fi Infrastructured for discovery mechanism */
97         ASP_DISCOVERY_TECH_NAN    = 1 << 4,  /**< Use Wi-Fi NAN for discovery mechanism */
98 } asp_discovery_tech_e;
99
100 /**
101  * @brief Enumeration for Wi-Fi WPS type.
102  * @see asp_advert_set_p2p_config_method()
103  * @see asp_advert_get_p2p_config_method()
104  * @see asp_session_set_p2p_config_method()
105  * @see asp_session_get_p2p_config_method()
106  * @since_tizen 4.0
107  */
108 typedef enum {
109         ASP_WPS_TYPE_NONE,         /**< No WPS type */
110         ASP_WPS_TYPE_DEFAULT,      /**< Default WPS type both P2PS and PIN */
111         ASP_WPS_TYPE_PIN_BOTH,     /**< WPS type PIN code both display and keypad*/
112         ASP_WPS_TYPE_PIN_DISPLAY,  /**< WPS type display PIN code only*/
113         ASP_WPS_TYPE_PIN_KEYPAD,   /**< WPS type keypad to input the PIN only*/
114 } asp_wps_type_e;
115
116 /**
117  * @brief Enumeration for Application Service Platform (ASP) Session connect status.
118  * @since_tizen 4.0
119 */
120 typedef enum {
121         ASP_CONNECT_STATUS_NETWORK_ROLE_REJECTED,      /**< Network role rejected */
122         ASP_CONNECT_STATUS_CONNECTION_LIMIT_REACHED,   /**< The device's connection limit has been reached */
123         ASP_CONNECT_STATUS_REQUEST_SENT,               /**< Session request sent */
124         ASP_CONNECT_STATUS_REQUEST_RECEIVED,           /**< Session request received */
125         ASP_CONNECT_STATUS_REQUEST_DEFERRED,           /**< Session request deferred */
126         ASP_CONNECT_STATUS_REQUEST_ACCEPTED,           /**< Session request accepted */
127         ASP_CONNECT_STATUS_REQUEST_FAILED,             /**< Session request failed */
128         ASP_CONNECT_STATUS_GROUP_FORMATION_STARTED,    /**< Group formation started */
129         ASP_CONNECT_STATUS_GROUP_FORMATION_COMPLETED,  /**< Group formation completed */
130         ASP_CONNECT_STATUS_GROUP_FORMATION_FAILED,     /**< Group formation failed*/
131 } asp_connect_status_e;
132
133 /**
134  * @brief Enumeration for Application Service Platform (ASP) general session state.
135  * @since_tizen 4.0
136 */
137 typedef enum {
138         ASP_SESSION_STATE_ERROR,      /**< Session state error*/
139         ASP_SESSION_STATE_CLOSED,     /**< Session state closed*/
140         ASP_SESSION_STATE_INITIATED,  /**< Session state initiated*/
141         ASP_SESSION_STATE_REQUESTED,  /**< Session state requested*/
142         ASP_SESSION_STATE_OPEN,       /**< Session state open*/
143 } asp_session_state_e;
144
145 /**
146  * @brief Enumeration for Application Service Platform (ASP) session close status.
147  * @since_tizen 4.0
148 */
149 typedef enum {
150         ASP_SESSION_CLOSE_OK,              /**< Session closed without error */
151         ASP_SESSION_CLOSE_DISASSOCIATED,   /**< Session closed by disassociation (Wi-Fi Direct connection was broken) */
152         ASP_SESSION_CLOSE_LOCAL_CLOSE,     /**< Session closed with local close */
153         ASP_SESSION_CLOSE_REMOTE_CLOSE,    /**< Session closed with remote close */
154         ASP_SESSION_CLOSE_SYSTEM_FAILURE,  /**< Session closed with system failure */
155         ASP_SESSION_CLOSE_NO_RESPONSE,     /**< Session closed with no response from remote */
156 } asp_session_close_status_e;
157
158 /**
159  * @brief Enumeration for Application Service Platform (ASP) port status.
160  * @since_tizen 4.0
161 */
162 typedef enum {
163         ASP_PORT_STATUS_LOCAL_PORT_ALLOWED,   /**< Incoming connections are allowed on this local port for this ASP session */
164         ASP_PORT_STATUS_LOCAL_PORT_BLOCKED,   /**< Incoming connections are no longer allowed in the ASP session for this local port */
165         ASP_PORT_STATUS_FAILURE,              /**< The ASP was unable to set up this local port */
166         ASP_PORT_STATUS_REMOTE_PORT_ALLOWED,  /**< The remote service has allowed access to the given remote port for the given protocol */
167 } asp_port_status_e;
168
169 /**
170  * @brief Enumeration for service status.
171  * @since_tizen 4.0
172 */
173 typedef enum {
174         ASP_SERVICE_STATUS_NOT_ADVERTISED,  /**< Service status not advertised */
175         ASP_SERVICE_STATUS_ADVERTISED,       /**< Service status advertised */
176 } asp_service_status_e;
177
178 /**
179  * @brief The advertised service description.
180  * @since_tizen 4.0
181  */
182 typedef void *asp_advert_service_h;
183
184 /**
185  * @brief The searching service description.
186  * @since_tizen 4.0
187  */
188 typedef void *asp_seek_service_h;
189
190 /**
191  * @brief The Application Service Platform (ASP) session description.
192  * @since_tizen 4.0
193  */
194 typedef void *asp_session_h;
195
196 /**
197 * @brief Called when the Application Service Platform (ASP) Service is found.
198 * @since_tizen 4.0
199 * @remarks @a service_mac, @a instance_name and @a service_info are valid only in the callback.
200 * To use outside the callback, make a copy.
201 * @param[in] error_code     The error code. \n
202 *                           #ASP_ERROR_NONE              Successful\n
203 *                           #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
204 *                           #ASP_ERROR_OPERATION_FAILED  Operation failed\n
205 * @param[in] seek_service   The seek service which found the current result;
206 *                           the handle to the same object for which the search was started
207 * @param[in] service_mac    The P2P device address of the device which provides the service;
208 *                           NULL if not available
209 * @param[in] adv_id         The service advertisement ID defined by remote P2P device
210 * @param[in] config_method  The preferred Wi-Fi Simple Config (WSC) configuration method
211 * @param[in] instance_name  The advertised service name defined by the remote P2P device;
212 *                           NULL if not available
213 * @param[in] service_info   The advertised service information defined by the remote P2P device;
214 *                           NULL if not available
215 * @param[in] info_size      The advertised service information payload size;
216 *                           if the information is not available, this is set to -1
217 * @param[in] status         The status of the service
218 * @param[in] user_data      The user data passed from the callback registration function
219 * @pre The callback must be registered using asp_seek_set_search_result_cb().\n
220 * asp_seek_start() must be called to invoke this callback.
221 * @see asp_seek_set_search_result_cb()
222 * @see asp_seek_unset_search_result_cb()
223 * @see asp_seek_start()
224 */
225 typedef void (*asp_seek_search_result_cb) (int error_code,
226                                            asp_seek_service_h seek_service,
227                                            const char *service_mac,
228                                            unsigned int adv_id,
229                                            asp_wps_type_e config_method,
230                                            const char *instance_name,
231                                            const char *service_info,
232                                            int info_size,
233                                            unsigned char status,
234                                            void *user_data);
235
236 /**
237 * @brief Called when the status of an advertisement to a service is changed.
238 * @since_tizen 4.0
239 * @param[in] adv_service  The service whose status has changed;
240 *                         the handle to the same object for which the callback was set
241 * @param[in] status       The status of the service
242 * @param[in] reason       The reason of the state change
243 * @param[in] user_data    The user data passed from the callback registration function
244 * @pre The callback must be registered using asp_advert_set_status_cb().\n
245 * asp_advert_start_advertising() and asp_change_service_state() invoke this callback.
246 * @see asp_advert_set_status_changed_cb()
247 * @see asp_advert_unset_status_changed_cb()
248 * @see asp_advert_start_advertising()
249 */
250 typedef void (*asp_advert_status_changed_cb) (asp_advert_service_h adv_service,
251                                               asp_service_status_e status,
252                                               asp_advert_status_reason_e reason,
253                                               void *user_data);
254
255 /**
256 * @brief Called when a remote device is attempting to initiate an ASP session.
257 * @since_tizen 4.0
258 * @remarks @a network_config_pin, @a device_name and @a info are valid only in the callback.
259 * To use outside the callback, make a copy.
260 * @param[in] error_code              The error code.\n
261 *                                    #ASP_ERROR_NONE              Successful\n
262 *                                    #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
263 *                                    #ASP_ERROR_OPERATION_FAILED  Operation failed\n
264 * @param[in] adv_service             Service descriptor handle provided by the asp_advert_create()
265 *                                    it is the "original" object not created specifically for the callback
266 * @param[in] session                 The session for which the request is made;
267 *                                    the handle to the same object for which the callback was set
268 * @param[in] device_name             Device name of the remote peer
269 * @param[in] info                    The service-specific data payload (up to 144 bytes);
270 *                                    NULL if not available
271 * @param[in] info_size               The service-specific data payload size (up to 144)
272 * @param[in] get_network_config_pin  (@c true = requires WSC PIN to be entered by
273 *                                    the asp_session_confirm(),
274 *                                    @c false = does not require PIN)
275 * @param[in] network_config_pin      The WSC PIN value to be displayed; NULL if not available
276 * @param[in] user_data               The user data passed from the callback registration function
277 * @pre The callback must be registered using asp_session_set_request_cb().
278 * @see asp_session_set_request_cb()
279 */
280 typedef void (*asp_session_request_cb) (int error_code,
281                                         asp_advert_service_h adv_service,
282                                         asp_session_h session,
283                                         const char *device_name,
284                                         const char *info,
285                                         int info_size,
286                                         bool get_network_config_pin,
287                                         const char *network_config_pin,
288                                         void *user_data);
289
290 /**
291 * @brief Called when the Application Service Platform (ASP) has to provide
292 * a PIN value or collect a PIN value.
293 * @since_tizen 4.0
294 * @remarks @a config_pin is valid only in the callback.
295 * To use outside the callback, make a copy.
296 * @param[in] error_code  The error code.\n
297 *                        #ASP_ERROR_NONE              Successful\n
298 *                        #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
299 *                        #ASP_ERROR_OPERATION_FAILED  Operation failed\n
300 * @param[in] session     The session for which the request is made;
301 *                        the handle to the same object for which the callback was set
302 * @param[in] get_pin     (@c true = instruct the user to enter the PIN,
303 *                        @c false = display the PIN provided in the @a config_pin parameter)
304 * @param[in] config_pin  The WSC PIN value used for setting up; ignored if @a get_pin is @c true
305 * @param[in] user_data   The user data passed from the callback registration function
306 * @pre The callback must be registered using asp_session_set_config_request_cb().\n
307 * asp_session_connect() must be called to invoke this callback.
308 * @see asp_session_set_request_cb()
309 * @see asp_session_connect()
310 */
311 typedef void (*asp_session_config_request_cb) (int error_code,
312                                                asp_session_h session,
313                                                bool get_pin,
314                                                const char *config_pin,
315                                                void *user_data);
316
317 /**
318 * @brief Called when the Application Service Platform (ASP) reports progress on group formation.
319 * @since_tizen 4.0
320 * @remarks @a deferred_resp is valid only in the callback.
321 * To use outside the callback, make a copy.
322 * @param[in] error_code     The error code.\n
323 *                           #ASP_ERROR_NONE              Successful\n
324 *                           #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
325 *                           #ASP_ERROR_OPERATION_FAILED  Operation failed\n
326 * @param[in] session        The session for which progress is reported;
327 *                           the handle to the same object for which the callback was set
328 * @param[in] status         The connection progress status
329 * @param[in] deferred_resp  The service-specific data payload up to 144 bytes
330 * @param[in] resp_size      The service-specific data payload size(up to 144)
331 * @param[in] user_data      The user data passed from the callback registration function
332 * @pre The callback must be registered using asp_session_set_connect_status_cb()
333 * @see asp_session_set_connect_status_cb()
334 */
335 typedef void (*asp_session_connect_status_cb) (int error_code,
336                                                asp_session_h session,
337                                                asp_connect_status_e status,
338                                                const char *deferred_resp,
339                                                int resp_size,
340                                                void *user_data);
341
342 /**
343 * @brief Called when the Application Service Platform (ASP) reports the state and status of an ASP session.
344 * @since_tizen 4.0
345 * @remarks @a additional_info is valid only in the callback.
346 * To use outside the callback, make a copy.
347 * @param[in] error_code       The error code.\n
348 *                             #ASP_ERROR_NONE              Successful\n
349 *                             #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
350 *                             #ASP_ERROR_OPERATION_FAILED  Operation failed\n
351 * @param[in] session          The session for which status is reported;
352 *                             the handle to the same object for which the callback was set
353 * @param[in] state            The session state
354 * @param[in] additional_info  Additional information related to the SessionStatus event
355 * @param[in] user_data        The user data passed from the callback registration function
356 * @pre The callback must be registered using asp_session_set_status_cb()
357 * @see asp_session_set_status_cb()
358 */
359 typedef void (*asp_session_status_cb) (int error_code,
360                                        asp_session_h session,
361                                        asp_session_state_e state,
362                                        const char *additional_info,
363                                        void *user_data);
364
365 /**
366 * @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.
367 * @since_tizen 4.0
368 * @remarks @a ip_address is valid only in the callback.
369 * To use outside the callback, make a copy.
370 * @param[in] error_code   The error code.\n
371 *                         #ASP_ERROR_NONE              Successful\n
372 *                         #ASP_ERROR_OUT_OF_MEMORY     Out of memory\n
373 *                         #ASP_ERROR_OPERATION_FAILED  Operation failed\n
374 * @param[in] session      Application Service Platform session descriptor handle
375 * @param[in] ip_address   The IP address for the port, local or remote
376 * @param[in] port         The port number
377 * @param[in] proto        The IANA protocol number
378 * @param[in] status       The port status
379 * @param[in] user_data    The user data passed from the callback registration function
380 * @pre The callback must be registered using asp_session_set_port_status_cb()
381 * @see asp_set_session_port_status_cb()
382 */
383 typedef void (*asp_session_port_status_cb) (int error_code,
384                                             asp_session_h session,
385                                             const char *ip_address,
386                                             int port,
387                                             int proto,
388                                             asp_port_status_e status,
389                                             void *user_data);
390
391 /**
392  * @brief Initializes Application Service Platform (ASP).
393  * @since_tizen 4.0
394  * @return 0 on success, otherwise a negative error value.
395  * @retval #ASP_ERROR_NONE                  Successful
396  * @retval #ASP_ERROR_RESOURCE_BUSY         Device or resource busy
397  * @retval #ASP_ERROR_NOT_SUPPORTED         Not supported
398  * @retval #ASP_ERROR_COMMUNICATION_FAILED  Communication failed
399  * @retval #ASP_ERROR_OPERATION_FAILED      Operation failed
400  * @see asp_deinitialize()
401  */
402 int asp_initialize(void);
403
404 /**
405  * @brief Deinitializes Application Service Platform (ASP).
406  * @since_tizen 4.0
407  * @privilege http://tizen.org/privilege/wifidirect
408  * @return 0 on success, otherwise a negative error value.
409  * @retval #ASP_ERROR_NONE                  Successful
410  * @retval #ASP_ERROR_NOT_PERMITTED         Operation not permitted
411  * @retval #ASP_ERROR_NOT_SUPPORTED         Not supported
412  * @retval #ASP_ERROR_NOT_INITIALIZED       Not initialized
413  * @retval #ASP_ERROR_COMMUNICATION_FAILED  Communication failed
414  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
415  * @see asp_initialize()
416  */
417 int asp_deinitialize(void);
418
419 /**
420  * @brief Registers the callback function that will be invoked when a service found.
421  * @since_tizen 4.0
422  * @param[in] cb         The callback function to invoke
423  * @param[in] user_data  The user data passed from the callback registration function
424  * @return 0 on success, otherwise a negative error value
425  * @retval #ASP_ERROR_NONE               Successful
426  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
427  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
428  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
429  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
430  * @post asp_search_result_cb will be called under certain conditions,
431  * after calling asp_seek_start()
432  * @see asp_initialize()
433  * @see asp_seek_unset_search_result_cb()
434  * @see asp_seek_start()
435  */
436 int asp_seek_set_search_result_cb(asp_seek_search_result_cb cb, void *user_data);
437
438 /**
439  * @brief Unregisters the callback function that will invoked when a service found.
440  * @since_tizen 4.0
441  * @return 0 on success, otherwise a negative error value
442  * @retval #ASP_ERROR_NONE             Successful
443  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
444  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
445  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
446  * @see asp_initialize()
447  * @see asp_seek_set_search_result_cb()
448  */
449 int asp_seek_unset_search_result_cb(void);
450
451 /**
452  * @brief Registers the callback function that will invoked when the status of an advertisement to a service is changed.
453  * @since_tizen 4.0
454  * @param[in] cb         The callback function to invoke
455  * @param[in] user_data  The user data passed from the callback registration function
456  * @return 0 on success, otherwise a negative error value
457  * @retval #ASP_ERROR_NONE               Successful
458  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
459  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
460  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
461  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
462  * @post asp_seek_search_result_cb() will be called under certain conditions,
463  * after calling asp_seek_start()
464  * @see asp_initialize()
465  * @see asp_advert_unset_status_changed_cb()
466  * @see asp_advert_start_advertising()
467  */
468 int asp_advert_set_status_changed_cb(asp_advert_status_changed_cb cb,
469                                            void *user_data);
470
471 /**
472  * @brief Unregisters the callback function that will invoked when the status of an advertisement to a service is changed.
473  * @since_tizen 4.0
474  * @return 0 on success, otherwise a negative error value
475  * @retval #ASP_ERROR_NONE             Successful
476  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
477  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
478  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
479  * @see asp_initialize()
480  * @see asp_advert_set_status_changed_cb()
481  */
482 int asp_advert_unset_status_changed_cb(void);
483
484 /**
485  * @brief Registers the callback called when ASP session connection is requested.
486  * @since_tizen 4.0
487  * @param[in] cb         The callback function to invoke
488  * @param[in] user_data  The user data passed from the callback registration function
489  * @return 0 on success, otherwise a negative error value
490  * @retval #ASP_ERROR_NONE               Successful
491  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
492  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
493  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
494  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
495  * @see asp_initialize()
496  * @see asp_session_unset_request_cb()
497  */
498 int asp_session_set_request_cb(asp_session_request_cb cb, void *user_data);
499
500 /**
501  * @brief Unregisters the callback called ASP when session connection is requested.
502  * @since_tizen 4.0
503  * @return 0 on success, otherwise a negative error value
504  * @retval #ASP_ERROR_NONE             Successful
505  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
506  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
507  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
508  * @see asp_initialize()
509  * @see asp_session_set_request_cb()
510  */
511 int asp_session_unset_request_cb(void);
512
513 /**
514  * @brief Registers the callback called when the session configuration is requested.
515  * @since_tizen 4.0
516  * @param[in] cb         The callback function to invoke
517  * @param[in] user_data  The user data passed from the callback registration function
518  * @return 0 on success, otherwise a negative error value
519  * @retval #ASP_ERROR_NONE               Successful
520  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
521  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
522  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
523  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
524  * @see asp_initialize()
525  * @see asp_session_unset_config_request_cb()
526  * @see asp_session_config_request_cb()
527  */
528 int asp_session_set_config_request_cb(asp_session_config_request_cb cb,
529                                       void *user_data);
530
531 /**
532  * @brief Unregisters the callback called when the session configuration is requested.
533  * @since_tizen 4.0
534  * @return 0 on success, otherwise a negative error value
535  * @retval #ASP_ERROR_NONE             Successful
536  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
537  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
538  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
539  * @see asp_initialize()
540  * @see asp_session_config_request_cb()
541  */
542 int asp_session_unset_config_request_cb(void);
543
544 /**
545  * @brief Registers the callback called when the state of the session connection is changed.
546  * @since_tizen 4.0
547  * @param[in] cb         The callback function to invoke
548  * @param[in] user_data  The user data passed from the callback registration function
549  * @return 0 on success, otherwise a negative error value
550  * @retval #ASP_ERROR_NONE               Successful
551  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
552  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
553  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
554  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
555  * @see asp_initialize()
556  * @see asp_session_unset_connection_status_changed_cb()
557  * @see asp_session_connect_status_cb()
558  */
559 int asp_session_set_connect_status_cb(asp_session_connect_status_cb cb, void *user_data);
560
561 /**
562  * @brief Unregisters the callback called when the state of the session connection is changed.
563  * @since_tizen 4.0
564  * @return 0 on success, otherwise a negative error value
565  * @retval #ASP_ERROR_NONE             Successful
566  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
567  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
568  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
569  * @see asp_initialize()
570  * @see asp_session_set_connection_status_changed_cb()
571  */
572 int asp_session_unset_connect_status_cb(void);
573
574 /**
575  * @brief Registers the callback called when the state of the session is changed.
576  * @since_tizen 4.0
577  * @param[in] cb         The callback function to invoke
578  * @param[in] user_data  The user data passed from the callback registration function
579  * @return 0 on success, otherwise a negative error value
580  * @retval #ASP_ERROR_NONE               Successful
581  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
582  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
583  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
584  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
585  * @see asp_initialize()
586  * @see asp_session_unset_status_cb()
587  * @see asp_session_status_cb()
588  */
589 int asp_session_set_status_cb(asp_session_status_cb cb, void *user_data);
590
591 /**
592  * @brief Unregisters the callback called when the state of the session is changed.
593  * @since_tizen 4.0
594  * @return 0 on success, otherwise a negative error value
595  * @retval #ASP_ERROR_NONE             Successful
596  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
597  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
598  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
599  * @see asp_initialize()
600  * @see asp_session_set_status_cb()
601  */
602 int asp_session_unset_status_cb(void);
603
604 /**
605  * @brief Registers the callback called when the state of the port is changed.
606  * @since_tizen 4.0
607  * @param[in] cb         The callback function to invoke
608  * @param[in] user_data  The user data passed from the callback registration function
609  * @return 0 on success, otherwise a negative error value
610  * @retval #ASP_ERROR_NONE               Successful
611  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
612  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
613  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
614  * @see asp_initialize()
615  * @see asp_session_unset_status_cb()
616  */
617 int asp_session_set_port_status_cb(asp_session_port_status_cb cb, void *user_data);
618
619 /**
620  * @brief Unregisters the callback called when the state of the port is changed.
621  * @since_tizen 4.0
622  * @return 0 on success, otherwise a negative error value
623  * @retval #ASP_ERROR_NONE             Successful
624  * @retval #ASP_ERROR_NOT_SUPPORTED    Not supported
625  * @retval #ASP_ERROR_NOT_INITIALIZED  Not initialized
626  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
627  * @see asp_initialize()
628  * @see asp_session_set_port_status_cb()
629  */
630 int asp_session_unset_port_status_cb(void);
631
632 /**
633  * @brief Creates the description of a service to be advertised.
634  * @since_tizen 4.0
635  * @remarks The @a adv_service should be released using asp_advert_destroy().
636  * @param[in] instance_name  Service instance name of a service type to be advertised.
637  *                           The length of this parameter be 63 byte or less and
638  *                           encoding shall be single-byte or multi-byte UTF-8 characters.
639  *                           If you want to advertise one of the original P2PS defined services,
640  *                           this shall be NULL.
641  * @param[out] adv_service   service descriptor handle
642  * @return 0 on success, otherwise a negative error value
643  * @retval #ASP_ERROR_NONE               Successful
644  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
645  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
646  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
647  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
648  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
649  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
650  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
651  * @see asp_advert_destroy()
652  */
653 int asp_advert_create(char *instance_name, asp_advert_service_h *adv_service);
654
655 /**
656  * @brief Destroys the description of a service to be advertised.
657  * @details If asp_advert_start_advertising() was called for a service,
658  * asp_advert_stop_advertising() should be called for it before destroying it.
659  * @since_tizen 4.0
660  * @param[in] adv_service Service descriptor handle provided by the asp_advert_create()
661  * @return 0 on success, otherwise a negative error value
662  * @retval #ASP_ERROR_NONE               Successful
663  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
664  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
665  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
666  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
667  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
668  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
669  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
670  * @pre This API needs asp_create_service() before use
671  * @see asp_advert_create()
672  */
673 int asp_advert_destroy(asp_advert_service_h adv_service);
674
675 /**
676  * @brief Sets the service type for a service to be advertised.
677  * @details Application should set service type after creating service using
678  * asp_advert_create() and before advertising service using
679  * asp_advert_start_advertising().
680  * @since_tizen 4.0
681  * @param[in] adv_service   Service descriptor handle provided by the asp_advert_create()
682  * @param[in]               service_type  The unique type of a particular service.
683  *                          this shall be at least 1 character and no more than 15 characters long
684  *                          contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and
685  *                          'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45)
686  *                          contain at least one letter ('A' - 'Z' or 'a' - â€˜z')
687  *                          not begin or end with a hyphen. If you want to advertise one of the
688  *                          original P2PS defined services, this means service name.
689  * @return 0 on success, otherwise a negative error value
690  * @retval #ASP_ERROR_NONE               Successful
691  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
692  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
693  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
694  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
695  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
696  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
697  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
698  * @pre This API needs asp_advert_create() before use
699  * @see asp_advert_create()
700  */
701 int asp_advert_set_service_type(asp_advert_service_h adv_service,
702                                             char *service_type);
703
704 /**
705  * @brief Sets auto accept for a service to be advertised.
706  * @details Application should set service auto accept after creating service using
707  * asp_advert_create() and before advertising service using
708  * asp_advert_start_advertising().
709  * @since_tizen 4.0
710  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
711  * @param[in] auto_accept  Enables/Disables auto accept based on the value TRUE/FALSE
712  * @return 0 on success, otherwise a negative error value
713  * @retval #ASP_ERROR_NONE               Successful
714  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
715  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
716  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
717  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
718  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
719  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
720  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
721  * @pre This API needs asp_advert_create() before use
722  * @see asp_advert_create()
723  */
724 int asp_advert_set_auto_accept(asp_advert_service_h adv_service,
725                                bool auto_accept);
726
727 /**
728  * @brief Adds the information for a service to be advertised.
729  * @details Application should set service information after creating service using
730  * asp_advert_create() and before advertising service using
731  * asp_advert_start_advertising().
732  * @since_tizen 4.0
733  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
734  * @param[in] key          Service-defined key data specified in Section 6 of RFC6763
735  * @param[in] value        Service-defined value data specified in Section 6 of RFC6763
736  *                         Only one value can be added for a given key. If a value is set for a key,
737  *                         and another value was set for the key before, the old value will be
738  *                         overwritten with the new one.
739  * @return 0 on success, otherwise a negative error value
740  * @retval #ASP_ERROR_NONE               Successful
741  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
742  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
743  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
744  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
745  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
746  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
747  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
748  * @pre This API needs asp_advert_create() before use
749  * @see asp_advert_create()
750  */
751 int asp_advert_add_info(asp_advert_service_h adv_service,
752                             const char *key, const char *value);
753
754
755 /**
756  * @brief Sets the information for a service to be advertised.
757  * @details Application should set service information after creating service using
758  * asp_advert_create() and before advertising service using
759  * asp_advert_start_advertising().
760  * @since_tizen 4.0
761  * @remarks @a value should not be freed.
762  * It is recommended to make a copy of it to use.
763  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
764  * @param[in] key          Service-defined key data specified in Section 6 of RFC6763
765  * @param[in] length       Length of service-defined value data specified in Section 6 of RFC6763
766  * @param[in] value        Service-defined value data specified in Section 6 of RFC6763
767  * @return 0 on success, otherwise a negative error value
768  * @retval #ASP_ERROR_NONE               Successful
769  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
770  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
771  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
772  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
773  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
774  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
775  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
776  * @pre This API needs asp_advert_create() before use
777  * @see asp_advert_create()
778  */
779 int asp_advert_get_info(asp_advert_service_h adv_service, const char *key,
780                         int *length, char **value);
781
782
783 /**
784  * @brief Sets the information for a service to be advertised.
785  * @details Application should set service information after creating service using
786  * asp_advert_create() and before advertising service using
787  * asp_advert_start_advertising().
788  * @since_tizen 4.0
789  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
790  * @param[in] key          Service-defined key data specified to be removed
791  * @return 0 on success, otherwise a negative error value
792  * @retval #ASP_ERROR_NONE               Successful
793  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
794  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
795  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
796  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
797  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
798  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
799  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
800  * @pre This API needs asp_advert_create() before use
801  * @see asp_advert_create()
802  */
803 int asp_advert_remove_info(asp_advert_service_h adv_service, const char *key);
804
805 /**
806  * @brief Sets the status for a service to be advertised.
807  * @details Application should set service status after creating service using
808  * asp_advert_create() and before advertising service using
809  * asp_advert_start_advertising().
810  * @since_tizen 4.0
811  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
812  * @param[in] status       Status of the service:
813  *                         (@c 1 = available to use, @c 0 = not available to use,
814  *                         @c 2-255 = service specific information)
815  * @return 0 on success, otherwise a negative error value
816  * @retval #ASP_ERROR_NONE               Successful
817  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
818  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
819  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
820  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
821  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
822  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
823  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
824  * @pre This API needs asp_advert_create() before use
825  * @see asp_advert_create()
826  */
827 int asp_advert_set_status(asp_advert_service_h adv_service,
828                           unsigned char status);
829
830
831 /**
832  * @brief Sets the discovery mechanism for a service to be advertised.
833  * @details Application should set discovery mechanism after creating service using
834  * asp_advert_create() and before advertising service using
835  * asp_advert_start_advertising().
836  * @since_tizen 4.0
837  * @param[in] adv_service     Service descriptor handle provided by the asp_advert_create()
838  * @param[in] discovery_tech  The discovery mechanism; values of
839  *                            #asp_discovery_tech_e combined with bitwise 'or'
840  * @return 0 on success, otherwise a negative error value
841  * @retval #ASP_ERROR_NONE               Successful
842  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
843  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
844  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
845  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
846  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
847  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
848  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
849  * @pre This API needs asp_advert_create() before use
850  * @see asp_advert_create()
851  */
852 int asp_advert_set_discovery_tech(asp_advert_service_h adv_service, int discovery_tech);
853
854 /**
855  * @brief Sets the preferred connection for a service to be advertised.
856  * @details Application should set preferred connection after creating service using
857  * asp_advert_create() and before advertising service using
858  * asp_advert_start_advertising().
859  * @since_tizen 4.0
860  * @param[in] adv_service           Service descriptor handle provided by the asp_advert_create()
861  * @param[in] preferred_connection  The preferred connection
862  * @return 0 on success, otherwise a negative error value
863  * @retval #ASP_ERROR_NONE               Successful
864  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
865  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
866  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
867  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
868  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
869  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
870  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
871  * @pre This API needs asp_advert_create() before use
872  * @see asp_advert_create()
873  */
874 int asp_advert_set_preferred_connection(asp_advert_service_h adv_service,
875                                         unsigned char preferred_connection);
876
877 /**
878  * @brief Sets the Wi-Fi P2P role for a service to be advertised.
879  * @details Application should set role after creating service using
880  * asp_advert_create() and before advertising service using
881  * asp_advert_start_advertising().
882  * @since_tizen 4.0
883  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
884  * @param[in] role         The role of the service: \n
885  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n
886  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_GO  - The receiving interface should assume \n
887  *                         the GO role, if it's not possible, #ASP_ERROR_NETWORK_ROLE_REJECTED \n
888  *                         is returned \n
889  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_GC  -
890  *                         The receiving interface should assume the GC role
891  * @return 0 on success, otherwise a negative error value
892  * @retval #ASP_ERROR_NONE                   Successful
893  * @retval #ASP_ERROR_NOT_PERMITTED          Operation not permitted
894  * @retval #ASP_ERROR_OUT_OF_MEMORY          Out of memory
895  * @retval #ASP_ERROR_INVALID_PARAMETER      Invalid parameter
896  * @retval #ASP_ERROR_NOT_SUPPORTED          Not supported
897  * @retval #ASP_ERROR_NOT_INITIALIZED        Not initialized
898  * @retval #ASP_ERROR_OPERATION_FAILED       Operation failed
899  * @retval #ASP_ERROR_SERVICE_NOT_FOUND      Service not found
900  * @retval #ASP_ERROR_NETWORK_ROLE_REJECTED  Network role rejected
901  * @pre This API needs asp_advert_create() before use
902  * @see asp_advert_create()
903  */
904 int asp_advert_set_p2p_role_scheme(asp_advert_service_h adv_service,
905                                    asp_advert_p2p_role_scheme_e role);
906
907 /**
908  * @brief Gets the Wi-Fi P2P role for a service to be advertised.
909  * @details Application should Get role after creating service using
910  * asp_advert_create() and before advertising service using
911  * asp_advert_start_advertising().
912  * @since_tizen 4.0
913  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
914  * @param[in] role         The role of the service: \n
915  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n
916  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_GO  - The receiving interface should assume \n
917  *                         the GO role \n
918  *                         #ASP_ADVERT_P2P_ROLE_SCHEME_GC  -
919  *                         The receiving interface should assume the GC role
920  * @return 0 on success, otherwise a negative error value
921  * @retval #ASP_ERROR_NONE               Successful
922  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
923  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
924  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
925  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
926  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
927  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
928  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
929  * @pre This API needs asp_advert_create() before use
930  * @see asp_advert_create()
931  */
932 int asp_advert_get_p2p_role_scheme(asp_advert_service_h adv_service,
933                                    asp_advert_p2p_role_scheme_e *role);
934
935 /**
936  * @brief Sets the P2P configuration method for a service to be advertised.
937  * @details Application should set configuration method after creating service using
938  * asp_advert_create() and before advertising service using
939  * asp_advert_start_advertising().
940  * @since_tizen 4.0
941  * @param[in] adv_service    Service descriptor handle provided by the asp_advert_create()
942  * @param[in] config_method  preferred Wi-Fi Simple Config (WSC) configuration method.
943  *                           Default value is ASP_WPS_TYPE_DEFAULT.
944  * @return 0 on success, otherwise a negative error value
945  * @retval #ASP_ERROR_NONE               Successful
946  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
947  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
948  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
949  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
950  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
951  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
952  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
953  * @pre This API needs asp_advert_create() before use
954  * @see asp_advert_create()
955  */
956 int asp_advert_set_p2p_config_method(asp_advert_service_h adv_service,
957                                      asp_wps_type_e config_method);
958 /**
959  * @brief Gets the P2P configuration method for a service to be advertised.
960  * @details Application should Get configuration method after creating service using
961  * asp_advert_create() and before advertising service using
962  * asp_advert_start_advertising().
963  * @since_tizen 4.0
964  * @param[in] adv_service    Service descriptor handle provided by the asp_advert_create()
965  * @param[in] config_method  preferred Wi-Fi Simple Config (WSC)configuration method.
966  * @return 0 on success, otherwise a negative error value
967  * @retval #ASP_ERROR_NONE               Successful
968  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
969  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
970  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
971  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
972  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
973  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
974  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
975  * @pre This API needs asp_advert_create() before use
976  * @see asp_advert_create()
977  */
978 int asp_advert_get_p2p_config_method(asp_advert_service_h adv_service,
979                                      asp_wps_type_e *config_method);
980
981 /**
982  * @brief Sets the service response for an advertised service.
983  * @details Application should set service response after creating service using
984  * asp_advert_create() and before advertising service using
985  * asp_advert_create().
986  * @since_tizen 4.0
987  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
988  * @param[in] rsp_info     Specified for a particular service up to 144 bytes.
989  *                         You can refer to Wi-Fi Peer-to-Peer Services Technical Specification,
990  *                         Wi-Fi Alliance. Available at:http://www.wi-fi.org
991  * @param[in] length       The length of @a rsp_info in bytes, maximum length is 144
992  * @return 0 on success, otherwise a negative error value
993  * @retval #ASP_ERROR_NONE               Successful
994  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
995  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
996  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
997  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
998  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
999  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1000  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1001  * @pre This API needs asp_advert_create() before use
1002  * @see asp_advert_create()
1003  */
1004 int asp_advert_set_p2p_response(asp_advert_service_h adv_service,
1005                                 char *rsp_info, int length);
1006
1007 /**
1008  * @brief Starts to advertise a service.
1009  * @details Application should start to advertise after creating service using
1010  * asp_advert_create(). If the service is being advertised, no changes can be made to it.
1011  * @since_tizen 4.0
1012  * @privlevel public
1013  * @privilege http://tizen.org/privilege/wifidirect
1014  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
1015  * @return 0 on success, otherwise a negative error value
1016  * @retval #ASP_ERROR_NONE               Successful
1017  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1018  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1019  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1020  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1021  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1022  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1023  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1024  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1025  * @pre This API needs asp_advert_create() before use
1026  * @see asp_advert_create()
1027  * @see asp_advert_stop_advertising()
1028  */
1029 int asp_advert_start_advertising(asp_advert_service_h adv_service);
1030
1031 /**
1032  * @brief Stops a service advertisement.
1033  * @details Application should cancel to advertise after advertising service using
1034  * asp_advert_start_advertising().
1035  * @since_tizen 4.0
1036  * @privlevel public
1037  * @privilege http://tizen.org/privilege/wifidirect
1038  * @param[in] adv_service  Service descriptor handle provided by the asp_advert_create()
1039  * @return 0 on success, otherwise a negative error value
1040  * @retval #ASP_ERROR_NONE               Successful
1041  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1042  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1043  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1044  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1045  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1046  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1047  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1048  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1049  * @pre This API needs asp_advert_start_advertising() before use
1050  * @see asp_advert_start_advertising()
1051  */
1052 int asp_advert_stop_advertising(asp_advert_service_h adv_service);
1053
1054 /**
1055  * @brief Changes the advertising service status.
1056  * @details Application should change the advertising service
1057  * status after advertising service using asp_advert_start_advertising().
1058  * @since_tizen 4.0
1059  * @privlevel public
1060  * @privilege http://tizen.org/privilege/wifidirect
1061  * @param[in] adv_service  Service descriptor handle provided by the asp_create_service()
1062  * @param[in] status       Status of the service:
1063  *                         (@c 1 = available to use, @c 0 = not available to use,
1064  *                         @c 2-255 = service specific information)
1065  * @return 0 on success, otherwise a negative error value
1066  * @retval #ASP_ERROR_NONE               Successful
1067  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1068  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1069  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1070  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1071  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1072  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1073  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1074  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1075  * @pre This API needs asp_advert_start_advertising() before use
1076  * @see asp_advert_start_advertising()
1077  */
1078 int asp_advert_change_service_status(asp_advert_service_h adv_service,
1079                                      unsigned char status);
1080
1081 /**
1082  * @brief Creates the description of a seek operation.
1083  * @remarks The @a seek_service should be released using asp_seek_destroy().
1084  * @since_tizen 4.0
1085  * @param[in] service_type   Service Type of a service being searched.
1086  *                           this shall be at least 1 character and no more than 15 characters long
1087  *                           contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and
1088  *                           'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or decimal 45)
1089  *                           contain at least one letter ('A' - 'Z' or 'a' - â€˜z')
1090  *                           not begin or end with a hyphen. If you want to seek one of the
1091  *                           original P2PS defined services, this means service name.
1092  * @param[out] seek_service  Service seek handle
1093  * @return 0 on success, otherwise a negative error value
1094  * @retval #ASP_ERROR_NONE               Successful
1095  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1096  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1097  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1098  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1099  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1100  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1101  * @pre Application Service Platform (ASP) must be initialized by asp_initialize().
1102  * @see asp_seek_destroy()
1103  */
1104 int asp_seek_create(char *service_type, asp_seek_service_h *seek_service);
1105
1106 /**
1107  * @brief Destroys the description of a seek operation.
1108  * @details If asp_seek_start() was called for a service,
1109  * asp_seek_stop() should be called for it before destroying it.
1110  * asp_seek_stop().
1111  * @since_tizen 4.0
1112  * @param[in] seek_service  Service seek handle provided by the asp_seek_create()
1113  * @return 0 on success, otherwise a negative error value
1114  * @retval #ASP_ERROR_NONE               Successful
1115  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1116  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1117  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1118  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1119  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1120  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1121  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1122  * @pre A seek service handle must be created with asp_seek_create().
1123  * @see asp_seek_create
1124  */
1125 int asp_seek_destroy(asp_seek_service_h seek_service);
1126
1127 /**
1128  * @brief Adds the information for a service to be sought.
1129  * @details Application should set service information after creating service using
1130  * asp_seek_create() and before seeking service using asp_seek_start().
1131  * @since_tizen 4.0
1132  * @privlevel public
1133  * @param[in] seek_service  Service descriptor handle provided by the asp_seek_create()
1134  * @param[in] key           Service-defined key data to be searched,
1135  *                          specified in Section 6 of RFC6763
1136  * @return 0 on success, otherwise a negative error value
1137  * @retval #ASP_ERROR_NONE               Successful
1138  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1139  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1140  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1141  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1142  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1143  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1144  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1145  * @pre This API needs asp_seek_create() before use
1146  * @see asp_seek_create()
1147  */
1148 int asp_seek_add_info(asp_seek_service_h seek_service, const char *key);
1149
1150 /**
1151  * @brief Removes the information for a service to be sought.
1152  * @details Application should set service information after creating service using
1153  * asp_seek_create() and before seeking service using asp_seek_start().
1154  * @since_tizen 4.0
1155  * @param[in] seek_service  Service descriptor handle provided by the asp_seek_create()
1156  * @param[in] key           Service-defined key data to be searched,
1157  *                          specified in Section 6 of RFC6763
1158  * @return 0 on success, otherwise a negative error value
1159  * @retval #ASP_ERROR_NONE               Successful
1160  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1161  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1162  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1163  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1164  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1165  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1166  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1167  * @pre This API needs asp_seek_create() before use
1168  * @see asp_seek_create()
1169  */
1170 int asp_seek_remove_info(asp_seek_service_h seek_service, const char *key);
1171
1172 /**
1173  * @brief Sets the discovery mechanism for a service to be sought.
1174  * @details Application should set service information after creating service using
1175  * asp_seek_create() and before seeking service using asp_seek_start().
1176  * @since_tizen 4.0
1177  * @param[in] adv_service     Service descriptor handle provided by the asp_seek_create()
1178  * @param[in] discovery_tech  The discovery mechanism, values of
1179  *                            #asp_discovery_tech_e combined with bitwise 'or'
1180  * @return 0 on success, otherwise a negative error value
1181  * @retval #ASP_ERROR_NONE               Successful
1182  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1183  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1184  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1185  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1186  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1187  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1188  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1189  * @pre This API needs asp_seek_create() before use
1190  * @see asp_seek_create()
1191  */
1192 int asp_seek_set_discovery_tech(asp_seek_service_h seek_service, int discovery_tech);
1193
1194 /**
1195  * @brief Sets the preferred connection for a service to be sought.
1196  * @details Application should set service information after creating service using
1197  * asp_seek_create() and before seeking service using asp_seek_start().
1198  * @since_tizen 4.0
1199  * @param[in] seek_service          Service descriptor handle provided by the asp_seek_create()
1200  * @param[in] preferred_connection  The preferred connection
1201  * @return 0 on success, otherwise a negative error value
1202  * @retval #ASP_ERROR_NONE               Successful
1203  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1204  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1205  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1206  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1207  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1208  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1209  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1210  * @pre This API needs asp_seek_create() before use
1211  * @see asp_seek_create()
1212  */
1213 int asp_seek_set_preferred_connection(asp_seek_service_h seek_service,
1214                                       unsigned char preferred_connection);
1215
1216 /**
1217  * @brief Starts to seek services on peer devices.
1218  * @details If the service is currently seeking, no changes can be made to it.
1219  * @since_tizen 4.0
1220  * @privlevel public
1221  * @privilege http://tizen.org/privilege/wifidirect
1222  * @param[in] seek_service  Service seek handle provided by the asp_seek_create()
1223  * @return 0 on success, otherwise a negative error value
1224  * @retval #ASP_ERROR_NONE               Successful
1225  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1226  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1227  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1228  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1229  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1230  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1231  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1232  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1233  * @pre A seek service handle must be created with asp_seek_create().
1234  * @see asp_seek_create()
1235  * @see asp_seek_stop()
1236  */
1237 int asp_seek_start(asp_seek_service_h seek_service);
1238
1239 /**
1240  * @brief Stops seeking services.
1241  * @details Application should cancel to seek service after searching service using
1242  * asp_seek_start().
1243  * @since_tizen 4.0
1244  * @privlevel public
1245  * @privilege http://tizen.org/privilege/wifidirect
1246  * @param[in] seek_service  Service seek handle provided by the asp_seek_create()
1247  * @return 0 on success, otherwise a negative error value
1248  * @retval #ASP_ERROR_NONE               Successful
1249  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1250  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1251  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1252  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1253  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1254  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1255  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1256  * @retval #ASP_ERROR_SERVICE_NOT_FOUND  Service not found
1257  * @pre A seek service handle must be created with asp_seek_create().
1258  * @see asp_seek_start()
1259  */
1260 int asp_seek_stop(asp_seek_service_h seek_service);
1261
1262 /**
1263  * @brief Creates a local Application Service Platform (ASP) session.
1264  * @since_tizen 4.0
1265  * @remarks The @a session should be released using asp_session_destroy().
1266  * @param[in] service_mac  P2P device address of remote P2P device provided by
1267  *                         asp_seek_search_result_cb()
1268  * @param[in] adv_id       The advertisement ID provided by
1269  *                         asp_seek_search_result_cb()
1270  * @param[in] session      ASP session descriptor handle
1271  * @return 0 on success, otherwise a negative error value
1272  * @retval #ASP_ERROR_NONE               Successful
1273  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1274  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1275  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1276  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1277  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1278  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1279  * @see asp_session_destroy()
1280  */
1281 int asp_session_create(char *service_mac, unsigned int adv_id,
1282                        asp_session_h *session);
1283
1284 /**
1285  * @brief Destroys a local Application Service Platform (ASP) session.
1286  * @details Application should create session by asp_session_create().
1287  * @since_tizen 4.0
1288  * @param[in] session  Application Service Platform session descriptor handle
1289  * @return 0 on success, otherwise a negative error value
1290  * @retval #ASP_ERROR_NONE               Successful
1291  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1292  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1293  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1294  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1295  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1296  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1297  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1298  * @pre This API needs asp_session_create() before use.
1299  * @see asp_session_create()
1300  */
1301 int asp_session_destroy(asp_session_h session);
1302
1303 /**
1304  * @brief Gets the session MAC for an Application Service Platform session.
1305  * @details Application should request to connect session by
1306  * asp_session_connect() or receive request by asp_session_request_cb().
1307  * @since_tizen 4.0
1308  * @remarks @a session_mac should not be freed.
1309  * It is recommended to make a copy of it to use.
1310  * @param[in] session       Application Service Platform session descriptor handle
1311  * @param[out] session_mac  The session MAC is the MAC address of
1312  *                          P2P device which assigned the session ID
1313  * @return 0 on success, otherwise a negative error value
1314  * @retval #ASP_ERROR_NONE               Successful
1315  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1316  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1317  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1318  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1319  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1320  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1321  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1322  * @pre This API needs asp_session_connect() before use.
1323  * @see asp_session_connect()
1324  * @see asp_session_request_cb()
1325  */
1326 int asp_session_get_mac(asp_session_h session, char **session_mac);
1327
1328 /**
1329  * @brief Gets the ID of an Application Service Platform session.
1330  * @details Application should create local session by
1331  * asp_session_create() or receive request by asp_session_request_cb().
1332  * @since_tizen 4.0
1333  * @param[in] session      Application Service Platform session descriptor handle
1334  * @param[out] session_id  The session ID
1335  * @return 0 on success, otherwise a negative error value
1336  * @retval #ASP_ERROR_NONE               Successful
1337  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1338  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1339  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1340  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1341  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1342  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1343  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1344  * @pre This API needs asp_session_create() before use.
1345  * @see asp_session_create()
1346  * @see asp_session_request_cb()
1347  */
1348 int asp_session_get_id(asp_session_h session, unsigned int *session_id);
1349
1350 /**
1351  * @brief Sets the information for an Application Service Platform session.
1352  * @details Application should set session_info after creating session by
1353  * asp_session_create() and before requesting to connect
1354  * session by asp_session_connect().
1355  * @since_tizen 4.0
1356  * @param[in] session       Application Service Platform session descriptor handle
1357  *                          provided by the asp_session_create()
1358  * @param[in] session_info  Detailed information about the session.
1359  *                          The session_info parameter is defined for each service section
1360  *                          and up to 144 bytes. You can refer to Wi-Fi Peer-to-Peer Services
1361  *                          Technical Specification, Wi-Fi Alliance.
1362  *                          Available at:http://www.wi-fi.org
1363  * @return 0 on success, otherwise a negative error value
1364  * @retval #ASP_ERROR_NONE               Successful
1365  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1366  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1367  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1368  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1369  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1370  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1371  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1372  * @pre This API needs asp_session_create() before use.
1373  * @see asp_session_create()
1374  */
1375 int asp_session_set_info(asp_session_h session, char *session_info);
1376
1377 /**
1378  * @brief Gets the information for an Application Service Platform session.
1379  * @details Application should get session_info after creating session by
1380  * asp_session_create() and before requesting to connect
1381  * session by asp_session_connect().
1382  * @since_tizen 4.0
1383  * @remarks @a session_info should not be freed.
1384  * It is recommended to make a copy of it to use.
1385  * @param[in] session        Application Service Platform session descriptor handle
1386  *                           provided by the asp_session_create()
1387  * @param[out] session_info  detailed information about session
1388  * @return 0 on success, otherwise a negative error value
1389  * @retval #ASP_ERROR_NONE               Successful
1390  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1391  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1392  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1393  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1394  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1395  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1396  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1397  * @pre This API needs asp_session_create() before use.
1398  * @see asp_session_create()
1399  */
1400 int asp_session_get_info(asp_session_h session, char **session_info);
1401
1402 /**
1403  * @brief Sets the Wi-Fi Direct group role in session.
1404  * @details Application should set role after creating session by
1405  * asp_session_create() and before requesting to connect
1406  * session by asp_session_connect().
1407  * @since_tizen 4.0
1408  * @param[in] session  Application Service Platform session descriptor handle
1409  *                     provided by the asp_session_create()
1410  * @param[in] role     The role of the service: \n
1411  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n
1412  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_GO  - The receiving interface should assume \n
1413  *                     the GO role, if it's not possible, #ASP_ERROR_NETWORK_ROLE_REJECTED \n
1414  *                     is returned \n
1415  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_GC  -
1416  *                     The receiving interface should assume the GC role
1417  * @return 0 on success, otherwise a negative error value
1418  * @retval #ASP_ERROR_NONE                  Successful
1419  * @retval #ASP_ERROR_NOT_PERMITTED         Operation not permitted
1420  * @retval #ASP_ERROR_OUT_OF_MEMORY         Out of memory
1421  * @retval #ASP_ERROR_INVALID_PARAMETER     Invalid parameter
1422  * @retval #ASP_ERROR_NOT_SUPPORTED         Not supported
1423  * @retval #ASP_ERROR_NOT_INITIALIZED       Not initialized
1424  * @retval #ASP_ERROR_OPERATION_FAILED      Operation failed
1425  * @retval #ASP_ERROR_SESSION_NOT_FOUND     Session not found
1426  * @retval #ASP_ERROR_NETWORK_ROLE_REJECTED Network role rejected
1427  * @pre This API needs asp_create_service() before use.
1428  * @see asp_create_session()
1429  */
1430 int asp_session_set_p2p_role_scheme(asp_session_h session,
1431                                     asp_advert_p2p_role_scheme_e role);
1432
1433 /**
1434  * @brief Gets the Wi-Fi Direct group role in session.
1435  * @since_tizen 4.0
1436  * @param[in] session  Application Service Platform session descriptor handle
1437  *                     provided by the asp_session_create()
1438  * @param[in] role     The role of the service: \n
1439  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_ANY - All roles are acceptable \n
1440  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_GO  - The receiving interface should assume \n
1441  *                     the GO role\n
1442  *                     #ASP_ADVERT_P2P_ROLE_SCHEME_GC  -
1443  *                     The receiving interface should assume the GC role
1444  * @return 0 on success, otherwise a negative error value
1445  * @retval #ASP_ERROR_NONE               Successful
1446  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1447  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1448  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1449  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1450  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1451  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1452  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1453  * @pre This API needs asp_session_create() before use.
1454  * @see asp_session_create()
1455  */
1456 int asp_session_get_p2p_role_scheme(asp_session_h session,
1457                                     asp_advert_p2p_role_scheme_e *role);
1458
1459 /**
1460  * @brief Sets the Preferred WSC Configuration method.
1461  * @details Application should set the config method after creating session by
1462  * asp_session_create() and before requesting to connect
1463  * session by asp_session_connect().
1464  * @since_tizen 4.0
1465  * @param[in] session        Application Service Platform session descriptor handle
1466  *                           provided by the asp_session_create()
1467  * @param[in] config_method  Preferred WSC Configuration method.
1468  *                           Default value is #ASP_WPS_TYPE_DEFAULT.
1469  * @return 0 on success, otherwise a negative error value
1470  * @retval #ASP_ERROR_NONE               Successful
1471  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1472  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1473  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1474  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1475  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1476  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1477  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1478  * @pre This API needs asp_session_create() before use.
1479  * @see asp_session_create()
1480  */
1481 int asp_session_set_p2p_config_method(asp_session_h session,
1482                                       asp_wps_type_e config_method);
1483
1484 /**
1485  * @brief Gets the Preferred WSC Configuration method.
1486  * @since_tizen 4.0
1487  * @param[in] session         Application Service Platform session descriptor handle
1488  *                            provided by the asp_session_create()
1489  * @param[out] config_method  Preferred WSC Configuration method
1490  * @return 0 on success, otherwise a negative error value
1491  * @retval #ASP_ERROR_NONE               Successful
1492  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1493  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1494  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1495  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1496  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1497  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1498  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1499  * @pre This API needs asp_session_create() before use.
1500  * @see asp_session_create()
1501  */
1502 int asp_session_get_p2p_config_method(asp_session_h session,
1503                                       asp_wps_type_e *config_method);
1504
1505 /**
1506  * @brief Gets the session close status.
1507  * @details This call is valid only for closed sessions (sessions in the #ASP_SESSION_STATE_CLOSED
1508  *          state). If the @a session does not identify a closed session,
1509  *          #ASP_ERROR_NOT_PERMITTED is returned.
1510  * @since_tizen 4.0
1511  * @param[in] session  ASP session descriptor handle provided by
1512  *                     the asp_session_request_cb() callback,
1513  *                     asp_session_create(), or asp_session_get_handle()
1514  * @param[out] status  The session close status
1515  * @return 0 on success, otherwise a negative error value
1516  * @retval #ASP_ERROR_NONE               Successful
1517  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1518  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1519  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1520  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1521  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1522  */
1523 int asp_session_get_close_status(asp_session_h session, int *status);
1524
1525 /**
1526  * @brief Starts to connect the Application Service Platform session.
1527  * @since_tizen 4.0
1528  * @privlevel public
1529  * @privilege http://tizen.org/privilege/wifidirect
1530  * @param[in] session  Application Service Platform session descriptor handle
1531  * @return 0 on success, otherwise a negative error value
1532  * @retval #ASP_ERROR_NONE               Successful
1533  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1534  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1535  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1536  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1537  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1538  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1539  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1540  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1541  * @pre This API needs asp_session_create() before use.
1542  * @see asp_session_create()
1543  */
1544 int asp_session_connect(asp_session_h session);
1545
1546 /**
1547  * @brief Confirms the Application Service Platform(ASP) session request.
1548  * @since_tizen 4.0
1549  * @privlevel public
1550  * @privilege http://tizen.org/privilege/wifidirect
1551  * @param[in] session    ASP session descriptor handle provided by
1552  *                       the asp_session_request_cb() callback or
1553  *                       asp_session_create() if pin is requested.
1554  * @param[in] confirmed  (@c true = confirm session, @c false = reject session)
1555  * @param[in] pin        If session requests the WSC PIN
1556  * @return 0 on success, otherwise a negative error value
1557  * @retval #ASP_ERROR_NONE               Successful
1558  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1559  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1560  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1561  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1562  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1563  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1564  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1565  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1566  * @see asp_advert_start_advertising()
1567  * @see asp_session_create()
1568  */
1569 int asp_session_confirm(asp_session_h session, bool confirmed, char *pin);
1570
1571 /**
1572  * @brief Gets the Description of Application Service Platform (ASP) session to be connected.
1573  * @since_tizen 4.0
1574  * @param[in] session_mac  The MAC address of the P2P device that assigned
1575  *                         the value of session_id, as provided by
1576  *                         the asp_session_request_cb() callback or
1577  *                         asp_session_create() if pin is requested.
1578  * @param[in] session_id   The session ID
1579  * @param[out] session     Peer-to-Peer service session descriptor handle
1580  * @return 0 on success, otherwise a negative error value
1581  * @retval #ASP_ERROR_NONE               Successful
1582  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1583  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1584  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1585  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1586  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1587  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1588  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1589  * @see asp_session_create()
1590  */
1591 int asp_session_get_handle(char *session_mac, unsigned int session_id,
1592                            asp_session_h *session);
1593
1594 /**
1595  * @brief Moves an Application Service Platform (ASP) session from Requested state to the Open state.
1596  * @since_tizen 4.0
1597  * @param[in] session  ASP session descriptor handle provided by
1598  *                     the asp_session_request_cb() callback
1599  * @return 0 on success, otherwise a negative error value
1600  * @retval #ASP_ERROR_NONE               Successful
1601  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1602  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1603  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1604  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1605  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1606  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1607  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1608  * @pre Peer-to-Peer service must be advertised by asp_advert_start_advertising().\n
1609  * Local device should be listening or finding remote P2P device by
1610  * asp_advert_start_advertising()
1611  * @see asp_advert_start_advertising()
1612  */
1613 int asp_session_set_state_ready(asp_session_h session);
1614
1615 /**
1616  * @brief Ends an Application Service Platform (ASP) session and releases associated resources.
1617  * @details The ASP may tear down the underlying ASP P2P group
1618  * if not other ASP sessions are using it.
1619  * @since_tizen 4.0
1620  * @privlevel public
1621  * @privilege http://tizen.org/privilege/wifidirect
1622  * @param[in] session  ASP session descriptor handle provided by
1623  *                     the asp_session_request_cb() callback or
1624  *                     asp_session_create()
1625  * @return 0 on success, otherwise a negative error value
1626  * @retval #ASP_ERROR_NONE               Successful
1627  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1628  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1629  * @retval #ASP_ERROR_PERMISSION_DENIED  Permission denied
1630  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1631  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1632  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1633  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1634  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1635  * @see asp_session_create()
1636  * @see asp_session_request_cb()
1637  */
1638 int asp_session_close(asp_session_h session);
1639
1640 /**
1641  * @brief Requests that incoming connections be allowed on a given port.
1642  * @since_tizen 4.0
1643  * @param[in] session     ASP session descriptor handle provided by
1644  *                        the asp_session_request_cb() callback or
1645  *                        asp_session_create()
1646  * @param[in] ip_address  The IP address on which the port is being used
1647  * @param[in] port        The port number
1648  * @param[in] proto       The IANA protocol number
1649  * @return 0 on success, otherwise a negative error value
1650  * @retval #ASP_ERROR_NONE               Successful
1651  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1652  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1653  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1654  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1655  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1656  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1657  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1658  * @see asp_session_create()
1659  * @see asp_session_request_cb()
1660  */
1661 int asp_session_bind_port(asp_session_h session, char *ip_address,
1662                           int port, int proto);
1663
1664 /**
1665  * @brief Indicates that the service is no longer utilizing the port in the ASP session.
1666  * @since_tizen 4.0
1667  * @param[in] session     ASP session descriptor handle provided by
1668  *                        the asp_session_request_cb() callback or
1669  *                        asp_session_create()
1670  * @param[in] ip_address  The IP address on which the port is being used
1671  * @param[in] port        The port number
1672  * @param[in] proto       The IANA protocol number
1673  * @return 0 on success, otherwise a negative error value
1674  * @retval #ASP_ERROR_NONE               Successful
1675  * @retval #ASP_ERROR_NOT_PERMITTED      Operation not permitted
1676  * @retval #ASP_ERROR_OUT_OF_MEMORY      Out of memory
1677  * @retval #ASP_ERROR_INVALID_PARAMETER  Invalid parameter
1678  * @retval #ASP_ERROR_NOT_SUPPORTED      Not supported
1679  * @retval #ASP_ERROR_NOT_INITIALIZED    Not initialized
1680  * @retval #ASP_ERROR_OPERATION_FAILED   Operation failed
1681  * @retval #ASP_ERROR_SESSION_NOT_FOUND  Session not found
1682  * @see asp_session_create()
1683  * @see asp_session_request_cb()
1684  */
1685 int asp_session_release_port(asp_session_h session, char *ip_address,
1686                              int port, int proto);
1687
1688 /**
1689  * @}
1690  */
1691
1692 #ifdef __cplusplus
1693 }
1694 #endif
1695
1696 #endif /* __TIZEN_NET_ASP_H__ */
1697