2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * CDDL HEADER START
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * The contents of this file are subject to the terms of the
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * Common Development and Distribution License (the "License").
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * You may not use this file except in compliance with the License.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * See the License for the specific language governing permissions
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * and limitations under the License.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * When distributing Covered Code, include this CDDL HEADER in each
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * If applicable, add the following below this CDDL HEADER, with the
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * fields enclosed by brackets "[]" replaced with your own identifying
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * information: Portions Copyright [yyyy] [name of copyright owner]
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * CDDL HEADER END
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * Use is subject to license terms.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston "Usage: %s [-t <bmc|lan>] [-h hostname] [-u username] "
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj/*ARGSUSED*/
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robjsdr_print(ipmi_handle_t *ihp, ipmi_entity_t *ep, const char *name,
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (0);
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (-1);
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (0);
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robjentity_print(ipmi_handle_t *ihp, ipmi_entity_t *ep, void *data)
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj (void) snprintf(name + strlen(name), sizeof (name) - strlen(name),
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj 24 - indentation, name, present ? "present" : "absent");
888e055994b8b0dc77b98c53dd97026237caec5dRobert Johnston (void) ipmi_entity_iter_sdr(ihp, ep, sdr_print,
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj (void) ipmi_entity_iter_children(ihp, ep, entity_print,
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (0);
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston char c, *host = NULL, *user = NULL, *passwd = NULL;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston while ((c = getopt(argc, argv, optstr)) != -1)
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston "ABORT: Invalid transport type\n");
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston (host == NULL || passwd == NULL || user == NULL)) {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston (void) fprintf(stderr, "-h/-u/-p must all be specified for "
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston "transport type \"lan\"\n");
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston if (nvlist_alloc(¶ms, NV_UNIQUE_NAME, 0) ||
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston nvlist_add_string(params, IPMI_LAN_HOST, host) ||
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston nvlist_add_string(params, IPMI_LAN_USER, user) ||
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston nvlist_add_string(params, IPMI_LAN_PASSWD, passwd)) {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston "ABORT: nvlist construction failed\n");
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston if ((ihp = ipmi_open(&err, &errmsg, xport_type, params)) == NULL) {
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (1);
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj "ENTITY/SENSOR", "PRESENT", "SENSOR", "READING", "STATE");
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj (void) printf("----------------------- -------- ------------- "
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj "------------ -----\n");
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj (void) fprintf(stderr, "failed to iterate entities: %s\n",
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (1);
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj return (0);