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