src/graph_{ident,instance}.[ch]: Implement getting the mtime from instances.
[collection4.git] / src / graph_ident.h
1 #ifndef GRAPH_IDENT_H
2 #define GRAPH_IDENT_H 1
3
4 #include <time.h>
5
6 #define ANY_TOKEN "/any/"
7 #define ALL_TOKEN "/all/"
8
9 #define IS_ANY(str) (((str) != NULL) && (strcasecmp (ANY_TOKEN, (str)) == 0))
10 #define IS_ALL(str) (((str) != NULL) && (strcasecmp (ALL_TOKEN, (str)) == 0))
11
12 struct graph_ident_s;
13 typedef struct graph_ident_s graph_ident_t;
14
15 graph_ident_t *ident_create (const char *host,
16     const char *plugin, const char *plugin_instance,
17     const char *type, const char *type_instance);
18 graph_ident_t *ident_clone (const graph_ident_t *ident);
19
20 #define IDENT_FLAG_REPLACE_ALL 0x01
21 #define IDENT_FLAG_REPLACE_ANY 0x02
22 graph_ident_t *ident_copy_with_selector (const graph_ident_t *selector,
23     const graph_ident_t *ident, unsigned int flags);
24
25 void ident_destroy (graph_ident_t *ident);
26
27 const char *ident_get_host (graph_ident_t *ident);
28 const char *ident_get_plugin (graph_ident_t *ident);
29 const char *ident_get_plugin_instance (graph_ident_t *ident);
30 const char *ident_get_type (graph_ident_t *ident);
31 const char *ident_get_type_instance (graph_ident_t *ident);
32
33 int ident_set_host (graph_ident_t *ident, const char *host);
34 int ident_set_plugin (graph_ident_t *ident, const char *plugin);
35 int ident_set_plugin_instance (graph_ident_t *ident,
36     const char *plugin_instance);
37 int ident_set_type (graph_ident_t *ident, const char *type);
38 int ident_set_type_instance (graph_ident_t *ident,
39     const char *type_instance);
40
41 int ident_compare (const graph_ident_t *i0,
42     const graph_ident_t *i1);
43
44 _Bool ident_matches (const graph_ident_t *selector,
45                 const graph_ident_t *ident);
46
47 char *ident_to_string (const graph_ident_t *ident);
48 char *ident_to_file (const graph_ident_t *ident);
49 char *ident_to_json (const graph_ident_t *ident);
50
51 time_t ident_get_mtime (const graph_ident_t *ident);
52
53 /* vim: set sw=2 sts=2 et fdm=marker : */
54 #endif /* GRAPH_IDENT_H */