1
2
3
4
5
6
7
8
9
10 #ifndef PENGINE_RULES__H
11 # define PENGINE_RULES__H
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 # include <glib.h>
18
19 # include <crm/crm.h>
20 # include <crm/common/iso8601.h>
21 # include <crm/pengine/common.h>
22
23 enum expression_type {
24 not_expr,
25 nested_rule,
26 attr_expr,
27 loc_expr,
28 role_expr,
29 time_expr,
30 version_expr,
31 rsc_expr,
32 op_expr
33 };
34
35 enum expression_type find_expression_type(xmlNode * expr);
36
37 gboolean pe_evaluate_rules(xmlNode *ruleset, GHashTable *node_hash,
38 crm_time_t *now, crm_time_t *next_change);
39
40 gboolean pe_test_rule(xmlNode *rule, GHashTable *node_hash,
41 enum rsc_role_e role, crm_time_t *now,
42 crm_time_t *next_change, pe_match_data_t *match_data);
43
44 gboolean pe_test_expression(xmlNode *expr, GHashTable *node_hash,
45 enum rsc_role_e role, crm_time_t *now,
46 crm_time_t *next_change,
47 pe_match_data_t *match_data);
48
49 void pe_eval_nvpairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
50 pe_rule_eval_data_t *rule_data, GHashTable *hash,
51 const char *always_first, gboolean overwrite,
52 crm_time_t *next_change);
53
54 void pe_unpack_nvpairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
55 GHashTable *node_hash, GHashTable *hash,
56 const char *always_first, gboolean overwrite,
57 crm_time_t *now, crm_time_t *next_change);
58
59 #if ENABLE_VERSIONED_ATTRS
60 void pe_eval_versioned_attributes(xmlNode *top, xmlNode *xml_obj,
61 const char *set_name, pe_rule_eval_data_t *rule_data,
62 xmlNode *hash, crm_time_t *next_change);
63
64 GHashTable *pe_unpack_versioned_parameters(xmlNode *versioned_params, const char *ra_version);
65 #endif
66
67 char *pe_expand_re_matches(const char *string, pe_re_match_data_t * match_data);
68
69 gboolean pe_eval_rules(xmlNode *ruleset, pe_rule_eval_data_t *rule_data,
70 crm_time_t *next_change);
71 gboolean pe_eval_expr(xmlNode *rule, pe_rule_eval_data_t *rule_data,
72 crm_time_t *next_change);
73 gboolean pe_eval_subexpr(xmlNode *expr, pe_rule_eval_data_t *rule_data,
74 crm_time_t *next_change);
75
76 #ifndef PCMK__NO_COMPAT
77
78
79
80
81
82 gboolean test_ruleset(xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now);
83
84
85 gboolean test_rule(xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role,
86 crm_time_t *now);
87
88
89 gboolean pe_test_rule_re(xmlNode *rule, GHashTable *node_hash,
90 enum rsc_role_e role, crm_time_t *now,
91 pe_re_match_data_t *re_match_data);
92
93
94 gboolean pe_test_rule_full(xmlNode *rule, GHashTable *node_hash,
95 enum rsc_role_e role, crm_time_t *now,
96 pe_match_data_t *match_data);
97
98
99 gboolean test_expression(xmlNode *expr, GHashTable *node_hash,
100 enum rsc_role_e role, crm_time_t *now);
101
102
103 gboolean pe_test_expression_re(xmlNode *expr, GHashTable *node_hash,
104 enum rsc_role_e role, crm_time_t *now,
105 pe_re_match_data_t *re_match_data);
106
107
108 gboolean pe_test_expression_full(xmlNode *expr, GHashTable *node_hash,
109 enum rsc_role_e role,
110 crm_time_t *now, pe_match_data_t *match_data);
111
112
113 void unpack_instance_attributes(xmlNode *top, xmlNode *xml_obj,
114 const char *set_name, GHashTable *node_hash,
115 GHashTable *hash, const char *always_first,
116 gboolean overwrite, crm_time_t *now);
117 #endif
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif