Ubus
OpenWrt system message/RPC bus.
|
#include <libubox/avl.h>
#include <libubox/list.h>
#include <libubox/blobmsg.h>
#include <libubox/uloop.h>
#include <stdint.h>
#include "ubusmsg.h"
#include "ubus_common.h"
Go to the source code of this file.
Data Structures | |
struct | ubus_msghdr_buf |
struct | ubus_method |
struct | ubus_object_type |
struct | ubus_object |
struct | ubus_subscriber |
struct | ubus_event_handler |
struct | ubus_context |
struct | ubus_object_data |
struct | ubus_acl_key |
struct | ubus_request_data |
struct | ubus_request |
struct | ubus_notify_request |
struct | ubus_auto_conn |
struct | acl_object |
Macros | |
#define | UBUS_MAX_NOTIFY_PEERS 16 |
#define | UBUS_OBJECT_TYPE(_name, _methods) |
#define | __UBUS_METHOD_NOARG(_name, _handler, _tags) |
#define | __UBUS_METHOD(_name, _handler, _policy, _tags) |
#define | UBUS_METHOD(_name, _handler, _policy) { __UBUS_METHOD(_name, _handler, _policy, 0) } |
#define | UBUS_METHOD_TAG(_name, _handler, _policy, _tags) { __UBUS_METHOD(_name, _handler, _policy, _tags) } |
#define | UBUS_METHOD_MASK(_name, _handler, _policy, _mask) |
#define | UBUS_METHOD_NOARG(_name, _handler) { __UBUS_METHOD_NOARG(_name, _handler, 0) } |
#define | UBUS_METHOD_TAG_NOARG(_name, _handler, _tags) { __UBUS_METHOD_NOARG(_name, _handler, _tags) } |
#define | UBUS_TAG_STATUS BIT(0) |
#define | UBUS_TAG_ADMIN BIT(1) |
#define | UBUS_TAG_PRIVATE BIT(2) |
#define | acl_for_each(o, m) |
Typedefs | |
typedef void(* | ubus_lookup_handler_t) (struct ubus_context *ctx, struct ubus_object_data *obj, void *priv) |
typedef int(* | ubus_handler_t) (struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) |
typedef void(* | ubus_state_handler_t) (struct ubus_context *ctx, struct ubus_object *obj) |
typedef void(* | ubus_remove_handler_t) (struct ubus_context *ctx, struct ubus_subscriber *obj, uint32_t id) |
typedef void(* | ubus_event_handler_t) (struct ubus_context *ctx, struct ubus_event_handler *ev, const char *type, struct blob_attr *msg) |
typedef void(* | ubus_data_handler_t) (struct ubus_request *req, int type, struct blob_attr *msg) |
typedef void(* | ubus_fd_handler_t) (struct ubus_request *req, int fd) |
typedef void(* | ubus_complete_handler_t) (struct ubus_request *req, int ret) |
typedef void(* | ubus_notify_complete_handler_t) (struct ubus_notify_request *req, int idx, int ret) |
typedef void(* | ubus_notify_data_handler_t) (struct ubus_notify_request *req, int type, struct blob_attr *msg) |
typedef void(* | ubus_connect_handler_t) (struct ubus_context *ctx) |
typedef bool(* | ubus_new_object_handler_t) (struct ubus_context *ctx, struct ubus_subscriber *sub, const char *path) |
Functions | |
struct ubus_context * | ubus_connect (const char *path) |
int | ubus_connect_ctx (struct ubus_context *ctx, const char *path) |
void | ubus_auto_connect (struct ubus_auto_conn *conn) |
int | ubus_reconnect (struct ubus_context *ctx, const char *path) |
void | ubus_free (struct ubus_context *ctx) |
void | ubus_shutdown (struct ubus_context *ctx) |
static void | ubus_auto_shutdown (struct ubus_auto_conn *conn) |
const char * | ubus_strerror (int error) |
static void | ubus_add_uloop (struct ubus_context *ctx) |
static void | ubus_handle_event (struct ubus_context *ctx) |
int | ubus_complete_request (struct ubus_context *ctx, struct ubus_request *req, int timeout) |
void | ubus_complete_request_async (struct ubus_context *ctx, struct ubus_request *req) |
void | ubus_abort_request (struct ubus_context *ctx, struct ubus_request *req) |
int | ubus_lookup (struct ubus_context *ctx, const char *path, ubus_lookup_handler_t cb, void *priv) |
int | ubus_lookup_id (struct ubus_context *ctx, const char *path, uint32_t *id) |
int | ubus_add_object (struct ubus_context *ctx, struct ubus_object *obj) |
int | ubus_remove_object (struct ubus_context *ctx, struct ubus_object *obj) |
int | ubus_register_subscriber (struct ubus_context *ctx, struct ubus_subscriber *obj) |
static int | ubus_unregister_subscriber (struct ubus_context *ctx, struct ubus_subscriber *obj) |
int | ubus_subscribe (struct ubus_context *ctx, struct ubus_subscriber *obj, uint32_t id) |
int | ubus_unsubscribe (struct ubus_context *ctx, struct ubus_subscriber *obj, uint32_t id) |
int | __ubus_monitor (struct ubus_context *ctx, const char *type) |
static int | ubus_monitor_start (struct ubus_context *ctx) |
static int | ubus_monitor_stop (struct ubus_context *ctx) |
int | ubus_register_acl (struct ubus_context *ctx) |
int | ubus_invoke_fd (struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, ubus_data_handler_t cb, void *priv, int timeout, int fd) |
static int | ubus_invoke (struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, ubus_data_handler_t cb, void *priv, int timeout) |
int | ubus_invoke_async_fd (struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, struct ubus_request *req, int fd) |
static int | ubus_invoke_async (struct ubus_context *ctx, uint32_t obj, const char *method, struct blob_attr *msg, struct ubus_request *req) |
int | ubus_send_reply (struct ubus_context *ctx, struct ubus_request_data *req, struct blob_attr *msg) |
static void | ubus_defer_request (struct ubus_context *ctx, struct ubus_request_data *req, struct ubus_request_data *new_req) |
static void | ubus_request_set_fd (struct ubus_context *ctx, struct ubus_request_data *req, int fd) |
static int | ubus_request_get_caller_fd (struct ubus_request_data *req) |
void | ubus_complete_deferred_request (struct ubus_context *ctx, struct ubus_request_data *req, int ret) |
int | ubus_notify (struct ubus_context *ctx, struct ubus_object *obj, const char *type, struct blob_attr *msg, int timeout) |
int | ubus_notify_async (struct ubus_context *ctx, struct ubus_object *obj, const char *type, struct blob_attr *msg, struct ubus_notify_request *req) |
int | ubus_send_event (struct ubus_context *ctx, const char *id, struct blob_attr *data) |
int | ubus_register_event_handler (struct ubus_context *ctx, struct ubus_event_handler *ev, const char *pattern) |
static int | ubus_unregister_event_handler (struct ubus_context *ctx, struct ubus_event_handler *ev) |
Variables | |
struct avl_tree | acl_objects |
#define __UBUS_METHOD | ( | _name, | |
_handler, | |||
_policy, | |||
_tags | |||
) |
#define __UBUS_METHOD_NOARG | ( | _name, | |
_handler, | |||
_tags | |||
) |
#define acl_for_each | ( | o, | |
m | |||
) |
#define UBUS_METHOD | ( | _name, | |
_handler, | |||
_policy | |||
) | { __UBUS_METHOD(_name, _handler, _policy, 0) } |
#define UBUS_METHOD_MASK | ( | _name, | |
_handler, | |||
_policy, | |||
_mask | |||
) |
#define UBUS_METHOD_NOARG | ( | _name, | |
_handler | |||
) | { __UBUS_METHOD_NOARG(_name, _handler, 0) } |
#define UBUS_METHOD_TAG | ( | _name, | |
_handler, | |||
_policy, | |||
_tags | |||
) | { __UBUS_METHOD(_name, _handler, _policy, _tags) } |
#define UBUS_METHOD_TAG_NOARG | ( | _name, | |
_handler, | |||
_tags | |||
) | { __UBUS_METHOD_NOARG(_name, _handler, _tags) } |
#define UBUS_OBJECT_TYPE | ( | _name, | |
_methods | |||
) |
typedef void(* ubus_complete_handler_t) (struct ubus_request *req, int ret) |
typedef void(* ubus_connect_handler_t) (struct ubus_context *ctx) |
typedef void(* ubus_data_handler_t) (struct ubus_request *req, int type, struct blob_attr *msg) |
typedef void(* ubus_event_handler_t) (struct ubus_context *ctx, struct ubus_event_handler *ev, const char *type, struct blob_attr *msg) |
typedef void(* ubus_fd_handler_t) (struct ubus_request *req, int fd) |
typedef int(* ubus_handler_t) (struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) |
typedef void(* ubus_lookup_handler_t) (struct ubus_context *ctx, struct ubus_object_data *obj, void *priv) |
typedef bool(* ubus_new_object_handler_t) (struct ubus_context *ctx, struct ubus_subscriber *sub, const char *path) |
typedef void(* ubus_notify_complete_handler_t) (struct ubus_notify_request *req, int idx, int ret) |
typedef void(* ubus_notify_data_handler_t) (struct ubus_notify_request *req, int type, struct blob_attr *msg) |
typedef void(* ubus_remove_handler_t) (struct ubus_context *ctx, struct ubus_subscriber *obj, uint32_t id) |
typedef void(* ubus_state_handler_t) (struct ubus_context *ctx, struct ubus_object *obj) |
int __ubus_monitor | ( | struct ubus_context * | ctx, |
const char * | type | ||
) |
Definition at line 495 of file libubus-req.c.
void ubus_abort_request | ( | struct ubus_context * | ctx, |
struct ubus_request * | req | ||
) |
Definition at line 80 of file libubus-req.c.
int ubus_add_object | ( | struct ubus_context * | ctx, |
struct ubus_object * | obj | ||
) |
Definition at line 209 of file libubus-obj.c.
|
inlinestatic |
void ubus_auto_connect | ( | struct ubus_auto_conn * | conn | ) |
Definition at line 345 of file libubus.c.
|
inlinestatic |
void ubus_complete_deferred_request | ( | struct ubus_context * | ctx, |
struct ubus_request_data * | req, | ||
int | ret | ||
) |
Definition at line 189 of file libubus-req.c.
int ubus_complete_request | ( | struct ubus_context * | ctx, |
struct ubus_request * | req, | ||
int | timeout | ||
) |
Definition at line 140 of file libubus-req.c.
void ubus_complete_request_async | ( | struct ubus_context * | ctx, |
struct ubus_request * | req | ||
) |
struct ubus_context* ubus_connect | ( | const char * | path | ) |
Definition at line 351 of file libubus.c.
int ubus_connect_ctx | ( | struct ubus_context * | ctx, |
const char * | path | ||
) |
Definition at line 284 of file libubus.c.
|
inlinestatic |
void ubus_free | ( | struct ubus_context * | ctx | ) |
|
inlinestatic |
|
inlinestatic |
Definition at line 354 of file libubus.h.
|
inlinestatic |
Definition at line 365 of file libubus.h.
int ubus_invoke_async_fd | ( | struct ubus_context * | ctx, |
uint32_t | obj, | ||
const char * | method, | ||
struct blob_attr * | msg, | ||
struct ubus_request * | req, | ||
int | fd | ||
) |
Definition at line 220 of file libubus-req.c.
int ubus_invoke_fd | ( | struct ubus_context * | ctx, |
uint32_t | obj, | ||
const char * | method, | ||
struct blob_attr * | msg, | ||
ubus_data_handler_t | cb, | ||
void * | priv, | ||
int | timeout, | ||
int | fd | ||
) |
Definition at line 236 of file libubus-req.c.
int ubus_lookup | ( | struct ubus_context * | ctx, |
const char * | path, | ||
ubus_lookup_handler_t | cb, | ||
void * | priv | ||
) |
Definition at line 161 of file libubus.c.
int ubus_lookup_id | ( | struct ubus_context * | ctx, |
const char * | path, | ||
uint32_t * | id | ||
) |
Definition at line 192 of file libubus.c.
|
inlinestatic |
Definition at line 321 of file libubus.h.
|
inlinestatic |
int ubus_notify | ( | struct ubus_context * | ctx, |
struct ubus_object * | obj, | ||
const char * | type, | ||
struct blob_attr * | msg, | ||
int | timeout | ||
) |
Definition at line 311 of file libubus-req.c.
int ubus_notify_async | ( | struct ubus_context * | ctx, |
struct ubus_object * | obj, | ||
const char * | type, | ||
struct blob_attr * | msg, | ||
struct ubus_notify_request * | req | ||
) |
int ubus_reconnect | ( | struct ubus_context * | ctx, |
const char * | path | ||
) |
Definition at line 395 of file libubus-io.c.
int ubus_register_acl | ( | struct ubus_context * | ctx | ) |
Definition at line 142 of file libubus-acl.c.
int ubus_register_event_handler | ( | struct ubus_context * | ctx, |
struct ubus_event_handler * | ev, | ||
const char * | pattern | ||
) |
Definition at line 225 of file libubus.c.
int ubus_register_subscriber | ( | struct ubus_context * | ctx, |
struct ubus_subscriber * | obj | ||
) |
Definition at line 77 of file libubus-sub.c.
int ubus_remove_object | ( | struct ubus_context * | ctx, |
struct ubus_object * | obj | ||
) |
Definition at line 256 of file libubus-obj.c.
|
inlinestatic |
|
inlinestatic |
int ubus_send_event | ( | struct ubus_context * | ctx, |
const char * | id, | ||
struct blob_attr * | data | ||
) |
int ubus_send_reply | ( | struct ubus_context * | ctx, |
struct ubus_request_data * | req, | ||
struct blob_attr * | msg | ||
) |
Definition at line 205 of file libubus-req.c.
void ubus_shutdown | ( | struct ubus_context * | ctx | ) |
const char* ubus_strerror | ( | int | error | ) |
int ubus_subscribe | ( | struct ubus_context * | ctx, |
struct ubus_subscriber * | obj, | ||
uint32_t | id | ||
) |
Definition at line 118 of file libubus-sub.c.
|
inlinestatic |
Definition at line 423 of file libubus.h.
|
inlinestatic |
int ubus_unsubscribe | ( | struct ubus_context * | ctx, |
struct ubus_subscriber * | obj, | ||
uint32_t | id | ||
) |
Definition at line 123 of file libubus-sub.c.
|
extern |