5 * Copyright (C) 2007-2009 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>
33 #include <connman/ipv4.h>
37 * @title: Element premitives
38 * @short_description: Functions for handling elements
41 enum connman_element_type {
42 CONNMAN_ELEMENT_TYPE_UNKNOWN = 0,
43 CONNMAN_ELEMENT_TYPE_ROOT = 1,
44 CONNMAN_ELEMENT_TYPE_PROFILE = 2,
45 CONNMAN_ELEMENT_TYPE_DEVICE = 3,
46 CONNMAN_ELEMENT_TYPE_NETWORK = 4,
47 CONNMAN_ELEMENT_TYPE_SERVICE = 5,
48 CONNMAN_ELEMENT_TYPE_PPP = 6,
49 CONNMAN_ELEMENT_TYPE_IPV4 = 7,
50 CONNMAN_ELEMENT_TYPE_IPV6 = 8,
51 CONNMAN_ELEMENT_TYPE_DHCP = 9,
52 CONNMAN_ELEMENT_TYPE_BOOTP = 10,
53 CONNMAN_ELEMENT_TYPE_ZEROCONF = 11,
54 CONNMAN_ELEMENT_TYPE_CONNECTION = 42,
55 CONNMAN_ELEMENT_TYPE_VENDOR = 10000,
58 struct connman_driver;
60 struct connman_element {
65 enum connman_element_type type;
71 struct connman_element *parent;
73 struct connman_driver *driver;
76 void (*destruct) (struct connman_element *element);
80 struct connman_device *device;
81 struct connman_network *network;
87 enum connman_ipv4_method method;
97 extern struct connman_element *connman_element_create(const char *name);
98 extern struct connman_element *connman_element_ref(struct connman_element *element);
99 extern void connman_element_unref(struct connman_element *element);
101 extern int connman_element_add_static_property(struct connman_element *element,
102 const char *name, int type, const void *value);
103 extern int connman_element_set_static_property(struct connman_element *element,
104 const char *name, int type, const void *value);
105 extern int connman_element_add_static_array_property(struct connman_element *element,
106 const char *name, int type, const void *value, int len);
107 extern int connman_element_define_properties(struct connman_element *element, ...);
108 extern int connman_element_create_property(struct connman_element *element,
109 const char *name, int type);
110 extern int connman_element_set_property(struct connman_element *element,
111 enum connman_property_id id, const void *value);
112 extern int connman_element_get_value(struct connman_element *element,
113 enum connman_property_id id, void *value);
114 extern gboolean connman_element_get_static_property(struct connman_element *element,
115 const char *name, void *value);
116 extern gboolean connman_element_get_static_array_property(struct connman_element *element,
117 const char *name, void *value, int *len);
118 extern gboolean connman_element_match_static_property(struct connman_element *element,
119 const char *name, const void *value);
121 extern int connman_element_register(struct connman_element *element,
122 struct connman_element *parent);
123 extern void connman_element_unregister(struct connman_element *element);
124 extern void connman_element_unregister_children(struct connman_element *element);
125 extern void connman_element_update(struct connman_element *element);
127 extern int connman_element_set_enabled(struct connman_element *element,
129 extern int connman_element_set_scanning(struct connman_element *element,
132 static inline void *connman_element_get_data(struct connman_element *element)
134 return element->driver_data;
137 static inline void connman_element_set_data(struct connman_element *element,
140 element->driver_data = data;
147 #endif /* __CONNMAN_ELEMENT_H */