aboutsummaryrefslogtreecommitdiff
path: root/include/npassd
diff options
context:
space:
mode:
Diffstat (limited to 'include/npassd')
-rw-r--r--include/npassd/common.h1
-rw-r--r--include/npassd/service.h14
-rw-r--r--include/npassd/session.h19
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);