1SD_BUS_MESSAGE_GET_TYPE(3)  sd_bus_message_get_type SD_BUS_MESSAGE_GET_TYPE(3)
2
3
4

NAME

6       sd_bus_message_get_type, sd_bus_message_get_error,
7       sd_bus_message_get_errno, sd_bus_message_get_creds,
8       sd_bus_message_is_signal, sd_bus_message_is_method_call,
9       sd_bus_message_is_method_error - Query bus message
10       addressing/credentials metadata
11

SYNOPSIS

13       #include <systemd/sd-bus.h>
14
15       int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type);
16
17       sd_bus_error* sd_bus_message_get_error(sd_bus_message *m);
18
19       int sd_bus_message_get_errno(sd_bus_message *m);
20
21       sd_bus_creds* sd_bus_message_get_creds(sd_bus_message *m);
22
23       int sd_bus_message_is_signal(sd_bus_message *m, const char *interface,
24                                    const char *member);
25
26       int sd_bus_message_is_method_call(sd_bus_message *m,
27                                         const char *interface,
28                                         const char *member);
29
30       int sd_bus_message_is_method_error(sd_bus_message *m,
31                                          const char *name);
32

DESCRIPTION

34       sd_bus_message_get_type() returns the type of a message in the output
35       parameter type, one of SD_BUS_MESSAGE_METHOD_CALL,
36       SD_BUS_MESSAGE_METHOD_RETURN, SD_BUS_MESSAGE_METHOD_ERROR,
37       SD_BUS_MESSAGE_SIGNAL. This type is either specified as a parameter
38       when the message is created using sd_bus_message_new(3), or is set
39       automatically when the message is created using
40       sd_bus_message_new_signal(3), sd_bus_message_new_method_call(3),
41       sd_bus_message_new_method_error(3) and similar functions.
42
43       sd_bus_message_get_error() returns the error stored in the message m,
44       if there is any. Otherwise, it returns NULL.
45       sd_bus_message_get_errno() returns the error stored in the message m as
46       a positive errno-style value, if there is any. Otherwise, it returns
47       zero. Errors are mapped to errno values according to the default and
48       any additional registered error mappings. See sd-bus-errors(3) and
49       sd_bus_error_add_map(3).
50
51       sd_bus_message_get_creds() returns the message credentials attached to
52       the message m. If no credentials are attached to the message, it
53       returns NULL. Ownership of the credentials instance is not transferred
54       to the caller and hence should not be freed.
55
56       sd_bus_message_is_signal() checks if message m is a signal message. If
57       interface is non-null, it also checks if the message has the same
58       interface set. If member is non-null, it also checks if the message has
59       the same member set. Also see sd_bus_message_new_signal(3). It returns
60       true when all checks pass.
61
62       sd_bus_message_is_method_call() checks if message m is a method call
63       message. If interface is non-null, it also checks if the message has
64       the same interface set. If member is non-null, it also checks if the
65       message has the same member set. Also see
66       sd_bus_message_new_method_call(3). It returns true when all checks
67       pass.
68
69       sd_bus_message_is_method_error() checks if message m is an error reply
70       message. If name is non-null, it also checks if the message has the
71       same error identifier set. Also see sd_bus_message_new_method_error(3).
72       It returns true when all checks pass.
73

RETURN VALUE

75       On success, these functions (except sd_bus_message_get_error() and
76       sd_bus_message_get_creds()) return a non-negative integer. On failure,
77       they return a negative errno-style error code.
78       sd_bus_message_get_errno() always returns a non-negative integer, even
79       on failure.
80
81   Errors
82       Returned errors may indicate the following problems:
83
84       -EINVAL
85           The message parameter m or an output parameter is NULL.
86

NOTES

88       Functions described here are available as a shared library, which can
89       be compiled against and linked to with the libsystemd pkg-config(1)
90       file.
91
92       The code described here uses getenv(3), which is declared to be not
93       multi-thread-safe. This means that the code calling the functions
94       described here must not call setenv(3) from a parallel thread. It is
95       recommended to only do calls to setenv() from an early phase of the
96       program when no other threads have been started.
97

SEE ALSO

99       systemd(1), sd-bus(3), sd_bus_message_new(3),
100       sd_bus_message_set_destination(3), sd-bus-errors(3),
101       sd_bus_error_add_map(3)
102
103
104
105systemd 254                                         SD_BUS_MESSAGE_GET_TYPE(3)
Impressum