Merge "Add "connection_test" app in Tizen Image binary" into tizen
[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.get
187  * @remarks You must release @a profile using connection_profile_destroy().
188  * @param[in] type  The type of profile\n
189  *               #CONNECTION_PROFILE_TYPE_CELLULAR and #CONNECTION_PROFILE_TYPE_WIFI are supported.
190  * @param[in] keyword  The keyword included in profile name
191  * @param[out] profile  The handle of the profile
192  * @return @c 0 on success, otherwise negative error value
193  * @retval #CONNECTION_ERROR_NONE  Successful
194  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
195  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
196  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
197  * @see connection_profile_destroy()
198  * @see connection_profile_get_name()
199 */
200 int connection_profile_create(connection_profile_type_e type, const char* keyword, connection_profile_h* profile);
201
202 /**
203  * @brief Destroys a profile handle.
204  * @since_tizen 2.3
205  * @param[out] profile  The handle to the profile
206  * @return @c 0 on success, otherwise a negative error value
207  * @retval #CONNECTION_ERROR_NONE  Successful
208  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
209  * @see connection_profile_create()
210 */
211 int connection_profile_destroy(connection_profile_h profile);
212
213 /**
214  * @brief Clones a profile handle.
215  * @since_tizen 2.3
216  * @remarks You must release @a cloned_profile using connection_profile_destroy().
217  * @param[out] cloned_profile  The handle of the cloned profile
218  * @param[in] origin_profile  The handle of the origin profile
219  * @return @c 0 on success, otherwise a negative error value
220  * @retval #CONNECTION_ERROR_NONE  Successful
221  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
222  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
223  * @see connection_profile_destroy()
224 */
225 int connection_profile_clone(connection_profile_h* cloned_profile, connection_profile_h origin_profile);
226
227 /**
228  * @brief Gets the profile ID.
229  * @details The separate profiles can have the same name.
230  * So, you must use this API instead of connection_profile_get_name() if you want to get the unique identification.
231  * In case you create a profile, this value will be determined when you add the profile.
232  *
233  * @since_tizen 2.3
234  * @remarks You must release @a profile_id using free().
235  * @param[in] profile  The profile handle
236  * @param[out] profile_id  The ID of the profile
237  * @return @c 0 on success, otherwise a negative error value
238  * @retval #CONNECTION_ERROR_NONE  Successful
239  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
240  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
241  * @see connection_profile_get_name()
242  * @see connection_add_profile()
243 */
244 int connection_profile_get_id(connection_profile_h profile, char** profile_id);
245
246 /**
247  * @brief Gets the profile name.
248  * @since_tizen 2.3
249  * @remarks You must release @a profile_name using free().
250  * @param[in] profile  The profile handle
251  * @param[out] profile_name  The name of the profile
252  * @return @c 0 on success, otherwise a negative error value
253  * @retval #CONNECTION_ERROR_NONE  Successful
254  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
255  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
256  * @see connection_profile_get_id()
257 */
258 int connection_profile_get_name(connection_profile_h profile, char** profile_name);
259
260 /**
261  * @brief Gets the network type.
262  * @since_tizen 2.3
263  * @param[in] profile  The profile handle
264  * @param[out] type  The type of the profile
265  * @return @c 0 on success, otherwise a negative error value
266  * @retval #CONNECTION_ERROR_NONE  Successful
267  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
268  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
269 */
270 int connection_profile_get_type(connection_profile_h profile, connection_profile_type_e* type);
271
272 /**
273  * @brief Gets the name of the network interface, e.g. eth0 and pdp0.
274  * @since_tizen 2.3
275  * @remarks You must release @a interface_name using free().
276  * @param[in] profile  The profile handle
277  * @param[out] interface_name  The name of the network interface
278  * @return @c 0 on success, otherwise a negative error value
279  * @retval #CONNECTION_ERROR_NONE  Successful
280  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
281  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
282 */
283 int connection_profile_get_network_interface_name(connection_profile_h profile, char** interface_name);
284
285 /**
286  * @brief Refreshes the profile information.
287  * @since_tizen 2.3
288  * @privlevel public
289  * @privilege %http://tizen.org/privilege/network.get
290  * @remarks You should call this function in order to get the current information because the profile information can be changed.
291  * @param[in] profile  The profile handle
292  * @return @c 0 on success, otherwise a negative error value
293  * @retval #CONNECTION_ERROR_NONE  Successful
294  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
295  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
296  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
297  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
298 */
299 int connection_profile_refresh(connection_profile_h profile);
300
301 /**
302  * @brief Gets the network type.
303  * @since_tizen 2.3
304  * @param[in] profile  The profile handle
305  * @param[out] state  The state of the profile
306  * @return @c 0 on success, otherwise a negative error value
307  * @retval #CONNECTION_ERROR_NONE  Successful
308  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
309  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
310 */
311 int connection_profile_get_state(connection_profile_h profile, connection_profile_state_e* state);
312
313 /**
314  * @brief Gets the IP config type.
315  * @since_tizen 2.3
316  * @param[in] profile  The profile handle
317  * @param[in] address_family  The address family
318  * @param[out] type  The type of the IP config
319  * @return @c 0 on success, otherwise a negative error value
320  * @retval #CONNECTION_ERROR_NONE  Successful
321  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
322  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
323 */
324 int connection_profile_get_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e* type);
325
326 /**
327  * @brief Gets the IP address.
328  * @since_tizen 2.3
329  * @remarks You must release @a ip_address using free().
330  * @param[in] profile  The profile handle
331  * @param[in] address_family  The address family
332  * @param[out] ip_address  The IP address
333  * @return @c 0 on success, otherwise a negative error value
334  * @retval #CONNECTION_ERROR_NONE  Successful
335  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
336  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
337  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
338  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
339 */
340 int connection_profile_get_ip_address(connection_profile_h profile, connection_address_family_e address_family, char** ip_address);
341
342 /**
343  * @brief Gets the Subnet Mask.
344  * @since_tizen 2.3
345  * @remarks You must release @a subnet_mask using free().
346  * @param[in] profile  The profile handle
347  * @param[in] address_family  The address family
348  * @param[out] subnet_mask  The subnet mask
349  * @return @c 0 on success, otherwise a negative error value
350  * @retval #CONNECTION_ERROR_NONE  Successful
351  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
352  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
353  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
354  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
355 */
356 int connection_profile_get_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, char** subnet_mask);
357
358 /**
359  * @brief Gets the Gateway address.
360  * @since_tizen 2.3
361  * @remarks You must release @a gateway_address using free().
362  * @param[in] profile  The profile handle
363  * @param[in] address_family  The address family
364  * @param[out] gateway_address  The gateway address
365  * @return @c 0 on success, otherwise a negative error value
366  * @retval #CONNECTION_ERROR_NONE  Successful
367  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
368  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
369  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
370  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
371 */
372 int connection_profile_get_gateway_address(connection_profile_h profile, connection_address_family_e address_family, char** gateway_address);
373
374 /**
375  * @brief Gets the DNS address.
376  * @since_tizen 2.3
377  * @remarks The allowance of the DNS address is @c 2. You must release @a dns_address using free().
378  * @param[in] profile  The profile handle
379  * @param[in] order  The order of DNS address \n
380  *              it starts from 1, which means first DNS address.
381  * @param[in] address_family  The address family
382  * @param[out] dns_address  The DNS address
383  * @return @c 0 on success, otherwise a negative error value
384  * @retval #CONNECTION_ERROR_NONE  Successful
385  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
386  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
387  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
388  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
389 */
390 int connection_profile_get_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, char** dns_address);
391
392 /**
393  * @brief Gets the Proxy type.
394  * @since_tizen 2.3
395  * @param[in] profile  The profile handle
396  * @param[out] type  The type of the proxy
397  * @return @c 0 on success, otherwise a negative error value
398  * @retval #CONNECTION_ERROR_NONE  Successful
399  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
400  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
401 */
402 int connection_profile_get_proxy_type(connection_profile_h profile, connection_proxy_type_e* type);
403
404 /**
405  * @brief Gets the Proxy address.
406  * @since_tizen 2.3
407  * @remarks You must release @a proxy_address using free().
408  * @param[in] profile  The profile handle
409  * @param[in] address_family  The address family
410  * @param[out] proxy_address  The proxy address
411  * @return @c 0 on success, otherwise a negative error value
412  * @retval #CONNECTION_ERROR_NONE  Successful
413  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
414  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
415  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
416  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
417 */
418 int connection_profile_get_proxy_address(connection_profile_h profile, connection_address_family_e address_family, char** proxy_address);
419
420 /**
421  * @brief Sets the IP config type.
422  * @details If you set IP config type to #CONNECTION_IP_CONFIG_TYPE_STATIC,
423  * then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0".
424  * @since_tizen 2.3
425  * @param[in] profile  The profile handle
426  * @param[in] address_family  The address family
427  * @param[in] type  The type of the IP config
428  * @return @c 0 on success, otherwise a negative error value
429  * @retval #CONNECTION_ERROR_NONE  Successful
430  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
431  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
432 */
433 int connection_profile_set_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e type);
434
435 /**
436  * @brief Sets the IP address.
437  * @since_tizen 2.3
438  * @param[in] profile  The profile handle
439  * @param[in] address_family  The address family
440  * @param[in] ip_address  The IP address.\n
441  *                      If you set this value to @c NULL, then the existing value will be deleted.
442  * @return @c 0 on success, otherwise a negative error value
443  * @retval #CONNECTION_ERROR_NONE  Successful
444  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
445  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
446  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
447  * @see connection_update_profile()
448 */
449 int connection_profile_set_ip_address(connection_profile_h profile, connection_address_family_e address_family, const char* ip_address);
450
451 /**
452  * @brief Sets the Subnet Mask.
453  * @since_tizen 2.3
454  * @param[in] profile  The profile handle
455  * @param[in] address_family  The address family
456  * @param[in] subnet_mask  The subnet mask. \n
457  *                      If you set this value to @c NULL, then the existing value will be deleted.
458  * @return @c 0 on success, otherwise a negative error value
459  * @retval #CONNECTION_ERROR_NONE  Successful
460  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
461  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
462  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
463  * @see connection_update_profile()
464 */
465 int connection_profile_set_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, const char* subnet_mask);
466
467 /**
468  * @brief Sets the Gateway address.
469  * @since_tizen 2.3
470  * @param[in] profile  The profile handle
471  * @param[in] address_family  The address family
472  * @param[in] gateway_address  The gateway address. \n
473  *                      If you set this value to @c NULL, then the existing value will be deleted.
474  * @return @c 0 on success, otherwise a negative error value
475  * @retval #CONNECTION_ERROR_NONE  Successful
476  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
477  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
478  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
479  * @see connection_update_profile()
480 */
481 int connection_profile_set_gateway_address(connection_profile_h profile, connection_address_family_e address_family, const char* gateway_address);
482
483 /**
484  * @brief Sets the DNS address.
485  * @since_tizen 2.3
486  * @remarks The allowance of the DNS address is @c 2.
487  * @param[in] profile  The profile handle
488  * @param[in] order  The order of the DNS address. \n
489  *              It starts from @c 1, which means first DNS address.
490  * @param[in] address_family  The address family
491  * @param[in] dns_address  The DNS address; if you set this value to NULL, then the existing value will be deleted
492  * @return @c 0 on success, otherwise a negative error value
493  * @retval #CONNECTION_ERROR_NONE  Successful
494  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
495  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
496  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
497  * @see connection_update_profile()
498 */
499 int connection_profile_set_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, const char* dns_address);
500
501 /**
502  * @brief Sets the Proxy type.
503  * @details If you set the Proxy type to #CONNECTION_PROXY_TYPE_AUTO or #CONNECTION_PROXY_TYPE_MANUAL, then Proxy will be restored.
504  * @since_tizen 2.3
505  * @param[in] profile  The profile handle
506  * @param[in] type  The type of the proxy
507  * @return @c 0 on success, otherwise a negative error value
508  * @retval #CONNECTION_ERROR_NONE  Successful
509  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
510  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
511  * @see connection_update_profile()
512 */
513 int connection_profile_set_proxy_type(connection_profile_h profile, connection_proxy_type_e type);
514
515 /**
516  * @brief Sets the Proxy address.
517  * @since_tizen 2.3
518  * @param[in] profile  The profile handle
519  * @param[in] address_family  The address family
520  * @param[in] proxy_address  The proxy address. \n
521  *                      if you set this value to @c NULL, then the existing value will be deleted.
522  * @return @c 0 on success, otherwise a negative error value
523  * @retval #CONNECTION_ERROR_NONE  Successful
524  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
525  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Not supported address family
526  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
527  * @see connection_update_profile()
528 */
529 int connection_profile_set_proxy_address(connection_profile_h profile, connection_address_family_e address_family, const char* proxy_address);
530
531 /**
532  * @brief Called when the state of the profile is changed.
533  * @since_tizen 2.3
534  * @param[in] state  The state
535  * @param[in] user_data The user data passed from the callback registration function
536  * @see connection_profile_set_state_changed_cb()
537  * @see connection_profile_unset_state_changed_cb()
538 */
539 typedef void(*connection_profile_state_changed_cb)(connection_profile_state_e state, void* user_data);
540
541 /**
542  * @brief Registers the callback that is called when the state of profile is changed.
543  * @since_tizen 2.3
544  * @param[in] profile  The profile handle
545  * @param[in] callback  The callback function to be called
546  * @param[in] user_data The user data passed to the callback function
547  * @return @c 0 on success, otherwise a negative error value
548  * @retval #CONNECTION_ERROR_NONE  Successful
549  * @retval #CONNECTION_ERROR_INVALID_PARAMETER   Invalid parameter
550  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
551  * @post connection_opened_cb() is invoked when the state of profile is changed.
552  * @see connection_profile_state_changed_cb()
553  * @see connection_profile_unset_state_changed_cb()
554 */
555 int connection_profile_set_state_changed_cb(connection_profile_h profile, connection_profile_state_changed_cb callback, void* user_data);
556
557 /**
558  * @brief Unregisters the callback that is called when the state of profile is changed.
559  * @since_tizen 2.3
560  * @param[in] profile  The profile handle
561  * @return @c 0 on success, otherwise a negative error value
562  * @retval #CONNECTION_ERROR_NONE  Successful
563  * @retval #CONNECTION_ERROR_INVALID_PARAMETER   Invalid parameter
564  * @see connection_profile_state_changed_cb()
565  * @see connection_profile_set_state_changed_cb()
566 */
567 int connection_profile_unset_state_changed_cb(connection_profile_h profile);
568
569 /**
570 * @}
571 */
572
573
574 /**
575 * @addtogroup CAPI_NETWORK_CONNECTION_WIFI_PROFILE_MODULE
576 * @{
577 */
578
579 /**
580  * @brief Gets the ESSID (Extended Service Set Identifier).
581  * @since_tizen 2.3
582  * @remarks You must release @a essid using free().
583  * @param[in] profile  The profile handle
584  * @param[out] essid  The ESSID
585  * @return @c 0 on success, otherwise a negative error value
586  * @retval #CONNECTION_ERROR_NONE  Successful
587  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
588  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
589  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
590 */
591 int connection_profile_get_wifi_essid(connection_profile_h profile, char** essid);
592
593 /**
594  * @brief Gets the BSSID (Basic Service Set Identifier).
595  * @since_tizen 2.3
596  * @remarks You must release @a bssid using free().
597  * @param[in] profile  The profile handle
598  * @param[out] bssid  The BSSID
599  * @return @c 0 on success, otherwise a negative error value
600  * @retval #CONNECTION_ERROR_NONE  Successful
601  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
602  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
603  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
604 */
605 int connection_profile_get_wifi_bssid(connection_profile_h profile, char** bssid);
606
607 /**
608  * @brief Gets the RSSI.
609  * @since_tizen 2.3
610  * @param[in] profile  The profile handle
611  * @param[out] rssi  The RSSI
612  * @return @c 0 on success, otherwise a negative error value
613  * @retval #CONNECTION_ERROR_NONE  Successful
614  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
615  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
616 */
617 int connection_profile_get_wifi_rssi(connection_profile_h profile, int* rssi);
618
619 /**
620  * @brief Gets the frequency (MHz).
621  * @since_tizen 2.3
622  * @param[in] profile  The profile handle
623  * @param[out] frequency  The frequency
624  * @return @c 0 on success, otherwise a negative error value
625  * @retval #CONNECTION_ERROR_NONE  Successful
626  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
627  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
628 */
629 int connection_profile_get_wifi_frequency(connection_profile_h profile, int* frequency);
630
631 /**
632  * @brief Gets the max speed (Mbps).
633  * @since_tizen 2.3
634  * @param[in] profile  The profile handle
635  * @param[out] max_speed  The max speed
636  * @return @c 0 on success, otherwise a negative error value
637  * @retval #CONNECTION_ERROR_NONE  Successful
638  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
639  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
640 */
641 int connection_profile_get_wifi_max_speed(connection_profile_h profile, int* max_speed);
642
643 /**
644  * @brief Gets the security mode of Wi-Fi.
645  * @since_tizen 2.3
646  * @param[in] profile  The profile handle
647  * @param[out] type  The type of Wi-Fi security
648  * @return @c 0 on success, otherwise a negative error value
649  * @retval #CONNECTION_ERROR_NONE  Successful
650  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
651  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
652  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
653 */
654 int connection_profile_get_wifi_security_type(connection_profile_h profile, connection_wifi_security_type_e* type);
655
656 /**
657  * @brief Gets the security mode of Wi-Fi.
658  * @since_tizen 2.3
659  * @param[in] profile  The profile handle
660  * @param[out] type  The type of Wi-Fi security
661  * @return @c 0 on success, otherwise a negative error value
662  * @retval #CONNECTION_ERROR_NONE  Successful
663  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
664  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
665  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
666 */
667 int connection_profile_get_wifi_encryption_type(connection_profile_h profile, connection_wifi_encryption_type_e* type);
668
669 /**
670  * @brief Checks whether passphrase is required.
671  * @since_tizen 2.3
672  * @remarks This function is not valid if security type is #CONNECTION_WIFI_SECURITY_TYPE_EAP.
673  * @param[in] profile  The profile handle
674  * @param[out] required  @c true if a passphrase is required, otherwise @c false if a passphrase is not required.
675  * @return @c 0 on success, otherwise a negative error value
676  * @retval #CONNECTION_ERROR_NONE  Successful
677  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
678  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
679 */
680 int connection_profile_is_wifi_passphrase_required(connection_profile_h profile, bool* required);
681
682 /**
683  * @brief Sets the passphrase of the Wi-Fi WPA.
684  * @since_tizen 2.3
685  * @param[in] profile  The profile handle
686  * @param[in] passphrase  The passphrase of Wi-Fi security
687  * @return @c 0 on success, otherwise a negative error value
688  * @retval #CONNECTION_ERROR_NONE  Successful
689  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
690  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
691  * @see connection_update_profile()
692 */
693 int connection_profile_set_wifi_passphrase(connection_profile_h profile, const char* passphrase);
694
695 /**
696  * @brief Checks whether the WPS (Wi-Fi Protected Setup) is supported.
697  * @since_tizen 2.3
698  * @remarks If WPS is supported, you can connect the access point with WPS by wifi_connect_with_wps().
699  * @param[in] profile  The profile handle
700  * @param[out] supported  @c true if WPS is supported, otherwise @c false if WPS is not supported.
701  * @return @c 0 on success, otherwise negative error value
702  * @retval #CONNECTION_ERROR_NONE  Successful
703  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
704  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
705 */
706 int connection_profile_is_wifi_wps_supported(connection_profile_h profile, bool* supported);
707
708 /**
709 * @}
710 */
711
712
713 /**
714 * @addtogroup CAPI_NETWORK_CONNECTION_CELLULAR_PROFILE_MODULE
715 * @{
716 */
717
718 /**
719 * @brief Gets the cellular network type.
720 * @param[in] profile  The handle of profile
721 * @param[out] type  The type of cellular
722 * @return 0 on success, otherwise negative error value.
723 * @retval #CONNECTION_ERROR_NONE  Successful
724 * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
725 * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
726 */
727 int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type);
728
729 /**
730  * @brief Gets the service type.
731  * @since_tizen 2.3
732  * @param[in] profile  The profile handle
733  * @param[out] type  The type of the cellular service
734  * @return @c 0 on success, otherwise a negative error value
735  * @retval #CONNECTION_ERROR_NONE  Successful
736  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
737  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
738  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
739 */
740 int connection_profile_get_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e* type);
741
742 /**
743  * @brief Gets the APN (access point name).
744  * @since_tizen 2.3
745  * @remarks You must release @a apn using free().
746  * @param[in] profile  The profile handle
747  * @param[out] apn  The name of the APN
748  * @return @c 0 on success, otherwise a negative error value
749  * @retval #CONNECTION_ERROR_NONE  Successful
750  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
751  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
752  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
753 */
754 int connection_profile_get_cellular_apn(connection_profile_h profile, char** apn);
755
756 /**
757  * @brief Gets the authentication information.
758  * @since_tizen 2.3
759  * @remarks You must release @a user_name and @a password using free().
760  * @param[in] profile  The profile handle
761  * @param[out] type  The type of the authentication
762  * @param[out] user_name  The user name
763  * @param[out] password  The password
764  * @return @c 0 on success, otherwise a negative error value
765  * @retval #CONNECTION_ERROR_NONE  Successful
766  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
767  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
768  * @retval #CONNECTION_ERROR_OPERATION_FAILED  Operation failed
769  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
770 */
771 int connection_profile_get_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e* type, char** user_name, char** password);
772
773 /**
774  * @brief Gets the home URL.
775  * @since_tizen 2.3
776  * @remarks You must release @a home_url using free().
777  * @param[in] profile  The profile handle
778  * @param[out] home_url  The home URL
779  * @return @c 0 on success, otherwise a negative error value
780  * @retval #CONNECTION_ERROR_NONE  Successful
781  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
782  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY  Out of memory
783  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
784 */
785 int connection_profile_get_cellular_home_url(connection_profile_h profile, char** home_url);
786
787 /**
788  * @brief Checks wheter the connection is in roaming state.
789  * @since_tizen 2.3
790  * @param[in] profile  The profile handle
791  * @param[out] is_roaming  @c true if the cellular is roaming, otherwise @c false if it is not roaming.
792  * @return @c 0 on success, otherwise a negative error value
793  * @retval #CONNECTION_ERROR_NONE  Successful
794  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
795  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
796 */
797 int connection_profile_is_cellular_roaming(connection_profile_h profile, bool* is_roaming);
798
799 /**
800  * @brief Checks whether the profile is hidden.
801  * @since_tizen 2.3
802  * @param[in] profile  The profile handle
803  * @param[out] is_hidden @c ture if the profile is in hidden, otherwise @c false if the profile is not hidden.
804  * @return @c 0 on success, otherwise a negative error value
805  * @retval #CONNECTION_ERROR_NONE  Successful
806  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
807  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
808 */
809 int connection_profile_is_cellular_hidden(connection_profile_h profile, bool* is_hidden);
810
811 /**
812  * @brief Checks whether the profile is editable.
813  * @since_tizen 2.3
814  * @param[in] profile  The profile handle
815  * @param[out] is_editable  @c true if the profile is editable, otherwise @c false if the profile is not editable.
816  * @return @c 0 on success, otherwise a negative error value
817  * @retval #CONNECTION_ERROR_NONE  Successful
818  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
819  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
820 */
821 int connection_profile_is_cellular_editable(connection_profile_h profile, bool* is_editable);
822
823 /**
824  * @brief Checks whether the profile is default.
825  * @since_tizen 2.3
826  * @param[in] profile  The profile handle
827  * @param[out] is_default  @c true if the profile is default, otherwise @c false if the profile is not default.
828  * @return @c 0 on success, otherwise a negative error value
829  * @retval #CONNECTION_ERROR_NONE  Successful
830  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
831  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
832 */
833 int connection_profile_is_cellular_default(connection_profile_h profile, bool* is_default);
834
835 /**
836  * @brief Sets the service type.
837  * @since_tizen 2.3
838  * @param[in] profile  The profile handle
839  * @param[in] service_type  The type of cellular service
840  * @return @c 0 on success, otherwise a negative error value
841  * @retval #CONNECTION_ERROR_NONE  Successful
842  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
843  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
844  * @see connection_update_profile()
845 */
846 int connection_profile_set_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e service_type);
847
848 /**
849  * @brief Sets the APN (Access Point Name).
850  * @since_tizen 2.3
851  * @param[in] profile  The profile handle
852  * @param[in] apn  The name of APN
853  * @return @c 0 on success, otherwise a negative error value
854  * @retval #CONNECTION_ERROR_NONE  Successful
855  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
856  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
857  * @see connection_update_profile()
858 */
859 int connection_profile_set_cellular_apn(connection_profile_h profile, const char* apn);
860
861 /**
862  * @brief Sets the Authentication information.
863  * @since_tizen 2.3
864  * @param[in] profile  The profile handle
865  * @param[in] type  The type of the authentication
866  * @param[in] user_name  The user name
867  * @param[in] password  The password
868  * @return @c 0 on success, otherwise a negative error value
869  * @retval #CONNECTION_ERROR_NONE  Successful
870  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
871  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
872  * @see connection_update_profile()
873 */
874 int connection_profile_set_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e type, const char* user_name, const char* password);
875
876 /**
877  * @brief Sets the home URL.
878  * @since_tizen 2.3
879  * @param[in] profile  The profile handle
880  * @param[in] home_url  The home URL
881  * @return @c 0 on success, otherwise a negative error value
882  * @retval #CONNECTION_ERROR_NONE  Successful
883  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
884  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
885  * @see connection_update_profile()
886 */
887 int connection_profile_set_cellular_home_url(connection_profile_h profile, const char* home_url);
888
889 /**
890 * @}
891 */
892
893
894 #ifdef __cplusplus
895 }
896
897 #endif
898
899 #endif /* __TIZEN_NETWORK_CONNECTION_PROFILE_H__ */