aboutsummaryrefslogtreecommitdiff
path: root/include/npassd/session.h
blob: a3aa705bd0bb116ef186a6acd5ab31ff0e63ca11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdbool.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];
};

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);