pacemaker  1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
rules.c File Reference
#include <crm_internal.h>
#include <crm/crm.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <glib.h>
#include <crm/pengine/rules.h>
#include <crm/pengine/internal.h>
#include <sys/types.h>
#include <regex.h>
#include <ctype.h>
Include dependency graph for rules.c:

Go to the source code of this file.

Macros

#define cron_check(xml_field, time_field)
 
#define update_field(xml_field, time_fn)
 

Typedefs

typedef struct sorted_set_s sorted_set_t
 
typedef struct unpack_data_s unpack_data_t
 

Functions

 CRM_TRACE_INIT_DATA (pe_rules)
 
crm_time_tparse_xml_duration (crm_time_t *start, xmlNode *duration_spec)
 
gboolean test_date_expression (xmlNode *time_expr, crm_time_t *now)
 
gboolean cron_range_satisfied (crm_time_t *now, xmlNode *cron_spec)
 
gboolean test_attr_expression (xmlNode *expr, GHashTable *hash, crm_time_t *now)
 
gboolean pe_test_attr_expression_full (xmlNode *expr, GHashTable *hash, crm_time_t *now, pe_match_data_t *match_data)
 
gboolean test_role_expression (xmlNode *expr, enum rsc_role_e role, crm_time_t *now)
 
gboolean test_ruleset (xmlNode *ruleset, GHashTable *node_hash, crm_time_t *now)
 
gboolean test_rule (xmlNode *rule, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now)
 
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)
 
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)
 
gboolean test_expression (xmlNode *expr, GHashTable *node_hash, enum rsc_role_e role, crm_time_t *now)
 
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)
 
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)
 
enum expression_type find_expression_type (xmlNode *expr)
 
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)
 
char * pe_expand_re_matches (const char *string, pe_re_match_data_t *match_data)
 

Macro Definition Documentation

#define cron_check (   xml_field,
  time_field 
)
Value:
value = crm_element_value(cron_spec, xml_field); \
if(value != NULL) { \
gboolean pass = TRUE; \
decodeNVpair(value, '-', &value_low, &value_high); \
if(value_low == NULL) { \
value_low = strdup(value); \
} \
value_low_i = crm_parse_int(value_low, "0"); \
value_high_i = crm_parse_int(value_high, "-1"); \
if(value_high_i < 0) { \
if(value_low_i != time_field) { \
pass = FALSE; \
} \
} else if(value_low_i > time_field) { \
pass = FALSE; \
} else if(value_high_i < time_field) { \
pass = FALSE; \
} \
free(value_low); \
free(value_high); \
if(pass == FALSE) { \
crm_debug("Condition '%s' in %s: failed", value, xml_field); \
return pass; \
} \
crm_debug("Condition '%s' in %s: passed", value, xml_field); \
}
int crm_parse_int(const char *text, const char *default_text)
Definition: strings.c:125
#define crm_debug(fmt, args...)
Definition: logging.h:253
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5165

Definition at line 516 of file rules.c.

#define update_field (   xml_field,
  time_fn 
)
Value:
value = crm_element_value(duration_spec, xml_field); \
if(value != NULL) { \
int value_i = crm_parse_int(value, "0"); \
time_fn(end, value_i); \
}
int crm_parse_int(const char *text, const char *default_text)
Definition: strings.c:125
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5165

Definition at line 585 of file rules.c.

Typedef Documentation

typedef struct sorted_set_s sorted_set_t
typedef struct unpack_data_s unpack_data_t

Function Documentation

CRM_TRACE_INIT_DATA ( pe_rules  )
gboolean cron_range_satisfied ( crm_time_t now,
xmlNode *  cron_spec 
)

Definition at line 545 of file rules.c.

enum expression_type find_expression_type ( xmlNode *  expr)

Definition at line 190 of file rules.c.

crm_time_t * parse_xml_duration ( crm_time_t start,
xmlNode *  duration_spec 
)

Definition at line 593 of file rules.c.

char* pe_expand_re_matches ( const char *  string,
pe_re_match_data_t match_data 
)

Definition at line 950 of file rules.c.

gboolean pe_test_attr_expression_full ( xmlNode *  expr,
GHashTable *  hash,
crm_time_t now,
pe_match_data_t match_data 
)

Definition at line 272 of file rules.c.

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 at line 136 of file rules.c.

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 at line 125 of file rules.c.

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 at line 79 of file rules.c.

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 at line 68 of file rules.c.

gboolean test_attr_expression ( xmlNode *  expr,
GHashTable *  hash,
crm_time_t now 
)

Definition at line 266 of file rules.c.

gboolean test_date_expression ( xmlNode *  time_expr,
crm_time_t now 
)

Definition at line 613 of file rules.c.

gboolean test_expression ( xmlNode *  expr,
GHashTable *  node_hash,
enum rsc_role_e  role,
crm_time_t now 
)

Definition at line 119 of file rules.c.

gboolean test_role_expression ( xmlNode *  expr,
enum rsc_role_e  role,
crm_time_t now 
)

Definition at line 225 of file rules.c.

gboolean test_rule ( xmlNode *  rule,
GHashTable *  node_hash,
enum rsc_role_e  role,
crm_time_t now 
)

Definition at line 62 of file rules.c.

gboolean test_ruleset ( xmlNode *  ruleset,
GHashTable *  node_hash,
crm_time_t now 
)

Definition at line 44 of file rules.c.

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 at line 919 of file rules.c.