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
[];
39 struct list_head watcher_list
, watched_list
;
40 struct ubus_object
*watcher
, *watched
;
46 struct list_head list
;
48 struct list_head events
;
50 struct list_head watchers
, watched
;
52 struct ubus_object_type
*type
;
55 struct ubus_client
*client
;
56 int (*recv_msg
)(struct ubus_client
*client
, const char *method
, struct blob_attr
*msg
);
59 unsigned int invoke_seq
;
62 struct ubus_object
*ubusd_create_object(struct ubus_client
*cl
, struct blob_attr
**attr
);
63 struct ubus_object
*ubusd_create_object_internal(struct ubus_object_type
*type
, uint32_t id
);
64 void ubusd_free_object(struct ubus_object
*obj
);
66 static inline struct ubus_object
*ubusd_find_object(uint32_t objid
)
68 struct ubus_object
*obj
;
71 id
= ubus_find_id(&objects
, objid
);
75 obj
= container_of(id
, struct ubus_object
, id
);
79 void ubus_watch_new(struct ubus_object
*obj
, struct ubus_object
*target
, const char *method
);
80 void ubus_watch_free(struct ubus_watch
*w
);
81 void ubus_proto_notify_watch(struct ubus_watch
*w
);