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;
87 * @brief Enumeration for ethernet state.
92 CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< @internal There is no Ethernet profile to open */
93 CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< @internal Disconnected */
94 CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< @internal Connected */
95 } connection_ethernet_state_e;
98 * @brief Enumeration for Bluetooth state.
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.
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.
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 Enumeration for connection errors.
135 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
136 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
137 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
138 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
139 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
140 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
141 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
142 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
143 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
144 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
145 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
146 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
147 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
148 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
149 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
150 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */
151 } connection_error_e;
158 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
163 * @brief Enumeration for statistics type.
168 CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
169 CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
170 CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
171 CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
172 } connection_statistics_type_e;
179 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
185 * @brief Creates a handle for managing data connections.
188 * @privilege %http://tizen.org/privilege/network.get
189 * @remarks You must release @a handle using connection_destroy().
190 * @param[out] connection The connection handle
191 * @return @c 0 on success, otherwise a negative error value
192 * @retval #CONNECTION_ERROR_NONE Successful
193 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
194 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
195 * @see connection_destroy()
197 int connection_create(connection_h* connection);
200 * @brief Destroys the connection handle.
202 * @param[in] connection The connection handle
203 * @return @c 0 on success, otherwise negative error value
204 * @retval #CONNECTION_ERROR_NONE Successful
205 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
206 * @see connection_create()
208 int connection_destroy(connection_h connection);
211 * @brief Called when the type of a connection is changed.
213 * @param[in] type The type of the current network connection
214 * @param[in] user_data The user data passed from the callback registration function
215 * @see connection_set_type_changed_cb()
216 * @see connection_unset_type_changed_cb()
218 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
221 * @brief Called when the address is changed.
223 * @param[in] ipv4_address The IP address for IPv4
224 * @param[in] ipv6_address The IP address for IPv6
225 * @param[in] user_data The user data passed from the callback registration function
226 * @see connection_set_ip_address_changed_cb()
227 * @see connection_unset_ip_address_changed_cb()
228 * @see connection_set_proxy_address_changed_cb()
229 * @see connection_unset_proxy_address_changed_cb()
231 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
234 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
236 * @param[in] result The result
237 * @param[in] user_data The user data passed from connection_open_profile()
238 * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
239 * @see connection_set_default_cellular_service_profile_async()
241 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
244 * @brief Gets the type of the current profile for data connection.
246 * @param[in] connection The connection handle
247 * @param[out] type The type of the network
248 * @return @c 0 on success, otherwise negative error value
249 * @retval #CONNECTION_ERROR_NONE Successful
250 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
251 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
253 int connection_get_type(connection_h connection, connection_type_e* type);
256 * @brief Gets the IP address of the current connection.
258 * @remarks You must release @a ip_address using free().
259 * @param[in] connection The connection handle
260 * @param[in] address_family The address family
261 * @param[out] ip_address The pointer to the IP address string
262 * @return @c 0 on success, otherwise a negative error value
263 * @retval #CONNECTION_ERROR_NONE Successful
264 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
265 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
266 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
268 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
271 * @brief Gets the proxy address of the current connection.
273 * @remarks You must release @a proxy using free().
274 * @param[in] connection The connection handle
275 * @param[in] address_family The address family
276 * @param[out] proxy The proxy address
277 * @return @c 0 on success, otherwise a negative error value
278 * @retval #CONNECTION_ERROR_NONE Successful
279 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
280 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
281 * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
283 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
286 * @brief Gets the state of cellular connection.
287 * @details The returned state is for the cellular connection state.
289 * @param[in] connection The connection handle
290 * @param[out] state The state of the cellular connection
291 * @return @c 0 on success, otherwise a negative error value
292 * @retval #CONNECTION_ERROR_NONE Successful
293 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
294 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
295 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
297 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
300 * @brief Gets the state of the Wi-Fi.
301 * @details The returned state is for the Wi-Fi connection state.
304 * @privilege %http://tizen.org/privilege/network.get
305 * @param[in] connection The connection handle
306 * @param[out] state The state of Wi-Fi connection
307 * @return @c 0 on success, otherwise a negative error value
308 * @retval #CONNECTION_ERROR_NONE Successful
309 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
310 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
311 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
312 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
314 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
318 * @brief Gets the state of the Ethernet.
319 * @details The returned state is for the Ethernet connection state.
322 * @privilege %http://tizen.org/privilege/network.get
323 * @param[in] connection The connection handle
324 * @param[out] state The state of Ethernet connection
325 * @return @c 0 on success, otherwise a negative error value
326 * @retval #CONNECTION_ERROR_NONE Successful
327 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
328 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
329 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
330 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
332 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
335 * @brief Gets the state of the Bluetooth.
336 * @details The returned state is for the Bluetooth connection state.
339 * @privilege %http://tizen.org/privilege/network.get
340 * @param[in] connection The connection handle
341 * @param[out] state The state of the Bluetooth connection
342 * @return @c 0 on success, otherwise a negative error value
343 * @retval #CONNECTION_ERROR_NONE Successful
344 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
345 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
346 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
347 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
349 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
352 * @brief Registers the callback that is called when the type of the current connection is changed.
354 * @param[in] connection The connection handle
355 * @param[in] callback The callback function to be called
356 * @param[in] user_data The user data passed to the callback function
357 * @return @c 0 on success, otherwise a negative error value
358 * @retval #CONNECTION_ERROR_NONE Successful
359 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
360 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
362 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
365 * @brief Unregisters the callback that is called when the type of current connection is changed.
367 * @param[in] connection The connection handle
368 * @return @c 0 on success, otherwise a 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
373 int connection_unset_type_changed_cb(connection_h connection);
376 * @brief Registers the callback that is called when the IP address is changed.
378 * @param[in] connection The connection handle
379 * @param[in] callback The callback function to be called
380 * @param[in] user_data The user data passed to the callback function
381 * @return @c 0 on success, otherwise a negative error value
382 * @retval #CONNECTION_ERROR_NONE Successful
383 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
384 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
386 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
389 * @brief Unregisters the callback that is called when the IP address is changed.
391 * @param[in] connection The connection handle
392 * @return @c 0 on success, otherwise a negative error value
393 * @retval #CONNECTION_ERROR_NONE Successful
394 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
395 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
397 int connection_unset_ip_address_changed_cb(connection_h connection);
400 * @brief Registers the callback that is called when the proxy address is changed.
402 * @param[in] connection The connection handle
403 * @param[in] callback The callback function to be called
404 * @param[in] user_data The user data passed to the callback function
405 * @return @c 0 on success, otherwise a 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
410 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
413 * @brief Unregisters the callback that is called when the proxy address is changed.
415 * @param[in] connection The connection handle
416 * @return @c 0 on success, otherwise a negative error value
417 * @retval #CONNECTION_ERROR_NONE Successful
418 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
419 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
421 int connection_unset_proxy_address_changed_cb(connection_h connection);
424 * @brief Adds a new profile which is created by connection_profile_create().
427 * @privilege %http://tizen.org/privilege/network.profile \n
428 * %http://tizen.org/privilege/network.get
429 * @remarks You can only add a profile of the cellular type. \n
430 * This API needs both privileges.
431 * @param[in] connection The connection handle
432 * @param[in] profile The profile handle
433 * @return @c 0 on success, otherwise a negative error value
434 * @retval #CONNECTION_ERROR_NONE Successful
435 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
436 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
437 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
438 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
440 int connection_add_profile(connection_h connection, connection_profile_h profile);
443 * @brief Removes an existing profile.
446 * @privilege %http://tizen.org/privilege/network.profile \n
447 * %http://tizen.org/privilege/network.get
448 * @remarks This API needs both privileges.
449 * @param[in] connection The connection handle
450 * @param[in] profile The profile handle
451 * @return @c 0 on success, otherwise a negative error value
452 * @retval #CONNECTION_ERROR_NONE Successful
453 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
454 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
455 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
456 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
458 int connection_remove_profile(connection_h connection, connection_profile_h profile);
461 * @brief Updates an existing profile.
462 * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
463 * When you call this function, your changes affect the Connection Manager and the existing profile is updated.
464 * In addition, the existing profile will be updated if you call connection_open_profile().
467 * @privilege %http://tizen.org/privilege/network.profile \n
468 * %http://tizen.org/privilege/network.get
469 * @remarks This API needs both privileges.
470 * @param[in] connection The connection handle
471 * @param[in] profile The profile handle
472 * @return @c 0 on success, otherwise a negative error value
473 * @retval #CONNECTION_ERROR_NONE Successful
474 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
475 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
476 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
477 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
478 * @see connection_open_profile()
480 int connection_update_profile(connection_h connection, connection_profile_h profile);
483 * @brief Gets a profiles iterator.
486 * @privilege %http://tizen.org/privilege/network.get
487 * @remarks You must release @a profile_iterator using connection_destroy().
488 * @param[in] connection The connection handle
489 * @param[in] type The type of the connetion iterator
490 * @param[out] profile_iterator The iterator of profile
491 * @return @c 0 on success, otherwise a negative error value
492 * @retval #CONNECTION_ERROR_NONE Successful
493 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
494 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
495 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
496 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
498 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
501 * @brief Moves the profile iterator to the next position and gets a profile handle.
503 * @param[in] profile_iterator The iterator of profile
504 * @param[out] profile The profile handle
505 * @return @c 0 on success, otherwise a negative error value
506 * @retval #CONNECTION_ERROR_NONE Successful
507 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
508 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
510 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
513 * @brief Checks whether the next element of a profile iterator exists or not.
515 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
516 * @param[in] profile_iterator The iterator of profile
517 * @return @c true if next element exists, otherwise @c false if next element doesn't exist
519 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
522 * @brief Destroys a profiles iterator.
524 * @param[in] profile_iterator The iterator of the profile
525 * @return @c 0 on success, otherwise a negative error value
526 * @retval #CONNECTION_ERROR_NONE Successful
527 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
529 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
532 * @brief Gets the name of the default profile.
535 * @privilege %http://tizen.org/privilege/network.get
536 * @remarks You must release @a profile using connection_profile_destroy().
537 * @param[in] connection The connection handle
538 * @param[out] profile The profile handle
539 * @return @c 0 on success, otherwise a negative error value
540 * @retval #CONNECTION_ERROR_NONE Successful
541 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
542 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
543 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
544 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
545 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
547 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
550 * @brief Gets the default profile which provides the given cellular service.
553 * @privilege %http://tizen.org/privilege/network.get
554 * @remarks You must release @a profile using connection_profile_destroy().
555 * @param[in] connection The connection handle
556 * @param[in] type The type of cellular service \n
557 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
558 * @param[out] profile The profile handle
559 * @return @c 0 on success, otherwise a negative error value
560 * @retval #CONNECTION_ERROR_NONE Successful
561 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
562 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
563 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
564 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda
565 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
567 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
570 * @brief Sets the default profile which provides the given cellular service.
573 * @privilege %http://tizen.org/privilege/network.profile \n
574 * %http://tizen.org/privilege/network.get
575 * @remarks This API needs both privileges.
576 * @param[in] connection The connection handle
577 * @param[in] type The type of cellular service \n
578 * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
579 * @param[in] profile The profile handle
580 * @return @c 0 on success, otherwise a negative error value
581 * @retval #CONNECTION_ERROR_NONE Successful
582 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
583 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
584 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
585 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
587 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
590 * @brief Sets the default profile which provides the given cellular service, asynchronously.
593 * @privilege %http://tizen.org/privilege/network.profile \n
594 * %http://tizen.org/privilege/network.get
595 * @remarks This API needs both privileges.
596 * @param[in] connection The connection handle
597 * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
598 * @param[in] profile The profile handle
599 * @param[in] callback The callback function to be called
600 * @param[in] user_data The user data passed to the callback function
601 * @return @c 0 on success, otherwise negative error value
602 * @retval #CONNECTION_ERROR_NONE Successful
603 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
604 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
605 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
606 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
608 int connection_set_default_cellular_service_profile_async(connection_h connection,
609 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
612 * @brief Called after connection_open_profile() is finished.
614 * @param[in] result The result
615 * @param[in] user_data The user data passed from connection_open_profile()
616 * @pre connection_open_profile() will invoke this callback function.
617 * @see connection_open_profile()
619 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
622 * @brief Called after connection_close_profile() is finished.
624 * @param[in] result The result
625 * @param[in] user_data The user data passed from connection_close_profile()
626 * @pre connection_close_profile() will invoke this callback function.
627 * @see connection_close_profile()
629 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
632 * @brief Called after connection_reset_profile() is finished.
634 * @param[in] result The result
635 * @param[in] user_data The user data passed from connection_reset_profile()
636 * @pre connection_reset_profile() will invoke this callback function.
637 * @see connection_reset_profile()
639 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
642 * @brief Opens a connection of profile, asynchronously.
645 * @privilege %http://tizen.org/privilege/network.set \n
646 * %http://tizen.org/privilege/network.get
647 * @remarks This API needs both privileges.
648 * @param[in] connection The connection handle
649 * @param[in] profile The profile handle
650 * @param[in] callback The callback function to be called
651 * @param[in] user_data The user data passed to the callback function
652 * @return @c 0 on success, otherwise negative error value
653 * @retval #CONNECTION_ERROR_NONE Successful
654 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
655 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
656 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
657 * @post connection_opened_cb() will be invoked.
658 * @see connection_opened_cb()
659 * @see connection_close_profile()
660 * @see connection_profile_set_state_changed_cb()
661 * @see connection_profile_unset_state_changed_cb()
662 * @see connection_profile_state_changed_cb()
664 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
667 * @brief Closes a connection of profile.
670 * @privilege %http://tizen.org/privilege/network.set \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] 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 * @post connection_closed_cb() will be invoked.
683 * @see connection_closed_cb()
684 * @see connection_open_profile()
685 * @see connection_profile_set_state_changed_cb()
686 * @see connection_profile_unset_state_changed_cb()
687 * @see connection_profile_state_changed_cb()
689 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
692 * @brief Resets the cellular profile.
695 * @privilege %http://tizen.org/privilege/network.profile \n
696 * %http://tizen.org/privilege/network.get
697 * @remarks This API needs both privileges.
698 * @param[in] connection The connection handle
699 * @param[in] type The type of reset
700 * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.)
701 * @param[in] callback The callback function to be called
702 * @param[in] user_data The user data passed to the callback function
703 * @return 0 on success, otherwise negative error value
704 * @retval #CONNECTION_ERROR_NONE Successful
705 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
706 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
707 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
708 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
709 * @post connection_reset_cb() will be invoked.
711 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
714 * @brief Adds a route to the routing table.
715 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
718 * @privilege %http://tizen.org/privilege/network.set \n
719 * %http://tizen.org/privilege/network.get
720 * @remarks This API needs both privileges.
721 * @param[in] connection The connection handle
722 * @param[in] interface_name The name of network interface
723 * @param[in] host_address The IP address of the host
724 * @return @c 0 on success, otherwise negative error value
725 * @retval #CONNECTION_ERROR_NONE Successful
726 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
727 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
728 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
729 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
730 * @see connection_profile_get_network_interface_name()
732 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
735 * @brief Removes a route from the routing table.
736 * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
739 * @privilege %http://tizen.org/privilege/network.set \n
740 * %http://tizen.org/privilege/network.get
741 * @remarks This API needs both privileges.
742 * @param[in] connection The connection handle
743 * @param[in] interface_name The name of network interface
744 * @param[in] host_address The IP address of the host
745 * @return @c 0 on success, otherwise negative error value
746 * @retval #CONNECTION_ERROR_NONE Successful
747 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
748 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
749 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
750 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
751 * @see connection_profile_get_network_interface_name()
753 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
760 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
765 * @brief Gets the statistics information.
768 * @privilege %http://tizen.org/privilege/network.get
769 * @param[in] connection The connection handle
770 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
771 * @param[in] statistics_type The type of statistics
772 * @param[out] size The received data size of the last cellular packet data connection (bytes)
773 * @return @c 0 on success, otherwise negative error value
774 * @retval #CONNECTION_ERROR_NONE Successful
775 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
776 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
777 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
779 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
782 * @brief Resets the statistics information.
785 * @privilege %http://tizen.org/privilege/network.set \n
786 * %http://tizen.org/privilege/network.get
787 * @remarks This API needs both privileges.
788 * @param[in] connection The connection handle
789 * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
790 * @param[in] statistics_type The type of statistics
791 * @return @c 0 on success, otherwise negative error value
792 * @retval #CONNECTION_ERROR_NONE Successful
793 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
794 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
795 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
796 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
798 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
806 #endif /* __cplusplus */