Merge "Change dbus service name for mobileap-agent and add test case for getting...
[platform/core/api/tethering.git] / include / tethering.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_NETWORK_TETHERING_H__
18 #define __TIZEN_NETWORK_TETHERING_H__
19
20 #include <tizen.h>
21 #include <time.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file tethering.h
29  */
30
31 /**
32  * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
33  * @{
34  */
35
36 /**
37  * @brief The tethering handle.
38  * @since_tizen 2.3
39  */
40 typedef void * tethering_h;
41
42 /**
43  * @brief Enumeration for the tethering.
44  * @since_tizen 2.3
45  */
46 typedef enum {
47     TETHERING_ERROR_NONE = TIZEN_ERROR_NONE,  /**< Successful */
48     TETHERING_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED,  /**< Operation not permitted */
49     TETHERING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
50     TETHERING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,  /**< Out of memory */
51     TETHERING_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,  /**< Resource busy */
52     TETHERING_ERROR_NOT_ENABLED = TIZEN_ERROR_TETHERING | 0x0501,  /**< Not enabled */
53     TETHERING_ERROR_OPERATION_FAILED = TIZEN_ERROR_TETHERING | 0x0502,  /**< Operation failed */
54     TETHERING_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
55     TETHERING_ERROR_NOT_SUPPORT_API = TIZEN_ERROR_NOT_SUPPORTED, /**< API is not supported */
56     TETHERING_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,  /**< Permission denied */
57 } tethering_error_e;
58
59 /**
60  * @brief Enumeration for the type of tethering.
61  * @since_tizen 2.3
62  */
63 typedef enum {
64     TETHERING_TYPE_ALL = 0,  /**< All type except for TETHERING_TYPE_RESERVED */
65     TETHERING_TYPE_USB,  /**< USB type */
66     TETHERING_TYPE_WIFI,  /**< Wi-Fi type */
67     TETHERING_TYPE_BT,  /**< BT type */
68     TETHERING_TYPE_RESERVED,  /**< Reserved type */
69 } tethering_type_e;
70
71 /**
72  * @brief Enumeration for the cause of disabling the tethering.
73  * @since_tizen 2.3
74  */
75 typedef enum
76 {
77     TETHERING_DISABLED_BY_USB_DISCONNECTION = 0,  /**< Disabled due to usb disconnection */
78     TETHERING_DISABLED_BY_FLIGHT_MODE,  /**< Disabled due to flight mode */
79     TETHERING_DISABLED_BY_LOW_BATTERY,  /**< Disabled due to low battery */
80     TETHERING_DISABLED_BY_NETWORK_CLOSE,  /**< Disabled due to pdp network close */
81     TETHERING_DISABLED_BY_TIMEOUT,  /**< Disabled due to timeout */
82     TETHERING_DISABLED_BY_OTHERS,  /**< Disabled by other apps */
83     TETHERING_DISABLED_BY_REQUEST,  /**< Disabled by your request */
84     TETHERING_DISABLED_BY_WIFI_ON,  /**< Disabled due to Wi-Fi on */
85     TETHERING_DISABLED_BY_BT_OFF,  /**< Disabled due to Bluetooth off */
86 } tethering_disabled_cause_e;
87
88 /**
89  * @}
90  */
91
92
93 /**
94  * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
95  * @{
96  */
97
98 /**
99  * @brief Enumeration for the Wi-Fi security.
100  * @since_tizen 2.3
101  */
102 typedef enum {
103     TETHERING_WIFI_SECURITY_TYPE_NONE = 0,  /**< No Security type */
104     TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK,  /**< WPA2_PSK */
105 } tethering_wifi_security_type_e;
106
107 /**
108   * @brief Enumeration for the Wi-Fi mode
109   * @since_tizen 3.0
110   */
111 typedef enum {
112         TETHERING_WIFI_MODE_TYPE_B = 0,  /**< mode b */
113         TETHERING_WIFI_MODE_TYPE_G,  /**< mode g */
114         TETHERING_WIFI_MODE_TYPE_A,  /**< mode a */
115         TETHERING_WIFI_MODE_TYPE_AD, /**< mode ad */
116 } tethering_wifi_mode_type_e;
117
118 /**
119  * @}
120  */
121
122
123 /**
124  * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
125  * @{
126  */
127
128 /**
129  * @brief The tethering client handle.
130  * @since_tizen 2.3
131  */
132 typedef void * tethering_client_h;
133
134 /**
135  * @brief Enumeration for address family.
136  * @since_tizen 2.3
137  */
138 typedef enum {
139     TETHERING_ADDRESS_FAMILY_IPV4 = 0,  /**< IPV4 Address type */
140 } tethering_address_family_e;
141
142 /**
143  * @}
144  */
145
146
147 /**
148  * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
149  * @{
150  */
151
152 /**
153  * @brief Called when the tethering is enabled.
154  * @since_tizen 2.3
155  * @param[in]  result  The result of enabling the tethering
156  * @param[in]  type  The tethering type
157  * @param[in]  is_requested  Indicates whether this change is requested
158  * @param[in]  user_data  The user data passed from tethering_set_enabled_cb()
159  * @pre  If you register callback function using tethering_set_enabled_cb(), this will be invoked when the tethering is enabled.
160  * @see tethering_enable()
161  * @see tethering_unset_enabled_cb()
162  */
163 typedef void (*tethering_enabled_cb)(tethering_error_e result, tethering_type_e type, bool is_requested, void *user_data);
164
165 /**
166  * @brief Called when the tethering is disabled.
167  * @since_tizen 2.3
168  * @param[in]  result  The result of disabling the tethering
169  * @param[in]  type  The tethering type
170  * @param[in]  cause  The cause of disabling
171  * @param[in]  user_data  The user data passed from tethering_set_disabled_cb()
172  * @pre  If you register callback function using tethering_set_disabled_cb(), this will be invoked when the tethering is disabled.
173  * @see tethering_set_disabled_cb()
174  * @see tethering_unset_disabled_cb()
175  */
176 typedef void (*tethering_disabled_cb)(tethering_error_e result, tethering_type_e type, tethering_disabled_cause_e cause, void *user_data);
177
178 /**
179  * @brief Called when the connection state is changed.
180  * @since_tizen 2.3
181  * @remarks @a client is valid only in this function. In order to use it outside this function, a user must copy the client with tethering_client_clone().
182  * @param[in]  client  The client of which connection state is changed
183  * @param[in]  opened  @c true when connection is opened, otherwise false
184  * @param[in]  user_data  The user data passed from tethering_set_connection_state_changed_cb()
185  * @pre  If you register callback function using tethering_set_connection_state_changed_cb(), this will be invoked when the connection state is changed.
186  * @see tethering_set_connection_state_changed_cb()
187  * @see tethering_unset_connection_state_changed_cb()
188  */
189 typedef void (*tethering_connection_state_changed_cb)(tethering_client_h client, bool opened, void *user_data);
190
191 /**
192  * @brief Called when you get the connected client repeatedly.
193  * @since_tizen 2.3
194  * @remarks @a client is valid only in this function. In order to use the client outside this function, a user must copy the client with tethering_client_clone().
195  * @param[in]  client  The connected client
196  * @param[in]  user_data  The user data passed from the request function
197  * @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
198  * @pre  tethering_foreach_connected_clients() will invoke this callback.
199  * @see  tethering_foreach_connected_clients()
200  */
201 typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *user_data);
202
203 /**
204  * @brief Called when you get the data usage.
205  * @since_tizen 2.3
206  * @param[in]  result  The result of getting the data usage
207  * @param[in]  received_data  The usage of received data
208  * @param[in]  sent_data  The usage of sent data
209  * @param[in]  user_data  The user data passed from the request function
210  * @pre  tethering_get_data_usage() will invoked this callback.
211  */
212 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
213
214 /**
215  * @brief Called when the security type of Wi-Fi tethering is changed.
216  * @since_tizen 2.3
217  * @param[in]  changed_type  The changed security type of Wi-Fi tethering
218  * @param[in]  user_data  The user data passed from the register function
219  * @see tethering_wifi_set_security_type_changed_cb()
220  * @see tethering_wifi_unset_security_type_changed_cb()
221  */
222 typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
223
224 /**
225  * @brief Called when the visibility of SSID is changed.
226  * @since_tizen 2.3
227  * @param[in]  changed_visible  The changed visibility of SSID
228  * @param[in]  user_data  The user data passed from the register function
229  * @see tethering_wifi_set_ssid_visibility_changed_cb()
230  * @see tethering_wifi_unset_ssid_visibility_changed_cb()
231  */
232 typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
233
234 /**
235  * @brief Called when the passphrase of Wi-Fi tethering is changed.
236  * @since_tizen 2.3
237  * @param[in]  user_data  The user data passed from the register function
238  * @see tethering_wifi_set_passphrase_changed_cb()
239  * @see tethering_wifi_unset_passphrase_changed_cb()
240  */
241 typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
242
243 /**
244  * @brief Called when the settings are reloaded.
245  * @since_tizen 2.3
246  * @param[in]  result  The result of reloading the settings
247  * @param[in]  user_data  The user data passed from the request function
248  * @pre  tethering_wifi_reload_settings() will invoke this callback.
249  */
250 typedef void (*tethering_wifi_settings_reloaded_cb)(tethering_error_e result, void *user_data);
251
252 /**
253  * @brief Called when Wi-Fi AP settings are reloaded.
254  * @since_tizen 2.3
255  * @param[in]  result  The result of reloading the settings
256  * @param[in]  user_data  The user data passed from the request function
257  * @pre  tethering_wifi_ap_reload_settings() will invoke this callback.
258  */
259 typedef void (*tethering_wifi_ap_settings_reloaded_cb)(tethering_error_e result, void *user_data);
260
261 /**
262  * @brief Creates the handle for tethering.
263  * @since_tizen 2.3
264  * @privlevel platform
265  * @privilege %http://tizen.org/privilege/tethering.admin
266  * @remarks The @a tethering must be released using tethering_destroy().
267  * @param[out]  tethering  A handle of a new mobile ap handle on success
268  * @return  0 on success, otherwise a negative error value
269  * @retval  #TETHERING_ERROR_NONE  Successful
270  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
271  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
272  * @retval  #TETHERING_ERROR_NOT_SUPPORT_API  API is not supported
273  * @see  tethering_destroy()
274  */
275 int tethering_create(tethering_h *tethering);
276
277 /**
278  * @brief Destroys the handle for tethering.
279  * @since_tizen 2.3
280  * @privlevel platform
281  * @privilege %http://tizen.org/privilege/tethering.admin
282  * @param[in]  tethering  The tethering handle
283  * @return  0 on success, otherwise a negative error value
284  * @retval  #TETHERING_ERROR_NONE  Successful
285  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
286  * @see  tethering_create()
287  */
288 int tethering_destroy(tethering_h tethering);
289
290 /**
291  * @brief Enables the tethering, asynchronously.
292  * @since_tizen 2.3
293  * @privlevel platform
294  * @privilege %http://tizen.org/privilege/tethering.admin
295  * @param[in]  tethering  The tethering handle
296  * @param[in]  type  The tethering type
297  * @return 0 on success, otherwise negative error value
298  * @retval  #TETHERING_ERROR_NONE  Successful
299  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
300  * @post tethering_enabled_cb() will be invoked.
301  * @see  tethering_is_enabled()
302  * @see  tethering_disable()
303  */
304 int tethering_enable(tethering_h tethering, tethering_type_e type);
305
306 /**
307  * @brief Disables the tethering, asynchronously.
308  * @since_tizen 2.3
309  * @privlevel platform
310  * @privilege %http://tizen.org/privilege/tethering.admin
311  * @param[in]  tethering  The tethering handle
312  * @param[in]  type  The tethering type
313  * @return 0 on success, otherwise negative error value
314  * @retval  #TETHERING_ERROR_NONE  Successful
315  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
316  * @post tethering_disabled_cb() will be invoked.
317  * @see  tethering_is_enabled()
318  * @see  tethering_enable()
319  */
320 int tethering_disable(tethering_h tethering, tethering_type_e type);
321
322 /**
323  * @brief Checks whether the tethering is enabled or not.
324  * @since_tizen 2.3
325  * @privlevel platform
326  * @privilege %http://tizen.org/privilege/tethering.admin
327  * @param[in]  tethering  The tethering handle
328  * @param[in]  type  The tethering type
329  * @return  @c true if tethering is enabled, \n @c false if tethering is disabled
330  */
331 bool tethering_is_enabled(tethering_h tethering, tethering_type_e type);
332
333 /**
334  * @brief Gets the MAC address of local device as "FC:A1:3E:D6:B1:B1".
335  * @since_tizen 2.3
336  * @privlevel platform
337  * @privilege %http://tizen.org/privilege/tethering.admin
338  * @remarks @a mac_address must be released using free().
339  * @param[in]  tethering  The tethering handle
340  * @param[in]  type  The tethering type
341  * @param[out]  mac_address  The MAC address
342  * @return  0 on success, otherwise a negative error value
343  * @retval  #TETHERING_ERROR_NONE  Successful
344  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
345  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
346  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
347  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
348  * @pre  The tethering must be enabled.
349  * @see  tethering_is_enabled()
350  * @see  tethering_enable()
351  */
352 int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address);
353
354 /**
355  * @brief Gets the name of network interface (e.g. usb0).
356  * @since_tizen 2.3
357  * @privlevel platform
358  * @privilege %http://tizen.org/privilege/tethering.admin
359  * @remarks @a interface_name must be released using free().
360  * @param[in]  tethering  The tethering handle
361  * @param[in]  type  The tethering type
362  * @param[out]  interface_name  The name of the network interface
363  * @return 0 on success, otherwise negative error value
364  * @retval  #TETHERING_ERROR_NONE  Successful
365  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
366  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
367  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
368  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
369  * @pre  The tethering must be enabled.
370  * @see  tethering_is_enabled()
371  * @see  tethering_enable()
372  */
373 int tethering_get_network_interface_name(tethering_h tethering, tethering_type_e type, char **interface_name);
374
375 /**
376  * @brief Gets the local IP address.
377  * @since_tizen 2.3
378  * @privlevel platform
379  * @privilege %http://tizen.org/privilege/tethering.admin
380  * @remarks @a ip_address must be released using free().
381  * @param[in]  tethering  The tethering handle
382  * @param[in]  type  The tethering type
383  * @param[in]  address_family  The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
384  * @param[out]  ip_address  The local IP address
385  * @return 0 on success, otherwise negative error value
386  * @retval  #TETHERING_ERROR_NONE  Successful
387  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
388  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
389  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
390  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
391  * @pre  The tethering must be enabled.
392  * @see  tethering_is_enabled()
393  * @see  tethering_enable()
394  */
395 int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address);
396
397 /**
398  * @brief Gets the Gateway address.
399  * @since_tizen 2.3
400  * @privlevel platform
401  * @privilege %http://tizen.org/privilege/tethering.admin
402  * @remarks @a gateway_address must be released using free().
403  * @param[in]  tethering  The tethering handle
404  * @param[in]  type  The tethering type
405  * @param[in]  address_family  The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
406  * @param[out]  gateway_address  The local IP address
407  * @return 0 on success, otherwise negative error value
408  * @retval  #TETHERING_ERROR_NONE  Successful
409  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
410  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
411  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
412  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
413  * @pre  The tethering must be enabled.
414  * @see  tethering_is_enabled()
415  * @see  tethering_enable()
416  */
417 int tethering_get_gateway_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **gateway_address);
418
419 /**
420  * @brief Gets the Subnet Mask.
421  * @since_tizen 2.3
422  * @privlevel platform
423  * @privilege %http://tizen.org/privilege/tethering.admin
424  * @remarks @a subnet_mask must be released using free().
425  * @param[in]  tethering  The tethering handle
426  * @param[in]  type  The tethering type
427  * @param[in]  address_family  The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
428  * @param[out]  subnet_mask  The local IP address
429  * @return 0 on success, otherwise negative error value
430  * @retval  #TETHERING_ERROR_NONE  Successful
431  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
432  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
433  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
434  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
435  * @pre  The tethering must be enabled.
436  * @see  tethering_is_enabled()
437  * @see  tethering_enable()
438  */
439 int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask);
440
441 /**
442  * @brief Gets the data usage.
443  * @since_tizen 2.3
444  * @privlevel platform
445  * @privilege %http://tizen.org/privilege/tethering.admin
446  * @param[in]  tethering  The tethering handle
447  * @param[out]  usage  The data usage
448  * @return 0 on success, otherwise negative error value
449  * @retval  #TETHERING_ERROR_NONE  Successful
450  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
451  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
452  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
453  * @pre  The tethering must be enabled.
454  * @see  tethering_is_enabled()
455  * @see  tethering_enable()
456  */
457 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
458
459 /**
460  * @brief Gets the clients which are connected.
461  * @since_tizen 2.3
462  * @privlevel platform
463  * @privilege %http://tizen.org/privilege/tethering.admin
464  * @param[in]  tethering  The tethering handle
465  * @param[in]  type  The tethering type
466  * @param[in]  callback  The callback function to invoke
467  * @param[in]  user_data  The user data to be passed to the callback function
468  * @retval  #TETHERING_ERROR_NONE  Successful
469  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
470  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
471  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
472  * @pre  The tethering must be enabled.
473  * @see  tethering_is_enabled()
474  * @see  tethering_enable()
475  */
476 int tethering_foreach_connected_clients(tethering_h tethering, tethering_type_e type, tethering_connected_client_cb callback, void *user_data);
477
478 /**
479  * @brief Registers the callback function, which is called when tethering is enabled.
480  * @since_tizen 2.3
481  * @privlevel platform
482  * @privilege %http://tizen.org/privilege/tethering.admin
483  * @param[in]  tethering  The tethering handle
484  * @param[in]  type  The tethering type
485  * @param[in]  callback  The callback function to invoke
486  * @param[in]  user_data  The user data to be passed to the callback function
487  * @retval  #TETHERING_ERROR_NONE  Successful
488  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
489  * @see  tethering_unset_enabled_cb()
490  */
491 int tethering_set_enabled_cb(tethering_h tethering, tethering_type_e type, tethering_enabled_cb callback, void *user_data);
492
493 /**
494  * @brief Unregisters the callback function, which is called when tethering is enabled.
495  * @since_tizen 2.3
496  * @privlevel platform
497  * @privilege %http://tizen.org/privilege/tethering.admin
498  * @param[in]  tethering  The tethering handle
499  * @param[in]  type  The tethering type
500  * @retval  #TETHERING_ERROR_NONE  Successful
501  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
502  * @see  tethering_set_enabled_cb()
503  */
504 int tethering_unset_enabled_cb(tethering_h tethering, tethering_type_e type);
505
506 /**
507  * @brief Registers the callback function called when tethering is disabled.
508  * @since_tizen 2.3
509  * @privlevel platform
510  * @privilege %http://tizen.org/privilege/tethering.admin
511  * @param[in]  tethering  The tethering handle
512  * @param[in]  type  The tethering type
513  * @param[in]  callback  The callback function to invoke
514  * @param[in]  user_data  The user data to be passed to the callback function
515  * @retval  #TETHERING_ERROR_NONE  Successful
516  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
517  * @see  tethering_unset_disabled_cb()
518  */
519 int tethering_set_disabled_cb(tethering_h tethering, tethering_type_e type, tethering_disabled_cb callback, void *user_data);
520
521 /**
522  * @brief Unregisters the callback function, which is called when tethering is disabled.
523  * @since_tizen 2.3
524  * @privlevel platform
525  * @privilege %http://tizen.org/privilege/tethering.admin
526  * @param[in]  tethering  The tethering handle
527  * @param[in]  type  The tethering type
528  * @retval  #TETHERING_ERROR_NONE  Successful
529  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
530  * @see  tethering_set_disabled_cb()
531  */
532 int tethering_unset_disabled_cb(tethering_h tethering, tethering_type_e type);
533
534 /**
535  * @brief Registers the callback function, which is called when the state of connection is changed.
536  * @since_tizen 2.3
537  * @privlevel platform
538  * @privilege %http://tizen.org/privilege/tethering.admin
539  * @param[in]  tethering  The tethering handle
540  * @param[in]  type  The tethering type
541  * @param[in]  callback  The callback function to invoke
542  * @param[in]  user_data  The user data to be passed to the callback function
543  * @retval  #TETHERING_ERROR_NONE  Successful
544  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
545  * @see  tethering_unset_connection_state_changed_cb_cb()
546  */
547 int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_type_e type, tethering_connection_state_changed_cb callback, void *user_data);
548
549 /**
550  * @brief Unregisters the callback function, which is called when the state of connection is changed.
551  * @since_tizen 2.3
552  * @privlevel platform
553  * @privilege %http://tizen.org/privilege/tethering.admin
554  * @param[in]  tethering  The tethering handle
555  * @param[in]  type  The tethering type
556  * @retval  #TETHERING_ERROR_NONE  Successful
557  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
558  * @see  tethering_set_connection_state_changed_cb()
559  */
560 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
561
562 /**
563  * @brief Registers the callback function, which is called when the security type of Wi-Fi tethering is changed.
564  * @since_tizen 2.3
565  * @privlevel platform
566  * @privilege %http://tizen.org/privilege/tethering.admin
567  * @param[in]  tethering  The tethering handle
568  * @param[in]  callback  The callback function to invoke
569  * @param[in]  user_data  The user data to be passed to the callback function
570  * @retval  #TETHERING_ERROR_NONE  Successful
571  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
572  * @see  tethering_wifi_unset_security_type_changed_cb()
573  */
574 int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
575
576 /**
577  * @brief Unregisters the callback function, which is called when the security type of Wi-Fi tethering is changed.
578  * @since_tizen 2.3
579  * @privlevel platform
580  * @privilege %http://tizen.org/privilege/tethering.admin
581  * @param[in]  tethering  The tethering handle
582  * @param[in]  type  The tethering type
583  * @retval  #TETHERING_ERROR_NONE  Successful
584  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
585  * @see  tethering_wifi_set_security_type_changed_cb()
586  */
587 int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
588
589 /**
590  * @brief Registers the callback function , which iscalled when the visibility of SSID is changed.
591  * @since_tizen 2.3
592  * @privlevel platform
593  * @privilege %http://tizen.org/privilege/tethering.admin
594  * @param[in]  tethering  The tethering handle
595  * @param[in]  callback  The callback function to invoke
596  * @param[in]  user_data  The user data to be passed to the callback function
597  * @retval  #TETHERING_ERROR_NONE  Successful
598  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
599  * @see  tethering_wifi_unset_ssid_visibility_changed_cb_cb()
600  */
601 int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
602
603 /**
604  * @brief Unregisters the callback function, which is called when the visibility of SSID is changed.
605  * @since_tizen 2.3
606  * @privlevel platform
607  * @privilege %http://tizen.org/privilege/tethering.admin
608  * @param[in]  tethering  The tethering handle
609  * @retval  #TETHERING_ERROR_NONE  Successful
610  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
611  * @see  tethering_wifi_set_ssid_visibility_changed_cb()
612  */
613 int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
614
615 /**
616  * @brief Registers the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
617  * @since_tizen 2.3
618  * @privlevel platform
619  * @privilege %http://tizen.org/privilege/tethering.admin
620  * @param[in]  tethering  The tethering handle
621  * @param[in]  callback  The callback function to invoke
622  * @param[in]  user_data  The user data to be passed to the callback function
623  * @retval  #TETHERING_ERROR_NONE  Successful
624  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
625  * @see  tethering_wifi_unset_passphrase_changed_cb()
626  */
627 int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
628
629 /**
630  * @brief Unregisters the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
631  * @since_tizen 2.3
632  * @privlevel platform
633  * @privilege %http://tizen.org/privilege/tethering.admin
634  * @param[in]  tethering  The tethering handle
635  * @retval  #TETHERING_ERROR_NONE  Successful
636  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
637  * @see  tethering_wifi_set_passphrase_changed_cb()
638  */
639 int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
640
641 /**
642  * @}
643  */
644
645
646 /**
647  * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
648  * @{
649  */
650
651 /**
652  * @brief Sets the security type of Wi-Fi tethering.
653  * @since_tizen 2.3
654  * @privlevel platform
655  * @privilege %http://tizen.org/privilege/tethering.admin
656  * @remarks This change is applied next time Wi-Fi tethering is enabled.
657  * @param[in]  tethering  The tethering handle
658  * @param[in]  type  The security type
659  * @return 0 on success, otherwise negative error value
660  * @retval  #TETHERING_ERROR_NONE  Successful
661  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
662  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
663  * @see  tethering_wifi_get_security_type()
664  */
665 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
666
667 /**
668  * @brief Gets the security type of Wi-Fi tethering.
669  * @since_tizen 2.3
670  * @privlevel platform
671  * @privilege %http://tizen.org/privilege/tethering.admin
672  * @param[in]  tethering  The tethering handle
673  * @param[out]  type  The security type
674  * @return 0 on success, otherwise negative error value
675  * @retval  #TETHERING_ERROR_NONE  Successful
676  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
677  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
678  * @see  tethering_wifi_set_security_type()
679  */
680 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
681
682 /**
683  * @brief Sets the SSID (service set identifier).
684  * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
685  * @since_tizen 2.3
686  * @privlevel platform
687  * @privilege %http://tizen.org/privilege/tethering.admin
688  * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle.
689  * @param[in]  tethering  The tethering handle
690  * @param[in]  ssid  The SSID
691  * @return 0 on success, otherwise negative error value
692  * @retval  #TETHERING_ERROR_NONE  Successful
693  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
694  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
695  */
696 int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
697
698 /**
699  * @brief Gets the SSID (service set identifier).
700  * @since_tizen 2.3
701  * @privlevel platform
702  * @privilege %http://tizen.org/privilege/tethering.admin
703  * @remarks @a ssid must be released using free().
704  * @param[in]  tethering  The tethering handle
705  * @param[out]  ssid  The SSID
706  * @return 0 on success, otherwise negative error value
707  * @retval  #TETHERING_ERROR_NONE  Successful
708  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
709  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
710  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
711  */
712 int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
713
714 /**
715  * @brief Sets the visibility of SSID (service set identifier).
716  * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan will not find the device.
717  * @since_tizen 2.3
718  * @privlevel platform
719  * @privilege %http://tizen.org/privilege/tethering.admin
720  * @remarks This change is applied next time Wi-Fi tethering is enabled.
721  * @param[in]  tethering  The tethering handle
722  * @param[in]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
723  * @return 0 on success, otherwise negative error value
724  * @retval  #TETHERING_ERROR_NONE  Successful
725  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
726  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
727  * @see  tethering_wifi_get_ssid_visibility()
728  */
729 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
730
731 /**
732  * @brief Gets the visibility of SSID (service set identifier).
733  * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan will not find the device.
734  * @since_tizen 2.3
735  * @privlevel platform
736  * @privilege %http://tizen.org/privilege/tethering.admin
737  * @param[in]  tethering  The tethering handle
738  * @param[out]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
739  * @return 0 on success, otherwise negative error value
740  * @retval  #TETHERING_ERROR_NONE  Successful
741  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
742  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
743  * @see  tethering_wifi_set_ssid_visibility()
744  */
745 int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
746
747 /**
748  * @brief Sets the passphrase.
749  * @since_tizen 2.3
750  * @privlevel platform
751  * @privilege %http://tizen.org/privilege/tethering.admin
752  * @remarks This change is applied next time Wi-Fi tethering is enabled.
753  * @param[in]  tethering  The tethering handle
754  * @param[in]  passphrase  The passphrase
755  * @return 0 on success, otherwise negative error value
756  * @retval  #TETHERING_ERROR_NONE  Successful
757  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
758  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
759  * @see  tethering_wifi_get_passphrase()
760  */
761 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
762
763 /**
764  * @brief Gets the passphrase.
765  * @since_tizen 2.3
766  * @privlevel platform
767  * @privilege %http://tizen.org/privilege/tethering.admin
768  * @remarks @a passphrase must be released using free().
769  * @param[in]  tethering  The tethering handle
770  * @param[out]  passphrase  The passphrase
771  * @return 0 on success, otherwise negative error value
772  * @retval  #TETHERING_ERROR_NONE  Successful
773  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
774  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
775  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
776  * @see  tethering_wifi_set_passphrase()
777  */
778 int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase);
779
780 /**
781  * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility).
782  * @since_tizen 2.3
783  * @privlevel platform
784  * @privilege %http://tizen.org/privilege/tethering.admin
785  * @remarks Connected devices via Wi-Fi tethering or MobileAP will be disconnected when the settings are reloaded.
786  * @param[in]  tethering  The tethering handle
787  * @param[in]  callback  The callback function to invoke
788  * @param[in]  user_data  The user data to be passed to the callback function
789  * @return 0 on success, otherwise negative error value
790  * @retval  #TETHERING_ERROR_NONE  Successful
791  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
792  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
793  */
794 int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_settings_reloaded_cb callback, void *user_data);
795
796 /**
797  * @brief Gets the mac_filter for Wi-Fi Tethering.
798  * @details If you set the mac_filter to enable, then the device can be allowed/blocked based on mac-address.
799  * By default mac_filter is set to false.
800  * @since_tizen 3.0
801  * @privlevel platform
802  * @privilege %http://tizen.org/privilege/tethering.admin
803  * @param[in]  tethering  The handle of tethering
804  * @param[out]  mac_filter The mac filter: (@c true = enable, @c false = disable)
805  * @return 0 on success, otherwise negative error value.
806  * @retval  #TETHERING_ERROR_NONE  Successful
807  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
808  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
809  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
810  * @see  tethering_mobileap_set_mac_filter()
811  */
812 int tethering_wifi_get_mac_filter(tethering_h tethering, bool *mac_filter);
813
814 /**
815  * @brief Sets the mac-filter for Wi-Fi Tethering.
816  * @details If you set the mac_filter to enable, then the device can be allowed/blocked based on mac-address.
817  * By default mac_filter is set to @c false.
818  * @since_tizen 3.0
819  * @privlevel platform
820  * @privilege %http://tizen.org/privilege/tethering.admin
821  * @remarks This change is applied next time Wi-Fi tethering is enabled.
822  * @param[in]  tethering  The tethering handle
823  * @param[in]  mac_filter  The mac filter: (@c true = enable, @c false = disable)
824  * @return 0 on success, otherwise negative error value
825  * @retval  #TETHERING_ERROR_NONE  Successful
826  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
827  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
828  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
829  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
830  * @see  tethering_mobileap_get_mac_filter()
831  */
832 int tethering_wifi_set_mac_filter(tethering_h tethering, bool mac_filter);
833
834 /**
835  * @brief Adds the mac-address to the allowed client list.
836  * @details AP can allow the client by adding clients mac-address to the allowed list.
837  * @since_tizen 3.0
838  * @privlevel platform
839  * @privilege %http://tizen.org/privilege/tethering.admin
840  * @param[in]  tethering  The handle of tethering
841  * @param[in]  mac  The mac address
842  * @return 0 on success, otherwise negative error value.
843  * @retval  #TETHERING_ERROR_NONE  Successful
844  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
845  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
846  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
847  * @see  tethering_mobileap_set_mac_filter()
848  */
849 int tethering_wifi_add_allowed_mac_list(tethering_h tethering, const char *mac);
850
851 /**
852  * @brief Removes the mac-address from the allowed client list.
853  * @details Removes the mac-address from the allowed client list.
854  * @since_tizen 3.0
855  * @privlevel platform
856  * @privilege %http://tizen.org/privilege/tethering.admin
857  * @param[in]  tethering  The handle of tethering
858  * @param[in]  mac  The mac address
859  * @return 0 on success, otherwise negative error value.
860  * @retval  #TETHERING_ERROR_NONE  Successful
861  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
862  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
863  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
864  * @see  tethering_mobileap_set_mac_filter()
865  */
866 int tethering_wifi_remove_allowed_mac_list(tethering_h tethering, const char *mac);
867 /**
868  * @brief Gets the mac-addresses from the allowed client list.
869  * @details Gets the mac-addresses from the allowed client list.
870  * @since_tizen 3.0
871  * @privlevel platform
872  * @privilege %http://tizen.org/privilege/tethering.admin
873  * @param[in]  tethering  The handle of tethering
874  * @param[out]  allowed_mac_list  list of allowed mac addresses list
875  * @return 0 on success, otherwise negative error value.
876  * @retval  #TETHERING_ERROR_NONE  Successful
877  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
878  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
879  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
880  * @see  tethering_mobileap_set_mac_filter()
881  */
882 int tethering_wifi_get_allowed_mac_list(tethering_h tethering, void **allowed_mac_list);
883
884 /**
885  * @brief Adds the mac-address to the blocked(black list) client list.
886  * @details AP can disallow the client by adding clients mac-address to the blocked list.
887  * @since_tizen 3.0
888  * @privlevel platform
889  * @privilege %http://tizen.org/privilege/tethering.admin
890  * @param[in]  tethering  The handle of tethering
891  * @param[in]  mac  The mac address
892  * @return 0 on success, otherwise negative error value.
893  * @retval  #TETHERING_ERROR_NONE  Successful
894  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
895  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
896  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
897  * @see  tethering_mobileap_set_mac_filter()
898  */
899 int tethering_wifi_add_blocked_mac_list(tethering_h tethering, const char *mac);
900
901 /**
902  * @brief Removes the mac-address from the blocked(black list) client list.
903  * @details Removes the mac-address from the blocked client list.
904  * @since_tizen 3.0
905  * @privlevel platform
906  * @privilege %http://tizen.org/privilege/tethering.admin
907  * @param[in]  tethering  The handle of tethering
908  * @param[in]  mac  The mac address
909  * @return 0 on success, otherwise negative error value.
910  * @retval  #TETHERING_ERROR_NONE  Successful
911  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
912  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
913  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
914  * @see  tethering_mobileap_set_mac_filter()
915  */
916 int tethering_wifi_remove_blocked_mac_list(tethering_h tethering, const char *mac);
917
918 /**
919  * @brief Gets the mac-addresses from the blocked client list.
920  * @details Get the mac-addresses from the blocked client list.
921  * @since_tizen 3.0
922  * @privlevel platform
923  * @privilege %http://tizen.org/privilege/tethering.admin
924  * @param[in]  tethering  The handle of tethering
925  * @param[out]  blocked_mac_list  list of blocked mac addresses list
926  * @return 0 on success, otherwise negative error value.
927  * @retval  #TETHERING_ERROR_NONE  Successful
928  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
929  * @retval  #TETHERING_ERROR_NOT_SUPPORTED  API is not supported
930  * @retval  #TETHERING_ERROR_PERMISSION_DENIED  Permission Denied
931  * @see  tethering_mobileap_set_mac_filter()
932  */
933 int tethering_wifi_get_blocked_mac_list(tethering_h tethering, void **blocked_mac_list);
934
935 /**
936  * @brief Enables/disables the dhcp server.
937  * @since_tizen 3.0
938  * @privlevel platform
939  * @privilege %http://tizen.org/privilege/tethering.admin
940  * @details Enable/disable the dhcp server.
941  * @param[in]  tethering  The handle of tethering
942  * @param[in]  enable  Enable/disable the dhcp server
943  * @return 0 on success, otherwise negative error value.
944  * @retval  #TETHERING_ERROR_NONE  Successful
945  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
946  */
947 int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable);
948
949 /**
950  * @brief Enables the dhcp server with the address range.
951  * @since_tizen 3.0
952  * @privlevel platform
953  * @privilege %http://tizen.org/privilege/tethering.admin
954  * @details Enable the dhcp server with the address range.
955  * @param[in]  tethering  The handle of tethering
956  * @param[in]  rangestart Start address range
957  * @param[in]  rangestop  End address range
958  * @return 0 on success, otherwise negative error value.
959  * @retval  #TETHERING_ERROR_NONE  Successful
960  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
961  */
962 int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, char *rangestop);
963
964 /**
965  * @brief Checks whether the dhcp is enabled or not.
966  * @since_tizen 3.0
967  * @privlevel platform
968  * @privilege %http://tizen.org/privilege/tethering.admin
969  * @param[in]  tethering  The tethering handle
970  * @param[out] dhcp_enabled  @c true if dhcp is enabled, \n @c false if dhcp is disabled
971  * @return  0 on success, otherwise a negative error value
972  * @retval  #TETHERING_ERROR_NONE  Successful
973  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
974  */
975 int tethering_wifi_is_dhcp_enabled(tethering_h tethering, bool *dhcp_enabled);
976
977 /**
978  * @brief Sets the Channel for Wi-Fi.
979  * @details The Channel should be in between 1-14. If channel is not set, Wi-Fi sets default channel.
980  * @since_tizen 3.0
981  * @privlevel platform
982  * @privilege %http://tizen.org/privilege/tethering.admin
983  * @param[in]  tethering  The tethering handle
984  * @param[in]  channel  The channel number
985  * @return 0 on success, otherwise negative error value
986  * @retval  #TETHERING_ERROR_NONE  Successful
987  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
988  */
989 int tethering_wifi_set_channel(tethering_h tethering, int channel);
990
991 /**
992  * @brief Gets the channel for Wi-Fi.
993  * @details If channel is not set, Wi-Fi gets default channel.
994  * @since_tizen 3.0
995  * @privlevel platform
996  * @privilege %http://tizen.org/privilege/tethering.admin
997  * @param[in]  tethering  The tethering handle
998  * @param[out]  channel  The channel number
999  * @return 0 on success, otherwise negative error value
1000  * @retval  #TETHERING_ERROR_NONE  Successful
1001  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1002  * @see  tethering_wifi_ap_set_channel()
1003  */
1004 int tethering_wifi_get_channel(tethering_h tethering, int *channel);
1005
1006 /**
1007  * @brief Sets the mode for Wi-Fi.
1008  * @details The mobile AP mode (ex: b only, g only, ad, a). If mode is not set, Wi-Fi sets default mode.
1009  * @since_tizen 3.0
1010  * @privlevel platform
1011  * @privilege %http://tizen.org/privilege/tethering.admin
1012  * @param[in]  tethering  The tethering handle
1013  * @param[in]  type     The mobile AP mode
1014  * @return 0 on success, otherwise negative error value
1015  * @retval  #TETHERING_ERROR_NONE  Successful
1016  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1017  */
1018 int tethering_wifi_set_mode(tethering_h tethering, tethering_wifi_mode_type_e type);
1019
1020 /**
1021  * @brief Gets the mode for Wi-Fi.
1022  * @details If the mode is not set, Wi-Fi gets default mode.
1023  * @since_tizen 3.0
1024  * @privlevel platform
1025  * @privilege %http://tizen.org/privilege/tethering.admin
1026  * @remarks @a mode must be released using free().
1027  * @param[in]  tethering  The tethering handle
1028  * @param[out]  type  The mode of Wi-Fi AP
1029  * @return 0 on success, otherwise negative error value
1030  * @retval  #TETHERING_ERROR_NONE  Successful
1031  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1032  * @see  tethering_wifi_set_mode()
1033  */
1034 int tethering_wifi_get_mode(tethering_h tethering, tethering_wifi_mode_type_e *type);
1035
1036 /**
1037  * @brief Sets the security type of Wi-Fi AP.
1038  * @details If security type is not set, WPA2_PSK is used.
1039  * @since_tizen 2.3
1040  * @privlevel platform
1041  * @privilege %http://tizen.org/privilege/tethering.admin
1042  * @param[in]  tethering  The tethering handle
1043  * @param[in]  type  The security type
1044  * @return 0 on success, otherwise negative error value
1045  * @retval  #TETHERING_ERROR_NONE  Successful
1046  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1047  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
1048  * @see  tethering_wifi_ap_get_security_type()
1049  */
1050 int tethering_wifi_ap_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
1051
1052 /**
1053  * @brief Gets the security type of Wi-Fi AP.
1054  * @details If security type is not set, WPA2_PSK is used.
1055  * @since_tizen 2.3
1056  * @privlevel platform
1057  * @privilege %http://tizen.org/privilege/tethering.admin
1058  * @param[in]  tethering  The tethering handle
1059  * @param[out]  type  The security type
1060  * @return 0 on success, otherwise negative error value
1061  * @retval  #TETHERING_ERROR_NONE  Successful
1062  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1063  * @see  tethering_wifi_ap_set_security_type()
1064  */
1065 int tethering_wifi_ap_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
1066
1067 /**
1068  * @brief Sets the SSID (service set identifier) for Wi-Fi AP.
1069  * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
1070  * @since_tizen 2.3
1071  * @privlevel platform
1072  * @privilege %http://tizen.org/privilege/tethering.admin
1073  * @param[in]  tethering  The tethering handle
1074  * @param[in]  ssid  The SSID
1075  * @return 0 on success, otherwise negative error value
1076  * @retval  #TETHERING_ERROR_NONE  Successful
1077  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1078  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1079  */
1080 int tethering_wifi_ap_set_ssid(tethering_h tethering, const char *ssid);
1081
1082 /**
1083  * @brief Gets the SSID (service set identifier) for Wi-Fi AP.
1084  * @details If SSID is not set, Device name is used as SSID.
1085  * @since_tizen 2.3
1086  * @privlevel platform
1087  * @privilege %http://tizen.org/privilege/tethering.admin
1088  * @remarks @a ssid must be released using free().
1089  * @param[in]  tethering  The tethering handle
1090  * @param[out]  ssid  The SSID
1091  * @return 0 on success, otherwise negative error value
1092  * @retval  #TETHERING_ERROR_NONE  Successful
1093  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1094  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1095  */
1096 int tethering_wifi_ap_get_ssid(tethering_h tethering, char **ssid);
1097
1098 /**
1099  * @brief Sets the visibility of SSID (service set identifier) for Wi-Fi AP.
1100  * @details If you set the visibility to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
1101  * @details By default visibility is set to @c true.
1102  * @since_tizen 2.3
1103  * @privlevel platform
1104  * @privilege %http://tizen.org/privilege/tethering.admin
1105  * @remarks This change is applied next time Wi-Fi tethering is enabled.
1106  * @param[in]  tethering  The tethering handle
1107  * @param[in]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
1108  * @return 0 on success, otherwise negative error value
1109  * @retval  #TETHERING_ERROR_NONE  Successful
1110  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1111  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
1112  * @see  tethering_wifi_ap_get_ssid_visibility()
1113  */
1114 int tethering_wifi_ap_set_ssid_visibility(tethering_h tethering, bool visible);
1115
1116 /**
1117  * @brief Gets the visibility of SSID (service set identifier) for Wi-Fi AP.
1118  * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
1119  * @details By default visibility is set to @c true.
1120  * @since_tizen 2.3
1121  * @privlevel platform
1122  * @privilege %http://tizen.org/privilege/tethering.admin
1123  * @param[in]  tethering  The tethering handle
1124  * @param[out]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
1125  * @return 0 on success, otherwise negative error value
1126  * @retval  #TETHERING_ERROR_NONE  Successful
1127  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1128  * @see  tethering_wifi_ap_set_ssid_visibility()
1129  */
1130 int tethering_wifi_ap_get_ssid_visibility(tethering_h tethering, bool *visible);
1131
1132 /**
1133  * @brief Sets the passphrase for Wi-Fi AP.
1134  * @details If the passphrase is not set, random string of 8 characters will be used.
1135  * @since_tizen 2.3
1136  * @privlevel platform
1137  * @privilege %http://tizen.org/privilege/tethering.admin
1138  * @param[in]  tethering  The tethering handle
1139  * @param[in]  passphrase  The passphrase
1140  * @return 0 on success, otherwise negative error value
1141  * @retval  #TETHERING_ERROR_NONE  Successful
1142  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1143  * @see  tethering_wifi_ap_get_passphrase()
1144  */
1145 int tethering_wifi_ap_set_passphrase(tethering_h tethering, const char *passphrase);
1146
1147 /**
1148  * @brief Gets the passphrase for Wi-Fi AP.
1149  * @details If the passphrase is not set, random string of 8 characters will be used.
1150  * @since_tizen 2.3
1151  * @privlevel platform
1152  * @privilege %http://tizen.org/privilege/tethering.admin
1153  * @remarks @a passphrase must be released using free().
1154  * @param[in]  tethering  The tethering handle
1155  * @param[out]  passphrase  The passphrase
1156  * @return 0 on success, otherwise negative error value
1157  * @retval  #TETHERING_ERROR_NONE  Successful
1158  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1159  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1160  * @see  tethering_wifi_ap_set_passphrase()
1161  */
1162 int tethering_wifi_ap_get_passphrase(tethering_h tethering, char **passphrase);
1163
1164 /**
1165  * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility) for Wi-Fi AP.
1166  * @since_tizen 2.3
1167  * @privlevel platform
1168  * @privilege %http://tizen.org/privilege/tethering.admin
1169  * @remarks Devices connected via MobileAP will be disconnected when the settings are reloaded.
1170  * @param[in]  tethering  The tethering handle
1171  * @param[in]  callback  The callback function to invoke
1172  * @param[in]  user_data  The user data to be passed to the callback function
1173  * @return 0 on success, otherwise negative error value
1174  * @retval  #TETHERING_ERROR_NONE  Successful
1175  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1176  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
1177  */
1178 int tethering_wifi_ap_reload_settings(tethering_h tethering, tethering_wifi_ap_settings_reloaded_cb callback, void *user_data);
1179 /**
1180  * @}
1181  */
1182
1183
1184 /**
1185  * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
1186  * @{
1187  */
1188
1189 /**
1190  * @brief Clones the handle of a client.
1191  * @since_tizen 2.3
1192  * @privlevel platform
1193  * @privilege %http://tizen.org/privilege/tethering.admin
1194  * @remarks @a dest must be release using tethering_client_destroy().
1195  * @param[out]  dest  The cloned client handle
1196  * @param[in]  origin  The origin client handle
1197  * @return  0 on success, otherwise a negative error value
1198  * @retval  #TETHERING_ERROR_NONE  Successful
1199  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1200  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1201  * @see  tethering_client_destroy()
1202  */
1203 int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin);
1204
1205 /**
1206  * @brief Destroys the handle of a client.
1207  * @since_tizen 2.3
1208  * @privlevel platform
1209  * @privilege %http://tizen.org/privilege/tethering.admin
1210  * @param[in]  client  The client handle
1211  * @return  0 on success, otherwise a negative error value
1212  * @retval  #TETHERING_ERROR_NONE  Successful
1213  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1214  * @see  tethering_client_clone()
1215  */
1216 int tethering_client_destroy(tethering_client_h client);
1217
1218 /**
1219  * @brief  Gets the tethering type of client.
1220  * @since_tizen 2.3
1221  * @privlevel platform
1222  * @privilege %http://tizen.org/privilege/tethering.admin
1223  * @param[in]  client  The handle of client
1224  * @param[out]  type  The type of tethering
1225  * @return  0 on success, otherwise a negative error value.
1226  * @retval  #TETHERING_ERROR_NONE  Successful
1227  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1228  * @see  tethering_usb_get_connected_client()
1229  * @see  tethering_connection_state_changed_cb()
1230  */
1231 int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type);
1232
1233 /**
1234  * @brief Gets the name of a client.
1235  * @since_tizen 2.3
1236  * @privlevel platform
1237  * @privilege %http://tizen.org/privilege/tethering.admin
1238  * @remarks @a name must be released using free().
1239  * @param[in]  client  The client handle
1240  * @param[out]  name  The name of the client
1241  * @return  0 on success, otherwise a negative error value
1242  * @retval  #TETHERING_ERROR_NONE  Successful
1243  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1244  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1245  * @see  tethering_usb_get_connected_client()
1246  * @see  tethering_connection_state_changed_cb()
1247  */
1248 int tethering_client_get_name(tethering_client_h client, char **name);
1249
1250 /**
1251  * @brief Gets the IP address of a client.
1252  * @since_tizen 2.3
1253  * @privlevel platform
1254  * @privilege %http://tizen.org/privilege/tethering.admin
1255  * @remarks @a ip_address must be released using free().
1256  * @param[in]  client  The client handle
1257  * @param[in]  address_family  The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported
1258  * @param[out]  ip_address  The IP address
1259  * @return  0 on success, otherwise a negative error value
1260  * @retval  #TETHERING_ERROR_NONE  Successful
1261  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1262  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1263  * @see  tethering_usb_get_connected_client()
1264  * @see  tethering_connection_state_changed_cb()
1265  */
1266 int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address);
1267
1268 /**
1269  * @brief Gets the MAC address of a client such as "FC:A1:3E:D6:B1:B1".
1270  * @since_tizen 2.3
1271  * @privlevel platform
1272  * @privilege %http://tizen.org/privilege/tethering.admin
1273  * @remarks @a mac_address must be released using free().
1274  * @param[in]  client  The client handle
1275  * @param[out]  mac_address  The MAC address
1276  * @return  0 on success, otherwise a negative error value
1277  * @retval  #TETHERING_ERROR_NONE  Successful
1278  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1279  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
1280  * @see  tethering_usb_get_connected_client()
1281  * @see  tethering_connection_state_changed_cb()
1282  */
1283 int tethering_client_get_mac_address(tethering_client_h client, char **mac_address);
1284
1285 /**
1286  * @brief Gets the connection time of a client.
1287  * @since_tizen 2.3
1288  * @privlevel platform
1289  * @privilege %http://tizen.org/privilege/tethering.admin
1290  * @param[in] client The client handle
1291  * @param[out]  time  The connected time of the client
1292  * @return  0 on success, otherwise a negative error value
1293  * @retval  #TETHERING_ERROR_NONE  Successful
1294  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
1295  * @see  tethering_usb_get_connected_client()
1296  * @see  tethering_connection_state_changed_cb()
1297  */
1298 int tethering_client_get_time(tethering_client_h client, time_t *timestamp);
1299
1300 /**
1301  * @}
1302  */
1303
1304
1305 #ifdef __cplusplus
1306  }
1307 #endif
1308
1309 #endif /* __TIZEN_NETWORK_TETHERING_H__ */
1310
1311