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 <glib.h>
  22 #include <libxml/tree.h>
  23 
  24 #include <crm/crm.h>
  25 #include <crm/cib.h>
  26 #include <crm/common/xml.h>
  27 #include <crm/cluster.h>
  28 #include <crm/common/ipc_internal.h>
  29 #include <crm/common/mainloop.h>
  30 #include <crm/cib/internal.h>
  31 
  32 #include "based_transaction.h"
  33 
  34 #ifdef HAVE_GNUTLS_GNUTLS_H
  35 #  include <gnutls/gnutls.h>
  36 #endif
  37 
  38 #define OUR_NODENAME (stand_alone? "localhost" : crm_cluster->uname)
  39 
  40 // CIB-specific client flags
  41 enum cib_client_flags {
  42     // Notifications
  43     cib_notify_pre     = (UINT64_C(1) << 0),
  44     cib_notify_post    = (UINT64_C(1) << 1),
  45     cib_notify_confirm = (UINT64_C(1) << 3),
  46     cib_notify_diff    = (UINT64_C(1) << 4),
  47 
  48     // Whether client is another cluster daemon
  49     cib_is_daemon      = (UINT64_C(1) << 12),
  50 };
  51 
  52 extern bool based_is_primary;
  53 extern GHashTable *config_hash;
  54 extern xmlNode *the_cib;
  55 extern crm_trigger_t *cib_writer;
  56 extern gboolean cib_writes_enabled;
  57 
  58 extern GMainLoop *mainloop;
  59 extern crm_cluster_t *crm_cluster;
  60 extern GHashTable *local_notify_queue;
  61 extern gboolean legacy_mode;
  62 extern gboolean stand_alone;
  63 extern gboolean cib_shutdown_flag;
  64 extern gchar *cib_root;
  65 extern int cib_status;
  66 
  67 extern struct qb_ipcs_service_handlers ipc_ro_callbacks;
  68 extern struct qb_ipcs_service_handlers ipc_rw_callbacks;
  69 extern qb_ipcs_service_t *ipcs_ro;
  70 extern qb_ipcs_service_t *ipcs_rw;
  71 extern qb_ipcs_service_t *ipcs_shm;
  72 
  73 void cib_peer_callback(xmlNode *msg, void *private_data);
  74 void cib_common_callback_worker(uint32_t id, uint32_t flags,
  75                                 xmlNode *op_request, pcmk__client_t *cib_client,
  76                                 gboolean privileged);
  77 int cib_process_request(xmlNode *request, gboolean privileged,
  78                         const pcmk__client_t *cib_client);
  79 void cib_shutdown(int nsig);
  80 void terminate_cib(const char *caller, int fast);
  81 gboolean cib_legacy_mode(void);
  82 
  83 gboolean uninitializeCib(void);
  84 xmlNode *readCibXmlFile(const char *dir, const char *file,
  85                         gboolean discard_status);
  86 int activateCibXml(xmlNode *doc, gboolean to_disk, const char *op);
  87 
  88 int cib_process_shutdown_req(const char *op, int options, const char *section,
  89                              xmlNode *req, xmlNode *input,
  90                              xmlNode *existing_cib, xmlNode **result_cib,
  91                              xmlNode **answer);
  92 int cib_process_noop(const char *op, int options, const char *section,
  93                      xmlNode *req, xmlNode *input, xmlNode *existing_cib,
  94                      xmlNode **result_cib, xmlNode **answer);
  95 int cib_process_ping(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_readwrite(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_replace_svr(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_server_process_diff(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_sync(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_one(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_delete_absolute(const char *op, int options,
 114                                 const char *section, xmlNode *req,
 115                                 xmlNode *input, xmlNode *existing_cib,
 116                                 xmlNode **result_cib, xmlNode **answer);
 117 int cib_process_upgrade_server(const char *op, int options, const char *section,
 118                                xmlNode *req, xmlNode *input,
 119                                xmlNode *existing_cib, xmlNode **result_cib,
 120                                xmlNode **answer);
 121 int cib_process_commit_transaction(const char *op, int options,
 122                                    const char *section, xmlNode *req,
 123                                    xmlNode *input, xmlNode *existing_cib,
 124                                    xmlNode **result_cib, xmlNode **answer);
 125 void send_sync_request(const char *host);
 126 int sync_our_cib(xmlNode *request, gboolean all);
 127 
 128 cib__op_fn_t based_get_op_function(const cib__operation_t *operation);
 129 void cib_diff_notify(const char *op, int result, const char *call_id,
 130                      const char *client_id, const char *client_name,
 131                      const char *origin, xmlNode *update, xmlNode *diff);
 132 
 133 static inline const char *
 134 cib_config_lookup(const char *opt)
     /* [previous][next][first][last][top][bottom][index][help] */
 135 {
 136     return g_hash_table_lookup(config_hash, opt);
 137 }
 138 
 139 #endif // PACEMAKER_BASED__H

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