static ipmi_config_err_t community_string_commit (ipmi_config_state_data_t *state_data, const char *section_name, const struct ipmi_config_keyvalue *kv) { fiid_obj_t obj_cmd_rs = NULL; ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR; ipmi_config_err_t ret; uint8_t channel_number; assert (state_data); assert (section_name); assert (kv); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_lan_configuration_parameters_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if ((ret = get_lan_channel_number (state_data, section_name, &channel_number)) != IPMI_CONFIG_ERR_SUCCESS) { rv = ret; goto cleanup; } if (ipmi_cmd_set_lan_configuration_parameters_community_string (state_data->ipmi_ctx, channel_number, kv->value_input, strlen (kv->value_input), obj_cmd_rs) < 0) { if (ipmi_config_param_errnum_is_non_fatal (state_data, obj_cmd_rs, &ret)) rv = ret; if (rv == IPMI_CONFIG_ERR_FATAL_ERROR || state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_set_lan_configuration_parameters_community_string: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); goto cleanup; } rv = IPMI_CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
static ipmi_config_err_t _get_number_of_alert_strings (struct ipmi_config_state_data *state_data, uint8_t *number_of_alert_strings) { fiid_obj_t obj_cmd_rs = NULL; uint64_t val; ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR; ipmi_config_err_t ret; assert (state_data); assert (number_of_alert_strings); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_get_pef_configuration_parameters_number_of_alert_strings_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if (ipmi_cmd_get_pef_configuration_parameters_number_of_alert_strings (state_data->ipmi_ctx, IPMI_GET_PEF_PARAMETER, IPMI_PEF_CONFIGURATION_PARAMETERS_NO_SET_SELECTOR, IPMI_PEF_CONFIGURATION_PARAMETERS_NO_BLOCK_SELECTOR, obj_cmd_rs) < 0) { if (ipmi_errnum_is_non_fatal (state_data, obj_cmd_rs, &ret)) rv = ret; if (rv == IPMI_CONFIG_ERR_FATAL_ERROR || state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_get_pef_configuration_parameters_number_of_alert_strings: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); goto cleanup; } if (FIID_OBJ_GET (obj_cmd_rs, "number_of_alert_strings", &val) < 0) { rv = IPMI_CONFIG_ERR_NON_FATAL_ERROR; goto cleanup; } (*number_of_alert_strings) = val; rv = IPMI_CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
static config_err_t _set_pef_action_global_control (pstdout_state_t pstate, ipmi_ctx_t ipmi_ctx, struct config_arguments *cmd_args, struct pef_action_global_control *gc) { fiid_obj_t obj_cmd_rs = NULL; config_err_t rv = CONFIG_ERR_FATAL_ERROR; assert (ipmi_ctx); assert (cmd_args); assert (gc); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_pef_configuration_parameters_rs))) { pstdout_fprintf (pstate, stderr, "fiid_obj_create: %s", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_pef_configuration_parameters_pef_action_global_control (ipmi_ctx, gc->enable_alert_action, gc->enable_power_down_action, gc->enable_reset_action, gc->enable_power_cycle_action, gc->enable_oem_action, gc->enable_diagnostic_interrupt, obj_cmd_rs) < 0) { config_err_t ret; if (cmd_args->common_args.debug) pstdout_fprintf (pstate, stderr, "ipmi_cmd_set_pef_configuration_parameters_pef_action_global_control: %s\n", ipmi_ctx_errormsg (ipmi_ctx)); if (config_is_config_param_non_fatal_error (ipmi_ctx, obj_cmd_rs, &ret)) rv = ret; goto cleanup; } rv = CONFIG_ERR_SUCCESS; cleanup: if (obj_cmd_rs) fiid_obj_destroy (obj_cmd_rs); return (rv); }
static config_err_t _set_pef_control (pstdout_state_t pstate, ipmi_ctx_t ipmi_ctx, struct config_arguments *cmd_args, struct pef_control *pc) { fiid_obj_t obj_cmd_rs = NULL; config_err_t rv = CONFIG_ERR_FATAL_ERROR; assert (ipmi_ctx); assert (cmd_args); assert (pc); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_pef_configuration_parameters_rs))) { pstdout_fprintf (pstate, stderr, "fiid_obj_create: %s", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_pef_configuration_parameters_pef_control (ipmi_ctx, pc->enable_pef, pc->enable_pef_event_messages, pc->enable_pef_startup_delay, pc->enable_pef_alert_startup_delay, obj_cmd_rs) < 0) { config_err_t ret; if (cmd_args->common_args.debug) pstdout_fprintf (pstate, stderr, "ipmi_cmd_set_pef_configuration_parameters_pef_control: %s\n", ipmi_ctx_errormsg (ipmi_ctx)); if (config_is_config_param_non_fatal_error (ipmi_ctx, obj_cmd_rs, &ret)) rv = ret; goto cleanup; } rv = CONFIG_ERR_SUCCESS; cleanup: if (obj_cmd_rs) fiid_obj_destroy (obj_cmd_rs); return (rv); }
int ipmi_cmd_dcmi_get_dcmi_capability_info_enhanced_system_power_statistics_attributes (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_dcmi_get_dcmi_capability_info_common (ctx, obj_cmd_rs, tmpl_cmd_dcmi_get_dcmi_capability_info_enhanced_system_power_statistics_attributes_rs, IPMI_DCMI_CAPABILITIES_INFO_PARAMETER_ENHANCED_SYSTEM_POWER_STATISTICS_ATTRIBUTES) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_dcmi_get_dcmi_capability_info_manageability_access_attributes (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_dcmi_get_dcmi_capability_info_common (ctx, obj_cmd_rs, tmpl_cmd_dcmi_get_dcmi_capability_info_manageability_access_attributes_rs, IPMI_DCMI_CAPABILITIES_INFO_PARAMETER_MANAGEABILITY_ACCESS_ATTRIBUTES) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_dcmi_get_dcmi_capability_info_optional_platform_attributes (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_dcmi_get_dcmi_capability_info_common (ctx, obj_cmd_rs, tmpl_cmd_dcmi_get_dcmi_capability_info_optional_platform_attributes_rs, IPMI_DCMI_CAPABILITIES_INFO_PARAMETER_OPTIONAL_PLATFORM_ATTRIBUTES) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_dcmi_get_dcmi_capability_info_supported_dcmi_capabilities (ipmi_ctx_t ctx, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_dcmi_get_dcmi_capability_info_common (ctx, obj_cmd_rs, tmpl_cmd_dcmi_get_dcmi_capability_info_supported_dcmi_capabilities_rs, IPMI_DCMI_CAPABILITIES_INFO_PARAMETER_SUPPORTED_DCMI_CAPABILITIES) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
config_err_t pef_startup_delay_commit (pstdout_state_t pstate, const struct config_keyvalue *kv, ipmi_ctx_t ipmi_ctx, struct config_arguments *cmd_args) { fiid_obj_t obj_cmd_rs = NULL; config_err_t rv = CONFIG_ERR_FATAL_ERROR; assert (kv); assert (ipmi_ctx); assert (cmd_args); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_pef_configuration_parameters_rs))) { pstdout_fprintf (pstate, stderr, "fiid_obj_create: %s", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_pef_configuration_parameters_pef_startup_delay (ipmi_ctx, atoi (kv->value_input), obj_cmd_rs) < 0) { config_err_t ret; if (cmd_args->common_args.debug) pstdout_fprintf (pstate, stderr, "ipmi_cmd_set_pef_configuration_parameters_pef_startup_delay: %s\n", ipmi_ctx_errormsg (ipmi_ctx)); if (config_is_config_param_non_fatal_error (ipmi_ctx, obj_cmd_rs, &ret)) rv = ret; goto cleanup; } rv = CONFIG_ERR_SUCCESS; cleanup: if (obj_cmd_rs) fiid_obj_destroy (obj_cmd_rs); return (rv); }
static ipmi_config_err_t _set_front_panel_buttons (ipmi_config_state_data_t *state_data, struct front_panel_buttons *data) { fiid_obj_t obj_cmd_rs = NULL; ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR; assert (state_data); assert (data); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_front_panel_enables_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_front_panel_enables (state_data->ipmi_ctx, data->power_off, data->reset, data->diagnostic_interrupt, data->standby, obj_cmd_rs) < 0) { ipmi_config_err_t ret; if (ipmi_errnum_is_non_fatal (state_data, obj_cmd_rs, &ret)) rv = ret; if (rv == IPMI_CONFIG_ERR_FATAL_ERROR || state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_set_front_panel_enables: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); goto cleanup; } rv = IPMI_CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
int ipmi_cmd_dcmi_get_dcmi_capability_info (ipmi_ctx_t ctx, uint8_t parameter_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_dcmi_get_dcmi_capability_info_common (ctx, obj_cmd_rs, tmpl_cmd_dcmi_get_dcmi_capability_info_rs, parameter_selector) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_oem_supermicro_reset_intrusion (ipmi_oem_state_data_t *state_data) { uint8_t bytes_rq[IPMI_OEM_MAX_BYTES]; uint8_t bytes_rs[IPMI_OEM_MAX_BYTES]; int rs_len; int rv = -1; assert (state_data); assert (!state_data->prog_data->args->oem_options_count); /* Supermicro OEM * * 0x30 - OEM network function * 0x03 - OEM cmd */ bytes_rq[0] = IPMI_CMD_OEM_SUPERMICRO_RESET_INTRUSION; if ((rs_len = ipmi_cmd_raw (state_data->ipmi_ctx, 0, /* lun */ IPMI_NET_FN_OEM_SUPERMICRO_GENERIC_RQ, /* network function */ bytes_rq, /* data */ 1, /* num bytes */ bytes_rs, IPMI_OEM_MAX_BYTES)) < 0) { pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_raw: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); goto cleanup; } if (ipmi_oem_check_response_and_completion_code (state_data, bytes_rs, rs_len, 2, IPMI_CMD_OEM_SUPERMICRO_RESET_INTRUSION, IPMI_NET_FN_OEM_SUPERMICRO_GENERIC_RS, NULL) < 0) goto cleanup; rv = 0; cleanup: return (rv); }
static ipmi_config_err_t power_restore_policy_commit (ipmi_config_state_data_t *state_data, const char *section_name, const struct ipmi_config_keyvalue *kv) { ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR; fiid_obj_t obj_cmd_rs = NULL; assert (state_data); assert (section_name); assert (kv); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_power_restore_policy_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_power_restore_policy (state_data->ipmi_ctx, power_restore_policy_number (kv->value_input), obj_cmd_rs) < 0) { ipmi_config_err_t ret; if (state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_set_power_restore_policy: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); if (ipmi_errnum_is_non_fatal (state_data, obj_cmd_rs, &ret)) rv = ret; goto cleanup; } rv = IPMI_CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
int ipmi_cmd_get_system_boot_options_BMC_boot_flag_valid_bit_clearing (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_BMC_boot_flag_valid_bit_clearing_rs, IPMI_SYSTEM_BOOT_OPTION_PARAMETER_BMC_BOOT_FLAG_VALID_BIT_CLEARING) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_system_boot_options_boot_initiator_mailbox (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_boot_initiator_mailbox_rs, IPMI_SYSTEM_BOOT_OPTION_PARAMETER_BOOT_INITIATOR_MAILBOX) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_system_boot_options_service_partition_scan (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_service_partition_scan_rs, IPMI_SYSTEM_BOOT_OPTION_PARAMETER_SERVICE_PARTITION_SCAN) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_system_boot_options_boot_flags (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_boot_flags_rs, IPMI_SYSTEM_BOOT_OPTION_PARAMETER_BOOT_FLAGS) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_system_boot_options_boot_info_acknowledge (ipmi_ctx_t ctx, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_boot_info_acknowledge_rs, IPMI_SYSTEM_BOOT_OPTION_PARAMETER_BOOT_INFO_ACKNOWLEDGE) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_system_boot_options (ipmi_ctx_t ctx, uint8_t parameter_selector, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_system_boot_options_common (ctx, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_system_boot_options_rs, parameter_selector) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
static ipmi_config_err_t power_cycle_interval_commit (ipmi_config_state_data_t *state_data, const char *section_name, const struct ipmi_config_keyvalue *kv) { ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR; fiid_obj_t obj_cmd_rs = NULL; assert (state_data); assert (section_name); assert (kv); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_set_power_cycle_interval_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if (ipmi_cmd_set_power_cycle_interval (state_data->ipmi_ctx, atoi (kv->value_input), obj_cmd_rs) < 0) { if (state_data->prog_data->args->common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_set_power_cycle_interval: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); if (!IPMI_CTX_ERRNUM_IS_FATAL_ERROR (state_data->ipmi_ctx)) rv = IPMI_CONFIG_ERR_NON_FATAL_ERROR; goto cleanup; } rv = IPMI_CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
int ipmi_cmd_get_serial_modem_configuration_connection_mode (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_serial_modem_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_serial_modem_configuration_connection_mode_rs, IPMI_SERIAL_MODEM_CONFIGURATION_PARAMETER_CONNECTION_MODE) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_sol_configuration_parameters_sol_payload_port_number (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_sol_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_sol_configuration_parameters_sol_payload_port_number_rs, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_PAYLOAD_PORT_NUMBER) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_sol_configuration_parameters_character_accumulate_interval_and_send_threshold (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_sol_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_sol_configuration_parameters_character_accumulate_interval_and_send_threshold_rs, IPMI_SOL_CONFIGURATION_PARAMETER_CHARACTER_ACCUMULATE_INTERVAL_AND_SEND_THRESHOLD) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_serial_modem_configuration_page_blackout_interval (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_serial_modem_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_serial_modem_configuration_page_blackout_interval_rs, IPMI_SERIAL_MODEM_CONFIGURATION_PARAMETER_PAGE_BLACKOUT_INTERVAL) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_serial_modem_configuration_ipmi_messaging_comm_settings (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_serial_modem_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_serial_modem_configuration_ipmi_messaging_comm_settings_rs, IPMI_SERIAL_MODEM_CONFIGURATION_PARAMETER_IPMI_MESSAGING_COMM_SETTINGS) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_sol_configuration_parameters_sol_authentication (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_sol_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_sol_configuration_parameters_sol_authentication_rs, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_AUTHENTICATION) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_sol_configuration_parameters_sol_volatile_bit_rate (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_sol_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_sol_configuration_parameters_sol_volatile_bit_rate_rs, IPMI_SOL_CONFIGURATION_PARAMETER_SOL_VOLATILE_BIT_RATE) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_cmd_get_serial_modem_configuration (ipmi_ctx_t ctx, uint8_t channel_number, uint8_t get_parameter, uint8_t parameter_selector, uint8_t set_selector, uint8_t block_selector, fiid_obj_t obj_cmd_rs) { if (_ipmi_cmd_get_serial_modem_configuration_parameters_common (ctx, channel_number, get_parameter, set_selector, block_selector, obj_cmd_rs, tmpl_cmd_get_serial_modem_configuration_rs, parameter_selector) < 0) { ERR_TRACE (ipmi_ctx_errormsg (ctx), ipmi_ctx_errnum (ctx)); return (-1); } return (0); }
int ipmi_oem_get_system_info_string (ipmi_oem_state_data_t *state_data, uint8_t parameter_selector, uint8_t set_selector, uint8_t block_selector, char *string, unsigned int string_len, unsigned int *string_len_ret) { fiid_obj_t obj_cmd_rs = NULL; uint8_t configuration_parameter_data[IPMI_OEM_MAX_BYTES]; int len; int rv = -1; assert (state_data); assert (string); assert (string_len); if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_get_system_info_parameters_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if (ipmi_cmd_get_system_info_parameters (state_data->ipmi_ctx, IPMI_GET_SYSTEM_INFO_PARAMETER, parameter_selector, set_selector, block_selector, obj_cmd_rs) < 0) { if ((ipmi_ctx_errnum (state_data->ipmi_ctx) == IPMI_ERR_BAD_COMPLETION_CODE && ipmi_check_completion_code (obj_cmd_rs, IPMI_COMP_CODE_GET_SYSTEM_INFO_PARAMETERS_PARAMETER_NOT_SUPPORTED) == 1) || (ipmi_ctx_errnum (state_data->ipmi_ctx) == IPMI_ERR_COMMAND_INVALID_OR_UNSUPPORTED && ipmi_check_completion_code (obj_cmd_rs, IPMI_COMP_CODE_INVALID_DATA_FIELD_IN_REQUEST) == 1)) { pstdout_fprintf (state_data->pstate, stderr, "%s:%s '%s' option not supported on this system\n", state_data->prog_data->args->oem_id, state_data->prog_data->args->oem_command, state_data->prog_data->args->oem_options[0]); goto cleanup; } pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_get_system_info_parameters: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); goto cleanup; } if ((len = fiid_obj_get_data (obj_cmd_rs, "configuration_parameter_data", configuration_parameter_data, IPMI_OEM_MAX_BYTES)) < 0) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_get_data: 'configuration_parameter_data': %s\n", fiid_obj_errormsg (obj_cmd_rs)); goto cleanup; } if (len > string_len) { pstdout_fprintf (state_data->pstate, stderr, "buffer overflow\n"); goto cleanup; } memcpy (string, &(configuration_parameter_data[0]), len); if (string_len_ret) (*string_len_ret) = len; rv = 0; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }
static config_err_t community_string_checkout (const char *section_name, struct config_keyvalue *kv, void *arg) { ipmi_pef_config_state_data_t *state_data; char community_string[IPMI_MAX_COMMUNITY_STRING_LENGTH+1] = { 0, }; fiid_obj_t obj_cmd_rs = NULL; config_err_t rv = CONFIG_ERR_FATAL_ERROR; config_err_t ret; uint8_t channel_number; assert (section_name); assert (kv); assert (arg); state_data = (ipmi_pef_config_state_data_t *)arg; if (!(obj_cmd_rs = fiid_obj_create (tmpl_cmd_get_lan_configuration_parameters_community_string_rs))) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_create: %s\n", strerror (errno)); goto cleanup; } if ((ret = get_lan_channel_number (state_data, section_name, &channel_number)) != CONFIG_ERR_SUCCESS) { rv = ret; goto cleanup; } if (ipmi_cmd_get_lan_configuration_parameters_community_string (state_data->ipmi_ctx, channel_number, IPMI_GET_LAN_PARAMETER, IPMI_PEF_CONFIGURATION_PARAMETERS_NO_SET_SELECTOR, IPMI_PEF_CONFIGURATION_PARAMETERS_NO_BLOCK_SELECTOR, obj_cmd_rs) < 0) { if (state_data->prog_data->args->config_args.common_args.debug) pstdout_fprintf (state_data->pstate, stderr, "ipmi_cmd_get_lan_configuration_parameters_community_string: %s\n", ipmi_ctx_errormsg (state_data->ipmi_ctx)); if (config_is_config_param_non_fatal_error (state_data->ipmi_ctx, obj_cmd_rs, &ret)) rv = ret; goto cleanup; } memset (community_string,'\0', IPMI_MAX_COMMUNITY_STRING_LENGTH+1); if (fiid_obj_get_data (obj_cmd_rs, "community_string", community_string, IPMI_MAX_COMMUNITY_STRING_LENGTH+1) < 0) { pstdout_fprintf (state_data->pstate, stderr, "fiid_obj_get_data: 'obj_cmd_rs': %s\n", fiid_obj_errormsg (obj_cmd_rs)); goto cleanup; } if (config_section_update_keyvalue_output (state_data->pstate, kv, community_string) < 0) return (CONFIG_ERR_FATAL_ERROR); rv = CONFIG_ERR_SUCCESS; cleanup: fiid_obj_destroy (obj_cmd_rs); return (rv); }