// Handle Appliction Commands (IPMI/Section 20) static void ipmi_handle_app (unsigned char *request, unsigned char req_len, unsigned char *response, unsigned char *res_len) { ipmi_mn_req_t *req = (ipmi_mn_req_t *) request; ipmi_res_t *res = (ipmi_res_t *) response; unsigned char cmd = req->cmd; pthread_mutex_lock(&m_app); switch (cmd) { case CMD_APP_GET_DEVICE_ID: app_get_device_id (response, res_len); break; case CMD_APP_COLD_RESET: app_cold_reset (); break; case CMD_APP_GET_SELFTEST_RESULTS: app_get_selftest_results (response, res_len); break; case CMD_APP_GET_DEVICE_GUID: app_get_device_guid (response, res_len); break; case CMD_APP_GET_SYSTEM_GUID: app_get_device_sys_guid (request, response, res_len); break; case CMD_APP_GET_GLOBAL_ENABLES: app_get_global_enables (response, res_len); break; case CMD_APP_SET_SYS_INFO_PARAMS: app_set_sys_info_params (request, response, res_len); break; case CMD_APP_GET_SYS_INFO_PARAMS: app_get_sys_info_params (request, response, res_len); break; default: res->cc = CC_INVALID_CMD; break; } pthread_mutex_unlock(&m_app); }
/* * Configuration callback routine. */ idigi_callback_status_t app_config_handler(idigi_config_request_t const request, void * const request_data, size_t const request_length, void * response_data, size_t * const response_length) { idigi_callback_status_t status; int ret = -1; UNUSED_ARGUMENT(request_length); switch (request) { case idigi_config_device_id: ret = app_get_device_id((uint8_t **)response_data, response_length); break; case idigi_config_vendor_id: ret = app_get_vendor_id((uint8_t **)response_data, response_length); break; case idigi_config_device_type: ret = app_get_device_type((char **)response_data, response_length); break; case idigi_config_server_url: ret = app_get_server_url((char **)response_data, response_length); break; case idigi_config_connection_type: ret = app_get_connection_type((idigi_connection_type_t **)response_data); break; case idigi_config_mac_addr: ret = app_get_mac_addr((uint8_t **)response_data, response_length); break; case idigi_config_link_speed: ret = app_get_link_speed((uint32_t **)response_data, response_length); break; case idigi_config_phone_number: ret = app_get_phone_number((uint8_t **)response_data, response_length); break; case idigi_config_tx_keepalive: ret = app_get_tx_keepalive_interval((uint16_t **)response_data, response_length); break; case idigi_config_rx_keepalive: ret = app_get_rx_keepalive_interval((uint16_t **)response_data, response_length); break; case idigi_config_wait_count: ret = app_get_wait_count((uint16_t **)response_data, response_length); break; case idigi_config_ip_addr: ret = app_get_ip_address((uint8_t **)response_data, response_length); break; case idigi_config_error_status: app_config_error((idigi_error_status_t *)request_data); ret = 0; break; case idigi_config_firmware_facility: *((idigi_service_supported_status_t *)response_data) = app_get_firmware_support(); ret = 0; break; case idigi_config_data_service: *((idigi_service_supported_status_t *)response_data) = app_get_data_service_support(); ret = 0; break; case idigi_config_max_transaction: *((unsigned int *)response_data) = app_get_max_message_transactions(); ret = 0; break; } status = (ret == 0) ? idigi_callback_continue : idigi_callback_abort; return status; }