struct ipmi_config_section *
ipmi_config_chassis_power_conf_get (ipmi_config_state_data_t *state_data)
{
  struct ipmi_config_section *section = NULL;
  char *section_comment =
    "The following configuration options are for configuring "
    "chassis power behavior."
    "\n"
    "The \"Power_Restore_Policy\" determines the behavior of the machine "
    "when AC power returns after a power loss.  The behavior can be set to "
    "always power on the machine (\"On_State_AC_Apply\"), power off the "
    "machine (\"Off_State_AC_Apply\"), or return the power to the state that "
    "existed before the power loss (\"Restore_State_AC_Apply\")."
    "\n"
    "The \"Power_Cycle_Interval\" determines the time the system will be "
    "powered down following a power cycle command.";

  if (!(section = ipmi_config_section_create (state_data,
                                              "Chassis_Power_Conf",
                                              "Chassis_Power_Conf",
                                              section_comment,
                                              0,
                                              NULL,
                                              NULL)))
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Power_Restore_Policy",
                                   "Possible values: Off_State_AC_Apply/Restore_State_AC_Apply/On_State_AC_Apply",
                                   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
                                   power_restore_policy_checkout,
                                   power_restore_policy_commit,
                                   power_restore_policy_number_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Power_Cycle_Interval",
                                   "Give value in seconds",
                                   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
                                   power_cycle_interval_checkout,
                                   power_cycle_interval_commit,
                                   number_range_one_byte_non_zero_validate) < 0)
    goto cleanup;

  return (section);

 cleanup:
  if (section)
    ipmi_config_section_destroy (section);
  return (NULL);
}
ipmi_config_err_t
ipmi_config_sensors_discrete_section (ipmi_config_state_data_t *state_data,
                                      struct ipmi_config_section **section_ptr)
{
  struct ipmi_config_section *section = NULL;
  char section_name[IPMI_CONFIG_MAX_SECTION_NAME_LEN + 1];
  ipmi_config_err_t rv = IPMI_CONFIG_ERR_FATAL_ERROR;
  ipmi_config_err_t ret;

  assert (state_data);
  assert (section_ptr);

  memset (section_name, '\0', IPMI_CONFIG_MAX_SECTION_NAME_LEN + 1);

  if ((ret = ipmi_config_sensors_create_section_name (state_data,
                                                      section_name,
                                                      IPMI_CONFIG_MAX_SECTION_NAME_LEN)) != IPMI_CONFIG_ERR_SUCCESS)
    {
      rv = ret;

      if (rv == IPMI_CONFIG_ERR_FATAL_ERROR
          || state_data->prog_data->args->common_args.debug)
        pstdout_fprintf (state_data->pstate,
                         stderr,
                         "ipmi_config_sensors_create_section_name: %s\n",
                         strerror (errno));

      goto cleanup;
    }

  if (!(section = ipmi_config_section_create (state_data,
                                              section_name,
                                              NULL,
                                              NULL,
                                              0,
                                              NULL,
                                              NULL)))
    goto cleanup;

  if (setup_sensor_event_enable_fields (state_data, section) < 0)
    goto cleanup;

  *section_ptr = section;
  return (IPMI_CONFIG_ERR_SUCCESS);

 cleanup:
  if (section)
    ipmi_config_section_destroy (section);
  return (rv);
}
struct ipmi_config_section *
ipmi_config_chassis_front_panel_buttons_get (ipmi_config_state_data_t *state_data)
{
  struct ipmi_config_section *section = NULL;
  char *section_comment =
    "The following configuration options are for enabling or disabling "
    "button functionality on the chassis.  Button may refer to a "
    "pushbutton, switch, or other front panel control built into the "
    "system chassis."
    "\n"
    "The value of the below may not be able to be checked out.  Therefore "
    "we recommend the user configure all four fields rather than a subset "
    "of them, otherwise some assumptions on configure may be made.";

  assert (state_data);

  if (!(section = ipmi_config_section_create (state_data,
					      "Chassis_Front_Panel_Buttons",
					      "Chassis_Front_Panel_Buttons",
					      section_comment,
					      0,
					      NULL,
					      NULL)))
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
				   section,
				   "Enable_Standby_Button_For_Entering_Standby",
				   "Possible values: Yes/No",
				   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
				   front_panel_buttons_checkout,
				   front_panel_buttons_commit,
				   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
				   section,
				   "Enable_Diagnostic_Interrupt_Button",
				   "Possible values: Yes/No",
				   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
				   front_panel_buttons_checkout,
				   front_panel_buttons_commit,
				   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
				   section,
				   "Enable_Reset_Button",
				   "Possible values: Yes/No",
				   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
				   front_panel_buttons_checkout,
				   front_panel_buttons_commit,
				   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
				   section,
				   "Enable_Power_Off_Button_For_Power_Off_Only",
				   "Possible values: Yes/No",
				   IPMI_CONFIG_CHECKOUT_KEY_COMMENTED_OUT_IF_VALUE_EMPTY,
				   front_panel_buttons_checkout,
				   front_panel_buttons_commit,
				   yes_no_validate) < 0)
    goto cleanup;

  return (section);

 cleanup:
  if (section)
    ipmi_config_section_destroy (section);
  return (NULL);
}
struct ipmi_config_section *
ipmi_config_dcmi_dcmi_conf_section_get (ipmi_config_state_data_t *state_data)
{
  struct ipmi_config_section *section = NULL;

  assert (state_data);

  if (!(section = ipmi_config_section_create (state_data,
                                              "DCMI_Conf",
                                              NULL,
                                              NULL,
                                              0,
                                              NULL,
                                              NULL)))
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Asset_Tag",
                                   "Give valid string",
                                   0,
                                   asset_tag_checkout,
                                   asset_tag_commit,
                                   asset_tag_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Management_Controller_Identifier_String",
                                   "Give valid string",
                                   0,
                                   management_controller_identifier_string_checkout,
                                   management_controller_identifier_string_commit,
                                   management_controller_identifier_string_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Power_Limit_Requested",
                                   "Give valid number in Watts",
                                   0,
                                   power_limit_requested_checkout,
                                   power_limit_requested_commit,
                                   number_range_two_bytes_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Correction_Time_Limit",
                                   "Give valid number in milliseconds",
                                   0,
                                   correction_time_limit_checkout,
                                   correction_time_limit_commit,
                                   number_range_four_bytes_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Management_Application_Statistics_Sampling_Period",
                                   "Give valid number in seconds",
                                   0,
                                   management_application_statistics_sampling_period_checkout,
                                   management_application_statistics_sampling_period_commit,
                                   number_range_two_bytes_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Exception_Actions",
                                   "Give valid hex or NO_ACTION, HARD_POWER_OFF_SYSTEM, or LOG_EVENT_TO_SEL_ONLY",
                                   0,
                                   exception_actions_checkout,
                                   exception_actions_commit,
                                   exception_actions_validate) < 0)
    goto cleanup;

  return (section);

 cleanup:
  if (section)
    ipmi_config_section_destroy (section);
  return (NULL);
}
struct ipmi_config_section *
ipmi_config_core_pef_conf_section_get (ipmi_config_state_data_t *state_data)
{
  struct ipmi_config_section *section;

  assert (state_data);

  if (!(section = ipmi_config_section_create (state_data,
                                              "PEF_Conf",
                                              NULL,
                                              NULL,
                                              IPMI_CONFIG_DO_NOT_CHECKOUT | IPMI_CONFIG_DO_NOT_LIST,
                                              NULL,
                                              NULL)))
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_PEF",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_pef_checkout,
                                   enable_pef_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_PEF_Event_Messages",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_pef_event_messages_checkout,
                                   enable_pef_event_messages_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_PEF_Startup_Delay",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_pef_startup_delay_checkout,
                                   enable_pef_startup_delay_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_PEF_Alert_Startup_Delay",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_pef_alert_startup_delay_checkout,
                                   enable_pef_alert_startup_delay_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_Alert_Action",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_alert_action_checkout,
                                   enable_alert_action_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_Power_Down_Action",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_power_down_action_checkout,
                                   enable_power_down_action_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_Reset_Action",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_reset_action_checkout,
                                   enable_reset_action_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_Power_Cycle_Action",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_power_cycle_action_checkout,
                                   enable_power_cycle_action_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_OEM_Action",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_oem_action_checkout,
                                   enable_oem_action_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "Enable_Diagnostic_Interrupt",
                                   "Possible values: Yes/No",
                                   0,
                                   enable_diagnostic_interrupt_checkout,
                                   enable_diagnostic_interrupt_commit,
                                   yes_no_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "PEF_Startup_Delay",
                                   "Give value in seconds",
                                   0,
                                   pef_startup_delay_checkout,
                                   pef_startup_delay_commit,
                                   number_range_one_byte_validate) < 0)
    goto cleanup;

  if (ipmi_config_section_add_key (state_data,
                                   section,
                                   "PEF_Alert_Startup_Delay",
                                   "Give value in seconds",
                                   0,
                                   pef_alert_startup_delay_checkout,
                                   pef_alert_startup_delay_commit,
                                   number_range_one_byte_validate) < 0)
    goto cleanup;

  return (section);

 cleanup:
  if (section)
    ipmi_config_section_destroy (section);
  return (NULL);
}