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