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;
123 extern struct connman_element *connman_element_create(const char *name);
124 extern struct connman_element *connman_element_ref(struct connman_element *element);
125 extern void connman_element_unref(struct connman_element *element);
127 extern int connman_element_add_static_property(struct connman_element *element,
128 const char *name, int type, const void *value);
129 extern int connman_element_set_static_property(struct connman_element *element,
130 const char *name, int type, const void *value);
131 extern int connman_element_add_static_array_property(struct connman_element *element,
132 const char *name, int type, const void *value, int len);
133 extern int connman_element_define_properties(struct connman_element *element, ...);
134 extern int connman_element_create_property(struct connman_element *element,
135 const char *name, int type);
136 extern int connman_element_set_property(struct connman_element *element,
137 enum connman_property_id id, const void *value);
138 extern int connman_element_get_value(struct connman_element *element,
139 enum connman_property_id id, void *value);
140 extern gboolean connman_element_get_static_property(struct connman_element *element,
141 const char *name, void *value);
142 extern gboolean connman_element_get_static_array_property(struct connman_element *element,
143 const char *name, void *value, int *len);
144 extern gboolean connman_element_match_static_property(struct connman_element *element,
145 const char *name, const void *value);
147 extern int connman_element_register(struct connman_element *element,
148 struct connman_element *parent);
149 extern void connman_element_unregister(struct connman_element *element);
150 extern void connman_element_unregister_children(struct connman_element *element);
151 extern void connman_element_update(struct connman_element *element);
153 extern int connman_element_set_enabled(struct connman_element *element,
155 extern int connman_element_set_scanning(struct connman_element *element,
158 static inline void *connman_element_get_data(struct connman_element *element)
160 return element->driver_data;
163 static inline void connman_element_set_data(struct connman_element *element,
166 element->driver_data = data;
173 #endif /* __CONNMAN_ELEMENT_H */