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-2023 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     int (*prepare) (xmlNode *, xmlNode **, const char **);
  51     int (*cleanup) (int, xmlNode **, xmlNode **);
  52     int (*fn) (const char *, int, const char *, xmlNode *,
  53                xmlNode *, xmlNode *, xmlNode **, xmlNode **);
  54 } cib_operation_t;
  55 
  56 extern bool based_is_primary;
  57 extern GHashTable *config_hash;
  58 extern xmlNode *the_cib;
  59 extern crm_trigger_t *cib_writer;
  60 extern gboolean cib_writes_enabled;
  61 
  62 extern GMainLoop *mainloop;
  63 extern crm_cluster_t *crm_cluster;
  64 extern GHashTable *local_notify_queue;
  65 extern gboolean legacy_mode;
  66 extern gboolean stand_alone;
  67 extern gboolean cib_shutdown_flag;
  68 extern gchar *cib_root;
  69 extern int cib_status;
  70 extern pcmk__output_t *logger_out;
  71 
  72 extern struct qb_ipcs_service_handlers ipc_ro_callbacks;
  73 extern struct qb_ipcs_service_handlers ipc_rw_callbacks;
  74 extern qb_ipcs_service_t *ipcs_ro;
  75 extern qb_ipcs_service_t *ipcs_rw;
  76 extern qb_ipcs_service_t *ipcs_shm;
  77 
  78 void cib_peer_callback(xmlNode *msg, void *private_data);
  79 void cib_common_callback_worker(uint32_t id, uint32_t flags,
  80                                 xmlNode *op_request, pcmk__client_t *cib_client,
  81                                 gboolean privileged);
  82 void cib_shutdown(int nsig);
  83 void terminate_cib(const char *caller, int fast);
  84 gboolean cib_legacy_mode(void);
  85 
  86 gboolean uninitializeCib(void);
  87 xmlNode *readCibXmlFile(const char *dir, const char *file,
  88                         gboolean discard_status);
  89 int activateCibXml(xmlNode *doc, gboolean to_disk, const char *op);
  90 
  91 int cib_process_shutdown_req(const char *op, int options, const char *section,
  92                              xmlNode *req, xmlNode *input,
  93                              xmlNode *existing_cib, xmlNode **result_cib,
  94                              xmlNode **answer);
  95 int cib_process_default(const char *op, int options, const char *section,
  96                         xmlNode *req, xmlNode *input, xmlNode *existing_cib,
  97                         xmlNode **result_cib, xmlNode **answer);
  98 int cib_process_ping(const char *op, int options, const char *section,
  99                      xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 100                      xmlNode **result_cib, xmlNode **answer);
 101 int cib_process_readwrite(const char *op, int options, const char *section,
 102                           xmlNode *req, xmlNode *input, xmlNode *existing_cib,
 103                           xmlNode **result_cib, xmlNode **answer);
 104 int cib_process_replace_svr(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_server_process_diff(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_sync(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_sync_one(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_process_delete_absolute(const char *op, int options,
 117                                 const char *section, xmlNode *req,
 118                                 xmlNode *input, xmlNode *existing_cib,
 119                                 xmlNode **result_cib, xmlNode **answer);
 120 int cib_process_upgrade_server(const char *op, int options, const char *section,
 121                                xmlNode *req, xmlNode *input,
 122                                xmlNode *existing_cib, xmlNode **result_cib,
 123                                xmlNode **answer);
 124 void send_sync_request(const char *host);
 125 int sync_our_cib(xmlNode *request, gboolean all);
 126 
 127 xmlNode *cib_msg_copy(xmlNode *msg, gboolean with_data);
 128 int cib_get_operation_id(const char *op, int *operation);
 129 cib_op_t *cib_op_func(int call_type);
 130 gboolean cib_op_modifies(int call_type);
 131 int cib_op_prepare(int call_type, xmlNode *request, xmlNode **input,
 132                    const char **section);
 133 int cib_op_cleanup(int call_type, int options, xmlNode **input,
 134                    xmlNode **output);
 135 int cib_op_can_run(int call_type, int call_options, bool privileged);
 136 void cib_diff_notify(const char *op, int result, const char *call_id,
 137                      const char *client_id, const char *client_name,
 138                      const char *origin, xmlNode *update, xmlNode *diff);
 139 void cib_replace_notify(const char *op, int result, const char *call_id,
 140                         const char *client_id, const char *client_name,
 141                         const char *origin, xmlNode *update, xmlNode *diff,
 142                         uint32_t change_section);
 143 
 144 static inline const char *
 145 cib_config_lookup(const char *opt)
     /* [previous][next][first][last][top][bottom][index][help] */
 146 {
 147     return g_hash_table_lookup(config_hash, opt);
 148 }
 149 
 150 #endif // PACEMAKER_BASED__H

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