1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdbusvtablehfoo
3 #define foosdbusvtablehfoo
4 
5 /***
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.
10 
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.
15 
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/>.
18 ***/
19 
20 #include "_sd-common.h"
21 
22 _SD_BEGIN_DECLARATIONS;
23 
24 typedef struct sd_bus_vtable sd_bus_vtable;
25 
26 #include "sd-bus.h"
27 
28 enum {
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'
35 };
36 
37 enum {
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_SENSITIVE                    = 1ULL << 8, /* covers both directions: method call + reply */
47         SD_BUS_VTABLE_ABSOLUTE_OFFSET              = 1ULL << 9,
48         _SD_BUS_VTABLE_CAPABILITY_MASK             = 0xFFFFULL << 40
49 };
50 
51 #define SD_BUS_VTABLE_CAPABILITY(x) ((uint64_t) (((x)+1) & 0xFFFF) << 40)
52 
53 enum {
54         _SD_BUS_VTABLE_PARAM_NAMES     = 1 << 0,
55 };
56 
57 extern const unsigned sd_bus_object_vtable_format;
58 
59 /* Note: unused areas in the sd_bus_vtable[] array must be initialized to 0. The structure contains an embedded
60  * union, and the compiler is NOT required to initialize the unused areas of the union when the rest of the
61  * structure is initialized. Normally the array is defined as read-only data, in which case the linker places
62  * it in the BSS section, which is always fully initialized, so this is not a concern. But if the array is
63  * created on the stack or on the heap, care must be taken to initialize the unused areas, for examply by
64  * first memsetting the whole region to zero before filling the data in. */
65 
66 struct sd_bus_vtable {
67         /* Please do not initialize this structure directly, use the
68          * macros below instead */
69 
70         uint8_t type:8;
71         uint64_t flags:56;
72         union {
73                 struct {
74                         size_t element_size;
75                         uint64_t features;
76                         const unsigned *vtable_format_reference;
77                 } start;
78                 struct {
79                         /* This field exists only to make sure we have something to initialize in
80                          * SD_BUS_VTABLE_END in a way that is both compatible with pedantic versions of C and
81                          * C++. It's unused otherwise. */
82                         size_t _reserved;
83                 } end;
84                 struct {
85                         const char *member;
86                         const char *signature;
87                         const char *result;
88                         sd_bus_message_handler_t handler;
89                         size_t offset;
90                         const char *names;
91                 } method;
92                 struct {
93                         const char *member;
94                         const char *signature;
95                         const char *names;
96                 } signal;
97                 struct {
98                         const char *member;
99                         const char *signature;
100                         sd_bus_property_get_t get;
101                         sd_bus_property_set_t set;
102                         size_t offset;
103                 } property;
104         } x;
105 };
106 
107 #define SD_BUS_VTABLE_START(_flags)                                     \
108         {                                                               \
109                 .type = _SD_BUS_VTABLE_START,                           \
110                 .flags = _flags,                                        \
111                 .x = {                                                  \
112                         .start = {                                      \
113                                 .element_size = sizeof(sd_bus_vtable),  \
114                                 .features = _SD_BUS_VTABLE_PARAM_NAMES, \
115                                 .vtable_format_reference = &sd_bus_object_vtable_format, \
116                         },                                              \
117                 },                                                      \
118         }
119 
120 /* helper macro to format method and signal parameters, one at a time */
121 #define SD_BUS_PARAM(x) #x "\0"
122 
123 #define SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, _in_names, _result, _out_names, _handler, _offset, _flags)  \
124         {                                                               \
125                 .type = _SD_BUS_VTABLE_METHOD,                          \
126                 .flags = _flags,                                        \
127                 .x = {                                                  \
128                         .method = {                                     \
129                                 .member = _member,                      \
130                                 .signature = _signature,                \
131                                 .result = _result,                      \
132                                 .handler = _handler,                    \
133                                 .offset = _offset,                      \
134                                 .names = _in_names _out_names,          \
135                         },                                              \
136                 },                                                      \
137         }
138 #define SD_BUS_METHOD_WITH_OFFSET(_member, _signature, _result, _handler, _offset, _flags)   \
139         SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, "", _result, "", _handler, _offset, _flags)
140 #define SD_BUS_METHOD_WITH_NAMES(_member, _signature, _in_names, _result, _out_names, _handler, _flags)   \
141         SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, _in_names, _result, _out_names, _handler, 0, _flags)
142 #define SD_BUS_METHOD(_member, _signature, _result, _handler, _flags)   \
143         SD_BUS_METHOD_WITH_NAMES_OFFSET(_member, _signature, "", _result, "", _handler, 0, _flags)
144 
145 #define SD_BUS_SIGNAL_WITH_NAMES(_member, _signature, _out_names, _flags)                      \
146         {                                                               \
147                 .type = _SD_BUS_VTABLE_SIGNAL,                          \
148                 .flags = _flags,                                        \
149                 .x = {                                                  \
150                         .signal = {                                     \
151                                 .member = _member,                      \
152                                 .signature = _signature,                \
153                                 .names = _out_names,                    \
154                         },                                              \
155                 },                                                      \
156                         }
157 #define SD_BUS_SIGNAL(_member, _signature, _flags)                      \
158         SD_BUS_SIGNAL_WITH_NAMES(_member, _signature, "", _flags)
159 
160 #define SD_BUS_PROPERTY(_member, _signature, _get, _offset, _flags)     \
161         {                                                               \
162                 .type = _SD_BUS_VTABLE_PROPERTY,                        \
163                 .flags = _flags,                                        \
164                 .x = {                                                  \
165                         .property = {                                   \
166                                 .member = _member,                      \
167                                 .signature = _signature,                \
168                                 .get = _get,                            \
169                                 .set = NULL,                            \
170                                 .offset = _offset,                      \
171                         },                                              \
172                 },                                                      \
173         }
174 
175 #define SD_BUS_WRITABLE_PROPERTY(_member, _signature, _get, _set, _offset, _flags) \
176         {                                                               \
177                 .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY,               \
178                 .flags = _flags,                                        \
179                 .x = {                                                  \
180                         .property = {                                   \
181                                 .member = _member,                      \
182                                 .signature = _signature,                \
183                                 .get = _get,                            \
184                                 .set = _set,                            \
185                                 .offset = _offset,                      \
186                         },                                              \
187                 },                                                      \
188         }
189 
190 #define SD_BUS_VTABLE_END                                               \
191         {                                                               \
192                 .type = _SD_BUS_VTABLE_END,                             \
193                 .flags = 0,                                             \
194                 .x = {                                                  \
195                         .end = {                                        \
196                                 ._reserved = 0,                         \
197                         },                                              \
198                 },                                                      \
199         }
200 
201 #define _SD_ECHO(X) X
202 #define _SD_CONCAT(X) #X "\0"
203 
204 #define _SD_VARARGS_FOREACH_SEQ(_01, _02, _03, _04, _05, _06, _07, _08, _09, _10, \
205                                 _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
206                                 _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
207                                 _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
208                                 _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
209                                 NAME, ...) NAME
210 
211 #define _SD_VARARGS_FOREACH_EVEN_01(FN, X)         FN(X)
212 #define _SD_VARARGS_FOREACH_EVEN_02(FN, X, Y)      FN(X)
213 #define _SD_VARARGS_FOREACH_EVEN_04(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_02(FN, __VA_ARGS__)
214 #define _SD_VARARGS_FOREACH_EVEN_06(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_04(FN, __VA_ARGS__)
215 #define _SD_VARARGS_FOREACH_EVEN_08(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_06(FN, __VA_ARGS__)
216 #define _SD_VARARGS_FOREACH_EVEN_10(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_08(FN, __VA_ARGS__)
217 #define _SD_VARARGS_FOREACH_EVEN_12(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_10(FN, __VA_ARGS__)
218 #define _SD_VARARGS_FOREACH_EVEN_14(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_12(FN, __VA_ARGS__)
219 #define _SD_VARARGS_FOREACH_EVEN_16(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_14(FN, __VA_ARGS__)
220 #define _SD_VARARGS_FOREACH_EVEN_18(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_16(FN, __VA_ARGS__)
221 #define _SD_VARARGS_FOREACH_EVEN_20(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_18(FN, __VA_ARGS__)
222 #define _SD_VARARGS_FOREACH_EVEN_22(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_20(FN, __VA_ARGS__)
223 #define _SD_VARARGS_FOREACH_EVEN_24(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_22(FN, __VA_ARGS__)
224 #define _SD_VARARGS_FOREACH_EVEN_26(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_24(FN, __VA_ARGS__)
225 #define _SD_VARARGS_FOREACH_EVEN_28(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_26(FN, __VA_ARGS__)
226 #define _SD_VARARGS_FOREACH_EVEN_30(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_28(FN, __VA_ARGS__)
227 #define _SD_VARARGS_FOREACH_EVEN_32(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_30(FN, __VA_ARGS__)
228 #define _SD_VARARGS_FOREACH_EVEN_34(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_32(FN, __VA_ARGS__)
229 #define _SD_VARARGS_FOREACH_EVEN_36(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_34(FN, __VA_ARGS__)
230 #define _SD_VARARGS_FOREACH_EVEN_38(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_36(FN, __VA_ARGS__)
231 #define _SD_VARARGS_FOREACH_EVEN_40(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_38(FN, __VA_ARGS__)
232 #define _SD_VARARGS_FOREACH_EVEN_42(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_40(FN, __VA_ARGS__)
233 #define _SD_VARARGS_FOREACH_EVEN_44(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_42(FN, __VA_ARGS__)
234 #define _SD_VARARGS_FOREACH_EVEN_46(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_44(FN, __VA_ARGS__)
235 #define _SD_VARARGS_FOREACH_EVEN_48(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_46(FN, __VA_ARGS__)
236 #define _SD_VARARGS_FOREACH_EVEN_50(FN, X, Y, ...) FN(X) _SD_VARARGS_FOREACH_EVEN_48(FN, __VA_ARGS__)
237 
238 #define _SD_VARARGS_FOREACH_EVEN(FN, ...)                                                 \
239         _SD_VARARGS_FOREACH_SEQ(__VA_ARGS__,                                              \
240                                 _SD_VARARGS_FOREACH_EVEN_50, _SD_VARARGS_FOREACH_EVEN_49, \
241                                 _SD_VARARGS_FOREACH_EVEN_48, _SD_VARARGS_FOREACH_EVEN_47, \
242                                 _SD_VARARGS_FOREACH_EVEN_46, _SD_VARARGS_FOREACH_EVEN_45, \
243                                 _SD_VARARGS_FOREACH_EVEN_44, _SD_VARARGS_FOREACH_EVEN_43, \
244                                 _SD_VARARGS_FOREACH_EVEN_42, _SD_VARARGS_FOREACH_EVEN_41, \
245                                 _SD_VARARGS_FOREACH_EVEN_40, _SD_VARARGS_FOREACH_EVEN_39, \
246                                 _SD_VARARGS_FOREACH_EVEN_38, _SD_VARARGS_FOREACH_EVEN_37, \
247                                 _SD_VARARGS_FOREACH_EVEN_36, _SD_VARARGS_FOREACH_EVEN_35, \
248                                 _SD_VARARGS_FOREACH_EVEN_34, _SD_VARARGS_FOREACH_EVEN_33, \
249                                 _SD_VARARGS_FOREACH_EVEN_32, _SD_VARARGS_FOREACH_EVEN_31, \
250                                 _SD_VARARGS_FOREACH_EVEN_30, _SD_VARARGS_FOREACH_EVEN_29, \
251                                 _SD_VARARGS_FOREACH_EVEN_28, _SD_VARARGS_FOREACH_EVEN_27, \
252                                 _SD_VARARGS_FOREACH_EVEN_26, _SD_VARARGS_FOREACH_EVEN_25, \
253                                 _SD_VARARGS_FOREACH_EVEN_24, _SD_VARARGS_FOREACH_EVEN_23, \
254                                 _SD_VARARGS_FOREACH_EVEN_22, _SD_VARARGS_FOREACH_EVEN_21, \
255                                 _SD_VARARGS_FOREACH_EVEN_20, _SD_VARARGS_FOREACH_EVEN_19, \
256                                 _SD_VARARGS_FOREACH_EVEN_18, _SD_VARARGS_FOREACH_EVEN_17, \
257                                 _SD_VARARGS_FOREACH_EVEN_16, _SD_VARARGS_FOREACH_EVEN_15, \
258                                 _SD_VARARGS_FOREACH_EVEN_14, _SD_VARARGS_FOREACH_EVEN_13, \
259                                 _SD_VARARGS_FOREACH_EVEN_12, _SD_VARARGS_FOREACH_EVEN_11, \
260                                 _SD_VARARGS_FOREACH_EVEN_10, _SD_VARARGS_FOREACH_EVEN_09, \
261                                 _SD_VARARGS_FOREACH_EVEN_08, _SD_VARARGS_FOREACH_EVEN_07, \
262                                 _SD_VARARGS_FOREACH_EVEN_06, _SD_VARARGS_FOREACH_EVEN_05, \
263                                 _SD_VARARGS_FOREACH_EVEN_04, _SD_VARARGS_FOREACH_EVEN_03, \
264                                 _SD_VARARGS_FOREACH_EVEN_02, _SD_VARARGS_FOREACH_EVEN_01) \
265                                 (FN, __VA_ARGS__)
266 
267 #define _SD_VARARGS_FOREACH_ODD_01(FN, X)
268 #define _SD_VARARGS_FOREACH_ODD_02(FN, X, Y)      FN(Y)
269 #define _SD_VARARGS_FOREACH_ODD_04(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_02(FN, __VA_ARGS__)
270 #define _SD_VARARGS_FOREACH_ODD_06(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_04(FN, __VA_ARGS__)
271 #define _SD_VARARGS_FOREACH_ODD_08(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_06(FN, __VA_ARGS__)
272 #define _SD_VARARGS_FOREACH_ODD_10(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_08(FN, __VA_ARGS__)
273 #define _SD_VARARGS_FOREACH_ODD_12(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_10(FN, __VA_ARGS__)
274 #define _SD_VARARGS_FOREACH_ODD_14(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_12(FN, __VA_ARGS__)
275 #define _SD_VARARGS_FOREACH_ODD_16(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_14(FN, __VA_ARGS__)
276 #define _SD_VARARGS_FOREACH_ODD_18(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_16(FN, __VA_ARGS__)
277 #define _SD_VARARGS_FOREACH_ODD_20(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_18(FN, __VA_ARGS__)
278 #define _SD_VARARGS_FOREACH_ODD_22(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_20(FN, __VA_ARGS__)
279 #define _SD_VARARGS_FOREACH_ODD_24(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_22(FN, __VA_ARGS__)
280 #define _SD_VARARGS_FOREACH_ODD_26(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_24(FN, __VA_ARGS__)
281 #define _SD_VARARGS_FOREACH_ODD_28(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_26(FN, __VA_ARGS__)
282 #define _SD_VARARGS_FOREACH_ODD_30(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_28(FN, __VA_ARGS__)
283 #define _SD_VARARGS_FOREACH_ODD_32(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_30(FN, __VA_ARGS__)
284 #define _SD_VARARGS_FOREACH_ODD_34(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_32(FN, __VA_ARGS__)
285 #define _SD_VARARGS_FOREACH_ODD_36(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_34(FN, __VA_ARGS__)
286 #define _SD_VARARGS_FOREACH_ODD_38(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_36(FN, __VA_ARGS__)
287 #define _SD_VARARGS_FOREACH_ODD_40(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_38(FN, __VA_ARGS__)
288 #define _SD_VARARGS_FOREACH_ODD_42(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_40(FN, __VA_ARGS__)
289 #define _SD_VARARGS_FOREACH_ODD_44(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_42(FN, __VA_ARGS__)
290 #define _SD_VARARGS_FOREACH_ODD_46(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_44(FN, __VA_ARGS__)
291 #define _SD_VARARGS_FOREACH_ODD_48(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_46(FN, __VA_ARGS__)
292 #define _SD_VARARGS_FOREACH_ODD_50(FN, X, Y, ...) FN(Y) _SD_VARARGS_FOREACH_ODD_48(FN, __VA_ARGS__)
293 
294 #define _SD_VARARGS_FOREACH_ODD(FN, ...)                                                \
295         _SD_VARARGS_FOREACH_SEQ(__VA_ARGS__,                                            \
296                                 _SD_VARARGS_FOREACH_ODD_50, _SD_VARARGS_FOREACH_ODD_49, \
297                                 _SD_VARARGS_FOREACH_ODD_48, _SD_VARARGS_FOREACH_ODD_47, \
298                                 _SD_VARARGS_FOREACH_ODD_46, _SD_VARARGS_FOREACH_ODD_45, \
299                                 _SD_VARARGS_FOREACH_ODD_44, _SD_VARARGS_FOREACH_ODD_43, \
300                                 _SD_VARARGS_FOREACH_ODD_42, _SD_VARARGS_FOREACH_ODD_41, \
301                                 _SD_VARARGS_FOREACH_ODD_40, _SD_VARARGS_FOREACH_ODD_39, \
302                                 _SD_VARARGS_FOREACH_ODD_38, _SD_VARARGS_FOREACH_ODD_37, \
303                                 _SD_VARARGS_FOREACH_ODD_36, _SD_VARARGS_FOREACH_ODD_35, \
304                                 _SD_VARARGS_FOREACH_ODD_34, _SD_VARARGS_FOREACH_ODD_33, \
305                                 _SD_VARARGS_FOREACH_ODD_32, _SD_VARARGS_FOREACH_ODD_31, \
306                                 _SD_VARARGS_FOREACH_ODD_30, _SD_VARARGS_FOREACH_ODD_29, \
307                                 _SD_VARARGS_FOREACH_ODD_28, _SD_VARARGS_FOREACH_ODD_27, \
308                                 _SD_VARARGS_FOREACH_ODD_26, _SD_VARARGS_FOREACH_ODD_25, \
309                                 _SD_VARARGS_FOREACH_ODD_24, _SD_VARARGS_FOREACH_ODD_23, \
310                                 _SD_VARARGS_FOREACH_ODD_22, _SD_VARARGS_FOREACH_ODD_21, \
311                                 _SD_VARARGS_FOREACH_ODD_20, _SD_VARARGS_FOREACH_ODD_19, \
312                                 _SD_VARARGS_FOREACH_ODD_18, _SD_VARARGS_FOREACH_ODD_17, \
313                                 _SD_VARARGS_FOREACH_ODD_16, _SD_VARARGS_FOREACH_ODD_15, \
314                                 _SD_VARARGS_FOREACH_ODD_14, _SD_VARARGS_FOREACH_ODD_13, \
315                                 _SD_VARARGS_FOREACH_ODD_12, _SD_VARARGS_FOREACH_ODD_11, \
316                                 _SD_VARARGS_FOREACH_ODD_10, _SD_VARARGS_FOREACH_ODD_09, \
317                                 _SD_VARARGS_FOREACH_ODD_08, _SD_VARARGS_FOREACH_ODD_07, \
318                                 _SD_VARARGS_FOREACH_ODD_06, _SD_VARARGS_FOREACH_ODD_05, \
319                                 _SD_VARARGS_FOREACH_ODD_04, _SD_VARARGS_FOREACH_ODD_03, \
320                                 _SD_VARARGS_FOREACH_ODD_02, _SD_VARARGS_FOREACH_ODD_01) \
321                                 (FN, __VA_ARGS__)
322 
323 #define SD_BUS_ARGS(...) __VA_ARGS__
324 #define SD_BUS_RESULT(...) __VA_ARGS__
325 
326 #define SD_BUS_NO_ARGS SD_BUS_ARGS(NULL)
327 #define SD_BUS_NO_RESULT SD_BUS_RESULT(NULL)
328 
329 #define SD_BUS_METHOD_WITH_ARGS(_member, _args, _result, _handler, _flags)                 \
330         SD_BUS_METHOD_WITH_NAMES(_member,                                                  \
331                                  _SD_VARARGS_FOREACH_EVEN(_SD_ECHO, _args),                \
332                                  _SD_VARARGS_FOREACH_ODD(_SD_CONCAT, _args),               \
333                                  _SD_VARARGS_FOREACH_EVEN(_SD_ECHO, _result),              \
334                                  _SD_VARARGS_FOREACH_ODD(_SD_CONCAT, _result) "\0",        \
335                                  _handler, _flags)
336 
337 #define SD_BUS_METHOD_WITH_ARGS_OFFSET(_member, _args, _result, _handler, _offset, _flags) \
338         SD_BUS_METHOD_WITH_NAMES_OFFSET(_member,                                           \
339                                         _SD_VARARGS_FOREACH_EVEN(_SD_ECHO, _args),         \
340                                         _SD_VARARGS_FOREACH_ODD(_SD_CONCAT, _args),        \
341                                         _SD_VARARGS_FOREACH_EVEN(_SD_ECHO, _result),       \
342                                         _SD_VARARGS_FOREACH_ODD(_SD_CONCAT, _result) "\0", \
343                                         _handler, _offset, _flags)
344 
345 #define SD_BUS_SIGNAL_WITH_ARGS(_member, _args, _flags)                                    \
346         SD_BUS_SIGNAL_WITH_NAMES(_member,                                                  \
347                                  _SD_VARARGS_FOREACH_EVEN(_SD_ECHO, _args),                \
348                                  _SD_VARARGS_FOREACH_ODD(_SD_CONCAT, _args) "\0",          \
349                                  _flags)
350 
351 _SD_END_DECLARATIONS;
352 
353 #endif
354