10 #ifndef CRM_COMMON_UTIL__H
11 # define CRM_COMMON_UTIL__H
23 # include <sys/types.h>
31 # include <libxml/tree.h>
38 # define ONLINESTATUS "online" // Status of an online client
39 # define OFFLINESTATUS "offline" // Status of an offline client
60 gboolean
parse_op_key(const
char *key,
char **rsc_id,
char **op_type,
63 int *action_id,
int *target_rc);
65 int *transition_id,
int *action_id,
66 int *
op_status,
int *op_rc,
int *target_rc);
71 const
char *task, const
char *interval_spec,
73 #define CRM_DEFAULT_OP_TIMEOUT_S "20s"
78 void crm_abort(
const char *file,
const char *
function,
int line,
79 const char *condition, gboolean do_core, gboolean do_fork);
91 pcmk_any_flags_set(uint64_t flag_group, uint64_t flags_to_check)
93 return (flag_group & flags_to_check) != 0;
106 pcmk_all_flags_set(uint64_t flag_group, uint64_t flags_to_check)
108 return (flag_group & flags_to_check) == flags_to_check;
114 #define pcmk_is_set(g, f) pcmk_all_flags_set((g), (f))
129 #ifdef HAVE_GNUTLS_GNUTLS_H
130 void crm_gnutls_global_init(
void);
138 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
API related to resource agents.
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
xmlNode * crm_create_op_xml(xmlNode *parent, const char *prefix, const char *task, const char *interval_spec, const char *timeout)
Create a CIB XML element for an operation.
bool crm_is_daemon_name(const char *name)
Check whether string represents a client name used by cluster daemons.
char * crm_generate_uuid(void)
int rsc_op_expected_rc(lrmd_event_data_t *event)
int char2score(const char *score)
long long crm_get_msec(const char *input)
Parse a time+units string and return milliseconds equivalent.
char * score2char_stack(int score, char *buf, size_t len)
const char * crm_meta_value(GHashTable *hash, const char *field)
bool crm_op_needs_metadata(const char *rsc_class, const char *op)
Check whether an operation requires resource agent meta-data.
char * pcmk_promotion_score_name(const char *rsc_id)
Return the name of the node attribute used as a promotion score.
int crm_user_lookup(const char *name, uid_t *uid, gid_t *gid)
int pcmk_daemon_user(uid_t *uid, gid_t *gid)
Get user and group IDs of pacemaker daemon user.
char * crm_meta_name(const char *field)
Low-level API for XML Access Control Lists (ACLs)
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
bool pcmk_str_is_infinity(const char *s)
Function and executable result codes.
int crm_str_to_boolean(const char *s, int *ret)
gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc)
bool pcmk_str_is_minus_infinity(const char *s)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
gboolean decode_transition_key(const char *key, char **uuid, int *transition_id, int *action_id, int *target_rc)
Parse a transition key into its constituent parts.
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)
Parse a transition magic string into its constituent parts.
char * crm_md5sum(const char *buffer)
gboolean crm_is_true(const char *s)
char * pcmk_hostname(void)
Get the local hostname.
char * crm_strip_trailing_newline(char *str)
void crm_abort(const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork)
Deprecated Pacemaker utilities.
int crm_default_remote_port(void)
Get the default remote connection TCP port on this host.
char * score2char(int score)