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