From 9c9207912eab0809e48be0ea17d70cb08f3ab04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 27 Jul 2018 14:58:41 +0200 Subject: [PATCH] man: add sd_bus_message_get_type(3) sd_bus_message{get_type,is_signal,is_method_call,is_method_error} get one man page. sd_bus_message_{set,get}_{destination,path,interface,member,sender} are put in the second one. --- man/rules/meson.build | 16 ++- man/sd-bus.xml | 1 + man/sd_bus_message_get_type.xml | 129 +++++++++++++++++++++++++ man/sd_bus_message_set_destination.xml | 70 ++++++++++++-- 4 files changed, 207 insertions(+), 9 deletions(-) create mode 100644 man/sd_bus_message_get_type.xml diff --git a/man/rules/meson.build b/man/rules/meson.build index 6f9a04cf61..5be98947a1 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -213,6 +213,12 @@ manpages = [ '3', ['sd_bus_message_get_realtime_usec', 'sd_bus_message_get_seqnum'], ''], + ['sd_bus_message_get_type', + '3', + ['sd_bus_message_is_method_call', + 'sd_bus_message_is_method_error', + 'sd_bus_message_is_signal'], + ''], ['sd_bus_message_new', '3', ['SD_BUS_MESSAGE_METHOD_CALL', @@ -236,7 +242,15 @@ manpages = [ ['sd_bus_message_new_signal', '3', [], ''], ['sd_bus_message_read', '3', ['sd_bus_message_readv'], ''], ['sd_bus_message_read_basic', '3', [], ''], - ['sd_bus_message_set_destination', '3', ['sd_bus_message_set_sender'], ''], + ['sd_bus_message_set_destination', + '3', + ['sd_bus_message_get_destination', + 'sd_bus_message_get_interface', + 'sd_bus_message_get_member', + 'sd_bus_message_get_path', + 'sd_bus_message_get_sender', + 'sd_bus_message_set_sender'], + ''], ['sd_bus_negotiate_fds', '3', ['sd_bus_negotiate_creds', 'sd_bus_negotiate_timestamp'], diff --git a/man/sd-bus.xml b/man/sd-bus.xml index 6f58b001c0..0e381cc9d8 100644 --- a/man/sd-bus.xml +++ b/man/sd-bus.xml @@ -60,6 +60,7 @@ sd_bus_message_copy3, sd_bus_message_get_cookie3, sd_bus_message_get_monotonic_usec3, +sd_bus_message_get_type3, sd_bus_message_new3, sd_bus_message_new_method_call3, sd_bus_message_new_method_error3, diff --git a/man/sd_bus_message_get_type.xml b/man/sd_bus_message_get_type.xml new file mode 100644 index 0000000000..6f6b7d0ba3 --- /dev/null +++ b/man/sd_bus_message_get_type.xml @@ -0,0 +1,129 @@ + + + + + + + + sd_bus_message_get_type + systemd + + + + sd_bus_message_get_type + 3 + + + + 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 + + + + + #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_new3, + or is set automatically when the message is created using + sd_bus_set_message_new_signal3, + sd_bus_set_message_new_method_call3, + sd_bus_set_message_new_method_error3 + 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_signal3. 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_call3. 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_error3. 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. + + + + + + + + See Also + + + systemd1, + sd-bus3, + sd_bus_message_new3, + sd_bus_message_set_destination3 + + + + diff --git a/man/sd_bus_message_set_destination.xml b/man/sd_bus_message_set_destination.xml index 626272b0aa..e8a1206ae8 100644 --- a/man/sd_bus_message_set_destination.xml +++ b/man/sd_bus_message_set_destination.xml @@ -6,7 +6,6 @@ --> - sd_bus_message_set_destination systemd @@ -19,8 +18,14 @@ sd_bus_message_set_destination + sd_bus_message_get_destination + sd_bus_message_get_path + sd_bus_message_get_interface + sd_bus_message_get_member sd_bus_message_set_sender - Set the destination or sender service name of a bus message + sd_bus_message_get_sender + + Set and query bus message addressing information @@ -33,31 +38,77 @@ const char *destination + + const char* sd_bus_message_get_destination + sd_bus_message *message + + + + const char* sd_bus_message_get_path + sd_bus_message *message + + + + const char* sd_bus_message_get_interface + sd_bus_message *message + + + + const char* sd_bus_message_get_member + sd_bus_message *message + + int sd_bus_message_set_sender sd_bus_message *message const char *sender + + + const char* sd_bus_message_get_sender + sd_bus_message *message + Description - sd_bus_message_set_destination() sets the destination service name for the specified bus - message object. The specified name must be a valid unique or well-known service name. + sd_bus_message_set_destination() sets the destination service name + for the specified bus message object. The specified name must be a valid unique or well-known + service name. + + sd_bus_message_get_destination(), + sd_bus_message_get_path(), + sd_bus_message_get_interface(), and + sd_bus_message_get_member() return the destination, path, interface, and + member fields from message header. The return value will be + NULL is message is NULL or the + message is of a type that doesn't use those fields or the message doesn't have them set. See + sd_bus_message_new_method_call3 + and + sd_bus_message_set_destination3 + for more discussion of those values. + sd_bus_message_set_sender() sets the sender service name for the specified bus message object. The specified name must be a valid unique or well-known service name. This function is useful only for messages to send on direct connections as for connections to bus brokers the broker will fill in the destination field anyway, and the sender field set by original sender is ignored. + + sd_bus_message_get_sender() returns the sender field from + message. + + When a string is returned, it is a pointer to internal storage, and may not be modified or + freed. It is only valid as long as the message remains referenced and + this field hasn't been changed by a different call. Return Value - On success, these calls return 0 or a positive integer. On failure, these calls return a negative errno-style - error code. + On success, these calls return 0 or a positive integer. On failure, these calls return a + negative errno-style error code. @@ -69,13 +120,16 @@ -EINVAL - A specified parameter is invalid. + The message parameter or the output parameter are + NULL. -EPERM - The message is already sealed. + For sd_bus_message_set_destination or + sd_bus_message_set_sender, the message is already + sealed.