#include <arpa/inet.h>
#include "ubusd.h"
 
Go to the source code of this file.
 | 
| static void  | ubusd_delete_event_source (struct event_source *evs) | 
|   | 
| void  | ubusd_event_cleanup_object (struct ubus_object *obj) | 
|   | 
| static int  | ubusd_alloc_event_pattern (struct ubus_client *cl, struct blob_attr *msg) | 
|   | 
| static void  | ubusd_send_event_msg (struct ubus_msg_buf **ub, struct ubus_client *cl, struct ubus_object *obj, const char *id, event_fill_cb fill_cb, void *cb_priv) | 
|   | 
| int  | ubusd_send_event (struct ubus_client *cl, const char *id, event_fill_cb fill_cb, void *cb_priv) | 
|   | 
| static struct ubus_msg_buf *  | ubusd_create_event_from_msg (void *priv, const char *id) | 
|   | 
| static int  | ubusd_forward_event (struct ubus_client *cl, struct blob_attr *msg) | 
|   | 
| static int  | ubusd_event_recv (struct ubus_client *cl, struct ubus_msg_buf *ub, const char *method, struct blob_attr *msg) | 
|   | 
| static struct ubus_msg_buf *  | ubusd_create_object_event_msg (void *priv, const char *id) | 
|   | 
| void  | ubusd_send_obj_event (struct ubus_object *obj, bool add) | 
|   | 
| void  | ubusd_event_init (void) | 
|   | 
◆ anonymous enum
| Enumerator | 
|---|
| EVREG_PATTERN  |  | 
| EVREG_OBJECT  |  | 
| EVREG_LAST  |  | 
Definition at line 45 of file ubusd_event.c.
 
 
◆ anonymous enum
| Enumerator | 
|---|
| EVMSG_ID  |  | 
| EVMSG_DATA  |  | 
| EVMSG_LAST  |  | 
Definition at line 185 of file ubusd_event.c.
 
 
◆ ubusd_alloc_event_pattern()
  
  
      
        
          | static int ubusd_alloc_event_pattern  | 
          ( | 
          struct ubus_client *  | 
          cl,  | 
         
        
           | 
           | 
          struct blob_attr *  | 
          msg  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 56 of file ubusd_event.c.
   86         len = strlen(pattern);
 
   87         if (pattern[len - 1] == 
'*') {
 
   96         ev = calloc(1, 
sizeof(*ev) + len + 1);
 
  103         name = (
char *) (ev + 1);
 
  104         strcpy(
name, pattern);
 
struct ubus_client * client
 
int ubusd_acl_check(struct ubus_client *cl, const char *obj, const char *method, enum ubusd_acl_type type)
 
static struct blobmsg_policy evr_policy[]
 
static struct avl_tree patterns
 
static struct ubus_object * ubusd_find_object(uint32_t objid)
 
@ UBUS_STATUS_INVALID_ARGUMENT
 
@ UBUS_STATUS_PERMISSION_DENIED
 
#define UBUS_SYSTEM_OBJECT_MAX
 
 
 
 
◆ ubusd_create_event_from_msg()
  
  
      
        
          | static struct ubus_msg_buf* ubusd_create_event_from_msg  | 
          ( | 
          void *  | 
          priv,  | 
         
        
           | 
           | 
          const char *  | 
          id  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 197 of file ubusd_event.c.
  199         struct blob_attr *msg = priv;
 
  201         blob_buf_init(&
b, 0);
 
  204         blob_put(&
b, 
UBUS_ATTR_DATA, blobmsg_data(msg), blobmsg_data_len(msg));
 
struct ubus_msg_buf * ubus_msg_new(void *data, int len, bool shared)
 
 
 
 
◆ ubusd_create_object_event_msg()
  
  
      
        
          | static struct ubus_msg_buf* ubusd_create_object_event_msg  | 
          ( | 
          void *  | 
          priv,  | 
         
        
           | 
           | 
          const char *  | 
          id  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 243 of file ubusd_event.c.
  248         blob_buf_init(&
b, 0);
 
  252         blobmsg_add_u32(&
b, 
"id", obj->
id.id);
 
  253         blobmsg_add_string(&
b, 
"path", obj->
path.key);
 
  254         blob_nest_end(&
b, s);
 
 
 
 
◆ ubusd_delete_event_source()
  
  
      
        
          | static void ubusd_delete_event_source  | 
          ( | 
          struct event_source *  | 
          evs | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
◆ ubusd_event_cleanup_object()
      
        
          | void ubusd_event_cleanup_object  | 
          ( | 
          struct ubus_object *  | 
          obj | ) | 
           | 
        
      
 
Definition at line 36 of file ubusd_event.c.
static void ubusd_delete_event_source(struct event_source *evs)
 
 
 
 
◆ ubusd_event_init()
      
        
          | void ubusd_event_init  | 
          ( | 
          void  | 
           | ) | 
           | 
        
      
 
Definition at line 266 of file ubusd_event.c.
int(* recv_msg)(struct ubus_client *client, struct ubus_msg_buf *ub, const char *method, struct blob_attr *msg)
 
static struct ubus_object * event_obj
 
static int ubusd_event_recv(struct ubus_client *cl, struct ubus_msg_buf *ub, const char *method, struct blob_attr *msg)
 
void ubus_init_string_tree(struct avl_tree *tree, bool dup)
 
struct ubus_object * ubusd_create_object_internal(struct ubus_object_type *type, uint32_t id)
 
#define UBUS_SYSTEM_OBJECT_EVENT
 
 
 
 
◆ ubusd_event_recv()
  
  
      
        
          | static int ubusd_event_recv  | 
          ( | 
          struct ubus_client *  | 
          cl,  | 
         
        
           | 
           | 
          struct ubus_msg_buf *  | 
          ub,  | 
         
        
           | 
           | 
          const char *  | 
          method,  | 
         
        
           | 
           | 
          struct blob_attr *  | 
          msg  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 231 of file ubusd_event.c.
  233         if (!strcmp(method, 
"register"))
 
  236         if (!strcmp(method, 
"send"))
 
static int ubusd_forward_event(struct ubus_client *cl, struct blob_attr *msg)
 
static int ubusd_alloc_event_pattern(struct ubus_client *cl, struct blob_attr *msg)
 
@ UBUS_STATUS_INVALID_COMMAND
 
 
 
 
◆ ubusd_forward_event()
  
  
      
        
          | static int ubusd_forward_event  | 
          ( | 
          struct ubus_client *  | 
          cl,  | 
         
        
           | 
           | 
          struct blob_attr *  | 
          msg  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 209 of file ubusd_event.c.
  211         struct blob_attr *data;
 
  225         if (!strncmp(
id, 
"ubus.", 5))
 
static struct ubus_msg_buf * ubusd_create_event_from_msg(void *priv, const char *id)
 
int ubusd_send_event(struct ubus_client *cl, const char *id, event_fill_cb fill_cb, void *cb_priv)
 
static struct blobmsg_policy ev_policy[]
 
 
 
 
◆ ubusd_send_event()
Definition at line 140 of file ubusd_event.c.
  158                 const char *key = ev->
avl.key;
 
  163                 if (cur_match_len < match_len)
 
  166                 match_len = cur_match_len;
 
  172                         if (match_len != (
int) strlen(key))
 
static bool ubus_strmatch_len(const char *s1, const char *s2, int *len)
 
void ubus_msg_free(struct ubus_msg_buf *ub)
 
static void ubusd_send_event_msg(struct ubus_msg_buf **ub, struct ubus_client *cl, struct ubus_object *obj, const char *id, event_fill_cb fill_cb, void *cb_priv)
 
 
 
 
◆ ubusd_send_event_msg()
Definition at line 111 of file ubusd_event.c.
  128                 *ub = fill_cb(cb_priv, 
id);
 
  133         objid_ptr = blob_data(blob_data((*ub)->data));
 
  134         *objid_ptr = htonl(obj->
id.id);
 
void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub)
 
 
 
 
◆ ubusd_send_obj_event()
      
        
          | void ubusd_send_obj_event  | 
          ( | 
          struct ubus_object *  | 
          obj,  | 
        
        
           | 
           | 
          bool  | 
          add  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 259 of file ubusd_event.c.
  261         const char *
id = add ? 
"ubus.object.add" : 
"ubus.object.remove";
 
static struct ubus_msg_buf * ubusd_create_object_event_msg(void *priv, const char *id)
 
 
 
 
◆ ev_policy
  
  
      
        
          | struct blobmsg_policy ev_policy[] | 
         
       
   | 
  
static   | 
  
 
Initial value:= {
        [
EVMSG_ID] = { .name = 
"id", .type = BLOBMSG_TYPE_STRING },
 
        [
EVMSG_DATA] = { .name = 
"data", .type = BLOBMSG_TYPE_TABLE },
 
}
 
Definition at line 140 of file ubusd_event.c.
 
 
◆ event_obj
◆ event_seq
◆ evr_policy
  
  
      
        
          | struct blobmsg_policy evr_policy[] | 
         
       
   | 
  
static   | 
  
 
Initial value:= {
        [
EVREG_PATTERN] = { .name = 
"pattern", .type = BLOBMSG_TYPE_STRING },
 
        [
EVREG_OBJECT] = { .name = 
"object", .type = BLOBMSG_TYPE_INT32 },
 
}
 
Definition at line 36 of file ubusd_event.c.
 
 
◆ obj_event_seq
◆ patterns