5 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
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.
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.
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
22 #ifndef __CONNMAN_ELEMENT_H
23 #define __CONNMAN_ELEMENT_H
32 #include <connman/property.h>
36 * @title: Element premitives
37 * @short_description: Functions for handling elements
40 enum connman_element_state {
41 CONNMAN_ELEMENT_STATE_UNKNOWN = 0,
42 CONNMAN_ELEMENT_STATE_CONNECT = 1,
43 CONNMAN_ELEMENT_STATE_CONNECTED = 2,
44 CONNMAN_ELEMENT_STATE_CLOSED = 3,
47 enum connman_element_policy {
48 CONNMAN_ELEMENT_POLICY_UNKNOWN = 0,
49 CONNMAN_ELEMENT_POLICY_IGNORE = 1,
50 CONNMAN_ELEMENT_POLICY_AUTO = 2,
51 CONNMAN_ELEMENT_POLICY_ASK = 3,
54 enum connman_element_type {
55 CONNMAN_ELEMENT_TYPE_UNKNOWN = 0,
56 CONNMAN_ELEMENT_TYPE_ROOT = 1,
57 CONNMAN_ELEMENT_TYPE_PROFILE = 2,
58 CONNMAN_ELEMENT_TYPE_DEVICE = 3,
59 CONNMAN_ELEMENT_TYPE_NETWORK = 4,
60 CONNMAN_ELEMENT_TYPE_SERVICE = 5,
61 CONNMAN_ELEMENT_TYPE_IPV4 = 6,
62 CONNMAN_ELEMENT_TYPE_IPV6 = 7,
63 CONNMAN_ELEMENT_TYPE_DHCP = 8,
64 CONNMAN_ELEMENT_TYPE_BOOTP = 9,
65 CONNMAN_ELEMENT_TYPE_ZEROCONF = 10,
67 CONNMAN_ELEMENT_TYPE_CONNECTION = 42,
70 enum connman_element_subtype {
71 CONNMAN_ELEMENT_SUBTYPE_UNKNOWN = 0,
72 CONNMAN_ELEMENT_SUBTYPE_FAKE = 1,
73 CONNMAN_ELEMENT_SUBTYPE_NETWORK = 2,
74 CONNMAN_ELEMENT_SUBTYPE_ETHERNET = 3,
75 CONNMAN_ELEMENT_SUBTYPE_WIFI = 4,
76 CONNMAN_ELEMENT_SUBTYPE_WIMAX = 5,
77 CONNMAN_ELEMENT_SUBTYPE_MODEM = 6,
78 CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH = 7,
81 struct connman_driver;
83 struct connman_element {
88 enum connman_element_type type;
89 enum connman_element_subtype subtype;
90 enum connman_element_state state;
91 enum connman_element_policy policy;
101 struct connman_element *parent;
103 struct connman_driver *driver;
106 void (*destruct) (struct connman_element *element);
110 struct connman_device *device;
130 extern struct connman_element *connman_element_create(const char *name);
131 extern struct connman_element *connman_element_ref(struct connman_element *element);
132 extern void connman_element_unref(struct connman_element *element);
134 extern int connman_element_add_static_property(struct connman_element *element,
135 const char *name, int type, const void *value);
136 extern int connman_element_set_static_property(struct connman_element *element,
137 const char *name, int type, const void *value);
138 extern int connman_element_add_static_array_property(struct connman_element *element,
139 const char *name, int type, const void *value, int len);
140 extern int connman_element_define_properties(struct connman_element *element, ...);
141 extern int connman_element_create_property(struct connman_element *element,
142 const char *name, int type);
143 extern int connman_element_set_property(struct connman_element *element,
144 enum connman_property_id id, const void *value);
145 extern int connman_element_get_value(struct connman_element *element,
146 enum connman_property_id id, void *value);
147 extern gboolean connman_element_get_static_property(struct connman_element *element,
148 const char *name, void *value);
149 extern gboolean connman_element_get_static_array_property(struct connman_element *element,
150 const char *name, void *value, int *len);
151 extern gboolean connman_element_match_static_property(struct connman_element *element,
152 const char *name, const void *value);
154 extern int connman_element_register(struct connman_element *element,
155 struct connman_element *parent);
156 extern void connman_element_unregister(struct connman_element *element);
157 extern void connman_element_unregister_children(struct connman_element *element);
158 extern void connman_element_update(struct connman_element *element);
160 extern int connman_element_set_enabled(struct connman_element *element,
162 extern int connman_element_set_scanning(struct connman_element *element,
165 static inline void *connman_element_get_data(struct connman_element *element)
167 return element->driver_data;
170 static inline void connman_element_set_data(struct connman_element *element,
173 element->driver_data = data;
180 #endif /* __CONNMAN_ELEMENT_H */