summaryrefslogtreecommitdiffstats
path: root/include/crm/common/remote_internal.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:29 +0000
commitb41961d74fe7ff2d4d4abaca92454e87c561e49f (patch)
treeb34e3826a7b649dafdbd05081140c990c96d736d /include/crm/common/remote_internal.h
parentReleasing progress-linux version 2.1.7-1~progress7.99u1. (diff)
downloadpacemaker-b41961d74fe7ff2d4d4abaca92454e87c561e49f.tar.xz
pacemaker-b41961d74fe7ff2d4d4abaca92454e87c561e49f.zip
Merging upstream version 2.1.8~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/crm/common/remote_internal.h')
-rw-r--r--include/crm/common/remote_internal.h65
1 files changed, 58 insertions, 7 deletions
diff --git a/include/crm/common/remote_internal.h b/include/crm/common/remote_internal.h
index 030c7a4..d55f25f 100644
--- a/include/crm/common/remote_internal.h
+++ b/include/crm/common/remote_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2023 the Pacemaker project contributors
+ * Copyright 2008-2024 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -7,8 +7,13 @@
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
-#ifndef PCMK__REMOTE_INTERNAL__H
-# define PCMK__REMOTE_INTERNAL__H
+#ifndef PCMK__CRM_COMMON_REMOTE_INTERNAL__H
+#define PCMK__CRM_COMMON_REMOTE_INTERNAL__H
+
+#include <stdbool.h> // bool
+
+#include <crm/common/nodes.h> // pcmk_node_variant_remote
+#include <crm/common/scheduler_types.h> // pcmk_node_t
// internal functions from remote.c
@@ -24,8 +29,54 @@ int pcmk__connect_remote(const char *host, int port, int timeout_ms,
int pcmk__accept_remote_connection(int ssock, int *csock);
void pcmk__sockaddr2str(const void *sa, char *s);
-# ifdef HAVE_GNUTLS_GNUTLS_H
-# include <gnutls/gnutls.h>
+/*!
+ * \internal
+ * \brief Check whether a node is a Pacemaker Remote node of any kind
+ *
+ * \param[in] node Node to check
+ *
+ * \return true if \p node is a remote, guest, or bundle node, otherwise false
+ */
+static inline bool
+pcmk__is_pacemaker_remote_node(const pcmk_node_t *node)
+{
+ return (node != NULL) && (node->details->type == pcmk_node_variant_remote);
+}
+
+/*!
+ * \internal
+ * \brief Check whether a node is a remote node
+ *
+ * \param[in] node Node to check
+ *
+ * \return true if \p node is a remote node, otherwise false
+ */
+static inline bool
+pcmk__is_remote_node(const pcmk_node_t *node)
+{
+ return pcmk__is_pacemaker_remote_node(node)
+ && ((node->details->remote_rsc == NULL)
+ || (node->details->remote_rsc->container == NULL));
+}
+
+/*!
+ * \internal
+ * \brief Check whether a node is a guest or bundle node
+ *
+ * \param[in] node Node to check
+ *
+ * \return true if \p node is a guest or bundle node, otherwise false
+ */
+static inline bool
+pcmk__is_guest_or_bundle_node(const pcmk_node_t *node)
+{
+ return pcmk__is_pacemaker_remote_node(node)
+ && (node->details->remote_rsc != NULL)
+ && (node->details->remote_rsc->container != NULL);
+}
+
+#ifdef HAVE_GNUTLS_GNUTLS_H
+#include <gnutls/gnutls.h>
gnutls_session_t *pcmk__new_tls_session(int csock, unsigned int conn_type,
gnutls_credentials_type_t cred_type,
@@ -44,5 +95,5 @@ int pcmk__read_handshake_data(const pcmk__client_t *client);
*/
int pcmk__tls_client_handshake(pcmk__remote_t *remote, int timeout_ms);
-# endif // HAVE_GNUTLS_GNUTLS_H
-#endif // PCMK__REMOTE_INTERNAL__H
+#endif // HAVE_GNUTLS_GNUTLS_H
+#endif // PCMK__CRM_COMMON_REMOTE_INTERNAL__H