root/include/crm/common/ipc_controld.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2020-2021 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_IPC_CONTROLD__H
  11 #  define PCMK__CRM_COMMON_IPC_CONTROLD__H
  12 
  13 
  14 #include <stdbool.h>                    // bool
  15 #include <glib.h>                       // GList
  16 #include <libxml/tree.h>                // xmlNode
  17 #include <crm/common/ipc.h>             // pcmk_ipc_api_t
  18 
  19 #ifdef __cplusplus
  20 extern "C" {
  21 #endif
  22 
  23 /**
  24  * \file
  25  * \brief IPC commands for Pacemaker controller
  26  *
  27  * \ingroup core
  28  */
  29 
  30 //! Possible types of controller replies
  31 enum pcmk_controld_api_reply {
  32     pcmk_controld_reply_unknown,
  33     pcmk_controld_reply_reprobe,
  34     pcmk_controld_reply_info,
  35     pcmk_controld_reply_resource,
  36     pcmk_controld_reply_ping,
  37     pcmk_controld_reply_nodes,
  38 };
  39 
  40 // Node information passed with pcmk_controld_reply_nodes
  41 typedef struct {
  42     uint32_t id;
  43     const char *uname;
  44     const char *state;
  45 } pcmk_controld_api_node_t;
  46 
  47 /*!
  48  * Controller reply passed to event callback
  49  *
  50  * \note Shutdown and election calls have no reply. Reprobe calls are
  51  *       acknowledged but contain no data (reply_type will be the only item
  52  *       set). Node info and ping calls have their own reply data. Fail and
  53  *       refresh calls use the resource reply type and reply data.
  54  * \note The pointers in the reply are only guaranteed to be meaningful for the
  55  *       execution of the callback; if the values are needed for later, the
  56  *       callback should copy them.
  57  */
  58 typedef struct {
  59     enum pcmk_controld_api_reply reply_type;
  60     const char *feature_set; //!< CRM feature set advertised by controller
  61     const char *host_from;   //!< Name of node that sent reply
  62 
  63     union {
  64         // pcmk_controld_reply_info
  65         struct {
  66             bool have_quorum;
  67             bool is_remote;
  68             int id;
  69             const char *uuid;
  70             const char *uname;
  71             const char *state;
  72         } node_info;
  73 
  74         // pcmk_controld_reply_resource
  75         struct {
  76             xmlNode *node_state;    //<! Resource operation history XML
  77         } resource;
  78 
  79         // pcmk_controld_reply_ping
  80         struct {
  81             const char *sys_from;
  82             const char *fsa_state;
  83             const char *result;
  84         } ping;
  85 
  86         // pcmk_controld_reply_nodes
  87         GList *nodes; // list of pcmk_controld_api_node_t *
  88     } data;
  89 } pcmk_controld_api_reply_t;
  90 
  91 int pcmk_controld_api_reprobe(pcmk_ipc_api_t *api, const char *target_node,
  92                               const char *router_node);
  93 int pcmk_controld_api_node_info(pcmk_ipc_api_t *api, uint32_t nodeid);
  94 int pcmk_controld_api_fail(pcmk_ipc_api_t *api, const char *target_node,
  95                            const char *router_node, const char *rsc_id,
  96                            const char *rsc_long_id, const char *standard,
  97                            const char *provider, const char *type);
  98 int pcmk_controld_api_refresh(pcmk_ipc_api_t *api, const char *target_node,
  99                               const char *router_node, const char *rsc_id,
 100                               const char *rsc_long_id, const char *standard,
 101                               const char *provider, const char *type,
 102                               bool cib_only);
 103 int pcmk_controld_api_ping(pcmk_ipc_api_t *api, const char *node_name);
 104 int pcmk_controld_api_list_nodes(pcmk_ipc_api_t *api);
 105 unsigned int pcmk_controld_api_replies_expected(pcmk_ipc_api_t *api);
 106 
 107 #ifdef __cplusplus
 108 }
 109 #endif
 110 
 111 #endif // PCMK__CRM_COMMON_IPC_CONTROLD__H

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