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);
125 # ifdef HAVE_GNUTLS_GNUTLS_H 126 gnutls_session_t *tls_session;
143 pcmk__client_tls = (UINT64_C(1) << 34),
166 pcmk__client_tls_handshake_complete = (UINT64_C(1) << 44),
170 #define PCMK__CLIENT_TYPE(client) ((client)->flags & UINT64_C(0xff00000000)) 198 #define pcmk__set_client_flags(client, flags_to_set) do { \ 199 (client)->flags = pcmk__set_flags_as(__func__, __LINE__, \ 201 "Client", pcmk__client_name(client), \ 202 (client)->flags, (flags_to_set), #flags_to_set); \ 205 #define pcmk__clear_client_flags(client, flags_to_clear) do { \ 206 (client)->flags = pcmk__clear_flags_as(__func__, __LINE__, \ 208 "Client", pcmk__client_name(client), \ 209 (client)->flags, (flags_to_clear), #flags_to_clear); \ 212 #define pcmk__set_ipc_flags(ipc_flags, ipc_name, flags_to_set) do { \ 213 ipc_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \ 215 (ipc_flags), (flags_to_set), \ 219 #define pcmk__clear_ipc_flags(ipc_flags, ipc_name, flags_to_clear) do { \ 220 ipc_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \ 222 (ipc_flags), (flags_to_clear), \ 243 const char *tag,
const char *ver,
crm_exit_t status);
244 #define pcmk__ipc_create_ack(flags, tag, ver, st) \ 245 pcmk__ipc_create_ack_as(__func__, __LINE__, (flags), (tag), (ver), (st)) 248 uint32_t request, uint32_t
flags,
const char *tag,
250 #define pcmk__ipc_send_ack(c, req, flags, tag, ver, st) \ 251 pcmk__ipc_send_ack_as(__func__, __LINE__, (c), (req), (flags), (tag), (ver), (st)) 254 uint32_t max_send_size,
255 struct iovec **
result, ssize_t *bytes);
257 const xmlNode *message, uint32_t
flags);
260 uint32_t *
id, uint32_t *
flags);
265 struct qb_ipcs_service_handlers *cb);
267 struct qb_ipcs_service_handlers *cb);
269 struct qb_ipcs_service_handlers *cb);
274 qb_ipcs_service_t **ipcs_rw,
275 qb_ipcs_service_t **ipcs_shm,
276 struct qb_ipcs_service_handlers *ro_cb,
277 struct qb_ipcs_service_handlers *rw_cb);
280 qb_ipcs_service_t *ipcs_rw,
281 qb_ipcs_service_t *ipcs_shm);
283 static inline const char *
284 pcmk__ipc_sys_name(
const char *ipc_name,
const char *fallback)
Client uses TCP connection.
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)
int pcmk__ipc_send_xml(pcmk__client_t *c, uint32_t request, const xmlNode *message, uint32_t flags)
struct mainloop_io_s mainloop_io_t
int pcmk__ipc_prepare_iov(uint32_t request, const xmlNode *message, uint32_t max_send_size, struct iovec **result, ssize_t *bytes)
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)
int pcmk__connect_ipc(pcmk_ipc_api_t *api, enum pcmk_ipc_dispatch dispatch_type, int attempts)
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__connect_generic_ipc(crm_ipc_t *ipc)
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)
struct crm_ipc_s crm_ipc_t
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
pcmk_ipc_dispatch
How IPC replies should be dispatched.
void pcmk__foreach_ipc_client(GHFunc func, gpointer user_data)
guint pcmk__ipc_client_count(void)
pcmk__action_result_t result
int pcmk__ipc_fd(crm_ipc_t *ipc, int *fd)
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.