2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_NETWORK_TETHERING_H__
18 #define __TIZEN_NETWORK_TETHERING_H__
33 * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
39 * @brief The tethering handle.
42 typedef void * tethering_h;
46 * @brief Enumeration for the tethering.
50 TETHERING_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
51 TETHERING_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
52 TETHERING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
53 TETHERING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
54 TETHERING_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Resource busy */
55 TETHERING_ERROR_NOT_ENABLED = TIZEN_ERROR_TETHERING | 0x0501, /**< Not enabled */
56 TETHERING_ERROR_OPERATION_FAILED = TIZEN_ERROR_TETHERING | 0x0502, /**< Operation failed */
57 TETHERING_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
58 TETHERING_ERROR_NOT_SUPPORT_API = TIZEN_ERROR_NOT_SUPPORTED, /**< API is not supported */
59 TETHERING_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
64 * @brief Enumeration for the type of tethering.
68 TETHERING_TYPE_ALL = 0, /**< All type except for TETHERING_TYPE_RESERVED */
69 TETHERING_TYPE_USB, /**< USB type */
70 TETHERING_TYPE_WIFI, /**< Wi-Fi type */
71 TETHERING_TYPE_BT, /**< BT type */
72 TETHERING_TYPE_RESERVED, /**< Reserved type */
77 * @brief Enumeration for the cause of disabling the tethering.
82 TETHERING_DISABLED_BY_USB_DISCONNECTION = 0, /**< Disabled due to usb disconnection */
83 TETHERING_DISABLED_BY_FLIGHT_MODE, /**< Disabled due to flight mode */
84 TETHERING_DISABLED_BY_LOW_BATTERY, /**< Disabled due to low battery */
85 TETHERING_DISABLED_BY_NETWORK_CLOSE, /**< Disabled due to pdp network close */
86 TETHERING_DISABLED_BY_TIMEOUT, /**< Disabled due to timeout */
87 TETHERING_DISABLED_BY_OTHERS, /**< Disabled by other apps */
88 TETHERING_DISABLED_BY_REQUEST, /**< Disabled by your request */
89 TETHERING_DISABLED_BY_WIFI_ON, /**< Disabled due to Wi-Fi on */
90 TETHERING_DISABLED_BY_BT_OFF, /**< Disabled due to Bluetooth off */
91 TETHERING_DISABLED_BY_POWER_SAVE_MODE, /**< Disabled due to power save mode */
92 } tethering_disabled_cause_e;
101 * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
107 * @brief Enumeration for the Wi-Fi security.
111 TETHERING_WIFI_SECURITY_TYPE_NONE = 0, /**< No Security type */
112 TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK, /**< WPA2_PSK */
113 } tethering_wifi_security_type_e;
122 * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
128 * @brief The tethering client handle.
131 typedef void * tethering_client_h;
135 * @brief Enumeration for address family.
139 TETHERING_ADDRESS_FAMILY_IPV4 = 0, /**< IPV4 Address type */
140 } tethering_address_family_e;
149 * @addtogroup CAPI_NETWORK_TETHERING_MANAGER_MODULE
155 * @brief Called when the tethering is enabled.
157 * @param[in] result The result of enabling the tethering
158 * @param[in] type The tethering type
159 * @param[in] is_requested Indicates whether this change is requested
160 * @param[in] user_data The user data passed from tethering_set_enabled_cb()
161 * @pre If you register callback function using tethering_set_enabled_cb(), this will be invoked when the tethering is enabled.
162 * @see tethering_enable()
163 * @see tethering_unset_enabled_cb()
165 typedef void (*tethering_enabled_cb)(tethering_error_e result, tethering_type_e type, bool is_requested, void *user_data);
169 * @brief Called when the tethering is disabled.
171 * @param[in] result The result of disabling the tethering
172 * @param[in] type The tethering type
173 * @param[in] cause The cause of disabling
174 * @param[in] user_data The user data passed from tethering_set_disabled_cb()
175 * @pre If you register callback function using tethering_set_disabled_cb(), this will be invoked when the tethering is disabled.
176 * @see tethering_set_disabled_cb()
177 * @see tethering_unset_disabled_cb()
179 typedef void (*tethering_disabled_cb)(tethering_error_e result, tethering_type_e type, tethering_disabled_cause_e cause, void *user_data);
183 * @brief Called when the connection state is changed.
185 * @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().
186 * @param[in] client The client of which connection state is changed
187 * @param[in] opened @c true when connection is opened, otherwise false
188 * @param[in] user_data The user data passed from tethering_set_connection_state_changed_cb()
189 * @pre If you register callback function using tethering_set_connection_state_changed_cb(), this will be invoked when the connection state is changed.
190 * @see tethering_set_connection_state_changed_cb()
191 * @see tethering_unset_connection_state_changed_cb()
193 typedef void (*tethering_connection_state_changed_cb)(tethering_client_h client, bool opened, void *user_data);
197 * @brief Called when you get the connected client repeatedly.
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()
206 typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *user_data);
210 * @brief Called when you get the data usage.
212 * @param[in] result The result of getting the data usage
213 * @param[in] received_data The usage of received data
214 * @param[in] sent_data The usage of sent data
215 * @param[in] user_data The user data passed from the request function
216 * @pre tethering_get_data_usage() will invoked this callback.
218 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
222 * @brief Called when the security type of Wi-Fi tethering is changed.
224 * @param[in] changed_type The changed security type of Wi-Fi tethering
225 * @param[in] user_data The user data passed from the register function
226 * @see tethering_wifi_set_security_type_changed_cb()
227 * @see tethering_wifi_unset_security_type_changed_cb()
229 typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
233 * @brief Called when the visibility of SSID is changed.
235 * @param[in] changed_visible The changed visibility of SSID
236 * @param[in] user_data The user data passed from the register function
237 * @see tethering_wifi_set_ssid_visibility_changed_cb()
238 * @see tethering_wifi_unset_ssid_visibility_changed_cb()
240 typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
244 * @brief Called when the passphrase of Wi-Fi tethering is changed.
246 * @param[in] user_data The user data passed from the register function
247 * @see tethering_wifi_set_passphrase_changed_cb()
248 * @see tethering_wifi_unset_passphrase_changed_cb()
250 typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
254 * @brief Called when the settings are reloaded.
256 * @param[in] result The result of reloading the settings
257 * @param[in] user_data The user data passed from the request function
258 * @pre tethering_wifi_reload_settings() will invoke this callback.
260 typedef void (*tethering_wifi_settings_reloaded_cb)(tethering_error_e result, void *user_data);
264 * @brief Called when Wi-Fi AP settings are reloaded.
266 * @param[in] result The result of reloading the settings
267 * @param[in] user_data The user data passed from the request function
268 * @pre tethering_wifi_ap_reload_settings() will invoke this callback.
270 typedef void (*tethering_wifi_ap_settings_reloaded_cb)(tethering_error_e result, void *user_data);
274 * @brief Creates the handle for tethering.
276 * @privlevel platform
277 * @privilege http://tizen.org/privilege/tethering.admin
278 * @remarks The @a tethering must be released using tethering_destroy().
279 * @param[out] tethering A handle of a new mobile ap handle on success
280 * @return 0 on success, otherwise a negative error value
281 * @retval #TETHERING_ERROR_NONE Successful
282 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
283 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
284 * @retval #TETHERING_ERROR_NOT_SUPPORT_API API is not supported
285 * @see tethering_destroy()
287 int tethering_create(tethering_h *tethering);
291 * @brief Destroys the handle for tethering.
293 * @privlevel platform
294 * @privilege http://tizen.org/privilege/tethering.admin
295 * @param[in] tethering The tethering handle
296 * @return 0 on success, otherwise a negative error value
297 * @retval #TETHERING_ERROR_NONE Successful
298 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
299 * @see tethering_create()
301 int tethering_destroy(tethering_h tethering);
305 * @brief Enables the tethering, asynchronously.
307 * @privlevel platform
308 * @privilege http://tizen.org/privilege/tethering.admin
309 * @param[in] tethering The tethering handle
310 * @param[in] type The tethering type
311 * @return 0 on success, otherwise negative error value
312 * @retval #TETHERING_ERROR_NONE Successful
313 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
314 * @post tethering_enabled_cb() will be invoked.
315 * @see tethering_is_enabled()
316 * @see tethering_disable()
318 int tethering_enable(tethering_h tethering, tethering_type_e type);
322 * @brief Disables the tethering, asynchronously.
324 * @privlevel platform
325 * @privilege http://tizen.org/privilege/tethering.admin
326 * @param[in] tethering The tethering handle
327 * @param[in] type The tethering type
328 * @return 0 on success, otherwise negative error value
329 * @retval #TETHERING_ERROR_NONE Successful
330 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
331 * @post tethering_disabled_cb() will be invoked.
332 * @see tethering_is_enabled()
333 * @see tethering_enable()
335 int tethering_disable(tethering_h tethering, tethering_type_e type);
339 * @brief Checks whether the tethering is enabled or not.
341 * @privlevel platform
342 * @privilege http://tizen.org/privilege/tethering.admin
343 * @param[in] tethering The tethering handle
344 * @param[in] type The tethering type
345 * @return @c true if tethering is enabled, \n @c false if tethering is disabled
347 bool tethering_is_enabled(tethering_h tethering, tethering_type_e type);
351 * @brief Gets the MAC address of local device as "FC:A1:3E:D6:B1:B1".
353 * @privlevel platform
354 * @privilege http://tizen.org/privilege/tethering.admin
355 * @remarks @a mac_address must be released using free().
356 * @param[in] tethering The tethering handle
357 * @param[in] type The tethering type
358 * @param[out] mac_address The MAC address
359 * @return 0 on success, otherwise a 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()
369 int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address);
373 * @brief Gets the name of network interface (e.g. usb0).
375 * @privlevel platform
376 * @privilege http://tizen.org/privilege/tethering.admin
377 * @remarks @a interface_name must be released using free().
378 * @param[in] tethering The tethering handle
379 * @param[in] type The tethering type
380 * @param[out] interface_name The name of the network interface
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()
391 int tethering_get_network_interface_name(tethering_h tethering, tethering_type_e type, char **interface_name);
395 * @brief Gets the local IP address.
397 * @privlevel platform
398 * @privilege http://tizen.org/privilege/tethering.admin
399 * @remarks @a ip_address must be released using free().
400 * @param[in] tethering The tethering handle
401 * @param[in] type The tethering type
402 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
403 * @param[out] ip_address The local IP address
404 * @return 0 on success, otherwise negative error value
405 * @retval #TETHERING_ERROR_NONE Successful
406 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
407 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
408 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
409 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
410 * @pre The tethering must be enabled.
411 * @see tethering_is_enabled()
412 * @see tethering_enable()
414 int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address);
418 * @brief Gets the Gateway address.
420 * @privlevel platform
421 * @privilege http://tizen.org/privilege/tethering.admin
422 * @remarks @a gateway_address must be released using free().
423 * @param[in] tethering The tethering handle
424 * @param[in] type The tethering type
425 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
426 * @param[out] gateway_address The local IP address
427 * @return 0 on success, otherwise negative error value
428 * @retval #TETHERING_ERROR_NONE Successful
429 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
431 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
432 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
433 * @pre The tethering must be enabled.
434 * @see tethering_is_enabled()
435 * @see tethering_enable()
437 int tethering_get_gateway_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **gateway_address);
441 * @brief Gets the Subnet Mask.
443 * @privlevel platform
444 * @privilege http://tizen.org/privilege/tethering.admin
445 * @remarks @a subnet_mask must be released using free().
446 * @param[in] tethering The tethering handle
447 * @param[in] type The tethering type
448 * @param[in] address_family The address family of IP address (currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported)
449 * @param[out] subnet_mask The local IP address
450 * @return 0 on success, otherwise negative error value
451 * @retval #TETHERING_ERROR_NONE Successful
452 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
453 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
454 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
455 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
456 * @pre The tethering must be enabled.
457 * @see tethering_is_enabled()
458 * @see tethering_enable()
460 int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask);
464 * @brief Gets the data usage.
466 * @privlevel platform
467 * @privilege http://tizen.org/privilege/tethering.admin
468 * @param[in] tethering The tethering handle
469 * @param[out] usage The data usage
470 * @return 0 on success, otherwise negative error value
471 * @retval #TETHERING_ERROR_NONE Successful
472 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
473 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
474 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
475 * @pre The tethering must be enabled.
476 * @see tethering_is_enabled()
477 * @see tethering_enable()
479 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
483 * @brief Gets the clients which are connected.
485 * @privlevel platform
486 * @privilege http://tizen.org/privilege/tethering.admin
487 * @param[in] tethering The tethering handle
488 * @param[in] type The tethering type
489 * @param[in] callback The callback function to invoke
490 * @param[in] user_data The user data to be passed to the callback function
491 * @retval #TETHERING_ERROR_NONE Successful
492 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
493 * @retval #TETHERING_ERROR_NOT_ENABLED Not enabled
494 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
495 * @pre The tethering must be enabled.
496 * @see tethering_is_enabled()
497 * @see tethering_enable()
499 int tethering_foreach_connected_clients(tethering_h tethering, tethering_type_e type, tethering_connected_client_cb callback, void *user_data);
502 * @brief Set the ip forward status
503 * @param[in] tethering The handle of tethering
504 * @param[in] status The ip forward status: (@c true = enable, @c false = disable)
505 * @retval #TETHERING_ERROR_NONE Successful
506 * @reztval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
507 * @see tethering_get_ip_forward_status()
509 int tethering_set_ip_forward_status(tethering_h tethering, bool status);
512 * @brief Get the ip forward status
513 * @param[in] tethering The handle of tethering
514 * @param[out] status The ip forward status: (@c true = enable, @c false = disable)
515 * @retval #TETHERING_ERROR_NONE Successful
516 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
517 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
518 * @see tethering_set_ip_forward_status()
520 int tethering_get_ip_forward_status(tethering_h tethering, bool *status);
524 * @brief Registers the callback function, which is called when tethering is enabled.
526 * @privlevel platform
527 * @privilege http://tizen.org/privilege/tethering.admin
528 * @param[in] tethering The tethering handle
529 * @param[in] type The tethering type
530 * @param[in] callback The callback function to invoke
531 * @param[in] user_data The user data to be passed to the callback function
532 * @retval #TETHERING_ERROR_NONE Successful
533 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
534 * @see tethering_unset_enabled_cb()
536 int tethering_set_enabled_cb(tethering_h tethering, tethering_type_e type, tethering_enabled_cb callback, void *user_data);
540 * @brief Unregisters the callback function, which is called when tethering is enabled.
542 * @privlevel platform
543 * @privilege http://tizen.org/privilege/tethering.admin
544 * @param[in] tethering The tethering handle
545 * @param[in] type The tethering type
546 * @retval #TETHERING_ERROR_NONE Successful
547 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
548 * @see tethering_set_enabled_cb()
550 int tethering_unset_enabled_cb(tethering_h tethering, tethering_type_e type);
554 * @brief Registers the callback function called when tethering is disabled.
556 * @privlevel platform
557 * @privilege http://tizen.org/privilege/tethering.admin
558 * @param[in] tethering The tethering handle
559 * @param[in] type The tethering type
560 * @param[in] callback The callback function to invoke
561 * @param[in] user_data The user data to be passed to the callback function
562 * @retval #TETHERING_ERROR_NONE Successful
563 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
564 * @see tethering_unset_disabled_cb()
566 int tethering_set_disabled_cb(tethering_h tethering, tethering_type_e type, tethering_disabled_cb callback, void *user_data);
570 * @brief Unregisters the callback function, which is called when tethering is disabled.
572 * @privlevel platform
573 * @privilege http://tizen.org/privilege/tethering.admin
574 * @param[in] tethering The tethering handle
575 * @param[in] type The tethering type
576 * @retval #TETHERING_ERROR_NONE Successful
577 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
578 * @see tethering_set_disabled_cb()
580 int tethering_unset_disabled_cb(tethering_h tethering, tethering_type_e type);
584 * @brief Registers the callback function, which is called when the state of connection is changed.
586 * @privlevel platform
587 * @privilege http://tizen.org/privilege/tethering.admin
588 * @param[in] tethering The tethering handle
589 * @param[in] type The tethering type
590 * @param[in] callback The callback function to invoke
591 * @param[in] user_data The user data to be passed to the callback function
592 * @retval #TETHERING_ERROR_NONE Successful
593 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
594 * @see tethering_unset_connection_state_changed_cb_cb()
596 int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_type_e type, tethering_connection_state_changed_cb callback, void *user_data);
600 * @brief Unregisters the callback function, which is called when the state of connection is changed.
602 * @privlevel platform
603 * @privilege http://tizen.org/privilege/tethering.admin
604 * @param[in] tethering The tethering handle
605 * @param[in] type The tethering type
606 * @retval #TETHERING_ERROR_NONE Successful
607 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
608 * @see tethering_set_connection_state_changed_cb()
610 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
614 * @brief Registers the callback function, which is called when the security type of Wi-Fi tethering is changed.
616 * @privlevel platform
617 * @privilege http://tizen.org/privilege/tethering.admin
618 * @param[in] tethering The tethering handle
619 * @param[in] callback The callback function to invoke
620 * @param[in] user_data The user data to be passed to the callback function
621 * @retval #TETHERING_ERROR_NONE Successful
622 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
623 * @see tethering_wifi_unset_security_type_changed_cb()
625 int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
629 * @brief Unregisters the callback function, which is called when the security type of Wi-Fi tethering is changed.
631 * @privlevel platform
632 * @privilege http://tizen.org/privilege/tethering.admin
633 * @param[in] tethering The tethering handle
634 * @param[in] type The tethering type
635 * @retval #TETHERING_ERROR_NONE Successful
636 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
637 * @see tethering_wifi_set_security_type_changed_cb()
639 int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
643 * @brief Registers the callback function , which iscalled when the visibility of SSID is changed.
645 * @privlevel platform
646 * @privilege http://tizen.org/privilege/tethering.admin
647 * @param[in] tethering The tethering handle
648 * @param[in] callback The callback function to invoke
649 * @param[in] user_data The user data to be passed to the callback function
650 * @retval #TETHERING_ERROR_NONE Successful
651 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
652 * @see tethering_wifi_unset_ssid_visibility_changed_cb_cb()
654 int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
658 * @brief Unregisters the callback function, which is called when the visibility of SSID is changed.
660 * @privlevel platform
661 * @privilege http://tizen.org/privilege/tethering.admin
662 * @param[in] tethering The tethering handle
663 * @retval #TETHERING_ERROR_NONE Successful
664 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
665 * @see tethering_wifi_set_ssid_visibility_changed_cb()
667 int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
671 * @brief Registers the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
673 * @privlevel platform
674 * @privilege http://tizen.org/privilege/tethering.admin
675 * @param[in] tethering The tethering handle
676 * @param[in] callback The callback function to invoke
677 * @param[in] user_data The user data to be passed to the callback function
678 * @retval #TETHERING_ERROR_NONE Successful
679 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
680 * @see tethering_wifi_unset_passphrase_changed_cb()
682 int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
686 * @brief Unregisters the callback function, which is called when the passphrase of Wi-Fi tethering is changed.
688 * @privlevel platform
689 * @privilege http://tizen.org/privilege/tethering.admin
690 * @param[in] tethering The tethering handle
691 * @retval #TETHERING_ERROR_NONE Successful
692 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
693 * @see tethering_wifi_set_passphrase_changed_cb()
695 int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
704 * @addtogroup CAPI_NETWORK_TETHERING_WIFI_MODULE
710 * @brief Sets the security type of Wi-Fi tethering.
712 * @privlevel platform
713 * @privilege http://tizen.org/privilege/tethering.admin
714 * @remarks This change is applied next time Wi-Fi tethering is enabled.
715 * @param[in] tethering The tethering handle
716 * @param[in] type The security type
717 * @return 0 on success, otherwise negative error value
718 * @retval #TETHERING_ERROR_NONE Successful
719 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
720 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
721 * @see tethering_wifi_get_security_type()
723 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
727 * @brief Gets the security type of Wi-Fi tethering.
729 * @privlevel platform
730 * @privilege http://tizen.org/privilege/tethering.admin
731 * @param[in] tethering The tethering handle
732 * @param[out] type The security type
733 * @return 0 on success, otherwise negative error value
734 * @retval #TETHERING_ERROR_NONE Successful
735 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
736 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
737 * @see tethering_wifi_set_security_type()
739 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
743 * @brief Sets the SSID (service set identifier).
744 * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
746 * @privlevel platform
747 * @privilege http://tizen.org/privilege/tethering.admin
748 * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle.
749 * @param[in] tethering The tethering handle
750 * @param[in] ssid The SSID
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_OUT_OF_MEMORY Out of memory
756 int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
760 * @brief Gets the SSID (service set identifier).
762 * @privlevel platform
763 * @privilege http://tizen.org/privilege/tethering.admin
764 * @remarks @a ssid must be released using free().
765 * @param[in] tethering The tethering handle
766 * @param[out] ssid The SSID
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
773 int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
777 * @brief Sets the visibility of SSID (service set identifier).
778 * @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.
780 * @privlevel platform
781 * @privilege http://tizen.org/privilege/tethering.admin
782 * @remarks This change is applied next time Wi-Fi tethering is enabled.
783 * @param[in] tethering The tethering handle
784 * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible)
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 * @see tethering_wifi_get_ssid_visibility()
791 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
795 * @brief Gets the visibility of SSID (service set identifier).
796 * @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.
798 * @privlevel platform
799 * @privilege http://tizen.org/privilege/tethering.admin
800 * @param[in] tethering The tethering handle
801 * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible)
802 * @return 0 on success, otherwise negative error value
803 * @retval #TETHERING_ERROR_NONE Successful
804 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
805 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
806 * @see tethering_wifi_set_ssid_visibility()
808 int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
812 * @brief Sets the passphrase.
814 * @privlevel platform
815 * @privilege http://tizen.org/privilege/tethering.admin
816 * @remarks This change is applied next time Wi-Fi tethering is enabled.
817 * @param[in] tethering The tethering handle
818 * @param[in] passphrase The passphrase
819 * @return 0 on success, otherwise negative error value
820 * @retval #TETHERING_ERROR_NONE Successful
821 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
822 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
823 * @see tethering_wifi_get_passphrase()
825 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
829 * @brief Gets the passphrase.
831 * @privlevel platform
832 * @privilege http://tizen.org/privilege/tethering.admin
833 * @remarks @a passphrase must be released using free().
834 * @param[in] tethering The tethering handle
835 * @param[out] passphrase The passphrase
836 * @return 0 on success, otherwise negative error value
837 * @retval #TETHERING_ERROR_NONE Successful
838 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
839 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
840 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
841 * @see tethering_wifi_set_passphrase()
843 int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase);
847 * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility).
849 * @privlevel platform
850 * @privilege http://tizen.org/privilege/tethering.admin
851 * @remarks Connected devices via Wi-Fi tethering or MobileAP will be disconnected when the settings are reloaded.
852 * @param[in] tethering The tethering handle
853 * @param[in] callback The callback function to invoke
854 * @param[in] user_data The user data to be passed to the callback function
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_OPERATION_FAILED Operation failed
860 int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_settings_reloaded_cb callback, void *user_data);
864 * @brief Sets the security type of Wi-Fi AP.
865 * @details If security type is not set, WPA2_PSK is used.
867 * @privlevel platform
868 * @privilege http://tizen.org/privilege/tethering.admin
869 * @param[in] tethering The tethering handle
870 * @param[in] type The security type
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_OPERATION_FAILED Operation failed
875 * @see tethering_wifi_ap_get_security_type()
877 int tethering_wifi_ap_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
881 * @brief Gets the security type of Wi-Fi AP.
882 * @details If security type is not set, WPA2_PSK is used.
884 * @privlevel platform
885 * @privilege http://tizen.org/privilege/tethering.admin
886 * @param[in] tethering The tethering handle
887 * @param[out] type The security type
888 * @return 0 on success, otherwise negative error value
889 * @retval #TETHERING_ERROR_NONE Successful
890 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
891 * @see tethering_wifi_ap_set_security_type()
893 int tethering_wifi_ap_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
897 * @brief Sets the SSID (service set identifier) for Wi-Fi AP.
898 * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID.
900 * @privlevel platform
901 * @privilege http://tizen.org/privilege/tethering.admin
902 * @param[in] tethering The tethering handle
903 * @param[in] ssid The SSID
904 * @return 0 on success, otherwise negative error value
905 * @retval #TETHERING_ERROR_NONE Successful
906 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
907 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
909 int tethering_wifi_ap_set_ssid(tethering_h tethering, const char *ssid);
913 * @brief Gets the SSID (service set identifier) for Wi-Fi AP.
914 * @details If SSID is not set, Device name is used as SSID.
916 * @privlevel platform
917 * @privilege http://tizen.org/privilege/tethering.admin
918 * @remarks @a ssid must be released using free().
919 * @param[in] tethering The tethering handle
920 * @param[out] ssid The SSID
921 * @return 0 on success, otherwise negative error value
922 * @retval #TETHERING_ERROR_NONE Successful
923 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
924 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
926 int tethering_wifi_ap_get_ssid(tethering_h tethering, char **ssid);
930 * @brief Sets the visibility of SSID (service set identifier) for Wi-Fi AP.
931 * @details If you set the visibility to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
932 * @details By default visibility is set to @c true.
934 * @privlevel platform
935 * @privilege http://tizen.org/privilege/tethering.admin
936 * @remarks This change is applied next time Wi-Fi tethering is enabled.
937 * @param[in] tethering The tethering handle
938 * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible)
939 * @return 0 on success, otherwise negative error value
940 * @retval #TETHERING_ERROR_NONE Successful
941 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
942 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
943 * @see tethering_wifi_ap_get_ssid_visibility()
945 int tethering_wifi_ap_set_ssid_visibility(tethering_h tethering, bool visible);
949 * @brief Gets the visibility of SSID (service set identifier) for Wi-Fi AP.
950 * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device.
951 * @details By default visibility is set to @c true.
953 * @privlevel platform
954 * @privilege http://tizen.org/privilege/tethering.admin
955 * @param[in] tethering The tethering handle
956 * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible)
957 * @return 0 on success, otherwise negative error value
958 * @retval #TETHERING_ERROR_NONE Successful
959 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
960 * @see tethering_wifi_ap_set_ssid_visibility()
962 int tethering_wifi_ap_get_ssid_visibility(tethering_h tethering, bool *visible);
966 * @brief Sets the passphrase for Wi-Fi AP.
967 * @details If the passphrase is not set, random string of 8 characters will be used.
969 * @privlevel platform
970 * @privilege http://tizen.org/privilege/tethering.admin
971 * @param[in] tethering The tethering handle
972 * @param[in] passphrase The passphrase
973 * @return 0 on success, otherwise negative error value
974 * @retval #TETHERING_ERROR_NONE Successful
975 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
976 * @see tethering_wifi_ap_get_passphrase()
978 int tethering_wifi_ap_set_passphrase(tethering_h tethering, const char *passphrase);
982 * @brief Gets the passphrase for Wi-Fi AP.
983 * @details If the passphrase is not set, random string of 8 characters will be used.
985 * @privlevel platform
986 * @privilege http://tizen.org/privilege/tethering.admin
987 * @remarks @a passphrase must be released using free().
988 * @param[in] tethering The tethering handle
989 * @param[out] passphrase The passphrase
990 * @return 0 on success, otherwise negative error value
991 * @retval #TETHERING_ERROR_NONE Successful
992 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
993 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
994 * @see tethering_wifi_ap_set_passphrase()
996 int tethering_wifi_ap_get_passphrase(tethering_h tethering, char **passphrase);
1000 * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility) for Wi-Fi AP.
1002 * @privlevel platform
1003 * @privilege http://tizen.org/privilege/tethering.admin
1004 * @remarks Devices connected via MobileAP will be disconnected when the settings are reloaded.
1005 * @param[in] tethering The tethering handle
1006 * @param[in] callback The callback function to invoke
1007 * @param[in] user_data The user data to be passed to the callback function
1008 * @return 0 on success, otherwise negative error value
1009 * @retval #TETHERING_ERROR_NONE Successful
1010 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1011 * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed
1013 int tethering_wifi_ap_reload_settings(tethering_h tethering, tethering_wifi_ap_settings_reloaded_cb callback, void *user_data);
1022 * @addtogroup CAPI_NETWORK_TETHERING_CLIENT_MODULE
1028 * @brief Clones the handle of a client.
1030 * @privlevel platform
1031 * @privilege http://tizen.org/privilege/tethering.admin
1032 * @remarks @a dest must be release using tethering_client_destroy().
1033 * @param[out] dest The cloned client handle
1034 * @param[in] origin The origin client handle
1035 * @return 0 on success, otherwise a negative error value
1036 * @retval #TETHERING_ERROR_NONE Successful
1037 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1038 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
1039 * @see tethering_client_destroy()
1041 int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin);
1045 * @brief Destroys the handle of a client.
1047 * @privlevel platform
1048 * @privilege http://tizen.org/privilege/tethering.admin
1049 * @param[in] client The client handle
1050 * @return 0 on success, otherwise a negative error value
1051 * @retval #TETHERING_ERROR_NONE Successful
1052 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1053 * @see tethering_client_clone()
1055 int tethering_client_destroy(tethering_client_h client);
1059 * @brief Gets the tethering type of client.
1061 * @privlevel platform
1062 * @privilege http://tizen.org/privilege/tethering.admin
1063 * @param[in] client The handle of client
1064 * @param[out] type The type of tethering
1065 * @return 0 on success, otherwise a negative error value.
1066 * @retval #TETHERING_ERROR_NONE Successful
1067 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1068 * @see tethering_usb_get_connected_client()
1069 * @see tethering_connection_state_changed_cb()
1071 int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type);
1075 * @brief Gets the name of a client.
1077 * @privlevel platform
1078 * @privilege http://tizen.org/privilege/tethering.admin
1079 * @remarks @a name must be released using free().
1080 * @param[in] client The client handle
1081 * @param[out] name The name of the client
1082 * @return 0 on success, otherwise a negative error value
1083 * @retval #TETHERING_ERROR_NONE Successful
1084 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1085 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
1086 * @see tethering_usb_get_connected_client()
1087 * @see tethering_connection_state_changed_cb()
1089 int tethering_client_get_name(tethering_client_h client, char **name);
1093 * @brief Gets the IP address of a client.
1095 * @privlevel platform
1096 * @privilege http://tizen.org/privilege/tethering.admin
1097 * @remarks @a ip_address must be released using free().
1098 * @param[in] client The client handle
1099 * @param[in] address_family The address family of IP address. Currently, #TETHERING_ADDRESS_FAMILY_IPV4 is only supported
1100 * @param[out] ip_address The IP address
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_OUT_OF_MEMORY Out of memory
1105 * @see tethering_usb_get_connected_client()
1106 * @see tethering_connection_state_changed_cb()
1108 int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address);
1112 * @brief Gets the MAC address of a client such as "FC:A1:3E:D6:B1:B1".
1114 * @privlevel platform
1115 * @privilege http://tizen.org/privilege/tethering.admin
1116 * @remarks @a mac_address must be released using free().
1117 * @param[in] client The client handle
1118 * @param[out] mac_address The MAC address
1119 * @return 0 on success, otherwise a negative error value
1120 * @retval #TETHERING_ERROR_NONE Successful
1121 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1122 * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory
1123 * @see tethering_usb_get_connected_client()
1124 * @see tethering_connection_state_changed_cb()
1126 int tethering_client_get_mac_address(tethering_client_h client, char **mac_address);
1130 * @brief Gets the connection time of a client.
1132 * @privlevel platform
1133 * @privilege http://tizen.org/privilege/tethering.admin
1134 * @param[in] client The client handle
1135 * @param[out] time The connected time of the client
1136 * @return 0 on success, otherwise a negative error value
1137 * @retval #TETHERING_ERROR_NONE Successful
1138 * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
1139 * @see tethering_usb_get_connected_client()
1140 * @see tethering_connection_state_changed_cb()
1142 int tethering_client_get_time(tethering_client_h client, time_t *timestamp);
1153 #endif /* __TIZEN_NETWORK_TETHERING_H__ */