1 #pragma once
2 
3 #include <systemd/sd-bus.h>
4 
5 #include <chrono>
6 
7 // ABC for sdbus implementation.
8 namespace sdbusplus
9 {
10 
11 // Defined by systemd taking uint64_t usec params
12 using SdBusDuration =
13     std::chrono::duration<uint64_t, std::chrono::microseconds::period>;
14 
15 // A wrapper for interfacing or testing sd-bus.  This will hold methods for
16 // buses, messages, etc.
17 class SdBusInterface
18 {
19   public:
20     virtual ~SdBusInterface() = default;
21 
22     virtual int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot,
23                                           const char* path) = 0;
24 
25     virtual int sd_bus_add_object_vtable(
26         sd_bus* bus, sd_bus_slot** slot, const char* path,
27         const char* interface, const sd_bus_vtable* vtable, void* userdata) = 0;
28 
29     virtual int
30         sd_bus_add_match(sd_bus* bus, sd_bus_slot** slot, const char* path,
31                          sd_bus_message_handler_t callback, void* userdata) = 0;
32 
33     virtual int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) = 0;
34 
35     virtual int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec,
36                             sd_bus_error* ret_error,
37                             sd_bus_message** reply) = 0;
38 
39     virtual int sd_bus_call_async(
40         sd_bus* bus, sd_bus_slot** slot, sd_bus_message* m,
41         sd_bus_message_handler_t callback, void* userdata, uint64_t usec) = 0;
42 
43     virtual int sd_bus_detach_event(sd_bus* bus) = 0;
44 
45     virtual int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path,
46                                                   char** interfaces) = 0;
47     virtual int sd_bus_emit_interfaces_removed_strv(
48         sd_bus* bus, const char* path, char** interfaces) = 0;
49     virtual int sd_bus_emit_object_added(sd_bus* bus, const char* path) = 0;
50     virtual int sd_bus_emit_object_removed(sd_bus* bus, const char* path) = 0;
51     virtual int sd_bus_emit_properties_changed_strv(
52         sd_bus* bus, const char* path, const char* interface,
53         const char** names) = 0;
54 
55     virtual int sd_bus_error_set(sd_bus_error* e, const char* name,
56                                  const char* message) = 0;
57     virtual int sd_bus_error_set_const(sd_bus_error* e, const char* name,
58                                        const char* message) = 0;
59     virtual int sd_bus_error_get_errno(const sd_bus_error* e) = 0;
60     virtual int sd_bus_error_set_errno(sd_bus_error* e, int error) = 0;
61     virtual int sd_bus_error_is_set(const sd_bus_error* e) = 0;
62     virtual void sd_bus_error_free(sd_bus_error* e) = 0;
63 
64     virtual sd_event* sd_bus_get_event(sd_bus* bus) = 0;
65     virtual int sd_bus_get_fd(sd_bus* bus) = 0;
66     virtual int sd_bus_get_events(sd_bus* bus) = 0;
67     virtual int sd_bus_get_timeout(sd_bus* bus, uint64_t* timeout_usec) = 0;
68     virtual int sd_bus_get_unique_name(sd_bus* bus, const char** unique) = 0;
69 
70     virtual int sd_bus_list_names(sd_bus* bus, char*** acquired,
71                                   char*** activatable) = 0;
72 
73     // https://github.com/systemd/systemd/blob/master/src/systemd/sd-bus.h
74     virtual int sd_bus_message_append_basic(sd_bus_message* message, char type,
75                                             const void* value) = 0;
76 
77     virtual int sd_bus_message_append_string_iovec(
78         sd_bus_message* message, const struct iovec* iov, int iovcnt) = 0;
79 
80     virtual int sd_bus_message_at_end(sd_bus_message* m, int complete) = 0;
81 
82     virtual int sd_bus_message_close_container(sd_bus_message* m) = 0;
83 
84     virtual int sd_bus_message_enter_container(sd_bus_message* m, char type,
85                                                const char* contents) = 0;
86 
87     virtual int sd_bus_message_exit_container(sd_bus_message* m) = 0;
88 
89     virtual sd_bus* sd_bus_message_get_bus(sd_bus_message* m) = 0;
90     virtual int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) = 0;
91     virtual int sd_bus_message_get_cookie(sd_bus_message* m,
92                                           uint64_t* cookie) = 0;
93     virtual int sd_bus_message_get_reply_cookie(sd_bus_message* m,
94                                                 uint64_t* cookie) = 0;
95     virtual const char* sd_bus_message_get_destination(sd_bus_message* m) = 0;
96     virtual const char* sd_bus_message_get_interface(sd_bus_message* m) = 0;
97     virtual const char* sd_bus_message_get_member(sd_bus_message* m) = 0;
98     virtual const char* sd_bus_message_get_path(sd_bus_message* m) = 0;
99     virtual const char* sd_bus_message_get_sender(sd_bus_message* m) = 0;
100     virtual const char*
101         sd_bus_message_get_signature(sd_bus_message* m, int complete) = 0;
102     virtual int sd_bus_message_get_errno(sd_bus_message* m) = 0;
103     virtual const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) = 0;
104 
105     virtual int sd_bus_message_is_method_call(
106         sd_bus_message* m, const char* interface, const char* member) = 0;
107     virtual int sd_bus_message_is_method_error(sd_bus_message* m,
108                                                const char* name) = 0;
109     virtual int sd_bus_message_is_signal(
110         sd_bus_message* m, const char* interface, const char* member) = 0;
111 
112     virtual int sd_bus_message_new_method_call(
113         sd_bus* bus, sd_bus_message** m, const char* destination,
114         const char* path, const char* interface, const char* member) = 0;
115 
116     virtual int sd_bus_message_new_method_return(sd_bus_message* call,
117                                                  sd_bus_message** m) = 0;
118 
119     virtual int sd_bus_message_new_method_error(
120         sd_bus_message* call, sd_bus_message** m, sd_bus_error* e) = 0;
121 
122     virtual int sd_bus_message_new_method_errno(sd_bus_message* call,
123                                                 sd_bus_message** m, int error,
124                                                 const sd_bus_error* p) = 0;
125 
126     virtual int sd_bus_message_new_signal(
127         sd_bus* bus, sd_bus_message** m, const char* path,
128         const char* interface, const char* member) = 0;
129 
130     virtual int sd_bus_message_open_container(sd_bus_message* m, char type,
131                                               const char* contents) = 0;
132 
133     virtual int sd_bus_message_read_basic(sd_bus_message* m, char type,
134                                           void* p) = 0;
135 
136     virtual sd_bus_message* sd_bus_message_ref(sd_bus_message* m) = 0;
137 
138     virtual int sd_bus_message_skip(sd_bus_message* m, const char* types) = 0;
139 
140     virtual int sd_bus_message_verify_type(sd_bus_message* m, char type,
141                                            const char* contents) = 0;
142 
143     virtual int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot,
144                                                  sd_bus_destroy_t callback) = 0;
145 
146     virtual void* sd_bus_slot_set_userdata(sd_bus_slot* slot,
147                                            void* userdata) = 0;
148 
149     virtual int sd_bus_process(sd_bus* bus, sd_bus_message** r) = 0;
150 
151     virtual sd_bus* sd_bus_ref(sd_bus* bus) = 0;
152 
153     virtual int sd_bus_request_name(sd_bus* bus, const char* name,
154                                     uint64_t flags) = 0;
155 
156     virtual int sd_bus_send(sd_bus* bus, sd_bus_message* m,
157                             uint64_t* cookie) = 0;
158 
159     virtual sd_bus* sd_bus_unref(sd_bus* bus) = 0;
160     virtual sd_bus_slot* sd_bus_slot_unref(sd_bus_slot* slot) = 0;
161     virtual sd_bus* sd_bus_flush_close_unref(sd_bus* bus) = 0;
162 
163     virtual int sd_bus_flush(sd_bus* bus) = 0;
164     virtual void sd_bus_close(sd_bus* bus) = 0;
165     virtual int sd_bus_is_open(sd_bus* bus) = 0;
166 
167     virtual int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) = 0;
168 };
169 
170 class SdBusImpl : public SdBusInterface
171 {
172   public:
173     SdBusImpl() = default;
174     ~SdBusImpl() override = default;
175     SdBusImpl(const SdBusImpl&) = default;
176     SdBusImpl& operator=(const SdBusImpl&) = default;
177     SdBusImpl(SdBusImpl&&) = default;
178     SdBusImpl& operator=(SdBusImpl&&) = default;
179 
sd_bus_add_object_manager(sd_bus * bus,sd_bus_slot ** slot,const char * path)180     int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot,
181                                   const char* path) override
182     {
183         return ::sd_bus_add_object_manager(bus, slot, path);
184     }
185 
sd_bus_add_object_vtable(sd_bus * bus,sd_bus_slot ** slot,const char * path,const char * interface,const sd_bus_vtable * vtable,void * userdata)186     int sd_bus_add_object_vtable(sd_bus* bus, sd_bus_slot** slot,
187                                  const char* path, const char* interface,
188                                  const sd_bus_vtable* vtable,
189                                  void* userdata) override
190     {
191         return ::sd_bus_add_object_vtable(bus, slot, path, interface, vtable,
192                                           userdata);
193     }
194 
sd_bus_add_match(sd_bus * bus,sd_bus_slot ** slot,const char * path,sd_bus_message_handler_t callback,void * userdata)195     int sd_bus_add_match(sd_bus* bus, sd_bus_slot** slot, const char* path,
196                          sd_bus_message_handler_t callback,
197                          void* userdata) override
198     {
199         return ::sd_bus_add_match(bus, slot, path, callback, userdata);
200     }
201 
sd_bus_attach_event(sd_bus * bus,sd_event * e,int priority)202     int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) override
203     {
204         return ::sd_bus_attach_event(bus, e, priority);
205     }
206 
sd_bus_call(sd_bus * bus,sd_bus_message * m,uint64_t usec,sd_bus_error * ret_error,sd_bus_message ** reply)207     int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec,
208                     sd_bus_error* ret_error, sd_bus_message** reply) override
209     {
210         return ::sd_bus_call(bus, m, usec, ret_error, reply);
211     }
212 
sd_bus_call_async(sd_bus * bus,sd_bus_slot ** slot,sd_bus_message * m,sd_bus_message_handler_t callback,void * userdata,uint64_t usec)213     int sd_bus_call_async(sd_bus* bus, sd_bus_slot** slot, sd_bus_message* m,
214                           sd_bus_message_handler_t callback, void* userdata,
215                           uint64_t usec) override
216     {
217         return ::sd_bus_call_async(bus, slot, m, callback, userdata, usec);
218     }
219 
sd_bus_detach_event(sd_bus * bus)220     int sd_bus_detach_event(sd_bus* bus) override
221     {
222         return ::sd_bus_detach_event(bus);
223     }
224 
sd_bus_emit_interfaces_added_strv(sd_bus * bus,const char * path,char ** interfaces)225     int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path,
226                                           char** interfaces) override
227     {
228         return ::sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
229     }
230 
sd_bus_emit_interfaces_removed_strv(sd_bus * bus,const char * path,char ** interfaces)231     int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, const char* path,
232                                             char** interfaces) override
233     {
234         return ::sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
235     }
236 
sd_bus_emit_object_added(sd_bus * bus,const char * path)237     int sd_bus_emit_object_added(sd_bus* bus, const char* path) override
238     {
239         return ::sd_bus_emit_object_added(bus, path);
240     }
241 
sd_bus_emit_object_removed(sd_bus * bus,const char * path)242     int sd_bus_emit_object_removed(sd_bus* bus, const char* path) override
243     {
244         return ::sd_bus_emit_object_removed(bus, path);
245     }
246 
sd_bus_emit_properties_changed_strv(sd_bus * bus,const char * path,const char * interface,const char ** names)247     int sd_bus_emit_properties_changed_strv(sd_bus* bus, const char* path,
248                                             const char* interface,
249                                             const char** names) override
250     {
251         return ::sd_bus_emit_properties_changed_strv(bus, path, interface,
252                                                      const_cast<char**>(names));
253         // The const_cast above may seem unsafe, but it safe.  sd_bus's manpage
254         // shows a 'const char*' but the header does not.  I examined the code
255         // and no modification of the strings is done.  I tried to change sdbus
256         // directly but due to quirks of C you cannot implicitly convert a
257         // 'char **' to a 'const char**', so changing the implementation causes
258         // lots of compile failures due to an incompatible API change.
259         //
260         // Performing a const_cast allows us to avoid a memory allocation of
261         // the contained strings in 'interface::property_changed'.
262     }
263 
sd_bus_error_set(sd_bus_error * e,const char * name,const char * message)264     int sd_bus_error_set(sd_bus_error* e, const char* name,
265                          const char* message) override
266     {
267         return ::sd_bus_error_set(e, name, message);
268     }
269 
sd_bus_error_set_const(sd_bus_error * e,const char * name,const char * message)270     int sd_bus_error_set_const(sd_bus_error* e, const char* name,
271                                const char* message) override
272     {
273         return ::sd_bus_error_set_const(e, name, message);
274     }
275 
sd_bus_error_get_errno(const sd_bus_error * e)276     int sd_bus_error_get_errno(const sd_bus_error* e) override
277     {
278         return ::sd_bus_error_get_errno(e);
279     }
280 
sd_bus_error_set_errno(sd_bus_error * e,int error)281     int sd_bus_error_set_errno(sd_bus_error* e, int error) override
282     {
283         return ::sd_bus_error_set_errno(e, error);
284     }
285 
sd_bus_error_is_set(const sd_bus_error * e)286     int sd_bus_error_is_set(const sd_bus_error* e) override
287     {
288         return ::sd_bus_error_is_set(e);
289     }
290 
sd_bus_error_free(sd_bus_error * e)291     void sd_bus_error_free(sd_bus_error* e) override
292     {
293         return ::sd_bus_error_free(e);
294     }
295 
sd_bus_get_event(sd_bus * bus)296     sd_event* sd_bus_get_event(sd_bus* bus) override
297     {
298         return ::sd_bus_get_event(bus);
299     }
300 
sd_bus_get_fd(sd_bus * bus)301     int sd_bus_get_fd(sd_bus* bus) override
302     {
303         return ::sd_bus_get_fd(bus);
304     }
305 
sd_bus_get_events(sd_bus * bus)306     int sd_bus_get_events(sd_bus* bus) override
307     {
308         return ::sd_bus_get_events(bus);
309     }
310 
sd_bus_get_timeout(sd_bus * bus,uint64_t * timeout_usec)311     int sd_bus_get_timeout(sd_bus* bus, uint64_t* timeout_usec) override
312     {
313         return ::sd_bus_get_timeout(bus, timeout_usec);
314     }
315 
sd_bus_get_unique_name(sd_bus * bus,const char ** unique)316     int sd_bus_get_unique_name(sd_bus* bus, const char** unique) override
317     {
318         return ::sd_bus_get_unique_name(bus, unique);
319     }
320 
sd_bus_list_names(sd_bus * bus,char *** acquired,char *** activatable)321     int sd_bus_list_names(sd_bus* bus, char*** acquired,
322                           char*** activatable) override
323     {
324         return ::sd_bus_list_names(bus, acquired, activatable);
325     }
326 
sd_bus_message_append_basic(sd_bus_message * message,char type,const void * value)327     int sd_bus_message_append_basic(sd_bus_message* message, char type,
328                                     const void* value) override
329     {
330         return ::sd_bus_message_append_basic(message, type, value);
331     }
332 
sd_bus_message_append_string_iovec(sd_bus_message * message,const struct iovec * iov,int iovcnt)333     int sd_bus_message_append_string_iovec(
334         sd_bus_message* message, const struct iovec* iov, int iovcnt) override
335     {
336         return ::sd_bus_message_append_string_iovec(message, iov, iovcnt);
337     }
338 
sd_bus_message_at_end(sd_bus_message * m,int complete)339     int sd_bus_message_at_end(sd_bus_message* m, int complete) override
340     {
341         return ::sd_bus_message_at_end(m, complete);
342     }
343 
sd_bus_message_close_container(sd_bus_message * m)344     int sd_bus_message_close_container(sd_bus_message* m) override
345     {
346         return ::sd_bus_message_close_container(m);
347     }
348 
sd_bus_message_enter_container(sd_bus_message * m,char type,const char * contents)349     int sd_bus_message_enter_container(sd_bus_message* m, char type,
350                                        const char* contents) override
351     {
352         return ::sd_bus_message_enter_container(m, type, contents);
353     }
354 
sd_bus_message_exit_container(sd_bus_message * m)355     int sd_bus_message_exit_container(sd_bus_message* m) override
356     {
357         return ::sd_bus_message_exit_container(m);
358     }
359 
sd_bus_message_get_bus(sd_bus_message * m)360     sd_bus* sd_bus_message_get_bus(sd_bus_message* m) override
361     {
362         return ::sd_bus_message_get_bus(m);
363     }
364 
sd_bus_message_get_type(sd_bus_message * m,uint8_t * type)365     int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) override
366     {
367         return ::sd_bus_message_get_type(m, type);
368     }
369 
sd_bus_message_get_cookie(sd_bus_message * m,uint64_t * cookie)370     int sd_bus_message_get_cookie(sd_bus_message* m, uint64_t* cookie) override
371     {
372         return ::sd_bus_message_get_cookie(m, cookie);
373     }
374 
sd_bus_message_get_reply_cookie(sd_bus_message * m,uint64_t * cookie)375     int sd_bus_message_get_reply_cookie(sd_bus_message* m,
376                                         uint64_t* cookie) override
377     {
378         return ::sd_bus_message_get_reply_cookie(m, cookie);
379     }
380 
sd_bus_message_get_destination(sd_bus_message * m)381     const char* sd_bus_message_get_destination(sd_bus_message* m) override
382     {
383         return ::sd_bus_message_get_destination(m);
384     }
385 
sd_bus_message_get_interface(sd_bus_message * m)386     const char* sd_bus_message_get_interface(sd_bus_message* m) override
387     {
388         return ::sd_bus_message_get_interface(m);
389     }
390 
sd_bus_message_get_member(sd_bus_message * m)391     const char* sd_bus_message_get_member(sd_bus_message* m) override
392     {
393         return ::sd_bus_message_get_member(m);
394     }
395 
sd_bus_message_get_path(sd_bus_message * m)396     const char* sd_bus_message_get_path(sd_bus_message* m) override
397     {
398         return ::sd_bus_message_get_path(m);
399     }
400 
sd_bus_message_get_sender(sd_bus_message * m)401     const char* sd_bus_message_get_sender(sd_bus_message* m) override
402     {
403         return ::sd_bus_message_get_sender(m);
404     }
405 
sd_bus_message_get_signature(sd_bus_message * m,int complete)406     const char* sd_bus_message_get_signature(sd_bus_message* m,
407                                              int complete) override
408     {
409         return ::sd_bus_message_get_signature(m, complete);
410     }
411 
sd_bus_message_get_errno(sd_bus_message * m)412     int sd_bus_message_get_errno(sd_bus_message* m) override
413     {
414         return ::sd_bus_message_get_errno(m);
415     }
416 
sd_bus_message_get_error(sd_bus_message * m)417     const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) override
418     {
419         return ::sd_bus_message_get_error(m);
420     }
421 
sd_bus_message_is_method_call(sd_bus_message * m,const char * interface,const char * member)422     int sd_bus_message_is_method_call(sd_bus_message* m, const char* interface,
423                                       const char* member) override
424     {
425         return ::sd_bus_message_is_method_call(m, interface, member);
426     }
427 
sd_bus_message_is_method_error(sd_bus_message * m,const char * name)428     int sd_bus_message_is_method_error(sd_bus_message* m,
429                                        const char* name) override
430     {
431         return ::sd_bus_message_is_method_error(m, name);
432     }
433 
sd_bus_message_is_signal(sd_bus_message * m,const char * interface,const char * member)434     int sd_bus_message_is_signal(sd_bus_message* m, const char* interface,
435                                  const char* member) override
436     {
437         return ::sd_bus_message_is_signal(m, interface, member);
438     }
439 
sd_bus_message_new_method_call(sd_bus * bus,sd_bus_message ** m,const char * destination,const char * path,const char * interface,const char * member)440     int sd_bus_message_new_method_call(
441         sd_bus* bus, sd_bus_message** m, const char* destination,
442         const char* path, const char* interface, const char* member) override
443     {
444         return ::sd_bus_message_new_method_call(bus, m, destination, path,
445                                                 interface, member);
446     }
447 
sd_bus_message_new_method_return(sd_bus_message * call,sd_bus_message ** m)448     int sd_bus_message_new_method_return(sd_bus_message* call,
449                                          sd_bus_message** m) override
450     {
451         return ::sd_bus_message_new_method_return(call, m);
452     }
453 
sd_bus_message_new_method_error(sd_bus_message * call,sd_bus_message ** m,sd_bus_error * e)454     int sd_bus_message_new_method_error(
455         sd_bus_message* call, sd_bus_message** m, sd_bus_error* e) override
456     {
457         return ::sd_bus_message_new_method_error(call, m, e);
458     }
459 
sd_bus_message_new_method_errno(sd_bus_message * call,sd_bus_message ** m,int error,const sd_bus_error * p)460     int sd_bus_message_new_method_errno(sd_bus_message* call,
461                                         sd_bus_message** m, int error,
462                                         const sd_bus_error* p) override
463     {
464         return ::sd_bus_message_new_method_errno(call, m, error, p);
465     }
466 
sd_bus_message_new_signal(sd_bus * bus,sd_bus_message ** m,const char * path,const char * interface,const char * member)467     int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m,
468                                   const char* path, const char* interface,
469                                   const char* member) override
470     {
471         return ::sd_bus_message_new_signal(bus, m, path, interface, member);
472     }
473 
sd_bus_message_open_container(sd_bus_message * m,char type,const char * contents)474     int sd_bus_message_open_container(sd_bus_message* m, char type,
475                                       const char* contents) override
476     {
477         return ::sd_bus_message_open_container(m, type, contents);
478     }
479 
sd_bus_message_read_basic(sd_bus_message * m,char type,void * p)480     int sd_bus_message_read_basic(sd_bus_message* m, char type,
481                                   void* p) override
482     {
483         return ::sd_bus_message_read_basic(m, type, p);
484     }
485 
sd_bus_message_ref(sd_bus_message * m)486     sd_bus_message* sd_bus_message_ref(sd_bus_message* m) override
487     {
488         return ::sd_bus_message_ref(m);
489     }
490 
sd_bus_message_skip(sd_bus_message * m,const char * types)491     int sd_bus_message_skip(sd_bus_message* m, const char* types) override
492     {
493         return ::sd_bus_message_skip(m, types);
494     }
495 
sd_bus_message_verify_type(sd_bus_message * m,char type,const char * contents)496     int sd_bus_message_verify_type(sd_bus_message* m, char type,
497                                    const char* contents) override
498     {
499         return ::sd_bus_message_verify_type(m, type, contents);
500     }
501 
sd_bus_slot_set_destroy_callback(sd_bus_slot * slot,sd_bus_destroy_t callback)502     int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot,
503                                          sd_bus_destroy_t callback) override
504     {
505         return ::sd_bus_slot_set_destroy_callback(slot, callback);
506     }
507 
sd_bus_slot_set_userdata(sd_bus_slot * slot,void * userdata)508     void* sd_bus_slot_set_userdata(sd_bus_slot* slot, void* userdata) override
509     {
510         return ::sd_bus_slot_set_userdata(slot, userdata);
511     }
512 
sd_bus_process(sd_bus * bus,sd_bus_message ** r)513     int sd_bus_process(sd_bus* bus, sd_bus_message** r) override
514     {
515         return ::sd_bus_process(bus, r);
516     }
517 
sd_bus_ref(sd_bus * bus)518     sd_bus* sd_bus_ref(sd_bus* bus) override
519     {
520         return ::sd_bus_ref(bus);
521     }
522 
sd_bus_request_name(sd_bus * bus,const char * name,uint64_t flags)523     int sd_bus_request_name(sd_bus* bus, const char* name,
524                             uint64_t flags) override
525     {
526         return ::sd_bus_request_name(bus, name, flags);
527     }
528 
sd_bus_send(sd_bus * bus,sd_bus_message * m,uint64_t * cookie)529     int sd_bus_send(sd_bus* bus, sd_bus_message* m, uint64_t* cookie) override
530     {
531         return ::sd_bus_send(bus, m, cookie);
532     }
533 
sd_bus_unref(sd_bus * bus)534     sd_bus* sd_bus_unref(sd_bus* bus) override
535     {
536         return ::sd_bus_unref(bus);
537     }
538 
sd_bus_slot_unref(sd_bus_slot * slot)539     sd_bus_slot* sd_bus_slot_unref(sd_bus_slot* slot) override
540     {
541         return ::sd_bus_slot_unref(slot);
542     }
543 
sd_bus_flush_close_unref(sd_bus * bus)544     sd_bus* sd_bus_flush_close_unref(sd_bus* bus) override
545     {
546         return ::sd_bus_flush_close_unref(bus);
547     }
548 
sd_bus_flush(sd_bus * bus)549     int sd_bus_flush(sd_bus* bus) override
550     {
551         return ::sd_bus_flush(bus);
552     }
553 
sd_bus_close(sd_bus * bus)554     void sd_bus_close(sd_bus* bus) override
555     {
556         ::sd_bus_close(bus);
557     }
558 
sd_bus_is_open(sd_bus * bus)559     int sd_bus_is_open(sd_bus* bus) override
560     {
561         return ::sd_bus_is_open(bus);
562     }
563 
sd_bus_wait(sd_bus * bus,uint64_t timeout_usec)564     int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) override
565     {
566         return ::sd_bus_wait(bus, timeout_usec);
567     }
568 };
569 
570 extern SdBusImpl sdbus_impl;
571 
572 } // namespace sdbusplus
573