Remove obsolete file.
[connman] / plugins / fake.c
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 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <stdio.h>
27
28 #define CONNMAN_API_SUBJECT_TO_CHANGE
29 #include <connman/plugin.h>
30 #include <connman/device.h>
31 #include <connman/log.h>
32
33 static void create_network(struct connman_device *device, const char *name)
34 {
35         struct connman_network *network;
36
37         network = connman_network_create(name, CONNMAN_NETWORK_TYPE_VENDOR);
38         if (network == NULL)
39                 return;
40
41         connman_device_add_network(device, network);
42         connman_network_unref(network);
43 }
44
45 static int device_probe(struct connman_device *device)
46 {
47         DBG("");
48
49         return 0;
50 }
51
52 static void device_remove(struct connman_device *device)
53 {
54         DBG("");
55 }
56
57 static int device_enable(struct connman_device *device)
58 {
59         DBG("");
60
61         create_network(device, "network_one");
62         create_network(device, "network_two");
63
64         return 0;
65 }
66
67 static int device_disable(struct connman_device *device)
68 {
69         DBG("");
70
71         return 0;
72 }
73
74 static struct connman_device_driver device_driver = {
75         .name           = "fake",
76         .type           = CONNMAN_DEVICE_TYPE_VENDOR,
77         .probe          = device_probe,
78         .remove         = device_remove,
79         .enable         = device_enable,
80         .disable        = device_disable,
81 };
82
83 static void create_device(const char *name)
84 {
85         struct connman_device *device;
86
87         device = connman_device_create(name, CONNMAN_DEVICE_TYPE_VENDOR);
88         if (device == NULL)
89                 return;
90
91         connman_device_set_mode(device, CONNMAN_DEVICE_MODE_NETWORK_SINGLE);
92
93         connman_device_register(device);
94         connman_device_unref(device);
95 }
96
97 static int fake_init(void)
98 {
99         create_device("fake");
100
101         return connman_device_driver_register(&device_driver);
102 }
103
104 static void fake_exit(void)
105 {
106         connman_device_driver_unregister(&device_driver);
107 }
108
109 CONNMAN_PLUGIN_DEFINE(fake, "Tesing plugin", VERSION,
110                 CONNMAN_PLUGIN_PRIORITY_DEFAULT, fake_init, fake_exit)