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