pacemaker  3.0.0-d8340737c4
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 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, 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 pcmk__node_status_t *node, enum pcmk_ipc_server dest)
 

Variables

uint32_t id
 
uint32_t pid
 
gboolean local
 
enum pcmk_ipc_server 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 86 of file cpg.c.

◆ CS_SEND_MAX

#define CS_SEND_MAX   200

Definition at line 196 of file cpg.c.

◆ msg_data_len

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

Definition at line 84 of file cpg.c.

Typedef Documentation

◆ pcmk__cpg_host_t

typedef struct pcmk__cpg_host_s pcmk__cpg_host_t

Definition at line 63 of file cpg.c.

◆ pcmk__cpg_msg_t

typedef struct pcmk__cpg_msg_s pcmk__cpg_msg_t

Definition at line 80 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))  )

◆ 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 640 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 781 of file cpg.c.

◆ pcmk__cpg_disconnect()

void pcmk__cpg_disconnect ( pcmk_cluster_t cluster)

Definition at line 890 of file cpg.c.

◆ pcmk__cpg_local_nodeid()

uint32_t pcmk__cpg_local_nodeid ( cpg_handle_t  handle)

Definition at line 106 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,
const char **  from 
)

Definition at line 397 of file cpg.c.

◆ pcmk__cpg_send_xml()

bool pcmk__cpg_send_xml ( const xmlNode *  msg,
const pcmk__node_status_t node,
enum pcmk_ipc_server  dest 
)

Definition at line 1042 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 764 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 746 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 pcmk_ipc_server type

Definition at line 51 of file cpg.c.

◆ uname

char uname[MAX_NAME]

Definition at line 53 of file cpg.c.