summaryrefslogtreecommitdiff
path: root/src/ipmitool.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:03:01 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:03:01 +0200
commit777af8a8761d05c30588abec7444b143fe7393f0 (patch)
tree5a135c37eaa9ac94772819a28ce5beedd18e5c4a /src/ipmitool.c
parentc3445516ecd58e97de483cf4b7fafcc1104890d7 (diff)
parentb32d92e890caac903491116e9d817aa780c0323b (diff)
Merge tag 'upstream/1.8.14'
Upstream version 1.8.14
Diffstat (limited to 'src/ipmitool.c')
-rw-r--r--src/ipmitool.c136
1 files changed, 136 insertions, 0 deletions
diff --git a/src/ipmitool.c b/src/ipmitool.c
new file mode 100644
index 0000000..6230e5c
--- /dev/null
+++ b/src/ipmitool.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind.
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
+ * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
+ * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
+ * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
+ * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
+ * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+ * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
+ * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
+ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <ipmitool/ipmi.h>
+#include <ipmitool/ipmi_intf.h>
+#include <ipmitool/ipmi_main.h>
+
+#include <ipmitool/ipmi_sdr.h>
+#include <ipmitool/ipmi_gendev.h>
+#include <ipmitool/ipmi_sel.h>
+#include <ipmitool/ipmi_fru.h>
+#include <ipmitool/ipmi_sol.h>
+#include <ipmitool/ipmi_isol.h>
+#include <ipmitool/ipmi_tsol.h>
+#include <ipmitool/ipmi_lanp.h>
+#include <ipmitool/ipmi_chassis.h>
+#include <ipmitool/ipmi_mc.h>
+#include <ipmitool/ipmi_sensor.h>
+#include <ipmitool/ipmi_channel.h>
+#include <ipmitool/ipmi_session.h>
+#include <ipmitool/ipmi_event.h>
+#include <ipmitool/ipmi_user.h>
+#include <ipmitool/ipmi_raw.h>
+#include <ipmitool/ipmi_pef.h>
+#include <ipmitool/ipmi_oem.h>
+#include <ipmitool/ipmi_sunoem.h>
+#include <ipmitool/ipmi_fwum.h>
+#include <ipmitool/ipmi_picmg.h>
+#include <ipmitool/ipmi_kontronoem.h>
+#include <ipmitool/ipmi_firewall.h>
+#include <ipmitool/ipmi_hpmfwupg.h>
+#include <ipmitool/ipmi_delloem.h>
+#include <ipmitool/ipmi_ekanalyzer.h>
+#include <ipmitool/ipmi_ime.h>
+#include <ipmitool/ipmi_dcmi.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_READLINE
+extern int ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv);
+#endif
+extern int ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv);
+extern int ipmi_set_main(struct ipmi_intf * intf, int argc, char ** argv);
+extern int ipmi_exec_main(struct ipmi_intf * intf, int argc, char ** argv);
+
+
+int csv_output = 0;
+int verbose = 0;
+
+struct ipmi_cmd ipmitool_cmd_list[] = {
+ { ipmi_raw_main, "raw", "Send a RAW IPMI request and print response" },
+ { ipmi_rawi2c_main, "i2c", "Send an I2C Master Write-Read command and print response" },
+ { ipmi_rawspd_main, "spd", "Print SPD info from remote I2C device" },
+ { ipmi_lanp_main, "lan", "Configure LAN Channels" },
+ { ipmi_chassis_main, "chassis", "Get chassis status and set power state" },
+ { ipmi_power_main, "power", "Shortcut to chassis power commands" },
+ { ipmi_event_main, "event", "Send pre-defined events to MC" },
+ { ipmi_mc_main, "mc", "Management Controller status and global enables" },
+ { ipmi_mc_main, "bmc", NULL }, /* for backwards compatibility */
+ { ipmi_sdr_main, "sdr", "Print Sensor Data Repository entries and readings" },
+ { ipmi_sensor_main, "sensor", "Print detailed sensor information" },
+ { ipmi_fru_main, "fru", "Print built-in FRU and scan SDR for FRU locators" },
+ { ipmi_gendev_main, "gendev", "Read/Write Device associated with Generic Device locators sdr" },
+ { ipmi_sel_main, "sel", "Print System Event Log (SEL)" },
+ { ipmi_pef_main, "pef", "Configure Platform Event Filtering (PEF)" },
+ { ipmi_sol_main, "sol", "Configure and connect IPMIv2.0 Serial-over-LAN" },
+ { ipmi_tsol_main, "tsol", "Configure and connect with Tyan IPMIv1.5 Serial-over-LAN" },
+ { ipmi_isol_main, "isol", "Configure IPMIv1.5 Serial-over-LAN" },
+ { ipmi_user_main, "user", "Configure Management Controller users" },
+ { ipmi_channel_main, "channel", "Configure Management Controller channels" },
+ { ipmi_session_main, "session", "Print session information" },
+ { ipmi_dcmi_main, "dcmi", "Data Center Management Interface"},
+ { ipmi_sunoem_main, "sunoem", "OEM Commands for Sun servers" },
+ { ipmi_kontronoem_main, "kontronoem", "OEM Commands for Kontron devices"},
+ { ipmi_picmg_main, "picmg", "Run a PICMG/ATCA extended cmd"},
+ { ipmi_fwum_main, "fwum", "Update IPMC using Kontron OEM Firmware Update Manager" },
+ { ipmi_firewall_main,"firewall","Configure Firmware Firewall" },
+ { ipmi_delloem_main, "delloem", "OEM Commands for Dell systems" },
+#ifdef HAVE_READLINE
+ { ipmi_shell_main, "shell", "Launch interactive IPMI shell" },
+#endif
+ { ipmi_exec_main, "exec", "Run list of commands from file" },
+ { ipmi_set_main, "set", "Set runtime variable for shell and exec" },
+ { ipmi_echo_main, "echo", NULL }, /* for echoing lines to stdout in scripts */
+ { ipmi_hpmfwupg_main,"hpm", "Update HPM components using PICMG HPM.1 file"},
+ { ipmi_ekanalyzer_main,"ekanalyzer", "run FRU-Ekeying analyzer using FRU files"},
+ { ipmi_ime_main, "ime", "Update Intel Manageability Engine Firmware"},
+ { NULL },
+};
+
+int
+main(int argc, char ** argv)
+{
+ int rc;
+
+ rc = ipmi_main(argc, argv, ipmitool_cmd_list, NULL);
+
+ if (rc < 0)
+ exit(EXIT_FAILURE);
+ else
+ exit(EXIT_SUCCESS);
+}