Merge "Fix crash caused by decryption response delay" into tizen
[platform/upstream/connman.git] / gsupplicant / gsupplicant.h
1 /*
2  *
3  *  WPA supplicant library with GLib integration
4  *
5  *  Copyright (C) 2012-2013  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21 #ifndef __G_SUPPLICANT_H
22 #define __G_SUPPLICANT_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define G_SUPPLICANT_EAP_METHOD_MD5     (1 << 0)
29 #define G_SUPPLICANT_EAP_METHOD_TLS     (1 << 1)
30 #define G_SUPPLICANT_EAP_METHOD_MSCHAPV2        (1 << 2)
31 #define G_SUPPLICANT_EAP_METHOD_PEAP    (1 << 3)
32 #define G_SUPPLICANT_EAP_METHOD_TTLS    (1 << 4)
33 #define G_SUPPLICANT_EAP_METHOD_GTC     (1 << 5)
34 #define G_SUPPLICANT_EAP_METHOD_OTP     (1 << 6)
35 #define G_SUPPLICANT_EAP_METHOD_LEAP    (1 << 7)
36 #define G_SUPPLICANT_EAP_METHOD_WSC     (1 << 8)
37
38 #define G_SUPPLICANT_CAPABILITY_AUTHALG_OPEN    (1 << 0)
39 #define G_SUPPLICANT_CAPABILITY_AUTHALG_SHARED  (1 << 1)
40 #define G_SUPPLICANT_CAPABILITY_AUTHALG_LEAP    (1 << 2)
41
42 #define G_SUPPLICANT_CAPABILITY_PROTO_WPA               (1 << 0)
43 #define G_SUPPLICANT_CAPABILITY_PROTO_RSN               (1 << 1)
44
45 #define G_SUPPLICANT_CAPABILITY_SCAN_ACTIVE     (1 << 0)
46 #define G_SUPPLICANT_CAPABILITY_SCAN_PASSIVE    (1 << 1)
47 #define G_SUPPLICANT_CAPABILITY_SCAN_SSID               (1 << 2)
48
49 #define G_SUPPLICANT_CAPABILITY_MODE_INFRA      (1 << 0)
50 #define G_SUPPLICANT_CAPABILITY_MODE_IBSS               (1 << 1)
51 #define G_SUPPLICANT_CAPABILITY_MODE_AP         (1 << 2)
52 #define G_SUPPLICANT_CAPABILITY_MODE_P2P        (1 << 3)
53 #if defined TIZEN_EXT_WIFI_MESH
54 #define G_SUPPLICANT_CAPABILITY_MODE_MESH      (1 << 4)
55 #endif
56
57 #define G_SUPPLICANT_KEYMGMT_NONE               (1 << 0)
58 #define G_SUPPLICANT_KEYMGMT_IEEE8021X  (1 << 1)
59 #define G_SUPPLICANT_KEYMGMT_WPA_NONE   (1 << 2)
60 #define G_SUPPLICANT_KEYMGMT_WPA_PSK    (1 << 3)
61 #define G_SUPPLICANT_KEYMGMT_WPA_PSK_256        (1 << 4)
62 #if defined TIZEN_EXT
63 #define G_SUPPLICANT_KEYMGMT_WPA_FT_EAP (1 << 5)
64 #define G_SUPPLICANT_KEYMGMT_WPA_FT_PSK (1 << 6)
65 #else
66 #define G_SUPPLICANT_KEYMGMT_WPA_FT_PSK (1 << 5)
67 #define G_SUPPLICANT_KEYMGMT_WPA_FT_EAP (1 << 6)
68 #endif
69 #define G_SUPPLICANT_KEYMGMT_WPA_EAP    (1 << 7)
70 #define G_SUPPLICANT_KEYMGMT_WPA_EAP_256        (1 << 8)
71 #define G_SUPPLICANT_KEYMGMT_WPS                (1 << 9)
72 #if defined TIZEN_EXT
73 #define G_SUPPLICANT_KEYMGMT_SAE                (1 << 10)
74 #define G_SUPPLICANT_KEYMGMT_FT_SAE             (1 << 11)
75 #define G_SUPPLICANT_KEYMGMT_OWE                (1 << 22)
76 #define G_SUPPLICANT_KEYMGMT_DPP                (1 << 23)
77 #endif
78
79 #define G_SUPPLICANT_PROTO_WPA          (1 << 0)
80 #define G_SUPPLICANT_PROTO_RSN          (1 << 1)
81
82 #define G_SUPPLICANT_GROUP_WEP40                (1 << 0)
83 #define G_SUPPLICANT_GROUP_WEP104               (1 << 1)
84 #define G_SUPPLICANT_GROUP_TKIP         (1 << 2)
85 #define G_SUPPLICANT_GROUP_CCMP         (1 << 3)
86
87 #define G_SUPPLICANT_PAIRWISE_NONE      (1 << 0)
88 #define G_SUPPLICANT_PAIRWISE_TKIP      (1 << 1)
89 #define G_SUPPLICANT_PAIRWISE_CCMP      (1 << 2)
90
91 #define G_SUPPLICANT_WPS_CONFIGURED     (1 << 0)
92 #define G_SUPPLICANT_WPS_PBC            (1 << 1)
93 #define G_SUPPLICANT_WPS_PIN            (1 << 2)
94 #define G_SUPPLICANT_WPS_REGISTRAR      (1 << 3)
95
96 #define G_SUPPLICANT_WPS_CONFIG_PBC     0x0080
97
98 #define G_SUPPLICANT_GROUP_ROLE_CLIENT  (1 << 0)
99 #define G_SUPPLICANT_GROUP_ROLE_GO      (1 << 1)
100
101 typedef enum {
102         G_SUPPLICANT_MODE_UNKNOWN,
103         G_SUPPLICANT_MODE_INFRA,
104         G_SUPPLICANT_MODE_IBSS,
105         G_SUPPLICANT_MODE_MASTER,
106 #if defined TIZEN_EXT_WIFI_MESH
107         G_SUPPLICANT_MODE_MESH,
108 #endif
109 } GSupplicantMode;
110
111 #if defined TIZEN_EXT_WIFI_MESH
112 typedef enum {
113         G_SUPPLICANT_IEEE80211W_UNKNOWN,
114         G_SUPPLICANT_IEEE80211W_OPTIONAL,
115         G_SUPPLICANT_IEEE80211W_REQUIRED,
116 } GSupplicantPmf;
117 #endif
118
119 typedef enum {
120         G_SUPPLICANT_SECURITY_UNKNOWN,
121         G_SUPPLICANT_SECURITY_NONE,
122         G_SUPPLICANT_SECURITY_WEP,
123         G_SUPPLICANT_SECURITY_PSK,
124         G_SUPPLICANT_SECURITY_IEEE8021X,
125 #if defined TIZEN_EXT
126         G_SUPPLICANT_SECURITY_FT_PSK,
127         G_SUPPLICANT_SECURITY_FT_IEEE8021X,
128         G_SUPPLICANT_SECURITY_SAE,
129         G_SUPPLICANT_SECURITY_OWE,
130         G_SUPPLICANT_SECURITY_DPP,
131         G_SUPPLICANT_SECURITY_PSK_SHA256,
132 #endif
133 } GSupplicantSecurity;
134
135 #if defined TIZEN_EXT
136 typedef enum {
137         G_SUPPLICANT_EAP_KEYMGMT_NONE,
138         G_SUPPLICANT_EAP_KEYMGMT_FT,
139         G_SUPPLICANT_EAP_KEYMGMT_CCKM,
140         G_SUPPLICANT_EAP_KEYMGMT_OKC,
141 } GSupplicantEapKeymgmt;
142
143 typedef enum {
144         G_SUPPLICANT_MODE_IEEE80211_UNKNOWN,
145         G_SUPPLICANT_MODE_IEEE80211B,
146         G_SUPPLICANT_MODE_IEEE80211BG,
147         G_SUPPLICANT_MODE_IEEE80211BGN,
148         G_SUPPLICANT_MODE_IEEE80211A,
149         G_SUPPLICANT_MODE_IEEE80211AN,
150         G_SUPPLICANT_MODE_IEEE80211ANAC,
151 } GSupplicantPhy_mode;
152 #endif
153
154 typedef enum {
155         G_SUPPLICANT_STATE_UNKNOWN,
156         G_SUPPLICANT_STATE_DISABLED,
157         G_SUPPLICANT_STATE_DISCONNECTED,
158         G_SUPPLICANT_STATE_INACTIVE,
159         G_SUPPLICANT_STATE_SCANNING,
160         G_SUPPLICANT_STATE_AUTHENTICATING,
161         G_SUPPLICANT_STATE_ASSOCIATING,
162         G_SUPPLICANT_STATE_ASSOCIATED,
163         G_SUPPLICANT_STATE_4WAY_HANDSHAKE,
164         G_SUPPLICANT_STATE_GROUP_HANDSHAKE,
165         G_SUPPLICANT_STATE_COMPLETED,
166 } GSupplicantState;
167
168 typedef enum {
169         G_SUPPLICANT_WPS_STATE_UNKNOWN,
170         G_SUPPLICANT_WPS_STATE_SUCCESS,
171         G_SUPPLICANT_WPS_STATE_FAIL,
172 } GSupplicantWpsState;
173
174 typedef enum {
175         G_SUPPLICANT_PEER_SERVICES_CHANGED,
176         G_SUPPLICANT_PEER_GROUP_CHANGED,
177         G_SUPPLICANT_PEER_GROUP_STARTED,
178         G_SUPPLICANT_PEER_GROUP_FINISHED,
179         G_SUPPLICANT_PEER_GROUP_JOINED,
180         G_SUPPLICANT_PEER_GROUP_DISCONNECTED,
181         G_SUPPLICANT_PEER_GROUP_FAILED,
182 } GSupplicantPeerState;
183
184 #if defined TIZEN_EXT
185 typedef enum {
186         G_SUPPLICANT_INS_PREFERRED_FREQ_UNKNOWN,
187         G_SUPPLICANT_INS_PREFERRED_FREQ_24GHZ,
188         G_SUPPLICANT_INS_PREFERRED_FREQ_5GHZ,
189 } GSupplicantINSPreferredFreq;
190 #endif
191
192 typedef enum {
193         G_SUPPLICANT_MFP_NONE,
194         G_SUPPLICANT_MFP_OPTIONAL,
195         G_SUPPLICANT_MFP_REQUIRED,
196 } GSupplicantMfpOptions;
197
198 struct _GSupplicantSSID {
199 #if defined TIZEN_EXT
200         void *ssid;
201 #else
202         const void *ssid;
203 #endif
204         unsigned int ssid_len;
205         unsigned int scan_ssid;
206         GSupplicantMode mode;
207         GSupplicantSecurity security;
208         unsigned int protocol;
209         unsigned int pairwise_cipher;
210         unsigned int group_cipher;
211         unsigned int freq;
212         const char *eap;
213         const char *passphrase;
214         const char *identity;
215         const char *anonymous_identity;
216         const char *ca_cert_path;
217         const char *subject_match;
218         const char *altsubject_match;
219         const char *domain_suffix_match;
220         const char *domain_match;
221         const char *client_cert_path;
222         const char *private_key_path;
223         const char *private_key_passphrase;
224         const char *phase2_auth;
225         dbus_bool_t use_wps;
226         const char *pin_wps;
227         const char *bgscan;
228 #if defined TIZEN_EXT
229         unsigned char *bssid;
230         unsigned int bssid_for_connect_len;
231         unsigned char bssid_for_connect[6];
232         GSupplicantEapKeymgmt eap_keymgmt;
233         const char *phase1;
234         const char *pac_file;
235         unsigned int keymgmt;
236         const char *connector;
237         const char *c_sign_key;
238         const char *net_access_key;
239         bool is_passphrase_alloc;
240         bool is_connector_alloc;
241         bool is_c_sign_key_alloc;
242         bool is_net_access_key_alloc;
243 #endif
244         GSupplicantMfpOptions ieee80211w;
245 };
246
247 typedef struct _GSupplicantSSID GSupplicantSSID;
248
249 /*
250  * Max number of SSIDs that can be scanned.
251  * In wpa_s 0.7x the limit is 4.
252  * In wps_s 0.8 or later it is 16.
253  * The value is only used if wpa_supplicant does not return any max limit
254  * for number of scannable SSIDs.
255  */
256 #define WPAS_MAX_SCAN_SSIDS 4
257
258 struct scan_ssid {
259         unsigned char ssid[32];
260         uint8_t ssid_len;
261 };
262
263 struct _GSupplicantScanParams {
264         GSList *ssids;
265
266         uint8_t num_ssids;
267
268         uint8_t num_freqs;
269         uint16_t *freqs;
270 };
271
272 typedef struct _GSupplicantScanParams GSupplicantScanParams;
273
274 struct _GSupplicantPeerParams {
275         bool master;
276         char *wps_pin;
277         char *path;
278 };
279
280 typedef struct _GSupplicantPeerParams GSupplicantPeerParams;
281
282 struct _GSupplicantP2PServiceParams {
283         int version;
284         char *service;
285         unsigned char *query;
286         int query_length;
287         unsigned char *response;
288         int response_length;
289         unsigned char *wfd_ies;
290         int wfd_ies_length;
291 };
292
293 typedef struct _GSupplicantP2PServiceParams GSupplicantP2PServiceParams;
294
295 #if defined TIZEN_EXT
296 #define WIFI_BSSID_STR_LEN 18
297 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
298 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
299
300 #define WIFI_BSSID_LEN_MAX 6
301
302 struct g_connman_bssids {
303         unsigned char bssid[WIFI_BSSID_LEN_MAX];
304         uint16_t strength;
305         uint16_t frequency;
306         uint16_t assoc_reject_cnt;
307         bool is_last_connected;
308         unsigned int est_throughput;
309         int score_snr;
310         int score_last_connected_bssid;
311         int score_assoc_reject;
312         int score_frequency;
313         int score_strength;
314         int score_est_throughput;
315         int ins_score;
316 };
317 #endif
318
319 /* global API */
320 typedef void (*GSupplicantCountryCallback) (int result,
321                                                 const char *alpha2,
322                                                         void *user_data);
323
324 int g_supplicant_set_country(const char *alpha2,
325                                 GSupplicantCountryCallback callback,
326                                                 const void *user_data);
327
328 /* Interface API */
329 struct _GSupplicantInterface;
330 struct _GSupplicantPeer;
331
332 typedef struct _GSupplicantInterface GSupplicantInterface;
333 typedef struct _GSupplicantPeer GSupplicantPeer;
334 #if defined TIZEN_EXT_WIFI_MESH
335 typedef struct _GSupplicantMeshPeer GSupplicantMeshPeer;
336 #endif
337
338 typedef void (*GSupplicantInterfaceCallback) (int result,
339                                         GSupplicantInterface *interface,
340                                                         void *user_data);
341
342 #if defined TIZEN_EXT
343 typedef void (*GSupplicantMaxSpeedCallback) (int result, int maxspeed,
344                                              int strength, int snr, void *user_data,
345                                                  unsigned int est_throughput);
346 #endif
347
348 void g_supplicant_interface_cancel(GSupplicantInterface *interface);
349
350 int g_supplicant_interface_create(const char *ifname, const char *driver,
351                                         const char *bridge,
352 #ifdef TIZEN_EXT
353                                         unsigned int mac_policy,
354                                         unsigned int preassoc_mac_policy,
355                                         unsigned int random_mac_lifetime,
356 #endif /* TIZEN_EXT */
357                                         GSupplicantInterfaceCallback callback,
358                                                         void *user_data);
359 int g_supplicant_interface_remove(GSupplicantInterface *interface,
360                                         GSupplicantInterfaceCallback callback,
361                                                         void *user_data);
362 int g_supplicant_interface_scan(GSupplicantInterface *interface,
363                                         GSupplicantScanParams *scan_data,
364                                         GSupplicantInterfaceCallback callback,
365                                                         void *user_data);
366
367 #if defined TIZEN_EXT
368 int g_supplicant_interface_signalpoll(GSupplicantInterface *interface,
369                                         GSupplicantMaxSpeedCallback callback,
370                                         void *user_data);
371 #endif
372
373 int g_supplicant_interface_p2p_find(GSupplicantInterface *interface,
374                                         GSupplicantInterfaceCallback callback,
375                                                         void *user_data);
376
377 int g_supplicant_interface_p2p_stop_find(GSupplicantInterface *interface);
378
379 int g_supplicant_interface_p2p_connect(GSupplicantInterface *interface,
380                                         GSupplicantPeerParams *peer_params,
381                                         GSupplicantInterfaceCallback callback,
382                                         void *user_data);
383
384 int g_supplicant_interface_p2p_disconnect(GSupplicantInterface *interface,
385                                         GSupplicantPeerParams *peer_params);
386
387 int g_supplicant_interface_p2p_listen(GSupplicantInterface *interface,
388                                                 int period, int interval);
389
390 int g_supplicant_interface_p2p_add_service(GSupplicantInterface *interface,
391                                 GSupplicantInterfaceCallback callback,
392                                 GSupplicantP2PServiceParams *p2p_service_params,
393                                 void *user_data);
394
395 int g_supplicant_interface_p2p_del_service(GSupplicantInterface *interface,
396                                 GSupplicantP2PServiceParams *p2p_service_params);
397
398 int g_supplicant_set_widi_ies(GSupplicantP2PServiceParams *p2p_service_params,
399                                         GSupplicantInterfaceCallback callback,
400                                         void *user_data);
401
402 int g_supplicant_interface_connect(GSupplicantInterface *interface,
403                                         GSupplicantSSID *ssid,
404                                         GSupplicantInterfaceCallback callback,
405                                                         void *user_data);
406
407 #if defined TIZEN_EXT
408 int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
409                                         GSupplicantInterfaceCallback callback,
410                                         void *user_data, void *connman_network);
411 #else
412 int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
413                                         GSupplicantInterfaceCallback callback,
414                                                         void *user_data);
415 #endif
416
417 int g_supplicant_interface_set_bss_expiration_age(GSupplicantInterface *interface,
418                                         unsigned int bss_expiration_age);
419
420 #if defined TIZEN_EXT
421 void g_supplicant_interface_remove_network(GSupplicantInterface *interface,
422                                 GSupplicantSSID *ssid);
423 #endif
424
425 int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
426                                                         unsigned int ap_scan);
427
428 void g_supplicant_interface_set_data(GSupplicantInterface *interface,
429                                                                 void *data);
430 void *g_supplicant_interface_get_data(GSupplicantInterface *interface);
431 const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface);
432 #if defined TIZEN_EXT
433 bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface);
434 bool g_supplicant_interface_get_is_6_0_ghz_supported(GSupplicantInterface *interface);
435 unsigned char *g_supplicant_interface_get_add_network_bssid(GSupplicantInterface *interface);
436
437 typedef void (*GSupplicantMacPolicyCallback) (int result, unsigned int policy, void *user_data);
438 int g_supplicant_interface_set_mac_policy(GSupplicantInterface *interface,
439                                         GSupplicantMacPolicyCallback callback,
440                                                         unsigned int policy,
441                                                         void *user_data);
442
443 int g_supplicant_interface_set_preassoc_mac_policy(GSupplicantInterface *interface,
444                                         GSupplicantMacPolicyCallback callback,
445                                                         unsigned int policy,
446                                                         void *user_data);
447
448 typedef void (*GSupplicantRandomMaclifetimeCallback) (int result, unsigned int lifetime, void *user_data);
449 int g_supplicant_interface_set_random_mac_lifetime(GSupplicantInterface *interface,
450                                         GSupplicantRandomMaclifetimeCallback callback,
451                                                         unsigned int lifetime,
452                                                         void *user_data);
453 #endif
454 const char *g_supplicant_interface_get_driver(GSupplicantInterface *interface);
455 GSupplicantState g_supplicant_interface_get_state(GSupplicantInterface *interface);
456 const char *g_supplicant_interface_get_wps_key(GSupplicantInterface *interface);
457 const void *g_supplicant_interface_get_wps_ssid(GSupplicantInterface *interface,
458                                                         unsigned int *ssid_len);
459 GSupplicantWpsState g_supplicant_interface_get_wps_state(GSupplicantInterface *interface);
460 unsigned int g_supplicant_interface_get_mode(GSupplicantInterface *interface);
461 dbus_bool_t g_supplicant_interface_get_ready(GSupplicantInterface *interface);
462 unsigned int g_supplicant_interface_get_max_scan_ssids(
463                                         GSupplicantInterface *interface);
464
465 int g_supplicant_interface_enable_selected_network(GSupplicantInterface *interface,
466                                                         dbus_bool_t enable);
467 int g_supplicant_interface_set_country(GSupplicantInterface *interface,
468                                         GSupplicantCountryCallback callback,
469                                                         const char *alpha2,
470                                                         void *user_data);
471 bool g_supplicant_interface_has_p2p(GSupplicantInterface *interface);
472 int g_supplicant_interface_set_p2p_device_config(GSupplicantInterface *interface,
473                                                 const char *device_name,
474                                                 const char *primary_dev_type);
475 GSupplicantPeer *g_supplicant_interface_peer_lookup(GSupplicantInterface *interface,
476                                                 const char *identifier);
477 bool g_supplicant_interface_is_p2p_finding(GSupplicantInterface *interface);
478
479 #if defined TIZEN_EXT_WIFI_MESH
480 bool g_supplicant_interface_has_mesh(GSupplicantInterface *interface);
481 int g_supplicant_mesh_interface_create(const char *ifname, const char *driver,
482                                                 const char *bridge, const char *parent_ifname,
483                                                 GSupplicantInterfaceCallback callback, void *user_data);
484 const void *g_supplicant_interface_get_mesh_group_ssid(
485                                                         GSupplicantInterface *interface,
486                                                         unsigned int *ssid_len);
487 int g_supplicant_mesh_get_disconnect_reason(GSupplicantInterface *interface);
488 const char *g_supplicant_mesh_peer_get_address(GSupplicantMeshPeer *mesh_peer);
489 int g_supplicant_mesh_peer_get_disconnect_reason(
490                                                         GSupplicantMeshPeer *mesh_peer);
491 int g_supplicant_interface_abort_scan(GSupplicantInterface *interface,
492                                 GSupplicantInterfaceCallback callback, void *user_data);
493 int g_supplicant_interface_mesh_peer_change_status(
494                                 GSupplicantInterface *interface,
495                                 GSupplicantInterfaceCallback callback, const char *peer_address,
496                                 const char *method, void *user_data);
497 #endif
498
499 /* Network and Peer API */
500 struct _GSupplicantNetwork;
501 struct _GSupplicantGroup;
502
503 typedef struct _GSupplicantNetwork GSupplicantNetwork;
504 typedef struct _GSupplicantGroup GSupplicantGroup;
505
506 GSupplicantInterface *g_supplicant_network_get_interface(GSupplicantNetwork *network);
507 const char *g_supplicant_network_get_name(GSupplicantNetwork *network);
508 const char *g_supplicant_network_get_identifier(GSupplicantNetwork *network);
509 const char *g_supplicant_network_get_path(GSupplicantNetwork *network);
510 const void *g_supplicant_network_get_ssid(GSupplicantNetwork *network,
511                                                         unsigned int *ssid_len);
512 const char *g_supplicant_network_get_mode(GSupplicantNetwork *network);
513 const char *g_supplicant_network_get_security(GSupplicantNetwork *network);
514 dbus_int16_t g_supplicant_network_get_signal(GSupplicantNetwork *network);
515 dbus_uint16_t g_supplicant_network_get_frequency(GSupplicantNetwork *network);
516 dbus_bool_t g_supplicant_network_get_wps(GSupplicantNetwork *network);
517 dbus_bool_t g_supplicant_network_is_wps_active(GSupplicantNetwork *network);
518 dbus_bool_t g_supplicant_network_is_wps_pbc(GSupplicantNetwork *network);
519 dbus_bool_t g_supplicant_network_is_wps_advertizing(GSupplicantNetwork *network);
520
521 GSupplicantInterface *g_supplicant_peer_get_interface(GSupplicantPeer *peer);
522 const char *g_supplicant_peer_get_path(GSupplicantPeer *peer);
523 const char *g_supplicant_peer_get_identifier(GSupplicantPeer *peer);
524 const void *g_supplicant_peer_get_device_address(GSupplicantPeer *peer);
525 const void *g_supplicant_peer_get_iface_address(GSupplicantPeer *peer);
526 const char *g_supplicant_peer_get_name(GSupplicantPeer *peer);
527 const unsigned char *g_supplicant_peer_get_widi_ies(GSupplicantPeer *peer,
528                                                                 int *length);
529 bool g_supplicant_peer_is_wps_pbc(GSupplicantPeer *peer);
530 bool g_supplicant_peer_is_wps_pin(GSupplicantPeer *peer);
531 bool g_supplicant_peer_is_in_a_group(GSupplicantPeer *peer);
532 GSupplicantInterface *g_supplicant_peer_get_group_interface(GSupplicantPeer *peer);
533 bool g_supplicant_peer_is_client(GSupplicantPeer *peer);
534 bool g_supplicant_peer_has_requested_connection(GSupplicantPeer *peer);
535
536 #if defined TIZEN_EXT
537 /*
538 * Description: Network client requires additional wifi specific info
539 */
540 const unsigned char *g_supplicant_network_get_bssid(
541                                                 GSupplicantNetwork *network);
542 unsigned int g_supplicant_network_get_maxrate(GSupplicantNetwork *network);
543 const char *g_supplicant_network_get_enc_mode(GSupplicantNetwork *network);
544 bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network);
545 bool g_supplicant_network_is_hs20AP(GSupplicantNetwork *network);
546 const char *g_supplicant_network_get_eap(GSupplicantNetwork *network);
547 const char *g_supplicant_network_get_identity(GSupplicantNetwork *network);
548 const char *g_supplicant_network_get_phase2(GSupplicantNetwork *network);
549 unsigned int g_supplicant_network_get_keymgmt(GSupplicantNetwork *network);
550 dbus_bool_t g_supplicant_network_get_privacy(GSupplicantNetwork *network);
551 void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network);
552 const unsigned char *g_supplicant_network_get_countrycode(GSupplicantNetwork
553                                                           *network);
554 dbus_bool_t g_supplicant_network_is_pmf_required(GSupplicantNetwork *network);
555 void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network);
556 GSupplicantPhy_mode g_supplicant_network_get_phy_mode(GSupplicantNetwork *network);
557 dbus_bool_t g_supplicant_network_get_transition_mode(GSupplicantNetwork *network);
558 const unsigned char *g_supplicant_network_get_transition_mode_bssid(GSupplicantNetwork *network);
559 const void *g_supplicant_network_get_transition_mode_ssid(GSupplicantNetwork *network,
560                                                         unsigned int *transition_mode_ssid_len);
561 void g_supplicant_network_set_signal(GSupplicantNetwork *network, int signal);
562 void g_supplicant_network_set_bss_signal(GSupplicantNetwork *network,
563                 int signal, int snr);
564 GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface,
565                 const char *group);
566
567 void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid);
568 const unsigned char *g_supplicant_network_get_last_connected_bssid(GSupplicantNetwork *network);
569 void g_supplicant_network_update_assoc_reject(GSupplicantInterface *interface,
570                 GSupplicantNetwork *network);
571 GHashTable *g_supplicant_network_get_assoc_reject_table(GSupplicantNetwork *network);
572 GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *network);
573 #endif
574
575 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
576 typedef void (*g_supplicant_eap_callback)(GSupplicantInterface *interface, bool status);
577 #endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
578
579 struct _GSupplicantCallbacks {
580         void (*system_ready) (void);
581         void (*system_killed) (void);
582         void (*interface_added) (GSupplicantInterface *interface);
583         void (*interface_state) (GSupplicantInterface *interface);
584         void (*interface_removed) (GSupplicantInterface *interface);
585         void (*p2p_support) (GSupplicantInterface *interface);
586         void (*scan_started) (GSupplicantInterface *interface);
587         void (*scan_finished) (GSupplicantInterface *interface);
588         void (*ap_create_fail) (GSupplicantInterface *interface);
589         void (*network_added) (GSupplicantNetwork *network);
590         void (*network_removed) (GSupplicantNetwork *network);
591 #if defined TIZEN_EXT
592         void (*network_merged) (GSupplicantNetwork *network);
593 #endif
594         void (*network_changed) (GSupplicantNetwork *network,
595                                         const char *property);
596         void (*network_associated) (GSupplicantNetwork *network);
597 #if defined TIZEN_EXT
598         void (*system_power_off) (void);
599         void (*assoc_failed) (void *user_data);
600         void (*scan_done) (GSupplicantInterface *interface);
601 #endif
602         void (*sta_authorized) (GSupplicantInterface *interface,
603                                         const char *addr);
604         void (*sta_deauthorized) (GSupplicantInterface *interface,
605                                         const char *addr);
606         void (*peer_found) (GSupplicantPeer *peer);
607         void (*peer_lost) (GSupplicantPeer *peer);
608         void (*peer_changed) (GSupplicantPeer *peer,
609                                         GSupplicantPeerState state);
610         void (*peer_request) (GSupplicantPeer *peer);
611         void (*debug) (const char *str);
612         void (*disconnect_reasoncode)(GSupplicantInterface *interface,
613                                 int reasoncode);
614         void (*assoc_status_code)(GSupplicantInterface *interface,
615                                 int reasoncode);
616 #if defined TIZEN_EXT_WIFI_MESH
617         void (*mesh_support) (GSupplicantInterface *interface);
618         void (*mesh_group_started) (GSupplicantInterface *interface);
619         void (*mesh_group_removed) (GSupplicantInterface *interface);
620         void (*mesh_peer_connected) (GSupplicantMeshPeer *mesh_peer);
621         void (*mesh_peer_disconnected) (GSupplicantMeshPeer *mesh_peer);
622 #endif
623
624 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
625         g_supplicant_eap_callback eap;
626 #endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
627 };
628
629 typedef struct _GSupplicantCallbacks GSupplicantCallbacks;
630
631 #if defined TIZEN_EXT
632 void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bssid,
633                 bool last_connected_bssid, bool assoc_reject, bool signal_bssid,
634                 unsigned int preferred_freq_bssid_score, unsigned int last_connected_bssid_score,
635                 unsigned int assoc_reject_score, int signal_level3_5ghz, int signal_level3_24ghz);
636 #endif /* defined TIZEN_EXT */
637
638 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
639 void g_supplicant_replace_config_file(const char *ifname, const char *config_file);
640 void g_supplicant_register_eap_callback(g_supplicant_eap_callback cb);
641 void g_supplicant_unregister_eap_callback(void);
642 #endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
643
644 #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
645 int g_supplicant_register(GSupplicantCallbacks *callbacks);
646 #else /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
647 int g_supplicant_register(const GSupplicantCallbacks *callbacks);
648 #endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
649 void g_supplicant_unregister(const GSupplicantCallbacks *callbacks);
650
651 static inline
652 void g_supplicant_free_scan_params(GSupplicantScanParams *scan_params)
653 {
654         g_slist_free_full(scan_params->ssids, g_free);
655         g_free(scan_params->freqs);
656         g_free(scan_params);
657 }
658
659 #ifdef __cplusplus
660 }
661 #endif
662
663 #endif /* __G_SUPPLICANT_H */