summaryrefslogtreecommitdiff
path: root/include/device.h
blob: 31531481220429b3926248e4001c1f3952daf824 (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
/*
 *
 *  Connection Manager
 *
 *  Copyright (C) 2007-2008  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
 *
 */

#ifndef __CONNMAN_DEVICE_H
#define __CONNMAN_DEVICE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <connman/element.h>

/**
 * SECTION:device
 * @title: Device driver premitives
 * @short_description: Functions for registering device drivers
 */

enum connman_device_type {
	CONNMAN_DEVICE_TYPE_UNKNOWN   = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN,
	CONNMAN_DEVICE_TYPE_FAKE      = CONNMAN_ELEMENT_SUBTYPE_FAKE,
	CONNMAN_DEVICE_TYPE_ETHERNET  = CONNMAN_ELEMENT_SUBTYPE_ETHERNET,
	CONNMAN_DEVICE_TYPE_WIFI      = CONNMAN_ELEMENT_SUBTYPE_WIFI,
	CONNMAN_DEVICE_TYPE_WIMAX     = CONNMAN_ELEMENT_SUBTYPE_WIMAX,
	CONNMAN_DEVICE_TYPE_MODEM     = CONNMAN_ELEMENT_SUBTYPE_MODEM,
	CONNMAN_DEVICE_TYPE_BLUETOOTH = CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH,
};

enum connman_device_capabilities {
	CONNMAN_DEVICE_CAPABILITY_SCANNING = (1 << 0),
};

enum connman_device_policy {
	CONNMAN_DEVICE_POLICY_UNKNOWN = 0,
	CONNMAN_DEVICE_POLICY_IGNORE  = 1,
	CONNMAN_DEVICE_POLICY_AUTO    = 2,
	CONNMAN_DEVICE_POLICY_OFF     = 3,
};

enum connman_device_state {
	CONNMAN_DEVICE_STATE_UNKNOWN = 0,
	CONNMAN_DEVICE_STATE_OFF     = 1,
};

struct connman_device_driver;

struct connman_device {
	struct connman_element *element;
	unsigned long capabilities;
	enum connman_device_policy policy;
	enum connman_device_state state;

	struct connman_device_driver *driver;
	void *driver_data;

	GSList *networks;
};

extern int connman_device_set_enabled(struct connman_device *device,
							gboolean enabled);

struct connman_device_driver {
	const char *name;
	enum connman_device_type type;
	int priority;
	int (*probe) (struct connman_device *device);
	void (*remove) (struct connman_device *device);
	int (*scan) (struct connman_device *device);
};

extern int connman_device_driver_register(struct connman_device_driver *driver);
extern void connman_device_driver_unregister(struct connman_device_driver *driver);

#ifdef __cplusplus
}
#endif

#endif /* __CONNMAN_DEVICE_H */