Add initial implementation for uDHCP support
[connman] / plugins / supplicant.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2008  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 #include <connman/device.h>
23 #include <connman/element.h>
24
25 #define SUPPLICANT_NAME  "fi.epitest.hostap.WPASupplicant"
26 #define SUPPLICANT_INTF  "fi.epitest.hostap.WPASupplicant"
27 #define SUPPLICANT_PATH  "/fi/epitest/hostap/WPASupplicant"
28
29 enum supplicant_state {
30         STATE_INACTIVE,
31         STATE_SCANNING,
32         STATE_ASSOCIATING,
33         STATE_ASSOCIATED,
34         STATE_4WAY_HANDSHAKE,
35         STATE_GROUP_HANDSHAKE,
36         STATE_COMPLETED,
37         STATE_DISCONNECTED,
38 };
39
40 struct supplicant_network {
41         gchar *identifier;
42         guint8 *ssid;
43         guint ssid_len;
44         guint16 capabilities;
45         gboolean adhoc;
46         gboolean has_wep;
47         gboolean has_wpa;
48         gboolean has_rsn;
49         gint32 quality;
50         gint32 noise;
51         gint32 level;
52         gint32 maxrate;
53 };
54
55 struct supplicant_callback {
56         void (*state_change) (struct connman_device *device,
57                                                 enum supplicant_state state);
58         void (*clear_results) (struct connman_device *device);
59         void (*scan_result) (struct connman_device *device,
60                                         struct supplicant_network *network);
61 };
62
63 void __supplicant_activate(DBusConnection *conn);
64
65 int __supplicant_init(DBusConnection *conn);
66 void __supplicant_exit(void);
67
68 int __supplicant_start(struct connman_device *device,
69                                         struct supplicant_callback *callback);
70 int __supplicant_stop(struct connman_device *device);
71
72 int __supplicant_scan(struct connman_device *device);
73
74 int __supplicant_connect(struct connman_element *element,
75                                 const unsigned char *ssid, int ssid_len,
76                                 const char *security, const char *passphrase);
77 int __supplicant_disconnect(struct connman_element *element);