Add interface and network handling to supplicant test program
[platform/upstream/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_SCAN_ACTIVE       (1 << 0)
32 #define SUPPLICANT_CAPABILITY_SCAN_PASSIVE      (1 << 1)
33 #define SUPPLICANT_CAPABILITY_SCAN_SSID         (1 << 2)
34
35 enum supplicant_state {
36         SUPPLICANT_STATE_UNKNOWN,
37         SUPPLICANT_STATE_DISCONNECTED,
38         SUPPLICANT_STATE_INACTIVE,
39         SUPPLICANT_STATE_SCANNING,
40         SUPPLICANT_STATE_AUTHENTICATING,
41         SUPPLICANT_STATE_ASSOCIATING,
42         SUPPLICANT_STATE_ASSOCIATED,
43         SUPPLICANT_STATE_4WAY_HANDSHAKE,
44         SUPPLICANT_STATE_GROUP_HANDSHAKE,
45         SUPPLICANT_STATE_COMPLETED,
46 };
47
48 struct supplicant_interface;
49
50 const char *supplicant_interface_get_ifname(struct supplicant_interface *interface);
51
52 struct supplicant_network;
53
54 enum supplicant_network_mode {
55         SUPPLICANT_NETWORK_MODE_UNKNOWN,
56         SUPPLICANT_NETWORK_MODE_INFRA,
57         SUPPLICANT_NETWORK_MODE_ADHOC,
58 };
59
60 struct supplicant_interface *supplicant_network_get_interface(struct supplicant_network *network);
61 const char *supplicant_network_get_name(struct supplicant_network *network);
62 enum supplicant_network_mode supplicant_network_get_mode(struct supplicant_network *network);
63
64 struct supplicant_callbacks {
65         void (*interface_added) (struct supplicant_interface *interface);
66         void (*interface_removed) (struct supplicant_interface *interface);
67         void (*network_added) (struct supplicant_network *network);
68         void (*network_removed) (struct supplicant_network *network);
69 };
70
71 int supplicant_register(const struct supplicant_callbacks *callbacks);
72 void supplicant_unregister(const struct supplicant_callbacks *callbacks);