This source file includes following definitions.
- pcmk_any_flags_set
- pcmk_all_flags_set
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_COMMON_UTIL__H
11 # define PCMK__CRM_COMMON_UTIL__H
12
13 # include <sys/types.h>
14 # include <stdlib.h>
15 # include <stdbool.h>
16 # include <stdint.h>
17 # include <limits.h>
18 # include <signal.h>
19 # include <glib.h>
20
21 # include <libxml/tree.h>
22
23 # include <crm/lrmd.h>
24 # include <crm/common/acl.h>
25 # include <crm/common/agents.h>
26 # include <crm/common/results.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33
34
35
36
37
38
39 # define ONLINESTATUS "online"
40 # define OFFLINESTATUS "offline"
41
42
43 char *pcmk_promotion_score_name(const char *rsc_id);
44
45
46 int crm_default_remote_port(void);
47
48
49 const char *pcmk_readable_score(int score);
50 int char2score(const char *score);
51 int pcmk__add_scores(int score1, int score2);
52
53
54 gboolean crm_is_true(const char *s);
55 int crm_str_to_boolean(const char *s, int *ret);
56 long long crm_get_msec(const char *input);
57 char * crm_strip_trailing_newline(char *str);
58 char *crm_strdup_printf(char const *format, ...) G_GNUC_PRINTF(1, 2);
59
60 guint crm_parse_interval_spec(const char *input);
61
62
63 gboolean parse_op_key(const char *key, char **rsc_id, char **op_type,
64 guint *interval_ms);
65 gboolean decode_transition_key(const char *key, char **uuid, int *transition_id,
66 int *action_id, int *target_rc);
67 gboolean decode_transition_magic(const char *magic, char **uuid,
68 int *transition_id, int *action_id,
69 int *op_status, int *op_rc, int *target_rc);
70 int rsc_op_expected_rc(const lrmd_event_data_t *event);
71 gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc);
72 bool crm_op_needs_metadata(const char *rsc_class, const char *op);
73 xmlNode *crm_create_op_xml(xmlNode *parent, const char *prefix,
74 const char *task, const char *interval_spec,
75 const char *timeout);
76 #define CRM_DEFAULT_OP_TIMEOUT_S "20s"
77
78 bool pcmk_is_probe(const char *task, guint interval);
79 bool pcmk_xe_is_probe(const xmlNode *xml_op);
80 bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op);
81
82 int compare_version(const char *version1, const char *version2);
83
84
85 void crm_abort(const char *file, const char *function, int line,
86 const char *condition, gboolean do_core, gboolean do_fork);
87
88
89
90
91
92
93
94
95
96
97 static inline bool
98 pcmk_any_flags_set(uint64_t flag_group, uint64_t flags_to_check)
99 {
100 return (flag_group & flags_to_check) != 0;
101 }
102
103
104
105
106
107
108
109
110
111
112 static inline bool
113 pcmk_all_flags_set(uint64_t flag_group, uint64_t flags_to_check)
114 {
115 return (flag_group & flags_to_check) == flags_to_check;
116 }
117
118
119
120
121 #define pcmk_is_set(g, f) pcmk_all_flags_set((g), (f))
122
123 char *crm_meta_name(const char *field);
124 const char *crm_meta_value(GHashTable * hash, const char *field);
125
126 char *crm_md5sum(const char *buffer);
127
128 char *crm_generate_uuid(void);
129
130
131 bool crm_is_daemon_name(const char *name);
132
133 int crm_user_lookup(const char *name, uid_t * uid, gid_t * gid);
134 int pcmk_daemon_user(uid_t *uid, gid_t *gid);
135
136 #ifdef HAVE_GNUTLS_GNUTLS_H
137 void crm_gnutls_global_init(void);
138 #endif
139
140 char *pcmk_hostname(void);
141
142 bool pcmk_str_is_infinity(const char *s);
143 bool pcmk_str_is_minus_infinity(const char *s);
144
145 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
146 #include <crm/common/util_compat.h>
147 #endif
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif