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.
18 #ifndef __NET_CONNECTION_INTF_H__
19 #define __NET_CONNECTION_INTF_H__
22 #include "connection_profile.h"
27 #endif /* __cplusplus */
31 * @file net_connection.h
36 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
42 * @brief The connection handle.
43 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45 typedef void* connection_h;
49 * @brief The profiles iterator handle.
50 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
52 typedef void* connection_profile_iterator_h;
56 * @brief Enumeration for connection type.
57 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
60 CONNECTION_TYPE_DISCONNECTED = 0, /**< Disconnected */
61 CONNECTION_TYPE_WIFI = 1, /**< Wi-Fi type */
62 CONNECTION_TYPE_CELLULAR = 2, /**< Cellular type */
63 CONNECTION_TYPE_ETHERNET = 3, /**< Ethernet type */
64 CONNECTION_TYPE_BT = 4, /**< Bluetooth type */
65 CONNECTION_TYPE_NET_PROXY, /**< Proxy type for internet connection (Since 3.0) */
70 * @brief Enumeration for cellular network state.
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
74 CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE = 0, /**< Out of service */
75 CONNECTION_CELLULAR_STATE_FLIGHT_MODE = 1, /**< Flight mode */
76 CONNECTION_CELLULAR_STATE_ROAMING_OFF = 2, /**< Roaming is turned off */
77 CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE = 3, /**< Call is only available */
78 CONNECTION_CELLULAR_STATE_AVAILABLE = 4, /**< Available but not connected yet */
79 CONNECTION_CELLULAR_STATE_CONNECTED = 5, /**< Connected */
80 } connection_cellular_state_e;
84 * @brief Enumeration for Wi-Fi state.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
88 CONNECTION_WIFI_STATE_DEACTIVATED = 0, /**< Wi-Fi is deactivated */
89 CONNECTION_WIFI_STATE_DISCONNECTED = 1, /**< Disconnected */
90 CONNECTION_WIFI_STATE_CONNECTED = 2, /**< Connected */
91 } connection_wifi_state_e;
95 * @brief Enumeration for ethernet state.
96 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
99 CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */
100 CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */
101 CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */
102 } connection_ethernet_state_e;
106 * @brief Enumeration for Bluetooth state.
107 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
110 CONNECTION_BT_STATE_DEACTIVATED = 0, /**< There is no Bluetooth profile to open */
111 CONNECTION_BT_STATE_DISCONNECTED = 1, /**< Disconnected */
112 CONNECTION_BT_STATE_CONNECTED = 2, /**< Connected */
113 } connection_bt_state_e;
117 * @brief Enumeration for connection iterator type.
118 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
121 CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */
122 CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */
123 CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */
124 } connection_iterator_type_e;
128 * @brief Enumeration for reset profile type.
129 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132 CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */
133 CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */
134 } connection_reset_option_e;
138 * @brief Enumeration for the attached or detached state of ethernet cable.
139 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
142 CONNECTION_ETHERNET_CABLE_DETACHED = 0, /**< Ethernet cable is detached */
143 CONNECTION_ETHERNET_CABLE_ATTACHED = 1, /**< Ethernet cable is attached */
144 } connection_ethernet_cable_state_e;
148 * @brief Enumeration for connection errors.
149 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
153 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
154 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
155 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
156 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
157 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
158 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
159 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
160 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
161 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
162 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
163 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
164 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
165 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
166 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
167 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */
168 } connection_error_e;
176 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
182 * @brief Enumeration for statistics type.
183 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
186 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
187 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
188 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
189 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
190 } connection_statistics_type_e;
199 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
205 * @brief Creates a handle for managing data connections.
206 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
208 * @privilege %http://tizen.org/privilege/network.get
209 * @remarks You must release @a handle using connection_destroy().
210 * @param[out] connection The connection handle
211 * @return @c 0 on success,
212 * otherwise a negative error value
213 * @retval #CONNECTION_ERROR_NONE Successful
214 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
215 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
216 * @see connection_destroy()
218 int connection_create(connection_h* connection);
222 * @brief Destroys the connection handle.
223 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
224 * @param[in] connection The connection handle
225 * @return @c 0 on success,
226 * otherwise a negative error value
227 * @retval #CONNECTION_ERROR_NONE Successful
228 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
229 * @see connection_create()
231 int connection_destroy(connection_h connection);
235 * @brief Called when the type of a connection is changed.
236 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
237 * @param[in] type The type of the current network connection
238 * @param[in] user_data The user data passed from the callback registration function
239 * @see connection_set_type_changed_cb()
240 * @see connection_unset_type_changed_cb()
242 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
246 * @brief Called when the address is changed.
247 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
248 * @param[in] ipv4_address The IP address for IPv4
249 * @param[in] ipv6_address The IP address for IPv6
250 * @param[in] user_data The user data passed from the callback registration function
251 * @see connection_set_ip_address_changed_cb()
252 * @see connection_unset_ip_address_changed_cb()
253 * @see connection_set_proxy_address_changed_cb()
254 * @see connection_unset_proxy_address_changed_cb()
256 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
260 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
261 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
262 * @param[in] result The result
263 * @param[in] user_data The user data passed from connection_open_profile()
264 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
265 * @see connection_set_default_cellular_service_profile_async()
267 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
269 /* @brief Called with an IPv6 address.
271 * @remarks If @a ipv6_address is needed outside the callback, a copy should be made. \n
272 * @a ipv6_address will be freed automatically after the execution of this callback.
273 * @param[in] ipv6_address The IPv6 address
274 * @param[in] user_data The user data passed from the foreach function
275 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
276 * @pre connection_foreach_ipv6_addresses() will invoke this callback.
277 * @see connection_foreach_ipv6_addresses()
279 typedef bool(*connection_ipv6_address_cb)(char *ipv6_address, void *user_data);
282 * @brief Gets the type of the current profile for data connection.
283 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
284 * @param[in] connection The connection handle
285 * @param[out] type The type of the network
286 * @return @c 0 on success,
287 * otherwise a negative error value
288 * @retval #CONNECTION_ERROR_NONE Successful
289 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
290 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
292 int connection_get_type(connection_h connection, connection_type_e* type);
296 * @brief Gets the IP address of the current connection.
297 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
298 * @remarks You must release @a ip_address using free().
299 * @param[in] connection The connection handle
300 * @param[in] address_family The address family
301 * @param[out] ip_address The pointer to the IP address string
302 * @return @c 0 on success,
303 * otherwise a negative error value
304 * @retval #CONNECTION_ERROR_NONE Successful
305 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
306 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
307 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
309 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
313 * @brief Gets the proxy address of the current connection.
314 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
315 * @remarks You must release @a proxy using free().
316 * @param[in] connection The connection handle
317 * @param[in] address_family The address family
318 * @param[out] proxy The proxy address
319 * @return @c 0 on success,
320 * otherwise a negative error value
321 * @retval #CONNECTION_ERROR_NONE Successful
322 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
323 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
324 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
326 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
330 * @brief Gets the MAC address of the Wi-Fi or ethernet.
331 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
332 * @remarks @a mac_addr must be released with free() by you.
333 * @param[in] connection The handle of the connection
334 * @param[in] type The type of current network connection
335 * @param[out] mac_addr The MAC address
336 * @return @c 0 on success,
337 * otherwise a negative error value
338 * @retval #CONNECTION_ERROR_NONE Successful
339 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
340 * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
341 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
342 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
343 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
345 int connection_get_mac_address(connection_h connection, connection_type_e type, char** mac_addr);
349 * @brief Gets the state of cellular connection.
350 * @details The returned state is for the cellular connection state.
351 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352 * @param[in] connection The connection handle
353 * @param[out] state The state of the cellular connection
354 * @return @c 0 on success,
355 * otherwise a negative error value
356 * @retval #CONNECTION_ERROR_NONE Successful
357 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
359 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
361 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
365 * @brief Gets the state of the Wi-Fi.
366 * @details The returned state is for the Wi-Fi connection state.
367 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
369 * @privilege %http://tizen.org/privilege/network.get
370 * @param[in] connection The connection handle
371 * @param[out] state The state of Wi-Fi connection
372 * @return @c 0 on success,
373 * otherwise a negative error value
374 * @retval #CONNECTION_ERROR_NONE Successful
375 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
376 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
377 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
378 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
380 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
384 * @brief Gets the state of the Ethernet.
385 * @details The returned state is for the Ethernet connection state.
386 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
388 * @privilege %http://tizen.org/privilege/network.get
389 * @param[in] connection The connection handle
390 * @param[out] state The state of Ethernet connection
391 * @return @c 0 on success,
392 * otherwise a negative error value
393 * @retval #CONNECTION_ERROR_NONE Successful
394 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
395 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
396 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
397 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
399 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
403 * @brief Checks for ethernet cable is attached or not.
404 * @details The returned state is for the ethernet cable state.
405 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
407 * @privilege %http://tizen.org/privilege/network.get
408 * @param[in] connection The handle of the connection
409 * @param[in] state - Enum connection_ethernet_cable_state_e
410 * @return @c 0 on success,
411 * otherwise a negative error value
412 * @retval #CONNECTION_ERROR_NONE Successful
413 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
414 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
415 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
416 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
418 int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state);
422 * @brief Called when ethernet cable is plugged [in/out].
423 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
424 * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
425 * @param[in] user_data The user data passed to callback registration function
427 typedef void(*connection_ethernet_cable_state_chaged_cb)(connection_ethernet_cable_state_e state, void* user_data);
431 * @brief Registers callback for ethernet cable is plugged [in/out] event.
432 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
433 * @param[in] connection The handle of connection
434 * @param[in] callback The callback function to be called
435 * @param[in] user_data The user data passed to the callback function
436 * @return @c 0 on success,
437 * otherwise a negative error value
438 * @retval #CONNECTION_ERROR_NONE Successful
439 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
440 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
441 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
443 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection, connection_ethernet_cable_state_chaged_cb callback, void *user_data);
447 * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
448 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
449 * @param[in] connection The handle of connection
450 * @return @c 0 on success,
451 * otherwise a negative error value
452 * @retval #CONNECTION_ERROR_NONE Successful
453 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
454 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
455 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
457 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
461 * @brief Gets the state of the Bluetooth.
462 * @details The returned state is for the Bluetooth connection state.
463 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
465 * @privilege %http://tizen.org/privilege/network.get
466 * @param[in] connection The connection handle
467 * @param[out] state The state of the Bluetooth connection
468 * @return @c 0 on success,
469 * 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
473 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
474 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
476 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
480 * @brief Registers the callback that is called when the type of the current connection is changed.
481 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
482 * @param[in] connection The connection handle
483 * @param[in] callback The callback function to be called
484 * @param[in] user_data The user data passed to the callback function
485 * @return @c 0 on success,
486 * otherwise a negative error value
487 * @retval #CONNECTION_ERROR_NONE Successful
488 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
489 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
491 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
495 * @brief Unregisters the callback that is called when the type of current connection is changed.
496 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
497 * @param[in] connection The connection handle
498 * @return @c 0 on success,
499 * otherwise a negative error value
500 * @retval #CONNECTION_ERROR_NONE Successful
501 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
502 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
504 int connection_unset_type_changed_cb(connection_h connection);
508 * @brief Registers the callback that is called when the IP address is changed.
509 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
510 * @param[in] connection The connection handle
511 * @param[in] callback The callback function to be called
512 * @param[in] user_data The user data passed to the callback function
513 * @return @c 0 on success,
514 * otherwise a negative error value
515 * @retval #CONNECTION_ERROR_NONE Successful
516 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
517 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
519 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
523 * @brief Unregisters the callback that is called when the IP address is changed.
524 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
525 * @param[in] connection The connection handle
526 * @return @c 0 on success,
527 * otherwise a negative error value
528 * @retval #CONNECTION_ERROR_NONE Successful
529 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
530 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
532 int connection_unset_ip_address_changed_cb(connection_h connection);
536 * @brief Registers the callback that is called when the proxy address is changed.
537 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
538 * @param[in] connection The connection handle
539 * @param[in] callback The callback function to be called
540 * @param[in] user_data The user data passed to the callback function
541 * @return @c 0 on success,
542 * otherwise a negative error value
543 * @retval #CONNECTION_ERROR_NONE Successful
544 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
545 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
547 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
551 * @brief Unregisters the callback that is called when the proxy address is changed.
552 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553 * @param[in] connection The connection handle
554 * @return @c 0 on success,
555 * otherwise a negative error value
556 * @retval #CONNECTION_ERROR_NONE Successful
557 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
558 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
560 int connection_unset_proxy_address_changed_cb(connection_h connection);
564 * @brief Adds a new profile which is created by connection_profile_create().
565 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
567 * @privilege %http://tizen.org/privilege/network.profile
568 * @remarks You can only add a profile of the cellular type.
569 * @param[in] connection The connection handle
570 * @param[in] profile The profile handle
571 * @return @c 0 on success,
572 * otherwise a negative error value
573 * @retval #CONNECTION_ERROR_NONE Successful
574 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
575 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
576 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
577 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
579 int connection_add_profile(connection_h connection, connection_profile_h profile);
583 * @brief Removes an existing profile.
584 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
586 * @privilege %http://tizen.org/privilege/network.profile \n
587 * %http://tizen.org/privilege/network.get
588 * @remarks This API needs both privileges.
589 * @param[in] connection The connection handle
590 * @param[in] profile The profile handle
591 * @return @c 0 on success,
592 * otherwise a negative error value
593 * @retval #CONNECTION_ERROR_NONE Successful
594 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
595 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
596 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
597 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
599 int connection_remove_profile(connection_h connection, connection_profile_h profile);
603 * @brief Updates an existing profile.
604 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
605 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
606 * In addition, the existing profile will be updated if you call connection_open_profile().
607 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
609 * @privilege %http://tizen.org/privilege/network.profile \n
610 * %http://tizen.org/privilege/network.get
611 * @remarks This API needs both privileges.
612 * @param[in] connection The connection handle
613 * @param[in] profile The profile handle
614 * @return @c 0 on success,
615 * otherwise a negative error value
616 * @retval #CONNECTION_ERROR_NONE Successful
617 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
618 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
619 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
620 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
621 * @see connection_open_profile()
623 int connection_update_profile(connection_h connection, connection_profile_h profile);
627 * @brief Gets a profiles iterator.
628 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
630 * @privilege %http://tizen.org/privilege/network.get
631 * @remarks You must release @a profile_iterator using connection_destroy().
632 * @param[in] connection The connection handle
633 * @param[in] type The type of the connection iterator
634 * @param[out] profile_iterator The iterator of profile
635 * @return @c 0 on success,
636 * otherwise a negative error value
637 * @retval #CONNECTION_ERROR_NONE Successful
638 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
639 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
640 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
641 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
643 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
647 * @brief Moves the profile iterator to the next position and gets a profile handle.
648 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649 * @param[in] profile_iterator The iterator of profile
650 * @param[out] profile The profile handle
651 * @return @c 0 on success,
652 * otherwise a negative error value
653 * @retval #CONNECTION_ERROR_NONE Successful
654 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
655 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
657 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
661 * @brief Checks whether the next element of a profile iterator exists or not.
662 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
663 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
664 * @param[in] profile_iterator The iterator of profile
665 * @return @c true if next element exists,
666 * otherwise @c false if next element doesn't exist
668 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
672 * @brief Destroys a profiles iterator.
673 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
674 * @param[in] profile_iterator The iterator of the profile
675 * @return @c 0 on success,
676 * otherwise a negative error value
677 * @retval #CONNECTION_ERROR_NONE Successful
678 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
680 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
684 * @brief Gets the name of the default profile.
685 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
687 * @privilege %http://tizen.org/privilege/network.get
688 * @remarks You must release @a profile using connection_profile_destroy().
689 * @param[in] connection The connection handle
690 * @param[out] profile The profile handle
691 * @return @c 0 on success,
692 * otherwise a negative error value
693 * @retval #CONNECTION_ERROR_NONE Successful
694 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
695 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
696 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
697 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
698 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
700 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
704 * @brief Gets the default profile which provides the given cellular service.
705 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
707 * @privilege %http://tizen.org/privilege/network.get
708 * @remarks You must release @a profile using connection_profile_destroy().
709 * @param[in] connection The connection handle
710 * @param[in] type The type of cellular service \n
711 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
712 * @param[out] profile The profile handle
713 * @return @c 0 on success,
714 * otherwise a negative error value
715 * @retval #CONNECTION_ERROR_NONE Successful
716 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
717 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
718 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
719 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
720 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
722 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
726 * @brief Sets the default profile which provides the given cellular service.
727 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
729 * @privilege %http://tizen.org/privilege/network.profile \n
730 * %http://tizen.org/privilege/network.get
731 * @remarks This API needs both privileges.
732 * @param[in] connection The connection handle
733 * @param[in] type The type of cellular service \n
734 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
735 * @param[in] profile The profile handle
736 * @return @c 0 on success,
737 * otherwise a negative error value
738 * @retval #CONNECTION_ERROR_NONE Successful
739 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
740 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
741 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
742 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
744 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
748 * @brief Sets the default profile which provides the given cellular service, asynchronously.
749 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
751 * @privilege %http://tizen.org/privilege/network.profile \n
752 * %http://tizen.org/privilege/network.get
753 * @remarks This API needs both privileges.
754 * @param[in] connection The connection handle
755 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
756 * @param[in] profile The profile handle
757 * @param[in] callback The callback function to be called
758 * @param[in] user_data The user data passed to the callback function
759 * @return @c 0 on success,
760 * otherwise a negative error value
761 * @retval #CONNECTION_ERROR_NONE Successful
762 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
763 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
764 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
765 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
767 int connection_set_default_cellular_service_profile_async(connection_h connection,
768 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
772 * @brief Called after connection_open_profile() is finished.
773 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
774 * @param[in] result The result
775 * @param[in] user_data The user data passed from connection_open_profile()
776 * @pre connection_open_profile() will invoke this callback function.
777 * @see connection_open_profile()
779 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
783 * @brief Called after connection_close_profile() is finished.
784 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
785 * @param[in] result The result
786 * @param[in] user_data The user data passed from connection_close_profile()
787 * @pre connection_close_profile() will invoke this callback function.
788 * @see connection_close_profile()
790 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
794 * @brief Called after connection_reset_profile() is finished.
795 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
796 * @param[in] result The result
797 * @param[in] user_data The user data passed from connection_reset_profile()
798 * @pre connection_reset_profile() will invoke this callback function.
799 * @see connection_reset_profile()
801 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
805 * @brief Opens a connection of profile, asynchronously.
806 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
808 * @privilege %http://tizen.org/privilege/network.set \n
809 * %http://tizen.org/privilege/network.get
810 * @remarks This API needs both privileges.
811 * @param[in] connection The connection handle
812 * @param[in] profile The profile handle
813 * @param[in] callback The callback function to be called
814 * @param[in] user_data The user data passed to the callback function
815 * @return @c 0 on success,
816 * otherwise a negative error value
817 * @retval #CONNECTION_ERROR_NONE Successful
818 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
819 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
820 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
821 * @post connection_opened_cb() will be invoked.
822 * @see connection_opened_cb()
823 * @see connection_close_profile()
824 * @see connection_profile_set_state_changed_cb()
825 * @see connection_profile_unset_state_changed_cb()
826 * @see connection_profile_state_changed_cb()
828 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
832 * @brief Closes a connection of profile.
833 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
835 * @privilege %http://tizen.org/privilege/network.set
836 * @param[in] connection The connection handle
837 * @param[in] profile The profile handle
838 * @param[in] callback The callback function to be called
839 * @param[in] user_data The user data passed to the callback function
840 * @return @c 0 on success,
841 * otherwise a negative error value
842 * @retval #CONNECTION_ERROR_NONE Successful
843 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
844 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
845 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
846 * @post connection_closed_cb() will be invoked.
847 * @see connection_closed_cb()
848 * @see connection_open_profile()
849 * @see connection_profile_set_state_changed_cb()
850 * @see connection_profile_unset_state_changed_cb()
851 * @see connection_profile_state_changed_cb()
853 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
857 * @brief Resets the cellular profile.
858 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
860 * @privilege %http://tizen.org/privilege/network.profile \n
861 * %http://tizen.org/privilege/network.get
862 * @remarks This API needs both privileges.
863 * @param[in] connection The connection handle
864 * @param[in] type The type of reset
865 * @param[in] id The subscriber identity module ID to reset (The sim index starts from 0.)
866 * @param[in] callback The callback function to be called
867 * @param[in] user_data The user data passed to the callback function
868 * @return @c 0 on success,
869 * otherwise a negative error value
870 * @retval #CONNECTION_ERROR_NONE Successful
871 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
872 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
873 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
874 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
875 * @post connection_reset_cb() will be invoked.
877 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
881 * @brief Adds a IPv4 route to the routing table.
882 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
883 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
885 * @privilege %http://tizen.org/privilege/network.set
886 * @param[in] connection The connection handle
887 * @param[in] interface_name The name of network interface
888 * @param[in] host_address The IP address of the host
889 * @return @c 0 on success,
890 * otherwise a negative error value
891 * @retval #CONNECTION_ERROR_NONE Successful
892 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
893 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
894 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
895 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
896 * @see connection_profile_get_network_interface_name()
898 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
902 * @brief Removes a IPv4 route from the routing table.
903 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
904 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
906 * @privilege %http://tizen.org/privilege/network.set
907 * @param[in] connection The connection handle
908 * @param[in] interface_name The name of network interface
909 * @param[in] host_address The IP address of the host
910 * @return @c 0 on success,
911 * otherwise a negative error value
912 * @retval #CONNECTION_ERROR_NONE Successful
913 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
914 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
915 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
916 * @see connection_profile_get_network_interface_name()
918 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
922 * @brief Adds a IPv6 route to the routing table.
923 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
926 * @privilege %http://tizen.org/privilege/network.set
927 * @param[in] connection The connection handle
928 * @param[in] interface_name The name of network interface
929 * @param[in] host_address The IP address of the host
930 * @param[in] gateway The gateway address
931 * @return @c 0 on success,
932 * otherwise a negative error value
933 * @retval #CONNECTION_ERROR_NONE Successful
934 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
935 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
936 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
937 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
938 * @see connection_profile_get_network_interface_name()
940 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
944 * @brief Removes a IPV6 route from the routing table.
945 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
948 * @privilege %http://tizen.org/privilege/network.set
949 * @param[in] connection The connection handle
950 * @param[in] interface_name The name of network interface
951 * @param[in] host_address The IP address of the host
952 * @param[in] gateway The gateway address
953 * @return @c 0 on success,
954 * otherwise a negative error value
955 * @retval #CONNECTION_ERROR_NONE Successful
956 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
957 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
958 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
959 * @see connection_profile_get_network_interface_name()
961 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
964 * @brief Gets all IPv6 addresses assigned to the network interface.
966 * @param[in] connection The connection handle
967 * @param[in] connection_type The connection type
968 * @param[in] callback The callback to be called for each IPv6 address
969 * @param[in] user_data The user data passed to the callback function
970 * @return 0 on success, otherwise negative error value.
971 * @retval #CONNECTION_ERROR_NONE Successful
972 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
973 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
974 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
976 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
977 connection_ipv6_address_cb callback, void *user_data);
985 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
991 * @brief Gets the statistics information.
992 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
994 * @privilege %http://tizen.org/privilege/network.get
995 * @param[in] connection The connection handle
996 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
997 * @param[in] statistics_type The type of statistics
998 * @param[out] size The received data size of the last cellular packet data connection (bytes)
999 * @return @c 0 on success,
1000 * otherwise a negative error value
1001 * @retval #CONNECTION_ERROR_NONE Successful
1002 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1003 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1004 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1006 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
1010 * @brief Resets the statistics information.
1011 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1013 * @privilege %http://tizen.org/privilege/network.set
1014 * @remarks This API needs both privileges.
1015 * @param[in] connection The connection handle
1016 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
1017 * @param[in] statistics_type The type of statistics
1018 * @return @c 0 on success,
1019 * otherwise a negative error value
1020 * @retval #CONNECTION_ERROR_NONE Successful
1021 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1022 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1023 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
1024 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1026 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
1035 #endif /* __cplusplus */