summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-28 17:03:35 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-28 20:29:43 +0100
commit224b3787679a7dc57732d29c5b0cbec7b14e0c10 (patch)
treee70d9e929e700c1bad5c856c32b745b2a53f0554 /src
parent5b820358cf2a5cb6d67cc0b1faaaca3b0171f1ac (diff)
sd-bus: make more connection properties readable
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c44
-rw-r--r--src/systemd/sd-bus.h19
2 files changed, 58 insertions, 5 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 6b35036c06..ff01d608c5 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -3432,3 +3432,47 @@ _public_ int sd_bus_get_address(sd_bus *bus, const char **address) {
return -ENODATA;
}
+
+int sd_bus_get_creds_mask(sd_bus *bus, uint64_t *mask) {
+ assert_return(bus, -EINVAL);
+ assert_return(mask, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ *mask = bus->creds_mask;
+ return 0;
+}
+
+int sd_bus_is_bus_client(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return bus->bus_client;
+}
+
+int sd_bus_is_server(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return bus->is_server;
+}
+
+int sd_bus_is_anonymous(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return bus->anonymous_auth;
+}
+
+int sd_bus_is_trusted(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return bus->trusted;
+}
+
+int sd_bus_is_monitor(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return !!(bus->hello_flags & KDBUS_HELLO_MONITOR);
+}
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index daa34842d7..3ad3db54e7 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -116,18 +116,29 @@ int sd_bus_open_system_remote(sd_bus **ret, const char *host);
int sd_bus_open_system_container(sd_bus **ret, const char *machine);
int sd_bus_new(sd_bus **ret);
+
int sd_bus_set_address(sd_bus *bus, const char *address);
int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd);
int sd_bus_set_exec(sd_bus *bus, const char *path, char *const argv[]);
+int sd_bus_get_address(sd_bus *bus, const char **address);
int sd_bus_set_bus_client(sd_bus *bus, int b);
+int sd_bus_is_bus_client(sd_bus *bus);
int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t bus_id);
+int sd_bus_is_server(sd_bus *bus);
int sd_bus_set_anonymous(sd_bus *bus, int b);
+int sd_bus_is_anonymous(sd_bus *bus);
int sd_bus_set_trusted(sd_bus *bus, int b);
-int sd_bus_set_description(sd_bus *bus, const char *description);
+int sd_bus_is_trusted(sd_bus *bus);
int sd_bus_set_monitor(sd_bus *bus, int b);
+int sd_bus_is_monitor(sd_bus *bus);
+int sd_bus_set_description(sd_bus *bus, const char *description);
+int sd_bus_get_description(sd_bus *bus, const char **description);
int sd_bus_negotiate_fds(sd_bus *bus, int b);
+int sd_bus_can_send(sd_bus *bus, char type);
int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t creds_mask);
+int sd_bus_get_creds_mask(sd_bus *bus, uint64_t *creds_mask);
+
int sd_bus_start(sd_bus *ret);
int sd_bus_try_close(sd_bus *bus);
@@ -137,13 +148,11 @@ sd_bus *sd_bus_ref(sd_bus *bus);
sd_bus *sd_bus_unref(sd_bus *bus);
int sd_bus_is_open(sd_bus *bus);
-int sd_bus_can_send(sd_bus *bus, char type);
-int sd_bus_get_address(sd_bus *bus, const char **address);
+
int sd_bus_get_bus_id(sd_bus *bus, sd_id128_t *id);
-int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
int sd_bus_get_scope(sd_bus *bus, const char **scope);
-int sd_bus_get_description(sd_bus *bus, const char **description);
int sd_bus_get_tid(sd_bus *bus, pid_t *tid);
+int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie);
int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie);