X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fsystemd%2Fsd-bus-vtable.h;h=6ad6d519796d1d48c38a0db65e85c0c779842706;hp=d1642bae5ec69fae0fc41bb8d74f55c1bf2d71ca;hb=b4ff30ddf7f19a3d6c23ea4f3981712e1afea13e;hpb=6695ed7a841faad68df3d5cb466f5e0e01f57536 diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h index d1642bae5..6ad6d5197 100644 --- a/src/systemd/sd-bus-vtable.h +++ b/src/systemd/sd-bus-vtable.h @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - #ifndef foosdbusvtablehfoo #define foosdbusvtablehfoo @@ -22,37 +20,43 @@ along with systemd; If not, see . ***/ -#ifdef __cplusplus -extern "C" { -#endif +#include "_sd-common.h" + +_SD_BEGIN_DECLARATIONS; typedef struct sd_bus_vtable sd_bus_vtable; #include "sd-bus.h" enum { - _SD_BUS_VTABLE_START = '<', - _SD_BUS_VTABLE_END = '>', - _SD_BUS_VTABLE_METHOD = 'M', - _SD_BUS_VTABLE_SIGNAL = 'S', - _SD_BUS_VTABLE_PROPERTY = 'P', + _SD_BUS_VTABLE_START = '<', + _SD_BUS_VTABLE_END = '>', + _SD_BUS_VTABLE_METHOD = 'M', + _SD_BUS_VTABLE_SIGNAL = 'S', + _SD_BUS_VTABLE_PROPERTY = 'P', _SD_BUS_VTABLE_WRITABLE_PROPERTY = 'W', - _SD_BUS_VTABLE_CHILDREN = 'C' }; enum { - SD_BUS_VTABLE_DEPRECATED = 1, - SD_BUS_VTABLE_METHOD_NO_REPLY = 2, - SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE = 4, - SD_BUS_VTABLE_PROPERTY_INVALIDATE_ONLY = 8, + SD_BUS_VTABLE_DEPRECATED = 1ULL << 0, + SD_BUS_VTABLE_HIDDEN = 1ULL << 1, + SD_BUS_VTABLE_UNPRIVILEGED = 1ULL << 2, + SD_BUS_VTABLE_METHOD_NO_REPLY = 1ULL << 3, + SD_BUS_VTABLE_PROPERTY_CONST = 1ULL << 4, + SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE = 1ULL << 5, + SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION = 1ULL << 6, + SD_BUS_VTABLE_PROPERTY_EXPLICIT = 1ULL << 7, + _SD_BUS_VTABLE_CAPABILITY_MASK = 0xFFFFULL << 40 }; +#define SD_BUS_VTABLE_CAPABILITY(x) ((uint64_t) (((x)+1) & 0xFFFF) << 40) + struct sd_bus_vtable { /* Please do not initialize this structure directly, use the * macros below instead */ - int type; - int flags; + uint8_t type:8; + uint64_t flags:56; union { struct { size_t element_size; @@ -62,6 +66,7 @@ struct sd_bus_vtable { const char *signature; const char *result; sd_bus_message_handler_t handler; + size_t offset; } method; struct { const char *member; @@ -84,7 +89,7 @@ struct sd_bus_vtable { .x.start.element_size = sizeof(sd_bus_vtable), \ } -#define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags) \ +#define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags) \ { \ .type = _SD_BUS_VTABLE_METHOD, \ .flags = _flags, \ @@ -92,7 +97,10 @@ struct sd_bus_vtable { .x.method.signature = _signature, \ .x.method.result = _result, \ .x.method.handler = _handler, \ + .x.method.offset = _offset, \ } +#define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags) \ + SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, 0, _flags) #define SD_BUS_SIGNAL(_member, _signature, _flags) \ { \ @@ -128,8 +136,6 @@ struct sd_bus_vtable { .type = _SD_BUS_VTABLE_END, \ } -#ifdef __cplusplus -} -#endif +_SD_END_DECLARATIONS; #endif