#include "ubusd.h"
#include "ubusd_obj.h"
Go to the source code of this file.
◆ ubus_create_obj_method()
static bool ubus_create_obj_method |
( |
struct ubus_object_type * |
type, |
|
|
struct blob_attr * |
attr |
|
) |
| |
|
static |
Definition at line 37 of file ubusd_obj.c.
40 int bloblen = blob_raw_len(attr);
42 m = calloc(1,
sizeof(*m) + bloblen);
46 list_add_tail(&m->
list, &
type->methods);
47 memcpy(m->
data, attr, bloblen);
◆ ubus_create_obj_type()
Definition at line 53 of file ubusd_obj.c.
56 struct blob_attr *pos;
68 INIT_LIST_HEAD(&
type->methods);
70 blob_for_each_attr(pos, sig, rem) {
71 if (!blobmsg_check_attr(pos,
true))
bool ubus_alloc_id(struct avl_tree *tree, struct ubus_id *id, uint32_t val)
static bool ubus_create_obj_method(struct ubus_object_type *type, struct blob_attr *attr)
static void ubus_unref_object_type(struct ubus_object_type *type)
struct avl_tree obj_types
◆ ubus_get_obj_type()
Definition at line 89 of file ubusd_obj.c.
static struct ubus_id * ubus_find_id(struct avl_tree *tree, uint32_t id)
◆ ubus_subscribe()
Definition at line 172 of file ubusd_obj.c.
175 bool first = list_empty(&
target->subscribers);
177 s = calloc(1,
sizeof(*s));
183 list_add(&s->list, &
target->subscribers);
struct list_head subscribers target_list
struct ubus_object * target
struct list_head list target_list
struct ubus_object * subscriber
void ubus_notify_subscription(struct ubus_object *obj)
◆ ubus_unref_object_type()
Definition at line 21 of file ubusd_obj.c.
25 if (--
type->refcount > 0)
28 list_for_each_entry_safe(m, tmp, &
type->methods,
list) {
static void ubus_free_id(struct avl_tree *tree, struct ubus_id *id)
◆ ubus_unsubscribe()
Definition at line 190 of file ubusd_obj.c.
198 if (list_empty(&obj->subscribers))
◆ ubusd_create_object()
Definition at line 129 of file ubusd_obj.c.
154 if (avl_insert(&
path, &obj->
path) != 0) {
155 free((
void *) obj->
path.key);
156 obj->
path.key = NULL;
struct ubus_client * client
void ubusd_send_obj_event(struct ubus_object *obj, bool add)
int ubusd_acl_check(struct ubus_client *cl, const char *obj, const char *method, enum ubusd_acl_type type)
static struct ubus_object_type * ubus_create_obj_type(struct blob_attr *sig)
static struct ubus_object_type * ubus_get_obj_type(uint32_t obj_id)
struct ubus_object * ubusd_create_object_internal(struct ubus_object_type *type, uint32_t id)
void ubusd_free_object(struct ubus_object *obj)
◆ ubusd_create_object_internal()
Definition at line 103 of file ubusd_obj.c.
107 obj = calloc(1,
sizeof(*obj));
115 INIT_LIST_HEAD(&obj->
list);
116 INIT_LIST_HEAD(&obj->
events);
117 INIT_LIST_HEAD(&obj->subscribers);
struct ubus_object_type * type
◆ ubusd_free_object()
Definition at line 202 of file ubusd_obj.c.
209 list_for_each_entry_safe(s, tmp, &obj->subscribers, list) {
217 free((
void *) obj->
path.key);
219 if (!list_empty(&obj->
list))
220 list_del(&obj->
list);
void ubusd_event_cleanup_object(struct ubus_object *obj)
void ubus_unsubscribe(struct ubus_subscription *s)
void ubus_notify_unsubscribe(struct ubus_subscription *s)
◆ ubusd_obj_init()
static void __constructor ubusd_obj_init |
( |
void |
| ) |
|
|
static |
Definition at line 227 of file ubusd_obj.c.
void ubusd_event_init(void)
void ubusd_monitor_init(void)
void ubusd_acl_init(void)
void ubus_init_id_tree(struct avl_tree *tree)
void ubus_init_string_tree(struct avl_tree *tree, bool dup)
◆ obj_types
struct avl_tree obj_types |
◆ objects
◆ path