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.
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.
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
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
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
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].
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
389 * @param[in] callback The callback function to be called
390 * @param[in] user_data The user data passed to the callback function
391 * @return 0 on success, otherwise negative error value
392 * @retval #CONNECTION_ERROR_NONE Successful
393 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
394 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
395 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
397 int connection_set_ethernet_cable_state_chaged_cb( connection_h connection,
398 connection_ethernet_cable_state_chaged_cb callback, void *user_data);
401 * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
402 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0
403 * @param[in] connection The handle of connection
404 * @return 0 on success, otherwise negative error value
405 * @retval #CONNECTION_ERROR_NONE Successful
406 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
407 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
408 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
410 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
413 * @brief Gets the state of the Bluetooth.
414 * @details The returned state is for the Bluetooth connection state.
415 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
417 * @privilege %http://tizen.org/privilege/network.get
418 * @param[in] connection The connection handle
419 * @param[out] state The state of the Bluetooth connection
420 * @return @c 0 on success, otherwise a negative error value
421 * @retval #CONNECTION_ERROR_NONE Successful
422 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
423 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
424 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
425 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
427 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
430 * @brief Registers the callback that is called when the type of the current connection is changed.
431 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
432 * @param[in] connection The connection handle
433 * @param[in] callback The callback function to be called
434 * @param[in] user_data The user data passed to the callback function
435 * @return @c 0 on success, otherwise a negative error value
436 * @retval #CONNECTION_ERROR_NONE Successful
437 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
438 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
440 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
443 * @brief Unregisters the callback that is called when the type of current connection is changed.
444 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
445 * @param[in] connection The connection handle
446 * @return @c 0 on success, otherwise a negative error value
447 * @retval #CONNECTION_ERROR_NONE Successful
448 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
449 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
451 int connection_unset_type_changed_cb(connection_h connection);
454 * @brief Registers the callback that is called when the IP address is changed.
455 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
456 * @param[in] connection The connection handle
457 * @param[in] callback The callback function to be called
458 * @param[in] user_data The user data passed to the callback function
459 * @return @c 0 on success, 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
464 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
467 * @brief Unregisters the callback that is called when the IP address is changed.
468 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
469 * @param[in] connection The connection handle
470 * @return @c 0 on success, otherwise a negative error value
471 * @retval #CONNECTION_ERROR_NONE Successful
472 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
473 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
475 int connection_unset_ip_address_changed_cb(connection_h connection);
478 * @brief Registers the callback that is called when the proxy address is changed.
479 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
480 * @param[in] connection The connection handle
481 * @param[in] callback The callback function to be called
482 * @param[in] user_data The user data passed to the callback function
483 * @return @c 0 on success, otherwise a negative error value
484 * @retval #CONNECTION_ERROR_NONE Successful
485 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
486 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
488 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
491 * @brief Unregisters the callback that is called when the proxy address is changed.
492 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
493 * @param[in] connection The connection handle
494 * @return @c 0 on success, otherwise a negative error value
495 * @retval #CONNECTION_ERROR_NONE Successful
496 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
497 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
499 int connection_unset_proxy_address_changed_cb(connection_h connection);
502 * @brief Adds a new profile which is created by connection_profile_create().
503 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
505 * @privilege %http://tizen.org/privilege/network.profile
506 * @remarks You can only add a profile of the cellular type.
507 * @param[in] connection The connection handle
508 * @param[in] profile The profile handle
509 * @return @c 0 on success, otherwise a negative error value
510 * @retval #CONNECTION_ERROR_NONE Successful
511 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
512 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
513 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
514 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
516 int connection_add_profile(connection_h connection, connection_profile_h profile);
519 * @brief Removes an existing profile.
520 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
522 * @privilege %http://tizen.org/privilege/network.profile \n
523 * %http://tizen.org/privilege/network.get
524 * @remarks This API needs both privileges.
525 * @param[in] connection The connection handle
526 * @param[in] profile The profile handle
527 * @return @c 0 on success, 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
531 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
532 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
534 int connection_remove_profile(connection_h connection, connection_profile_h profile);
537 * @brief Updates an existing profile.
538 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
539 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
540 * In addition, the existing profile will be updated if you call connection_open_profile().
541 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
543 * @privilege %http://tizen.org/privilege/network.profile \n
544 * %http://tizen.org/privilege/network.get
545 * @remarks This API needs both privileges.
546 * @param[in] connection The connection handle
547 * @param[in] profile The profile handle
548 * @return @c 0 on success, otherwise a negative error value
549 * @retval #CONNECTION_ERROR_NONE Successful
550 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
551 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
552 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
553 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
554 * @see connection_open_profile()
556 int connection_update_profile(connection_h connection, connection_profile_h profile);
559 * @brief Gets a profiles iterator.
560 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
562 * @privilege %http://tizen.org/privilege/network.get
563 * @remarks You must release @a profile_iterator using connection_destroy().
564 * @param[in] connection The connection handle
565 * @param[in] type The type of the connetion iterator
566 * @param[out] profile_iterator The iterator of profile
567 * @return @c 0 on success, otherwise a negative error value
568 * @retval #CONNECTION_ERROR_NONE Successful
569 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
570 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
571 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
572 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
574 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
577 * @brief Moves the profile iterator to the next position and gets a profile handle.
578 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
579 * @param[in] profile_iterator The iterator of profile
580 * @param[out] profile The profile handle
581 * @return @c 0 on success, otherwise a negative error value
582 * @retval #CONNECTION_ERROR_NONE Successful
583 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
584 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
586 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
589 * @brief Checks whether the next element of a profile iterator exists or not.
590 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
591 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
592 * @param[in] profile_iterator The iterator of profile
593 * @return @c true if next element exists, otherwise @c false if next element doesn't exist
595 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
598 * @brief Destroys a profiles iterator.
599 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
600 * @param[in] profile_iterator The iterator of the profile
601 * @return @c 0 on success, otherwise a negative error value
602 * @retval #CONNECTION_ERROR_NONE Successful
603 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
605 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
608 * @brief Gets the name of the default profile.
609 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
611 * @privilege %http://tizen.org/privilege/network.get
612 * @remarks You must release @a profile using connection_profile_destroy().
613 * @param[in] connection The connection handle
614 * @param[out] profile The profile handle
615 * @return @c 0 on success, otherwise a negative error value
616 * @retval #CONNECTION_ERROR_NONE Successful
617 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
618 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
619 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
620 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
621 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
623 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
626 * @brief Gets the default profile which provides the given cellular service.
627 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
629 * @privilege %http://tizen.org/privilege/network.get
630 * @remarks You must release @a profile using connection_profile_destroy().
631 * @param[in] connection The connection handle
632 * @param[in] type The type of cellular service \n
633 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
634 * @param[out] profile The profile handle
635 * @return @c 0 on success, otherwise a negative error value
636 * @retval #CONNECTION_ERROR_NONE Successful
637 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
638 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
639 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
640 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda
641 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
643 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
646 * @brief Sets the default profile which provides the given cellular service.
647 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649 * @privilege %http://tizen.org/privilege/network.profile \n
650 * %http://tizen.org/privilege/network.get
651 * @remarks This API needs both privileges.
652 * @param[in] connection The connection handle
653 * @param[in] type The type of cellular service \n
654 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
655 * @param[in] profile The profile handle
656 * @return @c 0 on success, otherwise a negative error value
657 * @retval #CONNECTION_ERROR_NONE Successful
658 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
659 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
660 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
661 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
663 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
666 * @brief Sets the default profile which provides the given cellular service, asynchronously.
667 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
669 * @privilege %http://tizen.org/privilege/network.profile \n
670 * %http://tizen.org/privilege/network.get
671 * @remarks This API needs both privileges.
672 * @param[in] connection The connection handle
673 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
674 * @param[in] profile The profile handle
675 * @param[in] callback The callback function to be called
676 * @param[in] user_data The user data passed to the callback function
677 * @return @c 0 on success, otherwise negative error value
678 * @retval #CONNECTION_ERROR_NONE Successful
679 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
680 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
681 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
682 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
684 int connection_set_default_cellular_service_profile_async(connection_h connection,
685 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
688 * @brief Called after connection_open_profile() is finished.
689 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
690 * @param[in] result The result
691 * @param[in] user_data The user data passed from connection_open_profile()
692 * @pre connection_open_profile() will invoke this callback function.
693 * @see connection_open_profile()
695 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
698 * @brief Called after connection_close_profile() is finished.
699 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
700 * @param[in] result The result
701 * @param[in] user_data The user data passed from connection_close_profile()
702 * @pre connection_close_profile() will invoke this callback function.
703 * @see connection_close_profile()
705 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
708 * @brief Called after connection_reset_profile() is finished.
709 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
710 * @param[in] result The result
711 * @param[in] user_data The user data passed from connection_reset_profile()
712 * @pre connection_reset_profile() will invoke this callback function.
713 * @see connection_reset_profile()
715 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
718 * @brief Opens a connection of profile, asynchronously.
719 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
721 * @privilege %http://tizen.org/privilege/network.set \n
722 * %http://tizen.org/privilege/network.get
723 * @remarks This API needs both privileges.
724 * @param[in] connection The connection handle
725 * @param[in] profile The profile handle
726 * @param[in] callback The callback function to be called
727 * @param[in] user_data The user data passed to the callback function
728 * @return @c 0 on success, otherwise negative error value
729 * @retval #CONNECTION_ERROR_NONE Successful
730 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
731 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
732 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
733 * @post connection_opened_cb() will be invoked.
734 * @see connection_opened_cb()
735 * @see connection_close_profile()
736 * @see connection_profile_set_state_changed_cb()
737 * @see connection_profile_unset_state_changed_cb()
738 * @see connection_profile_state_changed_cb()
740 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
743 * @brief Closes a connection of profile.
744 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
746 * @privilege %http://tizen.org/privilege/network.set
747 * @param[in] connection The connection handle
748 * @param[in] profile The profile handle
749 * @param[in] callback The callback function to be called
750 * @param[in] user_data The user data passed to the callback function
751 * @return @c 0 on success, otherwise negative error value
752 * @retval #CONNECTION_ERROR_NONE Successful
753 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
754 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
755 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
756 * @post connection_closed_cb() will be invoked.
757 * @see connection_closed_cb()
758 * @see connection_open_profile()
759 * @see connection_profile_set_state_changed_cb()
760 * @see connection_profile_unset_state_changed_cb()
761 * @see connection_profile_state_changed_cb()
763 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
766 * @brief Resets the cellular profile.
767 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
769 * @privilege %http://tizen.org/privilege/network.profile \n
770 * %http://tizen.org/privilege/network.get
771 * @remarks This API needs both privileges.
772 * @param[in] connection The connection handle
773 * @param[in] type The type of reset
774 * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.)
775 * @param[in] callback The callback function to be called
776 * @param[in] user_data The user data passed to the callback function
777 * @return 0 on success, otherwise negative error value
778 * @retval #CONNECTION_ERROR_NONE Successful
779 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
780 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
781 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
782 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
783 * @post connection_reset_cb() will be invoked.
785 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
788 * @brief Adds a IPv4 route to the routing table.
789 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
790 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
792 * @privilege %http://tizen.org/privilege/network.set
793 * @param[in] connection The connection handle
794 * @param[in] interface_name The name of network interface
795 * @param[in] host_address The IP address of the host
796 * @return @c 0 on success, otherwise negative error value
797 * @retval #CONNECTION_ERROR_NONE Successful
798 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
799 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
800 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
801 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
802 * @see connection_profile_get_network_interface_name()
804 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
807 * @brief Removes a IPv4 route from the routing table.
808 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
809 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
811 * @privilege %http://tizen.org/privilege/network.set
812 * @param[in] connection The connection handle
813 * @param[in] interface_name The name of network interface
814 * @param[in] host_address The IP address of the host
815 * @return @c 0 on success, otherwise negative error value
816 * @retval #CONNECTION_ERROR_NONE Successful
817 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
818 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
819 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
820 * @see connection_profile_get_network_interface_name()
822 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
825 * @brief Adds a IPv6 route to the routing table.
826 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
829 * @privilege %http://tizen.org/privilege/network.set
830 * @param[in] connection The connection handle
831 * @param[in] interface_name The name of network interface
832 * @param[in] host_address The IP address of the host
833 * @param[in] gateway The gateway address
834 * @return @c 0 on success, otherwise negative error value
835 * @retval #CONNECTION_ERROR_NONE Successful
836 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
837 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
838 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
839 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
840 * @see connection_profile_get_network_interface_name()
842 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
845 * @brief Removes a IPV6 route from the routing table.
846 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
849 * @privilege %http://tizen.org/privilege/network.set
850 * @param[in] connection The connection handle
851 * @param[in] interface_name The name of network interface
852 * @param[in] host_address The IP address of the host
853 * @param[in] gateway The gateway address
854 * @return @c 0 on success, otherwise negative error value
855 * @retval #CONNECTION_ERROR_NONE Successful
856 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
857 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
858 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
859 * @see connection_profile_get_network_interface_name()
861 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
868 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
873 * @brief Gets the statistics information.
874 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
876 * @privilege %http://tizen.org/privilege/network.get
877 * @param[in] connection The connection handle
878 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
879 * @param[in] statistics_type The type of statistics
880 * @param[out] size The received data size of the last cellular packet data connection (bytes)
881 * @return @c 0 on success, otherwise negative error value
882 * @retval #CONNECTION_ERROR_NONE Successful
883 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
884 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
885 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
887 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
890 * @brief Resets the statistics information.
891 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
893 * @privilege %http://tizen.org/privilege/network.set
894 * @remarks This API needs both privileges.
895 * @param[in] connection The connection handle
896 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
897 * @param[in] statistics_type The type of statistics
898 * @return @c 0 on success, otherwise negative error value
899 * @retval #CONNECTION_ERROR_NONE Successful
900 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
901 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
902 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
903 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
905 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
913 #endif /* __cplusplus */