First attempt at a search infrastructure.
[collection4.git] / graph_ident.h
1 #ifndef GRAPH_IDENT_H
2 #define GRAPH_IDENT_H 1
3
4 #include "graph_types.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 graph_ident_t *ident_create (const char *host,
13     const char *plugin, const char *plugin_instance,
14     const char *type, const char *type_instance);
15 graph_ident_t *ident_clone (const graph_ident_t *ident);
16
17 #define IDENT_FLAG_REPLACE_ALL 0x01
18 #define IDENT_FLAG_REPLACE_ANY 0x02
19 graph_ident_t *ident_copy_with_selector (const graph_ident_t *selector,
20     const graph_ident_t *ident, unsigned int flags);
21
22 void ident_destroy (graph_ident_t *ident);
23
24 const char *ident_get_host (graph_ident_t *ident);
25 const char *ident_get_plugin (graph_ident_t *ident);
26 const char *ident_get_plugin_instance (graph_ident_t *ident);
27 const char *ident_get_type (graph_ident_t *ident);
28 const char *ident_get_type_instance (graph_ident_t *ident);
29
30 int ident_set_host (graph_ident_t *ident, const char *host);
31 int ident_set_plugin (graph_ident_t *ident, const char *plugin);
32 int ident_set_plugin_instance (graph_ident_t *ident,
33     const char *plugin_instance);
34 int ident_set_type (graph_ident_t *ident, const char *type);
35 int ident_set_type_instance (graph_ident_t *ident,
36     const char *type_instance);
37
38 int ident_compare (const graph_ident_t *i0,
39     const graph_ident_t *i1);
40
41 _Bool ident_matches (const graph_ident_t *selector,
42     const graph_ident_t *ident);
43
44 char *ident_to_string (const graph_ident_t *ident);
45 char *ident_to_file (const graph_ident_t *ident);
46 char *ident_to_json (const graph_ident_t *ident);
47
48 /* vim: set sw=2 sts=2 et fdm=marker : */
49 #endif /* GRAPH_IDENT_H */