8 #ifndef CRM_INTERNAL__H 9 # define CRM_INTERNAL__H 16 # include <libxml/tree.h> 32 static inline gboolean
33 is_privileged(
const char *user)
39 }
else if (strcmp(user,
"root") == 0) {
50 # define no_argument 0 51 # define required_argument 1 54 # define pcmk_option_default 0x00000 55 # define pcmk_option_hidden 0x00001 56 # define pcmk_option_paragraph 0x00002 57 # define pcmk_option_example 0x00004 79 const char *app_desc);
92 gboolean(*is_valid) (
const char *);
99 const char *
cluster_option(GHashTable * options, gboolean(*validate) (
const char *),
100 const char *
name,
const char *old_name,
const char *def_value);
131 #define CRM_OP_FMT "%s_%s_%u" 133 static inline long long 134 crm_clear_bit(
const char *
function,
int line,
const char *target,
long long word,
long long bit)
136 long long rc = (word & ~bit);
141 crm_trace(
"Bit 0x%.8llx for %s cleared by %s:%d", bit, target,
function, line);
143 crm_trace(
"Bit 0x%.8llx cleared by %s:%d", bit,
function, line);
149 static inline long long 150 crm_set_bit(
const char *
function,
int line,
const char *target,
long long word,
long long bit)
152 long long rc = (word | bit);
157 crm_trace(
"Bit 0x%.8llx for %s set by %s:%d", bit, target,
function, line);
159 crm_trace(
"Bit 0x%.8llx set by %s:%d", bit,
function, line);
165 # define set_bit(word, bit) word = crm_set_bit(__FUNCTION__, __LINE__, NULL, word, bit) 166 # define clear_bit(word, bit) word = crm_clear_bit(__FUNCTION__, __LINE__, NULL, word, bit) 177 # define crm_config_err(fmt...) { crm_config_error = TRUE; crm_err(fmt); } 178 # define crm_config_warn(fmt...) { crm_config_warning = TRUE; crm_warn(fmt); } 180 # define F_ATTRD_KEY "attr_key" 181 # define F_ATTRD_ATTRIBUTE "attr_name" 182 # define F_ATTRD_REGEX "attr_regex" 183 # define F_ATTRD_TASK "task" 184 # define F_ATTRD_VALUE "attr_value" 185 # define F_ATTRD_SET "attr_set" 186 # define F_ATTRD_IS_REMOTE "attr_is_remote" 187 # define F_ATTRD_IS_PRIVATE "attr_is_private" 188 # define F_ATTRD_SECTION "attr_section" 189 # define F_ATTRD_DAMPEN "attr_dampening" 190 # define F_ATTRD_HOST "attr_host" 191 # define F_ATTRD_HOST_ID "attr_host_id" 192 # define F_ATTRD_USER "attr_user" 193 # define F_ATTRD_WRITER "attr_writer" 194 # define F_ATTRD_VERSION "attr_version" 195 # define F_ATTRD_RESOURCE "attr_resource" 196 # define F_ATTRD_OPERATION "attr_clear_operation" 197 # define F_ATTRD_INTERVAL "attr_clear_interval" 198 # define F_ATTRD_IS_FORCE_WRITE "attrd_is_force_write" 201 # define ATTRD_OP_PEER_REMOVE "peer-remove" 202 # define ATTRD_OP_UPDATE "update" 203 # define ATTRD_OP_UPDATE_BOTH "update-both" 204 # define ATTRD_OP_UPDATE_DELAY "update-delay" 205 # define ATTRD_OP_QUERY "query" 206 # define ATTRD_OP_REFRESH "refresh" 207 # define ATTRD_OP_FLUSH "flush" 208 # define ATTRD_OP_SYNC "sync" 209 # define ATTRD_OP_SYNC_RESPONSE "sync-response" 210 # define ATTRD_OP_CLEAR_FAILURE "clear-failure" 212 # define PCMK_ENV_PHYSICAL_HOST "physical_host" 215 # if SUPPORT_COROSYNC 216 # include <qb/qbipc_common.h> 217 # include <corosync/corotypes.h> 243 qb_ipcs_service_t **ipcs_rw,
244 qb_ipcs_service_t **ipcs_shm,
245 struct qb_ipcs_service_handlers *ro_cb,
246 struct qb_ipcs_service_handlers *rw_cb);
249 qb_ipcs_service_t *ipcs_rw,
250 qb_ipcs_service_t *ipcs_shm);
252 static inline void *realloc_safe(
void *ptr,
size_t size)
254 void *ret = realloc(ptr, size);
265 void crm_xml_dump(xmlNode *
data,
int options,
char **buffer,
int *offset,
int *max,
int depth);
289 const char *node_name,
const char *session_id,
const char *channel);
void remote_proxy_relay_response(remote_proxy_t *proxy, xmlNode *msg, int msg_id)
gboolean daemon_option_enabled(const char *daemon, const char *option)
int remote_proxy_dispatch(const char *buffer, ssize_t length, gpointer userdata)
char * crm_compat_realpath(const char *path)
void * find_library_function(void **handle, const char *lib, const char *fn, int fatal)
long crm_get_sbd_timeout(void)
void crm_buffer_add_char(char **buffer, int *offset, int *max, char c)
gboolean check_sbd_timeout(const char *value)
struct pe_cluster_option_s pe_cluster_option
void crm_make_daemon(const char *name, gboolean daemonize, const char *pidfile)
struct mainloop_io_s mainloop_io_t
void stonith_ipc_server_init(qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
void remote_proxy_relay_event(remote_proxy_t *proxy, xmlNode *msg)
void remote_proxy_ack_shutdown(lrmd_t *lrmd)
Send an acknowledgment of a remote proxy shutdown request.
gboolean crm_digest_verify(xmlNode *input, const char *expected)
enum crm_exit_e crm_exit_t
void crm_set_options(const char *short_options, const char *usage, struct crm_option *long_options, const char *app_desc)
gboolean check_number(const char *value)
Wrappers for and extensions to libqb logging.
void cib_ipc_servers_init(qb_ipcs_service_t **ipcs_ro, qb_ipcs_service_t **ipcs_rw, qb_ipcs_service_t **ipcs_shm, struct qb_ipcs_service_handlers *ro_cb, struct qb_ipcs_service_handlers *rw_cb)
long crm_auto_watchdog_timeout(void)
void config_metadata(const char *name, const char *version, const char *desc_short, const char *desc_long, pe_cluster_option *option_list, int len)
int daemon(int nochdir, int noclose)
const char * default_value
struct crm_ipc_s crm_ipc_t
int remote_proxy_check(lrmd_t *lrmd, GHashTable *hash)
void remote_proxy_cb(lrmd_t *lrmd, const char *node_name, xmlNode *msg)
remote_proxy_t * remote_proxy_new(lrmd_t *lrmd, struct ipc_client_callbacks *proxy_callbacks, const char *node_name, const char *session_id, const char *channel)
gboolean check_quorum(const char *value)
#define crm_trace(fmt, args...)
void pcmk_panic(const char *origin)
void cib_ipc_servers_destroy(qb_ipcs_service_t *ipcs_ro, qb_ipcs_service_t *ipcs_rw, qb_ipcs_service_t *ipcs_shm)
gboolean check_positive_number(const char *value)
gboolean check_time(const char *value)
struct qb_ipc_response_header cs_ipc_header_response_t
gboolean check_boolean(const char *value)
const char * description_long
int crm_get_option_long(int argc, char **argv, int *index, const char **longname)
void remote_proxy_disconnected(gpointer data)
struct remote_proxy_s remote_proxy_t
crm_exit_t crm_help(char cmd, crm_exit_t exit_code)
void remote_proxy_nack_shutdown(lrmd_t *lrmd)
We're not going to shutdown as response to a remote proxy shutdown request.
const char * daemon_option(const char *option)
void attrd_ipc_server_init(qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
qb_ipcs_service_t * crmd_ipc_server_init(struct qb_ipcs_service_handlers *cb)
const char * cluster_option(GHashTable *options, gboolean(*validate)(const char *), const char *name, const char *old_name, const char *def_value)
const char * description_short
gboolean check_script(const char *value)
void remote_proxy_free(gpointer data)
void set_daemon_option(const char *option, const char *value)
gboolean check_utilization(const char *value)
void verify_all_options(GHashTable *options, pe_cluster_option *option_list, int len)
void strip_text_nodes(xmlNode *xml)
char * generate_hash_key(const char *crm_msg_reference, const char *sys)
const char * crm_acl_get_set_user(xmlNode *request, const char *field, const char *peer_user)
pid_t pcmk_locate_sbd(void)
gboolean check_timer(const char *value)
int crm_get_option(int argc, char **argv, int *index)
const char * get_cluster_pref(GHashTable *options, pe_cluster_option *option_list, int len, const char *name)
const char * crm_xml_add_last_written(xmlNode *xml_node)
char * uid2username(uid_t uid)
enum crm_proc_flag __attribute__
struct qb_ipc_request_header cs_ipc_header_request_t
void crm_xml_dump(xmlNode *data, int options, char **buffer, int *offset, int *max, int depth)