summaryrefslogtreecommitdiff
path: root/tools/supplicant.h
blob: b0fdef92afacad69cb4c0345028e4f44585f93e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 *
 *  Connection Manager
 *
 *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#define SUPPLICANT_EAP_METHOD_MD5	(1 << 0)
#define SUPPLICANT_EAP_METHOD_TLS	(1 << 1)
#define SUPPLICANT_EAP_METHOD_MSCHAPV2	(1 << 2)
#define SUPPLICANT_EAP_METHOD_PEAP	(1 << 3)
#define SUPPLICANT_EAP_METHOD_TTLS	(1 << 4)
#define SUPPLICANT_EAP_METHOD_GTC	(1 << 5)
#define SUPPLICANT_EAP_METHOD_OTP	(1 << 6)
#define SUPPLICANT_EAP_METHOD_LEAP	(1 << 7)

#define SUPPLICANT_CAPABILITY_KEYMGMT_NONE	(1 << 0)
#define SUPPLICANT_CAPABILITY_KEYMGMT_IEEE8021X	(1 << 1)
#define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_NONE	(1 << 2)
#define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_PSK	(1 << 3)
#define SUPPLICANT_CAPABILITY_KEYMGMT_WPA_EAP	(1 << 4)
#define SUPPLICANT_CAPABILITY_KEYMGMT_WPS	(1 << 5)

#define SUPPLICANT_CAPABILITY_AUTHALG_OPEN	(1 << 0)
#define SUPPLICANT_CAPABILITY_AUTHALG_SHARED	(1 << 1)
#define SUPPLICANT_CAPABILITY_AUTHALG_LEAP	(1 << 2)

#define SUPPLICANT_CAPABILITY_PROTO_WPA		(1 << 0)
#define SUPPLICANT_CAPABILITY_PROTO_RSN		(1 << 1)

#define SUPPLICANT_CAPABILITY_SCAN_ACTIVE	(1 << 0)
#define SUPPLICANT_CAPABILITY_SCAN_PASSIVE	(1 << 1)
#define SUPPLICANT_CAPABILITY_SCAN_SSID		(1 << 2)

#define SUPPLICANT_CAPABILITY_MODE_INFRA	(1 << 0)
#define SUPPLICANT_CAPABILITY_MODE_IBSS		(1 << 1)
#define SUPPLICANT_CAPABILITY_MODE_AP		(1 << 2)

enum supplicant_mode {
	SUPPLICANT_MODE_UNKNOWN,
	SUPPLICANT_MODE_INFRA,
	SUPPLICANT_MODE_IBSS,
};

enum supplicant_security {
	SUPPLICANT_SECURITY_UNKNOWN,
	SUPPLICANT_SECURITY_NONE,
	SUPPLICANT_SECURITY_WEP,
	SUPPLICANT_SECURITY_PSK,
	SUPPLICANT_SECURITY_IEEE8021X,
};

enum supplicant_state {
	SUPPLICANT_STATE_UNKNOWN,
	SUPPLICANT_STATE_DISCONNECTED,
	SUPPLICANT_STATE_INACTIVE,
	SUPPLICANT_STATE_SCANNING,
	SUPPLICANT_STATE_AUTHENTICATING,
	SUPPLICANT_STATE_ASSOCIATING,
	SUPPLICANT_STATE_ASSOCIATED,
	SUPPLICANT_STATE_4WAY_HANDSHAKE,
	SUPPLICANT_STATE_GROUP_HANDSHAKE,
	SUPPLICANT_STATE_COMPLETED,
};

struct supplicant_interface;

typedef void (* supplicant_interface_create_callback) (int result,
				struct supplicant_interface *interface,
							void *user_data);
typedef void (* supplicant_interface_remove_callback) (int result,
							void *user_data);

int supplicant_interface_create(const char *ifname, const char *driver,
			supplicant_interface_create_callback callback,
							void *user_data);
int supplicant_interface_remove(struct supplicant_interface *interface,
			supplicant_interface_remove_callback callback,
							void *user_data);

const char *supplicant_interface_get_ifname(struct supplicant_interface *interface);

struct supplicant_network;

struct supplicant_interface *supplicant_network_get_interface(struct supplicant_network *network);
const char *supplicant_network_get_name(struct supplicant_network *network);
const char *supplicant_network_get_identifier(struct supplicant_network *network);
enum supplicant_mode supplicant_network_get_mode(struct supplicant_network *network);

struct supplicant_callbacks {
	void (*system_ready) (void);
	void (*system_killed) (void);
	void (*interface_added) (struct supplicant_interface *interface);
	void (*interface_removed) (struct supplicant_interface *interface);
	void (*network_added) (struct supplicant_network *network);
	void (*network_removed) (struct supplicant_network *network);
};

int supplicant_register(const struct supplicant_callbacks *callbacks);
void supplicant_unregister(const struct supplicant_callbacks *callbacks);

void supplicant_set_debug_level(unsigned int level);