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 377f664254SPatrick Williams virtual int sd_bus_detach_event(sd_bus* bus) = 0; 387f664254SPatrick Williams 397f664254SPatrick Williams virtual int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path, 407f664254SPatrick Williams char** interfaces) = 0; 417f664254SPatrick Williams virtual int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, 427f664254SPatrick Williams const char* path, 437f664254SPatrick Williams char** interfaces) = 0; 447f664254SPatrick Williams virtual int sd_bus_emit_object_added(sd_bus* bus, const char* path) = 0; 457f664254SPatrick Williams virtual int sd_bus_emit_object_removed(sd_bus* bus, const char* path) = 0; 467f664254SPatrick Williams virtual int sd_bus_emit_properties_changed_strv(sd_bus* bus, 477f664254SPatrick Williams const char* path, 487f664254SPatrick Williams const char* interface, 49*e659436dSPatrick Williams const char** names) = 0; 507f664254SPatrick Williams 517f664254SPatrick Williams virtual int sd_bus_error_set(sd_bus_error* e, const char* name, 527f664254SPatrick Williams const char* message) = 0; 537f664254SPatrick Williams virtual int sd_bus_error_set_const(sd_bus_error* e, const char* name, 547f664254SPatrick Williams const char* message) = 0; 557f664254SPatrick Williams virtual int sd_bus_error_get_errno(const sd_bus_error* e) = 0; 567f664254SPatrick Williams virtual int sd_bus_error_set_errno(sd_bus_error* e, int error) = 0; 577f664254SPatrick Williams virtual int sd_bus_error_is_set(const sd_bus_error* e) = 0; 587f664254SPatrick Williams virtual void sd_bus_error_free(sd_bus_error* e) = 0; 597f664254SPatrick Williams 607f664254SPatrick Williams virtual sd_event* sd_bus_get_event(sd_bus* bus) = 0; 617f664254SPatrick Williams virtual int sd_bus_get_fd(sd_bus* bus) = 0; 627f664254SPatrick Williams virtual int sd_bus_get_unique_name(sd_bus* bus, const char** unique) = 0; 637f664254SPatrick Williams 647f664254SPatrick Williams virtual int sd_bus_list_names(sd_bus* bus, char*** acquired, 657f664254SPatrick Williams char*** activatable) = 0; 667f664254SPatrick Williams 677f664254SPatrick Williams // https://github.com/systemd/systemd/blob/master/src/systemd/sd-bus.h 687f664254SPatrick Williams virtual int sd_bus_message_append_basic(sd_bus_message* message, char type, 697f664254SPatrick Williams const void* value) = 0; 707f664254SPatrick Williams 717f664254SPatrick Williams virtual int sd_bus_message_at_end(sd_bus_message* m, int complete) = 0; 727f664254SPatrick Williams 737f664254SPatrick Williams virtual int sd_bus_message_close_container(sd_bus_message* m) = 0; 747f664254SPatrick Williams 757f664254SPatrick Williams virtual int sd_bus_message_enter_container(sd_bus_message* m, char type, 767f664254SPatrick Williams const char* contents) = 0; 777f664254SPatrick Williams 787f664254SPatrick Williams virtual int sd_bus_message_exit_container(sd_bus_message* m) = 0; 797f664254SPatrick Williams 807f664254SPatrick Williams virtual sd_bus* sd_bus_message_get_bus(sd_bus_message* m) = 0; 817f664254SPatrick Williams virtual int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) = 0; 827f664254SPatrick Williams virtual int sd_bus_message_get_cookie(sd_bus_message* m, 837f664254SPatrick Williams uint64_t* cookie) = 0; 847f664254SPatrick Williams virtual int sd_bus_message_get_reply_cookie(sd_bus_message* m, 857f664254SPatrick Williams uint64_t* cookie) = 0; 867f664254SPatrick Williams virtual const char* sd_bus_message_get_destination(sd_bus_message* m) = 0; 877f664254SPatrick Williams virtual const char* sd_bus_message_get_interface(sd_bus_message* m) = 0; 887f664254SPatrick Williams virtual const char* sd_bus_message_get_member(sd_bus_message* m) = 0; 897f664254SPatrick Williams virtual const char* sd_bus_message_get_path(sd_bus_message* m) = 0; 907f664254SPatrick Williams virtual const char* sd_bus_message_get_sender(sd_bus_message* m) = 0; 917f664254SPatrick Williams virtual const char* sd_bus_message_get_signature(sd_bus_message* m, 927f664254SPatrick Williams int complete) = 0; 937f664254SPatrick Williams virtual int sd_bus_message_get_errno(sd_bus_message* m) = 0; 947f664254SPatrick Williams virtual const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) = 0; 957f664254SPatrick Williams 967f664254SPatrick Williams virtual int sd_bus_message_is_method_call(sd_bus_message* m, 977f664254SPatrick Williams const char* interface, 987f664254SPatrick Williams const char* member) = 0; 997f664254SPatrick Williams virtual int sd_bus_message_is_method_error(sd_bus_message* m, 1007f664254SPatrick Williams const char* name) = 0; 1017f664254SPatrick Williams virtual int sd_bus_message_is_signal(sd_bus_message* m, 1027f664254SPatrick Williams const char* interface, 1037f664254SPatrick Williams const char* member) = 0; 1047f664254SPatrick Williams 1057f664254SPatrick Williams virtual int sd_bus_message_new_method_call(sd_bus* bus, sd_bus_message** m, 1067f664254SPatrick Williams const char* destination, 1077f664254SPatrick Williams const char* path, 1087f664254SPatrick Williams const char* interface, 1097f664254SPatrick Williams const char* member) = 0; 1107f664254SPatrick Williams 1117f664254SPatrick Williams virtual int sd_bus_message_new_method_return(sd_bus_message* call, 1127f664254SPatrick Williams sd_bus_message** m) = 0; 1137f664254SPatrick Williams 114f534ba04SWilliam A. Kennington III virtual int sd_bus_message_new_method_error(sd_bus_message* call, 115f534ba04SWilliam A. Kennington III sd_bus_message** m, 116f534ba04SWilliam A. Kennington III const char* name, 117f534ba04SWilliam A. Kennington III const char* description) = 0; 118f534ba04SWilliam A. Kennington III 1197f664254SPatrick Williams virtual int sd_bus_message_new_method_errno(sd_bus_message* call, 1207f664254SPatrick Williams sd_bus_message** m, int error, 1217f664254SPatrick Williams const sd_bus_error* p) = 0; 1227f664254SPatrick Williams 1237f664254SPatrick Williams virtual int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m, 1247f664254SPatrick Williams const char* path, 1257f664254SPatrick Williams const char* interface, 1267f664254SPatrick Williams 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 1417f664254SPatrick Williams virtual int sd_bus_process(sd_bus* bus, sd_bus_message** r) = 0; 1427f664254SPatrick Williams 1437f664254SPatrick Williams virtual sd_bus* sd_bus_ref(sd_bus* bus) = 0; 1447f664254SPatrick Williams 1457f664254SPatrick Williams virtual int sd_bus_request_name(sd_bus* bus, const char* name, 1467f664254SPatrick Williams uint64_t flags) = 0; 1477f664254SPatrick Williams 1487f664254SPatrick Williams virtual int sd_bus_send(sd_bus* bus, sd_bus_message* m, 1497f664254SPatrick Williams uint64_t* cookie) = 0; 1507f664254SPatrick Williams 1517f664254SPatrick Williams virtual sd_bus* sd_bus_unref(sd_bus* bus) = 0; 1527f664254SPatrick Williams virtual sd_bus* sd_bus_flush_close_unref(sd_bus* bus) = 0; 1537f664254SPatrick Williams 1547f664254SPatrick Williams virtual int sd_bus_flush(sd_bus* bus) = 0; 1557f664254SPatrick Williams virtual void sd_bus_close(sd_bus* bus) = 0; 1567f664254SPatrick Williams 1577f664254SPatrick Williams virtual int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) = 0; 1587f664254SPatrick Williams }; 1597f664254SPatrick Williams 1607f664254SPatrick Williams class SdBusImpl : public SdBusInterface 1617f664254SPatrick Williams { 1627f664254SPatrick Williams public: 1637f664254SPatrick Williams SdBusImpl() = default; 1647f664254SPatrick Williams ~SdBusImpl() = default; 1657f664254SPatrick Williams SdBusImpl(const SdBusImpl&) = default; 1667f664254SPatrick Williams SdBusImpl& operator=(const SdBusImpl&) = default; 1677f664254SPatrick Williams SdBusImpl(SdBusImpl&&) = default; 1687f664254SPatrick Williams SdBusImpl& operator=(SdBusImpl&&) = default; 1697f664254SPatrick Williams 1707f664254SPatrick Williams int sd_bus_add_object_manager(sd_bus* bus, sd_bus_slot** slot, 1717f664254SPatrick Williams const char* path) override 1727f664254SPatrick Williams { 1737f664254SPatrick Williams return ::sd_bus_add_object_manager(bus, slot, path); 1747f664254SPatrick Williams } 1757f664254SPatrick Williams 1767f664254SPatrick Williams int sd_bus_add_object_vtable(sd_bus* bus, sd_bus_slot** slot, 1777f664254SPatrick Williams const char* path, const char* interface, 1787f664254SPatrick Williams const sd_bus_vtable* vtable, 1797f664254SPatrick Williams void* userdata) override 1807f664254SPatrick Williams { 1817f664254SPatrick Williams return ::sd_bus_add_object_vtable(bus, slot, path, interface, vtable, 1827f664254SPatrick Williams userdata); 1837f664254SPatrick Williams } 1847f664254SPatrick Williams 1857f664254SPatrick Williams int sd_bus_attach_event(sd_bus* bus, sd_event* e, int priority) override 1867f664254SPatrick Williams { 1877f664254SPatrick Williams return ::sd_bus_attach_event(bus, e, priority); 1887f664254SPatrick Williams } 1897f664254SPatrick Williams 1907f664254SPatrick Williams int sd_bus_call(sd_bus* bus, sd_bus_message* m, uint64_t usec, 1917f664254SPatrick Williams sd_bus_error* ret_error, sd_bus_message** reply) override 1927f664254SPatrick Williams { 1937f664254SPatrick Williams return ::sd_bus_call(bus, m, usec, ret_error, reply); 1947f664254SPatrick Williams } 1957f664254SPatrick Williams 1967f664254SPatrick Williams int sd_bus_detach_event(sd_bus* bus) override 1977f664254SPatrick Williams { 1987f664254SPatrick Williams return ::sd_bus_detach_event(bus); 1997f664254SPatrick Williams } 2007f664254SPatrick Williams 2017f664254SPatrick Williams int sd_bus_emit_interfaces_added_strv(sd_bus* bus, const char* path, 2027f664254SPatrick Williams char** interfaces) override 2037f664254SPatrick Williams { 2047f664254SPatrick Williams return ::sd_bus_emit_interfaces_added_strv(bus, path, interfaces); 2057f664254SPatrick Williams } 2067f664254SPatrick Williams 2077f664254SPatrick Williams int sd_bus_emit_interfaces_removed_strv(sd_bus* bus, const char* path, 2087f664254SPatrick Williams char** interfaces) override 2097f664254SPatrick Williams { 2107f664254SPatrick Williams return ::sd_bus_emit_interfaces_removed_strv(bus, path, interfaces); 2117f664254SPatrick Williams } 2127f664254SPatrick Williams 2137f664254SPatrick Williams int sd_bus_emit_object_added(sd_bus* bus, const char* path) override 2147f664254SPatrick Williams { 2157f664254SPatrick Williams return ::sd_bus_emit_object_added(bus, path); 2167f664254SPatrick Williams } 2177f664254SPatrick Williams 2187f664254SPatrick Williams int sd_bus_emit_object_removed(sd_bus* bus, const char* path) override 2197f664254SPatrick Williams { 2207f664254SPatrick Williams return ::sd_bus_emit_object_removed(bus, path); 2217f664254SPatrick Williams } 2227f664254SPatrick Williams 2237f664254SPatrick Williams int sd_bus_emit_properties_changed_strv(sd_bus* bus, const char* path, 2247f664254SPatrick Williams const char* interface, 225*e659436dSPatrick Williams const char** names) override 2267f664254SPatrick Williams { 2277f664254SPatrick Williams return ::sd_bus_emit_properties_changed_strv(bus, path, interface, 228*e659436dSPatrick Williams const_cast<char**>(names)); 229*e659436dSPatrick Williams // The const_cast above may seem unsafe, but it safe. sd_bus's manpage 230*e659436dSPatrick Williams // shows a 'const char*' but the header does not. I examined the code 231*e659436dSPatrick Williams // and no modification of the strings is done. I tried to change sdbus 232*e659436dSPatrick Williams // directly but due to quirks of C you cannot implicitly convert a 233*e659436dSPatrick Williams // 'char **' to a 'const char**', so changing the implementation causes 234*e659436dSPatrick Williams // lots of compile failures due to an incompatible API change. 235*e659436dSPatrick Williams // 236*e659436dSPatrick Williams // Performing a const_cast allows us to avoid a memory allocation of 237*e659436dSPatrick Williams // the contained strings in 'interface::property_changed'. 2387f664254SPatrick Williams } 2397f664254SPatrick Williams 2407f664254SPatrick Williams int sd_bus_error_set(sd_bus_error* e, const char* name, 2417f664254SPatrick Williams const char* message) override 2427f664254SPatrick Williams { 2437f664254SPatrick Williams return ::sd_bus_error_set(e, name, message); 2447f664254SPatrick Williams } 2457f664254SPatrick Williams 2467f664254SPatrick Williams int sd_bus_error_set_const(sd_bus_error* e, const char* name, 2477f664254SPatrick Williams const char* message) override 2487f664254SPatrick Williams { 2497f664254SPatrick Williams return ::sd_bus_error_set_const(e, name, message); 2507f664254SPatrick Williams } 2517f664254SPatrick Williams 2527f664254SPatrick Williams int sd_bus_error_get_errno(const sd_bus_error* e) override 2537f664254SPatrick Williams { 2547f664254SPatrick Williams return ::sd_bus_error_get_errno(e); 2557f664254SPatrick Williams } 2567f664254SPatrick Williams 2577f664254SPatrick Williams int sd_bus_error_set_errno(sd_bus_error* e, int error) override 2587f664254SPatrick Williams { 2597f664254SPatrick Williams return ::sd_bus_error_set_errno(e, error); 2607f664254SPatrick Williams } 2617f664254SPatrick Williams 2627f664254SPatrick Williams int sd_bus_error_is_set(const sd_bus_error* e) override 2637f664254SPatrick Williams { 2647f664254SPatrick Williams return ::sd_bus_error_is_set(e); 2657f664254SPatrick Williams } 2667f664254SPatrick Williams 2677f664254SPatrick Williams void sd_bus_error_free(sd_bus_error* e) override 2687f664254SPatrick Williams { 2697f664254SPatrick Williams return ::sd_bus_error_free(e); 2707f664254SPatrick Williams } 2717f664254SPatrick Williams 2727f664254SPatrick Williams sd_event* sd_bus_get_event(sd_bus* bus) override 2737f664254SPatrick Williams { 2747f664254SPatrick Williams return ::sd_bus_get_event(bus); 2757f664254SPatrick Williams } 2767f664254SPatrick Williams 2777f664254SPatrick Williams int sd_bus_get_fd(sd_bus* bus) override 2787f664254SPatrick Williams { 2797f664254SPatrick Williams return ::sd_bus_get_fd(bus); 2807f664254SPatrick Williams } 2817f664254SPatrick Williams 2827f664254SPatrick Williams int sd_bus_get_unique_name(sd_bus* bus, const char** unique) override 2837f664254SPatrick Williams { 2847f664254SPatrick Williams return ::sd_bus_get_unique_name(bus, unique); 2857f664254SPatrick Williams } 2867f664254SPatrick Williams 2877f664254SPatrick Williams int sd_bus_list_names(sd_bus* bus, char*** acquired, 2887f664254SPatrick Williams char*** activatable) override 2897f664254SPatrick Williams { 2907f664254SPatrick Williams return ::sd_bus_list_names(bus, acquired, activatable); 2917f664254SPatrick Williams } 2927f664254SPatrick Williams 2937f664254SPatrick Williams int sd_bus_message_append_basic(sd_bus_message* message, char type, 2947f664254SPatrick Williams const void* value) override 2957f664254SPatrick Williams { 2967f664254SPatrick Williams return ::sd_bus_message_append_basic(message, type, value); 2977f664254SPatrick Williams } 2987f664254SPatrick Williams 2997f664254SPatrick Williams int sd_bus_message_at_end(sd_bus_message* m, int complete) override 3007f664254SPatrick Williams { 3017f664254SPatrick Williams return ::sd_bus_message_at_end(m, complete); 3027f664254SPatrick Williams } 3037f664254SPatrick Williams 3047f664254SPatrick Williams int sd_bus_message_close_container(sd_bus_message* m) override 3057f664254SPatrick Williams { 3067f664254SPatrick Williams return ::sd_bus_message_close_container(m); 3077f664254SPatrick Williams } 3087f664254SPatrick Williams 3097f664254SPatrick Williams int sd_bus_message_enter_container(sd_bus_message* m, char type, 3107f664254SPatrick Williams const char* contents) override 3117f664254SPatrick Williams { 3127f664254SPatrick Williams return ::sd_bus_message_enter_container(m, type, contents); 3137f664254SPatrick Williams } 3147f664254SPatrick Williams 3157f664254SPatrick Williams int sd_bus_message_exit_container(sd_bus_message* m) override 3167f664254SPatrick Williams { 3177f664254SPatrick Williams return ::sd_bus_message_exit_container(m); 3187f664254SPatrick Williams } 3197f664254SPatrick Williams 3207f664254SPatrick Williams sd_bus* sd_bus_message_get_bus(sd_bus_message* m) override 3217f664254SPatrick Williams { 3227f664254SPatrick Williams return ::sd_bus_message_get_bus(m); 3237f664254SPatrick Williams } 3247f664254SPatrick Williams 3257f664254SPatrick Williams int sd_bus_message_get_type(sd_bus_message* m, uint8_t* type) override 3267f664254SPatrick Williams { 3277f664254SPatrick Williams return ::sd_bus_message_get_type(m, type); 3287f664254SPatrick Williams } 3297f664254SPatrick Williams 3307f664254SPatrick Williams int sd_bus_message_get_cookie(sd_bus_message* m, uint64_t* cookie) override 3317f664254SPatrick Williams { 3327f664254SPatrick Williams return ::sd_bus_message_get_cookie(m, cookie); 3337f664254SPatrick Williams } 3347f664254SPatrick Williams 3357f664254SPatrick Williams int sd_bus_message_get_reply_cookie(sd_bus_message* m, 3367f664254SPatrick Williams uint64_t* cookie) override 3377f664254SPatrick Williams { 3387f664254SPatrick Williams return ::sd_bus_message_get_reply_cookie(m, cookie); 3397f664254SPatrick Williams } 3407f664254SPatrick Williams 3417f664254SPatrick Williams const char* sd_bus_message_get_destination(sd_bus_message* m) override 3427f664254SPatrick Williams { 3437f664254SPatrick Williams return ::sd_bus_message_get_destination(m); 3447f664254SPatrick Williams } 3457f664254SPatrick Williams 3467f664254SPatrick Williams const char* sd_bus_message_get_interface(sd_bus_message* m) override 3477f664254SPatrick Williams { 3487f664254SPatrick Williams return ::sd_bus_message_get_interface(m); 3497f664254SPatrick Williams } 3507f664254SPatrick Williams 3517f664254SPatrick Williams const char* sd_bus_message_get_member(sd_bus_message* m) override 3527f664254SPatrick Williams { 3537f664254SPatrick Williams return ::sd_bus_message_get_member(m); 3547f664254SPatrick Williams } 3557f664254SPatrick Williams 3567f664254SPatrick Williams const char* sd_bus_message_get_path(sd_bus_message* m) override 3577f664254SPatrick Williams { 3587f664254SPatrick Williams return ::sd_bus_message_get_path(m); 3597f664254SPatrick Williams } 3607f664254SPatrick Williams 3617f664254SPatrick Williams const char* sd_bus_message_get_sender(sd_bus_message* m) override 3627f664254SPatrick Williams { 3637f664254SPatrick Williams return ::sd_bus_message_get_sender(m); 3647f664254SPatrick Williams } 3657f664254SPatrick Williams 3667f664254SPatrick Williams const char* sd_bus_message_get_signature(sd_bus_message* m, 3677f664254SPatrick Williams int complete) override 3687f664254SPatrick Williams { 3697f664254SPatrick Williams return ::sd_bus_message_get_signature(m, complete); 3707f664254SPatrick Williams } 3717f664254SPatrick Williams 3727f664254SPatrick Williams int sd_bus_message_get_errno(sd_bus_message* m) override 3737f664254SPatrick Williams { 3747f664254SPatrick Williams return ::sd_bus_message_get_errno(m); 3757f664254SPatrick Williams } 3767f664254SPatrick Williams 3777f664254SPatrick Williams const sd_bus_error* sd_bus_message_get_error(sd_bus_message* m) override 3787f664254SPatrick Williams { 3797f664254SPatrick Williams return ::sd_bus_message_get_error(m); 3807f664254SPatrick Williams } 3817f664254SPatrick Williams 3827f664254SPatrick Williams int sd_bus_message_is_method_call(sd_bus_message* m, const char* interface, 3837f664254SPatrick Williams const char* member) override 3847f664254SPatrick Williams { 3857f664254SPatrick Williams return ::sd_bus_message_is_method_call(m, interface, member); 3867f664254SPatrick Williams } 3877f664254SPatrick Williams 3887f664254SPatrick Williams int sd_bus_message_is_method_error(sd_bus_message* m, 3897f664254SPatrick Williams const char* name) override 3907f664254SPatrick Williams { 3917f664254SPatrick Williams return ::sd_bus_message_is_method_error(m, name); 3927f664254SPatrick Williams } 3937f664254SPatrick Williams 3947f664254SPatrick Williams int sd_bus_message_is_signal(sd_bus_message* m, const char* interface, 3957f664254SPatrick Williams const char* member) override 3967f664254SPatrick Williams { 3977f664254SPatrick Williams return ::sd_bus_message_is_signal(m, interface, member); 3987f664254SPatrick Williams } 3997f664254SPatrick Williams 4007f664254SPatrick Williams int sd_bus_message_new_method_call(sd_bus* bus, sd_bus_message** m, 4017f664254SPatrick Williams const char* destination, 4027f664254SPatrick Williams const char* path, const char* interface, 4037f664254SPatrick Williams const char* member) override 4047f664254SPatrick Williams { 4057f664254SPatrick Williams return ::sd_bus_message_new_method_call(bus, m, destination, path, 4067f664254SPatrick Williams interface, member); 4077f664254SPatrick Williams } 4087f664254SPatrick Williams 4097f664254SPatrick Williams int sd_bus_message_new_method_return(sd_bus_message* call, 4107f664254SPatrick Williams sd_bus_message** m) override 4117f664254SPatrick Williams { 4127f664254SPatrick Williams return ::sd_bus_message_new_method_return(call, m); 4137f664254SPatrick Williams } 4147f664254SPatrick Williams 415f534ba04SWilliam A. Kennington III int sd_bus_message_new_method_error(sd_bus_message* call, 416f534ba04SWilliam A. Kennington III sd_bus_message** m, const char* name, 417f534ba04SWilliam A. Kennington III const char* description) override 418f534ba04SWilliam A. Kennington III { 419f534ba04SWilliam A. Kennington III return ::sd_bus_message_new_method_errorf(call, m, name, "%s", 420f534ba04SWilliam A. Kennington III description); 421f534ba04SWilliam A. Kennington III } 422f534ba04SWilliam A. Kennington III 4237f664254SPatrick Williams int sd_bus_message_new_method_errno(sd_bus_message* call, 4247f664254SPatrick Williams sd_bus_message** m, int error, 4257f664254SPatrick Williams const sd_bus_error* p) override 4267f664254SPatrick Williams { 4277f664254SPatrick Williams return ::sd_bus_message_new_method_errno(call, m, error, p); 4287f664254SPatrick Williams } 4297f664254SPatrick Williams 4307f664254SPatrick Williams int sd_bus_message_new_signal(sd_bus* bus, sd_bus_message** m, 4317f664254SPatrick Williams const char* path, const char* interface, 4327f664254SPatrick Williams const char* member) override 4337f664254SPatrick Williams { 4347f664254SPatrick Williams return ::sd_bus_message_new_signal(bus, m, path, interface, member); 4357f664254SPatrick Williams } 4367f664254SPatrick Williams 4377f664254SPatrick Williams int sd_bus_message_open_container(sd_bus_message* m, char type, 4387f664254SPatrick Williams const char* contents) override 4397f664254SPatrick Williams { 4407f664254SPatrick Williams return ::sd_bus_message_open_container(m, type, contents); 4417f664254SPatrick Williams } 4427f664254SPatrick Williams 4437f664254SPatrick Williams int sd_bus_message_read_basic(sd_bus_message* m, char type, 4447f664254SPatrick Williams void* p) override 4457f664254SPatrick Williams { 4467f664254SPatrick Williams return ::sd_bus_message_read_basic(m, type, p); 4477f664254SPatrick Williams } 4487f664254SPatrick Williams 4497f664254SPatrick Williams sd_bus_message* sd_bus_message_ref(sd_bus_message* m) override 4507f664254SPatrick Williams { 4517f664254SPatrick Williams return ::sd_bus_message_ref(m); 4527f664254SPatrick Williams } 4537f664254SPatrick Williams 4547f664254SPatrick Williams int sd_bus_message_skip(sd_bus_message* m, const char* types) override 4557f664254SPatrick Williams { 4567f664254SPatrick Williams return ::sd_bus_message_skip(m, types); 4577f664254SPatrick Williams } 4587f664254SPatrick Williams 4597f664254SPatrick Williams int sd_bus_message_verify_type(sd_bus_message* m, char type, 4607f664254SPatrick Williams const char* contents) override 4617f664254SPatrick Williams { 4627f664254SPatrick Williams return ::sd_bus_message_verify_type(m, type, contents); 4637f664254SPatrick Williams } 4647f664254SPatrick Williams 4657f664254SPatrick Williams int sd_bus_process(sd_bus* bus, sd_bus_message** r) override 4667f664254SPatrick Williams { 4677f664254SPatrick Williams return ::sd_bus_process(bus, r); 4687f664254SPatrick Williams } 4697f664254SPatrick Williams 4707f664254SPatrick Williams sd_bus* sd_bus_ref(sd_bus* bus) override 4717f664254SPatrick Williams { 4727f664254SPatrick Williams return ::sd_bus_ref(bus); 4737f664254SPatrick Williams } 4747f664254SPatrick Williams 4757f664254SPatrick Williams int sd_bus_request_name(sd_bus* bus, const char* name, 4767f664254SPatrick Williams uint64_t flags) override 4777f664254SPatrick Williams { 4787f664254SPatrick Williams return ::sd_bus_request_name(bus, name, flags); 4797f664254SPatrick Williams } 4807f664254SPatrick Williams 4817f664254SPatrick Williams int sd_bus_send(sd_bus* bus, sd_bus_message* m, uint64_t* cookie) override 4827f664254SPatrick Williams { 4837f664254SPatrick Williams return ::sd_bus_send(bus, m, cookie); 4847f664254SPatrick Williams } 4857f664254SPatrick Williams 4867f664254SPatrick Williams sd_bus* sd_bus_unref(sd_bus* bus) override 4877f664254SPatrick Williams { 4887f664254SPatrick Williams return ::sd_bus_unref(bus); 4897f664254SPatrick Williams } 4907f664254SPatrick Williams 4917f664254SPatrick Williams sd_bus* sd_bus_flush_close_unref(sd_bus* bus) override 4927f664254SPatrick Williams { 4937f664254SPatrick Williams return ::sd_bus_flush_close_unref(bus); 4947f664254SPatrick Williams } 4957f664254SPatrick Williams 4967f664254SPatrick Williams int sd_bus_flush(sd_bus* bus) override 4977f664254SPatrick Williams { 4987f664254SPatrick Williams return ::sd_bus_flush(bus); 4997f664254SPatrick Williams } 5007f664254SPatrick Williams 5017f664254SPatrick Williams void sd_bus_close(sd_bus* bus) override 5027f664254SPatrick Williams { 5037f664254SPatrick Williams ::sd_bus_close(bus); 5047f664254SPatrick Williams } 5057f664254SPatrick Williams 5067f664254SPatrick Williams int sd_bus_wait(sd_bus* bus, uint64_t timeout_usec) override 5077f664254SPatrick Williams { 5087f664254SPatrick Williams return ::sd_bus_wait(bus, timeout_usec); 5097f664254SPatrick Williams } 5107f664254SPatrick Williams }; 5117f664254SPatrick Williams 5127f664254SPatrick Williams extern SdBusImpl sdbus_impl; 5137f664254SPatrick Williams 5147f664254SPatrick Williams } // namespace sdbusplus 515