Ubus
OpenWrt system message/RPC bus.
ubusmsg.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
3  *
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
7  *
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.
12  */
13 
14 #ifndef __UBUSMSG_H
15 #define __UBUSMSG_H
16 
17 #include <stdint.h>
18 #include <libubox/blob.h>
19 
20 #define __packetdata __attribute__((packed)) __attribute__((__aligned__(4)))
21 
22 #define UBUS_MSG_CHUNK_SIZE 65536
23 
24 #define UBUS_SYSTEM_OBJECT_EVENT 1
25 #define UBUS_SYSTEM_OBJECT_ACL 2
26 #define UBUS_SYSTEM_OBJECT_MONITOR 3
27 #define UBUS_SYSTEM_OBJECT_MAX 1024
28 
29 struct ubus_msghdr {
30  uint8_t version;
31  uint8_t type;
32  uint16_t seq;
33  uint32_t peer;
34 } __packetdata;
35 
37  /* initial server message */
39 
40  /* generic command response */
42 
43  /* data message response */
45 
46  /* ping request */
48 
49  /* look up one or more objects */
51 
52  /* invoke a method on a single object */
54 
57 
58  /*
59  * subscribe/unsubscribe to object notifications
60  * The unsubscribe message is sent from ubusd when
61  * the object disappears
62  */
65 
66  /*
67  * send a notification to all subscribers of an object.
68  * when sent from the server, it indicates a subscription
69  * status change
70  */
72 
74 
75  /* must be last */
77 };
78 
81 
83 
87 
90 
93 
96 
98 
101 
102  /* must be last */
104 };
105 
113 
114  /* must be last */
116 };
117 
134 };
135 
136 #endif
uint32_t peer
Definition: ubusmsg.h:33
uint8_t version
Definition: ubusmsg.h:30
uint8_t type
Definition: ubusmsg.h:31
uint16_t seq
Definition: ubusmsg.h:32
ubus_msg_type
Definition: ubusmsg.h:36
@ UBUS_MSG_INVOKE
Definition: ubusmsg.h:53
@ UBUS_MSG_DATA
Definition: ubusmsg.h:44
@ UBUS_MSG_REMOVE_OBJECT
Definition: ubusmsg.h:56
@ UBUS_MSG_STATUS
Definition: ubusmsg.h:41
@ UBUS_MSG_PING
Definition: ubusmsg.h:47
@ UBUS_MSG_ADD_OBJECT
Definition: ubusmsg.h:55
@ UBUS_MSG_LOOKUP
Definition: ubusmsg.h:50
@ UBUS_MSG_NOTIFY
Definition: ubusmsg.h:71
@ __UBUS_MSG_LAST
Definition: ubusmsg.h:76
@ UBUS_MSG_MONITOR
Definition: ubusmsg.h:73
@ UBUS_MSG_HELLO
Definition: ubusmsg.h:38
@ UBUS_MSG_SUBSCRIBE
Definition: ubusmsg.h:63
@ UBUS_MSG_UNSUBSCRIBE
Definition: ubusmsg.h:64
ubus_msg_status
Definition: ubusmsg.h:118
@ UBUS_STATUS_INVALID_ARGUMENT
Definition: ubusmsg.h:121
@ UBUS_STATUS_NO_DATA
Definition: ubusmsg.h:124
@ UBUS_STATUS_TIMEOUT
Definition: ubusmsg.h:126
@ UBUS_STATUS_METHOD_NOT_FOUND
Definition: ubusmsg.h:122
@ UBUS_STATUS_NOT_FOUND
Definition: ubusmsg.h:123
@ UBUS_STATUS_INVALID_COMMAND
Definition: ubusmsg.h:120
@ UBUS_STATUS_CONNECTION_FAILED
Definition: ubusmsg.h:129
@ UBUS_STATUS_NO_MEMORY
Definition: ubusmsg.h:130
@ __UBUS_STATUS_LAST
Definition: ubusmsg.h:133
@ UBUS_STATUS_PERMISSION_DENIED
Definition: ubusmsg.h:125
@ UBUS_STATUS_OK
Definition: ubusmsg.h:119
@ UBUS_STATUS_UNKNOWN_ERROR
Definition: ubusmsg.h:128
@ UBUS_STATUS_SYSTEM_ERROR
Definition: ubusmsg.h:132
@ UBUS_STATUS_PARSE_ERROR
Definition: ubusmsg.h:131
@ UBUS_STATUS_NOT_SUPPORTED
Definition: ubusmsg.h:127
ubus_monitor_attr
Definition: ubusmsg.h:106
@ UBUS_MONITOR_DATA
Definition: ubusmsg.h:112
@ UBUS_MONITOR_CLIENT
Definition: ubusmsg.h:107
@ UBUS_MONITOR_SEND
Definition: ubusmsg.h:109
@ UBUS_MONITOR_MAX
Definition: ubusmsg.h:115
@ UBUS_MONITOR_PEER
Definition: ubusmsg.h:108
@ UBUS_MONITOR_SEQ
Definition: ubusmsg.h:110
@ UBUS_MONITOR_TYPE
Definition: ubusmsg.h:111
#define __packetdata
Definition: ubusmsg.h:20
ubus_msg_attr
Definition: ubusmsg.h:79
@ UBUS_ATTR_OBJTYPE
Definition: ubusmsg.h:88
@ UBUS_ATTR_TARGET
Definition: ubusmsg.h:92
@ UBUS_ATTR_ACTIVE
Definition: ubusmsg.h:94
@ UBUS_ATTR_OBJPATH
Definition: ubusmsg.h:84
@ UBUS_ATTR_METHOD
Definition: ubusmsg.h:86
@ UBUS_ATTR_SUBSCRIBERS
Definition: ubusmsg.h:97
@ UBUS_ATTR_STATUS
Definition: ubusmsg.h:82
@ UBUS_ATTR_NO_REPLY
Definition: ubusmsg.h:95
@ UBUS_ATTR_OBJID
Definition: ubusmsg.h:85
@ UBUS_ATTR_SIGNATURE
Definition: ubusmsg.h:89
@ UBUS_ATTR_GROUP
Definition: ubusmsg.h:100
@ UBUS_ATTR_DATA
Definition: ubusmsg.h:91
@ UBUS_ATTR_UNSPEC
Definition: ubusmsg.h:80
@ UBUS_ATTR_USER
Definition: ubusmsg.h:99
@ UBUS_ATTR_MAX
Definition: ubusmsg.h:103