enum cfg_message_req_types {
MESSAGE_REQ_EXEC_CFG_RINGREENABLE = 0,
MESSAGE_REQ_EXEC_CFG_KILLNODE = 1,
- MESSAGE_REQ_EXEC_CFG_SHUTDOWN = 2,
- MESSAGE_REQ_EXEC_CFG_CRYPTO_SET = 3
+ MESSAGE_REQ_EXEC_CFG_SHUTDOWN = 2
};
#define DEFAULT_SHUTDOWN_TIMEOUT 5
const void *message,
unsigned int nodeid);
-static void message_handler_req_exec_cfg_crypto_set (
- const void *message,
- unsigned int nodeid);
-
static void exec_cfg_killnode_endian_convert (void *msg);
static void message_handler_req_lib_cfg_ringstatusget (
void *conn,
const void *msg);
-static void message_handler_req_lib_cfg_crypto_set (
- void *conn,
- const void *msg);
-
/*
* Service Handler Definition
*/
{ /* 6 */
.lib_handler_fn = message_handler_req_lib_cfg_local_get,
.flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
- },
- { /* 7 */
- .lib_handler_fn = message_handler_req_lib_cfg_crypto_set,
- .flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
}
};
},
{ /* 2 */
.exec_handler_fn = message_handler_req_exec_cfg_shutdown,
- },
- { /* 3 */
- .exec_handler_fn = message_handler_req_exec_cfg_crypto_set,
}
};
mar_name_t reason __attribute__((aligned(8)));
};
-struct req_exec_cfg_crypto_set {
- struct qb_ipc_request_header header __attribute__((aligned(8)));
- mar_uint32_t type __attribute__((aligned(8)));
-};
-
struct req_exec_cfg_shutdown {
struct qb_ipc_request_header header __attribute__((aligned(8)));
};
LEAVE();
}
-static void message_handler_req_exec_cfg_crypto_set (
- const void *message,
- unsigned int nodeid)
-{
- const struct req_exec_cfg_crypto_set *req_exec_cfg_crypto_set = message;
- ENTER();
-
- log_printf(LOGSYS_LEVEL_NOTICE, "Node %d requested set crypto to %d",
- nodeid, req_exec_cfg_crypto_set->type);
-
- api->totem_crypto_set(req_exec_cfg_crypto_set->type);
- LEAVE();
-}
-
-
/*
* Library Interface Implementation
*/
api->ipc_response_send(conn, &res_lib_cfg_local_get,
sizeof(res_lib_cfg_local_get));
}
-
-
-static void message_handler_req_lib_cfg_crypto_set (
- void *conn,
- const void *msg)
-{
- const struct req_lib_cfg_crypto_set *req_lib_cfg_crypto_set = msg;
- struct res_lib_cfg_crypto_set res_lib_cfg_crypto_set;
- struct req_exec_cfg_crypto_set req_exec_cfg_crypto_set;
- struct iovec iovec;
- int ret = CS_ERR_INVALID_PARAM;
-
- req_exec_cfg_crypto_set.header.size =
- sizeof (struct req_exec_cfg_crypto_set);
- req_exec_cfg_crypto_set.header.id = SERVICE_ID_MAKE (CFG_SERVICE,
- MESSAGE_REQ_EXEC_CFG_CRYPTO_SET);
-
- /*
- * Set it locally first so we can tell if it is allowed
- */
- if (api->totem_crypto_set(req_lib_cfg_crypto_set->type) == 0) {
-
- req_exec_cfg_crypto_set.type = req_lib_cfg_crypto_set->type;
-
- iovec.iov_base = (char *)&req_exec_cfg_crypto_set;
- iovec.iov_len = sizeof (struct req_exec_cfg_crypto_set);
- assert (api->totem_mcast (&iovec, 1, TOTEM_SAFE) == 0);
- ret = CS_OK;
- }
-
- res_lib_cfg_crypto_set.header.size = sizeof(res_lib_cfg_crypto_set);
- res_lib_cfg_crypto_set.header.id = MESSAGE_RES_CFG_CRYPTO_SET;
- res_lib_cfg_crypto_set.header.error = ret;
-
- api->ipc_response_send(conn, &res_lib_cfg_crypto_set,
- sizeof(res_lib_cfg_crypto_set));
-}
return (error);
}
-
-cs_error_t
-corosync_cfg_crypto_set (
- corosync_cfg_handle_t handle,
- unsigned int type)
-{
- struct cfg_inst *cfg_inst;
- struct req_lib_cfg_crypto_set req_lib_cfg_crypto_set;
- struct res_lib_cfg_crypto_set res_lib_cfg_crypto_set;
- struct iovec iov;
- cs_error_t error;
-
-
- error = hdb_error_to_cs(hdb_handle_get (&cfg_hdb, handle, (void *)&cfg_inst));
- if (error != CS_OK) {
- return (error);
- }
-
- req_lib_cfg_crypto_set.header.id = MESSAGE_REQ_CFG_CRYPTO_SET;
- req_lib_cfg_crypto_set.header.size = sizeof (struct req_lib_cfg_crypto_set);
- req_lib_cfg_crypto_set.type = type;
-
- iov.iov_base = (void *)&req_lib_cfg_crypto_set;
- iov.iov_len = sizeof (struct req_lib_cfg_crypto_set);
-
- error = qb_to_cs_error (qb_ipcc_sendv_recv (cfg_inst->c,
- &iov,
- 1,
- &res_lib_cfg_crypto_set,
- sizeof (struct res_lib_cfg_crypto_set), CS_IPC_TIMEOUT_MS));
-
- if (error == CS_OK)
- error = res_lib_cfg_crypto_set.header.error;
-
- (void)hdb_handle_put (&cfg_hdb, handle);
- return (error);
-}