root/daemons/based/pacemaker-based.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. cib_config_lookup

   1 /*
   2  * Copyright 2004-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 PACEMAKER_BASED__H
  11 #  define PACEMAKER_BASED__H
  12 
  13 #include <stdio.h>
  14 #include <sys/types.h>
  15 #include <unistd.h>
  16 #include <stdlib.h>
  17 #include <glib.h>
  18 #include <errno.h>
  19 #include <fcntl.h>
  20 
  21 #include <crm/crm.h>
  22 #include <crm/cib.h>
  23 #include <crm/common/xml.h>
  24 #include <crm/cluster.h>
  25 #include <crm/common/ipc_internal.h>
  26 #include <crm/common/mainloop.h>
  27 #include <crm/cib/internal.h>
  28 
  29 #ifdef HAVE_GNUTLS_GNUTLS_H
  30 #  include <gnutls/gnutls.h>
  31 #endif
  32 
  33 // CIB-specific client flags
  34 enum cib_client_flags {
  35     // Notifications
  36     cib_notify_pre     = (UINT64_C(1) << 0),
  37     cib_notify_post    = (UINT64_C(1) << 1),
  38     cib_notify_replace = (UINT64_C(1) << 2),
  39     cib_notify_confirm = (UINT64_C(1) << 3),
  40     cib_notify_diff    = (UINT64_C(1) << 4),
  41 
  42     // Whether client is another cluster daemon
  43     cib_is_daemon      = (UINT64_C(1) << 12),
  44 };
  45 
  46 typedef struct cib_operation_s {
  47     const char *operation;
  48     gboolean modifies_cib;
  49     gboolean needs_privileges;
  50     gboolean needs_quorum;
  51     int (*prepare) (xmlNode *, xmlNode **, const char **);
  52     int (*cleanup) (int, xmlNode **, xmlNode **);
  53     int (*fn) (const char *, int, const char *, xmlNode *,
  54                xmlNode *, xmlNode *, xmlNode **, xmlNode **);
  55 } cib_operation_t;
  56 
  57 extern gboolean cib_is_master;
  58 extern GHashTable *peer_hash;
  59 extern GHashTable *config_hash;
  60 extern xmlNode *the_cib;
  61 extern crm_trigger_t *cib_writer;
  62 extern gboolean cib_writes_enabled;
  63 
  64 extern GMainLoop *mainloop;
  65 extern crm_cluster_t crm_cluster;
  66 extern GHashTable *local_notify_queue;
  67 extern gboolean legacy_mode;
  68 extern gboolean stand_alone;
  69 extern gboolean cib_shutdown_flag;
  70 extern const char *cib_root;
  71 extern char *cib_our_uname;
  72 extern int cib_status;
  73 extern FILE *msg_cib_strm;
  74 
  75 extern struct qb_ipcs_service_handlers ipc_ro_callbacks;
  76 extern struct qb_ipcs_service_handlers ipc_rw_callbacks;
  77 extern qb_ipcs_service_t *ipcs_ro;
  78 extern qb_ipcs_service_t *ipcs_rw;
  79 extern qb_ipcs_service_t *ipcs_shm;
  80 
  81 void cib_peer_callback(xmlNode *msg, void *private_data);
  82 void cib_common_callback_worker(uint32_t id, uint32_t flags,
  83                                 xmlNode *op_request, pcmk__client_t *cib_client,
  84                                 gboolean privileged);
  85 void cib_shutdown(int nsig);
  86 void initiate_exit(void);
  87 void terminate_cib(const char *caller, int fast);
  88 gboolean cib_legacy_mode(void);
  89 
  90 gboolean uninitializeCib(void);
  91 gboolean verifyCibXml(xmlNode *cib);
  92 xmlNode *readCibXml(char *buffer);
  93 xmlNode *readCibXmlFile(const char *dir, const char *file,
  94                         gboolean discard_status);
  95 int activateCibXml(xmlNode *doc, gboolean to_disk, const char *op);
  96 
  97 xmlNode *createCibRequest(gboolean isLocal, const char *operation,
  98                           const char *section, const char *verbose,
  99                           xmlNode *data);
 100 int cib_process_shutdown_req(const char *op, int options, const char *section,
 101                              xmlNode *req, xmlNode *input,
 102                              xmlNode *existing_cib, xmlNode **result_cib,
 103                              xmlNode **answer);
 104 int cib_process_default(const char *op, int options, const char *section,
 105                         xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 106                         xmlNode **result_cib, xmlNode **answer);
 107 int cib_process_ping(const char *op, int options, const char *section,
 108                      xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 109                      xmlNode **result_cib, xmlNode **answer);
 110 int cib_process_readwrite(const char *op, int options, const char *section,
 111                           xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 112                           xmlNode **result_cib, xmlNode **answer);
 113 int cib_process_replace_svr(const char *op, int options, const char *section,
 114                             xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 115                             xmlNode **result_cib, xmlNode **answer);
 116 int cib_server_process_diff(const char *op, int options, const char *section,
 117                             xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 118                             xmlNode **result_cib, xmlNode **answer);
 119 int cib_process_sync(const char *op, int options, const char *section,
 120                      xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 121                      xmlNode **result_cib, xmlNode **answer);
 122 int cib_process_sync_one(const char *op, int options, const char *section,
 123                          xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 124                          xmlNode **result_cib, xmlNode **answer);
 125 int cib_process_delete_absolute(const char *op, int options,
 126                                 const char *section, xmlNode *req,
 127                                 xmlNode *input, xmlNode *existing_cib,
 128                                 xmlNode **result_cib, xmlNode **answer);
 129 int cib_process_upgrade_server(const char *op, int options, const char *section,
 130                                xmlNode *req, xmlNode *input,
 131                                xmlNode *existing_cib, xmlNode **result_cib,
 132                                xmlNode **answer);
 133 void send_sync_request(const char *host);
 134 
 135 xmlNode *cib_msg_copy(xmlNode *msg, gboolean with_data);
 136 xmlNode *cib_construct_reply(xmlNode *request, xmlNode *output, int rc);
 137 int cib_get_operation_id(const char *op, int *operation);
 138 cib_op_t *cib_op_func(int call_type);
 139 gboolean cib_op_modifies(int call_type);
 140 int cib_op_prepare(int call_type, xmlNode *request, xmlNode **input,
 141                    const char **section);
 142 int cib_op_cleanup(int call_type, int options, xmlNode **input,
 143                    xmlNode **output);
 144 int cib_op_can_run(int call_type, int call_options, gboolean privileged,
 145                    gboolean global_update);
 146 void cib_diff_notify(int options, const char *client, const char *call_id,
 147                      const char *op, xmlNode *update, int result,
 148                      xmlNode *old_cib);
 149 void cib_replace_notify(const char *origin, xmlNode *update, int result,
 150                         xmlNode *diff, int change_section);
 151 
 152 static inline const char *
 153 cib_config_lookup(const char *opt)
     /* [previous][next][first][last][top][bottom][index][help] */
 154 {
 155     return g_hash_table_lookup(config_hash, opt);
 156 }
 157 
 158 #endif // PACEMAKER_BASED__H

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