1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_PENGINE_RULES__H
11 # define PCMK__CRM_PENGINE_RULES__H
12
13 # include <glib.h>
14 # include <crm/crm.h>
15 # include <crm/common/iso8601.h>
16 # include <crm/pengine/common.h>
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 enum expression_type {
23 not_expr,
24 nested_rule,
25 attr_expr,
26 loc_expr,
27 role_expr,
28 time_expr,
29 version_expr,
30 rsc_expr,
31 op_expr
32 };
33
34 enum expression_type find_expression_type(xmlNode * expr);
35
36 gboolean pe_evaluate_rules(xmlNode *ruleset, GHashTable *node_hash,
37 crm_time_t *now, crm_time_t *next_change);
38
39 gboolean pe_test_rule(xmlNode *rule, GHashTable *node_hash,
40 enum rsc_role_e role, crm_time_t *now,
41 crm_time_t *next_change, pe_match_data_t *match_data);
42
43 gboolean pe_test_expression(xmlNode *expr, GHashTable *node_hash,
44 enum rsc_role_e role, crm_time_t *now,
45 crm_time_t *next_change,
46 pe_match_data_t *match_data);
47
48 void pe_eval_nvpairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
49 pe_rule_eval_data_t *rule_data, GHashTable *hash,
50 const char *always_first, gboolean overwrite,
51 crm_time_t *next_change);
52
53 void pe_unpack_nvpairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
54 GHashTable *node_hash, GHashTable *hash,
55 const char *always_first, gboolean overwrite,
56 crm_time_t *now, crm_time_t *next_change);
57
58 #if ENABLE_VERSIONED_ATTRS
59 void pe_eval_versioned_attributes(xmlNode *top, xmlNode *xml_obj,
60 const char *set_name, pe_rule_eval_data_t *rule_data,
61 xmlNode *hash, crm_time_t *next_change);
62
63 GHashTable *pe_unpack_versioned_parameters(xmlNode *versioned_params, const char *ra_version);
64 #endif
65
66 char *pe_expand_re_matches(const char *string, pe_re_match_data_t * match_data);
67
68 gboolean pe_eval_rules(xmlNode *ruleset, pe_rule_eval_data_t *rule_data,
69 crm_time_t *next_change);
70 gboolean pe_eval_expr(xmlNode *rule, pe_rule_eval_data_t *rule_data,
71 crm_time_t *next_change);
72 gboolean pe_eval_subexpr(xmlNode *expr, pe_rule_eval_data_t *rule_data,
73 crm_time_t *next_change);
74
75 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
76 #include <crm/pengine/rules_compat.h>
77 #endif
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif