aboutsummaryrefslogtreecommitdiff
path: root/include/npassd/session.h
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-04-26 22:48:10 +0530
committersinanmohd <sinan@sinanmohd.com>2024-04-27 10:59:14 +0530
commit06e3f1885fc112093f867cd5d7a8b163ef28650c (patch)
treee60eb7e80f76d45f294131ab8de2d9ce1f0c1657 /include/npassd/session.h
parent8ce5f52567f486dbad1eb3f91383f62395df7581 (diff)
npassd/session: refactor
- mak use of list(3)
Diffstat (limited to 'include/npassd/session.h')
-rw-r--r--include/npassd/session.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/npassd/session.h b/include/npassd/session.h
index a3aa705..48d4fed 100644
--- a/include/npassd/session.h
+++ b/include/npassd/session.h
@@ -1,22 +1,19 @@
#include <stdbool.h>
+#include <sys/queue.h>
#include <systemd/sd-bus.h>
#include "npassd/common.h"
#define SESSION_IFACE "org.freedesktop.Secret.Session"
-#define MAX_OWNER_LEN 64
-/* reusable slots */
struct session {
- bool isactive;
- sd_bus_slot *slot;
- char owner[MAX_OWNER_LEN];
- /* +32 for snprintf("/session/%d") */
- char path[sizeof(DBUS_OBJECT_PATH) + 32];
+ sd_bus_slot *slot, *slot_singal;
+ char *owner, *path;
+
+ LIST_ENTRY(session) dlist;
};
-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 *session, unsigned session_no,
- const char *owner);
+LIST_HEAD(session_dlist, session);
+
+void session_free(struct session *s);
+int session_new(sd_bus *bus, struct session **session, const char *owner);