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.
37 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
39 typedef void* connection_h;
42 * @brief The profiles iterator handle.
43 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45 typedef void* connection_profile_iterator_h;
48 * @brief Enumeration for connection type.
49 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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 */
58 CONNECTION_TYPE_NET_PROXY, /**< Proxy type for internet connection (Since 3.0) */
62 * @brief Enumeration for cellular network state.
63 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
67 CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE = 0, /**< Out of service */
68 CONNECTION_CELLULAR_STATE_FLIGHT_MODE = 1, /**< Flight mode */
69 CONNECTION_CELLULAR_STATE_ROAMING_OFF = 2, /**< Roaming is turned off */
70 CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE = 3, /**< Call is only available */
71 CONNECTION_CELLULAR_STATE_AVAILABLE = 4, /**< Available but not connected yet */
72 CONNECTION_CELLULAR_STATE_CONNECTED = 5, /**< Connected */
73 } connection_cellular_state_e;
76 * @brief Enumeration for Wi-Fi state.
77 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
81 CONNECTION_WIFI_STATE_DEACTIVATED = 0, /**< Wi-Fi is deactivated */
82 CONNECTION_WIFI_STATE_DISCONNECTED = 1, /**< Disconnected */
83 CONNECTION_WIFI_STATE_CONNECTED = 2, /**< Connected */
84 } connection_wifi_state_e;
87 * @brief Enumeration for ethernet state.
88 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
92 CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */
93 CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */
94 CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */
95 } connection_ethernet_state_e;
98 * @brief Enumeration for Bluetooth state.
99 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
103 CONNECTION_BT_STATE_DEACTIVATED = 0, /**< There is no Bluetooth profile to open */
104 CONNECTION_BT_STATE_DISCONNECTED = 1, /**< Disconnected */
105 CONNECTION_BT_STATE_CONNECTED = 2, /**< Connected */
106 } connection_bt_state_e;
109 * @brief Enumeration for connection iterator type.
110 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
114 CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */
115 CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */
116 CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */
117 } connection_iterator_type_e;
120 * @brief Enumeration for reset profile type.
121 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
125 CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */
126 CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */
127 } connection_reset_option_e;
130 * @brief This enumeration defines the attached or detached state of ethernet cable.
131 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
135 CONNECTION_ETHERNET_CABLE_DETACHED = 0, /**< Ethernet cable is detached */
136 CONNECTION_ETHERNET_CABLE_ATTACHED = 1, /**< Ethernet cable is attached */
137 } connection_ethernet_cable_state_e;
140 * @brief Enumeration for connection errors.
141 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
145 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
146 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
147 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
148 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
149 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
150 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
151 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
152 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
153 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
154 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
155 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
156 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
157 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
158 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
159 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
160 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */
161 } connection_error_e;
168 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
173 * @brief Enumeration for statistics type.
174 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
178 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
179 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
180 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
181 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
182 } connection_statistics_type_e;
189 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
195 * @brief Creates a handle for managing data connections.
196 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
198 * @privilege %http://tizen.org/privilege/network.get
199 * @remarks You must release @a handle using connection_destroy().
200 * @param[out] connection The connection handle
201 * @return @c 0 on success, otherwise a negative error value
202 * @retval #CONNECTION_ERROR_NONE Successful
203 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
204 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
205 * @see connection_destroy()
207 int connection_create(connection_h* connection);
210 * @brief Destroys the connection handle.
211 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
212 * @param[in] connection The connection handle
213 * @return @c 0 on success, otherwise negative error value
214 * @retval #CONNECTION_ERROR_NONE Successful
215 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
216 * @see connection_create()
218 int connection_destroy(connection_h connection);
221 * @brief Called when the type of a connection is changed.
222 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
223 * @param[in] type The type of the current network connection
224 * @param[in] user_data The user data passed from the callback registration function
225 * @see connection_set_type_changed_cb()
226 * @see connection_unset_type_changed_cb()
228 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
231 * @brief Called when the address is changed.
232 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
233 * @param[in] ipv4_address The IP address for IPv4
234 * @param[in] ipv6_address The IP address for IPv6
235 * @param[in] user_data The user data passed from the callback registration function
236 * @see connection_set_ip_address_changed_cb()
237 * @see connection_unset_ip_address_changed_cb()
238 * @see connection_set_proxy_address_changed_cb()
239 * @see connection_unset_proxy_address_changed_cb()
241 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
244 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
245 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
246 * @param[in] result The result
247 * @param[in] user_data The user data passed from connection_open_profile()
248 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
249 * @see connection_set_default_cellular_service_profile_async()
251 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
254 * @brief Gets the type of the current profile for data connection.
255 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256 * @param[in] connection The connection handle
257 * @param[out] type The type of the network
258 * @return @c 0 on success, otherwise negative error value
259 * @retval #CONNECTION_ERROR_NONE Successful
260 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
261 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
263 int connection_get_type(connection_h connection, connection_type_e* type);
266 * @brief Gets the IP address of the current connection.
267 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
268 * @remarks You must release @a ip_address using free().
269 * @param[in] connection The connection handle
270 * @param[in] address_family The address family
271 * @param[out] ip_address The pointer to the IP address string
272 * @return @c 0 on success, otherwise a negative error value
273 * @retval #CONNECTION_ERROR_NONE Successful
274 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
275 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
276 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
278 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
281 * @brief Gets the proxy address of the current connection.
282 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
283 * @remarks You must release @a proxy using free().
284 * @param[in] connection The connection handle
285 * @param[in] address_family The address family
286 * @param[out] proxy The proxy address
287 * @return @c 0 on success, 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
291 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
293 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
296 * @brief Gets the MAC address of the Wi-Fi or ethernet.
297 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
298 * @remarks @a mac_addr must be released with free() by you.
299 * @param[in] connection The handle of the connection
300 * @param[in] type The type of current network connection
301 * @param[out] mac_addr The MAC address
302 * @return 0 on success, otherwise negative error value.
303 * @retval #CONNECTION_ERROR_NONE Successful
304 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
305 * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
306 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
307 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
308 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
310 int connection_get_mac_address(connection_h connection, connection_type_e type, char** mac_addr);
313 * @brief Gets the state of cellular connection.
314 * @details The returned state is for the cellular connection state.
315 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
316 * @param[in] connection The connection handle
317 * @param[out] state The state of the cellular connection
318 * @return @c 0 on success, otherwise a negative error value
319 * @retval #CONNECTION_ERROR_NONE Successful
320 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
321 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
322 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
324 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
327 * @brief Gets the state of the Wi-Fi.
328 * @details The returned state is for the Wi-Fi connection state.
329 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
331 * @privilege %http://tizen.org/privilege/network.get
332 * @param[in] connection The connection handle
333 * @param[out] state The state of Wi-Fi connection
334 * @return @c 0 on success, otherwise a negative error value
335 * @retval #CONNECTION_ERROR_NONE Successful
336 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
337 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
338 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
339 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
341 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
344 * @brief Gets the state of the Ethernet.
345 * @details The returned state is for the Ethernet connection state.
346 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
348 * @privilege %http://tizen.org/privilege/network.get
349 * @param[in] connection The connection handle
350 * @param[out] state The state of Ethernet connection
351 * @return @c 0 on success, otherwise a negative error value
352 * @retval #CONNECTION_ERROR_NONE Successful
353 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
354 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
355 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
356 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
358 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
361 * @brief Checks for ethernet cable is attached or not.
362 * @details The returned state is for the ethernet cable state.
363 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
365 * @privilege %http://tizen.org/privilege/network.get
366 * @param[in] connection The handle of the connection
367 * @param[in] state - Enum connection_ethernet_cable_state_e
368 * @return 0 on success, otherwise negative error value
369 * @retval #CONNECTION_ERROR_NONE Successful
370 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
371 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
372 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
373 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
375 int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state);
378 * @brief Called when ethernet cable is plugged [in/out].
379 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
380 * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
381 * @param[in] user_data The user data passed to callback registration function
383 typedef void(*connection_ethernet_cable_state_chaged_cb)(
384 connection_ethernet_cable_state_e state, void* user_data);
387 * @brief Registers callback for ethernet cable is plugged [in/out] event.
388 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
389 * @param[in] connection The handle of connection
390 * @param[in] callback The callback function to be called
391 * @param[in] user_data The user data passed to the callback function
392 * @return 0 on success, otherwise 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_NOT_SUPPORTED Not supported
398 int connection_set_ethernet_cable_state_chaged_cb( connection_h connection,
399 connection_ethernet_cable_state_chaged_cb callback, void *user_data);
402 * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
403 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
404 * @param[in] connection The handle of connection
405 * @return 0 on success, otherwise negative error value
406 * @retval #CONNECTION_ERROR_NONE Successful
407 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
408 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
409 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
411 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
414 * @brief Gets the state of the Bluetooth.
415 * @details The returned state is for the Bluetooth connection state.
416 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
418 * @privilege %http://tizen.org/privilege/network.get
419 * @param[in] connection The connection handle
420 * @param[out] state The state of the Bluetooth connection
421 * @return @c 0 on success, otherwise a negative error value
422 * @retval #CONNECTION_ERROR_NONE Successful
423 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
424 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
425 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
426 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
428 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
431 * @brief Registers the callback that is called when the type of the current connection is changed.
432 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
433 * @param[in] connection The connection handle
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, otherwise a negative error value
437 * @retval #CONNECTION_ERROR_NONE Successful
438 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
439 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
441 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
444 * @brief Unregisters the callback that is called when the type of current connection is changed.
445 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
446 * @param[in] connection The connection handle
447 * @return @c 0 on success, otherwise a negative error value
448 * @retval #CONNECTION_ERROR_NONE Successful
449 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
450 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
452 int connection_unset_type_changed_cb(connection_h connection);
455 * @brief Registers the callback that is called when the IP address is changed.
456 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
457 * @param[in] connection The connection handle
458 * @param[in] callback The callback function to be called
459 * @param[in] user_data The user data passed to the callback function
460 * @return @c 0 on success, otherwise a negative error value
461 * @retval #CONNECTION_ERROR_NONE Successful
462 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
463 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
465 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
468 * @brief Unregisters the callback that is called when the IP address is changed.
469 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
470 * @param[in] connection The connection handle
471 * @return @c 0 on success, otherwise a negative error value
472 * @retval #CONNECTION_ERROR_NONE Successful
473 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
474 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
476 int connection_unset_ip_address_changed_cb(connection_h connection);
479 * @brief Registers the callback that is called when the proxy address is changed.
480 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
481 * @param[in] connection The connection handle
482 * @param[in] callback The callback function to be called
483 * @param[in] user_data The user data passed to the callback function
484 * @return @c 0 on success, otherwise a negative error value
485 * @retval #CONNECTION_ERROR_NONE Successful
486 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
487 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
489 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
492 * @brief Unregisters the callback that is called when the proxy address is changed.
493 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
494 * @param[in] connection The connection handle
495 * @return @c 0 on success, otherwise a negative error value
496 * @retval #CONNECTION_ERROR_NONE Successful
497 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
498 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
500 int connection_unset_proxy_address_changed_cb(connection_h connection);
503 * @brief Adds a new profile which is created by connection_profile_create().
504 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
506 * @privilege %http://tizen.org/privilege/network.profile
507 * @remarks You can only add a profile of the cellular type.
508 * @param[in] connection The connection handle
509 * @param[in] profile The profile handle
510 * @return @c 0 on success, otherwise a negative error value
511 * @retval #CONNECTION_ERROR_NONE Successful
512 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
513 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
514 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
515 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
517 int connection_add_profile(connection_h connection, connection_profile_h profile);
520 * @brief Removes an existing profile.
521 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
523 * @privilege %http://tizen.org/privilege/network.profile \n
524 * %http://tizen.org/privilege/network.get
525 * @remarks This API needs both privileges.
526 * @param[in] connection The connection handle
527 * @param[in] profile The profile handle
528 * @return @c 0 on success, otherwise a negative error value
529 * @retval #CONNECTION_ERROR_NONE Successful
530 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
531 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
532 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
533 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
535 int connection_remove_profile(connection_h connection, connection_profile_h profile);
538 * @brief Updates an existing profile.
539 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
540 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
541 * In addition, the existing profile will be updated if you call connection_open_profile().
542 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
544 * @privilege %http://tizen.org/privilege/network.profile \n
545 * %http://tizen.org/privilege/network.get
546 * @remarks This API needs both privileges.
547 * @param[in] connection The connection handle
548 * @param[in] profile The profile handle
549 * @return @c 0 on success, otherwise a negative error value
550 * @retval #CONNECTION_ERROR_NONE Successful
551 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
552 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
553 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
554 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
555 * @see connection_open_profile()
557 int connection_update_profile(connection_h connection, connection_profile_h profile);
560 * @brief Gets a profiles iterator.
561 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
563 * @privilege %http://tizen.org/privilege/network.get
564 * @remarks You must release @a profile_iterator using connection_destroy().
565 * @param[in] connection The connection handle
566 * @param[in] type The type of the connetion iterator
567 * @param[out] profile_iterator The iterator of profile
568 * @return @c 0 on success, otherwise a negative error value
569 * @retval #CONNECTION_ERROR_NONE Successful
570 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
571 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
572 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
573 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
575 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
578 * @brief Moves the profile iterator to the next position and gets a profile handle.
579 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
580 * @param[in] profile_iterator The iterator of profile
581 * @param[out] profile The profile handle
582 * @return @c 0 on success, otherwise a negative error value
583 * @retval #CONNECTION_ERROR_NONE Successful
584 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
585 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
587 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
590 * @brief Checks whether the next element of a profile iterator exists or not.
591 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
592 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
593 * @param[in] profile_iterator The iterator of profile
594 * @return @c true if next element exists, otherwise @c false if next element doesn't exist
596 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
599 * @brief Destroys a profiles iterator.
600 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
601 * @param[in] profile_iterator The iterator of the profile
602 * @return @c 0 on success, otherwise a negative error value
603 * @retval #CONNECTION_ERROR_NONE Successful
604 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
606 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
609 * @brief Gets the name of the default profile.
610 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
612 * @privilege %http://tizen.org/privilege/network.get
613 * @remarks You must release @a profile using connection_profile_destroy().
614 * @param[in] connection The connection handle
615 * @param[out] profile The profile handle
616 * @return @c 0 on success, otherwise a negative error value
617 * @retval #CONNECTION_ERROR_NONE Successful
618 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
619 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
620 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
621 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
622 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
624 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
627 * @brief Gets the default profile which provides the given cellular service.
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 using connection_profile_destroy().
632 * @param[in] connection The connection handle
633 * @param[in] type The type of cellular service \n
634 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
635 * @param[out] profile The profile handle
636 * @return @c 0 on success, 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 Denieda
642 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
644 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
647 * @brief Sets the default profile which provides the given cellular service.
648 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
650 * @privilege %http://tizen.org/privilege/network.profile \n
651 * %http://tizen.org/privilege/network.get
652 * @remarks This API needs both privileges.
653 * @param[in] connection The connection handle
654 * @param[in] type The type of cellular service \n
655 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
656 * @param[in] profile The profile handle
657 * @return @c 0 on success, otherwise a negative error value
658 * @retval #CONNECTION_ERROR_NONE Successful
659 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
660 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
661 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
662 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
664 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
667 * @brief Sets the default profile which provides the given cellular service, asynchronously.
668 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
670 * @privilege %http://tizen.org/privilege/network.profile \n
671 * %http://tizen.org/privilege/network.get
672 * @remarks This API needs both privileges.
673 * @param[in] connection The connection handle
674 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
675 * @param[in] profile The profile handle
676 * @param[in] callback The callback function to be called
677 * @param[in] user_data The user data passed to the callback function
678 * @return @c 0 on success, otherwise negative error value
679 * @retval #CONNECTION_ERROR_NONE Successful
680 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
681 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
682 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
683 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
685 int connection_set_default_cellular_service_profile_async(connection_h connection,
686 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
689 * @brief Called after connection_open_profile() is finished.
690 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
691 * @param[in] result The result
692 * @param[in] user_data The user data passed from connection_open_profile()
693 * @pre connection_open_profile() will invoke this callback function.
694 * @see connection_open_profile()
696 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
699 * @brief Called after connection_close_profile() is finished.
700 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
701 * @param[in] result The result
702 * @param[in] user_data The user data passed from connection_close_profile()
703 * @pre connection_close_profile() will invoke this callback function.
704 * @see connection_close_profile()
706 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
709 * @brief Called after connection_reset_profile() is finished.
710 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
711 * @param[in] result The result
712 * @param[in] user_data The user data passed from connection_reset_profile()
713 * @pre connection_reset_profile() will invoke this callback function.
714 * @see connection_reset_profile()
716 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
719 * @brief Opens a connection of profile, asynchronously.
720 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
722 * @privilege %http://tizen.org/privilege/network.set \n
723 * %http://tizen.org/privilege/network.get
724 * @remarks This API needs both privileges.
725 * @param[in] connection The connection handle
726 * @param[in] profile The profile handle
727 * @param[in] callback The callback function to be called
728 * @param[in] user_data The user data passed to the callback function
729 * @return @c 0 on success, otherwise negative error value
730 * @retval #CONNECTION_ERROR_NONE Successful
731 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
732 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
733 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
734 * @post connection_opened_cb() will be invoked.
735 * @see connection_opened_cb()
736 * @see connection_close_profile()
737 * @see connection_profile_set_state_changed_cb()
738 * @see connection_profile_unset_state_changed_cb()
739 * @see connection_profile_state_changed_cb()
741 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
744 * @brief Closes a connection of profile.
745 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
747 * @privilege %http://tizen.org/privilege/network.set
748 * @param[in] connection The connection handle
749 * @param[in] profile The profile handle
750 * @param[in] callback The callback function to be called
751 * @param[in] user_data The user data passed to the callback function
752 * @return @c 0 on success, otherwise negative error value
753 * @retval #CONNECTION_ERROR_NONE Successful
754 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
755 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
756 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
757 * @post connection_closed_cb() will be invoked.
758 * @see connection_closed_cb()
759 * @see connection_open_profile()
760 * @see connection_profile_set_state_changed_cb()
761 * @see connection_profile_unset_state_changed_cb()
762 * @see connection_profile_state_changed_cb()
764 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
767 * @brief Resets the cellular profile.
768 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
770 * @privilege %http://tizen.org/privilege/network.profile \n
771 * %http://tizen.org/privilege/network.get
772 * @remarks This API needs both privileges.
773 * @param[in] connection The connection handle
774 * @param[in] type The type of reset
775 * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.)
776 * @param[in] callback The callback function to be called
777 * @param[in] user_data The user data passed to the callback function
778 * @return 0 on success, otherwise negative error value
779 * @retval #CONNECTION_ERROR_NONE Successful
780 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
781 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
782 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
783 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
784 * @post connection_reset_cb() will be invoked.
786 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
789 * @brief Adds a IPv4 route to the routing table.
790 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
791 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
793 * @privilege %http://tizen.org/privilege/network.set
794 * @param[in] connection The connection handle
795 * @param[in] interface_name The name of network interface
796 * @param[in] host_address The IP address of the host
797 * @return @c 0 on success, otherwise negative error value
798 * @retval #CONNECTION_ERROR_NONE Successful
799 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
800 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
801 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
802 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
803 * @see connection_profile_get_network_interface_name()
805 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
808 * @brief Removes a IPv4 route from the routing table.
809 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
810 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
812 * @privilege %http://tizen.org/privilege/network.set
813 * @param[in] connection The connection handle
814 * @param[in] interface_name The name of network interface
815 * @param[in] host_address The IP address of the host
816 * @return @c 0 on success, otherwise 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 * @see connection_profile_get_network_interface_name()
823 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
826 * @brief Adds a IPv6 route to the routing table.
827 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
830 * @privilege %http://tizen.org/privilege/network.set
831 * @param[in] connection The connection handle
832 * @param[in] interface_name The name of network interface
833 * @param[in] host_address The IP address of the host
834 * @param[in] gateway The gateway address
835 * @return @c 0 on success, otherwise negative error value
836 * @retval #CONNECTION_ERROR_NONE Successful
837 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
838 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
839 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
840 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
841 * @see connection_profile_get_network_interface_name()
843 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
846 * @brief Removes a IPV6 route from the routing table.
847 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
850 * @privilege %http://tizen.org/privilege/network.set
851 * @param[in] connection The connection handle
852 * @param[in] interface_name The name of network interface
853 * @param[in] host_address The IP address of the host
854 * @param[in] gateway The gateway address
855 * @return @c 0 on success, otherwise negative error value
856 * @retval #CONNECTION_ERROR_NONE Successful
857 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
858 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
859 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
860 * @see connection_profile_get_network_interface_name()
862 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
869 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
874 * @brief Gets the statistics information.
875 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
877 * @privilege %http://tizen.org/privilege/network.get
878 * @param[in] connection The connection handle
879 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
880 * @param[in] statistics_type The type of statistics
881 * @param[out] size The received data size of the last cellular packet data connection (bytes)
882 * @return @c 0 on success, otherwise negative error value
883 * @retval #CONNECTION_ERROR_NONE Successful
884 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
885 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
886 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
888 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
891 * @brief Resets the statistics information.
892 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
894 * @privilege %http://tizen.org/privilege/network.set
895 * @remarks This API needs both privileges.
896 * @param[in] connection The connection handle
897 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
898 * @param[in] statistics_type The type of statistics
899 * @return @c 0 on success, otherwise negative error value
900 * @retval #CONNECTION_ERROR_NONE Successful
901 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
902 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
903 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
904 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
906 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
914 #endif /* __cplusplus */