45 #include <sys/types.h>
46 #include <sys/socket.h>
47 #include <sys/select.h>
51 #include <qb/qbipcc.h>
66 qb_ipcc_connection_t *
c;
76 static void cfg_inst_free (
void *inst);
94 goto error_no_destroy;
106 goto error_put_destroy;
113 (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
118 (void)hdb_handle_put (&cfg_hdb, *cfg_handle);
120 (void)hdb_handle_destroy (&cfg_hdb, *cfg_handle);
128 int32_t *selection_fd)
134 if (error !=
CS_OK) {
140 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
155 struct qb_ipc_response_header *dispatch_data;
160 if (error !=
CS_OK) {
172 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
197 if (error !=
CS_OK) {
211 switch (dispatch_data->id) {
242 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
247 static void cfg_inst_free (
void *inst)
261 if (error !=
CS_OK) {
269 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
275 (void)hdb_handle_destroy (&cfg_hdb, cfg_handle);
277 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
285 char ***interface_names,
287 unsigned int *interface_count)
297 if (error !=
CS_OK) {
313 if (error !=
CS_OK) {
314 goto exit_handle_put;
318 *interface_names = malloc (
sizeof (
char *) * *interface_count);
319 if (*interface_names == NULL) {
322 memset (*interface_names, 0,
sizeof (
char *) * *interface_count);
324 *status = malloc (
sizeof (
char *) * *interface_count);
325 if (*status == NULL) {
327 goto error_free_interface_names_array;
329 memset (*status, 0,
sizeof (
char *) * *interface_count);
333 if ((*(interface_names))[i] == NULL) {
335 goto error_free_interface_names;
341 if ((*(status))[i] == NULL) {
343 goto error_free_status;
346 goto exit_handle_put;
349 for (j = 0; j < i; j++) {
350 free ((*(status))[j]);
352 i = *interface_count;
354 error_free_interface_names:
355 for (j = 0; j < i; j++) {
356 free ((*(interface_names))[j]);
361 error_free_interface_names_array:
362 free (*interface_names);
365 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
387 if (error !=
CS_OK) {
408 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
426 if (error !=
CS_OK) {
443 (void)hdb_handle_put (&cfg_hdb, cfg_handle);
461 if (error !=
CS_OK) {
495 const char *addr_buf;
497 char zeroes[
sizeof(
struct sockaddr_storage)];
501 if (error !=
CS_OK) {
504 memset(zeroes, 0,
sizeof(zeroes));
519 if (error !=
CS_OK) {
524 addrlen =
sizeof(
struct sockaddr_in);
526 addrlen =
sizeof(
struct sockaddr_in6);
531 struct sockaddr_in *in;
532 struct sockaddr_in6 *in6;
537 in = (
struct sockaddr_in *)addrs[i].address;
538 if (memcmp(addr_buf, zeroes, addrlen) == 0) {
541 in->sin_family = AF_INET;
543 memcpy(&in->sin_addr, addr_buf,
sizeof(
struct in_addr));
546 in6 = (
struct sockaddr_in6 *)addrs[i].address;
548 if (memcmp(addr_buf, zeroes, addrlen) == 0) {
549 in6->sin6_family = 0;
551 in6->sin6_family = AF_INET6;
553 memcpy(&in6->sin6_addr, addr_buf,
sizeof(
struct in6_addr));
563 hdb_handle_put (&cfg_hdb, cfg_handle);
570 unsigned int *local_nodeid)
579 if (error !=
CS_OK) {
596 if (error !=
CS_OK) {
605 (void)hdb_handle_put (&cfg_hdb, handle);
620 if (error !=
CS_OK) {
637 if (error !=
CS_OK) {
644 (void)hdb_handle_put (&cfg_hdb, handle);
659 if (error !=
CS_OK) {
676 if (error !=
CS_OK) {
683 (void)hdb_handle_put (&cfg_hdb, handle);
corosync_cfg_shutdown_reply_flags_t
enum corosync_cfg_shutdown_reply_flags_t
uint64_t corosync_cfg_handle_t
corosync_cfg_shutdown_flags_t
Shutdown types.
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
@ CS_DISPATCH_ONE_NONBLOCKING
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
#define CS_MAX_NAME_LENGTH
cs_error_t
The cs_error_t enum.
#define CS_IPC_TIMEOUT_MS
@ MESSAGE_REQ_CFG_RELOAD_CONFIG
@ MESSAGE_REQ_CFG_RINGSTATUSGET
@ MESSAGE_REQ_CFG_REOPEN_LOG_FILES
@ MESSAGE_REQ_CFG_TRYSHUTDOWN
@ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN
@ MESSAGE_REQ_CFG_KILLNODE
@ MESSAGE_REQ_CFG_GET_NODE_ADDRS
@ MESSAGE_REQ_CFG_LOCAL_GET
@ MESSAGE_RES_CFG_TESTSHUTDOWN
cs_error_t corosync_cfg_fd_get(corosync_cfg_handle_t cfg_handle, int32_t *selection_fd)
corosync_cfg_fd_get
cs_error_t corosync_cfg_finalize(corosync_cfg_handle_t cfg_handle)
corosync_cfg_finalize
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
cs_error_t corosync_cfg_kill_node(corosync_cfg_handle_t cfg_handle, unsigned int nodeid, const char *reason)
corosync_cfg_kill_node
cs_error_t corosync_cfg_replyto_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_reply_flags_t response)
corosync_cfg_replyto_shutdown
cs_error_t corosync_cfg_dispatch(corosync_cfg_handle_t cfg_handle, cs_dispatch_flags_t dispatch_flags)
corosync_cfg_dispatch
cs_error_t corosync_cfg_initialize(corosync_cfg_handle_t *cfg_handle, const corosync_cfg_callbacks_t *cfg_callbacks)
corosync_cfg_initialize
cs_error_t corosync_cfg_reload_config(corosync_cfg_handle_t handle)
corosync_cfg_reload_config
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
cs_error_t corosync_cfg_reopen_log_files(corosync_cfg_handle_t handle)
Reopen logging files.
cs_error_t corosync_cfg_local_get(corosync_cfg_handle_t handle, unsigned int *local_nodeid)
corosync_cfg_local_get
cs_error_t corosync_cfg_try_shutdown(corosync_cfg_handle_t cfg_handle, corosync_cfg_shutdown_flags_t flags)
corosync_cfg_try_shutdown
DECLARE_HDB_DATABASE(cfg_hdb, cfg_inst_free)
cs_error_t hdb_error_to_cs(int res)
#define IPC_DISPATCH_SIZE
#define IPC_RESPONSE_SIZE
corosync_cfg_callbacks_t callbacks
struct corosync_cfg_shutdown_callback_t
corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback
The req_lib_cfg_get_node_addrs struct.
The req_lib_cfg_killnode struct.
The req_lib_cfg_local_get struct.
The req_lib_cfg_reload_config struct.
The req_lib_cfg_reopen_log_files struct.
The req_lib_cfg_replytoshutdown struct.
The req_lib_cfg_ringstatusget struct.
The req_lib_cfg_tryshutdown struct.
The res_lib_cfg_get_node_addrs struct.
The res_lib_cfg_killnode struct.
The res_lib_cfg_local_get struct.
The res_lib_cfg_reload_config struct.
The res_lib_cfg_reopen_log_files struct.
The res_lib_cfg_replytoshutdown struct.
The res_lib_cfg_ringstatusget struct.
The res_lib_cfg_testshutdown struct.
The res_lib_cfg_tryshutdown struct.