From da21dd57634aebffe0f5833b598e1128fafc0def Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 27 Apr 2024 12:31:12 +0530 Subject: npassd/collection: init --- include/npassd/collection.h | 21 +++++++++++++++++++++ include/npassd/service.h | 4 +++- include/npassd/util.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 include/npassd/collection.h create mode 100644 include/npassd/util.h (limited to 'include') diff --git a/include/npassd/collection.h b/include/npassd/collection.h new file mode 100644 index 0000000..36d6b72 --- /dev/null +++ b/include/npassd/collection.h @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +struct collection { + sd_bus_slot *slot; + char *root, *path; + + int locked; + char *alias, *label; + uint64_t created, modified; + + LIST_ENTRY(collection) dlist; +}; + +LIST_HEAD(collection_dlist, collection); + +int collection_new(sd_bus *bus, struct sqlite3 *db, struct collection **p, + const char *alias, const char *label, const char *root); +int collection_root_make(const char *label, const char *alias, char **root); diff --git a/include/npassd/service.h b/include/npassd/service.h index b7c71af..92a833e 100644 --- a/include/npassd/service.h +++ b/include/npassd/service.h @@ -2,6 +2,7 @@ #include #include +#include "npassd/collection.h" #include "npassd/session.h" #define MAX_SESSION 128 @@ -9,9 +10,10 @@ struct service { sd_bus *bus; sd_bus_slot *slot; - struct sqlite3 *db; + struct session_dlist sessions; + struct collection_dlist collections; }; int service_init(sd_bus *bus, struct service *service); diff --git a/include/npassd/util.h b/include/npassd/util.h new file mode 100644 index 0000000..44efb9b --- /dev/null +++ b/include/npassd/util.h @@ -0,0 +1 @@ +int dbus_objpath_alnumify(char *path); -- cgit v1.2.3