10 #ifndef PCMK__CRM_COMMON_IPC_INTERNAL__H 11 #define PCMK__CRM_COMMON_IPC_INTERNAL__H 16 #include <sys/types.h> 18 #include <gnutls/gnutls.h> 21 #include <libxml/tree.h> 22 #include <qb/qbipcs.h> 41 #define PCMK__SPECIAL_PID 1 44 #define PCMK__IPC_TIMEOUT 120 46 #if defined(HAVE_GETPEEREID) 51 #define PCMK__SPECIAL_PID_AS_0(p) (((p) == PCMK__SPECIAL_PID) ? 0 : (p)) 53 #define PCMK__SPECIAL_PID_AS_0(p) (p) 89 gid_t refgid, pid_t *gotpid);
156 #define PCMK__CLIENT_TYPE(client) ((client)->flags & UINT64_C(0xff00000000)) 184 #define pcmk__set_client_flags(client, flags_to_set) do { \ 185 (client)->flags = pcmk__set_flags_as(__func__, __LINE__, \ 187 "Client", pcmk__client_name(client), \ 188 (client)->flags, (flags_to_set), #flags_to_set); \ 191 #define pcmk__clear_client_flags(client, flags_to_clear) do { \ 192 (client)->flags = pcmk__clear_flags_as(__func__, __LINE__, \ 194 "Client", pcmk__client_name(client), \ 195 (client)->flags, (flags_to_clear), #flags_to_clear); \ 198 #define pcmk__set_ipc_flags(ipc_flags, ipc_name, flags_to_set) do { \ 199 ipc_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \ 201 (ipc_flags), (flags_to_set), \ 205 #define pcmk__clear_ipc_flags(ipc_flags, ipc_name, flags_to_clear) do { \ 206 ipc_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \ 208 (ipc_flags), (flags_to_clear), \ 229 const char *tag,
const char *ver,
crm_exit_t status);
230 #define pcmk__ipc_create_ack(flags, tag, ver, st) \ 231 pcmk__ipc_create_ack_as(__func__, __LINE__, (flags), (tag), (ver), (st)) 234 uint32_t request, uint32_t
flags,
const char *tag,
236 #define pcmk__ipc_send_ack(c, req, flags, tag, ver, st) \ 237 pcmk__ipc_send_ack_as(__func__, __LINE__, (c), (req), (flags), (tag), (ver), (st)) 240 uint32_t max_send_size,
241 struct iovec **
result, ssize_t *bytes);
243 const xmlNode *message, uint32_t
flags);
246 uint32_t *
id, uint32_t *
flags);
251 struct qb_ipcs_service_handlers *cb);
253 struct qb_ipcs_service_handlers *cb);
255 struct qb_ipcs_service_handlers *cb);
260 qb_ipcs_service_t **ipcs_rw,
261 qb_ipcs_service_t **ipcs_shm,
262 struct qb_ipcs_service_handlers *ro_cb,
263 struct qb_ipcs_service_handlers *rw_cb);
266 qb_ipcs_service_t *ipcs_rw,
267 qb_ipcs_service_t *ipcs_shm);
269 static inline const char *
270 pcmk__ipc_sys_name(
const char *ipc_name,
const char *fallback)
284 #endif // PCMK__CRM_COMMON_IPC_INTERNAL__H 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)
void pcmk__set_client_queue_max(pcmk__client_t *client, const char *qmax)
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
Client TLS handshake is complete.
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.
Client uses TCP with TLS.
IPC commands for Pacemaker controller.
Client IPC connection accepted.
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)
gnutls_session_t tls_session
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.