2 * Copyright (c) 2011-2013 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 __NET_CONNECTION_INTF_H__
18 #define __NET_CONNECTION_INTF_H__
20 #include "connection_profile.h"
24 #endif /* __cplusplus */
27 * @file net_connection.h
31 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
36 * @brief The connection handle.
39 typedef void* connection_h;
42 * @brief The profiles iterator handle.
45 typedef void* connection_profile_iterator_h;
48 * @brief Enumeration for connection type.
53 CONNECTION_TYPE_DISCONNECTED = 0, /**< Disconnected */
54 CONNECTION_TYPE_WIFI = 1, /**< Wi-Fi type */
55 CONNECTION_TYPE_CELLULAR = 2, /**< Cellular type */
56 CONNECTION_TYPE_ETHERNET = 3, /**< Ethernet type */
57 CONNECTION_TYPE_BT = 4, /**< Bluetooth type */
61 * @brief Enumeration for cellular network state.
66 CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE = 0, /**< Out of service */
67 CONNECTION_CELLULAR_STATE_FLIGHT_MODE = 1, /**< Flight mode */
68 CONNECTION_CELLULAR_STATE_ROAMING_OFF = 2, /**< Roaming is turned off */
69 CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE = 3, /**< Call is only available */
70 CONNECTION_CELLULAR_STATE_AVAILABLE = 4, /**< Available but not connected yet */
71 CONNECTION_CELLULAR_STATE_CONNECTED = 5, /**< Connected */
72 } connection_cellular_state_e;
75 * @brief Enumeration for Wi-Fi state.
80 CONNECTION_WIFI_STATE_DEACTIVATED = 0, /**< Wi-Fi is deactivated */
81 CONNECTION_WIFI_STATE_DISCONNECTED = 1, /**< Disconnected */
82 CONNECTION_WIFI_STATE_CONNECTED = 2, /**< Connected */
83 } connection_wifi_state_e;
86 * @brief Enumeration for ethernet state.
91 CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */
92 CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */
93 CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */
94 } connection_ethernet_state_e;
97 * @brief Enumeration for Bluetooth state.
102 CONNECTION_BT_STATE_DEACTIVATED = 0, /**< There is no Bluetooth profile to open */
103 CONNECTION_BT_STATE_DISCONNECTED = 1, /**< Disconnected */
104 CONNECTION_BT_STATE_CONNECTED = 2, /**< Connected */
105 } connection_bt_state_e;
108 * @brief Enumeration for connection iterator type.
113 CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */
114 CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */
115 CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */
116 } connection_iterator_type_e;
119 * @brief Enumeration for reset profile type.
124 CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */
125 CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */
126 } connection_reset_option_e;
129 * @brief This enumeration defines the attached or detached state of ethernet cable.
134 CONNECTION_ETHERNET_CABLE_DETACHED = 0, /**< Ethernet cable is detached */
135 CONNECTION_ETHERNET_CABLE_ATTACHED = 1, /**< Ethernet cable is attached */
136 } connection_ethernet_cable_state_e;
139 * @brief Enumeration for connection errors.
144 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
145 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
146 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
147 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
148 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
149 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
150 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
151 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
152 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
153 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
154 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
155 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
156 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
157 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
158 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
159 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */
160 } connection_error_e;
167 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
172 * @brief Enumeration for statistics type.
177 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
178 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
179 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
180 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
181 } connection_statistics_type_e;
188 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
194 * @brief Creates a handle for managing data connections.
197 * @privilege %http://tizen.org/privilege/network.get
198 * @remarks You must release @a handle using connection_destroy().
199 * @param[out] connection The connection handle
200 * @return @c 0 on success, otherwise a negative error value
201 * @retval #CONNECTION_ERROR_NONE Successful
202 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
203 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
204 * @see connection_destroy()
206 int connection_create(connection_h* connection);
209 * @brief Destroys the connection handle.
211 * @param[in] connection The connection handle
212 * @return @c 0 on success, otherwise negative error value
213 * @retval #CONNECTION_ERROR_NONE Successful
214 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
215 * @see connection_create()
217 int connection_destroy(connection_h connection);
220 * @brief Called when the type of a connection is changed.
222 * @param[in] type The type of the current network connection
223 * @param[in] user_data The user data passed from the callback registration function
224 * @see connection_set_type_changed_cb()
225 * @see connection_unset_type_changed_cb()
227 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
230 * @brief Called when the address is changed.
232 * @param[in] ipv4_address The IP address for IPv4
233 * @param[in] ipv6_address The IP address for IPv6
234 * @param[in] user_data The user data passed from the callback registration function
235 * @see connection_set_ip_address_changed_cb()
236 * @see connection_unset_ip_address_changed_cb()
237 * @see connection_set_proxy_address_changed_cb()
238 * @see connection_unset_proxy_address_changed_cb()
240 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
243 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
245 * @param[in] result The result
246 * @param[in] user_data The user data passed from connection_open_profile()
247 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
248 * @see connection_set_default_cellular_service_profile_async()
250 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
253 * @brief Gets the type of the current profile for data connection.
255 * @param[in] connection The connection handle
256 * @param[out] type The type of the network
257 * @return @c 0 on success, otherwise negative error value
258 * @retval #CONNECTION_ERROR_NONE Successful
259 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
260 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
262 int connection_get_type(connection_h connection, connection_type_e* type);
265 * @brief Gets the IP address of the current connection.
267 * @remarks You must release @a ip_address using free().
268 * @param[in] connection The connection handle
269 * @param[in] address_family The address family
270 * @param[out] ip_address The pointer to the IP address string
271 * @return @c 0 on success, otherwise a negative error value
272 * @retval #CONNECTION_ERROR_NONE Successful
273 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
274 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
275 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
277 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
280 * @brief Gets the proxy address of the current connection.
282 * @remarks You must release @a proxy using free().
283 * @param[in] connection The connection handle
284 * @param[in] address_family The address family
285 * @param[out] proxy The proxy address
286 * @return @c 0 on success, otherwise a negative error value
287 * @retval #CONNECTION_ERROR_NONE Successful
288 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
289 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
290 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
292 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
295 * @brief Gets the MAC address of the Wi-Fi or ethernet.
297 * @remarks @a mac_addr must be released with free() by you.
298 * @param[in] connection The handle of the connection
299 * @param[in] type The type of current network connection
300 * @param[out] mac_addr The MAC address
301 * @return 0 on success, otherwise negative error value.
302 * @retval #CONNECTION_ERROR_NONE Successful
303 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
304 * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
305 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
306 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
307 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
309 int connection_get_mac_address(connection_h connection, connection_type_e type, char** mac_addr);
312 * @brief Gets the state of cellular connection.
313 * @details The returned state is for the cellular connection state.
315 * @param[in] connection The connection handle
316 * @param[out] state The state of the cellular connection
317 * @return @c 0 on success, otherwise a negative error value
318 * @retval #CONNECTION_ERROR_NONE Successful
319 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
320 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
321 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
323 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
326 * @brief Gets the state of the Wi-Fi.
327 * @details The returned state is for the Wi-Fi connection state.
330 * @privilege %http://tizen.org/privilege/network.get
331 * @param[in] connection The connection handle
332 * @param[out] state The state of Wi-Fi connection
333 * @return @c 0 on success, otherwise a negative error value
334 * @retval #CONNECTION_ERROR_NONE Successful
335 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
336 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
337 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
338 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
340 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
343 * @brief Gets the state of the Ethernet.
344 * @details The returned state is for the Ethernet connection state.
347 * @privilege %http://tizen.org/privilege/network.get
348 * @param[in] connection The connection handle
349 * @param[out] state The state of Ethernet connection
350 * @return @c 0 on success, otherwise a negative error value
351 * @retval #CONNECTION_ERROR_NONE Successful
352 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
353 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
354 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
355 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
357 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
360 * @brief Checks for ethernet cable is attached or not.
361 * @details The returned state is for the ethernet cable state.
364 * @privilege %http://tizen.org/privilege/network.get
365 * @param[in] connection The handle of the connection
366 * @param[in] state - Enum connection_ethernet_cable_state_e
367 * @return 0 on success, otherwise negative error value
368 * @retval #CONNECTION_ERROR_NONE Successful
369 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
370 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
371 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
372 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
374 int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state);
377 * @brief Called when ethernet cable is plugged [in/out].
379 * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
380 * @param[in] user_data The user data passed to callback registration function
382 typedef void(*connection_ethernet_cable_state_chaged_cb)(
383 connection_ethernet_cable_state_e state, void* user_data);
386 * @brief Registers callback for ethernet cable is plugged [in/out] event.
388 * @param[in] callback The callback function to be called
389 * @param[in] user_data The user data passed to the callback function
390 * @return 0 on success, otherwise negative error value
391 * @retval #CONNECTION_ERROR_NONE Successful
392 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
393 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
394 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
396 int connection_set_ethernet_cable_state_chaged_cb( connection_h connection,
397 connection_ethernet_cable_state_chaged_cb callback, void *user_data);
400 * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
402 * @param[in] connection The handle of connection
403 * @return 0 on success, otherwise negative error value
404 * @retval #CONNECTION_ERROR_NONE Successful
405 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
406 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
407 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
409 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
412 * @brief Gets the state of the Bluetooth.
413 * @details The returned state is for the Bluetooth connection state.
416 * @privilege %http://tizen.org/privilege/network.get
417 * @param[in] connection The connection handle
418 * @param[out] state The state of the Bluetooth connection
419 * @return @c 0 on success, otherwise a negative error value
420 * @retval #CONNECTION_ERROR_NONE Successful
421 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
422 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
423 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
424 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
426 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
429 * @brief Registers the callback that is called when the type of the current connection is changed.
431 * @param[in] connection The connection handle
432 * @param[in] callback The callback function to be called
433 * @param[in] user_data The user data passed to the callback function
434 * @return @c 0 on success, otherwise a negative error value
435 * @retval #CONNECTION_ERROR_NONE Successful
436 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
437 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
439 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
442 * @brief Unregisters the callback that is called when the type of current connection is changed.
444 * @param[in] connection The connection handle
445 * @return @c 0 on success, otherwise a negative error value
446 * @retval #CONNECTION_ERROR_NONE Successful
447 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
448 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
450 int connection_unset_type_changed_cb(connection_h connection);
453 * @brief Registers the callback that is called when the IP address is changed.
455 * @param[in] connection The connection handle
456 * @param[in] callback The callback function to be called
457 * @param[in] user_data The user data passed to the callback function
458 * @return @c 0 on success, otherwise a negative error value
459 * @retval #CONNECTION_ERROR_NONE Successful
460 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
461 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
463 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
466 * @brief Unregisters the callback that is called when the IP address is changed.
468 * @param[in] connection The connection handle
469 * @return @c 0 on success, otherwise a negative error value
470 * @retval #CONNECTION_ERROR_NONE Successful
471 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
472 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
474 int connection_unset_ip_address_changed_cb(connection_h connection);
477 * @brief Registers the callback that is called when the proxy address is changed.
479 * @param[in] connection The connection handle
480 * @param[in] callback The callback function to be called
481 * @param[in] user_data The user data passed to the callback function
482 * @return @c 0 on success, otherwise a negative error value
483 * @retval #CONNECTION_ERROR_NONE Successful
484 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
485 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
487 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
490 * @brief Unregisters the callback that is called when the proxy address is changed.
492 * @param[in] connection The connection handle
493 * @return @c 0 on success, otherwise a negative error value
494 * @retval #CONNECTION_ERROR_NONE Successful
495 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
496 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
498 int connection_unset_proxy_address_changed_cb(connection_h connection);
501 * @brief Adds a new profile which is created by connection_profile_create().
504 * @privilege %http://tizen.org/privilege/network.profile
505 * @remarks You can only add a profile of the cellular type.
506 * @param[in] connection The connection handle
507 * @param[in] profile The profile handle
508 * @return @c 0 on success, otherwise a negative error value
509 * @retval #CONNECTION_ERROR_NONE Successful
510 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
511 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
512 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
513 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
515 int connection_add_profile(connection_h connection, connection_profile_h profile);
518 * @brief Removes an existing profile.
521 * @privilege %http://tizen.org/privilege/network.profile \n
522 * %http://tizen.org/privilege/network.get
523 * @remarks This API needs both privileges.
524 * @param[in] connection The connection handle
525 * @param[in] profile The profile handle
526 * @return @c 0 on success, otherwise a negative error value
527 * @retval #CONNECTION_ERROR_NONE Successful
528 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
529 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
530 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
531 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
533 int connection_remove_profile(connection_h connection, connection_profile_h profile);
536 * @brief Updates an existing profile.
537 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
538 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
539 * In addition, the existing profile will be updated if you call connection_open_profile().
542 * @privilege %http://tizen.org/privilege/network.profile \n
543 * %http://tizen.org/privilege/network.get
544 * @remarks This API needs both privileges.
545 * @param[in] connection The connection handle
546 * @param[in] profile The profile handle
547 * @return @c 0 on success, otherwise a negative error value
548 * @retval #CONNECTION_ERROR_NONE Successful
549 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
550 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
551 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
552 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
553 * @see connection_open_profile()
555 int connection_update_profile(connection_h connection, connection_profile_h profile);
558 * @brief Gets a profiles iterator.
561 * @privilege %http://tizen.org/privilege/network.get
562 * @remarks You must release @a profile_iterator using connection_destroy().
563 * @param[in] connection The connection handle
564 * @param[in] type The type of the connetion iterator
565 * @param[out] profile_iterator The iterator of profile
566 * @return @c 0 on success, otherwise a negative error value
567 * @retval #CONNECTION_ERROR_NONE Successful
568 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
569 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
570 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
571 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
573 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
576 * @brief Moves the profile iterator to the next position and gets a profile handle.
578 * @param[in] profile_iterator The iterator of profile
579 * @param[out] profile The profile handle
580 * @return @c 0 on success, otherwise a negative error value
581 * @retval #CONNECTION_ERROR_NONE Successful
582 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
583 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
585 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
588 * @brief Checks whether the next element of a profile iterator exists or not.
590 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
591 * @param[in] profile_iterator The iterator of profile
592 * @return @c true if next element exists, otherwise @c false if next element doesn't exist
594 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
597 * @brief Destroys a profiles iterator.
599 * @param[in] profile_iterator The iterator of the profile
600 * @return @c 0 on success, otherwise a negative error value
601 * @retval #CONNECTION_ERROR_NONE Successful
602 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
604 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
607 * @brief Gets the name of the default profile.
610 * @privilege %http://tizen.org/privilege/network.get
611 * @remarks You must release @a profile using connection_profile_destroy().
612 * @param[in] connection The connection handle
613 * @param[out] profile The profile handle
614 * @return @c 0 on success, otherwise a negative error value
615 * @retval #CONNECTION_ERROR_NONE Successful
616 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
617 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
618 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
619 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
620 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
622 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
625 * @brief Gets the default profile which provides the given cellular service.
628 * @privilege %http://tizen.org/privilege/network.get
629 * @remarks You must release @a profile using connection_profile_destroy().
630 * @param[in] connection The connection handle
631 * @param[in] type The type of cellular service \n
632 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
633 * @param[out] profile The profile handle
634 * @return @c 0 on success, otherwise a negative error value
635 * @retval #CONNECTION_ERROR_NONE Successful
636 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
637 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
638 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
639 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda
640 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
642 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
645 * @brief Sets the default profile which provides the given cellular service.
648 * @privilege %http://tizen.org/privilege/network.profile \n
649 * %http://tizen.org/privilege/network.get
650 * @remarks This API needs both privileges.
651 * @param[in] connection The connection handle
652 * @param[in] type The type of cellular service \n
653 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
654 * @param[in] profile The profile handle
655 * @return @c 0 on success, otherwise a negative error value
656 * @retval #CONNECTION_ERROR_NONE Successful
657 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
658 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
659 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
660 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
662 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
665 * @brief Sets the default profile which provides the given cellular service, asynchronously.
668 * @privilege %http://tizen.org/privilege/network.profile \n
669 * %http://tizen.org/privilege/network.get
670 * @remarks This API needs both privileges.
671 * @param[in] connection The connection handle
672 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
673 * @param[in] profile The profile handle
674 * @param[in] callback The callback function to be called
675 * @param[in] user_data The user data passed to the callback function
676 * @return @c 0 on success, otherwise negative error value
677 * @retval #CONNECTION_ERROR_NONE Successful
678 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
679 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
680 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
681 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
683 int connection_set_default_cellular_service_profile_async(connection_h connection,
684 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
687 * @brief Called after connection_open_profile() is finished.
689 * @param[in] result The result
690 * @param[in] user_data The user data passed from connection_open_profile()
691 * @pre connection_open_profile() will invoke this callback function.
692 * @see connection_open_profile()
694 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
697 * @brief Called after connection_close_profile() is finished.
699 * @param[in] result The result
700 * @param[in] user_data The user data passed from connection_close_profile()
701 * @pre connection_close_profile() will invoke this callback function.
702 * @see connection_close_profile()
704 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
707 * @brief Called after connection_reset_profile() is finished.
709 * @param[in] result The result
710 * @param[in] user_data The user data passed from connection_reset_profile()
711 * @pre connection_reset_profile() will invoke this callback function.
712 * @see connection_reset_profile()
714 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
717 * @brief Opens a connection of profile, asynchronously.
720 * @privilege %http://tizen.org/privilege/network.set \n
721 * %http://tizen.org/privilege/network.get
722 * @remarks This API needs both privileges.
723 * @param[in] connection The connection handle
724 * @param[in] profile The profile handle
725 * @param[in] callback The callback function to be called
726 * @param[in] user_data The user data passed to the callback function
727 * @return @c 0 on success, otherwise negative error value
728 * @retval #CONNECTION_ERROR_NONE Successful
729 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
730 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
731 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
732 * @post connection_opened_cb() will be invoked.
733 * @see connection_opened_cb()
734 * @see connection_close_profile()
735 * @see connection_profile_set_state_changed_cb()
736 * @see connection_profile_unset_state_changed_cb()
737 * @see connection_profile_state_changed_cb()
739 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
742 * @brief Closes a connection of profile.
745 * @privilege %http://tizen.org/privilege/network.set
746 * @param[in] connection The connection handle
747 * @param[in] profile The profile handle
748 * @param[in] callback The callback function to be called
749 * @param[in] user_data The user data passed to the callback function
750 * @return @c 0 on success, otherwise negative error value
751 * @retval #CONNECTION_ERROR_NONE Successful
752 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
753 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
754 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
755 * @post connection_closed_cb() will be invoked.
756 * @see connection_closed_cb()
757 * @see connection_open_profile()
758 * @see connection_profile_set_state_changed_cb()
759 * @see connection_profile_unset_state_changed_cb()
760 * @see connection_profile_state_changed_cb()
762 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
765 * @brief Resets the cellular profile.
768 * @privilege %http://tizen.org/privilege/network.profile \n
769 * %http://tizen.org/privilege/network.get
770 * @remarks This API needs both privileges.
771 * @param[in] connection The connection handle
772 * @param[in] type The type of reset
773 * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.)
774 * @param[in] callback The callback function to be called
775 * @param[in] user_data The user data passed to the callback function
776 * @return 0 on success, otherwise negative error value
777 * @retval #CONNECTION_ERROR_NONE Successful
778 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
779 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
780 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
781 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
782 * @post connection_reset_cb() will be invoked.
784 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
787 * @brief Adds a IPv4 route to the routing table.
788 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
791 * @privilege %http://tizen.org/privilege/network.set
792 * @param[in] connection The connection handle
793 * @param[in] interface_name The name of network interface
794 * @param[in] host_address The IP address of the host
795 * @return @c 0 on success, otherwise negative error value
796 * @retval #CONNECTION_ERROR_NONE Successful
797 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
798 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
799 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
800 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
801 * @see connection_profile_get_network_interface_name()
803 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
806 * @brief Removes a IPv4 route from the routing table.
807 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
810 * @privilege %http://tizen.org/privilege/network.set
811 * @param[in] connection The connection handle
812 * @param[in] interface_name The name of network interface
813 * @param[in] host_address The IP address of the host
814 * @return @c 0 on success, otherwise negative error value
815 * @retval #CONNECTION_ERROR_NONE Successful
816 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
817 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
818 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
819 * @see connection_profile_get_network_interface_name()
821 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
824 * @brief Adds a IPv6 route to the routing table.
825 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
828 * @privilege %http://tizen.org/privilege/network.set
829 * @param[in] connection The connection handle
830 * @param[in] interface_name The name of network interface
831 * @param[in] host_address The IP address of the host
832 * @param[in] gateway The gateway address
833 * @return @c 0 on success, otherwise negative error value
834 * @retval #CONNECTION_ERROR_NONE Successful
835 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
836 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
837 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
838 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
839 * @see connection_profile_get_network_interface_name()
842 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
845 * @brief Removes a IPV6 route from the routing table.
846 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
849 * @privilege %http://tizen.org/privilege/network.set
850 * @param[in] connection The connection handle
851 * @param[in] interface_name The name of network interface
852 * @param[in] host_address The IP address of the host
853 * @param[in] gateway The gateway address
854 * @return @c 0 on success, otherwise negative error value
855 * @retval #CONNECTION_ERROR_NONE Successful
856 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
857 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
858 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
859 * @see connection_profile_get_network_interface_name()
861 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
868 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
873 * @brief Gets the statistics information.
876 * @privilege %http://tizen.org/privilege/network.get
877 * @param[in] connection The connection handle
878 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
879 * @param[in] statistics_type The type of statistics
880 * @param[out] size The received data size of the last cellular packet data connection (bytes)
881 * @return @c 0 on success, otherwise negative error value
882 * @retval #CONNECTION_ERROR_NONE Successful
883 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
884 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
885 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
887 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
890 * @brief Resets the statistics information.
893 * @privilege %http://tizen.org/privilege/network.set
894 * @remarks This API needs both privileges.
895 * @param[in] connection The connection handle
896 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
897 * @param[in] statistics_type The type of statistics
898 * @return @c 0 on success, otherwise negative error value
899 * @retval #CONNECTION_ERROR_NONE Successful
900 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
901 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
902 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
903 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
905 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
913 #endif /* __cplusplus */