root/include/crm/common/remote_internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__is_pacemaker_remote_node
  2. pcmk__is_remote_node
  3. pcmk__is_guest_or_bundle_node

   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 
  28 typedef struct pcmk__remote_s pcmk__remote_t;
  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);
  32 int pcmk__read_available_remote_data(pcmk__remote_t *remote);
  33 int pcmk__read_remote_message(pcmk__remote_t *remote, int timeout_ms);
  34 xmlNode *pcmk__remote_message_xml(pcmk__remote_t *remote);
  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 
  41 /*!
  42  * \internal
  43  * \brief Check whether a node is a Pacemaker Remote node of any kind
  44  *
  45  * \param[in] node  Node to check
  46  *
  47  * \return true if \p node is a remote, guest, or bundle node, otherwise false
  48  */
  49 static inline bool
  50 pcmk__is_pacemaker_remote_node(const pcmk_node_t *node)
     /* [previous][next][first][last][top][bottom][index][help] */
  51 {
  52     return (node != NULL)
  53             && (node->priv->variant == pcmk__node_variant_remote);
  54 }
  55 
  56 /*!
  57  * \internal
  58  * \brief Check whether a node is a remote node
  59  *
  60  * \param[in] node  Node to check
  61  *
  62  * \return true if \p node is a remote node, otherwise false
  63  */
  64 static inline bool
  65 pcmk__is_remote_node(const pcmk_node_t *node)
     /* [previous][next][first][last][top][bottom][index][help] */
  66 {
  67     return pcmk__is_pacemaker_remote_node(node)
  68            && ((node->priv->remote == NULL)
  69                || (node->priv->remote->priv->launcher == NULL));
  70 }
  71 
  72 /*!
  73  * \internal
  74  * \brief Check whether a node is a guest or bundle node
  75  *
  76  * \param[in] node  Node to check
  77  *
  78  * \return true if \p node is a guest or bundle node, otherwise false
  79  */
  80 static inline bool
  81 pcmk__is_guest_or_bundle_node(const pcmk_node_t *node)
     /* [previous][next][first][last][top][bottom][index][help] */
  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

/* [previous][next][first][last][top][bottom][index][help] */