pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
Data Structures | Macros | Typedefs | Enumerations | Functions
ipc_internal.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <glib.h>
#include <libxml/tree.h>
#include <qb/qbipcs.h>
#include <crm_config.h>
#include <crm/common/ipc.h>
#include <crm/common/ipc_controld.h>
#include <crm/common/ipc_pacemakerd.h>
#include <crm/common/mainloop.h>
Include dependency graph for ipc_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcmk__remote_s
 
struct  pcmk__client_s
 

Macros

#define PCMK__XA_IPC_PROTO_VERSION   "ipc-protocol-version"
 
#define PCMK__SPECIAL_PID   1
 
#define PCMK__IPC_TIMEOUT   120
 
#define PCMK__SPECIAL_PID_AS_0(p)   (p)
 
#define PCMK__CLIENT_TYPE(client)   ((client)->flags & UINT64_C(0xff00000000))
 
#define pcmk__set_client_flags(client, flags_to_set)
 
#define pcmk__clear_client_flags(client, flags_to_clear)
 
#define pcmk__set_ipc_flags(ipc_flags, ipc_name, flags_to_set)
 
#define pcmk__clear_ipc_flags(ipc_flags, ipc_name, flags_to_clear)
 
#define pcmk__ipc_create_ack(flags, tag, ver, st)   pcmk__ipc_create_ack_as(__func__, __LINE__, (flags), (tag), (ver), (st))
 
#define pcmk__ipc_send_ack(c, req, flags, tag, ver, st)   pcmk__ipc_send_ack_as(__func__, __LINE__, (c), (req), (flags), (tag), (ver), (st))
 

Typedefs

typedef struct pcmk__client_s pcmk__client_t
 

Enumerations

enum  pcmk__client_flags {
  pcmk__client_ipc = (UINT64_C(1) << 32), pcmk__client_tcp = (UINT64_C(1) << 33), pcmk__client_proxied = (UINT64_C(1) << 40), pcmk__client_privileged = (UINT64_C(1) << 41),
  pcmk__client_to_proxy = (UINT64_C(1) << 42), pcmk__client_authenticated = (UINT64_C(1) << 43)
}
 

Functions

int pcmk__ipc_is_authentic_process_active (const char *name, uid_t refuid, gid_t refgid, pid_t *gotpid)
 
int pcmk__connect_generic_ipc (crm_ipc_t *ipc)
 
int pcmk__ipc_fd (crm_ipc_t *ipc, int *fd)
 
int pcmk__connect_ipc (pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type, int attempts)
 
guint pcmk__ipc_client_count (void)
 
void pcmk__foreach_ipc_client (GHFunc func, gpointer user_data)
 
void pcmk__client_cleanup (void)
 
pcmk__client_tpcmk__find_client (const qb_ipcs_connection_t *c)
 
pcmk__client_tpcmk__find_client_by_id (const char *id)
 
const char * pcmk__client_name (const pcmk__client_t *c)
 
const char * pcmk__client_type_str (uint64_t client_type)
 
pcmk__client_tpcmk__new_unauth_client (void *key)
 Allocate a new pcmk__client_t object and generate its ID. More...
 
pcmk__client_tpcmk__new_client (qb_ipcs_connection_t *c, uid_t uid, gid_t gid)
 
void pcmk__free_client (pcmk__client_t *c)
 
void pcmk__drop_all_clients (qb_ipcs_service_t *s)
 
bool pcmk__set_client_queue_max (pcmk__client_t *client, const char *qmax)
 
xmlNode * pcmk__ipc_create_ack_as (const char *function, int line, uint32_t flags, const char *tag, const char *ver, crm_exit_t status)
 
int pcmk__ipc_send_ack_as (const char *function, int line, pcmk__client_t *c, uint32_t request, uint32_t flags, const char *tag, const char *ver, crm_exit_t status)
 
int pcmk__ipc_prepare_iov (uint32_t request, const xmlNode *message, uint32_t max_send_size, struct iovec **result, ssize_t *bytes)
 
int pcmk__ipc_send_xml (pcmk__client_t *c, uint32_t request, const xmlNode *message, uint32_t flags)
 
int pcmk__ipc_send_iov (pcmk__client_t *c, struct iovec *iov, uint32_t flags)
 
xmlNode * pcmk__client_data2xml (pcmk__client_t *c, void *data, uint32_t *id, uint32_t *flags)
 
int pcmk__client_pid (qb_ipcs_connection_t *c)
 
void pcmk__serve_attrd_ipc (qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
void pcmk__serve_fenced_ipc (qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
void pcmk__serve_pacemakerd_ipc (qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
qb_ipcs_service_t * pcmk__serve_schedulerd_ipc (struct qb_ipcs_service_handlers *cb)
 
qb_ipcs_service_t * pcmk__serve_controld_ipc (struct qb_ipcs_service_handlers *cb)
 
void pcmk__serve_based_ipc (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 pcmk__stop_based_ipc (qb_ipcs_service_t *ipcs_ro, qb_ipcs_service_t *ipcs_rw, qb_ipcs_service_t *ipcs_shm)
 
const char * pcmk__pcmkd_state_enum2friendly (enum pcmk_pacemakerd_state state)
 
const char * pcmk__controld_api_reply2str (enum pcmk_controld_api_reply reply)
 
const char * pcmk__pcmkd_api_reply2str (enum pcmk_pacemakerd_api_reply reply)
 

Macro Definition Documentation

◆ pcmk__clear_client_flags

#define pcmk__clear_client_flags (   client,
  flags_to_clear 
)
Value:
do { \
(client)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
"Client", pcmk__client_name(client), \
(client)->flags, (flags_to_clear), #flags_to_clear); \
} while (0)
#define LOG_TRACE
Definition: logging.h:38
const char * pcmk__client_name(const pcmk__client_t *c)
Definition: ipc_server.c:98
uint64_t flags
Definition: remote.c:215

Definition at line 205 of file ipc_internal.h.

◆ pcmk__clear_ipc_flags

#define pcmk__clear_ipc_flags (   ipc_flags,
  ipc_name,
  flags_to_clear 
)
Value:
do { \
ipc_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
"IPC", (ipc_name), \
(ipc_flags), (flags_to_clear), \
#flags_to_clear); \
} while (0)
#define LOG_TRACE
Definition: logging.h:38

Definition at line 219 of file ipc_internal.h.

◆ PCMK__CLIENT_TYPE

#define PCMK__CLIENT_TYPE (   client)    ((client)->flags & UINT64_C(0xff00000000))

Definition at line 170 of file ipc_internal.h.

◆ pcmk__ipc_create_ack

#define pcmk__ipc_create_ack (   flags,
  tag,
  ver,
  st 
)    pcmk__ipc_create_ack_as(__func__, __LINE__, (flags), (tag), (ver), (st))

Definition at line 244 of file ipc_internal.h.

◆ pcmk__ipc_send_ack

#define pcmk__ipc_send_ack (   c,
  req,
  flags,
  tag,
  ver,
  st 
)    pcmk__ipc_send_ack_as(__func__, __LINE__, (c), (req), (flags), (tag), (ver), (st))

Definition at line 250 of file ipc_internal.h.

◆ PCMK__IPC_TIMEOUT

#define PCMK__IPC_TIMEOUT   120

Definition at line 52 of file ipc_internal.h.

◆ pcmk__set_client_flags

#define pcmk__set_client_flags (   client,
  flags_to_set 
)
Value:
do { \
(client)->flags = pcmk__set_flags_as(__func__, __LINE__, \
"Client", pcmk__client_name(client), \
(client)->flags, (flags_to_set), #flags_to_set); \
} while (0)
#define LOG_TRACE
Definition: logging.h:38
const char * pcmk__client_name(const pcmk__client_t *c)
Definition: ipc_server.c:98
uint64_t flags
Definition: remote.c:215

Definition at line 198 of file ipc_internal.h.

◆ pcmk__set_ipc_flags

#define pcmk__set_ipc_flags (   ipc_flags,
  ipc_name,
  flags_to_set 
)
Value:
do { \
ipc_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
"IPC", (ipc_name), \
(ipc_flags), (flags_to_set), \
#flags_to_set); \
} while (0)
#define LOG_TRACE
Definition: logging.h:38

Definition at line 212 of file ipc_internal.h.

◆ PCMK__SPECIAL_PID

#define PCMK__SPECIAL_PID   1

Definition at line 49 of file ipc_internal.h.

◆ PCMK__SPECIAL_PID_AS_0

#define PCMK__SPECIAL_PID_AS_0 (   p)    (p)

Definition at line 61 of file ipc_internal.h.

◆ PCMK__XA_IPC_PROTO_VERSION

#define PCMK__XA_IPC_PROTO_VERSION   "ipc-protocol-version"

Definition at line 40 of file ipc_internal.h.

Typedef Documentation

◆ pcmk__client_t

Definition at line 108 of file ipc_internal.h.

Enumeration Type Documentation

◆ pcmk__client_flags

Enumerator
pcmk__client_ipc 

Client uses plain IPC.

pcmk__client_tcp 

Client uses TCP connection.

pcmk__client_proxied 

Client IPC is proxied.

pcmk__client_privileged 

Client is run by root or cluster user.

pcmk__client_to_proxy 

Local client to be proxied.

pcmk__client_authenticated 

Client IPC connection accepted.

Used only for remote CIB connections via remote-tls-port.

Definition at line 130 of file ipc_internal.h.

Function Documentation

◆ pcmk__client_cleanup()

void pcmk__client_cleanup ( void  )

Definition at line 115 of file ipc_server.c.

◆ pcmk__client_data2xml()

xmlNode* pcmk__client_data2xml ( pcmk__client_t c,
void *  data,
uint32_t *  id,
uint32_t *  flags 
)

Definition at line 386 of file ipc_server.c.

◆ pcmk__client_name()

const char* pcmk__client_name ( const pcmk__client_t c)

Definition at line 98 of file ipc_server.c.

◆ pcmk__client_pid()

int pcmk__client_pid ( qb_ipcs_connection_t *  c)

Definition at line 365 of file ipc_server.c.

◆ pcmk__client_type_str()

const char* pcmk__client_type_str ( uint64_t  client_type)

Definition at line 96 of file ipc_common.c.

◆ pcmk__connect_generic_ipc()

int pcmk__connect_generic_ipc ( crm_ipc_t ipc)

Definition at line 895 of file ipc_client.c.

◆ pcmk__connect_ipc()

int pcmk__connect_ipc ( pcmk_ipc_api_t api,
enum pcmk_ipc_dispatch  dispatch_type,
int  attempts 
)

Definition at line 501 of file ipc_client.c.

◆ pcmk__controld_api_reply2str()

const char* pcmk__controld_api_reply2str ( enum pcmk_controld_api_reply  reply)

Definition at line 39 of file ipc_controld.c.

◆ pcmk__drop_all_clients()

void pcmk__drop_all_clients ( qb_ipcs_service_t *  s)

Definition at line 130 of file ipc_server.c.

◆ pcmk__find_client()

pcmk__client_t* pcmk__find_client ( const qb_ipcs_connection_t *  c)

Definition at line 59 of file ipc_server.c.

◆ pcmk__find_client_by_id()

pcmk__client_t* pcmk__find_client_by_id ( const char *  id)

Definition at line 70 of file ipc_server.c.

◆ pcmk__foreach_ipc_client()

void pcmk__foreach_ipc_client ( GHFunc  func,
gpointer  user_data 
)

Definition at line 51 of file ipc_server.c.

◆ pcmk__free_client()

void pcmk__free_client ( pcmk__client_t c)

Definition at line 299 of file ipc_server.c.

◆ pcmk__ipc_client_count()

guint pcmk__ipc_client_count ( void  )

Definition at line 36 of file ipc_server.c.

◆ pcmk__ipc_create_ack_as()

xmlNode* pcmk__ipc_create_ack_as ( const char *  function,
int  line,
uint32_t  flags,
const char *  tag,
const char *  ver,
crm_exit_t  status 
)

Definition at line 783 of file ipc_server.c.

◆ pcmk__ipc_fd()

int pcmk__ipc_fd ( crm_ipc_t ipc,
int *  fd 
)

Definition at line 1040 of file ipc_client.c.

◆ pcmk__ipc_is_authentic_process_active()

int pcmk__ipc_is_authentic_process_active ( const char *  name,
uid_t  refuid,
gid_t  refgid,
pid_t *  gotpid 
)

Definition at line 1596 of file ipc_client.c.

◆ pcmk__ipc_prepare_iov()

int pcmk__ipc_prepare_iov ( uint32_t  request,
const xmlNode *  message,
uint32_t  max_send_size,
struct iovec **  result,
ssize_t *  bytes 
)

Definition at line 582 of file ipc_server.c.

◆ pcmk__ipc_send_ack_as()

int pcmk__ipc_send_ack_as ( const char *  function,
int  line,
pcmk__client_t c,
uint32_t  request,
uint32_t  flags,
const char *  tag,
const char *  ver,
crm_exit_t  status 
)

Definition at line 814 of file ipc_server.c.

◆ pcmk__ipc_send_iov()

int pcmk__ipc_send_iov ( pcmk__client_t c,
struct iovec *  iov,
uint32_t  flags 
)

Definition at line 667 of file ipc_server.c.

◆ pcmk__ipc_send_xml()

int pcmk__ipc_send_xml ( pcmk__client_t c,
uint32_t  request,
const xmlNode *  message,
uint32_t  flags 
)

Definition at line 746 of file ipc_server.c.

◆ pcmk__new_client()

pcmk__client_t* pcmk__new_client ( qb_ipcs_connection_t *  c,
uid_t  uid,
gid_t  gid 
)

Definition at line 218 of file ipc_server.c.

◆ pcmk__new_unauth_client()

pcmk__client_t* pcmk__new_unauth_client ( void *  key)

Allocate a new pcmk__client_t object and generate its ID.

Parameters
[in]keyWhat to use as connections hash table key (NULL to use ID)
Returns
Pointer to new pcmk__client_t (asserts on failure)

Definition at line 209 of file ipc_server.c.

◆ pcmk__pcmkd_api_reply2str()

const char* pcmk__pcmkd_api_reply2str ( enum pcmk_pacemakerd_api_reply  reply)

Definition at line 110 of file ipc_pacemakerd.c.

◆ pcmk__pcmkd_state_enum2friendly()

const char* pcmk__pcmkd_state_enum2friendly ( enum pcmk_pacemakerd_state  state)

Definition at line 76 of file ipc_pacemakerd.c.

◆ pcmk__serve_attrd_ipc()

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

Definition at line 911 of file ipc_server.c.

◆ pcmk__serve_based_ipc()

void pcmk__serve_based_ipc ( 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 844 of file ipc_server.c.

◆ pcmk__serve_controld_ipc()

qb_ipcs_service_t* pcmk__serve_controld_ipc ( struct qb_ipcs_service_handlers *  cb)

Definition at line 896 of file ipc_server.c.

◆ pcmk__serve_fenced_ipc()

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

Definition at line 933 of file ipc_server.c.

◆ pcmk__serve_pacemakerd_ipc()

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

Definition at line 956 of file ipc_server.c.

◆ pcmk__serve_schedulerd_ipc()

qb_ipcs_service_t* pcmk__serve_schedulerd_ipc ( struct qb_ipcs_service_handlers *  cb)

Definition at line 983 of file ipc_server.c.

◆ pcmk__set_client_queue_max()

bool pcmk__set_client_queue_max ( pcmk__client_t client,
const char *  qmax 
)

Definition at line 350 of file ipc_server.c.

◆ pcmk__stop_based_ipc()

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

Definition at line 878 of file ipc_server.c.