diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/npassd/service.h | 4 | ||||
-rw-r--r-- | include/npassd/session.h | 21 |
2 files changed, 12 insertions, 13 deletions
diff --git a/include/npassd/service.h b/include/npassd/service.h index 6219dd6..b7c71af 100644 --- a/include/npassd/service.h +++ b/include/npassd/service.h @@ -1,4 +1,5 @@ #include <sqlite3.h> +#include <sys/queue.h> #include <systemd/sd-bus.h> #include "npassd/session.h" @@ -8,8 +9,9 @@ struct service { sd_bus *bus; sd_bus_slot *slot; + struct sqlite3 *db; - struct session session[MAX_SESSION]; + struct session_dlist sessions; }; int service_init(sd_bus *bus, struct service *service); 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); |