This source file includes following definitions.
- cib_config_lookup
1
2
3
4
5
6
7
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
34 enum cib_client_flags {
35
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
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 bool based_is_primary;
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 xmlNode *readCibXml(char *buffer);
92 xmlNode *readCibXmlFile(const char *dir, const char *file,
93 gboolean discard_status);
94 int activateCibXml(xmlNode *doc, gboolean to_disk, const char *op);
95
96 xmlNode *createCibRequest(gboolean isLocal, const char *operation,
97 const char *section, const char *verbose,
98 xmlNode *data);
99 int cib_process_shutdown_req(const char *op, int options, const char *section,
100 xmlNode *req, xmlNode *input,
101 xmlNode *existing_cib, xmlNode **result_cib,
102 xmlNode **answer);
103 int cib_process_default(const char *op, int options, const char *section,
104 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
105 xmlNode **result_cib, xmlNode **answer);
106 int cib_process_ping(const char *op, int options, const char *section,
107 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
108 xmlNode **result_cib, xmlNode **answer);
109 int cib_process_readwrite(const char *op, int options, const char *section,
110 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
111 xmlNode **result_cib, xmlNode **answer);
112 int cib_process_replace_svr(const char *op, int options, const char *section,
113 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
114 xmlNode **result_cib, xmlNode **answer);
115 int cib_server_process_diff(const char *op, int options, const char *section,
116 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
117 xmlNode **result_cib, xmlNode **answer);
118 int cib_process_sync(const char *op, int options, const char *section,
119 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
120 xmlNode **result_cib, xmlNode **answer);
121 int cib_process_sync_one(const char *op, int options, const char *section,
122 xmlNode *req, xmlNode *input, xmlNode *existing_cib,
123 xmlNode **result_cib, xmlNode **answer);
124 int cib_process_delete_absolute(const char *op, int options,
125 const char *section, xmlNode *req,
126 xmlNode *input, xmlNode *existing_cib,
127 xmlNode **result_cib, xmlNode **answer);
128 int cib_process_upgrade_server(const char *op, int options, const char *section,
129 xmlNode *req, xmlNode *input,
130 xmlNode *existing_cib, xmlNode **result_cib,
131 xmlNode **answer);
132 void send_sync_request(const char *host);
133
134 xmlNode *cib_msg_copy(xmlNode *msg, gboolean with_data);
135 xmlNode *cib_construct_reply(xmlNode *request, xmlNode *output, int rc);
136 int cib_get_operation_id(const char *op, int *operation);
137 cib_op_t *cib_op_func(int call_type);
138 gboolean cib_op_modifies(int call_type);
139 int cib_op_prepare(int call_type, xmlNode *request, xmlNode **input,
140 const char **section);
141 int cib_op_cleanup(int call_type, int options, xmlNode **input,
142 xmlNode **output);
143 int cib_op_can_run(int call_type, int call_options, gboolean privileged,
144 gboolean global_update);
145 void cib_diff_notify(int options, const char *client, const char *call_id,
146 const char *op, xmlNode *update, int result,
147 xmlNode *old_cib);
148 void cib_replace_notify(const char *origin, xmlNode *update, int result,
149 xmlNode *diff, uint32_t change_section);
150
151 static inline const char *
152 cib_config_lookup(const char *opt)
153 {
154 return g_hash_table_lookup(config_hash, opt);
155 }
156
157 #endif