merge with master
[platform/core/api/wifi.git] / include / wifi.h
1 /*
2 * Copyright (c) 2012-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_WIFI_H__
18 #define __TIZEN_NETWORK_WIFI_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27 * @addtogroup CAPI_NETWORK_WIFI_MANAGER_MODULE
28 * @{
29 */
30
31 /**
32 * @brief The Wi-Fi error type
33 */
34 typedef enum
35 {
36     WIFI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
37     WIFI_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
38     WIFI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
39     WIFI_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
40     WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
41     WIFI_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0301, /**< Operation failed */
42     WIFI_ERROR_NO_CONNECTION = TIZEN_ERROR_NETWORK_CLASS|0x0302, /**< There is no connected AP */
43     WIFI_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
44     WIFI_ERROR_ALREADY_EXISTS = TIZEN_ERROR_NETWORK_CLASS|0x0303, /**< Already exists */
45     WIFI_ERROR_OPERATION_ABORTED = TIZEN_ERROR_NETWORK_CLASS|0x0304, /**< Operation is aborted */
46     WIFI_ERROR_DHCP_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0306, /**< DHCP failed */
47     WIFI_ERROR_INVALID_KEY = TIZEN_ERROR_NETWORK_CLASS|0x0307, /**< Invalid key */
48     WIFI_ERROR_NO_REPLY = TIZEN_ERROR_NETWORK_CLASS|0x0308, /**< No reply */
49     WIFI_ERROR_SECURITY_RESTRICTED = TIZEN_ERROR_NETWORK_CLASS|0x0309, /**< Restricted by security system policy */
50 } wifi_error_e;
51
52 /**
53 * @}
54 */
55
56
57 /**
58 * @addtogroup CAPI_NETWORK_WIFI_MONITOR_MODULE
59 * @{
60 */
61
62 /**
63 * @brief The state of Wi-Fi device
64 */
65 typedef enum
66 {
67     WIFI_DEVICE_STATE_DEACTIVATED = 0,  /**< Wi-Fi is Deactivated */
68     WIFI_DEVICE_STATE_ACTIVATED = 1,  /**< Wi-Fi is activated */
69 } wifi_device_state_e;
70
71 /**
72 * @brief The state of Wi-Fi connection
73 */
74 typedef enum
75 {
76     WIFI_CONNECTION_STATE_DISCONNECTED = 0,  /**< Disconnected state */
77     WIFI_CONNECTION_STATE_ASSOCIATION = 1,  /**< Association state */
78     WIFI_CONNECTION_STATE_CONFIGURATION = 2,  /**< Configuration state */
79     WIFI_CONNECTION_STATE_CONNECTED = 3,  /**< Connected state */
80 } wifi_connection_state_e;
81
82 /**
83 * @brief The RSSI level
84 */
85 typedef enum
86 {
87     WIFI_RSSI_LEVEL_0 = 0,  /**< level 0 */
88     WIFI_RSSI_LEVEL_1 = 1,  /**< level 1 */
89     WIFI_RSSI_LEVEL_2 = 2,  /**< level 2 */
90     WIFI_RSSI_LEVEL_3 = 3,  /**< level 3 */
91     WIFI_RSSI_LEVEL_4 = 4,  /**< level 4 */
92 } wifi_rssi_level_e;
93
94 /**
95 * @}
96 */
97
98
99 /**
100 * @addtogroup CAPI_NETWORK_WIFI_AP_NETWORK_MODULE
101 * @{
102 */
103
104 /**
105 * @brief Net IP configuration Type
106 */
107 typedef enum
108 {
109     WIFI_IP_CONFIG_TYPE_NONE = 0,  /**< Not defined */
110     WIFI_IP_CONFIG_TYPE_STATIC  = 1,  /**< Manual IP configuration */
111     WIFI_IP_CONFIG_TYPE_DYNAMIC = 2,  /**< Config IP using DHCP client*/
112     WIFI_IP_CONFIG_TYPE_AUTO = 3,  /**< Config IP from Auto IP pool (169.254/16). Later with DHCP client, if available */
113     WIFI_IP_CONFIG_TYPE_FIXED = 4,  /**< Indicates an IP address that can not be modified */
114 } wifi_ip_config_type_e;
115
116 /**
117 * @brief Address type
118 */
119 typedef enum
120 {
121     WIFI_ADDRESS_FAMILY_IPV4 = 0,  /**< IPV4 Address family */
122     WIFI_ADDRESS_FAMILY_IPV6 = 1,  /**< IPV6 Address family */
123 } wifi_address_family_e;
124
125 /**
126 * @brief This enumeration defines the proxy method type.
127 */
128 typedef enum
129 {
130     WIFI_PROXY_TYPE_DIRECT = 0, /**< Direct connection */
131     WIFI_PROXY_TYPE_AUTO = 1, /**< Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried */
132     WIFI_PROXY_TYPE_MANUAL  = 2  /**< Manual configuration */
133 } wifi_proxy_type_e;
134
135 /**
136 * @}
137 */
138
139
140 /**
141 * @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_MODULE
142 * @{
143 */
144
145 /**
146 * @brief Below security modes are used in infrastructure and ad-hoc mode
147 * For now all EAP security mechanisms are provided only in infrastructure mode
148 */
149 typedef enum
150 {
151     WIFI_SECURITY_TYPE_NONE = 0,  /**< Security disabled */
152     WIFI_SECURITY_TYPE_WEP = 1,  /**< WEP */
153     WIFI_SECURITY_TYPE_WPA_PSK = 2,  /**< WPA-PSK */
154     WIFI_SECURITY_TYPE_WPA2_PSK = 3,  /**< WPA2-PSK */
155     WIFI_SECURITY_TYPE_EAP = 4,  /**< EAP */
156 } wifi_security_type_e;
157
158 /**
159 * @brief Below encryption modes are used in infrastructure and ad-hoc mode
160 */
161 typedef enum
162 {
163     WIFI_ENCRYPTION_TYPE_NONE = 0,  /**< Encryption disabled */
164     WIFI_ENCRYPTION_TYPE_WEP = 1,  /**< WEP */
165     WIFI_ENCRYPTION_TYPE_TKIP = 2,  /**< TKIP */
166     WIFI_ENCRYPTION_TYPE_AES = 3,  /**< AES */
167     WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED = 4,  /**< TKIP and AES are both supported */
168 } wifi_encryption_type_e;
169
170 /**
171 * @}
172 */
173
174
175 /**
176 * @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_EAP_MODULE
177 * @{
178 */
179
180 /**
181 * @brief EAP type
182 */
183 typedef enum
184 {
185     WIFI_EAP_TYPE_PEAP = 0,  /**< EAP PEAP type */
186     WIFI_EAP_TYPE_TLS = 1,  /**< EAP TLS type */
187     WIFI_EAP_TYPE_TTLS = 2,  /**< EAP TTLS type */
188     WIFI_EAP_TYPE_SIM = 3,  /**< EAP SIM type */
189     WIFI_EAP_TYPE_AKA = 4,  /**< EAP AKA type */
190 } wifi_eap_type_e;
191
192 /**
193 * @brief EAP phase2 authentication type
194 */
195 typedef enum
196 {
197     WIFI_EAP_AUTH_TYPE_NONE = 0,  /**< EAP phase2 authentication none */
198     WIFI_EAP_AUTH_TYPE_PAP = 1,  /**< EAP phase2 authentication PAP */
199     WIFI_EAP_AUTH_TYPE_MSCHAP = 2,  /**< EAP phase2 authentication MSCHAP */
200     WIFI_EAP_AUTH_TYPE_MSCHAPV2 = 3,  /**< EAP phase2 authentication MSCHAPv2 */
201     WIFI_EAP_AUTH_TYPE_GTC = 4,  /**< EAP phase2 authentication GTC */
202     WIFI_EAP_AUTH_TYPE_MD5 = 5,  /**< EAP phase2 authentication MD5 */
203 } wifi_eap_auth_type_e;
204
205 /**
206 * @}
207 */
208
209
210 /**
211 * @addtogroup CAPI_NETWORK_WIFI_AP_MODULE
212 * @{
213 */
214
215 /**
216 * @brief  The handle for Wi-Fi access point.
217 */
218 typedef void* wifi_ap_h;
219
220 /**
221 * @}
222 */
223
224
225 /**
226 * @addtogroup CAPI_NETWORK_WIFI_MANAGER_MODULE
227 * @{
228 */
229
230 /**
231 * @brief Called when you get the found access point repeatedly.
232 * @remarks  @a ap is valid only in this function. In order to use the ap outside this function, you must copy the ap with wifi_ap_clone().
233 * @param[in]  ap  The access point
234 * @param[in]  user_data  The user data passed from the request function
235 * @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
236 * @pre  wifi_foreach_found_aps() and wifi_foreach_found_hidden_aps() will invoke this callback.
237 * @see  wifi_foreach_found_aps()
238 * @see  wifi_foreach_found_hidden_aps()
239 */
240 typedef bool(*wifi_found_ap_cb)(wifi_ap_h ap, void* user_data);
241
242 /**
243 * @brief Called when the scan is finished.
244 * @param[in] error_code  The error code
245 * @param[in] user_data The user data passed from the callback registration function
246 * @see wifi_scan()
247 * @see wifi_scan_hidden_ap()
248 * @see wifi_set_background_scan_cb()
249 * @see wifi_unset_background_scan_cb()
250 */
251 typedef void(*wifi_scan_finished_cb)(wifi_error_e error_code, void* user_data);
252
253 /**
254 * @brief Called after wifi_activate() is completed.
255 * @param[in] result  The result
256 * @param[in] user_data The user data passed from wifi_activate()
257 * @pre wifi_activate() will invoke this callback function.
258 * @see wifi_activate()
259 */
260 typedef void(*wifi_activated_cb)(wifi_error_e result, void* user_data);
261
262 /**
263 * @brief Called after wifi_deactivate() is completed.
264 * @param[in] result  The result
265 * @param[in] user_data The user data passed from wifi_deactivate()
266 * @pre wifi_deactivate() will invoke this callback function.
267 * @see wifi_deactivate()
268 */
269 typedef void(*wifi_deactivated_cb)(wifi_error_e result, void* user_data);
270
271 /**
272 * @brief Called after either wifi_connect() or wifi_connect_by_wps_pbc() are completed.
273 * @param[in] result  The result
274 * @param[in] user_data The user data passed from either wifi_connect() or wifi_connect_by_wps_pbc()
275 * @pre Either wifi_connect() or wifi_connect_by_wps_pbc() will invoke this callback function.
276 * @see wifi_connect()
277 * @see wifi_connect_by_wps_pbc()
278 */
279 typedef void(*wifi_connected_cb)(wifi_error_e result, void* user_data);
280
281 /**
282 * @brief Called after wifi_disconnect() is completed.
283 * @param[in] result  The result
284 * @param[in] user_data The user data passed from wifi_disconnect()
285 * @pre wifi_disconnect() will invoke this callback function.
286 * @see wifi_disconnect()
287 */
288 typedef void(*wifi_disconnected_cb)(wifi_error_e result, void* user_data);
289
290 /**
291 * @}
292 */
293
294
295 /**
296 * @addtogroup CAPI_NETWORK_WIFI_MONITOR_MODULE
297 * @{
298 */
299
300 /**
301 * @brief Called when the device state is changed.
302 * @param[in] state  The device state
303 * @param[in] user_data The user data passed from the callback registration function
304 * @see wifi_set_device_state_changed_cb()
305 * @see wifi_unset_device_state_changed_cb()
306 */
307 typedef void(*wifi_device_state_changed_cb)(wifi_device_state_e state, void* user_data);
308
309 /**
310 * @brief Called when the connection state is changed.
311 * @param[in] state  The connection state
312 * @param[in] ap  The access point
313 * @param[in] user_data The user data passed from the callback registration function
314 * @see wifi_set_connection_state_changed_cb()
315 * @see wifi_unset_connection_state_changed_cb()
316 */
317 typedef void(*wifi_connection_state_changed_cb)(wifi_connection_state_e state, wifi_ap_h ap, void* user_data);
318
319 /**
320 * @brief Called when the RSSI of connected Wi-Fi changed.
321 * @param[in] rssi_level  The level of RSSI
322 * @param[in] user_data The user data passed from the callback registration function
323 * @see wifi_set_rssi_level_changed_cb()
324 * @see wifi_unset_rssi_level_changed_cb()
325 */
326 typedef void(*wifi_rssi_level_changed_cb)(wifi_rssi_level_e rssi_level, void* user_data);
327
328 /**
329 * @}
330 */
331
332
333 /**
334 * @addtogroup CAPI_NETWORK_WIFI_MODULE
335 * @{
336 */
337
338 /**
339 * @brief Initializes Wi-Fi
340 * @return 0 on success, otherwise negative error value.
341 * @retval #WIFI_ERROR_NONE  Successful
342 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
343 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
344 */
345 int wifi_initialize(void);
346
347 /**
348 * @brief Deinitializes Wi-Fi
349 * @return 0 on success, otherwise negative error value.
350 * @retval #WIFI_ERROR_NONE  Successful
351 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
352 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
353 */
354 int wifi_deinitialize(void);
355
356 /**
357 * @}
358 */
359
360
361 /**
362 * @addtogroup CAPI_NETWORK_WIFI_MANAGER_MODULE
363 * @{
364 */
365
366 /**
367 * @brief Activates Wi-Fi, asynchronously.
368 * @param[in] callback  The callback function to be called. This can be NULL if you don't want to get the notification.
369 * @param[in] user_data The user data passed to the callback function
370 * @return 0 on success, otherwise negative error value.
371 * @retval #WIFI_ERROR_NONE  Successful
372 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
373 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
374 * @retval #WIFI_ERROR_SECURITY_RESTRICTED  Restricted by security system policy
375 * @post wifi_activated_cb() will be invoked
376 * @see wifi_activated_cb()
377 * @see wifi_deactivate()
378 */
379 int wifi_activate(wifi_activated_cb callback, void* user_data);
380
381 /**
382 * @brief Deactivates Wi-Fi, asynchronously.
383 * @param[in] callback  The callback function to be called. This can be NULL if you don't want to get the notification.
384 * @param[in] user_data The user data passed to the callback function
385 * @return 0 on success, otherwise negative error value.
386 * @retval #WIFI_ERROR_NONE  Successful
387 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
388 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
389 * @post wifi_deactivated_cb() will be invoked
390 * @see wifi_deactivated_cb()
391 * @see wifi_activate()
392 */
393 int wifi_deactivate(wifi_deactivated_cb callback, void* user_data);
394
395 /**
396 * @brief Check whether Wi-Fi is activated.
397 * @param[out] activated  Indicates whether wifi is activated or not
398 * @return 0 on success, otherwise negative error value.
399 * @retval #WIFI_ERROR_NONE  Successful
400 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
401 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
402 */
403 int wifi_is_activated(bool* activated);
404
405 /**
406 * @brief Gets the local MAC address.
407 * @remarks @a mac_address must be released with free() by you.
408 * @param[out] mac_address  The mac address
409 * @return 0 on success, otherwise negative error value.
410 * @retval #WIFI_ERROR_NONE  Successful
411 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
412 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
413 */
414 int wifi_get_mac_address(char** mac_address);
415
416 /**
417 * @brief Gets the name of network interface.
418 * @remarks @a name must be released with free() by you.
419 * @param[out] name  The name of network interface
420 * @return 0 on success, otherwise negative error value.
421 * @retval #WIFI_ERROR_NONE  Successful
422 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
423 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
424 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
425 */
426 int wifi_get_network_interface_name(char** name);
427
428 /**
429 * @brief Starts scan, asynchronously.
430 * @param[in] callback  The callback function to be called
431 * @param[in] user_data The user data passed to the callback function
432 * @return 0 on success, otherwise negative error value.
433 * @retval #WIFI_ERROR_NONE  Successful
434 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
435 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
436 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
437 * @post This function invokes wifi_scan_finished_cb().
438 */
439 int wifi_scan(wifi_scan_finished_cb callback, void* user_data);
440
441 /**
442 * @brief Starts hidden ap scan, asynchronously.
443 * @param[in] essid     The essid of hidden ap
444 * @param[in] callback  The callback function to be called
445 * @param[in] user_data The user data passed to the callback function
446 * @return 0 on success, otherwise negative error value.
447 * @retval #WIFI_ERROR_NONE  Successful
448 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
449 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
450 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
451 * @post This function invokes wifi_scan_finished_cb().
452 */
453 int wifi_scan_hidden_ap(const char* essid, wifi_scan_finished_cb callback, void* user_data);
454
455 /**
456 * @brief Gets the handle of connected access point.
457 * @remarks @a handle must be released with wifi_ap_destroy().
458 * @param[out] ap  The handle of access point
459 * @return 0 on success, otherwise negative error value.
460 * @retval #WIFI_ERROR_NONE  Successful
461 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
462 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
463 * @retval #WIFI_ERROR_NO_CONNECTION  There is no connected AP
464 */
465 int wifi_get_connected_ap(wifi_ap_h* ap);
466
467 /**
468 * @brief Gets the result of scan.
469 * @param[in] callback  The callback to be called
470 * @param[in] user_data The user data passed to the callback function
471 * @return 0 on success, otherwise negative error value.
472 * @retval #WIFI_ERROR_NONE  Successful
473 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
474 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
475 * @post This function invokes wifi_found_ap_cb().
476 */
477 int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data);
478
479 /**
480 * @brief Gets the result of hidden ap scan.
481 * @param[in] callback  The callback to be called
482 * @param[in] user_data The user data passed to the callback function
483 * @return 0 on success, otherwise negative error value.
484 * @retval #WIFI_ERROR_NONE  Successful
485 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
486 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
487 * @post This function invokes wifi_found_ap_cb().
488 */
489 int wifi_foreach_found_hidden_aps(wifi_found_ap_cb callback, void* user_data);
490
491 /**
492 * @brief Connects the access point, asynchronously.
493 * @param[in] ap  The handle of access point
494 * @param[in] callback  The callback function to be called. This can be NULL if you don't want to get the notification.
495 * @param[in] user_data The user data passed to the callback function
496 * @return 0 on success, otherwise negative error value.
497 * @retval #WIFI_ERROR_NONE  Successful
498 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
499 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
500 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
501 * @post This function invokes wifi_connected_cb().
502 * @see wifi_connected_cb()
503 * @see wifi_connect_by_wps_pbc()
504 * @see wifi_disconnect()
505 */
506 int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void* user_data);
507
508 /**
509 * @brief Disconnects the access point, asynchronously.
510 * @param[in] ap  The handle of access point
511 * @param[in] callback  The callback function to be called. This can be NULL if you don't want to get the notification.
512 * @param[in] user_data The user data passed to the callback function
513 * @return 0 on success, otherwise negative error value.
514 * @retval #WIFI_ERROR_NONE  Successful
515 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
516 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
517 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
518 * @post This function invokes wifi_disconnected_cb().
519 * @see wifi_disconnected_cb()
520 * @see wifi_connect_by_wps_pbc()
521 * @see wifi_connect()
522 */
523 int wifi_disconnect(wifi_ap_h ap, wifi_disconnected_cb callback, void* user_data);
524
525 /**
526 * @brief Connects the access point with WPS PBC, asynchronously.
527 * @param[in] ap  The handle of access point
528 * @param[in] callback  The callback function to be called. This can be NULL if you don't want to get the notification.
529 * @param[in] user_data The user data passed to the callback function
530 * @return 0 on success, otherwise negative error value.
531 * @retval #WIFI_ERROR_NONE  Successful
532 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
533 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
534 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
535 * @post This function invokes wifi_connected_cb().
536 * @see wifi_connected_cb()
537 * @see wifi_connect()
538 * @see wifi_disconnect()
539 * @see wifi_ap_is_wps_supported()
540 */
541 int wifi_connect_by_wps_pbc(wifi_ap_h ap, wifi_connected_cb callback, void* user_data);
542
543 /**
544 * @brief Deletes the information of stored access point.
545 * @details If an AP is connected, then connection information will be stored.
546 * This information is used when a connection to that AP is established automatically.
547 * @param[in] ap  The handle of access point
548 * @return 0 on success, otherwise negative error value.
549 * @retval #WIFI_ERROR_NONE  Successful
550 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
551 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
552 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
553 */
554 int wifi_forget_ap(wifi_ap_h ap);
555
556 /**
557 * @}
558 */
559
560
561 /**
562 * @addtogroup CAPI_NETWORK_WIFI_MONITOR_MODULE
563 * @{
564 */
565
566 /**
567 * @brief Gets connection state
568 * @param[out] connection_state  The connection state
569 * @return 0 on success, otherwise negative error value.
570 * @retval #WIFI_ERROR_NONE  Successful
571 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
572 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
573 */
574 int wifi_get_connection_state(wifi_connection_state_e* connection_state);
575
576 /**
577 * @brief Registers the callback called when the device state is changed.
578 * @param[in] callback  The callback function to be called
579 * @param[in] user_data The user data passed to the callback function
580 * @return 0 on success, otherwise negative error value.
581 * @retval #WIFI_ERROR_NONE  Successful
582 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
583 * @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
584 */
585 int wifi_set_device_state_changed_cb(wifi_device_state_changed_cb callback, void* user_data);
586
587 /**
588 * @brief Unregisters the callback called when the device state is changed.
589 * @return 0 on success, otherwise negative error value.
590 * @retval #WIFI_ERROR_NONE  Successful
591 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
592 */
593 int wifi_unset_device_state_changed_cb(void);
594
595 /**
596 * @brief Registers the callback called when the background scan is finished periodically.
597 * @param[in] callback  The callback function to be called
598 * @param[in] user_data The user data passed to the callback function
599 * @return 0 on success, otherwise negative error value.
600 * @retval #WIFI_ERROR_NONE  Successful
601 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
602 * @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
603 */
604 int wifi_set_background_scan_cb(wifi_scan_finished_cb callback, void* user_data);
605
606 /**
607 * @brief Unregisters the callback called when the scan is finished periodically.
608 * @return 0 on success, otherwise negative error value.
609 * @retval #WIFI_ERROR_NONE  Successful
610 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
611 */
612 int wifi_unset_background_scan_cb(void);
613
614 /**
615 * @brief Registers the callback called when the connection state is changed.
616 * @param[in] callback  The callback function to be called
617 * @param[in] user_data The user data passed to the callback function
618 * @return 0 on success, otherwise negative error value.
619 * @retval #WIFI_ERROR_NONE  Successful
620 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
621 * @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
622 */
623 int wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb callback, void* user_data);
624
625 /**
626 * @brief Unregisters the callback called when the connection state is changed.
627 * @return 0 on success, otherwise negative error value.
628 * @retval #WIFI_ERROR_NONE  Successful
629 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
630 */
631 int wifi_unset_connection_state_changed_cb(void);
632
633 /**
634 * @brief Registers callback called when the RSSI of connected Wi-Fi changed.
635 * @param[in] callback  The callback function to be called
636 * @param[in] user_data The user data passed to the callback function
637 * @return 0 on success, otherwise negative error value.
638 * @retval #WIFI_ERROR_NONE  Successful
639 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
640 * @retval #WIFI_ERROR_INVALID_PARAMETER   Invalid parameter
641 */
642 int wifi_set_rssi_level_changed_cb(wifi_rssi_level_changed_cb callback, void* user_data);
643
644 /**
645 * @brief Unregisters callback called when the RSSI of connected Wi-Fi changed.
646 * @return 0 on success, otherwise negative error value.
647 * @retval #WIFI_ERROR_NONE  Successful
648 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
649 */
650 int wifi_unset_rssi_level_changed_cb(void);
651
652 /**
653 * @}
654 */
655
656
657 /**
658 * @addtogroup CAPI_NETWORK_WIFI_AP_MODULE
659 * @{
660 */
661
662 /**
663 * @brief Creates the handle of access point.
664 * @remarks @a ap must be released with wifi_ap_destroy().
665 * @param[in] essid  The ESSID(Extended Service Set Identifier)
666 * @param[out] ap  The handle of access point
667 * @return 0 on success, otherwise negative error value.
668 * @retval #WIFI_ERROR_NONE  Successful
669 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
670 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
671 * @see wifi_ap_destroy()
672 */
673 int wifi_ap_create(const char* essid, wifi_ap_h* ap);
674
675 /**
676 * @brief Destroys the handle of access point.
677 * @param[in] ap  The handle of access point
678 * @return 0 on success, otherwise negative error value.
679 * @retval #WIFI_ERROR_NONE  Successful
680 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
681 * @see wifi_ap_create()
682 */
683 int wifi_ap_destroy(wifi_ap_h ap);
684
685 /**
686 * @brief Clons the handle of access point.
687 * @remarks @a cloned_ap must be released with wifi_ap_destroy().
688 * @param[out] cloned_ap  The handle of cloned access point
689 * @param[in] origin  The handle of origin access point
690 * @return 0 on success, otherwise negative error value.
691 * @retval #WIFI_ERROR_NONE  Successful
692 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
693 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
694 * @see wifi_ap_destroy()
695 */
696 int wifi_ap_clone(wifi_ap_h* cloned_ap, wifi_ap_h origin);
697
698 /**
699 * @brief Refresh the information of access point.
700 * @remarks You should call this function in order to get the current information because the information of access point can be changed.
701 * @param[in] ap  The handle of access point
702 * @return 0 on success, otherwise negative error value.
703 * @retval #WIFI_ERROR_NONE  Successful
704 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
705 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
706 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
707 */
708 int wifi_ap_refresh(wifi_ap_h ap);
709
710 /**
711 * @}
712 */
713
714
715 /**
716 * @addtogroup CAPI_NETWORK_WIFI_AP_NETWORK_MODULE
717 * @{
718 */
719
720 /**
721 * @brief Gets ESSID(Extended Service Set Identifier).
722 * @remarks @a essid must be released with free() by you.
723 * @param[in] ap  The handle of access point
724 * @param[out] essid  The ESSID
725 * @return 0 on success, otherwise negative error value.
726 * @retval #WIFI_ERROR_NONE  Successful
727 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
728 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
729 */
730 int wifi_ap_get_essid(wifi_ap_h ap, char** essid);
731
732 /**
733 * @brief Gets BSSID(Basic Service Set Identifier).
734 * @remarks @a bssid must be released with free() by you.
735 * @param[in] ap  The handle of access point
736 * @param[out] bssid  The BSSID
737 * @return 0 on success, otherwise negative error value.
738 * @retval #WIFI_ERROR_NONE  Successful
739 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
740 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
741 */
742 int wifi_ap_get_bssid(wifi_ap_h ap, char** bssid);
743
744 /**
745 * @brief Gets the RSSI.
746 * @param[in] ap  The handle of access point
747 * @param[out] rssi  The RSSI
748 * @return 0 on success, otherwise negative error value.
749 * @retval #WIFI_ERROR_NONE  Successful
750 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
751 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
752 */
753 int wifi_ap_get_rssi(wifi_ap_h ap, int* rssi);
754
755 /**
756 * @brief Gets the Frequency band (MHz).
757 * @param[in] ap  The handle of access point
758 * @param[out] frequency  The frequency
759 * @return 0 on success, otherwise negative error value.
760 * @retval #WIFI_ERROR_NONE  Successful
761 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
762 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
763 */
764 int wifi_ap_get_frequency(wifi_ap_h ap, int* frequency);
765
766 /**
767 * @brief Gets the max speed (Mbps).
768 * @param[in] ap  The handle of access point
769 * @param[out] max_speed  The max speed
770 * @return 0 on success, otherwise negative error value.
771 * @retval #WIFI_ERROR_NONE  Successful
772 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
773 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
774 */
775 int wifi_ap_get_max_speed(wifi_ap_h ap, int* max_speed);
776
777 /**
778 * @brief Indicates whether the access point is favorite or not.
779 * @param[in] ap  The handle of access point
780 * @param[out] favourite  Indicates whether access point is favorite or not.
781 * @return 0 on success, otherwise negative error value.
782 * @retval #WIFI_ERROR_NONE  Successful
783 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
784 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
785 */
786 int wifi_ap_is_favorite(wifi_ap_h ap, bool* favorite);
787
788 /**
789 * @brief Gets the connection state.
790 * @param[in] ap  The handle of access point
791 * @param[out] state  The connection state
792 * @return 0 on success, otherwise negative error value.
793 * @retval #WIFI_ERROR_NONE  Successful
794 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
795 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
796 */
797 int wifi_ap_get_connection_state(wifi_ap_h ap, wifi_connection_state_e* state);
798
799 /**
800 * @brief Gets the config type of IP.
801 * @param[in] ap  The handle of access point
802 * @param[in] address_family  The address family
803 * @param[out] type  The type of IP config
804 * @return 0 on success, otherwise negative error value.
805 * @retval #WIFI_ERROR_NONE  Successful
806 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
807 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
808 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
809 */
810 int wifi_ap_get_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e* type);
811
812 /**
813 * @brief Sets the config type of IP.
814 * @details If you set IP config type to #WIFI_IP_CONFIG_TYPE_STATIC,
815 * then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0".
816 * @param[in] ap  The handle of access point
817 * @param[in] address_family  The address family
818 * @param[in] type  The type of IP config
819 * @return 0 on success, otherwise negative error value.
820 * @retval #WIFI_ERROR_NONE  Successful
821 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
822 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
823 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
824 */
825 int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e address_family, wifi_ip_config_type_e type);
826
827 /**
828 * @brief Gets the IP address.
829 * @remarks @a ip_address must be released with free() by you.
830 * @param[in] ap  The handle of access point
831 * @param[in] address_family  The address family
832 * @param[out] ip_address  The IP address
833 * @return 0 on success, otherwise negative error value.
834 * @retval #WIFI_ERROR_NONE  Successful
835 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
836 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
837 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
838 */
839 int wifi_ap_get_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, char** ip_address);
840
841 /**
842 * @brief Sets the IP address.
843 * @param[in] ap  The handle of access point
844 * @param[in] address_family  The address family
845 * @param[in] ip_address  The IP address. If you set this value to NULL, then the existing value will be deleted.
846 * @return 0 on success, otherwise negative error value.
847 * @retval #WIFI_ERROR_NONE  Successful
848 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
849 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
850 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
851 */
852 int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* ip_address);
853
854 /**
855 * @brief Gets the subnet mask.
856 * @remarks @a subnet_mask must be released with free() by you.
857 * @param[in] ap  The handle of access point
858 * @param[in] address_family  The address family
859 * @param[out] subnet_mask  The subnet mask
860 * @return 0 on success, otherwise negative error value.
861 * @retval #WIFI_ERROR_NONE  Successful
862 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
863 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
864 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
865 */
866 int wifi_ap_get_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, char** subnet_mask);
867
868 /**
869 * @brief Sets the subnet mask.
870 * @param[in] ap  The handle of access point
871 * @param[in] address_family  The address family
872 * @param[in] subnet_mask  The subnet mask. If you set this value to NULL, then the existing value will be deleted.
873 * @return 0 on success, otherwise negative error value.
874 * @retval #WIFI_ERROR_NONE  Successful
875 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
876 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
877 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
878 */
879 int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e address_family, const char* subnet_mask);
880
881 /**
882 * @brief Gets the gateway address.
883 * @remarks @a gateway_address must be released with free() by you.
884 * @param[in] ap  The handle of access point
885 * @param[in] address_family  The address family
886 * @param[out] gateway_address  The gateway address
887 * @return 0 on success, otherwise negative error value.
888 * @retval #WIFI_ERROR_NONE  Successful
889 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
890 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
891 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
892 */
893 int wifi_ap_get_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, char** gateway_address);
894
895 /**
896 * @brief Sets the gateway address.
897 * @param[in] ap  The handle of access point
898 * @param[in] address_family  The address family
899 * @param[in] gateway_address  The gateway address. If you set this value to NULL, then the existing value will be deleted.
900 * @return 0 on success, otherwise negative error value.
901 * @retval #WIFI_ERROR_NONE  Successful
902 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
903 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
904 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
905 */
906 int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* gateway_address);
907
908 /**
909 * @brief Gets the proxy address.
910 * @remarks @a proxy_address must be released with free() by you.
911 * @param[in] ap  The handle of access point
912 * @param[in] address_family  The address family
913 * @param[out] proxy_address  The proxy address
914 * @return 0 on success, otherwise negative error value.
915 * @retval #WIFI_ERROR_NONE  Successful
916 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
917 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
918 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
919 */
920 int wifi_ap_get_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, char** proxy_address);
921
922 /**
923 * @brief Sets the proxy address.
924 * @param[in] ap  The handle of access point
925 * @param[in] address_family  The address family
926 * @param[in] proxy_address  The proxy address. If you set this value to NULL, then the existing value will be deleted.
927 * @return 0 on success, otherwise negative error value.
928 * @retval #WIFI_ERROR_NONE  Successful
929 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
930 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
931 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
932 */
933 int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e address_family, const char* proxy_address);
934
935 /**
936 * @brief Gets the Proxy type.
937 * @param[in] ap  The handle of access point
938 * @param[out] type  The type of proxy
939 * @return 0 on success, otherwise negative error value.
940 * @retval #WIFI_ERROR_NONE  Successful
941 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
942 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
943 */
944 int wifi_ap_get_proxy_type(wifi_ap_h ap, wifi_proxy_type_e* type);
945
946 /**
947 * @brief Sets the Proxy address.
948 * @details If you set Proxy type to #WIFI_PROXY_TYPE_AUTO or #WIFI_PROXY_TYPE_MANUAL, then Proxy will be restored.
949 * @param[in] ap  The handle of access point
950 * @param[in] type  The type of proxy
951 * @return 0 on success, otherwise negative error value.
952 * @retval #WIFI_ERROR_NONE  Successful
953 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
954 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
955 */
956 int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type);
957
958 /**
959 * @brief Gets the DNS address.
960 * @remarks The allowance of DNS address is 2. @a dns_address must be released with free() by you.
961 * @param[in] ap  The handle of access point
962 * @param[in] order  The order of DNS address. It starts from 1, which means first DNS address.
963 * @param[in] address_family  The address family
964 * @param[out] dns_address  The DNS address
965 * @return 0 on success, otherwise negative error value.
966 * @retval #WIFI_ERROR_NONE  Successful
967 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
968 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
969 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
970 */
971 int wifi_ap_get_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, char** dns_address);
972
973 /**
974 * @brief Sets the DNS address.
975 * @remarks The allowance of DNS address is 2.
976 * @param[in] ap  The handle of access point
977 * @param[in] order  The order of DNS address. It starts from 1, which means first DNS address.
978 * @param[in] address_family  The address family
979 * @param[in] dns_address  The DNS address. If you set this value to NULL, then the existing value will be deleted.
980 * @return 0 on success, otherwise negative error value.
981 * @retval #WIFI_ERROR_NONE  Successful
982 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
983 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
984 * @retval #WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED  Address family not supported
985 */
986 int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_family_e address_family, const char* dns_address);
987
988 /**
989 * @}
990 */
991
992
993 /**
994 * @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_MODULE
995 * @{
996 */
997
998 /**
999 * @brief Gets the security mode of Wi-Fi.
1000 * @param[in] ap  The handle of access point
1001 * @param[out] type  The type of Wi-Fi security
1002 * @return 0 on success, otherwise negative error value.
1003 * @retval #WIFI_ERROR_NONE  Successful
1004 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1005 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1006 */
1007 int wifi_ap_get_security_type(wifi_ap_h ap, wifi_security_type_e* type);
1008
1009 /**
1010 * @brief Sets the security mode of Wi-Fi.
1011 * @param[in] ap  The handle of access point
1012 * @param[in] type  The type of Wi-Fi security
1013 * @return 0 on success, otherwise negative error value.
1014 * @retval #WIFI_ERROR_NONE  Successful
1015 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1016 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1017 */
1018 int wifi_ap_set_security_type(wifi_ap_h ap, wifi_security_type_e type);
1019
1020 /**
1021 * @brief Gets the encryption type of Wi-Fi.
1022 * @param[in] ap  The handle of access point
1023 * @param[out] type  The type of Wi-Fi encryption
1024 * @return 0 on success, otherwise negative error value.
1025 * @retval #WIFI_ERROR_NONE  Successful
1026 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1027 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1028 */
1029 int wifi_ap_get_encryption_type(wifi_ap_h ap, wifi_encryption_type_e* type);
1030
1031 /**
1032 * @brief Sets the encryption type of Wi-Fi.
1033 * @param[in] ap  The handle of access point
1034 * @param[in] type  The type of Wi-Fi encryption
1035 * @return 0 on success, otherwise negative error value.
1036 * @retval #WIFI_ERROR_NONE  Successful
1037 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1038 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1039 */
1040 int wifi_ap_set_encryption_type(wifi_ap_h ap, wifi_encryption_type_e type);
1041
1042 /**
1043 * @brief Indicates whether the passphrase is required or not.
1044 * @remarks This function is not valid if security type is #WIFI_SECURITY_TYPE_EAP.
1045 * @param[in] ap  The handle of access point
1046 * @param[out] required  Indicates whether passphrase is required or not
1047 * @return 0 on success, otherwise negative error value.
1048 * @retval #WIFI_ERROR_NONE  Successful
1049 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1050 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1051 */
1052 int wifi_ap_is_passphrase_required(wifi_ap_h ap, bool* required);
1053
1054 /**
1055 * @brief Sets the passphrase.
1056 * @param[in] ap  The handle of access point
1057 * @param[in] passphrase  The passphrase of access point
1058 * @return 0 on success, otherwise negative error value.
1059 * @retval #WIFI_ERROR_NONE  Successful
1060 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1061 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1062 */
1063 int wifi_ap_set_passphrase(wifi_ap_h ap, const char* passphrase);
1064
1065 /**
1066 * @brief Indicates whether the WPS(Wi-Fi Protected Setup) is supported or not.
1067 * @param[in] ap  The handle of access point
1068 * @param[out] supported  Indicates whether WPS is supported or not
1069 * @return 0 on success, otherwise negative error value.
1070 * @retval #WIFI_ERROR_NONE  Successful
1071 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1072 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1073 * @see wifi_connect_by_wps_pbc()
1074 */
1075 int wifi_ap_is_wps_supported(wifi_ap_h ap, bool* supported);
1076
1077 /**
1078 * @}
1079 */
1080
1081
1082 /**
1083 * @addtogroup CAPI_NETWORK_WIFI_AP_SECURITY_EAP_MODULE
1084 * @{
1085 */
1086
1087 /**
1088 * @brief Sets the passphrase of EAP.
1089 * @details You can set one of @a user_name and @a password as NULL.
1090 * In this case, the value of a parameter which is set as NULL will be the previous value.
1091 * But it is not allowed that both @a user_name and @a password are set as NULL.
1092 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS.
1093 * @param[in] ap  The handle of access point
1094 * @param[in] user_name  The user name. This value can be NULL.
1095 * @param[in] password  The password. This value can be NULL.
1096 * @return 0 on success, otherwise negative error value.
1097 * @retval #WIFI_ERROR_NONE  Successful
1098 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1099 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1100 */
1101 int wifi_ap_set_eap_passphrase(wifi_ap_h ap, const char* user_name, const char* password);
1102
1103 /**
1104 * @brief Gets the passphrase of EAP.
1105 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_PEAP or #WIFI_EAP_TYPE_TTLS.
1106 * @a user_name must be released with free() by you.
1107 * @param[in] ap  The handle of access point
1108 * @param[out] user_name  The user name
1109 * @param[out] password  Indicates whether password is set or not (@c true = set, @c  false = not set)
1110 * @return 0 on success, otherwise negative error value.
1111 * @retval #WIFI_ERROR_NONE  Successful
1112 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1113 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
1114 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1115 */
1116 int wifi_ap_get_eap_passphrase(wifi_ap_h ap, char** user_name, bool* is_password_set);
1117
1118 /**
1119 * @brief Gets the CA Certificate of EAP.
1120 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1121 * @a file must be released with free() by you.
1122 * @param[in] ap  The handle of access point
1123 * @param[out] file  The file path of CA Certificate
1124 * @return 0 on success, otherwise negative error value.
1125 * @retval #WIFI_ERROR_NONE  Successful
1126 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1127 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
1128 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1129 */
1130 int wifi_ap_get_eap_ca_cert_file(wifi_ap_h ap, char** file);
1131
1132 /**
1133 * @brief Sets the CA Certificate of EAP.
1134 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1135 * @param[in] ap  The handle of access point
1136 * @param[in] file  The file path of CA Certificate
1137 * @return 0 on success, otherwise negative error value.
1138 * @retval #WIFI_ERROR_NONE  Successful
1139 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1140 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1141 */
1142 int wifi_ap_set_eap_ca_cert_file(wifi_ap_h ap, const char* file);
1143
1144 /**
1145 * @brief Gets the Client Certificate of EAP.
1146 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1147 * @a file must be released with free() by you.
1148 * @param[in] ap  The handle of access point
1149 * @param[out] file  The file path of Client Certificate
1150 * @return 0 on success, otherwise negative error value.
1151 * @retval #WIFI_ERROR_NONE  Successful
1152 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1153 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
1154 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1155 */
1156 int wifi_ap_get_eap_client_cert_file(wifi_ap_h ap, char** file);
1157
1158 /**
1159 * @brief Sets the CA Certificate of EAP.
1160 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1161 * @param[in] ap  The handle of access point
1162 * @param[in] file  The file path of Client Certificate
1163 * @return 0 on success, otherwise negative error value.
1164 * @retval #WIFI_ERROR_NONE  Successful
1165 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1166 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1167 */
1168 int wifi_ap_set_eap_client_cert_file(wifi_ap_h ap, const char* file);
1169
1170 /**
1171 * @brief Gets the private key file of EAP.
1172 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1173 * @a file must be released with free() by you.
1174 * @param[in] ap  The handle of access point
1175 * @param[out] file  The file path of private key
1176 * @return 0 on success, otherwise negative error value.
1177 * @retval #WIFI_ERROR_NONE  Successful
1178 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1179 * @retval #WIFI_ERROR_OUT_OF_MEMORY  Out of memory
1180 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1181 */
1182 int wifi_ap_get_eap_private_key_file(wifi_ap_h ap, char** file);
1183
1184 /**
1185 * @brief Sets the private key information of EAP.
1186 * @remarks This function is valid only if the EAP type is #WIFI_EAP_TYPE_TLS.
1187 * @param[in] ap  The handle of access point
1188 * @param[in] file  The file path of private key
1189 * @param[in] password  The password
1190 * @return 0 on success, otherwise negative error value.
1191 * @retval #WIFI_ERROR_NONE  Successful
1192 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1193 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1194 */
1195 int wifi_ap_set_eap_private_key_info(wifi_ap_h ap, const char* file, const char* password);
1196
1197 /**
1198 * @brief Gets the EAP type of Wi-Fi.
1199 * @param[in] ap  The handle of access point
1200 * @param[out] type  The type of EAP
1201 * @return 0 on success, otherwise negative error value.
1202 * @retval #WIFI_ERROR_NONE  Successful
1203 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1204 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1205 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1206 */
1207 int wifi_ap_get_eap_type(wifi_ap_h ap, wifi_eap_type_e* type);
1208
1209 /**
1210 * @brief Sets the EAP type of Wi-Fi.
1211 * @param[in] ap  The handle of access point
1212 * @param[in] type  The type of EAP
1213 * @return 0 on success, otherwise negative error value.
1214 * @retval #WIFI_ERROR_NONE  Successful
1215 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1216 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1217 */
1218 int wifi_ap_set_eap_type(wifi_ap_h ap, wifi_eap_type_e type);
1219
1220 /**
1221 * @brief Gets the type of EAP phase2 authentication of Wi-Fi.
1222 * @param[in] ap  The handle of access point
1223 * @param[out] type  The type of EAP phase2 authentication
1224 * @return 0 on success, otherwise negative error value.
1225 * @retval #WIFI_ERROR_NONE  Successful
1226 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1227 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1228 * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
1229 */
1230 int wifi_ap_get_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e* type);
1231
1232 /**
1233 * @brief Sets the type of EAP phase2 authentication of Wi-Fi.
1234 * @param[in] ap  The handle of access point
1235 * @param[in] type  The type of EAP phase2 authentication
1236 * @return 0 on success, otherwise negative error value.
1237 * @retval #WIFI_ERROR_NONE  Successful
1238 * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
1239 * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
1240 */
1241 int wifi_ap_set_eap_auth_type(wifi_ap_h ap, wifi_eap_auth_type_e type);
1242
1243 /**
1244 * @}
1245 */
1246
1247
1248 #ifdef __cplusplus
1249 }
1250 #endif
1251
1252 #endif /* __TIZEN_NETWORK_WIFI_H__ */