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