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