root/include/crm/pengine/rules.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2022 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   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        = 0,
  24     nested_rule     = 1,
  25     attr_expr       = 2,
  26     loc_expr        = 3,
  27     role_expr       = 4,
  28     time_expr       = 5,
  29 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
  30     //! \deprecated Do not use (will be removed in a future release)
  31     version_expr    = 6,
  32 #endif
  33     rsc_expr        = 7,
  34     op_expr         = 8,
  35 };
  36 
  37 enum expression_type find_expression_type(xmlNode * expr);
  38 
  39 gboolean pe_evaluate_rules(xmlNode *ruleset, GHashTable *node_hash,
  40                            crm_time_t *now, crm_time_t *next_change);
  41 
  42 gboolean pe_test_rule(xmlNode *rule, GHashTable *node_hash,
  43                       enum rsc_role_e role, crm_time_t *now,
  44                       crm_time_t *next_change, pe_match_data_t *match_data);
  45 
  46 gboolean pe_test_expression(xmlNode *expr, GHashTable *node_hash,
  47                             enum rsc_role_e role, crm_time_t *now,
  48                             crm_time_t *next_change,
  49                             pe_match_data_t *match_data);
  50 
  51 void pe_eval_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name,
  52                      pe_rule_eval_data_t *rule_data, GHashTable *hash,
  53                      const char *always_first, gboolean overwrite,
  54                      crm_time_t *next_change);
  55 
  56 void pe_unpack_nvpairs(xmlNode *top, xmlNode *xml_obj, const char *set_name,
  57                        GHashTable *node_hash, GHashTable *hash,
  58                        const char *always_first, gboolean overwrite,
  59                        crm_time_t *now, crm_time_t *next_change);
  60 
  61 char *pe_expand_re_matches(const char *string, pe_re_match_data_t * match_data);
  62 
  63 gboolean pe_eval_rules(xmlNode *ruleset, pe_rule_eval_data_t *rule_data,
  64                        crm_time_t *next_change);
  65 gboolean pe_eval_expr(xmlNode *rule, pe_rule_eval_data_t *rule_data,
  66                       crm_time_t *next_change);
  67 gboolean pe_eval_subexpr(xmlNode *expr, pe_rule_eval_data_t *rule_data,
  68                          crm_time_t *next_change);
  69 
  70 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
  71 #include <crm/pengine/rules_compat.h>
  72 #endif
  73 
  74 #ifdef __cplusplus
  75 }
  76 #endif
  77 
  78 #endif

/* [previous][next][first][last][top][bottom][index][help] */