2cfd0a5ce1f271569ea1820f1606948d92963185
[platform/core/api/connection.git] / include / connection_profile.h
1 /*
2  * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_NETWORK_CONNECTION_PROFILE_H__
18 #define __TIZEN_NETWORK_CONNECTION_PROFILE_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @file connection_profile.h
28  */
29
30 /**
31 * @addtogroup CAPI_NETWORK_CONNECTION_WIFI_PROFILE_MODULE
32 * @{
33 */
34
35 /**
36  * @brief Enumeration for security type of Wi-Fi.
37  * @since_tizen 2.3
38 */
39 typedef enum
40 {
41     CONNECTION_WIFI_SECURITY_TYPE_NONE = 0,  /**< Security disabled */
42     CONNECTION_WIFI_SECURITY_TYPE_WEP = 1,  /**< WEP */
43     CONNECTION_WIFI_SECURITY_TYPE_WPA_PSK = 2,  /**< WPA-PSK */
44     CONNECTION_WIFI_SECURITY_TYPE_WPA2_PSK = 3,  /**< WPA2-PSK */
45     CONNECTION_WIFI_SECURITY_TYPE_EAP = 4,  /**< EAP */
46 } connection_wifi_security_type_e;
47
48 /**
49  * @brief Enumeration for encryption modes.
50  * @since_tizen 2.3
51 */
52 typedef enum
53 {
54     CONNECTION_WIFI_ENCRYPTION_TYPE_NONE = 0,  /**< Encryption disabled */
55     CONNECTION_WIFI_ENCRYPTION_TYPE_WEP = 1,  /**< WEP */
56     CONNECTION_WIFI_ENCRYPTION_TYPE_TKIP = 2,  /**< TKIP */
57     CONNECTION_WIFI_ENCRYPTION_TYPE_AES = 3,  /**< AES */
58     CONNECTION_WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED = 4,  /**< TKIP and AES are both supported */
59 } connection_wifi_encryption_type_e;
60
61 /**
62 * @}
63 */
64
65
66 /**
67 * @addtogroup CAPI_NETWORK_CONNECTION_CELLULAR_PROFILE_MODULE
68 * @{
69 */
70
71 /**
72 * @brief This enumeration defines the cellular protocol type.
73 */
74 typedef enum
75 {
76     CONNECTION_CELLULAR_NETWORK_TYPE_UNKNOWN = 0,  /**< Not defined */
77     CONNECTION_CELLULAR_NETWORK_TYPE_GPRS = 1,  /**< GPRS type */
78     CONNECTION_CELLULAR_NETWORK_TYPE_EDGE = 2,  /**< EDGE type */
79     CONNECTION_CELLULAR_NETWORK_TYPE_UMTS = 3,  /**< UMTS type */
80 } connection_cellular_network_type_e;
81
82 /**
83  * @brief Enumeration for cellular service type.
84  * @since_tizen 2.3
85 */
86 typedef enum
87 {
88     CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN = 0,  /**< Unknown */
89     CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET = 1,  /**< Internet */
90     CONNECTION_CELLULAR_SERVICE_TYPE_MMS = 2,  /**< MMS */
91     CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET = 3,  /**< Prepaid internet */
92     CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_MMS = 4,  /**< Prepaid MMS */
93     CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING = 5,  /**< Tethering */
94     CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION = 6,  /**< Specific application */
95 } connection_cellular_service_type_e;
96
97 /**
98  * @brief Enumeration for cellular authentication type.
99  * @since_tizen 2.3
100 */
101 typedef enum
102 {
103     CONNECTION_CELLULAR_AUTH_TYPE_NONE = 0,  /**< No authentication */
104     CONNECTION_CELLULAR_AUTH_TYPE_PAP  = 1,  /**< PAP authentication */
105     CONNECTION_CELLULAR_AUTH_TYPE_CHAP = 2,  /**< CHAP authentication */
106 } connection_cellular_auth_type_e;
107
108 /**
109 * @}
110 */
111
112
113 /**
114 * @addtogroup CAPI_NETWORK_CONNECTION_PROFILE_MODULE
115 * @{
116 */
117
118 /**
119  * @brief The profile handle.
120  * @since_tizen 2.3
121 */
122 typedef void* connection_profile_h;
123
124 /**
125  * @brief Enumeration for profile state type.
126  * @since_tizen 2.3
127 */
128 typedef enum
129 {
130     CONNECTION_PROFILE_STATE_DISCONNECTED = 0,  /**< Disconnected state */
131     CONNECTION_PROFILE_STATE_ASSOCIATION = 1,  /**< Association state */
132     CONNECTION_PROFILE_STATE_CONFIGURATION = 2,  /**< Configuration state */
133     CONNECTION_PROFILE_STATE_CONNECTED = 3,  /**< Connected state */
134 } connection_profile_state_e;
135
136 /**
137  * @brief Enumeration for address family.
138  * @since_tizen 2.3
139 */
140 typedef enum
141 {
142     CONNECTION_ADDRESS_FAMILY_IPV4 = 0,  /**< IPV4 Address type */
143     CONNECTION_ADDRESS_FAMILY_IPV6 = 1,  /**< IPV6 Address type */
144 } connection_address_family_e;
145
146 /**
147  * @brief Enumeration for IP configuration type.
148  * @since_tizen 2.3
149 */
150 typedef enum
151 {
152     CONNECTION_IP_CONFIG_TYPE_NONE = 0,  /**< Not defined */
153     CONNECTION_IP_CONFIG_TYPE_STATIC  = 1,  /**< Manual IP configuration */
154     CONNECTION_IP_CONFIG_TYPE_DYNAMIC = 2,  /**< Config IP using DHCP client*/
155     CONNECTION_IP_CONFIG_TYPE_AUTO = 3,  /**< Config IP from Auto IP pool (169.254/16). Later with DHCP client, if available */
156     CONNECTION_IP_CONFIG_TYPE_FIXED = 4,  /**< Indicates an IP address that can not be modified */
157 } connection_ip_config_type_e;
158
159 /**
160  * @brief Enumeration for proxy method type.
161  * @since_tizen 2.3
162 */
163 typedef enum
164 {
165     CONNECTION_PROXY_TYPE_DIRECT = 0,  /**< Direct connection */
166     CONNECTION_PROXY_TYPE_AUTO = 1,  /**< Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried */
167     CONNECTION_PROXY_TYPE_MANUAL  = 2,  /**< Manual configuration */
168 } connection_proxy_type_e;
169
170 /**
171  * @brief Enumeration for network connection type.
172  * @since_tizen 2.3
173 */
174 typedef enum{
175     CONNECTION_PROFILE_TYPE_CELLULAR = 0,  /**< Cellular type */
176     CONNECTION_PROFILE_TYPE_WIFI = 1,  /**< Wi-Fi type */
177     CONNECTION_PROFILE_TYPE_ETHERNET = 2,  /**< Ethernet type */
178     CONNECTION_PROFILE_TYPE_BT = 3,  /**< Bluetooth type */
179 } connection_profile_type_e;
180
181 /**
182  * @brief Creates a profile handle.
183  * @details The profile name, which you get from connection_profile_get_name(), will include the keyword you set.
184  * @since_tizen 2.3
185  * @privlevel public
186  * @privilege %http://tizen.org/privilege/network.profile \n
187  *            %http://tizen.org/privilege/network.get
188  * @remarks You must release @a profile using connection_profile_destroy(). \n
189  *          This API needs both privileges.
190  * @param[in] type  The type of profile\n
191  *               #CONNECTION_PROFILE_TYPE_CELLULAR and #CONNECTION_PROFILE_TYPE_WIFI are supported.
192  * @param[in] keyword  The keyword included in profile name
193  * @param[out] profile  The handle of the profile
194  * @return @c 0 on success, otherwise negative error value
195  * @retval #CONNECTION_ERROR_NONE  Successful
196  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
197  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
198  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
199  * @see connection_profile_destroy()
200  * @see connection_profile_get_name()
201 */
202 int connection_profile_create(connection_profile_type_e type, const char* keyword, connection_profile_h* profile);
203
204 /**
205  * @brief Destroys a profile handle.
206  * @since_tizen 2.3
207  * @param[out] profile  The handle to the profile
208  * @return @c 0 on success, otherwise a negative error value
209  * @retval #CONNECTION_ERROR_NONE  Successful
210  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
211  * @see connection_profile_create()
212 */
213 int connection_profile_destroy(connection_profile_h profile);
214
215 /**
216  * @brief Clones a profile handle.
217  * @since_tizen 2.3
218  * @remarks You must release @a cloned_profile using connection_profile_destroy().
219  * @param[out] cloned_profile  The handle of the cloned profile
220  * @param[in] origin_profile  The handle of the origin profile
221  * @return @c 0 on success, otherwise a negative error value
222  * @retval #CONNECTION_ERROR_NONE  Successful
223  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
224  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
225  * @see connection_profile_destroy()
226 */
227 int connection_profile_clone(connection_profile_h* cloned_profile, connection_profile_h origin_profile);
228
229 /**
230  * @brief Gets the profile ID.
231  * @details The separate profiles can have the same name.
232  * So, you must use this API instead of connection_profile_get_name() if you want to get the unique identification.
233  * In case you create a profile, this value will be determined when you add the profile.
234  *
235  * @since_tizen 2.3
236  * @remarks You must release @a profile_id using free().
237  * @param[in] profile  The profile handle
238  * @param[out] profile_id  The ID of the profile
239  * @return @c 0 on success, otherwise a negative error value
240  * @retval #CONNECTION_ERROR_NONE  Successful
241  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
242  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
243  * @see connection_profile_get_name()
244  * @see connection_add_profile()
245 */
246 int connection_profile_get_id(connection_profile_h profile, char** profile_id);
247
248 /**
249  * @brief Gets the profile name.
250  * @since_tizen 2.3
251  * @remarks You must release @a profile_name using free().
252  * @param[in] profile  The profile handle
253  * @param[out] profile_name  The name of the profile
254  * @return @c 0 on success, otherwise a negative error value
255  * @retval #CONNECTION_ERROR_NONE  Successful
256  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
257  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
258  * @see connection_profile_get_id()
259 */
260 int connection_profile_get_name(connection_profile_h profile, char** profile_name);
261
262 /**
263  * @brief Gets the network type.
264  * @since_tizen 2.3
265  * @param[in] profile  The profile handle
266  * @param[out] type  The type of the profile
267  * @return @c 0 on success, otherwise a negative error value
268  * @retval #CONNECTION_ERROR_NONE  Successful
269  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
270  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
271 */
272 int connection_profile_get_type(connection_profile_h profile, connection_profile_type_e* type);
273
274 /**
275  * @brief Gets the name of the network interface, e.g. eth0 and pdp0.
276  * @since_tizen 2.3
277  * @remarks You must release @a interface_name using free().
278  * @param[in] profile  The profile handle
279  * @param[out] interface_name  The name of the network interface
280  * @return @c 0 on success, otherwise a negative error value
281  * @retval #CONNECTION_ERROR_NONE  Successful
282  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
283  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
284 */
285 int connection_profile_get_network_interface_name(connection_profile_h profile, char** interface_name);
286
287 /**
288  * @brief Refreshes the profile information.
289  * @since_tizen 2.3
290  * @privlevel public
291  * @privilege %http://tizen.org/privilege/network.get
292  * @remarks You should call this function in order to get the current information because the profile information can be changed.
293  * @param[in] profile  The profile handle
294  * @return @c 0 on success, otherwise a negative error value
295  * @retval #CONNECTION_ERROR_NONE  Successful
296  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
297  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
298  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
299  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
300 */
301 int connection_profile_refresh(connection_profile_h profile);
302
303 /**
304  * @brief Gets the network type.
305  * @since_tizen 2.3
306  * @param[in] profile  The profile handle
307  * @param[out] state  The state of the profile
308  * @return @c 0 on success, otherwise a negative error value
309  * @retval #CONNECTION_ERROR_NONE  Successful
310  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
311  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
312 */
313 int connection_profile_get_state(connection_profile_h profile, connection_profile_state_e* state);
314
315 /**
316  * @brief Gets the IP config type.
317  * @since_tizen 2.3
318  * @param[in] profile  The profile handle
319  * @param[in] address_family  The address family
320  * @param[out] type  The type of the IP config
321  * @return @c 0 on success, otherwise a negative error value
322  * @retval #CONNECTION_ERROR_NONE  Successful
323  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
324  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
325 */
326 int connection_profile_get_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e* type);
327
328 /**
329  * @brief Gets the IP address.
330  * @since_tizen 2.3
331  * @remarks You must release @a ip_address using free().
332  * @param[in] profile  The profile handle
333  * @param[in] address_family  The address family
334  * @param[out] ip_address  The IP address
335  * @return @c 0 on success, otherwise a negative error value
336  * @retval #CONNECTION_ERROR_NONE  Successful
337  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
338  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
339  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
340  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
341 */
342 int connection_profile_get_ip_address(connection_profile_h profile, connection_address_family_e address_family, char** ip_address);
343
344 /**
345  * @brief Gets the Subnet Mask.
346  * @since_tizen 2.3
347  * @remarks You must release @a subnet_mask using free().
348  * @param[in] profile  The profile handle
349  * @param[in] address_family  The address family
350  * @param[out] subnet_mask  The subnet mask
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_OUT_OF_MEMORY  Out of memory
355  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
356  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
357 */
358 int connection_profile_get_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, char** subnet_mask);
359
360 /**
361  * @brief Gets the Gateway address.
362  * @since_tizen 2.3
363  * @remarks You must release @a gateway_address using free().
364  * @param[in] profile  The profile handle
365  * @param[in] address_family  The address family
366  * @param[out] gateway_address  The gateway address
367  * @return @c 0 on success, otherwise a negative error value
368  * @retval #CONNECTION_ERROR_NONE  Successful
369  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
370  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
371  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
372  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
373 */
374 int connection_profile_get_gateway_address(connection_profile_h profile, connection_address_family_e address_family, char** gateway_address);
375
376 /**
377  * @brief Gets the DNS address.
378  * @since_tizen 2.3
379  * @remarks The allowance of the DNS address is @c 2. You must release @a dns_address using free().
380  * @param[in] profile  The profile handle
381  * @param[in] order  The order of DNS address \n
382  *              it starts from 1, which means first DNS address.
383  * @param[in] address_family  The address family
384  * @param[out] dns_address  The DNS address
385  * @return @c 0 on success, otherwise a negative error value
386  * @retval #CONNECTION_ERROR_NONE  Successful
387  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
388  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
389  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
390  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
391 */
392 int connection_profile_get_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, char** dns_address);
393
394 /**
395  * @brief Gets the Proxy type.
396  * @since_tizen 2.3
397  * @param[in] profile  The profile handle
398  * @param[out] type  The type of the proxy
399  * @return @c 0 on success, otherwise a negative error value
400  * @retval #CONNECTION_ERROR_NONE  Successful
401  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
402  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
403 */
404 int connection_profile_get_proxy_type(connection_profile_h profile, connection_proxy_type_e* type);
405
406 /**
407  * @brief Gets the Proxy address.
408  * @since_tizen 2.3
409  * @remarks You must release @a proxy_address using free().
410  * @param[in] profile  The profile handle
411  * @param[in] address_family  The address family
412  * @param[out] proxy_address  The proxy address
413  * @return @c 0 on success, otherwise a negative error value
414  * @retval #CONNECTION_ERROR_NONE  Successful
415  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
416  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
417  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
418  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
419 */
420 int connection_profile_get_proxy_address(connection_profile_h profile, connection_address_family_e address_family, char** proxy_address);
421
422 /**
423  * @brief Sets the IP config type.
424  * @details If you set IP config type to #CONNECTION_IP_CONFIG_TYPE_STATIC,
425  * then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0".
426  * @since_tizen 2.3
427  * @param[in] profile  The profile handle
428  * @param[in] address_family  The address family
429  * @param[in] type  The type of the IP config
430  * @return @c 0 on success, otherwise a negative error value
431  * @retval #CONNECTION_ERROR_NONE  Successful
432  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
433  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
434 */
435 int connection_profile_set_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e type);
436
437 /**
438  * @brief Sets the IP address.
439  * @since_tizen 2.3
440  * @param[in] profile  The profile handle
441  * @param[in] address_family  The address family
442  * @param[in] ip_address  The IP address.\n
443  *                      If you set this value to @c NULL, then the existing value will be deleted.
444  * @return @c 0 on success, otherwise a negative error value
445  * @retval #CONNECTION_ERROR_NONE  Successful
446  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
447  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
448  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
449  * @see connection_update_profile()
450 */
451 int connection_profile_set_ip_address(connection_profile_h profile, connection_address_family_e address_family, const char* ip_address);
452
453 /**
454  * @brief Sets the Subnet Mask.
455  * @since_tizen 2.3
456  * @param[in] profile  The profile handle
457  * @param[in] address_family  The address family
458  * @param[in] subnet_mask  The subnet mask. \n
459  *                      If you set this value to @c NULL, then the existing value will be deleted.
460  * @return @c 0 on success, otherwise a negative error value
461  * @retval #CONNECTION_ERROR_NONE  Successful
462  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
463  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
464  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
465  * @see connection_update_profile()
466 */
467 int connection_profile_set_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, const char* subnet_mask);
468
469 /**
470  * @brief Sets the Gateway address.
471  * @since_tizen 2.3
472  * @param[in] profile  The profile handle
473  * @param[in] address_family  The address family
474  * @param[in] gateway_address  The gateway address. \n
475  *                      If you set this value to @c NULL, then the existing value will be deleted.
476  * @return @c 0 on success, otherwise a negative error value
477  * @retval #CONNECTION_ERROR_NONE  Successful
478  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
479  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
480  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
481  * @see connection_update_profile()
482 */
483 int connection_profile_set_gateway_address(connection_profile_h profile, connection_address_family_e address_family, const char* gateway_address);
484
485 /**
486  * @brief Sets the DNS address.
487  * @since_tizen 2.3
488  * @remarks The allowance of the DNS address is @c 2.
489  * @param[in] profile  The profile handle
490  * @param[in] order  The order of the DNS address. \n
491  *              It starts from @c 1, which means first DNS address.
492  * @param[in] address_family  The address family
493  * @param[in] dns_address  The DNS address; if you set this value to NULL, then the existing value will be deleted
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_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
498  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
499  * @see connection_update_profile()
500 */
501 int connection_profile_set_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, const char* dns_address);
502
503 /**
504  * @brief Sets the Proxy type.
505  * @details If you set the Proxy type to #CONNECTION_PROXY_TYPE_AUTO or #CONNECTION_PROXY_TYPE_MANUAL, then Proxy will be restored.
506  * @since_tizen 2.3
507  * @param[in] profile  The profile handle
508  * @param[in] type  The type of the proxy
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  * @see connection_update_profile()
514 */
515 int connection_profile_set_proxy_type(connection_profile_h profile, connection_proxy_type_e type);
516
517 /**
518  * @brief Sets the Proxy address.
519  * @since_tizen 2.3
520  * @param[in] profile  The profile handle
521  * @param[in] address_family  The address family
522  * @param[in] proxy_address  The proxy address. \n
523  *                      if you set this value to @c NULL, then the existing value will be deleted.
524  * @return @c 0 on success, otherwise a negative error value
525  * @retval #CONNECTION_ERROR_NONE  Successful
526  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
527  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
528  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
529  * @see connection_update_profile()
530 */
531 int connection_profile_set_proxy_address(connection_profile_h profile, connection_address_family_e address_family, const char* proxy_address);
532
533 /**
534  * @brief Called when the state of the profile is changed.
535  * @since_tizen 2.3
536  * @param[in] state  The state
537  * @param[in] user_data The user data passed from the callback registration function
538  * @see connection_profile_set_state_changed_cb()
539  * @see connection_profile_unset_state_changed_cb()
540 */
541 typedef void(*connection_profile_state_changed_cb)(connection_profile_state_e state, void* user_data);
542
543 /**
544  * @brief Registers the callback that is called when the state of profile is changed.
545  * @since_tizen 2.3
546  * @param[in] profile  The profile handle
547  * @param[in] callback  The callback function to be called
548  * @param[in] user_data The user data passed to the callback function
549  * @return @c 0 on success, otherwise a negative error value
550  * @retval #CONNECTION_ERROR_NONE  Successful
551  * @retval #CONNECTION_ERROR_INVALID_PARAMETER   Invalid parameter
552  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
553  * @post connection_opened_cb() is invoked when the state of profile is changed.
554  * @see connection_profile_state_changed_cb()
555  * @see connection_profile_unset_state_changed_cb()
556 */
557 int connection_profile_set_state_changed_cb(connection_profile_h profile, connection_profile_state_changed_cb callback, void* user_data);
558
559 /**
560  * @brief Unregisters the callback that is called when the state of profile is changed.
561  * @since_tizen 2.3
562  * @param[in] profile  The profile handle
563  * @return @c 0 on success, otherwise a negative error value
564  * @retval #CONNECTION_ERROR_NONE  Successful
565  * @retval #CONNECTION_ERROR_INVALID_PARAMETER   Invalid parameter
566  * @see connection_profile_state_changed_cb()
567  * @see connection_profile_set_state_changed_cb()
568 */
569 int connection_profile_unset_state_changed_cb(connection_profile_h profile);
570
571 /**
572 * @}
573 */
574
575
576 /**
577 * @addtogroup CAPI_NETWORK_CONNECTION_WIFI_PROFILE_MODULE
578 * @{
579 */
580
581 /**
582  * @brief Gets the ESSID (Extended Service Set Identifier).
583  * @since_tizen 2.3
584  * @remarks You must release @a essid using free().
585  * @param[in] profile  The profile handle
586  * @param[out] essid  The ESSID
587  * @return @c 0 on success, otherwise a negative error value
588  * @retval #CONNECTION_ERROR_NONE  Successful
589  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
590  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
591  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
592 */
593 int connection_profile_get_wifi_essid(connection_profile_h profile, char** essid);
594
595 /**
596  * @brief Gets the BSSID (Basic Service Set Identifier).
597  * @since_tizen 2.3
598  * @remarks You must release @a bssid using free().
599  * @param[in] profile  The profile handle
600  * @param[out] bssid  The BSSID
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
604  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
605  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
606 */
607 int connection_profile_get_wifi_bssid(connection_profile_h profile, char** bssid);
608
609 /**
610  * @brief Gets the RSSI.
611  * @since_tizen 2.3
612  * @param[in] profile  The profile handle
613  * @param[out] rssi  The RSSI
614  * @return @c 0 on success, otherwise a negative error value
615  * @retval #CONNECTION_ERROR_NONE  Successful
616  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
617  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
618 */
619 int connection_profile_get_wifi_rssi(connection_profile_h profile, int* rssi);
620
621 /**
622  * @brief Gets the frequency (MHz).
623  * @since_tizen 2.3
624  * @param[in] profile  The profile handle
625  * @param[out] frequency  The frequency
626  * @return @c 0 on success, otherwise a negative error value
627  * @retval #CONNECTION_ERROR_NONE  Successful
628  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
629  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
630 */
631 int connection_profile_get_wifi_frequency(connection_profile_h profile, int* frequency);
632
633 /**
634  * @brief Gets the max speed (Mbps).
635  * @since_tizen 2.3
636  * @param[in] profile  The profile handle
637  * @param[out] max_speed  The max speed
638  * @return @c 0 on success, otherwise a negative error value
639  * @retval #CONNECTION_ERROR_NONE  Successful
640  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
641  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
642 */
643 int connection_profile_get_wifi_max_speed(connection_profile_h profile, int* max_speed);
644
645 /**
646  * @brief Gets the security mode of Wi-Fi.
647  * @since_tizen 2.3
648  * @param[in] profile  The profile handle
649  * @param[out] type  The type of Wi-Fi security
650  * @return @c 0 on success, otherwise a negative error value
651  * @retval #CONNECTION_ERROR_NONE  Successful
652  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
653  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
654  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
655 */
656 int connection_profile_get_wifi_security_type(connection_profile_h profile, connection_wifi_security_type_e* type);
657
658 /**
659  * @brief Gets the security mode of Wi-Fi.
660  * @since_tizen 2.3
661  * @param[in] profile  The profile handle
662  * @param[out] type  The type of Wi-Fi security
663  * @return @c 0 on success, otherwise a negative error value
664  * @retval #CONNECTION_ERROR_NONE  Successful
665  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
666  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
667  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
668 */
669 int connection_profile_get_wifi_encryption_type(connection_profile_h profile, connection_wifi_encryption_type_e* type);
670
671 /**
672  * @brief Checks whether passphrase is required.
673  * @since_tizen 2.3
674  * @remarks This function is not valid if security type is #CONNECTION_WIFI_SECURITY_TYPE_EAP.
675  * @param[in] profile  The profile handle
676  * @param[out] required  @c true if a passphrase is required, otherwise @c false if a passphrase is not required.
677  * @return @c 0 on success, otherwise a negative error value
678  * @retval #CONNECTION_ERROR_NONE  Successful
679  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
680  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
681 */
682 int connection_profile_is_wifi_passphrase_required(connection_profile_h profile, bool* required);
683
684 /**
685  * @brief Sets the passphrase of the Wi-Fi WPA.
686  * @since_tizen 2.3
687  * @param[in] profile  The profile handle
688  * @param[in] passphrase  The passphrase of Wi-Fi security
689  * @return @c 0 on success, otherwise a negative error value
690  * @retval #CONNECTION_ERROR_NONE  Successful
691  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
692  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
693  * @see connection_update_profile()
694 */
695 int connection_profile_set_wifi_passphrase(connection_profile_h profile, const char* passphrase);
696
697 /**
698  * @brief Checks whether the WPS (Wi-Fi Protected Setup) is supported.
699  * @since_tizen 2.3
700  * @remarks If WPS is supported, you can connect the access point with WPS by wifi_connect_with_wps().
701  * @param[in] profile  The profile handle
702  * @param[out] supported  @c true if WPS is supported, otherwise @c false if WPS is not supported.
703  * @return @c 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_NOT_SUPPORTED      Not supported
707 */
708 int connection_profile_is_wifi_wps_supported(connection_profile_h profile, bool* supported);
709
710 /**
711 * @}
712 */
713
714
715 /**
716 * @addtogroup CAPI_NETWORK_CONNECTION_CELLULAR_PROFILE_MODULE
717 * @{
718 */
719
720 /**
721 * @brief Gets the cellular network type.
722 * @param[in] profile  The handle of profile
723 * @param[out] type  The type of cellular
724 * @return 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_OPERATION_FAILED  Operation failed
728 */
729 int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type);
730
731 /**
732  * @brief Gets the service type.
733  * @since_tizen 2.3
734  * @param[in] profile  The profile handle
735  * @param[out] type  The type of the cellular service
736  * @return @c 0 on success, otherwise a negative error value
737  * @retval #CONNECTION_ERROR_NONE  Successful
738  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
739  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
740  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
741 */
742 int connection_profile_get_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e* type);
743
744 /**
745  * @brief Gets the APN (access point name).
746  * @since_tizen 2.3
747  * @remarks You must release @a apn using free().
748  * @param[in] profile  The profile handle
749  * @param[out] apn  The name of the APN
750  * @return @c 0 on success, otherwise a negative error value
751  * @retval #CONNECTION_ERROR_NONE  Successful
752  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
753  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
754  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
755 */
756 int connection_profile_get_cellular_apn(connection_profile_h profile, char** apn);
757
758 /**
759  * @brief Gets the authentication information.
760  * @since_tizen 2.3
761  * @remarks You must release @a user_name and @a password using free().
762  * @param[in] profile  The profile handle
763  * @param[out] type  The type of the authentication
764  * @param[out] user_name  The user name
765  * @param[out] password  The password
766  * @return @c 0 on success, otherwise a negative error value
767  * @retval #CONNECTION_ERROR_NONE  Successful
768  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
769  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
770  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
771  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
772 */
773 int connection_profile_get_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e* type, char** user_name, char** password);
774
775 /**
776  * @brief Gets the home URL.
777  * @since_tizen 2.3
778  * @remarks You must release @a home_url using free().
779  * @param[in] profile  The profile handle
780  * @param[out] home_url  The home URL
781  * @return @c 0 on success, otherwise a negative error value
782  * @retval #CONNECTION_ERROR_NONE  Successful
783  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
784  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
785  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
786 */
787 int connection_profile_get_cellular_home_url(connection_profile_h profile, char** home_url);
788
789 /**
790  * @brief Checks wheter the connection is in roaming state.
791  * @since_tizen 2.3
792  * @param[in] profile  The profile handle
793  * @param[out] is_roaming  @c true if the cellular is roaming, otherwise @c false if it is not roaming.
794  * @return @c 0 on success, otherwise a negative error value
795  * @retval #CONNECTION_ERROR_NONE  Successful
796  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
797  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
798 */
799 int connection_profile_is_cellular_roaming(connection_profile_h profile, bool* is_roaming);
800
801 /**
802  * @brief Checks whether the profile is hidden.
803  * @since_tizen 2.3
804  * @param[in] profile  The profile handle
805  * @param[out] is_hidden @c ture if the profile is in hidden, otherwise @c false if the profile is not hidden.
806  * @return @c 0 on success, otherwise a negative error value
807  * @retval #CONNECTION_ERROR_NONE  Successful
808  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
809  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
810 */
811 int connection_profile_is_cellular_hidden(connection_profile_h profile, bool* is_hidden);
812
813 /**
814  * @brief Checks whether the profile is editable.
815  * @since_tizen 2.3
816  * @param[in] profile  The profile handle
817  * @param[out] is_editable  @c true if the profile is editable, otherwise @c false if the profile is not editable.
818  * @return @c 0 on success, otherwise a negative error value
819  * @retval #CONNECTION_ERROR_NONE  Successful
820  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
821  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
822 */
823 int connection_profile_is_cellular_editable(connection_profile_h profile, bool* is_editable);
824
825 /**
826  * @brief Checks whether the profile is default.
827  * @since_tizen 2.3
828  * @param[in] profile  The profile handle
829  * @param[out] is_default  @c true if the profile is default, otherwise @c false if the profile is not default.
830  * @return @c 0 on success, otherwise a negative error value
831  * @retval #CONNECTION_ERROR_NONE  Successful
832  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
833  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
834 */
835 int connection_profile_is_cellular_default(connection_profile_h profile, bool* is_default);
836
837 /**
838  * @brief Sets the service type.
839  * @since_tizen 2.3
840  * @param[in] profile  The profile handle
841  * @param[in] service_type  The type of cellular service
842  * @return @c 0 on success, otherwise a negative error value
843  * @retval #CONNECTION_ERROR_NONE  Successful
844  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
845  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
846  * @see connection_update_profile()
847 */
848 int connection_profile_set_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e service_type);
849
850 /**
851  * @brief Sets the APN (Access Point Name).
852  * @since_tizen 2.3
853  * @param[in] profile  The profile handle
854  * @param[in] apn  The name of APN
855  * @return @c 0 on success, otherwise a negative error value
856  * @retval #CONNECTION_ERROR_NONE  Successful
857  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
858  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
859  * @see connection_update_profile()
860 */
861 int connection_profile_set_cellular_apn(connection_profile_h profile, const char* apn);
862
863 /**
864  * @brief Sets the Authentication information.
865  * @since_tizen 2.3
866  * @param[in] profile  The profile handle
867  * @param[in] type  The type of the authentication
868  * @param[in] user_name  The user name
869  * @param[in] password  The password
870  * @return @c 0 on success, otherwise a negative error value
871  * @retval #CONNECTION_ERROR_NONE  Successful
872  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
873  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
874  * @see connection_update_profile()
875 */
876 int connection_profile_set_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e type, const char* user_name, const char* password);
877
878 /**
879  * @brief Sets the home URL.
880  * @since_tizen 2.3
881  * @param[in] profile  The profile handle
882  * @param[in] home_url  The home URL
883  * @return @c 0 on success, otherwise a negative error value
884  * @retval #CONNECTION_ERROR_NONE  Successful
885  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
886  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
887  * @see connection_update_profile()
888 */
889 int connection_profile_set_cellular_home_url(connection_profile_h profile, const char* home_url);
890
891 /**
892 * @}
893 */
894
895
896 #ifdef __cplusplus
897 }
898
899 #endif
900
901 #endif /* __TIZEN_NETWORK_CONNECTION_PROFILE_H__ */