diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-04-20 19:08:55 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-04-20 21:26:22 +0530 |
commit | 243c88e20bad08a7b2fe268cec3a7b5129f461a2 (patch) | |
tree | df8b1c8c6eb3cb62745d32c637f5a78d94aa2ecf /include/npassd | |
parent | 47e0d63e931d14c91635abda4a7736f9e9b987c3 (diff) |
npassd: init
Diffstat (limited to 'include/npassd')
-rw-r--r-- | include/npassd/common.h | 1 | ||||
-rw-r--r-- | include/npassd/service.h | 14 | ||||
-rw-r--r-- | include/npassd/session.h | 19 |
3 files changed, 34 insertions, 0 deletions
diff --git a/include/npassd/common.h b/include/npassd/common.h new file mode 100644 index 0000000..b3ef866 --- /dev/null +++ b/include/npassd/common.h @@ -0,0 +1 @@ +#define DBUS_OBJECT_PATH "/org/freedesktop/secrets" diff --git a/include/npassd/service.h b/include/npassd/service.h new file mode 100644 index 0000000..e1a42fc --- /dev/null +++ b/include/npassd/service.h @@ -0,0 +1,14 @@ +#include <systemd/sd-bus.h> + +#include "npassd/session.h" + +#define MAX_SESSION 128 + +struct service { + sd_bus *bus; + sd_bus_slot *slot; + struct session session[MAX_SESSION]; +}; + +int service_init(sd_bus *bus, struct service *service); +void service_free(struct service *service); diff --git a/include/npassd/session.h b/include/npassd/session.h new file mode 100644 index 0000000..6763c6a --- /dev/null +++ b/include/npassd/session.h @@ -0,0 +1,19 @@ +#include <stdbool.h> +#include <systemd/sd-bus.h> + +#include "npassd/common.h" + +#define SESSION_IFACE "org.freedesktop.Secret.Session" + +/* reusable slots */ +struct session { + bool isactive; + sd_bus_slot *slot; + /* +32 for snprintf("/session/%d") */ + char path[sizeof(DBUS_OBJECT_PATH) + 32]; +}; + +void session_init(struct session *s, size_t n); +int session_slot_available(struct session *s, size_t n); +int session_free(struct session *s); +int session_new(sd_bus *bus, struct session *s, unsigned slot_no); |