pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rules.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2018 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 #ifndef PENGINE_RULES__H
21 # define PENGINE_RULES__H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 # include <glib.h>
28 # include <regex.h>
29 
30 # include <crm/crm.h>
31 # include <crm/common/iso8601.h>
32 # include <crm/pengine/common.h>
33 
42 };
43 
44 typedef struct pe_re_match_data {
45  char *string;
46  int nregs;
47  regmatch_t *pmatch;
49 
50 typedef struct pe_match_data {
52  GHashTable *params;
53  GHashTable *meta;
55 
56 enum expression_type find_expression_type(xmlNode * expr);
57 
58 gboolean test_ruleset(xmlNode * ruleset, GHashTable * node_hash, crm_time_t * now);
59 
60 gboolean test_rule(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now);
61 
62 gboolean pe_test_rule_re(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now,
63  pe_re_match_data_t * re_match_data);
64 
65 gboolean pe_test_rule_full(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now,
66  pe_match_data_t * match_data);
67 
68 gboolean test_expression(xmlNode * expr, GHashTable * node_hash,
69  enum rsc_role_e role, crm_time_t * now);
70 
71 gboolean pe_test_expression_re(xmlNode * expr, GHashTable * node_hash,
72  enum rsc_role_e role, crm_time_t * now, pe_re_match_data_t * re_match_data);
73 
74 gboolean pe_test_expression_full(xmlNode * expr, GHashTable * node_hash,
75  enum rsc_role_e role, crm_time_t * now, pe_match_data_t * match_data);
76 
77 void unpack_instance_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name,
78  GHashTable * node_hash, GHashTable * hash,
79  const char *always_first, gboolean overwrite, crm_time_t * now);
80 
81 #ifdef ENABLE_VERSIONED_ATTRS
82 void pe_unpack_versioned_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name,
83  GHashTable * node_hash, xmlNode * hash, crm_time_t * now);
84 GHashTable *pe_unpack_versioned_parameters(xmlNode *versioned_params, const char *ra_version);
85 #endif
86 
87 char *pe_expand_re_matches(const char *string, pe_re_match_data_t * match_data);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif
A dumping ground.
struct pe_re_match_data pe_re_match_data_t
struct crm_time_s crm_time_t
Definition: iso8601.h:32
gboolean pe_test_expression_re(xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_re_match_data_t *re_match_data)
Definition: rules.c:118
pe_re_match_data_t * re
Definition: rules.h:51
struct pe_match_data pe_match_data_t
enum expression_type find_expression_type(xmlNode *expr)
Definition: rules.c:183
Definition: rules.h:35
gboolean pe_test_rule_full(xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_match_data_t *match_data)
Definition: rules.c:72
ISO_8601 Date handling.
GHashTable * meta
Definition: rules.h:53
char * pe_expand_re_matches(const char *string, pe_re_match_data_t *match_data)
Definition: rules.c:935
GHashTable * params
Definition: rules.h:52
gboolean test_ruleset(xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now)
Definition: rules.c:37
gboolean pe_test_expression_full(xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_match_data_t *match_data)
Definition: rules.c:129
regmatch_t * pmatch
Definition: rules.h:47
gboolean pe_test_rule_re(xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now, pe_re_match_data_t *re_match_data)
Definition: rules.c:61
rsc_role_e
Definition: common.h:86
Definition: rules.h:38
void unpack_instance_attributes(xmlNode *top, xmlNode *xml_obj, const char *set_name, GHashTable *node_hash, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *now)
Definition: rules.c:904
gboolean test_rule(xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now)
Definition: rules.c:55
expression_type
Definition: rules.h:34
char * string
Definition: rules.h:45
gboolean test_expression(xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now)
Definition: rules.c:112