1 /*
2 * Copyright 2022-2024 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__PCMKI_PCMKI_RULE__H
11 #define PCMK__PCMKI_PCMKI_RULE__H
12
13 #include <crm/crm.h>
14 #include <crm/common/iso8601.h>
15 #include <crm/common/output_internal.h>
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 int pcmk__check_rules(pcmk__output_t *out, xmlNodePtr input,
22 const crm_time_t *date_time, const char **rule_ids);
23
24 /*!
25 * \internal
26 * \brief Check whether a given rule is in effect
27 *
28 * \param[in,out] out Output object
29 * \param[in] input The CIB XML to check (if \c NULL, use current CIB)
30 * \param[in] date Check whether the rule is in effect at this date and
31 * time (if \c NULL, use current date and time)
32 * \param[in] rule_ids The ID of the rule to check
33 *
34 * \return Standard Pacemaker return code
35 */
36 static inline int
37 pcmk__check_rule(pcmk__output_t *out, xmlNodePtr input, const crm_time_t *date,
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
38 const char *rule_id)
39 {
40 const char *rule_ids[] = {rule_id, NULL};
41 return pcmk__check_rules(out, input, date, rule_ids);
42 }
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif // PCMK__PCMKI_PCMKI_RULE__H