Update supplicant test program with some API changes
[framework/connectivity/connman.git] / tools / supplicant.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2009  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
22 #define SUPPLICANT_EAP_METHOD_MD5       (1 << 0)
23 #define SUPPLICANT_EAP_METHOD_TLS       (1 << 1)
24 #define SUPPLICANT_EAP_METHOD_MSCHAPV2  (1 << 2)
25 #define SUPPLICANT_EAP_METHOD_PEAP      (1 << 3)
26 #define SUPPLICANT_EAP_METHOD_TTLS      (1 << 4)
27 #define SUPPLICANT_EAP_METHOD_GTC       (1 << 5)
28 #define SUPPLICANT_EAP_METHOD_OTP       (1 << 6)
29 #define SUPPLICANT_EAP_METHOD_LEAP      (1 << 7)
30
31 #define SUPPLICANT_CAPABILITY_KEYMGMT_NONE      (1 << 0)
32 #define SUPPLICANT_CAPABILITY_KEYMGMT_IEEE8021X (1 << 1)
33 #define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_NONE  (1 << 2)
34 #define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_PSK   (1 << 3)
35 #define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_EAP   (1 << 4)
36 #define SUPPLICANT_CAPABILITY_KEYMGMT_WPS       (1 << 5)
37
38 #define SUPPLICANT_CAPABILITY_AUTHALG_OPEN      (1 << 0)
39 #define SUPPLICANT_CAPABILITY_AUTHALG_SHARED    (1 << 1)
40 #define SUPPLICANT_CAPABILITY_AUTHALG_LEAP      (1 << 2)
41
42 #define SUPPLICANT_CAPABILITY_PROTO_WPA         (1 << 0)
43 #define SUPPLICANT_CAPABILITY_PROTO_RSN         (1 << 1)
44
45 #define SUPPLICANT_CAPABILITY_SCAN_ACTIVE       (1 << 0)
46 #define SUPPLICANT_CAPABILITY_SCAN_PASSIVE      (1 << 1)
47 #define SUPPLICANT_CAPABILITY_SCAN_SSID         (1 << 2)
48
49 #define SUPPLICANT_CAPABILITY_MODE_INFRA        (1 << 0)
50 #define SUPPLICANT_CAPABILITY_MODE_IBSS         (1 << 1)
51 #define SUPPLICANT_CAPABILITY_MODE_AP           (1 << 2)
52
53 enum supplicant_mode {
54         SUPPLICANT_MODE_UNKNOWN,
55         SUPPLICANT_MODE_INFRA,
56         SUPPLICANT_MODE_IBSS,
57 };
58
59 enum supplicant_security {
60         SUPPLICANT_SECURITY_UNKNOWN,
61         SUPPLICANT_SECURITY_NONE,
62         SUPPLICANT_SECURITY_WEP,
63         SUPPLICANT_SECURITY_PSK,
64         SUPPLICANT_SECURITY_IEEE8021X,
65 };
66
67 enum supplicant_state {
68         SUPPLICANT_STATE_UNKNOWN,
69         SUPPLICANT_STATE_DISCONNECTED,
70         SUPPLICANT_STATE_INACTIVE,
71         SUPPLICANT_STATE_SCANNING,
72         SUPPLICANT_STATE_AUTHENTICATING,
73         SUPPLICANT_STATE_ASSOCIATING,
74         SUPPLICANT_STATE_ASSOCIATED,
75         SUPPLICANT_STATE_4WAY_HANDSHAKE,
76         SUPPLICANT_STATE_GROUP_HANDSHAKE,
77         SUPPLICANT_STATE_COMPLETED,
78 };
79
80 struct supplicant_interface;
81
82 typedef void (* supplicant_interface_create_callback) (int result,
83                                 struct supplicant_interface *interface,
84                                                         void *user_data);
85 typedef void (* supplicant_interface_remove_callback) (int result,
86                                                         void *user_data);
87
88 int supplicant_interface_create(const char *ifname, const char *driver,
89                         supplicant_interface_create_callback callback,
90                                                         void *user_data);
91 int supplicant_interface_remove(struct supplicant_interface *interface,
92                         supplicant_interface_remove_callback callback,
93                                                         void *user_data);
94
95 const char *supplicant_interface_get_ifname(struct supplicant_interface *interface);
96
97 struct supplicant_network;
98
99 struct supplicant_interface *supplicant_network_get_interface(struct supplicant_network *network);
100 const char *supplicant_network_get_name(struct supplicant_network *network);
101 const char *supplicant_network_get_identifier(struct supplicant_network *network);
102 enum supplicant_mode supplicant_network_get_mode(struct supplicant_network *network);
103
104 struct supplicant_callbacks {
105         void (*system_ready) (void);
106         void (*system_killed) (void);
107         void (*interface_added) (struct supplicant_interface *interface);
108         void (*interface_removed) (struct supplicant_interface *interface);
109         void (*network_added) (struct supplicant_network *network);
110         void (*network_removed) (struct supplicant_network *network);
111 };
112
113 int supplicant_register(const struct supplicant_callbacks *callbacks);
114 void supplicant_unregister(const struct supplicant_callbacks *callbacks);
115
116 void supplicant_set_debug_level(unsigned int level);