pacemaker  1.1.15-e174ec8
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Functions | Variables
crm_internal.h File Reference
#include <config.h>
#include <portability.h>
#include <glib.h>
#include <stdbool.h>
#include <libxml/tree.h>
#include <crm/lrmd.h>
#include <crm/common/logging.h>
#include <crm/common/io.h>
#include <crm/common/ipcs.h>
#include <crm/common/procfs.h>
#include <string.h>
#include <getopt.h>
#include <qb/qbipc_common.h>
#include <corosync/corotypes.h>
Include dependency graph for crm_internal.h:

Go to the source code of this file.

Data Structures

struct  crm_option
 
struct  pe_cluster_option_s
 
struct  remote_proxy_s
 

Macros

#define pcmk_option_default   0x00000
 
#define pcmk_option_hidden   0x00001
 
#define pcmk_option_paragraph   0x00002
 
#define pcmk_option_example   0x00004
 
#define set_bit(word, bit)   word = crm_set_bit(__FUNCTION__, NULL, word, bit)
 
#define clear_bit(word, bit)   word = crm_clear_bit(__FUNCTION__, NULL, word, bit)
 
#define REMOTE_MSG_TERMINATOR   "\r\n\r\n"
 
#define crm_config_err(fmt...)   { crm_config_error = TRUE; crm_err(fmt); }
 
#define crm_config_warn(fmt...)   { crm_config_warning = TRUE; crm_warn(fmt); }
 
#define attrd_channel   T_ATTRD
 
#define F_ATTRD_KEY   "attr_key"
 
#define F_ATTRD_ATTRIBUTE   "attr_name"
 
#define F_ATTRD_REGEX   "attr_regex"
 
#define F_ATTRD_TASK   "task"
 
#define F_ATTRD_VALUE   "attr_value"
 
#define F_ATTRD_SET   "attr_set"
 
#define F_ATTRD_IS_REMOTE   "attr_is_remote"
 
#define F_ATTRD_IS_PRIVATE   "attr_is_private"
 
#define F_ATTRD_SECTION   "attr_section"
 
#define F_ATTRD_DAMPEN   "attr_dampening"
 
#define F_ATTRD_IGNORE_LOCALLY   "attr_ignore_locally"
 
#define F_ATTRD_HOST   "attr_host"
 
#define F_ATTRD_HOST_ID   "attr_host_id"
 
#define F_ATTRD_USER   "attr_user"
 
#define F_ATTRD_WRITER   "attr_writer"
 
#define F_ATTRD_VERSION   "attr_version"
 
#define ATTRD_OP_PEER_REMOVE   "peer-remove"
 
#define ATTRD_OP_UPDATE   "update"
 
#define ATTRD_OP_UPDATE_BOTH   "update-both"
 
#define ATTRD_OP_UPDATE_DELAY   "update-delay"
 
#define ATTRD_OP_QUERY   "query"
 
#define ATTRD_OP_REFRESH   "refresh"
 
#define ATTRD_OP_FLUSH   "flush"
 
#define ATTRD_OP_SYNC   "sync"
 
#define ATTRD_OP_SYNC_RESPONSE   "sync-response"
 

Typedefs

typedef struct pe_cluster_option_s pe_cluster_option
 
typedef struct crm_remote_s crm_remote_t
 
typedef struct
qb_ipc_request_header 
cs_ipc_header_request_t
 
typedef struct
qb_ipc_response_header 
cs_ipc_header_response_t
 
typedef struct remote_proxy_s remote_proxy_t
 

Functions

void * find_library_function (void **handle, const char *lib, const char *fn, int fatal)
 
void * convert_const_pointer (const void *ptr)
 
char * uid2username (uid_t uid)
 
void determine_request_user (const char *user, xmlNode *request, const char *field)
 
const char * crm_acl_get_set_user (xmlNode *request, const char *field, const char *peer_user)
 
void crm_set_options (const char *short_options, const char *usage, struct crm_option *long_options, const char *app_desc)
 
int crm_get_option (int argc, char **argv, int *index)
 
int crm_get_option_long (int argc, char **argv, int *index, const char **longname)
 
int crm_help (char cmd, int exit_code)
 
const char * cluster_option (GHashTable *options, gboolean(*validate)(const char *), const char *name, const char *old_name, const char *def_value)
 
const char * get_cluster_pref (GHashTable *options, pe_cluster_option *option_list, int len, const char *name)
 
void config_metadata (const char *name, const char *version, const char *desc_short, const char *desc_long, pe_cluster_option *option_list, int len)
 
void verify_all_options (GHashTable *options, pe_cluster_option *option_list, int len)
 
gboolean check_time (const char *value)
 
gboolean check_timer (const char *value)
 
gboolean check_boolean (const char *value)
 
gboolean check_number (const char *value)
 
gboolean check_quorum (const char *value)
 
gboolean check_script (const char *value)
 
gboolean check_utilization (const char *value)
 
gboolean check_sbd_timeout (const char *value)
 
void filter_action_parameters (xmlNode *param_set, const char *version)
 
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)
 
char * add_list_element (char *list, const char *value)
 
int crm_pid_active (long pid, const char *daemon)
 
void crm_make_daemon (const char *name, gboolean daemonize, const char *pidfile)
 
char * generate_op_key (const char *rsc_id, const char *op_type, int interval)
 
char * generate_notify_key (const char *rsc_id, const char *notify_type, const char *op_type)
 
char * generate_transition_magic_v202 (const char *transition_key, int op_status)
 
char * generate_transition_magic (const char *transition_key, int op_status, int op_rc)
 
char * generate_transition_key (int action, int transition_id, int target_rc, const char *node)
 
void g_hash_destroy_str (gpointer data)
 
long long crm_int_helper (const char *text, char **end_text)
 
char * crm_concat (const char *prefix, const char *suffix, char join)
 
char * generate_hash_key (const char *crm_msg_reference, const char *sys)
 
bool crm_compress_string (const char *data, int length, int max, char **result, unsigned int *result_len)
 
int crm_remote_send (crm_remote_t *remote, xmlNode *msg)
 
int crm_remote_ready (crm_remote_t *remote, int total_timeout)
 
gboolean crm_remote_recv (crm_remote_t *remote, int total_timeout, int *disconnected)
 
xmlNode * crm_remote_parse_buffer (crm_remote_t *remote)
 
int crm_remote_tcp_connect (const char *host, int port)
 
int crm_remote_tcp_connect_async (const char *host, int port, int timeout, int *timer_id, void *userdata, void(*callback)(void *userdata, int sock))
 
int crm_initiate_client_tls_handshake (crm_remote_t *remote, int timeout_ms)
 
void * crm_create_anon_tls_session (int sock, int type, void *credentials)
 
void * create_psk_tls_session (int csock, int type, void *credentials)
 
const char * daemon_option (const char *option)
 
void set_daemon_option (const char *option, const char *value)
 
gboolean daemon_option_enabled (const char *daemon, const char *option)
 
void strip_text_nodes (xmlNode *xml)
 
void pcmk_panic (const char *origin)
 
void sysrq_init (void)
 
pid_t pcmk_locate_sbd (void)
 
long crm_pidfile_inuse (const char *filename, long mypid, const char *daemon)
 
long crm_read_pidfile (const char *filename)
 
void attrd_ipc_server_init (qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
void stonith_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)
 
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 cib_ipc_servers_destroy (qb_ipcs_service_t *ipcs_ro, qb_ipcs_service_t *ipcs_rw, qb_ipcs_service_t *ipcs_shm)
 
const char * crm_xml_add_last_written (xmlNode *xml_node)
 
void crm_xml_dump (xmlNode *data, int options, char **buffer, int *offset, int *max, int depth)
 
void crm_buffer_add_char (char **buffer, int *offset, int *max, char c)
 
gboolean crm_digest_verify (xmlNode *input, const char *expected)
 Return whether calculated digest of XML tree matches expected digest. More...
 
char * crm_compat_realpath (const char *path)
 
void remote_proxy_notify_destroy (lrmd_t *lrmd, const char *session_id)
 
void remote_proxy_ack_shutdown (lrmd_t *lrmd)
 Send an acknowledgment of a remote proxy shutdown request. More...
 
void remote_proxy_relay_event (lrmd_t *lrmd, const char *session_id, xmlNode *msg)
 
void remote_proxy_relay_response (lrmd_t *lrmd, const char *session_id, xmlNode *msg, int msg_id)
 
void remote_proxy_end_session (const char *session)
 
void remote_proxy_free (gpointer data)
 
int remote_proxy_check (lrmd_t *lrmd, GHashTable *hash)
 

Variables

int node_score_red
 
int node_score_green
 
int node_score_yellow
 
int node_score_infinity
 

Macro Definition Documentation

#define attrd_channel   T_ATTRD

Definition at line 273 of file crm_internal.h.

#define ATTRD_OP_FLUSH   "flush"

Definition at line 298 of file crm_internal.h.

#define ATTRD_OP_PEER_REMOVE   "peer-remove"

Definition at line 292 of file crm_internal.h.

#define ATTRD_OP_QUERY   "query"

Definition at line 296 of file crm_internal.h.

#define ATTRD_OP_REFRESH   "refresh"

Definition at line 297 of file crm_internal.h.

#define ATTRD_OP_SYNC   "sync"

Definition at line 299 of file crm_internal.h.

#define ATTRD_OP_SYNC_RESPONSE   "sync-response"

Definition at line 300 of file crm_internal.h.

#define ATTRD_OP_UPDATE   "update"

Definition at line 293 of file crm_internal.h.

#define ATTRD_OP_UPDATE_BOTH   "update-both"

Definition at line 294 of file crm_internal.h.

#define ATTRD_OP_UPDATE_DELAY   "update-delay"

Definition at line 295 of file crm_internal.h.

#define clear_bit (   word,
  bit 
)    word = crm_clear_bit(__FUNCTION__, NULL, word, bit)

Definition at line 200 of file crm_internal.h.

#define crm_config_err (   fmt...)    { crm_config_error = TRUE; crm_err(fmt); }

Definition at line 270 of file crm_internal.h.

#define crm_config_warn (   fmt...)    { crm_config_warning = TRUE; crm_warn(fmt); }

Definition at line 271 of file crm_internal.h.

#define F_ATTRD_ATTRIBUTE   "attr_name"

Definition at line 275 of file crm_internal.h.

#define F_ATTRD_DAMPEN   "attr_dampening"

Definition at line 283 of file crm_internal.h.

#define F_ATTRD_HOST   "attr_host"

Definition at line 285 of file crm_internal.h.

#define F_ATTRD_HOST_ID   "attr_host_id"

Definition at line 286 of file crm_internal.h.

#define F_ATTRD_IGNORE_LOCALLY   "attr_ignore_locally"

Definition at line 284 of file crm_internal.h.

#define F_ATTRD_IS_PRIVATE   "attr_is_private"

Definition at line 281 of file crm_internal.h.

#define F_ATTRD_IS_REMOTE   "attr_is_remote"

Definition at line 280 of file crm_internal.h.

#define F_ATTRD_KEY   "attr_key"

Definition at line 274 of file crm_internal.h.

#define F_ATTRD_REGEX   "attr_regex"

Definition at line 276 of file crm_internal.h.

#define F_ATTRD_SECTION   "attr_section"

Definition at line 282 of file crm_internal.h.

#define F_ATTRD_SET   "attr_set"

Definition at line 279 of file crm_internal.h.

#define F_ATTRD_TASK   "task"

Definition at line 277 of file crm_internal.h.

#define F_ATTRD_USER   "attr_user"

Definition at line 287 of file crm_internal.h.

#define F_ATTRD_VALUE   "attr_value"

Definition at line 278 of file crm_internal.h.

#define F_ATTRD_VERSION   "attr_version"

Definition at line 289 of file crm_internal.h.

#define F_ATTRD_WRITER   "attr_writer"

Definition at line 288 of file crm_internal.h.

#define pcmk_option_default   0x00000

Definition at line 71 of file crm_internal.h.

#define pcmk_option_example   0x00004

Definition at line 74 of file crm_internal.h.

#define pcmk_option_hidden   0x00001

Definition at line 72 of file crm_internal.h.

#define pcmk_option_paragraph   0x00002

Definition at line 73 of file crm_internal.h.

#define REMOTE_MSG_TERMINATOR   "\r\n\r\n"

Definition at line 258 of file crm_internal.h.

#define set_bit (   word,
  bit 
)    word = crm_set_bit(__FUNCTION__, NULL, word, bit)

Definition at line 199 of file crm_internal.h.

Typedef Documentation

typedef struct crm_remote_s crm_remote_t

remote tcp/tls helper functions

Definition at line 212 of file crm_internal.h.

typedef struct qb_ipc_request_header cs_ipc_header_request_t

Definition at line 306 of file crm_internal.h.

typedef struct qb_ipc_response_header cs_ipc_header_response_t

Definition at line 307 of file crm_internal.h.

Function Documentation

char* add_list_element ( char *  list,
const char *  value 
)

Definition at line 2331 of file utils.c.

void attrd_ipc_server_init ( qb_ipcs_service_t **  ipcs,
struct qb_ipcs_service_handlers *  cb 
)

Definition at line 1746 of file utils.c.

gboolean check_boolean ( const char *  value)

Definition at line 161 of file utils.c.

gboolean check_number ( const char *  value)

Definition at line 172 of file utils.c.

gboolean check_quorum ( const char *  value)

Definition at line 193 of file utils.c.

gboolean check_sbd_timeout ( const char *  value)

Definition at line 133 of file utils.c.

gboolean check_script ( const char *  value)

Definition at line 211 of file utils.c.

gboolean check_time ( const char *  value)

Definition at line 115 of file utils.c.

gboolean check_timer ( const char *  value)

Definition at line 124 of file utils.c.

gboolean check_utilization ( const char *  value)

Definition at line 238 of file utils.c.

void cib_ipc_servers_destroy ( qb_ipcs_service_t *  ipcs_ro,
qb_ipcs_service_t *  ipcs_rw,
qb_ipcs_service_t *  ipcs_shm 
)

Definition at line 1730 of file utils.c.

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 
)

Definition at line 1713 of file utils.c.

const char* cluster_option ( GHashTable *  options,
gboolean(*)(const char *)  validate,
const char *  name,
const char *  old_name,
const char *  def_value 
)

Definition at line 317 of file utils.c.

void config_metadata ( const char *  name,
const char *  version,
const char *  desc_short,
const char *  desc_long,
pe_cluster_option option_list,
int  len 
)

Definition at line 383 of file utils.c.

void* convert_const_pointer ( const void *  ptr)

Definition at line 2350 of file utils.c.

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 
)

Definition at line 1982 of file utils.c.

void* create_psk_tls_session ( int  csock,
int  type,
void *  credentials 
)
const char* crm_acl_get_set_user ( xmlNode *  request,
const char *  field,
const char *  peer_user 
)
void crm_buffer_add_char ( char **  buffer,
int *  offset,
int *  max,
char  c 
)

Definition at line 3964 of file xml.c.

char* crm_compat_realpath ( const char *  path)

Definition at line 40 of file compat.c.

bool crm_compress_string ( const char *  data,
int  length,
int  max,
char **  result,
unsigned int *  result_len 
)

Definition at line 2405 of file utils.c.

char* crm_concat ( const char *  prefix,
const char *  suffix,
char  join 
)

Definition at line 431 of file utils.c.

void* crm_create_anon_tls_session ( int  sock,
int  type,
void *  credentials 
)
gboolean crm_digest_verify ( xmlNode *  input,
const char *  expected 
)

Return whether calculated digest of XML tree matches expected digest.

Parameters
[in]inputRoot of XML to digest
[in]expectedExpected digest in on-disk format
Returns
TRUE if digests match, FALSE otherwise or on error

Definition at line 221 of file digest.c.

int crm_get_option ( int  argc,
char **  argv,
int *  index 
)

Definition at line 1587 of file utils.c.

int crm_get_option_long ( int  argc,
char **  argv,
int *  index,
const char **  longname 
)

Definition at line 1593 of file utils.c.

int crm_help ( char  cmd,
int  exit_code 
)

Definition at line 1638 of file utils.c.

int crm_initiate_client_tls_handshake ( crm_remote_t remote,
int  timeout_ms 
)
long long crm_int_helper ( const char *  text,
char **  end_text 
)

Definition at line 625 of file utils.c.

void crm_make_daemon ( const char *  name,
gboolean  daemonize,
const char *  pidfile 
)

Definition at line 1378 of file utils.c.

int crm_pid_active ( long  pid,
const char *  daemon 
)

Definition at line 1216 of file utils.c.

long crm_pidfile_inuse ( const char *  filename,
long  mypid,
const char *  daemon 
)

Definition at line 1316 of file utils.c.

long crm_read_pidfile ( const char *  filename)

Definition at line 1279 of file utils.c.

xmlNode* crm_remote_parse_buffer ( crm_remote_t remote)

Definition at line 379 of file remote.c.

int crm_remote_ready ( crm_remote_t remote,
int  total_timeout 
)

Definition at line 449 of file remote.c.

gboolean crm_remote_recv ( crm_remote_t remote,
int  total_timeout,
int *  disconnected 
)

Definition at line 607 of file remote.c.

int crm_remote_send ( crm_remote_t remote,
xmlNode *  msg 
)

Definition at line 331 of file remote.c.

int crm_remote_tcp_connect ( const char *  host,
int  port 
)

Definition at line 927 of file remote.c.

int crm_remote_tcp_connect_async ( const char *  host,
int  port,
int  timeout,
int *  timer_id,
void *  userdata,
void(*)(void *userdata, int sock)  callback 
)

Definition at line 838 of file remote.c.

void crm_set_options ( const char *  short_options,
const char *  usage,
struct crm_option long_options,
const char *  app_desc 
)

Definition at line 1546 of file utils.c.

const char* crm_xml_add_last_written ( xmlNode *  xml_node)

Definition at line 3216 of file xml.c.

void crm_xml_dump ( xmlNode *  data,
int  options,
char **  buffer,
int *  offset,
int *  max,
int  depth 
)

Definition at line 3861 of file xml.c.

qb_ipcs_service_t* crmd_ipc_server_init ( struct qb_ipcs_service_handlers *  cb)

Definition at line 1740 of file utils.c.

const char* daemon_option ( const char *  option)

Definition at line 117 of file logging.c.

gboolean daemon_option_enabled ( const char *  daemon,
const char *  option 
)

Definition at line 165 of file logging.c.

void determine_request_user ( const char *  user,
xmlNode *  request,
const char *  field 
)
void filter_action_parameters ( xmlNode *  param_set,
const char *  version 
)

Definition at line 1085 of file utils.c.

void* find_library_function ( void **  handle,
const char *  lib,
const char *  fn,
int  fatal 
)
void g_hash_destroy_str ( gpointer  data)

Definition at line 615 of file utils.c.

char* generate_hash_key ( const char *  crm_msg_reference,
const char *  sys 
)

Definition at line 449 of file utils.c.

char* generate_notify_key ( const char *  rsc_id,
const char *  notify_type,
const char *  op_type 
)

Definition at line 920 of file utils.c.

char* generate_op_key ( const char *  rsc_id,
const char *  op_type,
int  interval 
)

Definition at line 831 of file utils.c.

char* generate_transition_key ( int  action,
int  transition_id,
int  target_rc,
const char *  node 
)

Definition at line 1002 of file utils.c.

char* generate_transition_magic ( const char *  transition_key,
int  op_status,
int  op_rc 
)

Definition at line 959 of file utils.c.

char* generate_transition_magic_v202 ( const char *  transition_key,
int  op_status 
)

Definition at line 942 of file utils.c.

const char* get_cluster_pref ( GHashTable *  options,
pe_cluster_option option_list,
int  len,
const char *  name 
)

Definition at line 363 of file utils.c.

pid_t pcmk_locate_sbd ( void  )

Definition at line 215 of file watchdog.c.

void pcmk_panic ( const char *  origin)

Definition at line 184 of file watchdog.c.

void remote_proxy_ack_shutdown ( lrmd_t lrmd)

Send an acknowledgment of a remote proxy shutdown request.

Parameters
[in]lrmdConnection to proxy

Definition at line 54 of file proxy_common.c.

int remote_proxy_check ( lrmd_t lrmd,
GHashTable *  hash 
)

Definition at line 885 of file lrmd_client.c.

void remote_proxy_end_session ( const char *  session)

Definition at line 89 of file proxy_common.c.

void remote_proxy_free ( gpointer  data)

Definition at line 104 of file proxy_common.c.

void remote_proxy_notify_destroy ( lrmd_t lrmd,
const char *  session_id 
)

Definition at line 38 of file proxy_common.c.

void remote_proxy_relay_event ( lrmd_t lrmd,
const char *  session_id,
xmlNode *  msg 
)

Definition at line 63 of file proxy_common.c.

void remote_proxy_relay_response ( lrmd_t lrmd,
const char *  session_id,
xmlNode *  msg,
int  msg_id 
)

Definition at line 76 of file proxy_common.c.

void set_daemon_option ( const char *  option,
const char *  value 
)

Definition at line 141 of file logging.c.

void stonith_ipc_server_init ( qb_ipcs_service_t **  ipcs,
struct qb_ipcs_service_handlers *  cb 
)

Definition at line 1758 of file utils.c.

void strip_text_nodes ( xmlNode *  xml)

Definition at line 3115 of file xml.c.

void sysrq_init ( void  )

Definition at line 49 of file watchdog.c.

char* uid2username ( uid_t  uid)
void verify_all_options ( GHashTable *  options,
pe_cluster_option option_list,
int  len 
)

Definition at line 418 of file utils.c.

Variable Documentation

int node_score_green

Definition at line 77 of file utils.c.

int node_score_infinity

Definition at line 79 of file utils.c.

int node_score_red

Definition at line 76 of file utils.c.

int node_score_yellow

Definition at line 78 of file utils.c.