pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
cib_remote.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-2025 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>
26#include <crm/common/mainloop.h>
27#include <crm/common/xml.h>
31
32#include <gnutls/gnutls.h>
33
34// GnuTLS handshake timeout in seconds
35#define TLS_HANDSHAKE_TIMEOUT 5
36
37static pcmk__tls_t *tls = NULL;
38
39#include <arpa/inet.h>
40
41typedef struct cib_remote_opaque_s {
42 int port;
43 char *server;
44 char *user;
45 char *passwd;
46 gboolean encrypted;
47 pcmk__remote_t command;
48 pcmk__remote_t callback;
49 pcmk__output_t *out;
50 time_t start_time;
51 int timeout_sec;
53
54static int
55cib_remote_perform_op(cib_t *cib, const char *op, const char *host,
56 const char *section, xmlNode *data,
57 xmlNode **output_data, int call_options,
58 const char *user_name)
59{
60 int rc;
61 int remaining_time = 0;
62 time_t start_time;
63
64 xmlNode *op_msg = NULL;
65 xmlNode *op_reply = NULL;
66
67 cib_remote_opaque_t *private = cib->variant_opaque;
68
69 if (cib->state == cib_disconnected) {
70 return -ENOTCONN;
71 }
72
73 if (output_data != NULL) {
74 *output_data = NULL;
75 }
76
77 if (op == NULL) {
78 crm_err("No operation specified");
79 return -EINVAL;
80 }
81
82 rc = cib__create_op(cib, op, host, section, data, call_options, user_name,
83 NULL, &op_msg);
84 if (rc != pcmk_ok) {
85 return rc;
86 }
87
88 if (pcmk_is_set(call_options, cib_transaction)) {
89 rc = cib__extend_transaction(cib, op_msg);
90 pcmk__xml_free(op_msg);
91 return rc;
92 }
93
94 crm_trace("Sending %s message to the CIB manager", op);
95 if (!(call_options & cib_sync_call)) {
96 pcmk__remote_send_xml(&private->callback, op_msg);
97 } else {
98 pcmk__remote_send_xml(&private->command, op_msg);
99 }
100 pcmk__xml_free(op_msg);
101
102 if ((call_options & cib_discard_reply)) {
103 crm_trace("Discarding reply");
104 return pcmk_ok;
105
106 } else if (!(call_options & cib_sync_call)) {
107 return cib->call_id;
108 }
109
110 crm_trace("Waiting for a synchronous reply");
111
112 start_time = time(NULL);
113 remaining_time = cib->call_timeout ? cib->call_timeout : 60;
114
115 rc = pcmk_rc_ok;
116 while (remaining_time > 0 && (rc != ENOTCONN)) {
117 int reply_id = -1;
118 int msg_id = cib->call_id;
119
120 rc = pcmk__read_remote_message(&private->command,
121 remaining_time * 1000);
122 op_reply = pcmk__remote_message_xml(&private->command);
123
124 if (!op_reply) {
125 break;
126 }
127
128 crm_element_value_int(op_reply, PCMK__XA_CIB_CALLID, &reply_id);
129
130 if (reply_id == msg_id) {
131 break;
132
133 } else if (reply_id < msg_id) {
134 crm_debug("Received old reply: %d (wanted %d)", reply_id, msg_id);
135 crm_log_xml_trace(op_reply, "Old reply");
136
137 } else if ((reply_id - 10000) > msg_id) {
138 /* wrap-around case */
139 crm_debug("Received old reply: %d (wanted %d)", reply_id, msg_id);
140 crm_log_xml_trace(op_reply, "Old reply");
141 } else {
142 crm_err("Received a __future__ reply:" " %d (wanted %d)", reply_id, msg_id);
143 }
144
145 pcmk__xml_free(op_reply);
146 op_reply = NULL;
147
148 /* wasn't the right reply, try and read some more */
149 remaining_time = time(NULL) - start_time;
150 }
151
152 if (rc == ENOTCONN) {
153 crm_err("Disconnected while waiting for reply.");
154 return -ENOTCONN;
155 } else if (op_reply == NULL) {
156 crm_err("No reply message - empty");
157 return -ENOMSG;
158 }
159
160 crm_trace("Synchronous reply received");
161
162 /* Start processing the reply... */
163 if (crm_element_value_int(op_reply, PCMK__XA_CIB_RC, &rc) != 0) {
164 rc = -EPROTO;
165 }
166
167 if (rc == -pcmk_err_diff_resync) {
168 /* This is an internal value that clients do not and should not care about */
169 rc = pcmk_ok;
170 }
171
172 if (rc == pcmk_ok || rc == -EPERM) {
173 crm_log_xml_debug(op_reply, "passed");
174
175 } else {
176 crm_err("Call failed: %s", pcmk_strerror(rc));
177 crm_log_xml_warn(op_reply, "failed");
178 }
179
180 if (output_data == NULL) {
181 /* do nothing more */
182
183 } else if (!(call_options & cib_discard_reply)) {
184 xmlNode *wrapper = pcmk__xe_first_child(op_reply, PCMK__XE_CIB_CALLDATA,
185 NULL, NULL);
186 xmlNode *tmp = pcmk__xe_first_child(wrapper, NULL, NULL, NULL);
187
188 if (tmp == NULL) {
189 crm_trace("No output in reply to \"%s\" command %d", op, cib->call_id - 1);
190 } else {
191 *output_data = pcmk__xml_copy(NULL, tmp);
192 }
193 }
194
195 pcmk__xml_free(op_reply);
196
197 return rc;
198}
199
200static int
201cib_remote_callback_dispatch(gpointer user_data)
202{
203 int rc;
204 cib_t *cib = user_data;
205 cib_remote_opaque_t *private = cib->variant_opaque;
206
207 xmlNode *msg = NULL;
208 const char *type = NULL;
209
210 /* If start time is 0, we've previously handled a complete message and this
211 * connection is being reused for a new message. Reset the start_time,
212 * giving this new message timeout_sec from now to complete.
213 */
214 if (private->start_time == 0) {
215 private->start_time = time(NULL);
216 }
217
218 rc = pcmk__read_available_remote_data(&private->callback);
219 switch (rc) {
220 case pcmk_rc_ok:
221 /* We have the whole message so process it */
222 break;
223
224 case EAGAIN:
225 /* Have we timed out? */
226 if (time(NULL) >= private->start_time + private->timeout_sec) {
227 crm_info("Error reading from CIB manager connection: %s",
229 return -1;
230 }
231
232 /* We haven't read the whole message yet */
233 return 0;
234
235 default:
236 /* Error */
237 crm_info("Error reading from CIB manager connection: %s",
238 pcmk_rc_str(rc));
239 return -1;
240 }
241
242 // coverity[tainted_data] This can't easily be changed right now
243 msg = pcmk__remote_message_xml(&private->callback);
244 if (msg == NULL) {
245 private->start_time = 0;
246 return 0;
247 }
248
250
251 crm_trace("Activating %s callbacks...", type);
252
253 if (pcmk__str_eq(type, PCMK__VALUE_CIB, pcmk__str_none)) {
254 cib_native_callback(cib, msg, 0, 0);
255 } else if (pcmk__str_eq(type, PCMK__VALUE_CIB_NOTIFY, pcmk__str_none)) {
256 g_list_foreach(cib->notify_list, cib_native_notify, msg);
257 } else {
258 crm_err("Unknown message type: %s", type);
259 }
260
261 pcmk__xml_free(msg);
262 private->start_time = 0;
263 return 0;
264}
265
266static int
267cib_remote_command_dispatch(gpointer user_data)
268{
269 int rc;
270 cib_t *cib = user_data;
271 cib_remote_opaque_t *private = cib->variant_opaque;
272
273 /* See cib_remote_callback_dispatch */
274 if (private->start_time == 0) {
275 private->start_time = time(NULL);
276 }
277
278 rc = pcmk__read_available_remote_data(&private->command);
279 if (rc == EAGAIN) {
280 /* Have we timed out? */
281 if (time(NULL) >= private->start_time + private->timeout_sec) {
282 crm_info("Error reading from CIB manager connection: %s",
284 return -1;
285 }
286
287 /* We haven't read the whole message yet */
288 return 0;
289 }
290
291 free(private->command.buffer);
292 private->command.buffer = NULL;
293 crm_err("received late reply for remote cib connection, discarding");
294
295 if (rc != pcmk_rc_ok) {
296 crm_info("Error reading from CIB manager connection: %s",
297 pcmk_rc_str(rc));
298 return -1;
299 }
300
301 private->start_time = 0;
302 return 0;
303}
304
305static int
306cib_tls_close(cib_t *cib)
307{
308 cib_remote_opaque_t *private = cib->variant_opaque;
309
310 if (private->encrypted) {
311 if (private->command.tls_session) {
312 gnutls_bye(private->command.tls_session, GNUTLS_SHUT_RDWR);
313 gnutls_deinit(private->command.tls_session);
314 }
315
316 if (private->callback.tls_session) {
317 gnutls_bye(private->callback.tls_session, GNUTLS_SHUT_RDWR);
318 gnutls_deinit(private->callback.tls_session);
319 }
320
321 private->command.tls_session = NULL;
322 private->callback.tls_session = NULL;
323 pcmk__free_tls(tls);
324 tls = NULL;
325 }
326
327 if (private->command.tcp_socket >= 0) {
328 shutdown(private->command.tcp_socket, SHUT_RDWR); /* no more receptions */
329 close(private->command.tcp_socket);
330 }
331 if (private->callback.tcp_socket >= 0) {
332 shutdown(private->callback.tcp_socket, SHUT_RDWR); /* no more receptions */
333 close(private->callback.tcp_socket);
334 }
335 private->command.tcp_socket = -1;
336 private->callback.tcp_socket = -1;
337
338 free(private->command.buffer);
339 free(private->callback.buffer);
340 private->command.buffer = NULL;
341 private->callback.buffer = NULL;
342
343 return 0;
344}
345
346static void
347cib_remote_connection_destroy(gpointer user_data)
348{
349 crm_err("Connection destroyed");
350 cib_tls_close(user_data);
351}
352
353static int
354cib_tls_signon(cib_t *cib, pcmk__remote_t *connection, gboolean event_channel)
355{
356 cib_remote_opaque_t *private = cib->variant_opaque;
357 int rc;
358
359 xmlNode *answer = NULL;
360 xmlNode *login = NULL;
361
362 static struct mainloop_fd_callbacks cib_fd_callbacks = { 0, };
363
364 cib_fd_callbacks.dispatch =
365 event_channel ? cib_remote_callback_dispatch : cib_remote_command_dispatch;
366 cib_fd_callbacks.destroy = cib_remote_connection_destroy;
367
368 connection->tcp_socket = -1;
369 connection->tls_session = NULL;
370 rc = pcmk__connect_remote(private->server, private->port, 0, NULL,
371 &(connection->tcp_socket), NULL, NULL);
372 if (rc != pcmk_rc_ok) {
373 crm_info("Remote connection to %s:%d failed: %s " QB_XS " rc=%d",
374 private->server, private->port, pcmk_rc_str(rc), rc);
375 return -ENOTCONN;
376 }
377
378 if (private->encrypted) {
379 bool use_cert = pcmk__x509_enabled();
380 int tls_rc = GNUTLS_E_SUCCESS;
381
382 rc = pcmk__init_tls(&tls, false, use_cert ? GNUTLS_CRD_CERTIFICATE : GNUTLS_CRD_ANON);
383 if (rc != pcmk_rc_ok) {
384 return -1;
385 }
386
387 /* bind the socket to GnuTls lib */
388 connection->tls_session = pcmk__new_tls_session(tls, connection->tcp_socket);
389 if (connection->tls_session == NULL) {
390 cib_tls_close(cib);
391 return -1;
392 }
393
395 &tls_rc);
396 if (rc != pcmk_rc_ok) {
397 crm_err("Remote CIB session creation for %s:%d failed: %s",
398 private->server, private->port,
399 (rc == EPROTO)? gnutls_strerror(tls_rc) : pcmk_rc_str(rc));
400 gnutls_deinit(connection->tls_session);
401 connection->tls_session = NULL;
402 cib_tls_close(cib);
403 return -1;
404 }
405 }
406
407 /* Now that the handshake is done, see if any client TLS certificate is
408 * close to its expiration date and log if so. If a TLS certificate is not
409 * in use, this function will just return so we don't need to check for the
410 * session type here.
411 */
413
414 /* login to server */
416 crm_xml_add(login, PCMK_XA_OP, "authenticate");
417 crm_xml_add(login, PCMK_XA_USER, private->user);
418 crm_xml_add(login, PCMK__XA_PASSWORD, private->passwd);
420
421 pcmk__remote_send_xml(connection, login);
422 pcmk__xml_free(login);
423
424 rc = pcmk_ok;
425 if (pcmk__read_remote_message(connection, -1) == ENOTCONN) {
426 rc = -ENOTCONN;
427 }
428
429 answer = pcmk__remote_message_xml(connection);
430
431 crm_log_xml_trace(answer, "Reply");
432 if (answer == NULL) {
433 rc = -EPROTO;
434
435 } else {
436 /* grab the token */
437 const char *msg_type = crm_element_value(answer, PCMK__XA_CIB_OP);
438 const char *tmp_ticket = crm_element_value(answer,
440
441 if (!pcmk__str_eq(msg_type, CRM_OP_REGISTER, pcmk__str_casei)) {
442 crm_err("Invalid registration message: %s", msg_type);
443 rc = -EPROTO;
444
445 } else if (tmp_ticket == NULL) {
446 rc = -EPROTO;
447
448 } else {
449 connection->token = strdup(tmp_ticket);
450 }
451 }
452 pcmk__xml_free(answer);
453 answer = NULL;
454
455 if (rc != 0) {
456 cib_tls_close(cib);
457 return rc;
458 }
459
460 crm_trace("remote client connection established");
461 private->timeout_sec = 60;
462 connection->source = mainloop_add_fd("cib-remote", G_PRIORITY_HIGH,
463 connection->tcp_socket, cib,
464 &cib_fd_callbacks);
465 return rc;
466}
467
468static int
469cib_remote_signon(cib_t *cib, const char *name, enum cib_conn_type type)
470{
471 int rc = pcmk_ok;
472 cib_remote_opaque_t *private = cib->variant_opaque;
473
474 if (name == NULL) {
475 name = pcmk__s(crm_system_name, "client");
476 }
477
478 if (private->passwd == NULL) {
479 if (private->out == NULL) {
480 /* If no pcmk__output_t is set, just assume that a text prompt
481 * is good enough.
482 */
483 pcmk__text_prompt("Password", false, &(private->passwd));
484 } else {
485 private->out->prompt("Password", false, &(private->passwd));
486 }
487 }
488
489 if (private->server == NULL || private->user == NULL) {
490 rc = -EINVAL;
491 goto done;
492 }
493
494 rc = cib_tls_signon(cib, &(private->command), FALSE);
495 if (rc != pcmk_ok) {
496 goto done;
497 }
498
499 rc = cib_tls_signon(cib, &(private->callback), TRUE);
500
501done:
502 if (rc == pcmk_ok) {
503 crm_info("Opened connection to %s:%d for %s",
504 private->server, private->port, name);
506 cib->type = cib_command;
507
508 } else {
509 crm_info("Connection to %s:%d for %s failed: %s\n",
510 private->server, private->port, name, pcmk_strerror(rc));
511 }
512
513 return rc;
514}
515
516static int
517cib_remote_signoff(cib_t *cib)
518{
519 int rc = pcmk_ok;
520
521 crm_debug("Disconnecting from the CIB manager");
522 cib_tls_close(cib);
523
524 cib->cmds->end_transaction(cib, false, cib_none);
525 cib->state = cib_disconnected;
526 cib->type = cib_no_connection;
527
528 return rc;
529}
530
531static int
532cib_remote_free(cib_t *cib)
533{
534 int rc = pcmk_ok;
535
536 crm_warn("Freeing CIB");
537 if (cib->state != cib_disconnected) {
538 rc = cib_remote_signoff(cib);
539 if (rc == pcmk_ok) {
540 cib_remote_opaque_t *private = cib->variant_opaque;
541
542 free(private->server);
543 free(private->user);
544 free(private->passwd);
545 free(cib->cmds);
546 free(cib->user);
547 free(private);
548 free(cib);
549 }
550 }
551
552 return rc;
553}
554
555static int
556cib_remote_register_notification(cib_t * cib, const char *callback, int enabled)
557{
558 xmlNode *notify_msg = pcmk__xe_create(NULL, PCMK__XE_CIB_COMMAND);
559 cib_remote_opaque_t *private = cib->variant_opaque;
560
562 crm_xml_add(notify_msg, PCMK__XA_CIB_NOTIFY_TYPE, callback);
563 crm_xml_add_int(notify_msg, PCMK__XA_CIB_NOTIFY_ACTIVATE, enabled);
564 pcmk__remote_send_xml(&private->callback, notify_msg);
565 pcmk__xml_free(notify_msg);
566 return pcmk_ok;
567}
568
569static int
570cib_remote_set_connection_dnotify(cib_t * cib, void (*dnotify) (gpointer user_data))
571{
572 return -EPROTONOSUPPORT;
573}
574
592static int
593cib_remote_client_id(const cib_t *cib, const char **async_id,
594 const char **sync_id)
595{
596 cib_remote_opaque_t *private = cib->variant_opaque;
597
598 if (async_id != NULL) {
599 // private->callback is the channel for async requests
600 *async_id = private->callback.token;
601 }
602 if (sync_id != NULL) {
603 // private->command is the channel for sync requests
604 *sync_id = private->command.token;
605 }
606 return pcmk_ok;
607}
608
609cib_t *
610cib_remote_new(const char *server, const char *user, const char *passwd, int port,
611 gboolean encrypted)
612{
613 cib_remote_opaque_t *private = NULL;
614 cib_t *cib = cib_new_variant();
615
616 if (cib == NULL) {
617 return NULL;
618 }
619
620 private = calloc(1, sizeof(cib_remote_opaque_t));
621
622 if (private == NULL) {
623 free(cib);
624 return NULL;
625 }
626
627 cib->variant = cib_remote;
628 cib->variant_opaque = private;
629
630 private->server = pcmk__str_copy(server);
631 private->user = pcmk__str_copy(user);
632 private->passwd = pcmk__str_copy(passwd);
633 private->port = port;
634 private->encrypted = encrypted;
635
636 /* assign variant specific ops */
637 cib->delegate_fn = cib_remote_perform_op;
638 cib->cmds->signon = cib_remote_signon;
639 cib->cmds->signoff = cib_remote_signoff;
640 cib->cmds->free = cib_remote_free;
641 cib->cmds->register_notification = cib_remote_register_notification;
642 cib->cmds->set_connection_dnotify = cib_remote_set_connection_dnotify;
643
644 cib->cmds->client_id = cib_remote_client_id;
645
646 return cib;
647}
648
649void
651{
652 cib_remote_opaque_t *private;
653
654 if (cib->variant != cib_remote) {
655 return;
656 }
657
658 private = cib->variant_opaque;
659 private->out = out;
660}
int cib__extend_transaction(cib_t *cib, xmlNode *request)
Definition cib_utils.c:637
void cib_native_callback(cib_t *cib, xmlNode *msg, int call_id, int rc)
Definition cib_utils.c:665
cib_t * cib_new_variant(void)
Definition cib_client.c:622
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:558
void cib_native_notify(gpointer data, gpointer user_data)
Definition cib_utils.c:713
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:610
struct cib_remote_opaque_s cib_remote_opaque_t
void cib__set_output(cib_t *cib, pcmk__output_t *out)
Definition cib_remote.c:650
#define TLS_HANDSHAKE_TIMEOUT
Definition cib_remote.c:35
cib_conn_type
Definition cib_types.h:45
@ cib_no_connection
Definition cib_types.h:51
@ cib_command
Definition cib_types.h:46
@ cib_none
Definition cib_types.h:56
@ cib_transaction
Process request when the client commits the active transaction.
Definition cib_types.h:87
@ cib_sync_call
Definition cib_types.h:112
@ cib_discard_reply
Definition cib_types.h:61
@ cib_remote
Definition cib_types.h:32
@ cib_connected_command
Definition cib_types.h:37
@ cib_disconnected
Definition cib_types.h:42
int pcmk__read_available_remote_data(pcmk__remote_t *remote)
Definition remote.c:434
int pcmk__remote_send_xml(pcmk__remote_t *remote, const xmlNode *msg)
Definition remote.c:239
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:805
xmlNode * pcmk__remote_message_xml(pcmk__remote_t *remote)
Definition remote.c:292
int pcmk__read_remote_message(pcmk__remote_t *remote, int timeout_ms)
Definition remote.c:527
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition util.h:80
pcmk__cpg_host_t host
Definition cpg.c:4
char data[0]
Definition cpg.c:10
enum pcmk_ipc_server type
Definition cpg.c:3
A dumping ground.
#define CRM_OP_REGISTER
Definition crm.h:122
char * crm_system_name
Definition utils.c:45
#define crm_info(fmt, args...)
Definition logging.h:365
#define crm_warn(fmt, args...)
Definition logging.h:360
#define crm_log_xml_debug(xml, text)
Definition logging.h:377
#define crm_debug(fmt, args...)
Definition logging.h:368
#define crm_err(fmt, args...)
Definition logging.h:357
#define crm_log_xml_trace(xml, text)
Definition logging.h:378
#define crm_log_xml_warn(xml, text)
Definition logging.h:374
#define crm_trace(fmt, args...)
Definition logging.h:370
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:962
#define PCMK__VALUE_PASSWORD
#define PCMK__VALUE_CIB
#define PCMK__VALUE_CIB_NOTIFY
Formatted output for pacemaker tools.
void void void void void pcmk__text_prompt(const char *prompt, bool echo, char **dest)
#define ETIME
Definition portability.h:66
const char * pcmk_strerror(int rc)
Definition results.c:257
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
Definition results.c:617
@ pcmk_rc_ok
Definition results.h:159
#define pcmk_ok
Definition results.h:65
#define pcmk_err_diff_resync
Definition results.h:79
@ pcmk__str_none
@ pcmk__str_casei
#define pcmk__str_copy(str)
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition cib_types.h:141
int(* signoff)(cib_t *cib)
Definition cib_types.h:127
int(* end_transaction)(cib_t *cib, bool commit, int call_options)
End and optionally commit this client's CIB transaction.
Definition cib_types.h:292
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition cib_types.h:124
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:229
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition cib_types.h:178
int(* free)(cib_t *cib)
Definition cib_types.h:129
enum cib_conn_type type
Definition cib_types.h:314
enum cib_state state
Definition cib_types.h:312
GList * notify_list
Definition cib_types.h:322
void * variant_opaque
Definition cib_types.h:319
void * delegate_fn
Definition cib_types.h:320
cib_api_operations_t * cmds
Definition cib_types.h:325
int call_timeout
Definition cib_types.h:318
enum cib_variant variant
Definition cib_types.h:315
char * user
Definition cib_types.h:329
int call_id
Definition cib_types.h:317
int(* dispatch)(gpointer userdata)
Dispatch function for mainloop file descriptor with data ready.
Definition mainloop.h:151
void(* destroy)(gpointer userdata)
Destroy function for mainloop file descriptor client data.
Definition mainloop.h:158
This structure contains everything that makes up a single output formatter.
gnutls_session_t tls_session
mainloop_io_t * source
void pcmk__free_tls(pcmk__tls_t *tls)
Definition tls.c:149
bool pcmk__x509_enabled(void)
Definition tls.c:560
int pcmk__init_tls(pcmk__tls_t **tls, bool server, gnutls_credentials_type_t cred_type)
Definition tls.c:183
int pcmk__tls_client_handshake(pcmk__remote_t *remote, int timeout_sec, int *gnutls_rc)
Definition tls.c:543
void pcmk__tls_check_cert_expiration(gnutls_session_t session)
Definition tls.c:469
gnutls_session_t pcmk__new_tls_session(pcmk__tls_t *tls, int csock)
Definition tls.c:317
Wrappers for and extensions to libxml2.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
Definition xml_element.c:43
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
Definition xml.c:832
void pcmk__xml_free(xmlNode *xml)
Definition xml.c:816
#define PCMK_XA_USER
Definition xml_names.h:439
#define PCMK_XA_OP
Definition xml_names.h:347
#define PCMK__XA_HIDDEN
#define PCMK__XA_CIB_NOTIFY_ACTIVATE
#define PCMK__XA_CIB_OP
#define PCMK__XA_CIB_NOTIFY_TYPE
#define PCMK__XA_CIB_CALLID
#define PCMK__XA_CIB_CLIENTID
#define PCMK__XA_PASSWORD
#define PCMK__XE_CIB_COMMAND
#define PCMK__XA_CIB_RC
#define PCMK__XA_T
#define PCMK__XE_CIB_CALLDATA