2 * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2.1
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
19 extern struct avl_tree obj_types;
20 extern struct avl_tree objects;
21 extern struct avl_tree path;
26 struct ubus_object_type {
29 struct list_head methods;
33 struct list_head list;
35 struct blob_attr data[];
40 struct list_head list;
42 struct list_head events;
44 struct ubus_object_type *type;
47 struct ubus_client *client;
48 int (*recv_msg)(struct ubus_client *client, const char *method, struct blob_attr *msg);
53 struct ubus_object *ubusd_create_object(struct ubus_client *cl, struct blob_attr **attr);
54 struct ubus_object *ubusd_create_object_internal(struct ubus_object_type *type, uint32_t id);
55 void ubusd_free_object(struct ubus_object *obj);
57 static inline struct ubus_object *ubusd_find_object(uint32_t objid)
59 struct ubus_object *obj;
62 id = ubus_find_id(&objects, objid);
66 obj = container_of(id, struct ubus_object, id);