summaryrefslogtreecommitdiffstats
path: root/src/shared/varlink.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-05-29 09:33:27 +0200
committerLennart Poettering <lennart@poettering.net>2024-06-25 09:49:26 +0200
commit05f47839e1feca299191aaa1251c041d61ada1fc (patch)
tree8eba9406ddaf73eb8ad9c493605b5f32307f9ed6 /src/shared/varlink.h
parentMerge pull request #33461 from poettering/boot-measured-flag-rework (diff)
downloadsystemd-05f47839e1feca299191aaa1251c041d61ada1fc.tar.xz
systemd-05f47839e1feca299191aaa1251c041d61ada1fc.zip
varlink: add varlink_many_*() helpers that send messages to a set of connections at once
If we have a Varlink interface that allows man subscribers to the same source of events we typically want to notify all of them at once with the same message. Let's add some helpers for this purpose: varlink_many_*() can be used to send messages, similar to the corresponding varlink_*() calls, but they take a Set of Varlink objects and we issue the operation on every connection once. This ports over one existing case where this is beneficial, but the main user for this is supposed to be importd later.
Diffstat (limited to 'src/shared/varlink.h')
-rw-r--r--src/shared/varlink.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/shared/varlink.h b/src/shared/varlink.h
index 739786b975..40a8fd086f 100644
--- a/src/shared/varlink.h
+++ b/src/shared/varlink.h
@@ -2,9 +2,10 @@
#pragma once
#include "sd-event.h"
-
#include "sd-json.h"
+
#include "pidref.h"
+#include "set.h"
#include "time-util.h"
#include "varlink-idl.h"
@@ -264,6 +265,12 @@ int varlink_invocation(VarlinkInvocationFlags flags);
int varlink_error_to_errno(const char *error, sd_json_variant *parameters);
+int varlink_many_notifyb(Set *s, ...);
+#define varlink_many_notifybo(s, ...) \
+ varlink_many_notifyb((s), SD_JSON_BUILD_OBJECT(__VA_ARGS__))
+int varlink_many_reply(Set *s, sd_json_variant *parameters);
+int varlink_many_error(Set *s, const char *error_id, sd_json_variant *parameters);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(Varlink *, varlink_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(Varlink *, varlink_close_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(Varlink *, varlink_flush_close_unref);