pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
remote_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_COMMON_REMOTE_INTERNAL__H
11 #define PCMK__CRM_COMMON_REMOTE_INTERNAL__H
12 
13 #include <stdio.h> // NULL
14 #include <stdbool.h> // bool
15 #include <libxml/tree.h> // xmlNode
16 
17 #include <crm/common/ipc_internal.h> // pcmk__client_t
18 #include <crm/common/nodes_internal.h> // pcmk__node_variant_remote, etc.
19 #include <crm/common/resources_internal.h> // struct pcmk__remote_private
20 #include <crm/common/scheduler_types.h> // pcmk_node_t
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 // internal functions from remote.c
27 
29 
30 int pcmk__remote_send_xml(pcmk__remote_t *remote, const xmlNode *msg);
31 int pcmk__remote_ready(const pcmk__remote_t *remote, int timeout_ms);
33 int pcmk__read_remote_message(pcmk__remote_t *remote, int timeout_ms);
35 int pcmk__connect_remote(const char *host, int port, int timeout_ms,
36  int *timer_id, int *sock_fd, void *userdata,
37  void (*callback) (void *userdata, int rc, int sock));
38 int pcmk__accept_remote_connection(int ssock, int *csock);
39 void pcmk__sockaddr2str(const void *sa, char *s);
40 
49 static inline bool
50 pcmk__is_pacemaker_remote_node(const pcmk_node_t *node)
51 {
52  return (node != NULL)
53  && (node->priv->variant == pcmk__node_variant_remote);
54 }
55 
64 static inline bool
65 pcmk__is_remote_node(const pcmk_node_t *node)
66 {
67  return pcmk__is_pacemaker_remote_node(node)
68  && ((node->priv->remote == NULL)
69  || (node->priv->remote->priv->launcher == NULL));
70 }
71 
80 static inline bool
81 pcmk__is_guest_or_bundle_node(const pcmk_node_t *node)
82 {
83  return pcmk__is_pacemaker_remote_node(node)
84  && (node->priv->remote != NULL)
85  && (node->priv->remote->priv->launcher != NULL);
86 }
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif // PCMK__CRM_COMMON_REMOTE_INTERNAL__H
pcmk__cpg_host_t host
Definition: cpg.c:52
Type aliases needed to define scheduler objects.
int pcmk__accept_remote_connection(int ssock, int *csock)
Definition: remote.c:948
int pcmk__read_available_remote_data(pcmk__remote_t *remote)
Definition: remote.c:444
pcmk__node_private_t * priv
Definition: nodes.h:85
int pcmk__remote_ready(const pcmk__remote_t *remote, int timeout_ms)
Definition: remote.c:392
int pcmk__connect_remote(const char *host, int port, int timeout_ms, int *timer_id, int *sock_fd, void *userdata, void(*callback)(void *userdata, int rc, int sock))
Definition: remote.c:813
pcmk__resource_private_t * priv
Definition: resources.h:61
void pcmk__sockaddr2str(const void *sa, char *s)
Definition: remote.c:919
int pcmk__remote_send_xml(pcmk__remote_t *remote, const xmlNode *msg)
Definition: remote.c:245
enum pcmk__node_variant variant
pcmk_resource_t * remote
pcmk_resource_t * launcher
int pcmk__read_remote_message(pcmk__remote_t *remote, int timeout_ms)
Definition: remote.c:541
xmlNode * pcmk__remote_message_xml(pcmk__remote_t *remote)
Definition: remote.c:298