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

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