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