16 #include <libubox/blob.h>
17 #include <libubox/blobmsg.h>
20 #include <libubox/avl-cmp.h>
26 static int acl_cmp(
const void *k1,
const void *k2,
void *ptr)
33 ret = strcmp(key1->
user, key2->
user);
57 [
ACL_OBJ_USER] = { .name =
"user", .type = BLOBMSG_TYPE_STRING },
58 [
ACL_OBJ_GROUP] = { .name =
"group", .type = BLOBMSG_TYPE_STRING },
59 [
ACL_OBJ_ACL] = { .name =
"acl", .type = BLOBMSG_TYPE_TABLE },
69 blobmsg_data_len(obj));
77 acl = calloc(1,
sizeof(*
acl));
101 int type,
struct blob_attr *msg)
104 struct blob_attr *cur;
118 blobmsg_data_len(msg));
135 const char *
type,
struct blob_attr *msg)
137 if (strcmp(
type,
"ubus.acl.sequence"))
static struct ubus_context * ctx
static void acl_add(struct blob_attr *obj)
static struct ubus_event_handler acl_event
static const struct blobmsg_policy acl_obj_policy[__ACL_OBJ_MAX]
static const struct blobmsg_policy acl_policy[__ACL_POLICY_MAX]
int ubus_register_acl(struct ubus_context *ctx)
static void acl_subscribe_cb(struct ubus_context *ctx, struct ubus_event_handler *ev, const char *type, struct blob_attr *msg)
static struct blob_attr * acl_blob
static void acl_recv_cb(struct ubus_request *req, int type, struct blob_attr *msg)
static void acl_query(struct ubus_context *ctx)
static struct ubus_request acl_req
AVL_TREE(acl_objects, acl_cmp, true, NULL)
static int acl_cmp(const void *k1, const void *k2, void *ptr)
void ubus_complete_request_async(struct ubus_context *ctx, struct ubus_request *req)
int ubus_register_event_handler(struct ubus_context *ctx, struct ubus_event_handler *ev, const char *pattern)
struct avl_tree acl_objects
static int ubus_invoke_async(struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, struct ubus_request *req)
ubus_data_handler_t data_cb
#define UBUS_SYSTEM_OBJECT_ACL