1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #ifndef foosdbusvtablehfoo
3 #define foosdbusvtablehfoo
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 #include "_sd-common.h"
22 _SD_BEGIN_DECLARATIONS
;
24 typedef struct sd_bus_vtable sd_bus_vtable
;
29 _SD_BUS_VTABLE_START
= '<',
30 _SD_BUS_VTABLE_END
= '>',
31 _SD_BUS_VTABLE_METHOD
= 'M',
32 _SD_BUS_VTABLE_SIGNAL
= 'S',
33 _SD_BUS_VTABLE_PROPERTY
= 'P',
34 _SD_BUS_VTABLE_WRITABLE_PROPERTY
= 'W'
38 SD_BUS_VTABLE_DEPRECATED
= 1ULL << 0,
39 SD_BUS_VTABLE_HIDDEN
= 1ULL << 1,
40 SD_BUS_VTABLE_UNPRIVILEGED
= 1ULL << 2,
41 SD_BUS_VTABLE_METHOD_NO_REPLY
= 1ULL << 3,
42 SD_BUS_VTABLE_PROPERTY_CONST
= 1ULL << 4,
43 SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE
= 1ULL << 5,
44 SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION
= 1ULL << 6,
45 SD_BUS_VTABLE_PROPERTY_EXPLICIT
= 1ULL << 7,
46 _SD_BUS_VTABLE_CAPABILITY_MASK
= 0xFFFFULL
<< 40
49 #define SD_BUS_VTABLE_CAPABILITY(x) ((uint64_t) (((x)+1) & 0xFFFF) << 40)
51 struct sd_bus_vtable
{
52 /* Please do not initialize this structure directly, use the
53 * macros below instead */
63 const char *signature
;
65 sd_bus_message_handler_t handler
;
70 const char *signature
;
74 const char *signature
;
75 sd_bus_property_get_t get
;
76 sd_bus_property_set_t set
;
82 #define SD_BUS_VTABLE_START(_flags) \
84 .type = _SD_BUS_VTABLE_START, \
88 .element_size = sizeof(sd_bus_vtable) \
93 #define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags) \
95 .type = _SD_BUS_VTABLE_METHOD, \
100 .signature = _signature, \
102 .handler = _handler, \
107 #define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags) \
108 SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, 0, _flags)
110 #define SD_BUS_SIGNAL(_member, _signature, _flags) \
112 .type = _SD_BUS_VTABLE_SIGNAL, \
117 .signature = _signature, \
122 #define SD_BUS_PROPERTY(_member, _signature, _get, _offset, _flags) \
124 .type = _SD_BUS_VTABLE_PROPERTY, \
129 .signature = _signature, \
137 #define SD_BUS_WRITABLE_PROPERTY(_member, _signature, _get, _set, _offset, _flags) \
139 .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, \
144 .signature = _signature, \
152 #define SD_BUS_VTABLE_END \
154 .type = _SD_BUS_VTABLE_END, \
159 _SD_END_DECLARATIONS
;