1SD_BUS_MESSAGE_GET_TYPE(3) sd_bus_message_get_type SD_BUS_MESSAGE_GET_TYPE(3)
2
3
4
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
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
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
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
88 These APIs are implemented as a shared library, which can be compiled
89 and linked to with the libsystemd pkg-config(1) file.
90
92 systemd(1), sd-bus(3), sd_bus_message_new(3),
93 sd_bus_message_set_destination(3), sd-bus-errors(3),
94 sd_bus_error_add_map(3)
95
96
97
98systemd 251 SD_BUS_MESSAGE_GET_TYPE(3)