root/include/crm/common/ipc_pacemakerd.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2020 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_PACEMAKERD__H
  11 #  define PCMK__CRM_COMMON_IPC_PACEMAKERD__H
  12 
  13 #include <sys/types.h>       // time_t
  14 #include <crm/common/ipc.h>  // pcmk_ipc_api_t
  15 
  16 #ifdef __cplusplus
  17 extern "C" {
  18 #endif
  19 
  20 /**
  21  * \file
  22  * \brief IPC commands for Pacemakerd
  23  *
  24  * \ingroup core
  25  */
  26 
  27 enum pcmk_pacemakerd_state {
  28     pcmk_pacemakerd_state_invalid = -1,
  29     pcmk_pacemakerd_state_init = 0,
  30     pcmk_pacemakerd_state_starting_daemons,
  31     pcmk_pacemakerd_state_wait_for_ping,
  32     pcmk_pacemakerd_state_running,
  33     pcmk_pacemakerd_state_shutting_down,
  34     pcmk_pacemakerd_state_shutdown_complete,
  35     pcmk_pacemakerd_state_max = pcmk_pacemakerd_state_shutdown_complete,
  36 };
  37 
  38 //! Possible types of pacemakerd replies
  39 enum pcmk_pacemakerd_api_reply {
  40     pcmk_pacemakerd_reply_unknown,
  41     pcmk_pacemakerd_reply_ping,
  42     pcmk_pacemakerd_reply_shutdown,
  43 };
  44 
  45 /*!
  46  * Pacemakerd reply passed to event callback
  47  */
  48 typedef struct {
  49     enum pcmk_pacemakerd_api_reply reply_type;
  50 
  51     union {
  52         // pcmk_pacemakerd_reply_ping
  53         struct {
  54             const char *sys_from;
  55             enum pcmk_pacemakerd_state state;
  56             time_t last_good;
  57             int status;
  58         } ping;
  59         // pcmk_pacemakerd_reply_shutdown
  60         struct {
  61             int status;
  62         } shutdown;
  63     } data;
  64 } pcmk_pacemakerd_api_reply_t;
  65 
  66 int pcmk_pacemakerd_api_ping(pcmk_ipc_api_t *api, const char *ipc_name);
  67 int pcmk_pacemakerd_api_shutdown(pcmk_ipc_api_t *api, const char *ipc_name);
  68 
  69 enum pcmk_pacemakerd_state
  70     pcmk_pacemakerd_api_daemon_state_text2enum(const char *state);
  71 const char
  72     *pcmk_pacemakerd_api_daemon_state_enum2text(enum pcmk_pacemakerd_state state);
  73 
  74 #ifdef __cplusplus
  75 }
  76 #endif
  77 
  78 #endif // PCMK__CRM_COMMON_IPC_PACEMAKERD__H

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