10 #ifndef PCMK__IPC_INTERNAL_H 11 #define PCMK__IPC_INTERNAL_H 20 #include <sys/types.h> 22 #ifdef HAVE_GNUTLS_GNUTLS_H 23 # include <gnutls/gnutls.h> 27 #include <libxml/tree.h> 28 #include <qb/qbipcs.h> 40 #define PCMK__XA_IPC_PROTO_VERSION "ipc-protocol-version" 49 #define PCMK__SPECIAL_PID 1 52 #define PCMK__IPC_TIMEOUT 120 54 #if defined(HAVE_GETPEEREID) 59 #define PCMK__SPECIAL_PID_AS_0(p) (((p) == PCMK__SPECIAL_PID) ? 0 : (p)) 61 #define PCMK__SPECIAL_PID_AS_0(p) (p) 97 gid_t refgid, pid_t *gotpid);
120 # ifdef HAVE_GNUTLS_GNUTLS_H 121 gnutls_session_t *tls_session;
138 pcmk__client_tls = (UINT64_C(1) << 34),
161 pcmk__client_tls_handshake_complete = (UINT64_C(1) << 44),
165 #define PCMK__CLIENT_TYPE(client) ((client)->flags & UINT64_C(0xff00000000)) 193 #define pcmk__set_client_flags(client, flags_to_set) do { \ 194 (client)->flags = pcmk__set_flags_as(__func__, __LINE__, \ 196 "Client", pcmk__client_name(client), \ 197 (client)->flags, (flags_to_set), #flags_to_set); \ 200 #define pcmk__clear_client_flags(client, flags_to_clear) do { \ 201 (client)->flags = pcmk__clear_flags_as(__func__, __LINE__, \ 203 "Client", pcmk__client_name(client), \ 204 (client)->flags, (flags_to_clear), #flags_to_clear); \ 207 #define pcmk__set_ipc_flags(ipc_flags, ipc_name, flags_to_set) do { \ 208 ipc_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \ 210 (ipc_flags), (flags_to_set), \ 214 #define pcmk__clear_ipc_flags(ipc_flags, ipc_name, flags_to_clear) do { \ 215 ipc_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \ 217 (ipc_flags), (flags_to_clear), \ 238 const char *tag,
const char *ver,
crm_exit_t status);
239 #define pcmk__ipc_create_ack(flags, tag, ver, st) \ 240 pcmk__ipc_create_ack_as(__func__, __LINE__, (flags), (tag), (ver), (st)) 243 uint32_t request, uint32_t
flags,
const char *tag,
245 #define pcmk__ipc_send_ack(c, req, flags, tag, ver, st) \ 246 pcmk__ipc_send_ack_as(__func__, __LINE__, (c), (req), (flags), (tag), (ver), (st)) 249 uint32_t max_send_size,
250 struct iovec **
result, ssize_t *bytes);
255 uint32_t *
id, uint32_t *
flags);
260 struct qb_ipcs_service_handlers *cb);
262 struct qb_ipcs_service_handlers *cb);
264 struct qb_ipcs_service_handlers *cb);
269 qb_ipcs_service_t **ipcs_rw,
270 qb_ipcs_service_t **ipcs_shm,
271 struct qb_ipcs_service_handlers *ro_cb,
272 struct qb_ipcs_service_handlers *rw_cb);
275 qb_ipcs_service_t *ipcs_rw,
276 qb_ipcs_service_t *ipcs_shm);
278 static inline const char *
279 pcmk__ipc_sys_name(
const char *ipc_name,
const char *fallback)
Client uses TCP connection.
int pcmk__ipc_prepare_iov(uint32_t request, xmlNode *message, uint32_t max_send_size, struct iovec **result, ssize_t *bytes)
xmlNode * pcmk__client_data2xml(pcmk__client_t *c, void *data, uint32_t *id, uint32_t *flags)
pcmk__client_t * pcmk__new_client(qb_ipcs_connection_t *c, uid_t uid, gid_t gid)
const char * pcmk__pcmkd_api_reply2str(enum pcmk_pacemakerd_api_reply reply)
const char * pcmk__controld_api_reply2str(enum pcmk_controld_api_reply reply)
qb_ipcs_service_t * pcmk__serve_controld_ipc(struct qb_ipcs_service_handlers *cb)
struct mainloop_io_s mainloop_io_t
enum crm_exit_e crm_exit_t
void pcmk__stop_based_ipc(qb_ipcs_service_t *ipcs_ro, qb_ipcs_service_t *ipcs_rw, qb_ipcs_service_t *ipcs_shm)
pcmk_pacemakerd_api_reply
Possible types of pacemakerd replies.
void pcmk__client_cleanup(void)
Wrappers for and extensions to glib mainloop.
int pcmk__client_pid(qb_ipcs_connection_t *c)
Client is run by root or cluster user.
int pcmk__ipc_send_xml(pcmk__client_t *c, uint32_t request, xmlNode *message, uint32_t flags)
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)
pcmk__client_t * pcmk__find_client(const qb_ipcs_connection_t *c)
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_iov(pcmk__client_t *c, struct iovec *iov, uint32_t flags)
IPC commands for Pacemakerd.
IPC commands for Pacemaker controller.
bool pcmk__set_client_queue_max(pcmk__client_t *client, const char *qmax)
Client IPC connection accepted.
#define HAVE_GNUTLS_GNUTLS_H
void pcmk__foreach_ipc_client(GHFunc func, gpointer user_data)
guint pcmk__ipc_client_count(void)
pcmk__action_result_t result
pcmk__client_t * pcmk__find_client_by_id(const char *id)
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)
const char * pcmk__pcmkd_state_enum2friendly(enum pcmk_pacemakerd_state state)
IPC interface to Pacemaker daemons.
const char * pcmk__client_name(const pcmk__client_t *c)
const char * pcmk__client_type_str(uint64_t client_type)
pcmk__client_t * pcmk__new_unauth_client(void *key)
Allocate a new pcmk__client_t object and generate its ID.
Local client to be proxied.
void pcmk__drop_all_clients(qb_ipcs_service_t *s)
void pcmk__serve_fenced_ipc(qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
struct pcmk__remote_s * remote
void pcmk__serve_attrd_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)
int pcmk__ipc_is_authentic_process_active(const char *name, uid_t refuid, gid_t refgid, pid_t *gotpid)
unsigned int queue_backlog
qb_ipcs_connection_t * ipcs
qb_ipcs_service_t * pcmk__serve_schedulerd_ipc(struct qb_ipcs_service_handlers *cb)
void pcmk__free_client(pcmk__client_t *c)
pcmk_controld_api_reply
Possible types of controller replies.