22 #ifndef CRM_INTERNAL__H
23 # define CRM_INTERNAL__H
30 # include <libxml/tree.h>
48 static inline gboolean
49 is_privileged(
const char *user)
55 }
else if (strcmp(user,
"root") == 0) {
66 # define no_argument 0
67 # define required_argument 1
70 # define pcmk_option_default 0x00000
71 # define pcmk_option_hidden 0x00001
72 # define pcmk_option_paragraph 0x00002
73 # define pcmk_option_example 0x00004
95 const char *app_desc);
98 int crm_help(
char cmd,
int exit_code);
115 const char *
cluster_option(GHashTable * options, gboolean(*validate) (
const char *),
116 const char *name,
const char *old_name,
const char *def_value);
144 void crm_make_daemon(
const char *name, gboolean daemonize,
const char *pidfile);
147 char *
generate_op_key(
const char *rsc_id,
const char *op_type,
int interval);
148 char *
generate_notify_key(
const char *rsc_id,
const char *notify_type,
const char *op_type);
154 const char *caller_version,
int target_rc,
155 const char *node,
const char *origin,
158 static inline long long
159 crm_clear_bit(
const char *
function,
int line,
const char *target,
long long word,
long long bit)
161 long long rc = (word & ~bit);
166 crm_trace(
"Bit 0x%.8llx for %s cleared by %s:%d", bit, target,
function, line);
168 crm_trace(
"Bit 0x%.8llx cleared by %s:%d", bit,
function, line);
174 static inline long long
175 crm_set_bit(
const char *
function,
int line,
const char *target,
long long word,
long long bit)
177 long long rc = (word | bit);
182 crm_trace(
"Bit 0x%.8llx for %s set by %s:%d", bit, target,
function, line);
184 crm_trace(
"Bit 0x%.8llx set by %s:%d", bit,
function, line);
190 # define set_bit(word, bit) word = crm_set_bit(__FUNCTION__, __LINE__, NULL, word, bit)
191 # define clear_bit(word, bit) word = crm_clear_bit(__FUNCTION__, __LINE__, NULL, word, bit)
204 int *timer_id,
void *userdata,
void (*callback) (
void *userdata,
int sock));
208 # ifdef HAVE_GNUTLS_GNUTLS_H
244 # define REMOTE_MSG_TERMINATOR "\r\n\r\n"
256 # define crm_config_err(fmt...) { crm_config_error = TRUE; crm_err(fmt); }
257 # define crm_config_warn(fmt...) { crm_config_warning = TRUE; crm_warn(fmt); }
259 # define attrd_channel T_ATTRD
260 # define F_ATTRD_KEY "attr_key"
261 # define F_ATTRD_ATTRIBUTE "attr_name"
262 # define F_ATTRD_REGEX "attr_regex"
263 # define F_ATTRD_TASK "task"
264 # define F_ATTRD_VALUE "attr_value"
265 # define F_ATTRD_SET "attr_set"
266 # define F_ATTRD_IS_REMOTE "attr_is_remote"
267 # define F_ATTRD_IS_PRIVATE "attr_is_private"
268 # define F_ATTRD_SECTION "attr_section"
269 # define F_ATTRD_DAMPEN "attr_dampening"
270 # define F_ATTRD_IGNORE_LOCALLY "attr_ignore_locally"
271 # define F_ATTRD_HOST "attr_host"
272 # define F_ATTRD_HOST_ID "attr_host_id"
273 # define F_ATTRD_USER "attr_user"
274 # define F_ATTRD_WRITER "attr_writer"
275 # define F_ATTRD_VERSION "attr_version"
276 # define F_ATTRD_RESOURCE "attr_resource"
277 # define F_ATTRD_OPERATION "attr_clear_operation"
278 # define F_ATTRD_INTERVAL "attr_clear_interval"
281 # define ATTRD_OP_PEER_REMOVE "peer-remove"
282 # define ATTRD_OP_UPDATE "update"
283 # define ATTRD_OP_UPDATE_BOTH "update-both"
284 # define ATTRD_OP_UPDATE_DELAY "update-delay"
285 # define ATTRD_OP_QUERY "query"
286 # define ATTRD_OP_REFRESH "refresh"
287 # define ATTRD_OP_FLUSH "flush"
288 # define ATTRD_OP_SYNC "sync"
289 # define ATTRD_OP_SYNC_RESPONSE "sync-response"
290 # define ATTRD_OP_CLEAR_FAILURE "clear-failure"
292 # define PCMK_ENV_PHYSICAL_HOST "physical_host"
295 # if SUPPORT_COROSYNC
297 # include <qb/qbipc_common.h>
298 # include <corosync/corotypes.h>
302 # include <corosync/corodefs.h>
303 # include <corosync/coroipcc.h>
304 # include <corosync/coroipc_types.h>
331 qb_ipcs_service_t **ipcs_rw,
332 qb_ipcs_service_t **ipcs_shm,
333 struct qb_ipcs_service_handlers *ro_cb,
334 struct qb_ipcs_service_handlers *rw_cb);
337 qb_ipcs_service_t *ipcs_rw,
338 qb_ipcs_service_t *ipcs_shm);
340 static inline void *realloc_safe(
void *ptr,
size_t size)
342 void *ret = realloc(ptr, size);
353 void crm_xml_dump(xmlNode *
data,
int options,
char **buffer,
int *offset,
int *max,
int depth);
377 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)
char * generate_transition_magic(const char *transition_key, int op_status, int op_rc)
int remote_proxy_dispatch(const char *buffer, ssize_t length, gpointer userdata)
gboolean(* is_valid)(const char *)
char * crm_compat_realpath(const char *path)
void * find_library_function(void **handle, const char *lib, const char *fn, int fatal)
int crm_pid_active(long pid, const char *daemon)
int crm_remote_ready(crm_remote_t *remote, int total_timeout)
gboolean crm_remote_recv(crm_remote_t *remote, int total_timeout, int *disconnected)
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)
long crm_pidfile_inuse(const char *filename, long mypid, const char *daemon)
struct pe_cluster_option_s pe_cluster_option
void crm_make_daemon(const char *name, gboolean daemonize, const char *pidfile)
char * generate_transition_magic_v202(const char *transition_key, int op_status)
struct mainloop_io_s mainloop_io_t
int crm_help(char cmd, int exit_code)
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)
char * generate_notify_key(const char *rsc_id, const char *notify_type, const char *op_type)
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)
int crm_remote_accept(int ssock)
void filter_action_parameters(xmlNode *param_set, const char *version)
int crm_remote_tcp_connect(const char *host, int port)
void * convert_const_pointer(const void *ptr)
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)
void crm_sockaddr2str(void *sa, char *s)
Convert an IP address (IPv4 or IPv6) to a string for logging.
char * generate_transition_key(int action, int transition_id, int target_rc, const char *node)
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
void determine_request_user(const char *user, xmlNode *request, const char *field)
int crm_initiate_client_tls_handshake(crm_remote_t *remote, int timeout_ms)
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)
xmlNode * crm_remote_parse_buffer(crm_remote_t *remote)
gboolean check_quorum(const char *value)
#define crm_trace(fmt, args...)
enum crm_proc_flag __attribute__
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)
int crm_remote_tcp_connect_async(const char *host, int port, int timeout, int *timer_id, void *userdata, void(*callback)(void *userdata, int sock))
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
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)
xmlNode * create_operation_update(xmlNode *parent, lrmd_event_data_t *event, const char *caller_version, int target_rc, const char *node, const char *origin, int level)
void * create_psk_tls_session(int csock, int type, void *credentials)
void verify_all_options(GHashTable *options, pe_cluster_option *option_list, int len)
long crm_read_pidfile(const char *filename)
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)
char * generate_op_key(const char *rsc_id, const char *op_type, int interval)
Generate an operation key.
void * crm_create_anon_tls_session(int sock, int type, void *credentials)
const char * get_cluster_pref(GHashTable *options, pe_cluster_option *option_list, int len, const char *name)
int crm_remote_send(crm_remote_t *remote, xmlNode *msg)
const char * crm_xml_add_last_written(xmlNode *xml_node)
char * uid2username(uid_t uid)
enum crm_ais_msg_types type
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)