18 #ifndef CRM_COMMON_UTIL__H 19 # define CRM_COMMON_UTIL__H 27 # include <sys/types.h> 31 # include <sysexits.h> 35 # if SUPPORT_HEARTBEAT 36 # include <heartbeat.h> 38 # define NORMALNODE "normal" 39 # define ACTIVESTATUS "active" 40 # define DEADSTATUS "dead" 42 # define PINGSTATUS "ping" 44 # define JOINSTATUS "join" 46 # define LEAVESTATUS "leave" 48 # define ONLINESTATUS "online" 49 # define OFFLINESTATUS "offline" 58 int crm_parse_int(
const char *text,
const char *default_text);
60 gboolean
crm_str_eq(
const char *a,
const char *b, gboolean use_case);
63 # define safe_str_eq(a, b) crm_str_eq(a, b, FALSE) 66 static inline gboolean
67 crm_strcase_equal(gconstpointer a, gconstpointer b)
69 return crm_str_eq((
const char *) a, (
const char *) b, FALSE);
72 # define crm_atoi(text, default_text) crm_parse_int(text, default_text) 85 gboolean
parse_op_key(
const char *key,
char **rsc_id,
char **op_type,
int *interval);
89 int *
op_status,
int *op_rc,
int *target_rc);
91 void crm_abort(
const char *file,
const char *
function,
int line,
92 const char *condition, gboolean do_core, gboolean do_fork);
94 static inline gboolean
95 is_not_set(
long long word,
long long bit)
97 return ((word & bit) == 0);
100 static inline gboolean
101 is_set(
long long word,
long long bit)
103 return ((word & bit) == bit);
106 static inline gboolean
107 is_set_any(
long long word,
long long bit)
109 return ((word & bit) != 0);
113 crm_hash_table_size(GHashTable * hashtable)
115 if (hashtable == NULL) {
118 return g_hash_table_size(hashtable);
133 #ifdef HAVE_GNUTLS_GNUTLS_H 134 void crm_gnutls_global_init(
void);
gboolean safe_str_neq(const char *a, const char *b)
char * crm_generate_uuid(void)
void crm_build_path(const char *path_c, mode_t mode)
Create a directory, including any parent directories needed.
int rsc_op_expected_rc(lrmd_event_data_t *event)
int char2score(const char *score)
long long crm_get_msec(const char *input)
char * score2char_stack(int score, char *buf, size_t len)
const char * crm_meta_value(GHashTable *hash, const char *field)
int crm_parse_int(const char *text, const char *default_text)
int crm_user_lookup(const char *name, uid_t *uid, gid_t *gid)
char * crm_meta_name(const char *field)
gboolean decode_transition_key(const char *key, char **uuid, int *action, int *transition_id, int *target_rc)
bool pcmk_acl_required(const char *user)
unsigned long long crm_get_interval(const char *input)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
char * crm_itoa_stack(int an_int, char *buf, size_t len)
int crm_str_to_boolean(const char *s, int *ret)
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, int *interval)
gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc)
int compare_version(const char *version1, const char *version2)
gboolean decode_transition_magic(const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc)
char * crm_md5sum(const char *buffer)
gboolean crm_is_true(const char *s)
char * crm_strip_trailing_newline(char *str)
char * crm_itoa(int an_int)
void crm_abort(const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork)
char * score2char(int score)