Deleted Added
sdiff udiff text old ( 214501 ) new ( 252190 )
full compact
1/*
2 * wpa_supplicant - D-Bus introspection
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
4 * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
5 * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
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 * Alternatively, this software may be distributed under the terms of BSD
12 * license.
13 *
14 * See README and COPYING for more details.
15 */
16
17#include "utils/includes.h"
18
19#include "utils/common.h"
20#include "utils/list.h"
21#include "utils/wpabuf.h"
22#include "dbus_common_i.h"

--- 15 unchanged lines hidden (view full) ---

38 dl_list_for_each(iface, list, struct interfaces, list) {
39 if (os_strcmp(iface->dbus_interface, dbus_interface) == 0)
40 return iface; /* already in the list */
41 }
42
43 iface = os_zalloc(sizeof(struct interfaces));
44 if (!iface)
45 return NULL;
46 iface->xml = wpabuf_alloc(3000);
47 if (iface->xml == NULL) {
48 os_free(iface);
49 return NULL;
50 }
51 wpabuf_printf(iface->xml, "<interface name=\"%s\">", dbus_interface);
52 dl_list_add_tail(list, &iface->list);
53 iface->dbus_interface = os_strdup(dbus_interface);
54 return iface;

--- 29 unchanged lines hidden (view full) ---

84 }
85 wpabuf_printf(xml, "</%s>", type);
86}
87
88
89static void add_property(struct wpabuf *xml,
90 const struct wpa_dbus_property_desc *dsc)
91{
92 wpabuf_printf(xml, "<property name=\"%s\" type=\"%s\" access=\"%s\"/>",
93 dsc->dbus_property, dsc->type,
94 (dsc->access == R ? "read" :
95 (dsc->access == W ? "write" : "readwrite")));
96}
97
98
99static void extract_interfaces_methods(
100 struct dl_list *list, const struct wpa_dbus_method_desc *methods)
101{
102 const struct wpa_dbus_method_desc *dsc;
103 struct interfaces *iface;

--- 54 unchanged lines hidden (view full) ---

158
159static void add_interfaces(struct dl_list *list, struct wpabuf *xml)
160{
161 struct interfaces *iface, *n;
162 dl_list_for_each_safe(iface, n, list, struct interfaces, list) {
163 if (wpabuf_len(iface->xml) + 20 < wpabuf_tailroom(xml)) {
164 wpabuf_put_buf(xml, iface->xml);
165 wpabuf_put_str(xml, "</interface>");
166 }
167 dl_list_del(&iface->list);
168 wpabuf_free(iface->xml);
169 os_free(iface->dbus_interface);
170 os_free(iface);
171 }
172}
173

--- 71 unchanged lines hidden (view full) ---

245 */
246DBusMessage * wpa_dbus_introspect(DBusMessage *message,
247 struct wpa_dbus_object_desc *obj_dsc)
248{
249
250 DBusMessage *reply;
251 struct wpabuf *xml;
252
253 xml = wpabuf_alloc(4000);
254 if (xml == NULL)
255 return NULL;
256
257 wpabuf_put_str(xml, "<?xml version=\"1.0\"?>\n");
258 wpabuf_put_str(xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
259 wpabuf_put_str(xml, "<node>");
260
261 add_introspectable_interface(xml);

--- 17 unchanged lines hidden ---