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 257f664254SPatrick Williams virtual int sd_bus_add_object_vtable(sd_bus* bus, sd_bus_slot** slot, 267f664254SPatrick Williams const char* path, 277f664254SPatrick Williams const char* interface, 287f664254SPatrick Williams const sd_bus_vtable* vtable, 297f664254SPatrick Williams void* userdata) = 0; 307f664254SPatrick Williams 317f664254SPatrick Williams virtual int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) = 0; 327f664254SPatrick Williams 337f664254SPatrick Williams virtual int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec, 347f664254SPatrick Williams sd_bus_error* ret_error, 357f664254SPatrick Williams sd_bus_message** reply) = 0; 367f664254SPatrick Williams 37*472b7022SWilliam A. Kennington III virtual int sd_bus_call_async(sd_bus* bus, sd_bus_slot** slot, 38*472b7022SWilliam A. Kennington III sd_bus_message* m, 39*472b7022SWilliam A. Kennington III sd_bus_message_handler_t callback, 40*472b7022SWilliam A. Kennington III void* userdata, uint64_t usec) = 0; 41*472b7022SWilliam A. Kennington III 427f664254SPatrick Williams virtual int sd_bus_detach_event(sd_bus* bus) = 0; 437f664254SPatrick Williams 447f664254SPatrick Williams virtual int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path, 457f664254SPatrick Williams char** interfaces) = 0; 467f664254SPatrick Williams virtual int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, 477f664254SPatrick Williams const char* path, 487f664254SPatrick Williams 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; 517f664254SPatrick Williams virtual int sd_bus_emit_properties_changed_strv(sd_bus* bus, 527f664254SPatrick Williams const char* path, 537f664254SPatrick Williams const char* interface, 54e659436dSPatrick Williams const char** names) = 0; 557f664254SPatrick Williams 567f664254SPatrick Williams virtual int sd_bus_error_set(sd_bus_error* e, const char* name, 577f664254SPatrick Williams const char* message) = 0; 587f664254SPatrick Williams virtual int sd_bus_error_set_const(sd_bus_error* e, const char* name, 597f664254SPatrick Williams const char* message) = 0; 607f664254SPatrick Williams virtual int sd_bus_error_get_errno(const sd_bus_error* e) = 0; 617f664254SPatrick Williams virtual int sd_bus_error_set_errno(sd_bus_error* e, int error) = 0; 627f664254SPatrick Williams virtual int sd_bus_error_is_set(const sd_bus_error* e) = 0; 637f664254SPatrick Williams virtual void sd_bus_error_free(sd_bus_error* e) = 0; 647f664254SPatrick Williams 657f664254SPatrick Williams virtual sd_event* sd_bus_get_event(sd_bus* bus) = 0; 667f664254SPatrick Williams virtual int sd_bus_get_fd(sd_bus* bus) = 0; 677f664254SPatrick Williams virtual int sd_bus_get_unique_name(sd_bus* bus, const char** unique) = 0; 687f664254SPatrick Williams 697f664254SPatrick Williams virtual int sd_bus_list_names(sd_bus* bus, char*** acquired, 707f664254SPatrick Williams char*** activatable) = 0; 717f664254SPatrick Williams 727f664254SPatrick Williams // https://github.com/systemd/systemd/blob/master/src/systemd/sd-bus.h 737f664254SPatrick Williams virtual int sd_bus_message_append_basic(sd_bus_message* message, char type, 747f664254SPatrick Williams const void* value) = 0; 757f664254SPatrick Williams 767f664254SPatrick Williams virtual int sd_bus_message_at_end(sd_bus_message* m, int complete) = 0; 777f664254SPatrick Williams 787f664254SPatrick Williams virtual int sd_bus_message_close_container(sd_bus_message* m) = 0; 797f664254SPatrick Williams 807f664254SPatrick Williams virtual int sd_bus_message_enter_container(sd_bus_message* m, char type, 817f664254SPatrick Williams const char* contents) = 0; 827f664254SPatrick Williams 837f664254SPatrick Williams virtual int sd_bus_message_exit_container(sd_bus_message* m) = 0; 847f664254SPatrick Williams 857f664254SPatrick Williams virtual sd_bus* sd_bus_message_get_bus(sd_bus_message* m) = 0; 867f664254SPatrick Williams virtual int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) = 0; 877f664254SPatrick Williams virtual int sd_bus_message_get_cookie(sd_bus_message* m, 887f664254SPatrick Williams uint64_t* cookie) = 0; 897f664254SPatrick Williams virtual int sd_bus_message_get_reply_cookie(sd_bus_message* m, 907f664254SPatrick Williams uint64_t* cookie) = 0; 917f664254SPatrick Williams virtual const char* sd_bus_message_get_destination(sd_bus_message* m) = 0; 927f664254SPatrick Williams virtual const char* sd_bus_message_get_interface(sd_bus_message* m) = 0; 937f664254SPatrick Williams virtual const char* sd_bus_message_get_member(sd_bus_message* m) = 0; 947f664254SPatrick Williams virtual const char* sd_bus_message_get_path(sd_bus_message* m) = 0; 957f664254SPatrick Williams virtual const char* sd_bus_message_get_sender(sd_bus_message* m) = 0; 967f664254SPatrick Williams virtual const char* sd_bus_message_get_signature(sd_bus_message* m, 977f664254SPatrick Williams int complete) = 0; 987f664254SPatrick Williams virtual int sd_bus_message_get_errno(sd_bus_message* m) = 0; 997f664254SPatrick Williams virtual const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) = 0; 1007f664254SPatrick Williams 1017f664254SPatrick Williams virtual int sd_bus_message_is_method_call(sd_bus_message* m, 1027f664254SPatrick Williams const char* interface, 1037f664254SPatrick Williams const char* member) = 0; 1047f664254SPatrick Williams virtual int sd_bus_message_is_method_error(sd_bus_message* m, 1057f664254SPatrick Williams const char* name) = 0; 1067f664254SPatrick Williams virtual int sd_bus_message_is_signal(sd_bus_message* m, 1077f664254SPatrick Williams const char* interface, 1087f664254SPatrick Williams const char* member) = 0; 1097f664254SPatrick Williams 1107f664254SPatrick Williams virtual int sd_bus_message_new_method_call(sd_bus* bus, sd_bus_message** m, 1117f664254SPatrick Williams const char* destination, 1127f664254SPatrick Williams const char* path, 1137f664254SPatrick Williams const char* interface, 1147f664254SPatrick Williams const char* member) = 0; 1157f664254SPatrick Williams 1167f664254SPatrick Williams virtual int sd_bus_message_new_method_return(sd_bus_message* call, 1177f664254SPatrick Williams sd_bus_message** m) = 0; 1187f664254SPatrick Williams 119f534ba04SWilliam A. Kennington III virtual int sd_bus_message_new_method_error(sd_bus_message* call, 120f534ba04SWilliam A. Kennington III sd_bus_message** m, 121f534ba04SWilliam A. Kennington III const char* name, 122f534ba04SWilliam A. Kennington III const char* description) = 0; 123f534ba04SWilliam A. Kennington III 1247f664254SPatrick Williams virtual int sd_bus_message_new_method_errno(sd_bus_message* call, 1257f664254SPatrick Williams sd_bus_message** m, int error, 1267f664254SPatrick Williams const sd_bus_error* p) = 0; 1277f664254SPatrick Williams 1287f664254SPatrick Williams virtual int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m, 1297f664254SPatrick Williams const char* path, 1307f664254SPatrick Williams const char* interface, 1317f664254SPatrick Williams const char* member) = 0; 1327f664254SPatrick Williams 1337f664254SPatrick Williams virtual int sd_bus_message_open_container(sd_bus_message* m, char type, 1347f664254SPatrick Williams const char* contents) = 0; 1357f664254SPatrick Williams 1367f664254SPatrick Williams virtual int sd_bus_message_read_basic(sd_bus_message* m, char type, 1377f664254SPatrick Williams void* p) = 0; 1387f664254SPatrick Williams 1397f664254SPatrick Williams virtual sd_bus_message* sd_bus_message_ref(sd_bus_message* m) = 0; 1407f664254SPatrick Williams 1417f664254SPatrick Williams virtual int sd_bus_message_skip(sd_bus_message* m, const char* types) = 0; 1427f664254SPatrick Williams 1437f664254SPatrick Williams virtual int sd_bus_message_verify_type(sd_bus_message* m, char type, 1447f664254SPatrick Williams const char* contents) = 0; 1457f664254SPatrick Williams 146*472b7022SWilliam A. Kennington III virtual int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot, 147*472b7022SWilliam A. Kennington III sd_bus_destroy_t callback) = 0; 148*472b7022SWilliam A. Kennington III 149*472b7022SWilliam A. Kennington III virtual void* sd_bus_slot_set_userdata(sd_bus_slot* slot, 150*472b7022SWilliam A. Kennington III void* userdata) = 0; 151*472b7022SWilliam A. Kennington III 1527f664254SPatrick Williams virtual int sd_bus_process(sd_bus* bus, sd_bus_message** r) = 0; 1537f664254SPatrick Williams 1547f664254SPatrick Williams virtual sd_bus* sd_bus_ref(sd_bus* bus) = 0; 1557f664254SPatrick Williams 1567f664254SPatrick Williams virtual int sd_bus_request_name(sd_bus* bus, const char* name, 1577f664254SPatrick Williams uint64_t flags) = 0; 1587f664254SPatrick Williams 1597f664254SPatrick Williams virtual int sd_bus_send(sd_bus* bus, sd_bus_message* m, 1607f664254SPatrick Williams uint64_t* cookie) = 0; 1617f664254SPatrick Williams 1627f664254SPatrick Williams virtual sd_bus* sd_bus_unref(sd_bus* bus) = 0; 1637f664254SPatrick Williams virtual sd_bus* sd_bus_flush_close_unref(sd_bus* bus) = 0; 1647f664254SPatrick Williams 1657f664254SPatrick Williams virtual int sd_bus_flush(sd_bus* bus) = 0; 1667f664254SPatrick Williams virtual void sd_bus_close(sd_bus* bus) = 0; 1677f664254SPatrick Williams 1687f664254SPatrick Williams virtual int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) = 0; 1697f664254SPatrick Williams }; 1707f664254SPatrick Williams 1717f664254SPatrick Williams class SdBusImpl : public SdBusInterface 1727f664254SPatrick Williams { 1737f664254SPatrick Williams public: 1747f664254SPatrick Williams SdBusImpl() = default; 1757f664254SPatrick Williams ~SdBusImpl() = default; 1767f664254SPatrick Williams SdBusImpl(const SdBusImpl&) = default; 1777f664254SPatrick Williams SdBusImpl& operator=(const SdBusImpl&) = default; 1787f664254SPatrick Williams SdBusImpl(SdBusImpl&&) = default; 1797f664254SPatrick Williams SdBusImpl& operator=(SdBusImpl&&) = default; 1807f664254SPatrick Williams 1817f664254SPatrick Williams int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot, 1827f664254SPatrick Williams const char* path) override 1837f664254SPatrick Williams { 1847f664254SPatrick Williams return ::sd_bus_add_object_manager(bus, slot, path); 1857f664254SPatrick Williams } 1867f664254SPatrick Williams 1877f664254SPatrick Williams int sd_bus_add_object_vtable(sd_bus* bus, sd_bus_slot** slot, 1887f664254SPatrick Williams const char* path, const char* interface, 1897f664254SPatrick Williams const sd_bus_vtable* vtable, 1907f664254SPatrick Williams void* userdata) override 1917f664254SPatrick Williams { 1927f664254SPatrick Williams return ::sd_bus_add_object_vtable(bus, slot, path, interface, vtable, 1937f664254SPatrick Williams userdata); 1947f664254SPatrick Williams } 1957f664254SPatrick Williams 1967f664254SPatrick Williams int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) override 1977f664254SPatrick Williams { 1987f664254SPatrick Williams return ::sd_bus_attach_event(bus, e, priority); 1997f664254SPatrick Williams } 2007f664254SPatrick Williams 2017f664254SPatrick Williams int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec, 2027f664254SPatrick Williams sd_bus_error* ret_error, sd_bus_message** reply) override 2037f664254SPatrick Williams { 2047f664254SPatrick Williams return ::sd_bus_call(bus, m, usec, ret_error, reply); 2057f664254SPatrick Williams } 2067f664254SPatrick Williams 207*472b7022SWilliam A. Kennington III int sd_bus_call_async(sd_bus* bus, sd_bus_slot** slot, sd_bus_message* m, 208*472b7022SWilliam A. Kennington III sd_bus_message_handler_t callback, void* userdata, 209*472b7022SWilliam A. Kennington III uint64_t usec) override 210*472b7022SWilliam A. Kennington III { 211*472b7022SWilliam A. Kennington III return ::sd_bus_call_async(bus, slot, m, callback, userdata, usec); 212*472b7022SWilliam A. Kennington III } 213*472b7022SWilliam A. Kennington III 2147f664254SPatrick Williams int sd_bus_detach_event(sd_bus* bus) override 2157f664254SPatrick Williams { 2167f664254SPatrick Williams return ::sd_bus_detach_event(bus); 2177f664254SPatrick Williams } 2187f664254SPatrick Williams 2197f664254SPatrick Williams int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path, 2207f664254SPatrick Williams char** interfaces) override 2217f664254SPatrick Williams { 2227f664254SPatrick Williams return ::sd_bus_emit_interfaces_added_strv(bus, path, interfaces); 2237f664254SPatrick Williams } 2247f664254SPatrick Williams 2257f664254SPatrick Williams int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, const char* path, 2267f664254SPatrick Williams char** interfaces) override 2277f664254SPatrick Williams { 2287f664254SPatrick Williams return ::sd_bus_emit_interfaces_removed_strv(bus, path, interfaces); 2297f664254SPatrick Williams } 2307f664254SPatrick Williams 2317f664254SPatrick Williams int sd_bus_emit_object_added(sd_bus* bus, const char* path) override 2327f664254SPatrick Williams { 2337f664254SPatrick Williams return ::sd_bus_emit_object_added(bus, path); 2347f664254SPatrick Williams } 2357f664254SPatrick Williams 2367f664254SPatrick Williams int sd_bus_emit_object_removed(sd_bus* bus, const char* path) override 2377f664254SPatrick Williams { 2387f664254SPatrick Williams return ::sd_bus_emit_object_removed(bus, path); 2397f664254SPatrick Williams } 2407f664254SPatrick Williams 2417f664254SPatrick Williams int sd_bus_emit_properties_changed_strv(sd_bus* bus, const char* path, 2427f664254SPatrick Williams const char* interface, 243e659436dSPatrick Williams const char** names) override 2447f664254SPatrick Williams { 2457f664254SPatrick Williams return ::sd_bus_emit_properties_changed_strv(bus, path, interface, 246e659436dSPatrick Williams const_cast<char**>(names)); 247e659436dSPatrick Williams // The const_cast above may seem unsafe, but it safe. sd_bus's manpage 248e659436dSPatrick Williams // shows a 'const char*' but the header does not. I examined the code 249e659436dSPatrick Williams // and no modification of the strings is done. I tried to change sdbus 250e659436dSPatrick Williams // directly but due to quirks of C you cannot implicitly convert a 251e659436dSPatrick Williams // 'char **' to a 'const char**', so changing the implementation causes 252e659436dSPatrick Williams // lots of compile failures due to an incompatible API change. 253e659436dSPatrick Williams // 254e659436dSPatrick Williams // Performing a const_cast allows us to avoid a memory allocation of 255e659436dSPatrick Williams // the contained strings in 'interface::property_changed'. 2567f664254SPatrick Williams } 2577f664254SPatrick Williams 2587f664254SPatrick Williams int sd_bus_error_set(sd_bus_error* e, const char* name, 2597f664254SPatrick Williams const char* message) override 2607f664254SPatrick Williams { 2617f664254SPatrick Williams return ::sd_bus_error_set(e, name, message); 2627f664254SPatrick Williams } 2637f664254SPatrick Williams 2647f664254SPatrick Williams int sd_bus_error_set_const(sd_bus_error* e, const char* name, 2657f664254SPatrick Williams const char* message) override 2667f664254SPatrick Williams { 2677f664254SPatrick Williams return ::sd_bus_error_set_const(e, name, message); 2687f664254SPatrick Williams } 2697f664254SPatrick Williams 2707f664254SPatrick Williams int sd_bus_error_get_errno(const sd_bus_error* e) override 2717f664254SPatrick Williams { 2727f664254SPatrick Williams return ::sd_bus_error_get_errno(e); 2737f664254SPatrick Williams } 2747f664254SPatrick Williams 2757f664254SPatrick Williams int sd_bus_error_set_errno(sd_bus_error* e, int error) override 2767f664254SPatrick Williams { 2777f664254SPatrick Williams return ::sd_bus_error_set_errno(e, error); 2787f664254SPatrick Williams } 2797f664254SPatrick Williams 2807f664254SPatrick Williams int sd_bus_error_is_set(const sd_bus_error* e) override 2817f664254SPatrick Williams { 2827f664254SPatrick Williams return ::sd_bus_error_is_set(e); 2837f664254SPatrick Williams } 2847f664254SPatrick Williams 2857f664254SPatrick Williams void sd_bus_error_free(sd_bus_error* e) override 2867f664254SPatrick Williams { 2877f664254SPatrick Williams return ::sd_bus_error_free(e); 2887f664254SPatrick Williams } 2897f664254SPatrick Williams 2907f664254SPatrick Williams sd_event* sd_bus_get_event(sd_bus* bus) override 2917f664254SPatrick Williams { 2927f664254SPatrick Williams return ::sd_bus_get_event(bus); 2937f664254SPatrick Williams } 2947f664254SPatrick Williams 2957f664254SPatrick Williams int sd_bus_get_fd(sd_bus* bus) override 2967f664254SPatrick Williams { 2977f664254SPatrick Williams return ::sd_bus_get_fd(bus); 2987f664254SPatrick Williams } 2997f664254SPatrick Williams 3007f664254SPatrick Williams int sd_bus_get_unique_name(sd_bus* bus, const char** unique) override 3017f664254SPatrick Williams { 3027f664254SPatrick Williams return ::sd_bus_get_unique_name(bus, unique); 3037f664254SPatrick Williams } 3047f664254SPatrick Williams 3057f664254SPatrick Williams int sd_bus_list_names(sd_bus* bus, char*** acquired, 3067f664254SPatrick Williams char*** activatable) override 3077f664254SPatrick Williams { 3087f664254SPatrick Williams return ::sd_bus_list_names(bus, acquired, activatable); 3097f664254SPatrick Williams } 3107f664254SPatrick Williams 3117f664254SPatrick Williams int sd_bus_message_append_basic(sd_bus_message* message, char type, 3127f664254SPatrick Williams const void* value) override 3137f664254SPatrick Williams { 3147f664254SPatrick Williams return ::sd_bus_message_append_basic(message, type, value); 3157f664254SPatrick Williams } 3167f664254SPatrick Williams 3177f664254SPatrick Williams int sd_bus_message_at_end(sd_bus_message* m, int complete) override 3187f664254SPatrick Williams { 3197f664254SPatrick Williams return ::sd_bus_message_at_end(m, complete); 3207f664254SPatrick Williams } 3217f664254SPatrick Williams 3227f664254SPatrick Williams int sd_bus_message_close_container(sd_bus_message* m) override 3237f664254SPatrick Williams { 3247f664254SPatrick Williams return ::sd_bus_message_close_container(m); 3257f664254SPatrick Williams } 3267f664254SPatrick Williams 3277f664254SPatrick Williams int sd_bus_message_enter_container(sd_bus_message* m, char type, 3287f664254SPatrick Williams const char* contents) override 3297f664254SPatrick Williams { 3307f664254SPatrick Williams return ::sd_bus_message_enter_container(m, type, contents); 3317f664254SPatrick Williams } 3327f664254SPatrick Williams 3337f664254SPatrick Williams int sd_bus_message_exit_container(sd_bus_message* m) override 3347f664254SPatrick Williams { 3357f664254SPatrick Williams return ::sd_bus_message_exit_container(m); 3367f664254SPatrick Williams } 3377f664254SPatrick Williams 3387f664254SPatrick Williams sd_bus* sd_bus_message_get_bus(sd_bus_message* m) override 3397f664254SPatrick Williams { 3407f664254SPatrick Williams return ::sd_bus_message_get_bus(m); 3417f664254SPatrick Williams } 3427f664254SPatrick Williams 3437f664254SPatrick Williams int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) override 3447f664254SPatrick Williams { 3457f664254SPatrick Williams return ::sd_bus_message_get_type(m, type); 3467f664254SPatrick Williams } 3477f664254SPatrick Williams 3487f664254SPatrick Williams int sd_bus_message_get_cookie(sd_bus_message* m, uint64_t* cookie) override 3497f664254SPatrick Williams { 3507f664254SPatrick Williams return ::sd_bus_message_get_cookie(m, cookie); 3517f664254SPatrick Williams } 3527f664254SPatrick Williams 3537f664254SPatrick Williams int sd_bus_message_get_reply_cookie(sd_bus_message* m, 3547f664254SPatrick Williams uint64_t* cookie) override 3557f664254SPatrick Williams { 3567f664254SPatrick Williams return ::sd_bus_message_get_reply_cookie(m, cookie); 3577f664254SPatrick Williams } 3587f664254SPatrick Williams 3597f664254SPatrick Williams const char* sd_bus_message_get_destination(sd_bus_message* m) override 3607f664254SPatrick Williams { 3617f664254SPatrick Williams return ::sd_bus_message_get_destination(m); 3627f664254SPatrick Williams } 3637f664254SPatrick Williams 3647f664254SPatrick Williams const char* sd_bus_message_get_interface(sd_bus_message* m) override 3657f664254SPatrick Williams { 3667f664254SPatrick Williams return ::sd_bus_message_get_interface(m); 3677f664254SPatrick Williams } 3687f664254SPatrick Williams 3697f664254SPatrick Williams const char* sd_bus_message_get_member(sd_bus_message* m) override 3707f664254SPatrick Williams { 3717f664254SPatrick Williams return ::sd_bus_message_get_member(m); 3727f664254SPatrick Williams } 3737f664254SPatrick Williams 3747f664254SPatrick Williams const char* sd_bus_message_get_path(sd_bus_message* m) override 3757f664254SPatrick Williams { 3767f664254SPatrick Williams return ::sd_bus_message_get_path(m); 3777f664254SPatrick Williams } 3787f664254SPatrick Williams 3797f664254SPatrick Williams const char* sd_bus_message_get_sender(sd_bus_message* m) override 3807f664254SPatrick Williams { 3817f664254SPatrick Williams return ::sd_bus_message_get_sender(m); 3827f664254SPatrick Williams } 3837f664254SPatrick Williams 3847f664254SPatrick Williams const char* sd_bus_message_get_signature(sd_bus_message* m, 3857f664254SPatrick Williams int complete) override 3867f664254SPatrick Williams { 3877f664254SPatrick Williams return ::sd_bus_message_get_signature(m, complete); 3887f664254SPatrick Williams } 3897f664254SPatrick Williams 3907f664254SPatrick Williams int sd_bus_message_get_errno(sd_bus_message* m) override 3917f664254SPatrick Williams { 3927f664254SPatrick Williams return ::sd_bus_message_get_errno(m); 3937f664254SPatrick Williams } 3947f664254SPatrick Williams 3957f664254SPatrick Williams const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) override 3967f664254SPatrick Williams { 3977f664254SPatrick Williams return ::sd_bus_message_get_error(m); 3987f664254SPatrick Williams } 3997f664254SPatrick Williams 4007f664254SPatrick Williams int sd_bus_message_is_method_call(sd_bus_message* m, const char* interface, 4017f664254SPatrick Williams const char* member) override 4027f664254SPatrick Williams { 4037f664254SPatrick Williams return ::sd_bus_message_is_method_call(m, interface, member); 4047f664254SPatrick Williams } 4057f664254SPatrick Williams 4067f664254SPatrick Williams int sd_bus_message_is_method_error(sd_bus_message* m, 4077f664254SPatrick Williams const char* name) override 4087f664254SPatrick Williams { 4097f664254SPatrick Williams return ::sd_bus_message_is_method_error(m, name); 4107f664254SPatrick Williams } 4117f664254SPatrick Williams 4127f664254SPatrick Williams int sd_bus_message_is_signal(sd_bus_message* m, const char* interface, 4137f664254SPatrick Williams const char* member) override 4147f664254SPatrick Williams { 4157f664254SPatrick Williams return ::sd_bus_message_is_signal(m, interface, member); 4167f664254SPatrick Williams } 4177f664254SPatrick Williams 4187f664254SPatrick Williams int sd_bus_message_new_method_call(sd_bus* bus, sd_bus_message** m, 4197f664254SPatrick Williams const char* destination, 4207f664254SPatrick Williams const char* path, const char* interface, 4217f664254SPatrick Williams const char* member) override 4227f664254SPatrick Williams { 4237f664254SPatrick Williams return ::sd_bus_message_new_method_call(bus, m, destination, path, 4247f664254SPatrick Williams interface, member); 4257f664254SPatrick Williams } 4267f664254SPatrick Williams 4277f664254SPatrick Williams int sd_bus_message_new_method_return(sd_bus_message* call, 4287f664254SPatrick Williams sd_bus_message** m) override 4297f664254SPatrick Williams { 4307f664254SPatrick Williams return ::sd_bus_message_new_method_return(call, m); 4317f664254SPatrick Williams } 4327f664254SPatrick Williams 433f534ba04SWilliam A. Kennington III int sd_bus_message_new_method_error(sd_bus_message* call, 434f534ba04SWilliam A. Kennington III sd_bus_message** m, const char* name, 435f534ba04SWilliam A. Kennington III const char* description) override 436f534ba04SWilliam A. Kennington III { 437f534ba04SWilliam A. Kennington III return ::sd_bus_message_new_method_errorf(call, m, name, "%s", 438f534ba04SWilliam A. Kennington III description); 439f534ba04SWilliam A. Kennington III } 440f534ba04SWilliam A. Kennington III 4417f664254SPatrick Williams int sd_bus_message_new_method_errno(sd_bus_message* call, 4427f664254SPatrick Williams sd_bus_message** m, int error, 4437f664254SPatrick Williams const sd_bus_error* p) override 4447f664254SPatrick Williams { 4457f664254SPatrick Williams return ::sd_bus_message_new_method_errno(call, m, error, p); 4467f664254SPatrick Williams } 4477f664254SPatrick Williams 4487f664254SPatrick Williams int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m, 4497f664254SPatrick Williams const char* path, const char* interface, 4507f664254SPatrick Williams const char* member) override 4517f664254SPatrick Williams { 4527f664254SPatrick Williams return ::sd_bus_message_new_signal(bus, m, path, interface, member); 4537f664254SPatrick Williams } 4547f664254SPatrick Williams 4557f664254SPatrick Williams int sd_bus_message_open_container(sd_bus_message* m, char type, 4567f664254SPatrick Williams const char* contents) override 4577f664254SPatrick Williams { 4587f664254SPatrick Williams return ::sd_bus_message_open_container(m, type, contents); 4597f664254SPatrick Williams } 4607f664254SPatrick Williams 4617f664254SPatrick Williams int sd_bus_message_read_basic(sd_bus_message* m, char type, 4627f664254SPatrick Williams void* p) override 4637f664254SPatrick Williams { 4647f664254SPatrick Williams return ::sd_bus_message_read_basic(m, type, p); 4657f664254SPatrick Williams } 4667f664254SPatrick Williams 4677f664254SPatrick Williams sd_bus_message* sd_bus_message_ref(sd_bus_message* m) override 4687f664254SPatrick Williams { 4697f664254SPatrick Williams return ::sd_bus_message_ref(m); 4707f664254SPatrick Williams } 4717f664254SPatrick Williams 4727f664254SPatrick Williams int sd_bus_message_skip(sd_bus_message* m, const char* types) override 4737f664254SPatrick Williams { 4747f664254SPatrick Williams return ::sd_bus_message_skip(m, types); 4757f664254SPatrick Williams } 4767f664254SPatrick Williams 4777f664254SPatrick Williams int sd_bus_message_verify_type(sd_bus_message* m, char type, 4787f664254SPatrick Williams const char* contents) override 4797f664254SPatrick Williams { 4807f664254SPatrick Williams return ::sd_bus_message_verify_type(m, type, contents); 4817f664254SPatrick Williams } 4827f664254SPatrick Williams 483*472b7022SWilliam A. Kennington III int sd_bus_slot_set_destroy_callback(sd_bus_slot* slot, 484*472b7022SWilliam A. Kennington III sd_bus_destroy_t callback) override 485*472b7022SWilliam A. Kennington III { 486*472b7022SWilliam A. Kennington III return ::sd_bus_slot_set_destroy_callback(slot, callback); 487*472b7022SWilliam A. Kennington III } 488*472b7022SWilliam A. Kennington III 489*472b7022SWilliam A. Kennington III void* sd_bus_slot_set_userdata(sd_bus_slot* slot, void* userdata) override 490*472b7022SWilliam A. Kennington III { 491*472b7022SWilliam A. Kennington III return ::sd_bus_slot_set_userdata(slot, userdata); 492*472b7022SWilliam A. Kennington III } 493*472b7022SWilliam A. Kennington III 4947f664254SPatrick Williams int sd_bus_process(sd_bus* bus, sd_bus_message** r) override 4957f664254SPatrick Williams { 4967f664254SPatrick Williams return ::sd_bus_process(bus, r); 4977f664254SPatrick Williams } 4987f664254SPatrick Williams 4997f664254SPatrick Williams sd_bus* sd_bus_ref(sd_bus* bus) override 5007f664254SPatrick Williams { 5017f664254SPatrick Williams return ::sd_bus_ref(bus); 5027f664254SPatrick Williams } 5037f664254SPatrick Williams 5047f664254SPatrick Williams int sd_bus_request_name(sd_bus* bus, const char* name, 5057f664254SPatrick Williams uint64_t flags) override 5067f664254SPatrick Williams { 5077f664254SPatrick Williams return ::sd_bus_request_name(bus, name, flags); 5087f664254SPatrick Williams } 5097f664254SPatrick Williams 5107f664254SPatrick Williams int sd_bus_send(sd_bus* bus, sd_bus_message* m, uint64_t* cookie) override 5117f664254SPatrick Williams { 5127f664254SPatrick Williams return ::sd_bus_send(bus, m, cookie); 5137f664254SPatrick Williams } 5147f664254SPatrick Williams 5157f664254SPatrick Williams sd_bus* sd_bus_unref(sd_bus* bus) override 5167f664254SPatrick Williams { 5177f664254SPatrick Williams return ::sd_bus_unref(bus); 5187f664254SPatrick Williams } 5197f664254SPatrick Williams 5207f664254SPatrick Williams sd_bus* sd_bus_flush_close_unref(sd_bus* bus) override 5217f664254SPatrick Williams { 5227f664254SPatrick Williams return ::sd_bus_flush_close_unref(bus); 5237f664254SPatrick Williams } 5247f664254SPatrick Williams 5257f664254SPatrick Williams int sd_bus_flush(sd_bus* bus) override 5267f664254SPatrick Williams { 5277f664254SPatrick Williams return ::sd_bus_flush(bus); 5287f664254SPatrick Williams } 5297f664254SPatrick Williams 5307f664254SPatrick Williams void sd_bus_close(sd_bus* bus) override 5317f664254SPatrick Williams { 5327f664254SPatrick Williams ::sd_bus_close(bus); 5337f664254SPatrick Williams } 5347f664254SPatrick Williams 5357f664254SPatrick Williams int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) override 5367f664254SPatrick Williams { 5377f664254SPatrick Williams return ::sd_bus_wait(bus, timeout_usec); 5387f664254SPatrick Williams } 5397f664254SPatrick Williams }; 5407f664254SPatrick Williams 5417f664254SPatrick Williams extern SdBusImpl sdbus_impl; 5427f664254SPatrick Williams 5437f664254SPatrick Williams } // namespace sdbusplus 544