pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
Macros | Typedefs | Functions | Variables
cpg.c File Reference
#include <crm_internal.h>
#include <arpa/inet.h>
#include <inttypes.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <bzlib.h>
#include <corosync/corodefs.h>
#include <corosync/corotypes.h>
#include <corosync/hdb.h>
#include <corosync/cpg.h>
#include <qb/qbipc_common.h>
#include <qb/qbipcc.h>
#include <qb/qbutil.h>
#include <crm/cluster/internal.h>
#include <crm/common/ipc.h>
#include <crm/common/ipc_internal.h>
#include <crm/common/mainloop.h>
#include <crm/common/xml.h>
#include "crmcluster_private.h"
#include <crm/cluster/compat.h>
Include dependency graph for cpg.c:

Go to the source code of this file.

Macros

#define msg_data_len(msg)   (msg->is_compressed?msg->compressed_size:msg->size)
 
#define cs_repeat(rc, counter, max, code)
 
#define CS_SEND_MAX   200
 

Typedefs

typedef struct pcmk__cpg_host_s pcmk__cpg_host_t
 
typedef struct pcmk__cpg_msg_s pcmk__cpg_msg_t
 

Functions

struct pcmk__cpg_host_s __attribute__ ((packed))
 
struct qb_ipc_response_header header __attribute__ ((aligned(8)))
 
uint32_t pcmk__cpg_local_nodeid (cpg_handle_t handle)
 
char * pcmk__cpg_message_data (cpg_handle_t handle, uint32_t sender_id, uint32_t pid, void *content, uint32_t *kind, const char **from)
 
void pcmk__cpg_confchg_cb (cpg_handle_t handle, const struct cpg_name *group_name, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries)
 
int pcmk_cpg_set_deliver_fn (pcmk_cluster_t *cluster, cpg_deliver_fn_t fn)
 Set the CPG deliver callback function for a cluster object. More...
 
int pcmk_cpg_set_confchg_fn (pcmk_cluster_t *cluster, cpg_confchg_fn_t fn)
 Set the CPG config change callback function for a cluster object. More...
 
int pcmk__cpg_connect (pcmk_cluster_t *cluster)
 Connect to Corosync CPG. More...
 
void pcmk__cpg_disconnect (pcmk_cluster_t *cluster)
 
bool pcmk__cpg_send_xml (const xmlNode *msg, const crm_node_t *node, enum crm_ais_msg_types dest)
 
gboolean cluster_connect_cpg (pcmk_cluster_t *cluster)
 
void cluster_disconnect_cpg (pcmk_cluster_t *cluster)
 
uint32_t get_local_nodeid (cpg_handle_t handle)
 
void pcmk_cpg_membership (cpg_handle_t handle, const struct cpg_name *group_name, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries)
 
gboolean send_cluster_text (enum crm_ais_msg_class msg_class, const char *data, gboolean local, const crm_node_t *node, enum crm_ais_msg_types dest)
 
char * pcmk_message_common_cs (cpg_handle_t handle, uint32_t nodeid, uint32_t pid, void *content, uint32_t *kind, const char **from)
 
enum crm_ais_msg_types text2msg_type (const char *text)
 

Variables

uint32_t id
 
uint32_t pid
 
gboolean local
 
enum crm_ais_msg_types type
 
uint32_t size
 
char uname [MAX_NAME]
 
gboolean is_compressed
 
pcmk__cpg_host_t host
 
pcmk__cpg_host_t sender
 
uint32_t compressed_size
 
char data [0]
 

Macro Definition Documentation

◆ cs_repeat

#define cs_repeat (   rc,
  counter,
  max,
  code 
)
Value:
do { \
rc = code; \
if ((rc == CS_ERR_TRY_AGAIN) || (rc == CS_ERR_QUEUE_FULL)) { \
counter++; \
crm_debug("Retrying operation after %ds", counter); \
sleep(counter); \
} else { \
break; \
} \
} while (counter < max)

Definition at line 81 of file cpg.c.

◆ CS_SEND_MAX

#define CS_SEND_MAX   200

Definition at line 191 of file cpg.c.

◆ msg_data_len

#define msg_data_len (   msg)    (msg->is_compressed?msg->compressed_size:msg->size)

Definition at line 79 of file cpg.c.

Typedef Documentation

◆ pcmk__cpg_host_t

typedef struct pcmk__cpg_host_s pcmk__cpg_host_t

Definition at line 58 of file cpg.c.

◆ pcmk__cpg_msg_t

typedef struct pcmk__cpg_msg_s pcmk__cpg_msg_t

Definition at line 75 of file cpg.c.

Function Documentation

◆ __attribute__() [1/2]

struct pcmk__cpg_host_s __attribute__ ( (packed)  )

◆ __attribute__() [2/2]

struct qb_ipc_response_header header __attribute__::__attribute__ ( (aligned(8))  )

◆ cluster_connect_cpg()

gboolean cluster_connect_cpg ( pcmk_cluster_t cluster)

Definition at line 1110 of file cpg.c.

◆ cluster_disconnect_cpg()

void cluster_disconnect_cpg ( pcmk_cluster_t cluster)

Definition at line 1116 of file cpg.c.

◆ get_local_nodeid()

uint32_t get_local_nodeid ( cpg_handle_t  handle)

Definition at line 1122 of file cpg.c.

◆ pcmk__cpg_confchg_cb()

void pcmk__cpg_confchg_cb ( cpg_handle_t  handle,
const struct cpg_name *  group_name,
const struct cpg_address *  member_list,
size_t  member_list_entries,
const struct cpg_address *  left_list,
size_t  left_list_entries,
const struct cpg_address *  joined_list,
size_t  joined_list_entries 
)

Definition at line 689 of file cpg.c.

◆ pcmk__cpg_connect()

int pcmk__cpg_connect ( pcmk_cluster_t cluster)

Connect to Corosync CPG.

Parameters
[in,out]clusterInitialized cluster object to connect
Returns
Standard Pacemaker return code

Definition at line 829 of file cpg.c.

◆ pcmk__cpg_disconnect()

void pcmk__cpg_disconnect ( pcmk_cluster_t cluster)

Definition at line 933 of file cpg.c.

◆ pcmk__cpg_local_nodeid()

uint32_t pcmk__cpg_local_nodeid ( cpg_handle_t  handle)

Definition at line 101 of file cpg.c.

◆ pcmk__cpg_message_data()

char* pcmk__cpg_message_data ( cpg_handle_t  handle,
uint32_t  sender_id,
uint32_t  pid,
void *  content,
uint32_t *  kind,
const char **  from 
)

Definition at line 432 of file cpg.c.

◆ pcmk__cpg_send_xml()

bool pcmk__cpg_send_xml ( const xmlNode *  msg,
const crm_node_t node,
enum crm_ais_msg_types  dest 
)

Definition at line 1091 of file cpg.c.

◆ pcmk_cpg_membership()

void pcmk_cpg_membership ( cpg_handle_t  handle,
const struct cpg_name *  group_name,
const struct cpg_address *  member_list,
size_t  member_list_entries,
const struct cpg_address *  left_list,
size_t  left_list_entries,
const struct cpg_address *  joined_list,
size_t  joined_list_entries 
)

Definition at line 1128 of file cpg.c.

◆ pcmk_cpg_set_confchg_fn()

int pcmk_cpg_set_confchg_fn ( pcmk_cluster_t cluster,
cpg_confchg_fn_t  fn 
)

Set the CPG config change callback function for a cluster object.

Parameters
[in,out]clusterCluster object
[in]fnConfiguration change callback function to set
Returns
Standard Pacemaker return code

Definition at line 812 of file cpg.c.

◆ pcmk_cpg_set_deliver_fn()

int pcmk_cpg_set_deliver_fn ( pcmk_cluster_t cluster,
cpg_deliver_fn_t  fn 
)

Set the CPG deliver callback function for a cluster object.

Parameters
[in,out]clusterCluster object
[in]fnDeliver callback function to set
Returns
Standard Pacemaker return code

Definition at line 794 of file cpg.c.

◆ pcmk_message_common_cs()

char* pcmk_message_common_cs ( cpg_handle_t  handle,
uint32_t  nodeid,
uint32_t  pid,
void *  content,
uint32_t *  kind,
const char **  from 
)

Definition at line 1157 of file cpg.c.

◆ send_cluster_text()

gboolean send_cluster_text ( enum crm_ais_msg_class  msg_class,
const char *  data,
gboolean  local,
const crm_node_t node,
enum crm_ais_msg_types  dest 
)

Definition at line 1143 of file cpg.c.

◆ text2msg_type()

enum crm_ais_msg_types text2msg_type ( const char *  text)
Deprecated:
Do not use

Definition at line 1164 of file cpg.c.

Variable Documentation

◆ compressed_size

uint32_t compressed_size

Definition at line 56 of file cpg.c.

◆ data

char data[0]

Definition at line 58 of file cpg.c.

◆ host

Definition at line 52 of file cpg.c.

◆ id

uint32_t id

Definition at line 48 of file cpg.c.

◆ is_compressed

gboolean is_compressed

Definition at line 50 of file cpg.c.

◆ local

gboolean local

Definition at line 50 of file cpg.c.

◆ pid

uint32_t pid

Definition at line 49 of file cpg.c.

◆ sender

Definition at line 53 of file cpg.c.

◆ size

uint32_t size

Definition at line 52 of file cpg.c.

◆ type

enum crm_ais_msg_types type

Definition at line 51 of file cpg.c.

◆ uname

char uname[MAX_NAME]

Definition at line 53 of file cpg.c.