17f664254SPatrick Williams #pragma once
27f664254SPatrick Williams 
37f664254SPatrick Williams #include <systemd/sd-bus.h>
47f664254SPatrick Williams 
57f664254SPatrick Williams #include <chrono>
67f664254SPatrick Williams 
77f664254SPatrick Williams // ABC for sdbus implementation.
87f664254SPatrick Williams namespace sdbusplus
97f664254SPatrick Williams {
107f664254SPatrick Williams 
117f664254SPatrick Williams // Defined by systemd taking uint64_t usec params
127f664254SPatrick Williams using SdBusDuration =
137f664254SPatrick Williams     std::chrono::duration<uint64_t, std::chrono::microseconds::period>;
147f664254SPatrick Williams 
157f664254SPatrick Williams // A wrapper for interfacing or testing sd-bus.  This will hold methods for
167f664254SPatrick Williams // buses, messages, etc.
177f664254SPatrick Williams class SdBusInterface
187f664254SPatrick Williams {
197f664254SPatrick Williams   public:
207f664254SPatrick Williams     virtual ~SdBusInterface() = default;
217f664254SPatrick Williams 
227f664254SPatrick Williams     virtual int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot,
237f664254SPatrick Williams                                           const char* path) = 0;
247f664254SPatrick Williams 
2506f265f6SPatrick Williams     virtual int sd_bus_add_object_vtable(
2606f265f6SPatrick Williams         sd_bus* bus, sd_bus_slot** slot, const char* path,
2706f265f6SPatrick Williams         const char* interface, const sd_bus_vtable* vtable, void* userdata) = 0;
287f664254SPatrick Williams 
2906f265f6SPatrick Williams     virtual int
3006f265f6SPatrick Williams         sd_bus_add_match(sd_bus* bus, sd_bus_slot** slot, const char* path,
3106f265f6SPatrick Williams                          sd_bus_message_handler_t callback, void* userdata) = 0;
329d8ba947SWilliam A. Kennington III 
337f664254SPatrick Williams     virtual int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) = 0;
347f664254SPatrick Williams 
357f664254SPatrick Williams     virtual int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec,
367f664254SPatrick Williams                             sd_bus_error* ret_error,
377f664254SPatrick Williams                             sd_bus_message** reply) = 0;
387f664254SPatrick Williams 
3906f265f6SPatrick Williams     virtual int sd_bus_call_async(
4006f265f6SPatrick Williams         sd_bus* bus, sd_bus_slot** slot, sd_bus_message* m,
4106f265f6SPatrick Williams         sd_bus_message_handler_t callback, void* userdata, uint64_t usec) = 0;
42472b7022SWilliam A. Kennington III 
437f664254SPatrick Williams     virtual int sd_bus_detach_event(sd_bus* bus) = 0;
447f664254SPatrick Williams 
457f664254SPatrick Williams     virtual int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path,
467f664254SPatrick Williams                                                   char** interfaces) = 0;
4706f265f6SPatrick Williams     virtual int sd_bus_emit_interfaces_removed_strv(
4806f265f6SPatrick Williams         sd_bus* bus, const char* path, char** interfaces) = 0;
497f664254SPatrick Williams     virtual int sd_bus_emit_object_added(sd_bus* bus, const char* path) = 0;
507f664254SPatrick Williams     virtual int sd_bus_emit_object_removed(sd_bus* bus, const char* path) = 0;
5106f265f6SPatrick Williams     virtual int sd_bus_emit_properties_changed_strv(
5206f265f6SPatrick Williams         sd_bus* bus, const char* path, const char* interface,
53e659436dSPatrick Williams         const char** names) = 0;
547f664254SPatrick Williams 
557f664254SPatrick Williams     virtual int sd_bus_error_set(sd_bus_error* e, const char* name,
567f664254SPatrick Williams                                  const char* message) = 0;
577f664254SPatrick Williams     virtual int sd_bus_error_set_const(sd_bus_error* e, const char* name,
587f664254SPatrick Williams                                        const char* message) = 0;
597f664254SPatrick Williams     virtual int sd_bus_error_get_errno(const sd_bus_error* e) = 0;
607f664254SPatrick Williams     virtual int sd_bus_error_set_errno(sd_bus_error* e, int error) = 0;
617f664254SPatrick Williams     virtual int sd_bus_error_is_set(const sd_bus_error* e) = 0;
627f664254SPatrick Williams     virtual void sd_bus_error_free(sd_bus_error* e) = 0;
637f664254SPatrick Williams 
647f664254SPatrick Williams     virtual sd_event* sd_bus_get_event(sd_bus* bus) = 0;
657f664254SPatrick Williams     virtual int sd_bus_get_fd(sd_bus* bus) = 0;
667f664254SPatrick Williams     virtual int sd_bus_get_unique_name(sd_bus* bus, const char** unique) = 0;
677f664254SPatrick Williams 
687f664254SPatrick Williams     virtual int sd_bus_list_names(sd_bus* bus, char*** acquired,
697f664254SPatrick Williams                                   char*** activatable) = 0;
707f664254SPatrick Williams 
717f664254SPatrick Williams     // https://github.com/systemd/systemd/blob/master/src/systemd/sd-bus.h
727f664254SPatrick Williams     virtual int sd_bus_message_append_basic(sd_bus_message* message, char type,
737f664254SPatrick Williams                                             const void* value) = 0;
747f664254SPatrick Williams 
7506f265f6SPatrick Williams     virtual int sd_bus_message_append_string_iovec(
7606f265f6SPatrick Williams         sd_bus_message* message, const struct iovec* iov, int iovcnt) = 0;
77640a7d56SEd Tanous 
787f664254SPatrick Williams     virtual int sd_bus_message_at_end(sd_bus_message* m, int complete) = 0;
797f664254SPatrick Williams 
807f664254SPatrick Williams     virtual int sd_bus_message_close_container(sd_bus_message* m) = 0;
817f664254SPatrick Williams 
827f664254SPatrick Williams     virtual int sd_bus_message_enter_container(sd_bus_message* m, char type,
837f664254SPatrick Williams                                                const char* contents) = 0;
847f664254SPatrick Williams 
857f664254SPatrick Williams     virtual int sd_bus_message_exit_container(sd_bus_message* m) = 0;
867f664254SPatrick Williams 
877f664254SPatrick Williams     virtual sd_bus* sd_bus_message_get_bus(sd_bus_message* m) = 0;
887f664254SPatrick Williams     virtual int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) = 0;
897f664254SPatrick Williams     virtual int sd_bus_message_get_cookie(sd_bus_message* m,
907f664254SPatrick Williams                                           uint64_t* cookie) = 0;
917f664254SPatrick Williams     virtual int sd_bus_message_get_reply_cookie(sd_bus_message* m,
927f664254SPatrick Williams                                                 uint64_t* cookie) = 0;
937f664254SPatrick Williams     virtual const char* sd_bus_message_get_destination(sd_bus_message* m) = 0;
947f664254SPatrick Williams     virtual const char* sd_bus_message_get_interface(sd_bus_message* m) = 0;
957f664254SPatrick Williams     virtual const char* sd_bus_message_get_member(sd_bus_message* m) = 0;
967f664254SPatrick Williams     virtual const char* sd_bus_message_get_path(sd_bus_message* m) = 0;
977f664254SPatrick Williams     virtual const char* sd_bus_message_get_sender(sd_bus_message* m) = 0;
9806f265f6SPatrick Williams     virtual const char*
9906f265f6SPatrick Williams         sd_bus_message_get_signature(sd_bus_message* m, int complete) = 0;
1007f664254SPatrick Williams     virtual int sd_bus_message_get_errno(sd_bus_message* m) = 0;
1017f664254SPatrick Williams     virtual const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) = 0;
1027f664254SPatrick Williams 
10306f265f6SPatrick Williams     virtual int sd_bus_message_is_method_call(
10406f265f6SPatrick Williams         sd_bus_message* m, const char* interface, const char* member) = 0;
1057f664254SPatrick Williams     virtual int sd_bus_message_is_method_error(sd_bus_message* m,
1067f664254SPatrick Williams                                                const char* name) = 0;
10706f265f6SPatrick Williams     virtual int sd_bus_message_is_signal(
10806f265f6SPatrick Williams         sd_bus_message* m, const char* interface, const char* member) = 0;
1097f664254SPatrick Williams 
11006f265f6SPatrick Williams     virtual int sd_bus_message_new_method_call(
11106f265f6SPatrick Williams         sd_bus* bus, sd_bus_message** m, const char* destination,
11206f265f6SPatrick Williams         const char* path, const char* interface, const char* member) = 0;
1137f664254SPatrick Williams 
1147f664254SPatrick Williams     virtual int sd_bus_message_new_method_return(sd_bus_message* call,
1157f664254SPatrick Williams                                                  sd_bus_message** m) = 0;
1167f664254SPatrick Williams 
11706f265f6SPatrick Williams     virtual int sd_bus_message_new_method_error(
118*a4bfefdeSPatrick Williams         sd_bus_message* call, sd_bus_message** m, sd_bus_error* e) = 0;
119f534ba04SWilliam A. Kennington III 
1207f664254SPatrick Williams     virtual int sd_bus_message_new_method_errno(sd_bus_message* call,
1217f664254SPatrick Williams                                                 sd_bus_message** m, int error,
1227f664254SPatrick Williams                                                 const sd_bus_error* p) = 0;
1237f664254SPatrick Williams 
12406f265f6SPatrick Williams     virtual int sd_bus_message_new_signal(
12506f265f6SPatrick Williams         sd_bus* bus, sd_bus_message** m, const char* path,
12606f265f6SPatrick Williams         const char* interface, const char* member) = 0;
1277f664254SPatrick Williams 
1287f664254SPatrick Williams     virtual int sd_bus_message_open_container(sd_bus_message* m, char type,
1297f664254SPatrick Williams                                               const char* contents) = 0;
1307f664254SPatrick Williams 
1317f664254SPatrick Williams     virtual int sd_bus_message_read_basic(sd_bus_message* m, char type,
1327f664254SPatrick Williams                                           void* p) = 0;
1337f664254SPatrick Williams 
1347f664254SPatrick Williams     virtual sd_bus_message* sd_bus_message_ref(sd_bus_message* m) = 0;
1357f664254SPatrick Williams 
1367f664254SPatrick Williams     virtual int sd_bus_message_skip(sd_bus_message* m, const char* types) = 0;
1377f664254SPatrick Williams 
1387f664254SPatrick Williams     virtual int sd_bus_message_verify_type(sd_bus_message* m, char type,
1397f664254SPatrick Williams                                            const char* contents) = 0;
1407f664254SPatrick Williams 
141472b7022SWilliam A. Kennington III     virtual int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot,
142472b7022SWilliam A. Kennington III                                                  sd_bus_destroy_t callback) = 0;
143472b7022SWilliam A. Kennington III 
144472b7022SWilliam A. Kennington III     virtual void* sd_bus_slot_set_userdata(sd_bus_slot* slot,
145472b7022SWilliam A. Kennington III                                            void* userdata) = 0;
146472b7022SWilliam A. Kennington III 
1477f664254SPatrick Williams     virtual int sd_bus_process(sd_bus* bus, sd_bus_message** r) = 0;
1487f664254SPatrick Williams 
1497f664254SPatrick Williams     virtual sd_bus* sd_bus_ref(sd_bus* bus) = 0;
1507f664254SPatrick Williams 
1517f664254SPatrick Williams     virtual int sd_bus_request_name(sd_bus* bus, const char* name,
1527f664254SPatrick Williams                                     uint64_t flags) = 0;
1537f664254SPatrick Williams 
1547f664254SPatrick Williams     virtual int sd_bus_send(sd_bus* bus, sd_bus_message* m,
1557f664254SPatrick Williams                             uint64_t* cookie) = 0;
1567f664254SPatrick Williams 
1577f664254SPatrick Williams     virtual sd_bus* sd_bus_unref(sd_bus* bus) = 0;
1589d8ba947SWilliam A. Kennington III     virtual sd_bus_slot* sd_bus_slot_unref(sd_bus_slot* slot) = 0;
1597f664254SPatrick Williams     virtual sd_bus* sd_bus_flush_close_unref(sd_bus* bus) = 0;
1607f664254SPatrick Williams 
1617f664254SPatrick Williams     virtual int sd_bus_flush(sd_bus* bus) = 0;
1627f664254SPatrick Williams     virtual void sd_bus_close(sd_bus* bus) = 0;
1635d81ca2bSWilliam A. Kennington III     virtual int sd_bus_is_open(sd_bus* bus) = 0;
1647f664254SPatrick Williams 
1657f664254SPatrick Williams     virtual int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) = 0;
1667f664254SPatrick Williams };
1677f664254SPatrick Williams 
1687f664254SPatrick Williams class SdBusImpl : public SdBusInterface
1697f664254SPatrick Williams {
1707f664254SPatrick Williams   public:
1717f664254SPatrick Williams     SdBusImpl() = default;
1720eda6ebfSBrad Bishop     ~SdBusImpl() override = default;
1737f664254SPatrick Williams     SdBusImpl(const SdBusImpl&) = default;
1747f664254SPatrick Williams     SdBusImpl& operator=(const SdBusImpl&) = default;
1757f664254SPatrick Williams     SdBusImpl(SdBusImpl&&) = default;
1767f664254SPatrick Williams     SdBusImpl& operator=(SdBusImpl&&) = default;
1777f664254SPatrick Williams 
sd_bus_add_object_manager(sd_bus * bus,sd_bus_slot ** slot,const char * path)1787f664254SPatrick Williams     int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot,
1797f664254SPatrick Williams                                   const char* path) override
1807f664254SPatrick Williams     {
1817f664254SPatrick Williams         return ::sd_bus_add_object_manager(bus, slot, path);
1827f664254SPatrick Williams     }
1837f664254SPatrick Williams 
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)1847f664254SPatrick Williams     int sd_bus_add_object_vtable(sd_bus* bus, sd_bus_slot** slot,
1857f664254SPatrick Williams                                  const char* path, const char* interface,
1867f664254SPatrick Williams                                  const sd_bus_vtable* vtable,
1877f664254SPatrick Williams                                  void* userdata) override
1887f664254SPatrick Williams     {
1897f664254SPatrick Williams         return ::sd_bus_add_object_vtable(bus, slot, path, interface, vtable,
1907f664254SPatrick Williams                                           userdata);
1917f664254SPatrick Williams     }
1927f664254SPatrick Williams 
sd_bus_add_match(sd_bus * bus,sd_bus_slot ** slot,const char * path,sd_bus_message_handler_t callback,void * userdata)1939d8ba947SWilliam A. Kennington III     int sd_bus_add_match(sd_bus* bus, sd_bus_slot** slot, const char* path,
1949d8ba947SWilliam A. Kennington III                          sd_bus_message_handler_t callback,
1959d8ba947SWilliam A. Kennington III                          void* userdata) override
1969d8ba947SWilliam A. Kennington III     {
1979d8ba947SWilliam A. Kennington III         return ::sd_bus_add_match(bus, slot, path, callback, userdata);
1989d8ba947SWilliam A. Kennington III     }
1999d8ba947SWilliam A. Kennington III 
sd_bus_attach_event(sd_bus * bus,sd_event * e,int priority)2007f664254SPatrick Williams     int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) override
2017f664254SPatrick Williams     {
2027f664254SPatrick Williams         return ::sd_bus_attach_event(bus, e, priority);
2037f664254SPatrick Williams     }
2047f664254SPatrick Williams 
sd_bus_call(sd_bus * bus,sd_bus_message * m,uint64_t usec,sd_bus_error * ret_error,sd_bus_message ** reply)2057f664254SPatrick Williams     int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec,
2067f664254SPatrick Williams                     sd_bus_error* ret_error, sd_bus_message** reply) override
2077f664254SPatrick Williams     {
2087f664254SPatrick Williams         return ::sd_bus_call(bus, m, usec, ret_error, reply);
2097f664254SPatrick Williams     }
2107f664254SPatrick Williams 
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)211472b7022SWilliam A. Kennington III     int sd_bus_call_async(sd_bus* bus, sd_bus_slot** slot, sd_bus_message* m,
212472b7022SWilliam A. Kennington III                           sd_bus_message_handler_t callback, void* userdata,
213472b7022SWilliam A. Kennington III                           uint64_t usec) override
214472b7022SWilliam A. Kennington III     {
215472b7022SWilliam A. Kennington III         return ::sd_bus_call_async(bus, slot, m, callback, userdata, usec);
216472b7022SWilliam A. Kennington III     }
217472b7022SWilliam A. Kennington III 
sd_bus_detach_event(sd_bus * bus)2187f664254SPatrick Williams     int sd_bus_detach_event(sd_bus* bus) override
2197f664254SPatrick Williams     {
2207f664254SPatrick Williams         return ::sd_bus_detach_event(bus);
2217f664254SPatrick Williams     }
2227f664254SPatrick Williams 
sd_bus_emit_interfaces_added_strv(sd_bus * bus,const char * path,char ** interfaces)2237f664254SPatrick Williams     int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path,
2247f664254SPatrick Williams                                           char** interfaces) override
2257f664254SPatrick Williams     {
2267f664254SPatrick Williams         return ::sd_bus_emit_interfaces_added_strv(bus, path, interfaces);
2277f664254SPatrick Williams     }
2287f664254SPatrick Williams 
sd_bus_emit_interfaces_removed_strv(sd_bus * bus,const char * path,char ** interfaces)2297f664254SPatrick Williams     int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, const char* path,
2307f664254SPatrick Williams                                             char** interfaces) override
2317f664254SPatrick Williams     {
2327f664254SPatrick Williams         return ::sd_bus_emit_interfaces_removed_strv(bus, path, interfaces);
2337f664254SPatrick Williams     }
2347f664254SPatrick Williams 
sd_bus_emit_object_added(sd_bus * bus,const char * path)2357f664254SPatrick Williams     int sd_bus_emit_object_added(sd_bus* bus, const char* path) override
2367f664254SPatrick Williams     {
2377f664254SPatrick Williams         return ::sd_bus_emit_object_added(bus, path);
2387f664254SPatrick Williams     }
2397f664254SPatrick Williams 
sd_bus_emit_object_removed(sd_bus * bus,const char * path)2407f664254SPatrick Williams     int sd_bus_emit_object_removed(sd_bus* bus, const char* path) override
2417f664254SPatrick Williams     {
2427f664254SPatrick Williams         return ::sd_bus_emit_object_removed(bus, path);
2437f664254SPatrick Williams     }
2447f664254SPatrick Williams 
sd_bus_emit_properties_changed_strv(sd_bus * bus,const char * path,const char * interface,const char ** names)2457f664254SPatrick Williams     int sd_bus_emit_properties_changed_strv(sd_bus* bus, const char* path,
2467f664254SPatrick Williams                                             const char* interface,
247e659436dSPatrick Williams                                             const char** names) override
2487f664254SPatrick Williams     {
2497f664254SPatrick Williams         return ::sd_bus_emit_properties_changed_strv(bus, path, interface,
250e659436dSPatrick Williams                                                      const_cast<char**>(names));
251e659436dSPatrick Williams         // The const_cast above may seem unsafe, but it safe.  sd_bus's manpage
252e659436dSPatrick Williams         // shows a 'const char*' but the header does not.  I examined the code
253e659436dSPatrick Williams         // and no modification of the strings is done.  I tried to change sdbus
254e659436dSPatrick Williams         // directly but due to quirks of C you cannot implicitly convert a
255e659436dSPatrick Williams         // 'char **' to a 'const char**', so changing the implementation causes
256e659436dSPatrick Williams         // lots of compile failures due to an incompatible API change.
257e659436dSPatrick Williams         //
258e659436dSPatrick Williams         // Performing a const_cast allows us to avoid a memory allocation of
259e659436dSPatrick Williams         // the contained strings in 'interface::property_changed'.
2607f664254SPatrick Williams     }
2617f664254SPatrick Williams 
sd_bus_error_set(sd_bus_error * e,const char * name,const char * message)2627f664254SPatrick Williams     int sd_bus_error_set(sd_bus_error* e, const char* name,
2637f664254SPatrick Williams                          const char* message) override
2647f664254SPatrick Williams     {
2657f664254SPatrick Williams         return ::sd_bus_error_set(e, name, message);
2667f664254SPatrick Williams     }
2677f664254SPatrick Williams 
sd_bus_error_set_const(sd_bus_error * e,const char * name,const char * message)2687f664254SPatrick Williams     int sd_bus_error_set_const(sd_bus_error* e, const char* name,
2697f664254SPatrick Williams                                const char* message) override
2707f664254SPatrick Williams     {
2717f664254SPatrick Williams         return ::sd_bus_error_set_const(e, name, message);
2727f664254SPatrick Williams     }
2737f664254SPatrick Williams 
sd_bus_error_get_errno(const sd_bus_error * e)2747f664254SPatrick Williams     int sd_bus_error_get_errno(const sd_bus_error* e) override
2757f664254SPatrick Williams     {
2767f664254SPatrick Williams         return ::sd_bus_error_get_errno(e);
2777f664254SPatrick Williams     }
2787f664254SPatrick Williams 
sd_bus_error_set_errno(sd_bus_error * e,int error)2797f664254SPatrick Williams     int sd_bus_error_set_errno(sd_bus_error* e, int error) override
2807f664254SPatrick Williams     {
2817f664254SPatrick Williams         return ::sd_bus_error_set_errno(e, error);
2827f664254SPatrick Williams     }
2837f664254SPatrick Williams 
sd_bus_error_is_set(const sd_bus_error * e)2847f664254SPatrick Williams     int sd_bus_error_is_set(const sd_bus_error* e) override
2857f664254SPatrick Williams     {
2867f664254SPatrick Williams         return ::sd_bus_error_is_set(e);
2877f664254SPatrick Williams     }
2887f664254SPatrick Williams 
sd_bus_error_free(sd_bus_error * e)2897f664254SPatrick Williams     void sd_bus_error_free(sd_bus_error* e) override
2907f664254SPatrick Williams     {
2917f664254SPatrick Williams         return ::sd_bus_error_free(e);
2927f664254SPatrick Williams     }
2937f664254SPatrick Williams 
sd_bus_get_event(sd_bus * bus)2947f664254SPatrick Williams     sd_event* sd_bus_get_event(sd_bus* bus) override
2957f664254SPatrick Williams     {
2967f664254SPatrick Williams         return ::sd_bus_get_event(bus);
2977f664254SPatrick Williams     }
2987f664254SPatrick Williams 
sd_bus_get_fd(sd_bus * bus)2997f664254SPatrick Williams     int sd_bus_get_fd(sd_bus* bus) override
3007f664254SPatrick Williams     {
3017f664254SPatrick Williams         return ::sd_bus_get_fd(bus);
3027f664254SPatrick Williams     }
3037f664254SPatrick Williams 
sd_bus_get_unique_name(sd_bus * bus,const char ** unique)3047f664254SPatrick Williams     int sd_bus_get_unique_name(sd_bus* bus, const char** unique) override
3057f664254SPatrick Williams     {
3067f664254SPatrick Williams         return ::sd_bus_get_unique_name(bus, unique);
3077f664254SPatrick Williams     }
3087f664254SPatrick Williams 
sd_bus_list_names(sd_bus * bus,char *** acquired,char *** activatable)3097f664254SPatrick Williams     int sd_bus_list_names(sd_bus* bus, char*** acquired,
3107f664254SPatrick Williams                           char*** activatable) override
3117f664254SPatrick Williams     {
3127f664254SPatrick Williams         return ::sd_bus_list_names(bus, acquired, activatable);
3137f664254SPatrick Williams     }
3147f664254SPatrick Williams 
sd_bus_message_append_basic(sd_bus_message * message,char type,const void * value)3157f664254SPatrick Williams     int sd_bus_message_append_basic(sd_bus_message* message, char type,
3167f664254SPatrick Williams                                     const void* value) override
3177f664254SPatrick Williams     {
3187f664254SPatrick Williams         return ::sd_bus_message_append_basic(message, type, value);
3197f664254SPatrick Williams     }
3207f664254SPatrick Williams 
sd_bus_message_append_string_iovec(sd_bus_message * message,const struct iovec * iov,int iovcnt)32106f265f6SPatrick Williams     int sd_bus_message_append_string_iovec(
32206f265f6SPatrick Williams         sd_bus_message* message, const struct iovec* iov, int iovcnt) override
323640a7d56SEd Tanous     {
324640a7d56SEd Tanous         return ::sd_bus_message_append_string_iovec(message, iov, iovcnt);
325640a7d56SEd Tanous     }
326640a7d56SEd Tanous 
sd_bus_message_at_end(sd_bus_message * m,int complete)3277f664254SPatrick Williams     int sd_bus_message_at_end(sd_bus_message* m, int complete) override
3287f664254SPatrick Williams     {
3297f664254SPatrick Williams         return ::sd_bus_message_at_end(m, complete);
3307f664254SPatrick Williams     }
3317f664254SPatrick Williams 
sd_bus_message_close_container(sd_bus_message * m)3327f664254SPatrick Williams     int sd_bus_message_close_container(sd_bus_message* m) override
3337f664254SPatrick Williams     {
3347f664254SPatrick Williams         return ::sd_bus_message_close_container(m);
3357f664254SPatrick Williams     }
3367f664254SPatrick Williams 
sd_bus_message_enter_container(sd_bus_message * m,char type,const char * contents)3377f664254SPatrick Williams     int sd_bus_message_enter_container(sd_bus_message* m, char type,
3387f664254SPatrick Williams                                        const char* contents) override
3397f664254SPatrick Williams     {
3407f664254SPatrick Williams         return ::sd_bus_message_enter_container(m, type, contents);
3417f664254SPatrick Williams     }
3427f664254SPatrick Williams 
sd_bus_message_exit_container(sd_bus_message * m)3437f664254SPatrick Williams     int sd_bus_message_exit_container(sd_bus_message* m) override
3447f664254SPatrick Williams     {
3457f664254SPatrick Williams         return ::sd_bus_message_exit_container(m);
3467f664254SPatrick Williams     }
3477f664254SPatrick Williams 
sd_bus_message_get_bus(sd_bus_message * m)3487f664254SPatrick Williams     sd_bus* sd_bus_message_get_bus(sd_bus_message* m) override
3497f664254SPatrick Williams     {
3507f664254SPatrick Williams         return ::sd_bus_message_get_bus(m);
3517f664254SPatrick Williams     }
3527f664254SPatrick Williams 
sd_bus_message_get_type(sd_bus_message * m,uint8_t * type)3537f664254SPatrick Williams     int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) override
3547f664254SPatrick Williams     {
3557f664254SPatrick Williams         return ::sd_bus_message_get_type(m, type);
3567f664254SPatrick Williams     }
3577f664254SPatrick Williams 
sd_bus_message_get_cookie(sd_bus_message * m,uint64_t * cookie)3587f664254SPatrick Williams     int sd_bus_message_get_cookie(sd_bus_message* m, uint64_t* cookie) override
3597f664254SPatrick Williams     {
3607f664254SPatrick Williams         return ::sd_bus_message_get_cookie(m, cookie);
3617f664254SPatrick Williams     }
3627f664254SPatrick Williams 
sd_bus_message_get_reply_cookie(sd_bus_message * m,uint64_t * cookie)3637f664254SPatrick Williams     int sd_bus_message_get_reply_cookie(sd_bus_message* m,
3647f664254SPatrick Williams                                         uint64_t* cookie) override
3657f664254SPatrick Williams     {
3667f664254SPatrick Williams         return ::sd_bus_message_get_reply_cookie(m, cookie);
3677f664254SPatrick Williams     }
3687f664254SPatrick Williams 
sd_bus_message_get_destination(sd_bus_message * m)3697f664254SPatrick Williams     const char* sd_bus_message_get_destination(sd_bus_message* m) override
3707f664254SPatrick Williams     {
3717f664254SPatrick Williams         return ::sd_bus_message_get_destination(m);
3727f664254SPatrick Williams     }
3737f664254SPatrick Williams 
sd_bus_message_get_interface(sd_bus_message * m)3747f664254SPatrick Williams     const char* sd_bus_message_get_interface(sd_bus_message* m) override
3757f664254SPatrick Williams     {
3767f664254SPatrick Williams         return ::sd_bus_message_get_interface(m);
3777f664254SPatrick Williams     }
3787f664254SPatrick Williams 
sd_bus_message_get_member(sd_bus_message * m)3797f664254SPatrick Williams     const char* sd_bus_message_get_member(sd_bus_message* m) override
3807f664254SPatrick Williams     {
3817f664254SPatrick Williams         return ::sd_bus_message_get_member(m);
3827f664254SPatrick Williams     }
3837f664254SPatrick Williams 
sd_bus_message_get_path(sd_bus_message * m)3847f664254SPatrick Williams     const char* sd_bus_message_get_path(sd_bus_message* m) override
3857f664254SPatrick Williams     {
3867f664254SPatrick Williams         return ::sd_bus_message_get_path(m);
3877f664254SPatrick Williams     }
3887f664254SPatrick Williams 
sd_bus_message_get_sender(sd_bus_message * m)3897f664254SPatrick Williams     const char* sd_bus_message_get_sender(sd_bus_message* m) override
3907f664254SPatrick Williams     {
3917f664254SPatrick Williams         return ::sd_bus_message_get_sender(m);
3927f664254SPatrick Williams     }
3937f664254SPatrick Williams 
sd_bus_message_get_signature(sd_bus_message * m,int complete)3947f664254SPatrick Williams     const char* sd_bus_message_get_signature(sd_bus_message* m,
3957f664254SPatrick Williams                                              int complete) override
3967f664254SPatrick Williams     {
3977f664254SPatrick Williams         return ::sd_bus_message_get_signature(m, complete);
3987f664254SPatrick Williams     }
3997f664254SPatrick Williams 
sd_bus_message_get_errno(sd_bus_message * m)4007f664254SPatrick Williams     int sd_bus_message_get_errno(sd_bus_message* m) override
4017f664254SPatrick Williams     {
4027f664254SPatrick Williams         return ::sd_bus_message_get_errno(m);
4037f664254SPatrick Williams     }
4047f664254SPatrick Williams 
sd_bus_message_get_error(sd_bus_message * m)4057f664254SPatrick Williams     const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) override
4067f664254SPatrick Williams     {
4077f664254SPatrick Williams         return ::sd_bus_message_get_error(m);
4087f664254SPatrick Williams     }
4097f664254SPatrick Williams 
sd_bus_message_is_method_call(sd_bus_message * m,const char * interface,const char * member)4107f664254SPatrick Williams     int sd_bus_message_is_method_call(sd_bus_message* m, const char* interface,
4117f664254SPatrick Williams                                       const char* member) override
4127f664254SPatrick Williams     {
4137f664254SPatrick Williams         return ::sd_bus_message_is_method_call(m, interface, member);
4147f664254SPatrick Williams     }
4157f664254SPatrick Williams 
sd_bus_message_is_method_error(sd_bus_message * m,const char * name)4167f664254SPatrick Williams     int sd_bus_message_is_method_error(sd_bus_message* m,
4177f664254SPatrick Williams                                        const char* name) override
4187f664254SPatrick Williams     {
4197f664254SPatrick Williams         return ::sd_bus_message_is_method_error(m, name);
4207f664254SPatrick Williams     }
4217f664254SPatrick Williams 
sd_bus_message_is_signal(sd_bus_message * m,const char * interface,const char * member)4227f664254SPatrick Williams     int sd_bus_message_is_signal(sd_bus_message* m, const char* interface,
4237f664254SPatrick Williams                                  const char* member) override
4247f664254SPatrick Williams     {
4257f664254SPatrick Williams         return ::sd_bus_message_is_signal(m, interface, member);
4267f664254SPatrick Williams     }
4277f664254SPatrick Williams 
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)42806f265f6SPatrick Williams     int sd_bus_message_new_method_call(
42906f265f6SPatrick Williams         sd_bus* bus, sd_bus_message** m, const char* destination,
43006f265f6SPatrick Williams         const char* path, const char* interface, const char* member) override
4317f664254SPatrick Williams     {
4327f664254SPatrick Williams         return ::sd_bus_message_new_method_call(bus, m, destination, path,
4337f664254SPatrick Williams                                                 interface, member);
4347f664254SPatrick Williams     }
4357f664254SPatrick Williams 
sd_bus_message_new_method_return(sd_bus_message * call,sd_bus_message ** m)4367f664254SPatrick Williams     int sd_bus_message_new_method_return(sd_bus_message* call,
4377f664254SPatrick Williams                                          sd_bus_message** m) override
4387f664254SPatrick Williams     {
4397f664254SPatrick Williams         return ::sd_bus_message_new_method_return(call, m);
4407f664254SPatrick Williams     }
4417f664254SPatrick Williams 
sd_bus_message_new_method_error(sd_bus_message * call,sd_bus_message ** m,sd_bus_error * e)442*a4bfefdeSPatrick Williams     int sd_bus_message_new_method_error(
443*a4bfefdeSPatrick Williams         sd_bus_message* call, sd_bus_message** m, sd_bus_error* e) override
444f534ba04SWilliam A. Kennington III     {
445*a4bfefdeSPatrick Williams         return ::sd_bus_message_new_method_error(call, m, e);
446f534ba04SWilliam A. Kennington III     }
447f534ba04SWilliam A. Kennington III 
sd_bus_message_new_method_errno(sd_bus_message * call,sd_bus_message ** m,int error,const sd_bus_error * p)4487f664254SPatrick Williams     int sd_bus_message_new_method_errno(sd_bus_message* call,
4497f664254SPatrick Williams                                         sd_bus_message** m, int error,
4507f664254SPatrick Williams                                         const sd_bus_error* p) override
4517f664254SPatrick Williams     {
4527f664254SPatrick Williams         return ::sd_bus_message_new_method_errno(call, m, error, p);
4537f664254SPatrick Williams     }
4547f664254SPatrick Williams 
sd_bus_message_new_signal(sd_bus * bus,sd_bus_message ** m,const char * path,const char * interface,const char * member)4557f664254SPatrick Williams     int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m,
4567f664254SPatrick Williams                                   const char* path, const char* interface,
4577f664254SPatrick Williams                                   const char* member) override
4587f664254SPatrick Williams     {
4597f664254SPatrick Williams         return ::sd_bus_message_new_signal(bus, m, path, interface, member);
4607f664254SPatrick Williams     }
4617f664254SPatrick Williams 
sd_bus_message_open_container(sd_bus_message * m,char type,const char * contents)4627f664254SPatrick Williams     int sd_bus_message_open_container(sd_bus_message* m, char type,
4637f664254SPatrick Williams                                       const char* contents) override
4647f664254SPatrick Williams     {
4657f664254SPatrick Williams         return ::sd_bus_message_open_container(m, type, contents);
4667f664254SPatrick Williams     }
4677f664254SPatrick Williams 
sd_bus_message_read_basic(sd_bus_message * m,char type,void * p)4687f664254SPatrick Williams     int sd_bus_message_read_basic(sd_bus_message* m, char type,
4697f664254SPatrick Williams                                   void* p) override
4707f664254SPatrick Williams     {
4717f664254SPatrick Williams         return ::sd_bus_message_read_basic(m, type, p);
4727f664254SPatrick Williams     }
4737f664254SPatrick Williams 
sd_bus_message_ref(sd_bus_message * m)4747f664254SPatrick Williams     sd_bus_message* sd_bus_message_ref(sd_bus_message* m) override
4757f664254SPatrick Williams     {
4767f664254SPatrick Williams         return ::sd_bus_message_ref(m);
4777f664254SPatrick Williams     }
4787f664254SPatrick Williams 
sd_bus_message_skip(sd_bus_message * m,const char * types)4797f664254SPatrick Williams     int sd_bus_message_skip(sd_bus_message* m, const char* types) override
4807f664254SPatrick Williams     {
4817f664254SPatrick Williams         return ::sd_bus_message_skip(m, types);
4827f664254SPatrick Williams     }
4837f664254SPatrick Williams 
sd_bus_message_verify_type(sd_bus_message * m,char type,const char * contents)4847f664254SPatrick Williams     int sd_bus_message_verify_type(sd_bus_message* m, char type,
4857f664254SPatrick Williams                                    const char* contents) override
4867f664254SPatrick Williams     {
4877f664254SPatrick Williams         return ::sd_bus_message_verify_type(m, type, contents);
4887f664254SPatrick Williams     }
4897f664254SPatrick Williams 
sd_bus_slot_set_destroy_callback(sd_bus_slot * slot,sd_bus_destroy_t callback)490472b7022SWilliam A. Kennington III     int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot,
491472b7022SWilliam A. Kennington III                                          sd_bus_destroy_t callback) override
492472b7022SWilliam A. Kennington III     {
493472b7022SWilliam A. Kennington III         return ::sd_bus_slot_set_destroy_callback(slot, callback);
494472b7022SWilliam A. Kennington III     }
495472b7022SWilliam A. Kennington III 
sd_bus_slot_set_userdata(sd_bus_slot * slot,void * userdata)496472b7022SWilliam A. Kennington III     void* sd_bus_slot_set_userdata(sd_bus_slot* slot, void* userdata) override
497472b7022SWilliam A. Kennington III     {
498472b7022SWilliam A. Kennington III         return ::sd_bus_slot_set_userdata(slot, userdata);
499472b7022SWilliam A. Kennington III     }
500472b7022SWilliam A. Kennington III 
sd_bus_process(sd_bus * bus,sd_bus_message ** r)5017f664254SPatrick Williams     int sd_bus_process(sd_bus* bus, sd_bus_message** r) override
5027f664254SPatrick Williams     {
5037f664254SPatrick Williams         return ::sd_bus_process(bus, r);
5047f664254SPatrick Williams     }
5057f664254SPatrick Williams 
sd_bus_ref(sd_bus * bus)5067f664254SPatrick Williams     sd_bus* sd_bus_ref(sd_bus* bus) override
5077f664254SPatrick Williams     {
5087f664254SPatrick Williams         return ::sd_bus_ref(bus);
5097f664254SPatrick Williams     }
5107f664254SPatrick Williams 
sd_bus_request_name(sd_bus * bus,const char * name,uint64_t flags)5117f664254SPatrick Williams     int sd_bus_request_name(sd_bus* bus, const char* name,
5127f664254SPatrick Williams                             uint64_t flags) override
5137f664254SPatrick Williams     {
5147f664254SPatrick Williams         return ::sd_bus_request_name(bus, name, flags);
5157f664254SPatrick Williams     }
5167f664254SPatrick Williams 
sd_bus_send(sd_bus * bus,sd_bus_message * m,uint64_t * cookie)5177f664254SPatrick Williams     int sd_bus_send(sd_bus* bus, sd_bus_message* m, uint64_t* cookie) override
5187f664254SPatrick Williams     {
5197f664254SPatrick Williams         return ::sd_bus_send(bus, m, cookie);
5207f664254SPatrick Williams     }
5217f664254SPatrick Williams 
sd_bus_unref(sd_bus * bus)5227f664254SPatrick Williams     sd_bus* sd_bus_unref(sd_bus* bus) override
5237f664254SPatrick Williams     {
5247f664254SPatrick Williams         return ::sd_bus_unref(bus);
5257f664254SPatrick Williams     }
5267f664254SPatrick Williams 
sd_bus_slot_unref(sd_bus_slot * slot)5279d8ba947SWilliam A. Kennington III     sd_bus_slot* sd_bus_slot_unref(sd_bus_slot* slot) override
5289d8ba947SWilliam A. Kennington III     {
5299d8ba947SWilliam A. Kennington III         return ::sd_bus_slot_unref(slot);
5309d8ba947SWilliam A. Kennington III     }
5319d8ba947SWilliam A. Kennington III 
sd_bus_flush_close_unref(sd_bus * bus)5327f664254SPatrick Williams     sd_bus* sd_bus_flush_close_unref(sd_bus* bus) override
5337f664254SPatrick Williams     {
5347f664254SPatrick Williams         return ::sd_bus_flush_close_unref(bus);
5357f664254SPatrick Williams     }
5367f664254SPatrick Williams 
sd_bus_flush(sd_bus * bus)5377f664254SPatrick Williams     int sd_bus_flush(sd_bus* bus) override
5387f664254SPatrick Williams     {
5397f664254SPatrick Williams         return ::sd_bus_flush(bus);
5407f664254SPatrick Williams     }
5417f664254SPatrick Williams 
sd_bus_close(sd_bus * bus)5427f664254SPatrick Williams     void sd_bus_close(sd_bus* bus) override
5437f664254SPatrick Williams     {
5447f664254SPatrick Williams         ::sd_bus_close(bus);
5457f664254SPatrick Williams     }
5467f664254SPatrick Williams 
sd_bus_is_open(sd_bus * bus)5475d81ca2bSWilliam A. Kennington III     int sd_bus_is_open(sd_bus* bus) override
5485d81ca2bSWilliam A. Kennington III     {
5495d81ca2bSWilliam A. Kennington III         return ::sd_bus_is_open(bus);
5505d81ca2bSWilliam A. Kennington III     }
5515d81ca2bSWilliam A. Kennington III 
sd_bus_wait(sd_bus * bus,uint64_t timeout_usec)5527f664254SPatrick Williams     int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) override
5537f664254SPatrick Williams     {
5547f664254SPatrick Williams         return ::sd_bus_wait(bus, timeout_usec);
5557f664254SPatrick Williams     }
5567f664254SPatrick Williams };
5577f664254SPatrick Williams 
5587f664254SPatrick Williams extern SdBusImpl sdbus_impl;
5597f664254SPatrick Williams 
5607f664254SPatrick Williams } // namespace sdbusplus
561