summaryrefslogtreecommitdiff
path: root/resource.h
blob: 99bcfeddf5feb0b62325dd806b90aaea329a81f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2021 Russell King.
// Licensed under GPL version 2. See COPYING.
#ifndef RESOURCE_H
#define RESOURCE_h

struct client;
struct resource;

struct resource_ops {
	int (*get)(struct client *c, struct resource *r);
	void (*close)(struct client *c, struct resource *r);
	void (*update_open)(struct client *c, struct resource *r);
	int (*update)(struct client *c, struct resource *r, const char *m);
	void (*update_close)(struct client *c, struct resource *r);
};

struct resource {
	const struct resource_ops *ops;
	struct client *updater;
	time_t updater_time;
	void *data;
};

void resource_init(GHashTable *hash);

#endif