Tizen 2.1 base
[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
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
28  * @{
29  */
30
31 /**
32  * @brief The handle for tethering.
33  */
34 typedef void * tethering_h;
35
36 /**
37  * @brief Enumeration for the tethering.
38  */
39 typedef enum {
40     TETHERING_ERROR_NONE = TIZEN_ERROR_NONE,  /**< Successful */
41     TETHERING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
42     TETHERING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,  /**< Out of memory */
43     TETHERING_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,  /**< Resource busy */
44     TETHERING_ERROR_NOT_ENABLED = TIZEN_ERROR_NETWORK_CLASS | 0x0501,  /**< Not enabled */
45     TETHERING_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS | 0x0502,  /**< Operation failed */
46     TETHERING_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
47 } tethering_error_e;
48
49 /**
50  * @brief Enumeration for the type of tethering.
51  */
52 typedef enum {
53     TETHERING_TYPE_ALL = 0,  /**< All type */
54     TETHERING_TYPE_USB,  /**< USB type */
55     TETHERING_TYPE_WIFI,  /**< Wi-Fi type */
56     TETHERING_TYPE_BT,  /**< BT type */
57 } tethering_type_e;
58
59 /**
60  * @brief Enumeration for the cause of disabling the tethering.
61  */
62 typedef enum
63 {
64     TETHERING_DISABLED_BY_USB_DISCONNECTION = 0,  /**< Disabled due to usb disconnection */
65     TETHERING_DISABLED_BY_FLIGHT_MODE,  /**< Disabled due to flight mode */
66     TETHERING_DISABLED_BY_LOW_BATTERY,  /**< Disabled due to low battery */
67     TETHERING_DISABLED_BY_NETWORK_CLOSE,  /**< Disabled due to pdp network close */
68     TETHERING_DISABLED_BY_TIMEOUT,  /**< Disabled due to timeout */
69     TETHERING_DISABLED_BY_MDM_ON,  /**< Disabled due to mdm on */
70     TETHERING_DISABLED_BY_OTHERS,  /**< Disabled by other apps */
71     TETHERING_DISABLED_BY_REQUEST,  /**< Disabled by your request */
72     TETHERING_DISABLED_BY_WIFI_ON,  /**< Disabled due to Wi-Fi on */
73     TETHERING_DISABLED_BY_BT_OFF,  /**< Disabled due to Bluetooth off */
74 } tethering_disabled_cause_e;
75
76 /**
77  * @}
78  */
79
80
81 /**
82  * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
83  * @{
84  */
85
86 /**
87  * @brief Enumeration for the Wi-Fi security.
88  */
89 typedef enum {
90     TETHERING_WIFI_SECURITY_TYPE_NONE = 0,  /**< No Security type */
91     TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK,  /**< WPA2_PSK */
92 } tethering_wifi_security_type_e;
93
94 /**
95  * @}
96  */
97
98
99 /**
100  * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
101  * @{
102  */
103
104 /**
105  * @brief The handle for tethering client.
106  */
107 typedef void * tethering_client_h;
108
109 /**
110  * @brief Enumerations of Address family
111  */
112 typedef enum {
113     TETHERING_ADDRESS_FAMILY_IPV4 = 0,  /**< IPV4 Address type */
114 } tethering_address_family_e;
115
116 /**
117  * @}
118  */
119
120
121 /**
122  * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
123  * @{
124  */
125
126 /**
127  * @brief  Called when the tethering is enabled.
128  * @param[in]  result  The result of enabling the tethering
129  * @param[in]  type  The type of tethering
130  * @param[in]  is_requested  Indicates whether this change is requested by you
131  * @param[in]  user_data  The user data passed from tethering_set_enabled_cb()
132  * @pre  If you register callback function using tethering_set_enabled_cb(), this will be invoked when the tethering is enabled.
133  * @see tethering_enable()
134  * @see tethering_unset_enabled_cb()
135  */
136 typedef void (*tethering_enabled_cb)(tethering_error_e result, tethering_type_e type, bool is_requested, void *user_data);
137
138 /**
139  * @brief  Called when the tethering is disabled.
140  * @param[in]  result  The result of disabling the tethering
141  * @param[in]  type  The type of tethering
142  * @param[in]  cause  The cause of disabling
143  * @param[in]  user_data  The user data passed from tethering_set_disabled_cb()
144  * @pre  If you register callback function using tethering_set_disabled_cb(), this will be invoked when the tethering is disabled.
145  * @see tethering_set_disabled_cb()
146  * @see tethering_unset_disabled_cb()
147  */
148 typedef void (*tethering_disabled_cb)(tethering_error_e result, tethering_type_e type, tethering_disabled_cause_e cause, void *user_data);
149
150 /**
151  * @brief  Called when the connection state is changed.
152  * @remakrs  @c tethering_client_h is valid only in this function. In order to use it outside this function, you must copy the client with tethering_client_clone().
153  * @param[in]  client  The client of which connection state is changed
154  * @param[in]  opened  @c true when connection is opened, otherwise false
155  * @param[in]  user_data  The user data passed from tethering_set_connection_state_changed_cb()
156  * @pre  If you register callback function using tethering_set_connection_state_changed_cb(), this will be invoked when the connection state is changed.
157  * @see tethering_set_connection_state_changed_cb()
158  * @see tethering_unset_connection_state_changed_cb()
159  */
160 typedef void (*tethering_connection_state_changed_cb)(tethering_client_h client, bool opened, void *user_data);
161
162 /**
163  * @brief Called when you get the connected client repeatedly.
164  * @remarks  @a client is valid only in this function. In order to use the client outside this function, you must copy the client with tethering_client_clone().
165  * @param[in]  client  The connected client
166  * @param[in]  user_data  The user data passed from the request function
167  * @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
168  * @pre  tethering_foreach_connected_clients() will invoke this callback.
169  * @see  tethering_foreach_connected_clients()
170  */
171 typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *user_data);
172
173 /**
174  * @brief  Called when you get the data usage.
175  * @param[in]  result  The result of getting the data usage
176  * @param[in]  received_data  The usage of received data
177  * @param[in]  sent_data  The usage of sent data
178  * @param[in]  user_data  The user data passed from the request function
179  * @pre  tethering_get_data_usage() will invoked this callback
180  */
181 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
182
183 /**
184  * @brief  Called when the security type of Wi-Fi tethering is changed
185  * @param[in]  changed_type  The changed security type of Wi-Fi tethering
186  * @param[in]  user_data  The user data passed from the register function
187  * @see tethering_wifi_set_security_type_changed_cb()
188  * @see tethering_wifi_unset_security_type_changed_cb()
189  */
190 typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
191
192 /**
193  * @brief  Called when the visibility of SSID is changed
194  * @param[in]  changed_visible  The changed visibility of SSID
195  * @param[in]  user_data  The user data passed from the register function
196  * @see tethering_wifi_set_ssid_visibility_changed_cb()
197  * @see tethering_wifi_unset_ssid_visibility_changed_cb()
198  */
199 typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
200
201 /**
202  * @brief  Called when the passphrase of Wi-Fi tethering is changed
203  * @param[in]  user_data  The user data passed from the register function
204  * @see tethering_wifi_set_passphrase_changed_cb()
205  * @see tethering_wifi_unset_passphrase_changed_cb()
206  */
207 typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
208
209 /**
210  * @brief  Creates the handle of tethering.
211  * @remarks  The @a tethering must be released tethering_destroy() by you.
212  * @param[out]  tethering  A handle of a new mobile ap handle on success
213  * @return  0 on success, otherwise a negative error value.
214  * @retval  #TETHERING_ERROR_NONE  Successful
215  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
216  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
217  * @see  tethering_destroy()
218  */
219 int tethering_create(tethering_h *tethering);
220
221 /**
222  * @brief  Destroys the handle of tethering.
223  * @param[in]  tethering  The handle of tethering
224  * @return  0 on success, otherwise a negative error value.
225  * @retval  #TETHERING_ERROR_NONE  Successful
226  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
227  * @see  tethering_create()
228  */
229 int tethering_destroy(tethering_h tethering);
230
231 /**
232  * @brief Enables the tethering, asynchronously.
233  * @param[in]  tethering  The handle of tethering
234  * @param[in]  type  The type of tethering
235  * @return 0 on success, otherwise negative error value.
236  * @retval  #TETHERING_ERROR_NONE  Successful
237  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
238  * @post tethering_enabled_cb() will be invoked.
239  * @see  tethering_is_enabled()
240  * @see  tethering_disable()
241  */
242 int tethering_enable(tethering_h tethering, tethering_type_e type);
243
244 /**
245  * @brief Disables the tethering, asynchronously.
246  * @param[in]  tethering  The handle of tethering
247  * @param[in]  type  The type of tethering
248  * @return 0 on success, otherwise negative error value.
249  * @retval  #TETHERING_ERROR_NONE  Successful
250  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
251  * @post tethering_disabled_cb() will be invoked.
252  * @see  tethering_is_enabled()
253  * @see  tethering_enable()
254  */
255 int tethering_disable(tethering_h tethering, tethering_type_e type);
256
257 /**
258  * @brief  Checks whetehr the tethering is enabled or not.
259  * @param[in]  tethering  The handle of tethering
260  * @param[in]  type  The type of tethering
261  * @return  @c true if tethering is enabled, \n @c false if tethering is disabled.
262  */
263 bool tethering_is_enabled(tethering_h tethering, tethering_type_e type);
264
265 /**
266  * @brief  Gets the MAC address of local device as "FC:A1:3E:D6:B1:B1".
267  * @remarks @a mac_address must be released with free() by you.
268  * @param[in]  tethering  The handle of tethering
269  * @param[in]  type  The type of tethering
270  * @param[out]  mac_address  The MAC address
271  * @return  0 on success, otherwise a negative error value.
272  * @retval  #TETHERING_ERROR_NONE  Successful
273  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
274  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
275  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
276  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
277  * @pre  tethering must be enabled.
278  * @see  tethering_is_enabled()
279  * @see  tethering_enable()
280  */
281 int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address);
282
283 /**
284  * @brief Gets the name of network interface. For example, usb0.
285  * @remarks @a interface_name must be released with free() by you.
286  * @param[in]  tethering  The handle of tethering
287  * @param[in]  type  The type of tethering
288  * @param[out]  interface_name  The name of network interface
289  * @return 0 on success, otherwise negative error value.
290  * @retval  #TETHERING_ERROR_NONE  Successful
291  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
292  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
293  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
294  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
295  * @pre  tethering must be enabled.
296  * @see  tethering_is_enabled()
297  * @see  tethering_enable()
298  */
299 int tethering_get_network_interface_name(tethering_h tethering, tethering_type_e type, char **interface_name);
300
301 /**
302  * @brief Gets the local IP address.
303  * @remarks @a ip_address must be released with free() by you.
304  * @param[in]  tethering  The handle of tethering
305  * @param[in]  type  The type of tethering
306  * @param[in]  address_family  The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported.
307  * @param[out]  ip_address  The local IP address
308  * @return 0 on success, otherwise negative error value.
309  * @retval  #TETHERING_ERROR_NONE  Successful
310  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
311  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
312  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
313  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
314  * @pre  tethering must be enabled.
315  * @see  tethering_is_enabled()
316  * @see  tethering_enable()
317  */
318 int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address);
319
320 /**
321  * @brief Gets the Gateway address.
322  * @remarks @a gateway_address must be released with free() by you.
323  * @param[in]  tethering  The handle of tethering
324  * @param[in]  type  The type of tethering
325  * @param[in]  address_family  The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported.
326  * @param[out]  gateway_address  The local IP address
327  * @return 0 on success, otherwise negative error value.
328  * @retval  #TETHERING_ERROR_NONE  Successful
329  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
330  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
331  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
332  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
333  * @pre  tethering must be enabled.
334  * @see  tethering_is_enabled()
335  * @see  tethering_enable()
336  */
337 int tethering_get_gateway_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **gateway_address);
338
339 /**
340  * @brief Gets the Subnet Mask.
341  * @remarks @a subnet_mask must be released with free() by you.
342  * @param[in]  tethering  The handle of tethering
343  * @param[in]  type  The type of tethering
344  * @param[in]  address_family  The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported.
345  * @param[out]  subnet_mask  The local IP address
346  * @return 0 on success, otherwise negative error value.
347  * @retval  #TETHERING_ERROR_NONE  Successful
348  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
349  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
350  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
351  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
352  * @pre  tethering must be enabled.
353  * @see  tethering_is_enabled()
354  * @see  tethering_enable()
355  */
356 int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask);
357
358 /**
359  * @brief Gets the data usage.
360  * @param[in]  tethering  The handle of tethering
361  * @param[out]  usage  The data usage
362  * @return 0 on success, otherwise negative error value.
363  * @retval  #TETHERING_ERROR_NONE  Successful
364  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
365  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
366  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
367  * @pre  tethering must be enabled.
368  * @see  tethering_is_enabled()
369  * @see  tethering_enable()
370  */
371 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
372
373 /**
374  * @brief Gets the client which is connected by USB tethering.
375  * @param[in]  tethering  The handle of tethering
376  * @param[in]  type  The type of tethering
377  * @param[in]  callback  The callback function to invoke
378  * @param[in]  user_data  The user data to be passed to the callback function
379  * @retval  #TETHERING_ERROR_NONE  Successful
380  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
381  * @retval  #TETHERING_ERROR_NOT_ENABLED  Not enabled
382  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
383  * @pre  tethering must be enabled.
384  * @see  tethering_is_enabled()
385  * @see  tethering_enable()
386  */
387 int tethering_foreach_connected_clients(tethering_h tethering, tethering_type_e type, tethering_connected_client_cb callback, void *user_data);
388
389 /**
390  * @brief Registers the callback function called when tethering is enabled.
391  * @param[in]  tethering  The handle of tethering
392  * @param[in]  type  The type of tethering
393  * @param[in]  callback  The callback function to invoke
394  * @param[in]  user_data  The user data to be passed to the callback function
395  * @retval  #TETHERING_ERROR_NONE  Successful
396  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
397  * @see  tethering_unset_enabled_cb()
398  */
399 int tethering_set_enabled_cb(tethering_h tethering, tethering_type_e type, tethering_enabled_cb callback, void *user_data);
400
401 /**
402  * @brief Unregisters the callback function called when tethering is disabled.
403  * @param[in]  tethering  The handle of tethering
404  * @param[in]  type  The type of tethering
405  * @retval  #TETHERING_ERROR_NONE  Successful
406  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
407  * @see  tethering_set_enabled_cb()
408  */
409 int tethering_unset_enabled_cb(tethering_h tethering, tethering_type_e type);
410
411 /**
412  * @brief Registers the callback function called when tethering is disabled.
413  * @param[in]  tethering  The handle of tethering
414  * @param[in]  type  The type of tethering
415  * @param[in]  callback  The callback function to invoke
416  * @param[in]  user_data  The user data to be passed to the callback function
417  * @retval  #TETHERING_ERROR_NONE  Successful
418  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
419  * @see  tethering_unset_disabled_cb()
420  */
421 int tethering_set_disabled_cb(tethering_h tethering, tethering_type_e type, tethering_disabled_cb callback, void *user_data);
422
423 /**
424  * @brief Unregisters the callback function called when tethering is disabled.
425  * @param[in]  tethering  The handle of tethering
426  * @param[in]  type  The type of tethering
427  * @retval  #TETHERING_ERROR_NONE  Successful
428  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
429  * @see  tethering_set_disabled_cb()
430  */
431 int tethering_unset_disabled_cb(tethering_h tethering, tethering_type_e type);
432
433 /**
434  * @brief Registers the callback function called when the state of connection is changed.
435  * @param[in]  tethering  The handle of tethering
436  * @param[in]  type  The type of tethering
437  * @param[in]  callback  The callback function to invoke
438  * @param[in]  user_data  The user data to be passed to the callback function
439  * @retval  #TETHERING_ERROR_NONE  Successful
440  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
441  * @see  tethering_unset_connection_state_changed_cb_cb()
442  */
443 int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_type_e type, tethering_connection_state_changed_cb callback, void *user_data);
444
445 /**
446  * @brief Unregisters the callback function called when the state of connection is changed.
447  * @param[in]  tethering  The handle of tethering
448  * @param[in]  type  The type of tethering
449  * @retval  #TETHERING_ERROR_NONE  Successful
450  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
451  * @see  tethering_set_connection_state_changed_cb()
452  */
453 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
454
455 /**
456  * @brief Registers the callback function called when the security type of Wi-Fi tethering is changed.
457  * @param[in]  tethering  The handle of tethering
458  * @param[in]  callback  The callback function to invoke
459  * @param[in]  user_data  The user data to be passed to the callback function
460  * @retval  #TETHERING_ERROR_NONE  Successful
461  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
462  * @see  tethering_wifi_unset_security_type_changed_cb()
463  */
464 int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
465
466 /**
467  * @brief Unregisters the callback function called when the security type of Wi-Fi tethering is changed.
468  * @param[in]  tethering  The handle of tethering
469  * @param[in]  type  The type of tethering
470  * @retval  #TETHERING_ERROR_NONE  Successful
471  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
472  * @see  tethering_wifi_set_security_type_changed_cb()
473  */
474 int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
475
476 /**
477  * @brief Registers the callback function called when the visibility of SSID is changed.
478  * @param[in]  tethering  The handle of tethering
479  * @param[in]  callback  The callback function to invoke
480  * @param[in]  user_data  The user data to be passed to the callback function
481  * @retval  #TETHERING_ERROR_NONE  Successful
482  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
483  * @see  tethering_wifi_unset_ssid_visibility_changed_cb_cb()
484  */
485 int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
486
487 /**
488  * @brief Unregisters the callback function called when the visibility of SSID is changed.
489  * @param[in]  tethering  The handle of tethering
490  * @retval  #TETHERING_ERROR_NONE  Successful
491  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
492  * @see  tethering_wifi_set_ssid_visibility_changed_cb()
493  */
494 int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
495
496 /**
497  * @brief Registers the callback function called when the passphrase of Wi-Fi tethering is changed.
498  * @param[in]  tethering  The handle of tethering
499  * @param[in]  callback  The callback function to invoke
500  * @param[in]  user_data  The user data to be passed to the callback function
501  * @retval  #TETHERING_ERROR_NONE  Successful
502  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
503  * @see  tethering_wifi_unset_passphrase_changed_cb()
504  */
505 int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
506
507 /**
508  * @brief Unregisters the callback function called when the passphrase of Wi-Fi tethering is changed.
509  * @param[in]  tethering  The handle of tethering
510  * @retval  #TETHERING_ERROR_NONE  Successful
511  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
512  * @see  tethering_wifi_set_passphrase_changed_cb()
513  */
514 int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
515
516 /**
517  * @}
518  */
519
520
521 /**
522  * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
523  * @{
524  */
525
526 /**
527  * @brief Sets the security type of Wi-Fi tethering.
528  * @remarks You must set this value when Wi-Fi tethering is disabled.
529  * @param[in]  tethering  The handle of tethering
530  * @param[in]  type  The security type
531  * @return 0 on success, otherwise negative error value.
532  * @retval  #TETHERING_ERROR_NONE  Successful
533  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
534  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
535  * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
536  * @pre  Wi-Fi tethering must be disabled.
537  * @see  tethering_is_enabled()
538  * @see  tethering_wifi_get_security_type()
539  */
540 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
541
542 /**
543  * @brief Gets the security type of Wi-Fi tethering.
544  * @param[in]  tethering  The handle of tethering
545  * @param[out]  type  The security type
546  * @return 0 on success, otherwise negative error value.
547  * @retval  #TETHERING_ERROR_NONE  Successful
548  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
549  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
550  * @see  tethering_wifi_set_security_type()
551  */
552 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
553
554 /**
555  * @brief Gets the SSID (service set identifier).
556  * @remarks @a ssid must be released with free() by you.
557  * @param[in]  tethering  The handle of tethering
558  * @param[out]  ssid  The SSID
559  * @return 0 on success, otherwise negative error value.
560  * @retval  #TETHERING_ERROR_NONE  Successful
561  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
562  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
563  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
564  */
565 int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
566
567 /**
568  * @brief Sets the visibility of SSID(service set identifier).
569  * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
570  * @remarks You must set this value when Wi-Fi tethering is disabled.
571  * @param[in]  tethering  The handle of tethering
572  * @param[in]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
573  * @return 0 on success, otherwise negative error value.
574  * @retval  #TETHERING_ERROR_NONE  Successful
575  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
576  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
577  * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
578  * @pre  Wi-Fi tethering must be disabled.
579  * @see  tethering_is_enabled()
580  * @see  tethering_wifi_get_ssid_visibility()
581  */
582 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
583
584 /**
585  * @brief Gets the visibility of SSID(service set identifier).
586  * @details If the visibility is set invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
587  * @param[in]  tethering  The handle of tethering
588  * @param[out]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
589  * @return 0 on success, otherwise negative error value.
590  * @retval  #TETHERING_ERROR_NONE  Successful
591  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
592  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
593  * @see  tethering_wifi_set_ssid_visibility()
594  */
595 int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
596
597 /**
598  * @brief Sets the passphrase.
599  * @remarks You must set this value when Wi-Fi tethering is disabled.
600  * @param[in]  tethering  The handle of tethering
601  * @param[in]  passphrase  The passphrase
602  * @return 0 on success, otherwise negative error value.
603  * @retval  #TETHERING_ERROR_NONE  Successful
604  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
605  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
606  * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
607  * @pre  Wi-Fi tethering must be disabled.
608  * @see  tethering_is_enabled()
609  * @see  tethering_wifi_get_passphrase()
610  */
611 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
612
613 /**
614  * @brief Gets the passphrase.
615  * @remarks @a passphrase must be released with free() by you.
616  * @param[in]  tethering  The handle of tethering
617  * @param[out]  passphrase  The passphrase
618  * @return 0 on success, otherwise negative error value.
619  * @retval  #TETHERING_ERROR_NONE  Successful
620  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
621  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
622  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
623  * @see  tethering_wifi_set_passphrase()
624  */
625 int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase);
626
627 /**
628  * @}
629  */
630
631
632 /**
633  * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
634  * @{
635  */
636
637 /**
638  * @brief  Clones the handle of client.
639  * @remarks  The @cloned_client must be release tethering_client_destroy() by you.
640  * @param[out]  dest  The cloned client handle
641  * @param[in]  origin  The origin client handle
642  * @return  0 on success, otherwise a negative error value.
643  * @retval  #TETHERING_ERROR_NONE  Successful
644  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
645  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
646  * @see  tethering_client_destroy()
647  */
648 int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin);
649
650 /**
651  * @brief  Destroys the handle of client.
652  * @param[in]  client  The handle of client
653  * @return  0 on success, otherwise a negative error value.
654  * @retval  #TETHERING_ERROR_NONE  Successful
655  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
656  * @see  tethering_client_clone()
657  */
658 int tethering_client_destroy(tethering_client_h client);
659
660 /**
661  * @brief  Gets the tethering type of client.
662  * @param[in]  client  The handle of client
663  * @param[out]  type  The type of tethering
664  * @return  0 on success, otherwise a negative error value.
665  * @retval  #TETHERING_ERROR_NONE  Successful
666  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
667  * @see  tethering_usb_get_connected_client()
668  * @see  tethering_connection_state_changed_cb()
669  */
670 int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type);
671
672 /**
673  * @brief  Gets the name of client.
674  * @remarks @a name must be released with free() by you.
675  * @param[in]  client  The handle of client
676  * @param[out]  name  The name of client
677  * @return  0 on success, otherwise a negative error value.
678  * @retval  #TETHERING_ERROR_NONE  Successful
679  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
680  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
681  * @see  tethering_usb_get_connected_client()
682  * @see  tethering_connection_state_changed_cb()
683  */
684 int tethering_client_get_name(tethering_client_h client, char **name);
685
686 /**
687  * @brief  Gets the IP address of client.
688  * @remarks @a ip_address must be released with free() by you.
689  * @param[in]  client  The handle of client
690  * @param[in]  address_family  The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported.
691  * @param[out]  ip_address  The IP address
692  * @return  0 on success, otherwise a negative error value.
693  * @retval  #TETHERING_ERROR_NONE  Successful
694  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
695  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
696  * @see  tethering_usb_get_connected_client()
697  * @see  tethering_connection_state_changed_cb()
698  */
699 int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address);
700
701 /**
702  * @brief  Gets the MAC address of client such as "FC:A1:3E:D6:B1:B1".
703  * @remarks @a mac_address must be released with free() by you.
704  * @param[in]  client  The handle of client
705  * @param[out]  mac_address  The MAC address
706  * @return  0 on success, otherwise a 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  * @see  tethering_usb_get_connected_client()
711  * @see  tethering_connection_state_changed_cb()
712  */
713 int tethering_client_get_mac_address(tethering_client_h client, char **mac_address);
714
715 /**
716  * @}
717  */
718
719
720 #ifdef __cplusplus
721  }
722 #endif
723
724 #endif /* __TIZEN_NETWORK_TETHERING_H__ */
725
726