corosync  3.0.3
lib/cfg.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2018 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  *
9  * This software licensed under BSD license, the text of which follows:
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * - Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * - Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  * - Neither the name of the MontaVista Software, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33  * THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #include <config.h>
37 
38 #include <stdio.h>
39 #include <string.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <errno.h>
43 #include <pthread.h>
44 #include <limits.h>
45 #include <sys/types.h>
46 #include <sys/socket.h>
47 #include <sys/select.h>
48 #include <sys/un.h>
49 #include <sys/uio.h>
50 
51 #include <qb/qbipcc.h>
52 
53 #include <corosync/corotypes.h>
54 #include <corosync/corodefs.h>
55 #include <corosync/hdb.h>
56 
57 #include <corosync/cfg.h>
58 #include <corosync/ipc_cfg.h>
59 
60 #include "util.h"
61 
62 /*
63  * Data structure for instance data
64  */
65 struct cfg_inst {
66  qb_ipcc_connection_t *c;
70  int finalize;
71 };
72 
73 /*
74  * All instances in one database
75  */
76 static void cfg_inst_free (void *inst);
77 
78 DECLARE_HDB_DATABASE (cfg_hdb, cfg_inst_free);
79 
80 /*
81  * Implementation
82  */
83 
86  corosync_cfg_handle_t *cfg_handle,
87  const corosync_cfg_callbacks_t *cfg_callbacks)
88 {
89  struct cfg_inst *cfg_inst;
90  cs_error_t error = CS_OK;
91 
92  error = hdb_error_to_cs (hdb_handle_create (&cfg_hdb, sizeof (struct cfg_inst), cfg_handle));
93  if (error != CS_OK) {
94  goto error_no_destroy;
95  }
96 
97  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, *cfg_handle, (void *)&cfg_inst));
98  if (error != CS_OK) {
99  goto error_destroy;
100  }
101 
102  cfg_inst->finalize = 0;
103  cfg_inst->c = qb_ipcc_connect ("cfg", IPC_REQUEST_SIZE);
104  if (cfg_inst->c == NULL) {
105  error = qb_to_cs_error(-errno);
106  goto error_put_destroy;
107  }
108 
109  if (cfg_callbacks) {
110  memcpy (&cfg_inst->callbacks, cfg_callbacks, sizeof (corosync_cfg_callbacks_t));
111  }
112 
113  (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
114 
115  return (CS_OK);
116 
117 error_put_destroy:
118  (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
119 error_destroy:
120  (void)hdb_handle_destroy (&cfg_hdb, *cfg_handle);
121 error_no_destroy:
122  return (error);
123 }
124 
127  corosync_cfg_handle_t cfg_handle,
128  int32_t *selection_fd)
129 {
130  struct cfg_inst *cfg_inst;
131  cs_error_t error;
132 
133  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
134  if (error != CS_OK) {
135  return (error);
136  }
137 
138  error = qb_to_cs_error (qb_ipcc_fd_get (cfg_inst->c, selection_fd));
139 
140  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
141  return (error);
142 }
143 
146  corosync_cfg_handle_t cfg_handle,
147  cs_dispatch_flags_t dispatch_flags)
148 {
149  int timeout = -1;
150  cs_error_t error;
151  int cont = 1; /* always continue do loop except when set to 0 */
152  struct cfg_inst *cfg_inst;
154  corosync_cfg_callbacks_t callbacks;
155  struct qb_ipc_response_header *dispatch_data;
156  char dispatch_buf[IPC_DISPATCH_SIZE];
157 
158  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle,
159  (void *)&cfg_inst));
160  if (error != CS_OK) {
161  return (error);
162  }
163 
164  /*
165  * Timeout instantly for CS_DISPATCH_ONE_NONBLOCKING or CS_DISPATCH_ALL and
166  * wait indefinately for CS_DISPATCH_ONE or CS_DISPATCH_BLOCKING
167  */
168  if (dispatch_flags == CS_DISPATCH_ALL || dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
169  timeout = 0;
170  }
171 
172  dispatch_data = (struct qb_ipc_response_header *)dispatch_buf;
173  do {
174  error = qb_to_cs_error (qb_ipcc_event_recv (
175  cfg_inst->c,
176  dispatch_buf,
178  timeout));
179  if (error == CS_ERR_BAD_HANDLE) {
180  error = CS_OK;
181  goto error_put;
182  }
183  if (error == CS_ERR_TRY_AGAIN) {
184  if (dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
185  /*
186  * Don't mask error
187  */
188  goto error_put;
189  }
190  error = CS_OK;
191  if (dispatch_flags == CS_DISPATCH_ALL) {
192  break; /* exit do while cont is 1 loop */
193  } else {
194  continue; /* next poll */
195  }
196  }
197  if (error != CS_OK) {
198  goto error_put;
199  }
200 
201  /*
202  * Make copy of callbacks, message data, unlock instance, and call callback
203  * A risk of this dispatch method is that the callback routines may
204  * operate at the same time that cfgFinalize has been called in another thread.
205  */
206  memcpy (&callbacks, &cfg_inst->callbacks, sizeof (corosync_cfg_callbacks_t));
207 
208  /*
209  * Dispatch incoming response
210  */
211  switch (dispatch_data->id) {
213  if (callbacks.corosync_cfg_shutdown_callback == NULL) {
214  break;
215  }
216 
217  res_lib_cfg_testshutdown = (struct res_lib_cfg_testshutdown *)dispatch_data;
219  break;
220  default:
221  error = CS_ERR_LIBRARY;
222  goto error_nounlock;
223  break;
224  }
225  if (cfg_inst->finalize) {
226  /*
227  * If the finalize has been called then get out of the dispatch.
228  */
229  error = CS_ERR_BAD_HANDLE;
230  goto error_put;
231  }
232 
233  /*
234  * Determine if more messages should be processed
235  */
236  if (dispatch_flags == CS_DISPATCH_ONE || dispatch_flags == CS_DISPATCH_ONE_NONBLOCKING) {
237  cont = 0;
238  }
239  } while (cont);
240 
241 error_put:
242  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
243 error_nounlock:
244  return (error);
245 }
246 
247 static void cfg_inst_free (void *inst)
248 {
249  struct cfg_inst *cfg_inst = (struct cfg_inst *)inst;
250  qb_ipcc_disconnect(cfg_inst->c);
251 }
252 
255  corosync_cfg_handle_t cfg_handle)
256 {
257  struct cfg_inst *cfg_inst;
258  cs_error_t error;
259 
260  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
261  if (error != CS_OK) {
262  return (error);
263  }
264 
265  /*
266  * Another thread has already started finalizing
267  */
268  if (cfg_inst->finalize) {
269  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
270  return (CS_ERR_BAD_HANDLE);
271  }
272 
273  cfg_inst->finalize = 1;
274 
275  (void)hdb_handle_destroy (&cfg_hdb, cfg_handle);
276 
277  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
278 
279  return (error);
280 }
281 
284  corosync_cfg_handle_t cfg_handle,
285  char ***interface_names,
286  char ***status,
287  unsigned int *interface_count)
288 {
289  struct cfg_inst *cfg_inst;
292  unsigned int i, j;
293  cs_error_t error;
294  struct iovec iov;
295 
296  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
297  if (error != CS_OK) {
298  return (error);
299  }
300 
301  req_lib_cfg_ringstatusget.header.size = sizeof (struct req_lib_cfg_ringstatusget);
303 
304  iov.iov_base = (void *)&req_lib_cfg_ringstatusget,
305  iov.iov_len = sizeof (struct req_lib_cfg_ringstatusget),
306 
307  error = qb_to_cs_error (qb_ipcc_sendv_recv(cfg_inst->c,
308  &iov,
309  1,
311  sizeof (struct res_lib_cfg_ringstatusget), CS_IPC_TIMEOUT_MS));
312 
313  if (error != CS_OK) {
314  goto exit_handle_put;
315  }
316 
317  *interface_count = res_lib_cfg_ringstatusget.interface_count;
318  *interface_names = malloc (sizeof (char *) * *interface_count);
319  if (*interface_names == NULL) {
320  return (CS_ERR_NO_MEMORY);
321  }
322  memset (*interface_names, 0, sizeof (char *) * *interface_count);
323 
324  *status = malloc (sizeof (char *) * *interface_count);
325  if (*status == NULL) {
326  error = CS_ERR_NO_MEMORY;
327  goto error_free_interface_names_array;
328  }
329  memset (*status, 0, sizeof (char *) * *interface_count);
330 
331  for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
332  (*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]);
333  if ((*(interface_names))[i] == NULL) {
334  error = CS_ERR_NO_MEMORY;
335  goto error_free_interface_names;
336  }
337  }
338 
339  for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
340  (*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]);
341  if ((*(status))[i] == NULL) {
342  error = CS_ERR_NO_MEMORY;
343  goto error_free_status;
344  }
345  }
346  goto exit_handle_put;
347 
348 error_free_status:
349  for (j = 0; j < i; j++) {
350  free ((*(status))[j]);
351  }
352  i = *interface_count;
353 
354 error_free_interface_names:
355  for (j = 0; j < i; j++) {
356  free ((*(interface_names))[j]);
357  }
358 
359  free (*status);
360 
361 error_free_interface_names_array:
362  free (*interface_names);
363 
364 exit_handle_put:
365  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
366 
367  return (error);
368 }
369 
372  corosync_cfg_handle_t cfg_handle,
373  unsigned int nodeid,
374  const char *reason)
375 {
376  struct cfg_inst *cfg_inst;
379  cs_error_t error;
380  struct iovec iov;
381 
382  if (strlen(reason) >= CS_MAX_NAME_LENGTH)
383  return CS_ERR_NAME_TOO_LONG;
384 
385  error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle,
386  (void *)&cfg_inst));
387  if (error != CS_OK) {
388  return (error);
389  }
390 
392  req_lib_cfg_killnode.header.size = sizeof (struct req_lib_cfg_killnode);
393  req_lib_cfg_killnode.nodeid = nodeid;
394  strcpy((char *)req_lib_cfg_killnode.reason.value, reason);
395  req_lib_cfg_killnode.reason.length = strlen(reason)+1;
396 
397  iov.iov_base = (void *)&req_lib_cfg_killnode;
398  iov.iov_len = sizeof (struct req_lib_cfg_killnode);
399 
400  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
401  &iov,
402  1,
404  sizeof (struct res_lib_cfg_killnode), CS_IPC_TIMEOUT_MS));
405 
406  error = res_lib_cfg_killnode.header.error;
407 
408  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
409 
410  return (error == CS_OK ? res_lib_cfg_killnode.header.error : error);
411 }
412 
415  corosync_cfg_handle_t cfg_handle,
417 {
418  struct cfg_inst *cfg_inst;
421  cs_error_t error;
422  struct iovec iov;
423 
424  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
425  (void *)&cfg_inst));
426  if (error != CS_OK) {
427  return (error);
428  }
429 
431  req_lib_cfg_tryshutdown.header.size = sizeof (struct req_lib_cfg_tryshutdown);
433 
434  iov.iov_base = (void *)&req_lib_cfg_tryshutdown;
435  iov.iov_len = sizeof (req_lib_cfg_tryshutdown);
436 
437  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
438  &iov,
439  1,
441  sizeof (struct res_lib_cfg_tryshutdown), CS_IPC_TIMEOUT_MS));
442 
443  (void)hdb_handle_put (&cfg_hdb, cfg_handle);
444 
445  return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error);
446 }
447 
450  corosync_cfg_handle_t cfg_handle,
452 {
453  struct cfg_inst *cfg_inst;
456  struct iovec iov;
457  cs_error_t error;
458 
459  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
460  (void *)&cfg_inst));
461  if (error != CS_OK) {
462  return (error);
463  }
464 
466  req_lib_cfg_replytoshutdown.header.size = sizeof (struct req_lib_cfg_replytoshutdown);
468 
469  iov.iov_base = (void *)&req_lib_cfg_replytoshutdown;
470  iov.iov_len = sizeof (struct req_lib_cfg_replytoshutdown);
471 
472  error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
473  &iov,
474  1,
477 
478  return (error);
479 }
480 
482  corosync_cfg_handle_t cfg_handle,
483  unsigned int nodeid,
484  size_t max_addrs,
485  int *num_addrs,
487 {
488  cs_error_t error;
491  struct cfg_inst *cfg_inst;
492  int addrlen = 0;
493  int i;
494  struct iovec iov;
495  const char *addr_buf;
496  char response_buf[IPC_RESPONSE_SIZE];
497  char zeroes[sizeof(struct sockaddr_storage)];
498 
499  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, cfg_handle,
500  (void *)&cfg_inst));
501  if (error != CS_OK) {
502  return (error);
503  }
504  memset(zeroes, 0, sizeof(zeroes));
505 
509 
510  iov.iov_base = (char *)&req_lib_cfg_get_node_addrs;
511  iov.iov_len = sizeof (req_lib_cfg_get_node_addrs);
512 
513  error = qb_to_cs_error (qb_ipcc_sendv_recv (
514  cfg_inst->c,
515  &iov, 1,
516  response_buf, IPC_RESPONSE_SIZE, CS_IPC_TIMEOUT_MS));
518 
519  if (error != CS_OK) {
520  goto error_put;
521  }
522 
523  if (res_lib_cfg_get_node_addrs->family == AF_INET)
524  addrlen = sizeof(struct sockaddr_in);
525  if (res_lib_cfg_get_node_addrs->family == AF_INET6)
526  addrlen = sizeof(struct sockaddr_in6);
527 
528  for (i = 0, addr_buf = (char *)res_lib_cfg_get_node_addrs->addrs;
529  i < max_addrs && i<res_lib_cfg_get_node_addrs->num_addrs;
530  i++, addr_buf += TOTEMIP_ADDRLEN) {
531  struct sockaddr_in *in;
532  struct sockaddr_in6 *in6;
533 
534  addrs[i].address_length = addrlen;
535 
536  if (res_lib_cfg_get_node_addrs->family == AF_INET) {
537  in = (struct sockaddr_in *)addrs[i].address;
538  if (memcmp(addr_buf, zeroes, addrlen) == 0) {
539  in->sin_family = 0;
540  } else {
541  in->sin_family = AF_INET;
542  }
543  memcpy(&in->sin_addr, addr_buf, sizeof(struct in_addr));
544  }
545  if (res_lib_cfg_get_node_addrs->family == AF_INET6) {
546  in6 = (struct sockaddr_in6 *)addrs[i].address;
547 
548  if (memcmp(addr_buf, zeroes, addrlen) == 0) {
549  in6->sin6_family = 0;
550  } else {
551  in6->sin6_family = AF_INET6;
552  }
553  memcpy(&in6->sin6_addr, addr_buf, sizeof(struct in6_addr));
554  }
555 
556  /* Mark it as unused */
557 
558  }
560  errno = error = res_lib_cfg_get_node_addrs->header.error;
561 
562 error_put:
563  hdb_handle_put (&cfg_hdb, cfg_handle);
564 
565  return (error);
566 }
567 
569  corosync_cfg_handle_t handle,
570  unsigned int *local_nodeid)
571 {
572  cs_error_t error;
573  struct cfg_inst *cfg_inst;
574  struct iovec iov;
577 
578  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
579  if (error != CS_OK) {
580  return (error);
581  }
582 
583  req_lib_cfg_local_get.header.size = sizeof (struct qb_ipc_request_header);
585 
586  iov.iov_base = (void *)&req_lib_cfg_local_get;
587  iov.iov_len = sizeof (struct req_lib_cfg_local_get);
588 
589  error = qb_to_cs_error (qb_ipcc_sendv_recv (
590  cfg_inst->c,
591  &iov,
592  1,
594  sizeof (struct res_lib_cfg_local_get), CS_IPC_TIMEOUT_MS));
595 
596  if (error != CS_OK) {
597  goto error_exit;
598  }
599 
600  error = res_lib_cfg_local_get.header.error;
601 
602  *local_nodeid = res_lib_cfg_local_get.local_nodeid;
603 
604 error_exit:
605  (void)hdb_handle_put (&cfg_hdb, handle);
606 
607  return (error);
608 }
609 
611  corosync_cfg_handle_t handle)
612 {
613  cs_error_t error;
614  struct cfg_inst *cfg_inst;
615  struct iovec iov;
618 
619  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
620  if (error != CS_OK) {
621  return (error);
622  }
623 
624  req_lib_cfg_reload_config.header.size = sizeof (struct qb_ipc_request_header);
626 
627  iov.iov_base = (void *)&req_lib_cfg_reload_config;
628  iov.iov_len = sizeof (struct req_lib_cfg_reload_config);
629 
630  error = qb_to_cs_error (qb_ipcc_sendv_recv (
631  cfg_inst->c,
632  &iov,
633  1,
635  sizeof (struct res_lib_cfg_reload_config), CS_IPC_TIMEOUT_MS));
636 
637  if (error != CS_OK) {
638  goto error_exit;
639  }
640 
641  error = res_lib_cfg_reload_config.header.error;
642 
643 error_exit:
644  (void)hdb_handle_put (&cfg_hdb, handle);
645 
646  return (error);
647 }
648 
650  corosync_cfg_handle_t handle)
651 {
652  cs_error_t error;
653  struct cfg_inst *cfg_inst;
654  struct iovec iov;
657 
658  error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
659  if (error != CS_OK) {
660  return (error);
661  }
662 
663  req_lib_cfg_reopen_log_files.header.size = sizeof (struct qb_ipc_request_header);
665 
666  iov.iov_base = (void *)&req_lib_cfg_reopen_log_files;
667  iov.iov_len = sizeof (struct req_lib_cfg_reopen_log_files);
668 
669  error = qb_to_cs_error (qb_ipcc_sendv_recv (
670  cfg_inst->c,
671  &iov,
672  1,
675 
676  if (error != CS_OK) {
677  goto error_exit;
678  }
679 
680  error = res_lib_cfg_reopen_log_files.header.error;
681 
682 error_exit:
683  (void)hdb_handle_put (&cfg_hdb, handle);
684 
685  return (error);
686 }
req_lib_cfg_replytoshutdown
The req_lib_cfg_replytoshutdown struct.
Definition: ipc_cfg.h:152
CS_DISPATCH_ONE
@ CS_DISPATCH_ONE
Definition: corotypes.h:84
CS_ERR_NAME_TOO_LONG
@ CS_ERR_NAME_TOO_LONG
Definition: corotypes.h:110
cfg.h
corosync_cfg_reopen_log_files
cs_error_t corosync_cfg_reopen_log_files(corosync_cfg_handle_t handle)
Reopen logging files.
Definition: lib/cfg.c:649
res_lib_cfg_tryshutdown
The res_lib_cfg_tryshutdown struct.
Definition: ipc_cfg.h:145
CS_MAX_NAME_LENGTH
#define CS_MAX_NAME_LENGTH
Definition: corotypes.h:55
MESSAGE_REQ_CFG_REPLYTOSHUTDOWN
@ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN
Definition: ipc_cfg.h:58
corosync_cfg_kill_node
cs_error_t corosync_cfg_kill_node(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, const char *reason)
corosync_cfg_kill_node
Definition: lib/cfg.c:371
CS_ERR_LIBRARY
@ CS_ERR_LIBRARY
Definition: corotypes.h:99
CS_ERR_TRY_AGAIN
@ CS_ERR_TRY_AGAIN
Definition: corotypes.h:103
corosync_cfg_node_address_t::address_length
int address_length
Definition: cfg.h:97
hdb.h
corosync_cfg_replyto_shutdown
cs_error_t corosync_cfg_replyto_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_reply_flags_t response)
corosync_cfg_replyto_shutdown
Definition: lib/cfg.c:449
corosync_cfg_fd_get
cs_error_t corosync_cfg_fd_get(corosync_cfg_handle_t cfg_handle, int32_t *selection_fd)
corosync_cfg_fd_get
Definition: lib/cfg.c:126
CS_DISPATCH_ALL
@ CS_DISPATCH_ALL
Definition: corotypes.h:85
cfg_inst
Definition: lib/cfg.c:65
cs_name_t
The cs_name_t struct.
Definition: corotypes.h:65
res_lib_cfg_get_node_addrs::num_addrs
unsigned int num_addrs
Definition: ipc_cfg.h:186
res_lib_cfg_get_node_addrs::family
unsigned int family
Definition: ipc_cfg.h:185
ipc_cfg.h
IPC_REQUEST_SIZE
#define IPC_REQUEST_SIZE
Definition: lib/util.h:49
util.h
corosync_cfg_shutdown_reply_flags_t
corosync_cfg_shutdown_reply_flags_t
enum corosync_cfg_shutdown_reply_flags_t
Definition: cfg.h:66
cs_dispatch_flags_t
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
Definition: corotypes.h:83
res_lib_cfg_killnode
The res_lib_cfg_killnode struct.
Definition: ipc_cfg.h:130
corosync_cfg_ring_status_get
cs_error_t corosync_cfg_ring_status_get(corosync_cfg_handle_t cfg_handle, char ***interface_names, char ***status, unsigned int *interface_count)
corosync_cfg_ring_status_get
Definition: lib/cfg.c:283
req_lib_cfg_replytoshutdown::response
unsigned int response
Definition: ipc_cfg.h:154
res_lib_cfg_testshutdown::flags
unsigned int flags
Definition: ipc_cfg.h:169
cfg_inst::comp_name
cs_name_t comp_name
Definition: lib/cfg.c:68
CS_OK
@ CS_OK
Definition: corotypes.h:98
corosync_cfg_try_shutdown
cs_error_t corosync_cfg_try_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags)
corosync_cfg_try_shutdown
Definition: lib/cfg.c:414
corosync_cfg_dispatch
cs_error_t corosync_cfg_dispatch(corosync_cfg_handle_t cfg_handle, cs_dispatch_flags_t dispatch_flags)
corosync_cfg_dispatch
Definition: lib/cfg.c:145
corosync_cfg_handle_t
uint64_t corosync_cfg_handle_t
Definition: cfg.h:41
res_lib_cfg_reload_config
The res_lib_cfg_reload_config struct.
Definition: ipc_cfg.h:216
req_lib_cfg_get_node_addrs::nodeid
unsigned int nodeid
Definition: ipc_cfg.h:177
MESSAGE_RES_CFG_TESTSHUTDOWN
@ MESSAGE_RES_CFG_TESTSHUTDOWN
Definition: ipc_cfg.h:79
corosync_cfg_callbacks_t::corosync_cfg_shutdown_callback
corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback
Definition: cfg.h:82
TOTEMIP_ADDRLEN
#define TOTEMIP_ADDRLEN
Definition: coroapi.h:86
corosync_cfg_finalize
cs_error_t corosync_cfg_finalize(corosync_cfg_handle_t cfg_handle)
corosync_cfg_finalize
Definition: lib/cfg.c:254
cs_error_t
cs_error_t
The cs_error_t enum.
Definition: corotypes.h:97
cfg_inst::comp_registered
int comp_registered
Definition: lib/cfg.c:69
res_lib_cfg_replytoshutdown
The res_lib_cfg_replytoshutdown struct.
Definition: ipc_cfg.h:160
res_lib_cfg_get_node_addrs
The res_lib_cfg_get_node_addrs struct.
Definition: ipc_cfg.h:183
MESSAGE_REQ_CFG_REOPEN_LOG_FILES
@ MESSAGE_REQ_CFG_REOPEN_LOG_FILES
Definition: ipc_cfg.h:62
req_lib_cfg_local_get
The req_lib_cfg_local_get struct.
Definition: ipc_cfg.h:194
DECLARE_HDB_DATABASE
DECLARE_HDB_DATABASE(cfg_hdb, cfg_inst_free)
res_lib_cfg_testshutdown
The res_lib_cfg_testshutdown struct.
Definition: ipc_cfg.h:167
req_lib_cfg_get_node_addrs
The req_lib_cfg_get_node_addrs struct.
Definition: ipc_cfg.h:175
flags
uint32_t flags
Definition: exec/votequorum.c:103
cfg_inst::c
qb_ipcc_connection_t * c
Definition: lib/cfg.c:66
IPC_DISPATCH_SIZE
#define IPC_DISPATCH_SIZE
Definition: lib/util.h:51
qb_to_cs_error
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
corosync_cfg_callbacks_t
struct corosync_cfg_shutdown_callback_t
Definition: cfg.h:81
req_lib_cfg_ringstatusget
The req_lib_cfg_ringstatusget struct.
Definition: ipc_cfg.h:90
req_lib_cfg_tryshutdown::flags
unsigned int flags
Definition: ipc_cfg.h:139
corosync_cfg_initialize
cs_error_t corosync_cfg_initialize(corosync_cfg_handle_t *cfg_handle, const corosync_cfg_callbacks_t *cfg_callbacks)
corosync_cfg_initialize
Definition: lib/cfg.c:85
corosync_cfg_node_address_t
A node address.
Definition: cfg.h:95
MESSAGE_REQ_CFG_TRYSHUTDOWN
@ MESSAGE_REQ_CFG_TRYSHUTDOWN
Definition: ipc_cfg.h:57
cfg_inst::callbacks
corosync_cfg_callbacks_t callbacks
Definition: lib/cfg.c:67
MESSAGE_REQ_CFG_GET_NODE_ADDRS
@ MESSAGE_REQ_CFG_GET_NODE_ADDRS
Definition: ipc_cfg.h:59
res_lib_cfg_ringstatusget
The res_lib_cfg_ringstatusget struct.
Definition: ipc_cfg.h:97
CS_ERR_BAD_HANDLE
@ CS_ERR_BAD_HANDLE
Definition: corotypes.h:106
corosync_cfg_local_get
cs_error_t corosync_cfg_local_get(corosync_cfg_handle_t handle, unsigned int *local_nodeid)
corosync_cfg_local_get
Definition: lib/cfg.c:568
cfg_inst::finalize
int finalize
Definition: lib/cfg.c:70
MESSAGE_REQ_CFG_RINGSTATUSGET
@ MESSAGE_REQ_CFG_RINGSTATUSGET
Definition: ipc_cfg.h:54
nodeid
unsigned int nodeid
Definition: coroapi.h:75
req_lib_cfg_reopen_log_files
The req_lib_cfg_reopen_log_files struct.
Definition: ipc_cfg.h:223
corosync_cfg_get_node_addrs
cs_error_t corosync_cfg_get_node_addrs(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, size_t max_addrs, int *num_addrs, corosync_cfg_node_address_t *addrs)
corosync_cfg_get_node_addrs
Definition: lib/cfg.c:481
config.h
MESSAGE_REQ_CFG_LOCAL_GET
@ MESSAGE_REQ_CFG_LOCAL_GET
Definition: ipc_cfg.h:60
corotypes.h
res_lib_cfg_get_node_addrs::addrs
char addrs[]
Definition: ipc_cfg.h:188
req_lib_cfg_killnode
The req_lib_cfg_killnode struct.
Definition: ipc_cfg.h:121
res_lib_cfg_reopen_log_files
The res_lib_cfg_reopen_log_files struct.
Definition: ipc_cfg.h:230
req_lib_cfg_tryshutdown
The req_lib_cfg_tryshutdown struct.
Definition: ipc_cfg.h:137
res_lib_cfg_local_get
The res_lib_cfg_local_get struct.
Definition: ipc_cfg.h:201
CS_ERR_NO_MEMORY
@ CS_ERR_NO_MEMORY
Definition: corotypes.h:105
IPC_RESPONSE_SIZE
#define IPC_RESPONSE_SIZE
Definition: lib/util.h:50
corosync_cfg_shutdown_flags_t
corosync_cfg_shutdown_flags_t
Shutdown types.
Definition: cfg.h:46
req_lib_cfg_reload_config
The req_lib_cfg_reload_config struct.
Definition: ipc_cfg.h:209
MESSAGE_REQ_CFG_KILLNODE
@ MESSAGE_REQ_CFG_KILLNODE
Definition: ipc_cfg.h:56
corodefs.h
CS_IPC_TIMEOUT_MS
#define CS_IPC_TIMEOUT_MS
Definition: corotypes.h:130
CS_DISPATCH_ONE_NONBLOCKING
@ CS_DISPATCH_ONE_NONBLOCKING
Definition: corotypes.h:87
corosync_cfg_reload_config
cs_error_t corosync_cfg_reload_config(corosync_cfg_handle_t handle)
corosync_cfg_reload_config
Definition: lib/cfg.c:610
hdb_error_to_cs
cs_error_t hdb_error_to_cs(int res)
MESSAGE_REQ_CFG_RELOAD_CONFIG
@ MESSAGE_REQ_CFG_RELOAD_CONFIG
Definition: ipc_cfg.h:61