18 #ifndef CRM_COMMON_UTIL__H 19 # define CRM_COMMON_UTIL__H 27 # include <sys/types.h> 32 # include <sysexits.h> 36 # if SUPPORT_HEARTBEAT 37 # include <heartbeat.h> 39 # define NORMALNODE "normal" 40 # define ACTIVESTATUS "active" 41 # define DEADSTATUS "dead" 43 # define PINGSTATUS "ping" 45 # define JOINSTATUS "join" 47 # define LEAVESTATUS "leave" 49 # define ONLINESTATUS "online" 50 # define OFFLINESTATUS "offline" 59 int crm_parse_int(
const char *text,
const char *default_text);
61 gboolean
crm_str_eq(
const char *a,
const char *b, gboolean use_case);
64 # define safe_str_eq(a, b) crm_str_eq(a, b, FALSE) 67 static inline gboolean
68 crm_strcase_equal(gconstpointer a, gconstpointer b)
70 return crm_str_eq((
const char *) a, (
const char *) b, FALSE);
73 # define crm_atoi(text, default_text) crm_parse_int(text, default_text) 86 gboolean
parse_op_key(
const char *key,
char **rsc_id,
char **op_type,
int *interval);
90 int *
op_status,
int *op_rc,
int *target_rc);
92 void crm_abort(
const char *file,
const char *
function,
int line,
93 const char *condition, gboolean do_core, gboolean do_fork);
95 static inline gboolean
96 is_not_set(
long long word,
long long bit)
98 return ((word & bit) == 0);
101 static inline gboolean
102 is_set(
long long word,
long long bit)
104 return ((word & bit) == bit);
107 static inline gboolean
108 is_set_any(
long long word,
long long bit)
110 return ((word & bit) != 0);
114 crm_hash_table_size(GHashTable * hashtable)
116 if (hashtable == NULL) {
119 return g_hash_table_size(hashtable);
135 #ifdef HAVE_GNUTLS_GNUTLS_H 136 void crm_gnutls_global_init(
void);
bool crm_is_daemon_name(const char *name)
Check whether a string represents a cluster daemon name.
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)