2 * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __NET_CONNECTION_INTF_H__
18 #define __NET_CONNECTION_INTF_H__
20 #include "connection_profile.h"
24 #endif /* __cplusplus */
27 * @file net_connection.h
31 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
36 * @brief The connection handle.
39 typedef void* connection_h;
42 * @brief The profiles iterator handle.
45 typedef void* connection_profile_iterator_h;
48 * @brief Enumeration for connection type.
53 CONNECTION_TYPE_DISCONNECTED = 0, /**< Disconnected */
54 CONNECTION_TYPE_WIFI = 1, /**< Wi-Fi type */
55 CONNECTION_TYPE_CELLULAR = 2, /**< Cellular type */
56 CONNECTION_TYPE_ETHERNET = 3, /**< Ethernet type */
57 CONNECTION_TYPE_BT = 4, /**< Bluetooth type */
61 * @brief Enumeration for cellular network state.
66 CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE = 0, /**< Out of service */
67 CONNECTION_CELLULAR_STATE_FLIGHT_MODE = 1, /**< Flight mode */
68 CONNECTION_CELLULAR_STATE_ROAMING_OFF = 2, /**< Roaming is turned off */
69 CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE = 3, /**< Call is only available */
70 CONNECTION_CELLULAR_STATE_AVAILABLE = 4, /**< Available but not connected yet */
71 CONNECTION_CELLULAR_STATE_CONNECTED = 5, /**< Connected */
72 } connection_cellular_state_e;
75 * @brief Enumeration for Wi-Fi state.
80 CONNECTION_WIFI_STATE_DEACTIVATED = 0, /**< Wi-Fi is deactivated */
81 CONNECTION_WIFI_STATE_DISCONNECTED = 1, /**< Disconnected */
82 CONNECTION_WIFI_STATE_CONNECTED = 2, /**< Connected */
83 } connection_wifi_state_e;
86 * @brief Enumeration for ethernet state.
91 CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */
92 CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */
93 CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */
94 } connection_ethernet_state_e;
97 * @brief Enumeration for Bluetooth state.
102 CONNECTION_BT_STATE_DEACTIVATED = 0, /**< There is no Bluetooth profile to open */
103 CONNECTION_BT_STATE_DISCONNECTED = 1, /**< Disconnected */
104 CONNECTION_BT_STATE_CONNECTED = 2, /**< Connected */
105 } connection_bt_state_e;
108 * @brief Enumeration for connection iterator type.
113 CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */
114 CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */
115 CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */
116 } connection_iterator_type_e;
119 * @brief Enumeration for reset profile type.
124 CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */
125 CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */
126 } connection_reset_option_e;
129 * @brief Enumeration for connection errors.
134 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
135 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
136 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
137 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
138 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
139 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
140 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
141 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
142 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
143 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
144 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
145 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
146 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
147 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
148 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
149 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */
150 } connection_error_e;
157 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
162 * @brief Enumeration for statistics type.
167 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
168 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
169 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
170 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
171 } connection_statistics_type_e;
178 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
184 * @brief Creates a handle for managing data connections.
187 * @privilege %http://tizen.org/privilege/network.get
188 * @remarks You must release @a handle using connection_destroy().
189 * @param[out] connection The connection handle
190 * @return @c 0 on success, otherwise a negative error value
191 * @retval #CONNECTION_ERROR_NONE Successful
192 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
193 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
194 * @see connection_destroy()
196 int connection_create(connection_h* connection);
199 * @brief Destroys the connection handle.
201 * @param[in] connection The connection handle
202 * @return @c 0 on success, otherwise negative error value
203 * @retval #CONNECTION_ERROR_NONE Successful
204 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
205 * @see connection_create()
207 int connection_destroy(connection_h connection);
210 * @brief Called when the type of a connection is changed.
212 * @param[in] type The type of the current network connection
213 * @param[in] user_data The user data passed from the callback registration function
214 * @see connection_set_type_changed_cb()
215 * @see connection_unset_type_changed_cb()
217 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
220 * @brief Called when the address is changed.
222 * @param[in] ipv4_address The IP address for IPv4
223 * @param[in] ipv6_address The IP address for IPv6
224 * @param[in] user_data The user data passed from the callback registration function
225 * @see connection_set_ip_address_changed_cb()
226 * @see connection_unset_ip_address_changed_cb()
227 * @see connection_set_proxy_address_changed_cb()
228 * @see connection_unset_proxy_address_changed_cb()
230 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
233 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
235 * @param[in] result The result
236 * @param[in] user_data The user data passed from connection_open_profile()
237 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
238 * @see connection_set_default_cellular_service_profile_async()
240 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
243 * @brief Gets the type of the current profile for data connection.
245 * @param[in] connection The connection handle
246 * @param[out] type The type of the network
247 * @return @c 0 on success, otherwise negative error value
248 * @retval #CONNECTION_ERROR_NONE Successful
249 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
250 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
252 int connection_get_type(connection_h connection, connection_type_e* type);
255 * @brief Gets the IP address of the current connection.
257 * @remarks You must release @a ip_address using free().
258 * @param[in] connection The connection handle
259 * @param[in] address_family The address family
260 * @param[out] ip_address The pointer to the IP address string
261 * @return @c 0 on success, otherwise a negative error value
262 * @retval #CONNECTION_ERROR_NONE Successful
263 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
264 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
265 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
267 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
270 * @brief Gets the proxy address of the current connection.
272 * @remarks You must release @a proxy using free().
273 * @param[in] connection The connection handle
274 * @param[in] address_family The address family
275 * @param[out] proxy The proxy address
276 * @return @c 0 on success, otherwise a negative error value
277 * @retval #CONNECTION_ERROR_NONE Successful
278 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
279 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
280 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
282 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
285 * @brief Gets the state of cellular connection.
286 * @details The returned state is for the cellular connection state.
288 * @param[in] connection The connection handle
289 * @param[out] state The state of the cellular connection
290 * @return @c 0 on success, otherwise a negative error value
291 * @retval #CONNECTION_ERROR_NONE Successful
292 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
293 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
294 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
296 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
299 * @brief Gets the state of the Wi-Fi.
300 * @details The returned state is for the Wi-Fi connection state.
303 * @privilege %http://tizen.org/privilege/network.get
304 * @param[in] connection The connection handle
305 * @param[out] state The state of Wi-Fi connection
306 * @return @c 0 on success, otherwise a negative error value
307 * @retval #CONNECTION_ERROR_NONE Successful
308 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
309 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
310 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
311 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
313 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
316 * @brief Gets the state of the Ethernet.
317 * @details The returned state is for the Ethernet connection state.
320 * @privilege %http://tizen.org/privilege/network.get
321 * @param[in] connection The connection handle
322 * @param[out] state The state of Ethernet connection
323 * @return @c 0 on success, otherwise a negative error value
324 * @retval #CONNECTION_ERROR_NONE Successful
325 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
326 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
327 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
328 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
330 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
333 * @brief Gets the state of the Bluetooth.
334 * @details The returned state is for the Bluetooth connection state.
337 * @privilege %http://tizen.org/privilege/network.get
338 * @param[in] connection The connection handle
339 * @param[out] state The state of the Bluetooth connection
340 * @return @c 0 on success, otherwise a negative error value
341 * @retval #CONNECTION_ERROR_NONE Successful
342 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
343 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
344 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
345 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
347 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
350 * @brief Registers the callback that is called when the type of the current connection is changed.
352 * @param[in] connection The connection handle
353 * @param[in] callback The callback function to be called
354 * @param[in] user_data The user data passed to the callback function
355 * @return @c 0 on success, otherwise a negative error value
356 * @retval #CONNECTION_ERROR_NONE Successful
357 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
360 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
363 * @brief Unregisters the callback that is called when the type of current connection is changed.
365 * @param[in] connection The connection handle
366 * @return @c 0 on success, otherwise a negative error value
367 * @retval #CONNECTION_ERROR_NONE Successful
368 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
369 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
371 int connection_unset_type_changed_cb(connection_h connection);
374 * @brief Registers the callback that is called when the IP address is changed.
376 * @param[in] connection The connection handle
377 * @param[in] callback The callback function to be called
378 * @param[in] user_data The user data passed to the callback function
379 * @return @c 0 on success, otherwise a negative error value
380 * @retval #CONNECTION_ERROR_NONE Successful
381 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
382 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
384 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
387 * @brief Unregisters the callback that is called when the IP address is changed.
389 * @param[in] connection The connection handle
390 * @return @c 0 on success, otherwise a negative error value
391 * @retval #CONNECTION_ERROR_NONE Successful
392 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
393 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
395 int connection_unset_ip_address_changed_cb(connection_h connection);
398 * @brief Registers the callback that is called when the proxy address is changed.
400 * @param[in] connection The connection handle
401 * @param[in] callback The callback function to be called
402 * @param[in] user_data The user data passed to the callback function
403 * @return @c 0 on success, otherwise a negative error value
404 * @retval #CONNECTION_ERROR_NONE Successful
405 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
406 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
408 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
411 * @brief Unregisters the callback that is called when the proxy address is changed.
413 * @param[in] connection The connection handle
414 * @return @c 0 on success, otherwise a negative error value
415 * @retval #CONNECTION_ERROR_NONE Successful
416 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
417 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
419 int connection_unset_proxy_address_changed_cb(connection_h connection);
422 * @brief Adds a new profile which is created by connection_profile_create().
425 * @privilege %http://tizen.org/privilege/network.profile
426 * @remarks You can only add a profile of the cellular type.
427 * @param[in] connection The connection handle
428 * @param[in] profile The profile handle
429 * @return @c 0 on success, otherwise a negative error value
430 * @retval #CONNECTION_ERROR_NONE Successful
431 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
432 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
433 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
434 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
436 int connection_add_profile(connection_h connection, connection_profile_h profile);
439 * @brief Removes an existing profile.
442 * @privilege %http://tizen.org/privilege/network.profile \n
443 * %http://tizen.org/privilege/network.get
444 * @remarks This API needs both privileges.
445 * @param[in] connection The connection handle
446 * @param[in] profile The profile 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
451 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
452 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
454 int connection_remove_profile(connection_h connection, connection_profile_h profile);
457 * @brief Updates an existing profile.
458 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
459 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
460 * In addition, the existing profile will be updated if you call connection_open_profile().
463 * @privilege %http://tizen.org/privilege/network.profile \n
464 * %http://tizen.org/privilege/network.get
465 * @remarks This API needs both privileges.
466 * @param[in] connection The connection handle
467 * @param[in] profile The profile handle
468 * @return @c 0 on success, otherwise a negative error value
469 * @retval #CONNECTION_ERROR_NONE Successful
470 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
471 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
472 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
473 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
474 * @see connection_open_profile()
476 int connection_update_profile(connection_h connection, connection_profile_h profile);
479 * @brief Gets a profiles iterator.
482 * @privilege %http://tizen.org/privilege/network.get
483 * @remarks You must release @a profile_iterator using connection_destroy().
484 * @param[in] connection The connection handle
485 * @param[in] type The type of the connetion iterator
486 * @param[out] profile_iterator The iterator of profile
487 * @return @c 0 on success, otherwise a negative error value
488 * @retval #CONNECTION_ERROR_NONE Successful
489 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
490 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
491 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
492 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
494 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
497 * @brief Moves the profile iterator to the next position and gets a profile handle.
499 * @param[in] profile_iterator The iterator of profile
500 * @param[out] profile The profile handle
501 * @return @c 0 on success, otherwise a negative error value
502 * @retval #CONNECTION_ERROR_NONE Successful
503 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
504 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
506 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
509 * @brief Checks whether the next element of a profile iterator exists or not.
511 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
512 * @param[in] profile_iterator The iterator of profile
513 * @return @c true if next element exists, otherwise @c false if next element doesn't exist
515 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
518 * @brief Destroys a profiles iterator.
520 * @param[in] profile_iterator The iterator of the profile
521 * @return @c 0 on success, otherwise a negative error value
522 * @retval #CONNECTION_ERROR_NONE Successful
523 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
525 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
528 * @brief Gets the name of the default profile.
531 * @privilege %http://tizen.org/privilege/network.get
532 * @remarks You must release @a profile using connection_profile_destroy().
533 * @param[in] connection The connection handle
534 * @param[out] profile The profile handle
535 * @return @c 0 on success, otherwise a negative error value
536 * @retval #CONNECTION_ERROR_NONE Successful
537 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
538 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
539 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
540 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
541 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
543 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
546 * @brief Gets the default profile which provides the given cellular service.
549 * @privilege %http://tizen.org/privilege/network.get
550 * @remarks You must release @a profile using connection_profile_destroy().
551 * @param[in] connection The connection handle
552 * @param[in] type The type of cellular service \n
553 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
554 * @param[out] profile The profile handle
555 * @return @c 0 on success, otherwise a negative error value
556 * @retval #CONNECTION_ERROR_NONE Successful
557 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
558 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
559 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
560 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda
561 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
563 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
566 * @brief Sets the default profile which provides the given cellular service.
569 * @privilege %http://tizen.org/privilege/network.profile \n
570 * %http://tizen.org/privilege/network.get
571 * @remarks This API needs both privileges.
572 * @param[in] connection The connection handle
573 * @param[in] type The type of cellular service \n
574 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
575 * @param[in] profile The profile handle
576 * @return @c 0 on success, otherwise a negative error value
577 * @retval #CONNECTION_ERROR_NONE Successful
578 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
579 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
580 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
581 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
583 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
586 * @brief Sets the default profile which provides the given cellular service, asynchronously.
589 * @privilege %http://tizen.org/privilege/network.profile \n
590 * %http://tizen.org/privilege/network.get
591 * @remarks This API needs both privileges.
592 * @param[in] connection The connection handle
593 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
594 * @param[in] profile The profile handle
595 * @param[in] callback The callback function to be called
596 * @param[in] user_data The user data passed to the callback function
597 * @return @c 0 on success, otherwise negative error value
598 * @retval #CONNECTION_ERROR_NONE Successful
599 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
600 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
601 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
602 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
604 int connection_set_default_cellular_service_profile_async(connection_h connection,
605 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
608 * @brief Called after connection_open_profile() is finished.
610 * @param[in] result The result
611 * @param[in] user_data The user data passed from connection_open_profile()
612 * @pre connection_open_profile() will invoke this callback function.
613 * @see connection_open_profile()
615 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
618 * @brief Called after connection_close_profile() is finished.
620 * @param[in] result The result
621 * @param[in] user_data The user data passed from connection_close_profile()
622 * @pre connection_close_profile() will invoke this callback function.
623 * @see connection_close_profile()
625 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
628 * @brief Called after connection_reset_profile() is finished.
630 * @param[in] result The result
631 * @param[in] user_data The user data passed from connection_reset_profile()
632 * @pre connection_reset_profile() will invoke this callback function.
633 * @see connection_reset_profile()
635 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
638 * @brief Opens a connection of profile, asynchronously.
641 * @privilege %http://tizen.org/privilege/network.set \n
642 * %http://tizen.org/privilege/network.get
643 * @remarks This API needs both privileges.
644 * @param[in] connection The connection handle
645 * @param[in] profile The profile handle
646 * @param[in] callback The callback function to be called
647 * @param[in] user_data The user data passed to the callback function
648 * @return @c 0 on success, otherwise negative error value
649 * @retval #CONNECTION_ERROR_NONE Successful
650 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
651 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
652 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
653 * @post connection_opened_cb() will be invoked.
654 * @see connection_opened_cb()
655 * @see connection_close_profile()
656 * @see connection_profile_set_state_changed_cb()
657 * @see connection_profile_unset_state_changed_cb()
658 * @see connection_profile_state_changed_cb()
660 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
663 * @brief Closes a connection of profile.
666 * @privilege %http://tizen.org/privilege/network.set
667 * @param[in] connection The connection handle
668 * @param[in] profile The profile handle
669 * @param[in] callback The callback function to be called
670 * @param[in] user_data The user data passed to the callback function
671 * @return @c 0 on success, otherwise negative error value
672 * @retval #CONNECTION_ERROR_NONE Successful
673 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
674 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
675 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
676 * @post connection_closed_cb() will be invoked.
677 * @see connection_closed_cb()
678 * @see connection_open_profile()
679 * @see connection_profile_set_state_changed_cb()
680 * @see connection_profile_unset_state_changed_cb()
681 * @see connection_profile_state_changed_cb()
683 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
686 * @brief Resets the cellular profile.
689 * @privilege %http://tizen.org/privilege/network.profile \n
690 * %http://tizen.org/privilege/network.get
691 * @remarks This API needs both privileges.
692 * @param[in] connection The connection handle
693 * @param[in] type The type of reset
694 * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.)
695 * @param[in] callback The callback function to be called
696 * @param[in] user_data The user data passed to the callback function
697 * @return 0 on success, otherwise negative error value
698 * @retval #CONNECTION_ERROR_NONE Successful
699 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
700 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
701 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
702 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
703 * @post connection_reset_cb() will be invoked.
705 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
708 * @brief Adds a IPv4 route to the routing table.
709 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
712 * @privilege %http://tizen.org/privilege/network.set
713 * @param[in] connection The connection handle
714 * @param[in] interface_name The name of network interface
715 * @param[in] host_address The IP address of the host
716 * @return @c 0 on success, otherwise negative error value
717 * @retval #CONNECTION_ERROR_NONE Successful
718 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
719 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
720 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
721 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
722 * @see connection_profile_get_network_interface_name()
724 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
727 * @brief Removes a IPv4 route from the routing table.
728 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
731 * @privilege %http://tizen.org/privilege/network.set
732 * @param[in] connection The connection handle
733 * @param[in] interface_name The name of network interface
734 * @param[in] host_address The IP address of the host
735 * @return @c 0 on success, otherwise negative error value
736 * @retval #CONNECTION_ERROR_NONE Successful
737 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
738 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
739 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
740 * @see connection_profile_get_network_interface_name()
742 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
745 * @brief Adds a IPv6 route to the routing table.
746 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
749 * @privilege %http://tizen.org/privilege/network.set
750 * @param[in] connection The connection handle
751 * @param[in] interface_name The name of network interface
752 * @param[in] host_address The IP address of the host
753 * @param[in] gateway The gateway address
754 * @return @c 0 on success, otherwise negative error value
755 * @retval #CONNECTION_ERROR_NONE Successful
756 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
757 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
758 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
759 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
760 * @see connection_profile_get_network_interface_name()
762 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
769 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
774 * @brief Gets the statistics information.
777 * @privilege %http://tizen.org/privilege/network.get
778 * @param[in] connection The connection handle
779 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
780 * @param[in] statistics_type The type of statistics
781 * @param[out] size The received data size of the last cellular packet data connection (bytes)
782 * @return @c 0 on success, otherwise negative error value
783 * @retval #CONNECTION_ERROR_NONE Successful
784 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
785 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
786 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
788 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
791 * @brief Resets the statistics information.
794 * @privilege %http://tizen.org/privilege/network.set
795 * @remarks This API needs both privileges.
796 * @param[in] connection The connection handle
797 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
798 * @param[in] statistics_type The type of statistics
799 * @return @c 0 on success, otherwise negative error value
800 * @retval #CONNECTION_ERROR_NONE Successful
801 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
802 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
803 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
804 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
806 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
814 #endif /* __cplusplus */