SD_BUS_MESSAGE_GET_TYPE(3)

NAME
sd_bus_message_get_type, sd_bus_message_is_signal, sd_bus_message_is_method_call, sd_bus_message_is_method_error - Query bus message addressing metadata

SYNOPSIS

#include <systemd/sd-bus.h>

int sd_bus_message_get_type(sd_bus_message *message, uint8_t *type);

int sd_bus_message_is_signal(sd_bus_message *message, const char *interface, const char *member);

int sd_bus_message_is_method_call(sd_bus_message *message, const char *interface, const char *member);

int sd_bus_message_is_method_error(sd_bus_message *message, const char *name);

DESCRIPTION

sd_bus_message_get_type() returns the type of a message in the output parameter type, one of SD_BUS_MESSAGE_METHOD_CALL, SD_BUS_MESSAGE_METHOD_RETURN, SD_BUS_MESSAGE_METHOD_ERROR, SD_BUS_MESSAGE_SIGNAL. This type is either specified as a parameter when the message is created using sd_bus_set_message_new(3), or is set automatically when the message is created using sd_bus_set_message_new_signal(3), sd_bus_set_message_new_method_call(3), sd_bus_set_message_new_method_error(3) and similar functions.

sd_bus_message_is_signal() checks if message m is a signal message. If interface is non-null, it also checks if the message has the same interface set. If member is non-null, it also checks if the message has the same member set. Also see sd_bus_set_message_new_signal(3). It returns true when all checks pass.

sd_bus_message_is_method_call() checks if message m is a method call message. If interface is non-null, it also checks if the message has the same interface set. If member is non-null, it also checks if the message has the same member set. Also see sd_bus_set_message_new_method_call(3). It returns true when all checks pass.

sd_bus_message_is_method_error() checks if message m is an error reply message. If name is non-null, it also checks if the message has the same error identifier set. Also see sd_bus_set_message_new_method_error(3). It returns true when all checks pass.

RETURN VALUE

On success, those functions return 0 or a positive integer. On failure, it returns a negative errno-style error code.

  Errors

Returned errors may indicate the following problems:

-EINVAL
    The message parameter or the output parameter are NULL.

NOTES

These APIs are implemented as a shared library, which can be compiled and linked to with the libsystemd pkg-config(1) file.

SEE ALSO

systemd(1), sd-bus(3), sd_bus_message_new(3), sd_bus_message_set_destination(3)