X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbus-util.h;h=314c2f786775e766d506ab4c33810f4cefe4ae58;hb=0cc1125ae10a216f2b27cb2828849ac1beb6a1b1;hp=ddb926498fb90cf96f52dc4b38c39436ecf97895;hpb=ffc06c3513d9a0693c7f810d03b20705127ba55a;p=elogind.git diff --git a/src/libsystemd-bus/bus-util.h b/src/libsystemd-bus/bus-util.h index ddb926498..314c2f786 100644 --- a/src/libsystemd-bus/bus-util.h +++ b/src/libsystemd-bus/bus-util.h @@ -35,16 +35,22 @@ typedef enum BusTransport { _BUS_TRANSPORT_INVALID = -1 } BusTransport; +typedef int (*bus_property_set_t) (sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); + struct bus_properties_map { - const char *type; - const char *name; - void *ptr; + const char *member; + const char *signature; + bus_property_set_t set; + size_t offset; }; +int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); + int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, - const struct bus_properties_map *map); + const struct bus_properties_map *map, + void *userdata); int bus_async_unregister_and_quit(sd_event *e, sd_bus *bus, const char *name); @@ -57,10 +63,37 @@ int bus_verify_polkit_async(sd_bus *bus, Hashmap **registry, sd_bus_message *m, void bus_verify_polkit_async_registry_free(sd_bus *bus, Hashmap *registry); int bus_open_system_systemd(sd_bus **_bus); +int bus_open_user_systemd(sd_bus **_bus); int bus_open_transport(BusTransport transport, const char *host, bool user, sd_bus **bus); +int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus); + +int bus_print_property(const char *name, sd_bus_message *property, bool all); +int bus_print_all_properties(sd_bus *bus, const char *dest, const char *path, char **filter, bool all); + +int bus_property_get_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, sd_bus_error *error, void *userdata); +int bus_property_get_uid(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, sd_bus_error *error, void *userdata); -int bus_generic_print_property(const char *name, sd_bus_message *property, bool all); +#define bus_property_get_gid bus_property_get_uid +#define bus_property_get_pid bus_property_get_uid + +int bus_log_parse_error(int r); +int bus_log_create_error(int r); + +typedef struct UnitInfo { + const char *id; + const char *description; + const char *load_state; + const char *active_state; + const char *sub_state; + const char *following; + const char *unit_path; + uint32_t job_id; + const char *job_type; + const char *job_path; +} UnitInfo; + +int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref); @@ -103,3 +136,15 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref); #define BUS_ERROR_NO_SUCH_MACHINE "org.freedesktop.machine1.NoSuchMachine" #define BUS_ERROR_NO_MACHINE_FOR_PID "org.freedesktop.machine1.NoMachineForPID" #define BUS_ERROR_MACHINE_EXISTS "org.freedesktop.machine1.MachineExists" + +#define BUS_ERROR_NO_SUCH_SESSION "org.freedesktop.login1.NoSuchSession" +#define BUS_ERROR_NO_SESSION_FOR_PID "org.freedesktop.login1.NoSessionForPID" +#define BUS_ERROR_NO_SUCH_USER "org.freedesktop.login1.NoSuchUser" +#define BUS_ERROR_NO_USER_FOR_PID "org.freedesktop.login1.NoUserForPID" +#define BUS_ERROR_NO_SUCH_SEAT "org.freedesktop.login1.NoSuchSeat" +#define BUS_ERROR_SESSION_NOT_ON_SEAT "org.freedesktop.login1.SessionNotOnSeat" +#define BUS_ERROR_NOT_IN_CONTROL "org.freedesktop.login1.NotInControl" +#define BUS_ERROR_DEVICE_IS_TAKEN "org.freedesktop.login1.DeviceIsTaken" +#define BUS_ERROR_DEVICE_NOT_TAKEN "org.freedesktop.login1.DeviceNotTaken" +#define BUS_ERROR_OPERATION_IN_PROGRESS "org.freedesktop.login1.OperationInProgress" +#define BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED "org.freedesktop.login1.SleepVerbNotSupported"