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;
177 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
183 * @brief Enumeration for statistics type.
184 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
188 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
189 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
190 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
191 } connection_statistics_type_e;
200 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
206 * @brief Creates a handle for managing data connections.
207 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
209 * @privilege %http://tizen.org/privilege/network.get
210 * @remarks You must release @a handle using connection_destroy().
211 * @param[out] connection The connection handle
212 * @return @c 0 on success,
213 * otherwise a negative error value
214 * @retval #CONNECTION_ERROR_NONE Successful
215 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
216 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
217 * @see connection_destroy()
219 int connection_create(connection_h* connection);
223 * @brief Destroys the connection handle.
224 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
225 * @param[in] connection The connection handle
226 * @return @c 0 on success,
227 * otherwise a negative error value
228 * @retval #CONNECTION_ERROR_NONE Successful
229 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
230 * @see connection_create()
232 int connection_destroy(connection_h connection);
236 * @brief Called when the type of a connection is changed.
237 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
238 * @param[in] type The type of the current network connection
239 * @param[in] user_data The user data passed from the callback registration function
240 * @see connection_set_type_changed_cb()
241 * @see connection_unset_type_changed_cb()
243 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
247 * @brief Called when the address is changed.
248 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
249 * @param[in] ipv4_address The IP address for IPv4
250 * @param[in] ipv6_address The IP address for IPv6
251 * @param[in] user_data The user data passed from the callback registration function
252 * @see connection_set_ip_address_changed_cb()
253 * @see connection_unset_ip_address_changed_cb()
254 * @see connection_set_proxy_address_changed_cb()
255 * @see connection_unset_proxy_address_changed_cb()
257 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
261 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
262 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
263 * @param[in] result The result
264 * @param[in] user_data The user data passed from connection_open_profile()
265 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
266 * @see connection_set_default_cellular_service_profile_async()
268 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
272 * @brief Gets the type of the current profile for data connection.
273 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
274 * @param[in] connection The connection handle
275 * @param[out] type The type of the network
276 * @return @c 0 on success,
277 * otherwise a negative error value
278 * @retval #CONNECTION_ERROR_NONE Successful
279 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
280 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
282 int connection_get_type(connection_h connection, connection_type_e* type);
286 * @brief Gets the IP address of the current connection.
287 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
288 * @remarks You must release @a ip_address using free().
289 * @param[in] connection The connection handle
290 * @param[in] address_family The address family
291 * @param[out] ip_address The pointer to the IP address string
292 * @return @c 0 on success,
293 * otherwise a negative error value
294 * @retval #CONNECTION_ERROR_NONE Successful
295 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
296 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
297 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
299 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
303 * @brief Gets the proxy address of the current connection.
304 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
305 * @remarks You must release @a proxy using free().
306 * @param[in] connection The connection handle
307 * @param[in] address_family The address family
308 * @param[out] proxy The proxy address
309 * @return @c 0 on success,
310 * otherwise a negative error value
311 * @retval #CONNECTION_ERROR_NONE Successful
312 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
313 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
314 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
316 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
320 * @brief Gets the MAC address of the Wi-Fi or ethernet.
321 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
322 * @remarks @a mac_addr must be released with free() by you.
323 * @param[in] connection The handle of the connection
324 * @param[in] type The type of current network connection
325 * @param[out] mac_addr The MAC address
326 * @return @c 0 on success,
327 * otherwise a negative error value
328 * @retval #CONNECTION_ERROR_NONE Successful
329 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
330 * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
331 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
332 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
333 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
335 int connection_get_mac_address(connection_h connection, connection_type_e type, char** mac_addr);
339 * @brief Gets the state of cellular connection.
340 * @details The returned state is for the cellular connection state.
341 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
342 * @param[in] connection The connection handle
343 * @param[out] state The state of the cellular connection
344 * @return @c 0 on success,
345 * otherwise a negative error value
346 * @retval #CONNECTION_ERROR_NONE Successful
347 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
348 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
349 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
351 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
355 * @brief Gets the state of the Wi-Fi.
356 * @details The returned state is for the Wi-Fi connection state.
357 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359 * @privilege %http://tizen.org/privilege/network.get
360 * @param[in] connection The connection handle
361 * @param[out] state The state of Wi-Fi connection
362 * @return @c 0 on success,
363 * otherwise a negative error value
364 * @retval #CONNECTION_ERROR_NONE Successful
365 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
366 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
367 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
368 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
370 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
374 * @brief Gets the state of the Ethernet.
375 * @details The returned state is for the Ethernet connection state.
376 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
378 * @privilege %http://tizen.org/privilege/network.get
379 * @param[in] connection The connection handle
380 * @param[out] state The state of Ethernet connection
381 * @return @c 0 on success,
382 * otherwise a negative error value
383 * @retval #CONNECTION_ERROR_NONE Successful
384 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
385 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
386 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
387 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
389 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
393 * @brief Checks for ethernet cable is attached or not.
394 * @details The returned state is for the ethernet cable state.
395 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
397 * @privilege %http://tizen.org/privilege/network.get
398 * @param[in] connection The handle of the connection
399 * @param[in] state - Enum connection_ethernet_cable_state_e
400 * @return @c 0 on success,
401 * otherwise a negative error value
402 * @retval #CONNECTION_ERROR_NONE Successful
403 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
404 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
405 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
406 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
408 int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state);
412 * @brief Called when ethernet cable is plugged [in/out].
413 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
414 * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
415 * @param[in] user_data The user data passed to callback registration function
417 typedef void(*connection_ethernet_cable_state_chaged_cb)(connection_ethernet_cable_state_e state, void* user_data);
421 * @brief Registers callback for ethernet cable is plugged [in/out] event.
422 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
423 * @param[in] connection The handle of connection
424 * @param[in] callback The callback function to be called
425 * @param[in] user_data The user data passed to the callback function
426 * @return @c 0 on success,
427 * otherwise a negative error value
428 * @retval #CONNECTION_ERROR_NONE Successful
429 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
431 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
433 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection, connection_ethernet_cable_state_chaged_cb callback, void *user_data);
437 * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
438 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
439 * @param[in] connection The handle of connection
440 * @return @c 0 on success,
441 * otherwise a negative error value
442 * @retval #CONNECTION_ERROR_NONE Successful
443 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
444 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
445 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
447 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
451 * @brief Gets the state of the Bluetooth.
452 * @details The returned state is for the Bluetooth connection state.
453 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
455 * @privilege %http://tizen.org/privilege/network.get
456 * @param[in] connection The connection handle
457 * @param[out] state The state of the Bluetooth connection
458 * @return @c 0 on success,
459 * otherwise a negative error value
460 * @retval #CONNECTION_ERROR_NONE Successful
461 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
462 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
463 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
464 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
466 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
470 * @brief Registers the callback that is called when the type of the current connection is changed.
471 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
472 * @param[in] connection The connection handle
473 * @param[in] callback The callback function to be called
474 * @param[in] user_data The user data passed to the callback function
475 * @return @c 0 on success,
476 * otherwise a negative error value
477 * @retval #CONNECTION_ERROR_NONE Successful
478 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
479 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
481 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
485 * @brief Unregisters the callback that is called when the type of current connection is changed.
486 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
487 * @param[in] connection The connection handle
488 * @return @c 0 on success,
489 * otherwise a negative error value
490 * @retval #CONNECTION_ERROR_NONE Successful
491 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
492 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
494 int connection_unset_type_changed_cb(connection_h connection);
498 * @brief Registers the callback that is called when the IP address is changed.
499 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
500 * @param[in] connection The connection handle
501 * @param[in] callback The callback function to be called
502 * @param[in] user_data The user data passed to the callback function
503 * @return @c 0 on success,
504 * otherwise a negative error value
505 * @retval #CONNECTION_ERROR_NONE Successful
506 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
507 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
509 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
513 * @brief Unregisters the callback that is called when the IP address is changed.
514 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
515 * @param[in] connection The connection handle
516 * @return @c 0 on success,
517 * otherwise a negative error value
518 * @retval #CONNECTION_ERROR_NONE Successful
519 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
520 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
522 int connection_unset_ip_address_changed_cb(connection_h connection);
526 * @brief Registers the callback that is called when the proxy address is changed.
527 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
528 * @param[in] connection The connection handle
529 * @param[in] callback The callback function to be called
530 * @param[in] user_data The user data passed to the callback function
531 * @return @c 0 on success,
532 * otherwise a negative error value
533 * @retval #CONNECTION_ERROR_NONE Successful
534 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
535 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
537 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
541 * @brief Unregisters the callback that is called when the proxy address is changed.
542 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
543 * @param[in] connection The connection handle
544 * @return @c 0 on success,
545 * otherwise a negative error value
546 * @retval #CONNECTION_ERROR_NONE Successful
547 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
548 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
550 int connection_unset_proxy_address_changed_cb(connection_h connection);
554 * @brief Adds a new profile which is created by connection_profile_create().
555 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
557 * @privilege %http://tizen.org/privilege/network.profile
558 * @remarks You can only add a profile of the cellular type.
559 * @param[in] connection The connection handle
560 * @param[in] profile The profile handle
561 * @return @c 0 on success,
562 * otherwise a negative error value
563 * @retval #CONNECTION_ERROR_NONE Successful
564 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
565 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
566 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
567 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
569 int connection_add_profile(connection_h connection, connection_profile_h profile);
573 * @brief Removes an existing profile.
574 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
576 * @privilege %http://tizen.org/privilege/network.profile \n
577 * %http://tizen.org/privilege/network.get
578 * @remarks This API needs both privileges.
579 * @param[in] connection The connection handle
580 * @param[in] profile The profile handle
581 * @return @c 0 on success,
582 * otherwise a negative error value
583 * @retval #CONNECTION_ERROR_NONE Successful
584 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
585 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
586 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
587 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
589 int connection_remove_profile(connection_h connection, connection_profile_h profile);
593 * @brief Updates an existing profile.
594 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
595 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
596 * In addition, the existing profile will be updated if you call connection_open_profile().
597 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
599 * @privilege %http://tizen.org/privilege/network.profile \n
600 * %http://tizen.org/privilege/network.get
601 * @remarks This API needs both privileges.
602 * @param[in] connection The connection handle
603 * @param[in] profile The profile handle
604 * @return @c 0 on success,
605 * otherwise a negative error value
606 * @retval #CONNECTION_ERROR_NONE Successful
607 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
608 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
609 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
610 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
611 * @see connection_open_profile()
613 int connection_update_profile(connection_h connection, connection_profile_h profile);
617 * @brief Gets a profiles iterator.
618 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
620 * @privilege %http://tizen.org/privilege/network.get
621 * @remarks You must release @a profile_iterator using connection_destroy().
622 * @param[in] connection The connection handle
623 * @param[in] type The type of the connetion iterator
624 * @param[out] profile_iterator The iterator of profile
625 * @return @c 0 on success,
626 * otherwise a negative error value
627 * @retval #CONNECTION_ERROR_NONE Successful
628 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
629 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
630 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
631 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
633 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
637 * @brief Moves the profile iterator to the next position and gets a profile handle.
638 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
639 * @param[in] profile_iterator The iterator of profile
640 * @param[out] profile The profile handle
641 * @return @c 0 on success,
642 * otherwise a negative error value
643 * @retval #CONNECTION_ERROR_NONE Successful
644 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
645 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
647 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
651 * @brief Checks whether the next element of a profile iterator exists or not.
652 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
653 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
654 * @param[in] profile_iterator The iterator of profile
655 * @return @c true if next element exists,
656 * otherwise @c false if next element doesn't exist
658 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
662 * @brief Destroys a profiles iterator.
663 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
664 * @param[in] profile_iterator The iterator of the profile
665 * @return @c 0 on success,
666 * otherwise a negative error value
667 * @retval #CONNECTION_ERROR_NONE Successful
668 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
670 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
674 * @brief Gets the name of the default profile.
675 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
677 * @privilege %http://tizen.org/privilege/network.get
678 * @remarks You must release @a profile using connection_profile_destroy().
679 * @param[in] connection The connection handle
680 * @param[out] profile The profile handle
681 * @return @c 0 on success,
682 * otherwise a negative error value
683 * @retval #CONNECTION_ERROR_NONE Successful
684 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
685 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
686 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
687 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
688 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
690 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
694 * @brief Gets the default profile which provides the given cellular service.
695 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
697 * @privilege %http://tizen.org/privilege/network.get
698 * @remarks You must release @a profile using connection_profile_destroy().
699 * @param[in] connection The connection handle
700 * @param[in] type The type of cellular service \n
701 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
702 * @param[out] profile The profile handle
703 * @return @c 0 on success,
704 * otherwise a negative error value
705 * @retval #CONNECTION_ERROR_NONE Successful
706 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
707 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
708 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
709 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda
710 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
712 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
716 * @brief Sets the default profile which provides the given cellular service.
717 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
719 * @privilege %http://tizen.org/privilege/network.profile \n
720 * %http://tizen.org/privilege/network.get
721 * @remarks This API needs both privileges.
722 * @param[in] connection The connection handle
723 * @param[in] type The type of cellular service \n
724 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
725 * @param[in] profile The profile handle
726 * @return @c 0 on success,
727 * otherwise a 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 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
734 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
738 * @brief Sets the default profile which provides the given cellular service, asynchronously.
739 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
741 * @privilege %http://tizen.org/privilege/network.profile \n
742 * %http://tizen.org/privilege/network.get
743 * @remarks This API needs both privileges.
744 * @param[in] connection The connection handle
745 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
746 * @param[in] profile The profile handle
747 * @param[in] callback The callback function to be called
748 * @param[in] user_data The user data passed to the callback function
749 * @return @c 0 on success,
750 * otherwise a 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 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
757 int connection_set_default_cellular_service_profile_async(connection_h connection,
758 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
762 * @brief Called after connection_open_profile() is finished.
763 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
764 * @param[in] result The result
765 * @param[in] user_data The user data passed from connection_open_profile()
766 * @pre connection_open_profile() will invoke this callback function.
767 * @see connection_open_profile()
769 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
773 * @brief Called after connection_close_profile() is finished.
774 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
775 * @param[in] result The result
776 * @param[in] user_data The user data passed from connection_close_profile()
777 * @pre connection_close_profile() will invoke this callback function.
778 * @see connection_close_profile()
780 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
784 * @brief Called after connection_reset_profile() is finished.
785 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
786 * @param[in] result The result
787 * @param[in] user_data The user data passed from connection_reset_profile()
788 * @pre connection_reset_profile() will invoke this callback function.
789 * @see connection_reset_profile()
791 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
795 * @brief Opens a connection of profile, asynchronously.
796 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
798 * @privilege %http://tizen.org/privilege/network.set \n
799 * %http://tizen.org/privilege/network.get
800 * @remarks This API needs both privileges.
801 * @param[in] connection The connection handle
802 * @param[in] profile The profile handle
803 * @param[in] callback The callback function to be called
804 * @param[in] user_data The user data passed to the callback function
805 * @return @c 0 on success,
806 * otherwise a negative error value
807 * @retval #CONNECTION_ERROR_NONE Successful
808 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
809 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
810 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
811 * @post connection_opened_cb() will be invoked.
812 * @see connection_opened_cb()
813 * @see connection_close_profile()
814 * @see connection_profile_set_state_changed_cb()
815 * @see connection_profile_unset_state_changed_cb()
816 * @see connection_profile_state_changed_cb()
818 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
822 * @brief Closes a connection of profile.
823 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
825 * @privilege %http://tizen.org/privilege/network.set
826 * @param[in] connection The connection handle
827 * @param[in] profile The profile handle
828 * @param[in] callback The callback function to be called
829 * @param[in] user_data The user data passed to the callback function
830 * @return @c 0 on success,
831 * otherwise a negative error value
832 * @retval #CONNECTION_ERROR_NONE Successful
833 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
834 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
835 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
836 * @post connection_closed_cb() will be invoked.
837 * @see connection_closed_cb()
838 * @see connection_open_profile()
839 * @see connection_profile_set_state_changed_cb()
840 * @see connection_profile_unset_state_changed_cb()
841 * @see connection_profile_state_changed_cb()
843 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
847 * @brief Resets the cellular profile.
848 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
850 * @privilege %http://tizen.org/privilege/network.profile \n
851 * %http://tizen.org/privilege/network.get
852 * @remarks This API needs both privileges.
853 * @param[in] connection The connection handle
854 * @param[in] type The type of reset
855 * @param[in] id The subscriber identity module ID to reset (The sim index starts from 0.)
856 * @param[in] callback The callback function to be called
857 * @param[in] user_data The user data passed to the callback function
858 * @return @c 0 on success,
859 * otherwise a negative error value
860 * @retval #CONNECTION_ERROR_NONE Successful
861 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
862 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
863 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
864 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
865 * @post connection_reset_cb() will be invoked.
867 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
871 * @brief Adds a IPv4 route to the routing table.
872 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
873 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
875 * @privilege %http://tizen.org/privilege/network.set
876 * @param[in] connection The connection handle
877 * @param[in] interface_name The name of network interface
878 * @param[in] host_address The IP address of the host
879 * @return @c 0 on success,
880 * otherwise a negative error value
881 * @retval #CONNECTION_ERROR_NONE Successful
882 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
883 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
884 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
885 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
886 * @see connection_profile_get_network_interface_name()
888 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
892 * @brief Removes a IPv4 route from the routing table.
893 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
894 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
896 * @privilege %http://tizen.org/privilege/network.set
897 * @param[in] connection The connection handle
898 * @param[in] interface_name The name of network interface
899 * @param[in] host_address The IP address of the host
900 * @return @c 0 on success,
901 * otherwise a negative error value
902 * @retval #CONNECTION_ERROR_NONE Successful
903 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
904 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
905 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
906 * @see connection_profile_get_network_interface_name()
908 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
912 * @brief Adds a IPv6 route to the routing table.
913 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
916 * @privilege %http://tizen.org/privilege/network.set
917 * @param[in] connection The connection handle
918 * @param[in] interface_name The name of network interface
919 * @param[in] host_address The IP address of the host
920 * @param[in] gateway The gateway address
921 * @return @c 0 on success,
922 * otherwise a negative error value
923 * @retval #CONNECTION_ERROR_NONE Successful
924 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
925 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
926 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
927 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
928 * @see connection_profile_get_network_interface_name()
930 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
934 * @brief Removes a IPV6 route from the routing table.
935 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
938 * @privilege %http://tizen.org/privilege/network.set
939 * @param[in] connection The connection handle
940 * @param[in] interface_name The name of network interface
941 * @param[in] host_address The IP address of the host
942 * @param[in] gateway The gateway address
943 * @return @c 0 on success,
944 * otherwise a negative error value
945 * @retval #CONNECTION_ERROR_NONE Successful
946 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
947 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
948 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
949 * @see connection_profile_get_network_interface_name()
951 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
960 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
966 * @brief Gets the statistics information.
967 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
969 * @privilege %http://tizen.org/privilege/network.get
970 * @param[in] connection The connection handle
971 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
972 * @param[in] statistics_type The type of statistics
973 * @param[out] size The received data size of the last cellular packet data connection (bytes)
974 * @return @c 0 on success,
975 * otherwise a negative error value
976 * @retval #CONNECTION_ERROR_NONE Successful
977 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
978 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
979 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
981 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
985 * @brief Resets the statistics information.
986 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
988 * @privilege %http://tizen.org/privilege/network.set
989 * @remarks This API needs both privileges.
990 * @param[in] connection The connection handle
991 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
992 * @param[in] statistics_type The type of statistics
993 * @return @c 0 on success,
994 * otherwise a negative error value
995 * @retval #CONNECTION_ERROR_NONE Successful
996 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
997 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
998 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
999 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1001 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
1011 #endif /* __cplusplus */