f4d01c6dc7c59dd080cc0e88619de7464b51ebec
[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_AUTH_OPEN         (1 << 0)
32 #define SUPPLICANT_CAPABILITY_AUTH_SHARED       (1 << 1)
33 #define SUPPLICANT_CAPABILITY_AUTH_LEAP         (1 << 2)
34
35 #define SUPPLICANT_CAPABILITY_SCAN_ACTIVE       (1 << 0)
36 #define SUPPLICANT_CAPABILITY_SCAN_PASSIVE      (1 << 1)
37 #define SUPPLICANT_CAPABILITY_SCAN_SSID         (1 << 2)
38
39 #define SUPPLICANT_CAPABILITY_MODE_INFRA        (1 << 0)
40 #define SUPPLICANT_CAPABILITY_MODE_IBSS         (1 << 1)
41 #define SUPPLICANT_CAPABILITY_MODE_AP           (1 << 2)
42
43 enum supplicant_mode {
44         SUPPLICANT_MODE_UNKNOWN,
45         SUPPLICANT_MODE_INFRA,
46         SUPPLICANT_MODE_IBSS,
47 };
48
49 enum supplicant_security {
50         SUPPLICANT_SECURITY_UNKNOWN,
51         SUPPLICANT_SECURITY_NONE,
52         SUPPLICANT_SECURITY_WEP,
53         SUPPLICANT_SECURITY_PSK,
54         SUPPLICANT_SECURITY_IEEE8021X,
55 };
56
57 enum supplicant_state {
58         SUPPLICANT_STATE_UNKNOWN,
59         SUPPLICANT_STATE_DISCONNECTED,
60         SUPPLICANT_STATE_INACTIVE,
61         SUPPLICANT_STATE_SCANNING,
62         SUPPLICANT_STATE_AUTHENTICATING,
63         SUPPLICANT_STATE_ASSOCIATING,
64         SUPPLICANT_STATE_ASSOCIATED,
65         SUPPLICANT_STATE_4WAY_HANDSHAKE,
66         SUPPLICANT_STATE_GROUP_HANDSHAKE,
67         SUPPLICANT_STATE_COMPLETED,
68 };
69
70 struct supplicant_interface;
71
72 const char *supplicant_interface_get_ifname(struct supplicant_interface *interface);
73
74 struct supplicant_network;
75
76 struct supplicant_interface *supplicant_network_get_interface(struct supplicant_network *network);
77 const char *supplicant_network_get_name(struct supplicant_network *network);
78 const char *supplicant_network_get_identifier(struct supplicant_network *network);
79 enum supplicant_mode supplicant_network_get_mode(struct supplicant_network *network);
80
81 struct supplicant_callbacks {
82         void (*system_ready) (void);
83         void (*system_killed) (void);
84         void (*interface_added) (struct supplicant_interface *interface);
85         void (*interface_removed) (struct supplicant_interface *interface);
86         void (*network_added) (struct supplicant_network *network);
87         void (*network_removed) (struct supplicant_network *network);
88 };
89
90 int supplicant_register(const struct supplicant_callbacks *callbacks);
91 void supplicant_unregister(const struct supplicant_callbacks *callbacks);
92
93 void supplicant_set_debug_level(unsigned int level);
94 void supplicant_set_debug_show_timestamps(dbus_bool_t enabled);