1 #include "libubus.h" 2 3 // Ensure UBUS_* macros can be used from C++ 4 5 static int handler(ubus_context *, ubus_object *, ubus_request_data *, const char *, blob_attr *) 6 { 7 return 0; 8 } 9 10 enum { 11 HELLO_ID, 12 HELLO_MSG, 13 }; 14 15 constexpr blobmsg_policy hello_policy[] = { 16 [HELLO_ID] = { .name = "id", .type = BLOBMSG_TYPE_INT32 }, 17 [HELLO_MSG] = { .name = "msg", .type = BLOBMSG_TYPE_STRING }, 18 }; 19 20 constexpr ubus_method test_methods[] = { 21 UBUS_METHOD("hello1", handler, hello_policy), 22 UBUS_METHOD_TAG("hello2", handler, hello_policy, UBUS_TAG_ADMIN | UBUS_TAG_PRIVATE), 23 UBUS_METHOD_MASK("hello3", handler, hello_policy, 0), 24 UBUS_METHOD_NOARG("hello4", handler), 25 UBUS_METHOD_TAG_NOARG("hello5", handler, UBUS_TAG_STATUS), 26 }; 27 28 constexpr ubus_object_type test_object_type = UBUS_OBJECT_TYPE("test", test_methods); 29 30 int main() 31 { 32 (void) test_object_type; 33 return 0; 34 } 35
This page was automatically generated by LXR 0.3.1. • OpenWrt