Fix some WPA Enterprise privacy issues
[platform/upstream/connman.git] / plugins / hso.c
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2010  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 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <stdio.h>
27 #include <errno.h>
28 #include <string.h>
29
30 #include <glib.h>
31
32 #define CONNMAN_API_SUBJECT_TO_CHANGE
33 #include <connman/plugin.h>
34 #include <connman/device.h>
35 #include <connman/log.h>
36
37 struct hso_data {
38         int index;
39 };
40
41 static int hso_probe(struct connman_device *device)
42 {
43         struct hso_data *data;
44
45         DBG("device %p", device);
46
47         data = g_try_new0(struct hso_data, 1);
48         if (data == NULL)
49                 return -ENOMEM;
50
51         data->index = connman_device_get_index(device);
52
53         connman_device_set_data(device, data);
54
55         return 0;
56 }
57
58 static void hso_remove(struct connman_device *device)
59 {
60         struct hso_data *data = connman_device_get_data(device);
61
62         DBG("device %p", device);
63
64         connman_device_set_data(device, NULL);
65
66         g_free(data);
67 }
68
69 static int hso_enable(struct connman_device *device)
70 {
71         DBG("device %p", device);
72
73         connman_device_set_powered(device, TRUE);
74
75         return 0;
76 }
77
78 static int hso_disable(struct connman_device *device)
79 {
80         DBG("device %p", device);
81
82         connman_device_set_powered(device, FALSE);
83
84         return 0;
85 }
86
87 static struct connman_device_driver hso_driver = {
88         .name           = "hso",
89         .type           = CONNMAN_DEVICE_TYPE_HSO,
90         .probe          = hso_probe,
91         .remove         = hso_remove,
92         .enable         = hso_enable,
93         .disable        = hso_disable,
94 };
95
96 static int hso_init(void)
97 {
98         return connman_device_driver_register(&hso_driver);
99 }
100
101 static void hso_exit(void)
102 {
103         connman_device_driver_unregister(&hso_driver);
104 }
105
106 CONNMAN_PLUGIN_DEFINE(hso, "Option HSO device plugin", VERSION,
107                 CONNMAN_PLUGIN_PRIORITY_DEFAULT, hso_init, hso_exit)