dbus_new_introspect.c (214501) | dbus_new_introspect.c (252190) |
---|---|
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 * | 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. | 7 * This software may be distributed under the terms of the BSD license. 8 * See README 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; | 9 */ 10 11#include "utils/includes.h" 12 13#include "utils/common.h" 14#include "utils/list.h" 15#include "utils/wpabuf.h" 16#include "dbus_common_i.h" --- 15 unchanged lines hidden (view full) --- 32 dl_list_for_each(iface, list, struct interfaces, list) { 33 if (os_strcmp(iface->dbus_interface, dbus_interface) == 0) 34 return iface; /* already in the list */ 35 } 36 37 iface = os_zalloc(sizeof(struct interfaces)); 38 if (!iface) 39 return NULL; |
46 iface->xml = wpabuf_alloc(3000); | 40 iface->xml = wpabuf_alloc(6000); |
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{ | 41 if (iface->xml == NULL) { 42 os_free(iface); 43 return NULL; 44 } 45 wpabuf_printf(iface->xml, "<interface name=\"%s\">", dbus_interface); 46 dl_list_add_tail(list, &iface->list); 47 iface->dbus_interface = os_strdup(dbus_interface); 48 return iface; --- 29 unchanged lines hidden (view full) --- 78 } 79 wpabuf_printf(xml, "</%s>", type); 80} 81 82 83static void add_property(struct wpabuf *xml, 84 const struct wpa_dbus_property_desc *dsc) 85{ |
92 wpabuf_printf(xml, "<property name=\"%s\" type=\"%s\" access=\"%s\"/>", | 86 wpabuf_printf(xml, "<property name=\"%s\" type=\"%s\" " 87 "access=\"%s%s\"/>", |
93 dsc->dbus_property, dsc->type, | 88 dsc->dbus_property, dsc->type, |
94 (dsc->access == R ? "read" : 95 (dsc->access == W ? "write" : "readwrite"))); | 89 dsc->getter ? "read" : "", 90 dsc->setter ? "write" : ""); |
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>"); | 91} 92 93 94static void extract_interfaces_methods( 95 struct dl_list *list, const struct wpa_dbus_method_desc *methods) 96{ 97 const struct wpa_dbus_method_desc *dsc; 98 struct interfaces *iface; --- 54 unchanged lines hidden (view full) --- 153 154static void add_interfaces(struct dl_list *list, struct wpabuf *xml) 155{ 156 struct interfaces *iface, *n; 157 dl_list_for_each_safe(iface, n, list, struct interfaces, list) { 158 if (wpabuf_len(iface->xml) + 20 < wpabuf_tailroom(xml)) { 159 wpabuf_put_buf(xml, iface->xml); 160 wpabuf_put_str(xml, "</interface>"); |
161 } else { 162 wpa_printf(MSG_DEBUG, "dbus: Not enough room for " 163 "add_interfaces inspect data: tailroom %u, " 164 "add %u", 165 (unsigned int) wpabuf_tailroom(xml), 166 (unsigned int) wpabuf_len(iface->xml)); |
|
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 | 167 } 168 dl_list_del(&iface->list); 169 wpabuf_free(iface->xml); 170 os_free(iface->dbus_interface); 171 os_free(iface); 172 } 173} 174 --- 71 unchanged lines hidden (view full) --- 246 */ 247DBusMessage * wpa_dbus_introspect(DBusMessage *message, 248 struct wpa_dbus_object_desc *obj_dsc) 249{ 250 251 DBusMessage *reply; 252 struct wpabuf *xml; 253 |
253 xml = wpabuf_alloc(4000); | 254 xml = wpabuf_alloc(10000); |
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 --- | 255 if (xml == NULL) 256 return NULL; 257 258 wpabuf_put_str(xml, "<?xml version=\"1.0\"?>\n"); 259 wpabuf_put_str(xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE); 260 wpabuf_put_str(xml, "<node>"); 261 262 add_introspectable_interface(xml); --- 17 unchanged lines hidden --- |