|
|
@@ -971,53 +971,76 @@ static void message_handler_req_lib_cfg_nodestatusget (
|
|
|
void *conn,
|
|
|
const void *msg)
|
|
|
{
|
|
|
- struct res_lib_cfg_nodestatusget res_lib_cfg_nodestatusget;
|
|
|
+ struct res_lib_cfg_nodestatusget_version res_lib_cfg_nodestatusget_version;
|
|
|
+ struct res_lib_cfg_nodestatusget_v1 res_lib_cfg_nodestatusget_v1;
|
|
|
+ void *res_lib_cfg_nodestatusget_ptr = NULL;
|
|
|
+ size_t res_lib_cfg_nodestatusget_size;
|
|
|
struct req_lib_cfg_nodestatusget *req_lib_cfg_nodestatusget = (struct req_lib_cfg_nodestatusget *)msg;
|
|
|
struct totem_node_status node_status;
|
|
|
- cs_error_t res = CS_OK;
|
|
|
int i;
|
|
|
|
|
|
ENTER();
|
|
|
|
|
|
+ memset(&node_status, 0, sizeof(node_status));
|
|
|
+ if (totempg_nodestatus_get(req_lib_cfg_nodestatusget->nodeid, &node_status) != 0) {
|
|
|
+ res_lib_cfg_nodestatusget_ptr = &res_lib_cfg_nodestatusget_version;
|
|
|
+ res_lib_cfg_nodestatusget_size = sizeof(res_lib_cfg_nodestatusget_version);
|
|
|
+
|
|
|
+ res_lib_cfg_nodestatusget_version.header.error = CS_ERR_FAILED_OPERATION;
|
|
|
+ res_lib_cfg_nodestatusget_version.header.id = MESSAGE_RES_CFG_NODESTATUSGET;
|
|
|
+ res_lib_cfg_nodestatusget_version.header.size = res_lib_cfg_nodestatusget_size;
|
|
|
+
|
|
|
+ goto ipc_response_send;
|
|
|
+ }
|
|
|
+
|
|
|
/* Currently only one structure version supported */
|
|
|
- if (req_lib_cfg_nodestatusget->version == TOTEM_NODE_STATUS_STRUCTURE_VERSION)
|
|
|
- {
|
|
|
- res_lib_cfg_nodestatusget.header.id = MESSAGE_RES_CFG_NODESTATUSGET;
|
|
|
- res_lib_cfg_nodestatusget.header.size = sizeof (struct res_lib_cfg_nodestatusget);
|
|
|
-
|
|
|
- memset(&node_status, 0, sizeof(node_status));
|
|
|
- res = totempg_nodestatus_get(req_lib_cfg_nodestatusget->nodeid,
|
|
|
- &node_status);
|
|
|
- if (res == 0) {
|
|
|
- res_lib_cfg_nodestatusget.node_status.nodeid = req_lib_cfg_nodestatusget->nodeid;
|
|
|
- res_lib_cfg_nodestatusget.node_status.version = node_status.version;
|
|
|
- res_lib_cfg_nodestatusget.node_status.reachable = node_status.reachable;
|
|
|
- res_lib_cfg_nodestatusget.node_status.remote = node_status.remote;
|
|
|
- res_lib_cfg_nodestatusget.node_status.external = node_status.external;
|
|
|
- res_lib_cfg_nodestatusget.node_status.onwire_min = node_status.onwire_min;
|
|
|
- res_lib_cfg_nodestatusget.node_status.onwire_max = node_status.onwire_max;
|
|
|
- res_lib_cfg_nodestatusget.node_status.onwire_ver= node_status.onwire_ver;
|
|
|
-
|
|
|
- for (i=0; i < KNET_MAX_LINK; i++) {
|
|
|
- res_lib_cfg_nodestatusget.node_status.link_status[i].enabled = node_status.link_status[i].enabled;
|
|
|
- res_lib_cfg_nodestatusget.node_status.link_status[i].connected = node_status.link_status[i].connected;
|
|
|
- res_lib_cfg_nodestatusget.node_status.link_status[i].dynconnected = node_status.link_status[i].dynconnected;
|
|
|
- res_lib_cfg_nodestatusget.node_status.link_status[i].mtu = node_status.link_status[i].mtu;
|
|
|
- memcpy(res_lib_cfg_nodestatusget.node_status.link_status[i].src_ipaddr,
|
|
|
- node_status.link_status[i].src_ipaddr, CFG_MAX_HOST_LEN);
|
|
|
- memcpy(res_lib_cfg_nodestatusget.node_status.link_status[i].dst_ipaddr,
|
|
|
- node_status.link_status[i].dst_ipaddr, CFG_MAX_HOST_LEN);
|
|
|
- }
|
|
|
+ switch (req_lib_cfg_nodestatusget->version) {
|
|
|
+ case CFG_NODE_STATUS_V1:
|
|
|
+ res_lib_cfg_nodestatusget_ptr = &res_lib_cfg_nodestatusget_v1;
|
|
|
+ res_lib_cfg_nodestatusget_size = sizeof(res_lib_cfg_nodestatusget_v1);
|
|
|
+
|
|
|
+ res_lib_cfg_nodestatusget_v1.header.error = CS_OK;
|
|
|
+ res_lib_cfg_nodestatusget_v1.header.id = MESSAGE_RES_CFG_NODESTATUSGET;
|
|
|
+ res_lib_cfg_nodestatusget_v1.header.size = res_lib_cfg_nodestatusget_size;
|
|
|
+
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.version = CFG_NODE_STATUS_V1;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.nodeid = req_lib_cfg_nodestatusget->nodeid;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.reachable = node_status.reachable;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.remote = node_status.remote;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.external = node_status.external;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.onwire_min = node_status.onwire_min;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.onwire_max = node_status.onwire_max;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.onwire_ver = node_status.onwire_ver;
|
|
|
+
|
|
|
+ for (i=0; i < KNET_MAX_LINK; i++) {
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.link_status[i].enabled = node_status.link_status[i].enabled;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.link_status[i].connected = node_status.link_status[i].connected;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.link_status[i].dynconnected = node_status.link_status[i].dynconnected;
|
|
|
+ res_lib_cfg_nodestatusget_v1.node_status.link_status[i].mtu = node_status.link_status[i].mtu;
|
|
|
+ memcpy(res_lib_cfg_nodestatusget_v1.node_status.link_status[i].src_ipaddr,
|
|
|
+ node_status.link_status[i].src_ipaddr, CFG_MAX_HOST_LEN);
|
|
|
+ memcpy(res_lib_cfg_nodestatusget_v1.node_status.link_status[i].dst_ipaddr,
|
|
|
+ node_status.link_status[i].dst_ipaddr, CFG_MAX_HOST_LEN);
|
|
|
}
|
|
|
- } else {
|
|
|
- res = CS_ERR_NOT_SUPPORTED;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ /*
|
|
|
+ * Unsupported version requested
|
|
|
+ */
|
|
|
+ res_lib_cfg_nodestatusget_ptr = &res_lib_cfg_nodestatusget_version;
|
|
|
+ res_lib_cfg_nodestatusget_size = sizeof(res_lib_cfg_nodestatusget_version);
|
|
|
+
|
|
|
+ res_lib_cfg_nodestatusget_version.header.error = CS_ERR_NOT_SUPPORTED;
|
|
|
+ res_lib_cfg_nodestatusget_version.header.id = MESSAGE_RES_CFG_NODESTATUSGET;
|
|
|
+ res_lib_cfg_nodestatusget_version.header.size = res_lib_cfg_nodestatusget_size;
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
- res_lib_cfg_nodestatusget.header.error = res;
|
|
|
+ipc_response_send:
|
|
|
api->ipc_response_send (
|
|
|
conn,
|
|
|
- &res_lib_cfg_nodestatusget,
|
|
|
- sizeof (struct res_lib_cfg_nodestatusget));
|
|
|
+ res_lib_cfg_nodestatusget_ptr,
|
|
|
+ res_lib_cfg_nodestatusget_size);
|
|
|
|
|
|
LEAVE();
|
|
|
}
|