This source file includes following definitions.
- pcmk__xml_attr_value
1
2
3
4
5
6
7
8
9
10 #ifndef CRMCOMMON_PRIVATE__H
11 # define CRMCOMMON_PRIVATE__H
12
13
14
15
16
17 #include <stdint.h>
18 #include <stdbool.h>
19 #include <sys/types.h>
20 #include <glib.h>
21 #include <libxml/tree.h>
22 #include <qb/qbipcc.h>
23
24
25 #define PCMK__BUFFER_SIZE 4096
26
27 #if defined(PCMK__UNIT_TESTING)
28 #undef G_GNUC_INTERNAL
29 #define G_GNUC_INTERNAL
30 #endif
31
32
33
34
35 typedef struct pcmk__deleted_xml_s {
36 char *path;
37 int position;
38 } pcmk__deleted_xml_t;
39
40 typedef struct xml_node_private_s {
41 long check;
42 uint32_t flags;
43 } xml_node_private_t;
44
45 typedef struct xml_doc_private_s {
46 long check;
47 uint32_t flags;
48 char *user;
49 GList *acls;
50 GList *deleted_objs;
51 } xml_doc_private_t;
52
53 #define pcmk__set_xml_flags(xml_priv, flags_to_set) do { \
54 (xml_priv)->flags = pcmk__set_flags_as(__func__, __LINE__, \
55 LOG_NEVER, "XML", "XML node", (xml_priv)->flags, \
56 (flags_to_set), #flags_to_set); \
57 } while (0)
58
59 #define pcmk__clear_xml_flags(xml_priv, flags_to_clear) do { \
60 (xml_priv)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
61 LOG_NEVER, "XML", "XML node", (xml_priv)->flags, \
62 (flags_to_clear), #flags_to_clear); \
63 } while (0)
64
65 G_GNUC_INTERNAL
66 void pcmk__xml2text(xmlNodePtr data, int options, GString *buffer, int depth);
67
68 G_GNUC_INTERNAL
69 bool pcmk__tracking_xml_changes(xmlNode *xml, bool lazy);
70
71 G_GNUC_INTERNAL
72 void pcmk__mark_xml_created(xmlNode *xml);
73
74 G_GNUC_INTERNAL
75 int pcmk__xml_position(const xmlNode *xml,
76 enum xml_private_flags ignore_if_set);
77
78 G_GNUC_INTERNAL
79 xmlNode *pcmk__xml_match(const xmlNode *haystack, const xmlNode *needle,
80 bool exact);
81
82 G_GNUC_INTERNAL
83 void pcmk__xml_log(int log_level, const char *file, const char *function,
84 int line, const char *prefix, const xmlNode *data, int depth,
85 int options);
86
87 G_GNUC_INTERNAL
88 void pcmk__xml_update(xmlNode *parent, xmlNode *target, xmlNode *update,
89 bool as_diff);
90
91 G_GNUC_INTERNAL
92 xmlNode *pcmk__xc_match(const xmlNode *root, const xmlNode *search_comment,
93 bool exact);
94
95 G_GNUC_INTERNAL
96 void pcmk__xc_update(xmlNode *parent, xmlNode *target, xmlNode *update);
97
98 G_GNUC_INTERNAL
99 void pcmk__free_acls(GList *acls);
100
101 G_GNUC_INTERNAL
102 void pcmk__unpack_acl(xmlNode *source, xmlNode *target, const char *user);
103
104 G_GNUC_INTERNAL
105 bool pcmk__is_user_in_group(const char *user, const char *group);
106
107 G_GNUC_INTERNAL
108 void pcmk__apply_acl(xmlNode *xml);
109
110 G_GNUC_INTERNAL
111 void pcmk__apply_creation_acl(xmlNode *xml, bool check_top);
112
113 G_GNUC_INTERNAL
114 void pcmk__mark_xml_attr_dirty(xmlAttr *a);
115
116 G_GNUC_INTERNAL
117 bool pcmk__xa_filterable(const char *name);
118
119 static inline const char *
120 pcmk__xml_attr_value(const xmlAttr *attr)
121 {
122 return ((attr == NULL) || (attr->children == NULL))? NULL
123 : (const char *) attr->children->content;
124 }
125
126
127
128
129
130 #define PCMK__IPC_VERSION 1
131
132 #define PCMK__CONTROLD_API_MAJOR "1"
133 #define PCMK__CONTROLD_API_MINOR "0"
134
135
136 typedef struct pcmk__ipc_methods_s {
137
138
139
140
141
142
143
144
145 int (*new_data)(pcmk_ipc_api_t *api);
146
147
148
149
150
151
152
153 void (*free_data)(void *api_data);
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169 int (*post_connect)(pcmk_ipc_api_t *api);
170
171
172
173
174
175
176
177
178
179
180 bool (*reply_expected)(pcmk_ipc_api_t *api, xmlNode *request);
181
182
183
184
185
186
187
188
189
190
191 bool (*dispatch)(pcmk_ipc_api_t *api, xmlNode *msg);
192
193
194
195
196
197
198
199 void (*post_disconnect)(pcmk_ipc_api_t *api);
200 } pcmk__ipc_methods_t;
201
202
203 struct pcmk_ipc_api_s {
204 enum pcmk_ipc_server server;
205 enum pcmk_ipc_dispatch dispatch_type;
206 size_t ipc_size_max;
207 crm_ipc_t *ipc;
208 mainloop_io_t *mainloop_io;
209 bool free_on_disconnect;
210 pcmk_ipc_callback_t cb;
211 void *user_data;
212 void *api_data;
213 pcmk__ipc_methods_t *cmds;
214 };
215
216 typedef struct pcmk__ipc_header_s {
217 struct qb_ipc_response_header qb;
218 uint32_t size_uncompressed;
219 uint32_t size_compressed;
220 uint32_t flags;
221 uint8_t version;
222 } pcmk__ipc_header_t;
223
224 G_GNUC_INTERNAL
225 int pcmk__send_ipc_request(pcmk_ipc_api_t *api, xmlNode *request);
226
227 G_GNUC_INTERNAL
228 void pcmk__call_ipc_callback(pcmk_ipc_api_t *api,
229 enum pcmk_ipc_event event_type,
230 crm_exit_t status, void *event_data);
231
232 G_GNUC_INTERNAL
233 unsigned int pcmk__ipc_buffer_size(unsigned int max);
234
235 G_GNUC_INTERNAL
236 bool pcmk__valid_ipc_header(const pcmk__ipc_header_t *header);
237
238 G_GNUC_INTERNAL
239 pcmk__ipc_methods_t *pcmk__attrd_api_methods(void);
240
241 G_GNUC_INTERNAL
242 pcmk__ipc_methods_t *pcmk__controld_api_methods(void);
243
244 G_GNUC_INTERNAL
245 pcmk__ipc_methods_t *pcmk__pacemakerd_api_methods(void);
246
247 G_GNUC_INTERNAL
248 pcmk__ipc_methods_t *pcmk__schedulerd_api_methods(void);
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290 int pcmk__crm_ipc_is_authentic_process(qb_ipcc_connection_t *qb_ipc, int sock,
291 uid_t refuid, gid_t refgid,
292 pid_t *gotpid, uid_t *gotuid,
293 gid_t *gotgid);
294
295
296
297
298
299 #define PCMK__PW_BUFFER_LEN 500
300
301
302 #endif