pacemaker 2.1.7-2.1.7
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
cib_remote.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-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#include <crm_internal.h>
11
12#include <unistd.h>
13#include <stdlib.h>
14#include <stdio.h>
15#include <stdarg.h>
16#include <string.h>
17#include <netdb.h>
18#include <termios.h>
19#include <sys/socket.h>
20
21#include <glib.h>
22
23#include <crm/crm.h>
24#include <crm/cib/internal.h>
25#include <crm/msg_xml.h>
27#include <crm/common/mainloop.h>
30
31#ifdef HAVE_GNUTLS_GNUTLS_H
32
33# include <gnutls/gnutls.h>
34
35# define TLS_HANDSHAKE_TIMEOUT_MS 5000
36
37static gnutls_anon_client_credentials_t anon_cred_c;
38static gboolean remote_gnutls_credentials_init = FALSE;
39
40#endif // HAVE_GNUTLS_GNUTLS_H
41
42#include <arpa/inet.h>
43
44typedef struct cib_remote_opaque_s {
45 int port;
46 char *server;
47 char *user;
48 char *passwd;
49 gboolean encrypted;
50 pcmk__remote_t command;
51 pcmk__remote_t callback;
52 pcmk__output_t *out;
54
55static int
56cib_remote_perform_op(cib_t *cib, const char *op, const char *host,
57 const char *section, xmlNode *data,
58 xmlNode **output_data, int call_options,
59 const char *user_name)
60{
61 int rc;
62 int remaining_time = 0;
63 time_t start_time;
64
65 xmlNode *op_msg = NULL;
66 xmlNode *op_reply = NULL;
67
68 cib_remote_opaque_t *private = cib->variant_opaque;
69
70 if (cib->state == cib_disconnected) {
71 return -ENOTCONN;
72 }
73
74 if (output_data != NULL) {
75 *output_data = NULL;
76 }
77
78 if (op == NULL) {
79 crm_err("No operation specified");
80 return -EINVAL;
81 }
82
83 rc = cib__create_op(cib, op, host, section, data, call_options, user_name,
84 NULL, &op_msg);
85 if (rc != pcmk_ok) {
86 return rc;
87 }
88
89 if (pcmk_is_set(call_options, cib_transaction)) {
90 rc = cib__extend_transaction(cib, op_msg);
91 free_xml(op_msg);
92 return rc;
93 }
94
95 crm_trace("Sending %s message to the CIB manager", op);
96 if (!(call_options & cib_sync_call)) {
97 pcmk__remote_send_xml(&private->callback, op_msg);
98 } else {
99 pcmk__remote_send_xml(&private->command, op_msg);
100 }
101 free_xml(op_msg);
102
103 if ((call_options & cib_discard_reply)) {
104 crm_trace("Discarding reply");
105 return pcmk_ok;
106
107 } else if (!(call_options & cib_sync_call)) {
108 return cib->call_id;
109 }
110
111 crm_trace("Waiting for a synchronous reply");
112
113 start_time = time(NULL);
114 remaining_time = cib->call_timeout ? cib->call_timeout : 60;
115
116 rc = pcmk_rc_ok;
117 while (remaining_time > 0 && (rc != ENOTCONN)) {
118 int reply_id = -1;
119 int msg_id = cib->call_id;
120
121 rc = pcmk__read_remote_message(&private->command,
122 remaining_time * 1000);
123 op_reply = pcmk__remote_message_xml(&private->command);
124
125 if (!op_reply) {
126 break;
127 }
128
129 crm_element_value_int(op_reply, F_CIB_CALLID, &reply_id);
130
131 if (reply_id == msg_id) {
132 break;
133
134 } else if (reply_id < msg_id) {
135 crm_debug("Received old reply: %d (wanted %d)", reply_id, msg_id);
136 crm_log_xml_trace(op_reply, "Old reply");
137
138 } else if ((reply_id - 10000) > msg_id) {
139 /* wrap-around case */
140 crm_debug("Received old reply: %d (wanted %d)", reply_id, msg_id);
141 crm_log_xml_trace(op_reply, "Old reply");
142 } else {
143 crm_err("Received a __future__ reply:" " %d (wanted %d)", reply_id, msg_id);
144 }
145
146 free_xml(op_reply);
147 op_reply = NULL;
148
149 /* wasn't the right reply, try and read some more */
150 remaining_time = time(NULL) - start_time;
151 }
152
153 /* if(IPC_ISRCONN(native->command_channel) == FALSE) { */
154 /* crm_err("The CIB manager disconnected: %d", */
155 /* native->command_channel->ch_status); */
156 /* cib->state = cib_disconnected; */
157 /* } */
158
159 if (rc == ENOTCONN) {
160 crm_err("Disconnected while waiting for reply.");
161 return -ENOTCONN;
162 } else if (op_reply == NULL) {
163 crm_err("No reply message - empty");
164 return -ENOMSG;
165 }
166
167 crm_trace("Synchronous reply received");
168
169 /* Start processing the reply... */
170 if (crm_element_value_int(op_reply, F_CIB_RC, &rc) != 0) {
171 rc = -EPROTO;
172 }
173
174 if (rc == -pcmk_err_diff_resync) {
175 /* This is an internal value that clients do not and should not care about */
176 rc = pcmk_ok;
177 }
178
179 if (rc == pcmk_ok || rc == -EPERM) {
180 crm_log_xml_debug(op_reply, "passed");
181
182 } else {
183/* } else if(rc == -ETIME) { */
184 crm_err("Call failed: %s", pcmk_strerror(rc));
185 crm_log_xml_warn(op_reply, "failed");
186 }
187
188 if (output_data == NULL) {
189 /* do nothing more */
190
191 } else if (!(call_options & cib_discard_reply)) {
192 xmlNode *tmp = get_message_xml(op_reply, F_CIB_CALLDATA);
193
194 if (tmp == NULL) {
195 crm_trace("No output in reply to \"%s\" command %d", op, cib->call_id - 1);
196 } else {
197 *output_data = copy_xml(tmp);
198 }
199 }
200
201 free_xml(op_reply);
202
203 return rc;
204}
205
206static int
207cib_remote_callback_dispatch(gpointer user_data)
208{
209 int rc;
210 cib_t *cib = user_data;
211 cib_remote_opaque_t *private = cib->variant_opaque;
212
213 xmlNode *msg = NULL;
214
215 crm_info("Message on callback channel");
216
217 rc = pcmk__read_remote_message(&private->callback, -1);
218
219 msg = pcmk__remote_message_xml(&private->callback);
220 while (msg) {
221 const char *type = crm_element_value(msg, F_TYPE);
222
223 crm_trace("Activating %s callbacks...", type);
224
225 if (pcmk__str_eq(type, T_CIB, pcmk__str_casei)) {
226 cib_native_callback(cib, msg, 0, 0);
227
228 } else if (pcmk__str_eq(type, T_CIB_NOTIFY, pcmk__str_casei)) {
229 g_list_foreach(cib->notify_list, cib_native_notify, msg);
230
231 } else {
232 crm_err("Unknown message type: %s", type);
233 }
234
235 free_xml(msg);
236 msg = pcmk__remote_message_xml(&private->callback);
237 }
238
239 if (rc == ENOTCONN) {
240 return -1;
241 }
242
243 return 0;
244}
245
246static int
247cib_remote_command_dispatch(gpointer user_data)
248{
249 int rc;
250 cib_t *cib = user_data;
251 cib_remote_opaque_t *private = cib->variant_opaque;
252
253 rc = pcmk__read_remote_message(&private->command, -1);
254
255 free(private->command.buffer);
256 private->command.buffer = NULL;
257 crm_err("received late reply for remote cib connection, discarding");
258
259 if (rc == ENOTCONN) {
260 return -1;
261 }
262 return 0;
263}
264
265static int
266cib_tls_close(cib_t *cib)
267{
268 cib_remote_opaque_t *private = cib->variant_opaque;
269
270#ifdef HAVE_GNUTLS_GNUTLS_H
271 if (private->encrypted) {
272 if (private->command.tls_session) {
273 gnutls_bye(*(private->command.tls_session), GNUTLS_SHUT_RDWR);
274 gnutls_deinit(*(private->command.tls_session));
275 gnutls_free(private->command.tls_session);
276 }
277
278 if (private->callback.tls_session) {
279 gnutls_bye(*(private->callback.tls_session), GNUTLS_SHUT_RDWR);
280 gnutls_deinit(*(private->callback.tls_session));
281 gnutls_free(private->callback.tls_session);
282 }
283 private->command.tls_session = NULL;
284 private->callback.tls_session = NULL;
285 if (remote_gnutls_credentials_init) {
286 gnutls_anon_free_client_credentials(anon_cred_c);
287 gnutls_global_deinit();
288 remote_gnutls_credentials_init = FALSE;
289 }
290 }
291#endif
292
293 if (private->command.tcp_socket) {
294 shutdown(private->command.tcp_socket, SHUT_RDWR); /* no more receptions */
295 close(private->command.tcp_socket);
296 }
297 if (private->callback.tcp_socket) {
298 shutdown(private->callback.tcp_socket, SHUT_RDWR); /* no more receptions */
299 close(private->callback.tcp_socket);
300 }
301 private->command.tcp_socket = 0;
302 private->callback.tcp_socket = 0;
303
304 free(private->command.buffer);
305 free(private->callback.buffer);
306 private->command.buffer = NULL;
307 private->callback.buffer = NULL;
308
309 return 0;
310}
311
312static void
313cib_remote_connection_destroy(gpointer user_data)
314{
315 crm_err("Connection destroyed");
316#ifdef HAVE_GNUTLS_GNUTLS_H
317 cib_tls_close(user_data);
318#endif
319}
320
321static int
322cib_tls_signon(cib_t *cib, pcmk__remote_t *connection, gboolean event_channel)
323{
324 cib_remote_opaque_t *private = cib->variant_opaque;
325 int rc;
326
327 xmlNode *answer = NULL;
328 xmlNode *login = NULL;
329
330 static struct mainloop_fd_callbacks cib_fd_callbacks = { 0, };
331
332 cib_fd_callbacks.dispatch =
333 event_channel ? cib_remote_callback_dispatch : cib_remote_command_dispatch;
334 cib_fd_callbacks.destroy = cib_remote_connection_destroy;
335
336 connection->tcp_socket = -1;
337#ifdef HAVE_GNUTLS_GNUTLS_H
338 connection->tls_session = NULL;
339#endif
340 rc = pcmk__connect_remote(private->server, private->port, 0, NULL,
341 &(connection->tcp_socket), NULL, NULL);
342 if (rc != pcmk_rc_ok) {
343 crm_info("Remote connection to %s:%d failed: %s " CRM_XS " rc=%d",
344 private->server, private->port, pcmk_rc_str(rc), rc);
345 return -ENOTCONN;
346 }
347
348 if (private->encrypted) {
349 /* initialize GnuTls lib */
350#ifdef HAVE_GNUTLS_GNUTLS_H
351 if (remote_gnutls_credentials_init == FALSE) {
352 crm_gnutls_global_init();
353 gnutls_anon_allocate_client_credentials(&anon_cred_c);
354 remote_gnutls_credentials_init = TRUE;
355 }
356
357 /* bind the socket to GnuTls lib */
358 connection->tls_session = pcmk__new_tls_session(connection->tcp_socket,
359 GNUTLS_CLIENT,
360 GNUTLS_CRD_ANON,
361 anon_cred_c);
362 if (connection->tls_session == NULL) {
363 cib_tls_close(cib);
364 return -1;
365 }
366
367 if (pcmk__tls_client_handshake(connection, TLS_HANDSHAKE_TIMEOUT_MS)
368 != pcmk_rc_ok) {
369 crm_err("Session creation for %s:%d failed", private->server, private->port);
370
371 gnutls_deinit(*connection->tls_session);
372 gnutls_free(connection->tls_session);
373 connection->tls_session = NULL;
374 cib_tls_close(cib);
375 return -1;
376 }
377#else
378 return -EPROTONOSUPPORT;
379#endif
380 }
381
382 /* login to server */
383 login = create_xml_node(NULL, T_CIB_COMMAND);
384 crm_xml_add(login, "op", "authenticate");
385 crm_xml_add(login, "user", private->user);
386 crm_xml_add(login, "password", private->passwd);
387 crm_xml_add(login, "hidden", "password");
388
389 pcmk__remote_send_xml(connection, login);
390 free_xml(login);
391
392 rc = pcmk_ok;
393 if (pcmk__read_remote_message(connection, -1) == ENOTCONN) {
394 rc = -ENOTCONN;
395 }
396
397 answer = pcmk__remote_message_xml(connection);
398
399 crm_log_xml_trace(answer, "Reply");
400 if (answer == NULL) {
401 rc = -EPROTO;
402
403 } else {
404 /* grab the token */
405 const char *msg_type = crm_element_value(answer, F_CIB_OPERATION);
406 const char *tmp_ticket = crm_element_value(answer, F_CIB_CLIENTID);
407
408 if (!pcmk__str_eq(msg_type, CRM_OP_REGISTER, pcmk__str_casei)) {
409 crm_err("Invalid registration message: %s", msg_type);
410 rc = -EPROTO;
411
412 } else if (tmp_ticket == NULL) {
413 rc = -EPROTO;
414
415 } else {
416 connection->token = strdup(tmp_ticket);
417 }
418 }
419 free_xml(answer);
420 answer = NULL;
421
422 if (rc != 0) {
423 cib_tls_close(cib);
424 return rc;
425 }
426
427 crm_trace("remote client connection established");
428 connection->source = mainloop_add_fd("cib-remote", G_PRIORITY_HIGH,
429 connection->tcp_socket, cib,
430 &cib_fd_callbacks);
431 return rc;
432}
433
434static int
435cib_remote_signon(cib_t *cib, const char *name, enum cib_conn_type type)
436{
437 int rc = pcmk_ok;
438 cib_remote_opaque_t *private = cib->variant_opaque;
439 xmlNode *hello = NULL;
440
441 if (private->passwd == NULL) {
442 if (private->out == NULL) {
443 /* If no pcmk__output_t is set, just assume that a text prompt
444 * is good enough.
445 */
446 pcmk__text_prompt("Password", false, &(private->passwd));
447 } else {
448 private->out->prompt("Password", false, &(private->passwd));
449 }
450 }
451
452 if (private->server == NULL || private->user == NULL) {
453 rc = -EINVAL;
454 }
455
456 if (rc == pcmk_ok) {
457 rc = cib_tls_signon(cib, &(private->command), FALSE);
458 }
459
460 if (rc == pcmk_ok) {
461 rc = cib_tls_signon(cib, &(private->callback), TRUE);
462 }
463
464 if (rc == pcmk_ok) {
465 rc = cib__create_op(cib, CRM_OP_REGISTER, NULL, NULL, NULL, cib_none,
466 NULL, name, &hello);
467 }
468
469 if (rc == pcmk_ok) {
470 rc = pcmk__remote_send_xml(&private->command, hello);
471 rc = pcmk_rc2legacy(rc);
472 free_xml(hello);
473 }
474
475 if (rc == pcmk_ok) {
476 crm_info("Opened connection to %s:%d for %s",
477 private->server, private->port, name);
479 cib->type = cib_command;
480
481 } else {
482 crm_info("Connection to %s:%d for %s failed: %s\n",
483 private->server, private->port, name, pcmk_strerror(rc));
484 }
485
486 return rc;
487}
488
489static int
490cib_remote_signoff(cib_t *cib)
491{
492 int rc = pcmk_ok;
493
494 crm_debug("Disconnecting from the CIB manager");
495#ifdef HAVE_GNUTLS_GNUTLS_H
496 cib_tls_close(cib);
497#endif
498
499 cib->cmds->end_transaction(cib, false, cib_none);
500 cib->state = cib_disconnected;
501 cib->type = cib_no_connection;
502
503 return rc;
504}
505
506static int
507cib_remote_free(cib_t *cib)
508{
509 int rc = pcmk_ok;
510
511 crm_warn("Freeing CIB");
512 if (cib->state != cib_disconnected) {
513 rc = cib_remote_signoff(cib);
514 if (rc == pcmk_ok) {
515 cib_remote_opaque_t *private = cib->variant_opaque;
516
517 free(private->server);
518 free(private->user);
519 free(private->passwd);
520 free(cib->cmds);
521 free(cib->user);
522 free(private);
523 free(cib);
524 }
525 }
526
527 return rc;
528}
529
530static int
531cib_remote_inputfd(cib_t * cib)
532{
533 cib_remote_opaque_t *private = cib->variant_opaque;
534
535 return private->callback.tcp_socket;
536}
537
538static int
539cib_remote_register_notification(cib_t * cib, const char *callback, int enabled)
540{
541 xmlNode *notify_msg = create_xml_node(NULL, T_CIB_COMMAND);
542 cib_remote_opaque_t *private = cib->variant_opaque;
543
545 crm_xml_add(notify_msg, F_CIB_NOTIFY_TYPE, callback);
546 crm_xml_add_int(notify_msg, F_CIB_NOTIFY_ACTIVATE, enabled);
547 pcmk__remote_send_xml(&private->callback, notify_msg);
548 free_xml(notify_msg);
549 return pcmk_ok;
550}
551
552static int
553cib_remote_set_connection_dnotify(cib_t * cib, void (*dnotify) (gpointer user_data))
554{
555 return -EPROTONOSUPPORT;
556}
557
575static int
576cib_remote_client_id(const cib_t *cib, const char **async_id,
577 const char **sync_id)
578{
579 cib_remote_opaque_t *private = cib->variant_opaque;
580
581 if (async_id != NULL) {
582 // private->callback is the channel for async requests
583 *async_id = private->callback.token;
584 }
585 if (sync_id != NULL) {
586 // private->command is the channel for sync requests
587 *sync_id = private->command.token;
588 }
589 return pcmk_ok;
590}
591
592cib_t *
593cib_remote_new(const char *server, const char *user, const char *passwd, int port,
594 gboolean encrypted)
595{
596 cib_remote_opaque_t *private = NULL;
597 cib_t *cib = cib_new_variant();
598
599 if (cib == NULL) {
600 return NULL;
601 }
602
603 private = calloc(1, sizeof(cib_remote_opaque_t));
604
605 if (private == NULL) {
606 free(cib);
607 return NULL;
608 }
609
610 cib->variant = cib_remote;
611 cib->variant_opaque = private;
612
613 pcmk__str_update(&private->server, server);
614 pcmk__str_update(&private->user, user);
615 pcmk__str_update(&private->passwd, passwd);
616
617 private->port = port;
618 private->encrypted = encrypted;
619
620 /* assign variant specific ops */
621 cib->delegate_fn = cib_remote_perform_op;
622 cib->cmds->signon = cib_remote_signon;
623 cib->cmds->signoff = cib_remote_signoff;
624 cib->cmds->free = cib_remote_free;
625 cib->cmds->inputfd = cib_remote_inputfd; // Deprecated method
626
627 cib->cmds->register_notification = cib_remote_register_notification;
628 cib->cmds->set_connection_dnotify = cib_remote_set_connection_dnotify;
629
630 cib->cmds->client_id = cib_remote_client_id;
631
632 return cib;
633}
634
635void
637{
638 cib_remote_opaque_t *private;
639
640 if (cib->variant != cib_remote) {
641 return;
642 }
643
644 private = cib->variant_opaque;
645 private->out = out;
646}
#define F_CIB_CALLID
Definition internal.h:38
int cib__extend_transaction(cib_t *cib, xmlNode *request)
Definition cib_utils.c:758
void cib_native_callback(cib_t *cib, xmlNode *msg, int call_id, int rc)
Definition cib_utils.c:786
#define F_CIB_NOTIFY_TYPE
Definition internal.h:56
#define F_CIB_OPERATION
Definition internal.h:40
cib_t * cib_new_variant(void)
Definition cib_client.c:665
#define T_CIB
Definition internal.h:64
int cib__create_op(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, int call_options, const char *user_name, const char *client_name, xmlNode **op_msg)
Definition cib_utils.c:673
#define F_CIB_CLIENTID
Definition internal.h:36
#define F_CIB_RC
Definition internal.h:44
#define F_CIB_CALLDATA
Definition internal.h:39
#define T_CIB_NOTIFY
Definition internal.h:66
#define F_CIB_NOTIFY_ACTIVATE
Definition internal.h:57
#define T_CIB_COMMAND
Definition internal.h:65
void cib_native_notify(gpointer data, gpointer user_data)
Definition cib_utils.c:835
const char * name
Definition cib.c:26
cib_t * cib_remote_new(const char *server, const char *user, const char *passwd, int port, gboolean encrypted)
Definition cib_remote.c:593
struct cib_remote_opaque_s cib_remote_opaque_t
void cib__set_output(cib_t *cib, pcmk__output_t *out)
Definition cib_remote.c:636
cib_conn_type
Definition cib_types.h:46
@ cib_no_connection
Definition cib_types.h:49
@ cib_command
Definition cib_types.h:47
@ cib_none
Definition cib_types.h:54
@ cib_transaction
Process request when the client commits the active transaction.
Definition cib_types.h:100
@ cib_sync_call
Definition cib_types.h:102
@ cib_discard_reply
Definition cib_types.h:59
@ cib_remote
Definition cib_types.h:32
@ cib_connected_command
Definition cib_types.h:41
@ cib_disconnected
Definition cib_types.h:43
int pcmk__remote_send_xml(pcmk__remote_t *remote, const xmlNode *msg)
Definition remote.c:492
int pcmk__connect_remote(const char *host, int port, int timeout_ms, int *timer_id, int *sock_fd, void *userdata, void(*callback)(void *userdata, int rc, int sock))
Definition remote.c:1068
xmlNode * pcmk__remote_message_xml(pcmk__remote_t *remote)
Definition remote.c:544
int pcmk__read_remote_message(pcmk__remote_t *remote, int timeout_ms)
Definition remote.c:796
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition util.h:99
pcmk__cpg_host_t host
Definition cpg.c:4
enum crm_ais_msg_types type
Definition cpg.c:3
char data[0]
Definition cpg.c:10
A dumping ground.
#define CRM_OP_REGISTER
Definition crm.h:144
#define crm_info(fmt, args...)
Definition logging.h:382
#define crm_warn(fmt, args...)
Definition logging.h:380
#define CRM_XS
Definition logging.h:56
#define crm_log_xml_debug(xml, text)
Definition logging.h:392
#define crm_debug(fmt, args...)
Definition logging.h:384
#define crm_err(fmt, args...)
Definition logging.h:379
#define crm_log_xml_trace(xml, text)
Definition logging.h:393
#define crm_log_xml_warn(xml, text)
Definition logging.h:389
#define crm_trace(fmt, args...)
Definition logging.h:385
Wrappers for and extensions to glib mainloop.
mainloop_io_t * mainloop_add_fd(const char *name, int priority, int fd, void *userdata, struct mainloop_fd_callbacks *callbacks)
Definition mainloop.c:959
#define F_TYPE
Definition msg_xml.h:91
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
Definition nvpair.c:447
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
Definition nvpair.c:483
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
Definition nvpair.c:349
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
Definition nvpair.c:302
Formatted output for pacemaker tools.
void void void void void pcmk__text_prompt(const char *prompt, bool echo, char **dest)
const char * pcmk_strerror(int rc)
Definition results.c:149
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
Definition results.c:501
@ pcmk_rc_ok
Definition results.h:154
#define pcmk_ok
Definition results.h:68
int pcmk_rc2legacy(int rc)
Definition results.c:546
#define pcmk_err_diff_resync
Definition results.h:77
void pcmk__str_update(char **str, const char *value)
Definition strings.c:1193
@ pcmk__str_casei
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition cib_types.h:146
int(* inputfd)(cib_t *cib)
Definition cib_types.h:150
int(* signoff)(cib_t *cib)
Definition cib_types.h:132
int(* end_transaction)(cib_t *cib, bool commit, int call_options)
End and optionally commit this client's CIB transaction.
Definition cib_types.h:314
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition cib_types.h:126
int(* client_id)(const cib_t *cib, const char **async_id, const char **sync_id)
Get the given CIB connection's unique client identifier(s)
Definition cib_types.h:251
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition cib_types.h:200
int(* free)(cib_t *cib)
Definition cib_types.h:133
enum cib_conn_type type
Definition cib_types.h:331
enum cib_state state
Definition cib_types.h:330
GList * notify_list
Definition cib_types.h:339
void * variant_opaque
Definition cib_types.h:336
void * delegate_fn
Definition cib_types.h:337
cib_api_operations_t * cmds
Definition cib_types.h:345
int call_timeout
Definition cib_types.h:335
enum cib_variant variant
Definition cib_types.h:332
char * user
Definition cib_types.h:349
int call_id
Definition cib_types.h:334
int(* dispatch)(gpointer userdata)
Dispatch function for mainloop file descriptor with data ready.
Definition mainloop.h:138
void(* destroy)(gpointer userdata)
Destroy function for mainloop file descriptor client data.
Definition mainloop.h:145
This structure contains everything that makes up a single output formatter.
mainloop_io_t * source
void free_xml(xmlNode *child)
Definition xml.c:783
xmlNode * get_message_xml(const xmlNode *msg, const char *field)
Definition messages.c:154
xmlNode * copy_xml(xmlNode *src_node)
Definition xml.c:789
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition xml.c:638