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