root/include/crm/pengine/rules.h

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

INCLUDED FROM


   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 #  include <glib.h>
  22 #  include <regex.h>
  23 
  24 #  include <crm/crm.h>
  25 #  include <crm/common/iso8601.h>
  26 #  include <crm/pengine/common.h>
  27 
  28 enum expression_type {
  29     not_expr,
  30     nested_rule,
  31     attr_expr,
  32     loc_expr,
  33     role_expr,
  34     time_expr,
  35     version_expr
  36 };
  37 
  38 typedef struct pe_re_match_data {
  39     char *string;
  40     int nregs;
  41     regmatch_t *pmatch;
  42 } pe_re_match_data_t;
  43 
  44 typedef struct pe_match_data {
  45     pe_re_match_data_t *re;
  46     GHashTable *params;
  47     GHashTable *meta;
  48 } pe_match_data_t;
  49 
  50 enum expression_type find_expression_type(xmlNode * expr);
  51 
  52 gboolean test_ruleset(xmlNode * ruleset, GHashTable * node_hash, crm_time_t * now);
  53 
  54 gboolean test_rule(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now);
  55 
  56 gboolean pe_test_rule_re(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now,
  57                          pe_re_match_data_t * re_match_data);
  58 
  59 gboolean pe_test_rule_full(xmlNode * rule, GHashTable * node_hash, enum rsc_role_e role, crm_time_t * now,
  60                          pe_match_data_t * match_data);
  61 
  62 gboolean test_expression(xmlNode * expr, GHashTable * node_hash,
  63                          enum rsc_role_e role, crm_time_t * now);
  64 
  65 gboolean pe_test_expression_re(xmlNode * expr, GHashTable * node_hash,
  66                          enum rsc_role_e role, crm_time_t * now, pe_re_match_data_t * re_match_data);
  67 
  68 gboolean pe_test_expression_full(xmlNode * expr, GHashTable * node_hash,
  69                          enum rsc_role_e role, crm_time_t * now, pe_match_data_t * match_data);
  70 
  71 void unpack_instance_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name,
  72                                 GHashTable * node_hash, GHashTable * hash,
  73                                 const char *always_first, gboolean overwrite, crm_time_t * now);
  74 
  75 #ifdef ENABLE_VERSIONED_ATTRS
  76 void pe_unpack_versioned_attributes(xmlNode * top, xmlNode * xml_obj, const char *set_name,
  77                                     GHashTable * node_hash, xmlNode * hash, crm_time_t * now);
  78 GHashTable *pe_unpack_versioned_parameters(xmlNode *versioned_params, const char *ra_version);
  79 #endif
  80 
  81 char *pe_expand_re_matches(const char *string, pe_re_match_data_t * match_data);
  82 
  83 
  84 #endif

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