From 224844746a31fb76e7237a82748e7ed92aecf606 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sat, 27 Mar 2004 06:00:16 +0000 Subject: [PATCH] add channel header --- ipmitool/include/ipmitool/Makefile.am | 3 +- ipmitool/include/ipmitool/ipmi_channel.h | 173 +++++++++++++++++++++++ 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 ipmitool/include/ipmitool/ipmi_channel.h diff --git a/ipmitool/include/ipmitool/Makefile.am b/ipmitool/include/ipmitool/Makefile.am index ba49c21..5535ada 100644 --- a/ipmitool/include/ipmitool/Makefile.am +++ b/ipmitool/include/ipmitool/Makefile.am @@ -38,5 +38,6 @@ ipmitooldir = $(includedir)/ipmitool ipmitool_HEADERS = bswap.h helper.h ipmi.h ipmi_intf.h \ ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_lanp.h \ - ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h ipmi_sensor.h + ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h \ + ipmi_channel.h ipmi_sensor.h diff --git a/ipmitool/include/ipmitool/ipmi_channel.h b/ipmitool/include/ipmitool/ipmi_channel.h new file mode 100644 index 0000000..b0360d1 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_channel.h @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * 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. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_CHANNEL_H +#define IPMI_CHANNEL_H + +#include + +#define IPMI_GET_CHANNEL_AUTH_CAP 0x38 +#define IPMI_GET_CHANNEL_ACCESS 0x41 +#define IPMI_GET_CHANNEL_INFO 0x42 + + +#define IPMI_1_5_AUTH_TYPE_BIT_NONE 0x01 +#define IPMI_1_5_AUTH_TYPE_BIT_MD2 0x02 +#define IPMI_1_5_AUTH_TYPE_BIT_MD5 0x04 +#define IPMI_1_5_AUTH_TYPE_BIT_PASSWORD 0x10 +#define IPMI_1_5_AUTH_TYPE_BIT_OEM 0x20 + + +/* + * The Get Authentication Capabilities response structure + * From table 22-15 of the IPMI v2.0 spec + */ +struct get_channel_auth_cap_rsp { + unsigned char channel_number; +#if WORDS_BIGENDIAN + unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */ + unsigned char __reserved1 : 1; + unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ +#else + unsigned char enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ + unsigned char __reserved1 : 1; + unsigned char v20_data_available : 1; /* IPMI v2.0 data is available */ +#endif +#if WORDS_BIGENDIAN + unsigned char __reserved2 : 2; + unsigned char kg_status : 1; /* two-key login status */ + unsigned char per_message_auth : 1; /* per-message authentication status */ + unsigned char user_level_auth : 1; /* user-level authentication status */ + unsigned char non_null_usernames : 1; /* one or more non-null users exist */ + unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */ + unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */ +#else + unsigned char anon_login_enabled : 1; /* a null-named, null-pwd user exists */ + unsigned char null_usernames : 1; /* one or more null usernames non-null pwds */ + unsigned char non_null_usernames : 1; /* one or more non-null users exist */ + unsigned char user_level_auth : 1; /* user-level authentication status */ + unsigned char per_message_auth : 1; /* per-message authentication status */ + unsigned char kg_status : 1; /* two-key login status */ + unsigned char __reserved2 : 2; +#endif +#if WORDS_BIGENDIAN + unsigned char __reserved3 : 6; + unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ + unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ +#else + unsigned char ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ + unsigned char ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ + unsigned char __reserved3 : 6; +#endif + unsigned char oem_id[3]; /* IANA enterprise number for auth type */ + unsigned char oem_aux_data; /* Additional OEM specific data for oem auths */ +} __attribute__ ((packed)); + + + +/* + * The Get Channel Info response structure + * From table 22-29 of the IPMI v2.0 spec + */ +struct get_channel_info_rsp { +#if WORDS_BIGENDIAN + unsigned char __reserved1 : 4; + unsigned char channel_number : 4; /* channel number */ +#else + unsigned char channel_number : 4; /* channel number */ + unsigned char __reserved1 : 4; +#endif +#if WORDS_BIGENDIAN + unsigned char __reserved2 : 1; + unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */ +#else + unsigned char channel_medium : 7; /* Channel medium type per table 6-3 */ + unsigned char __reserved2 : 1; +#endif +#if WORDS_BIGENDIAN + unsigned char __reserved3 : 3; + unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */ +#else + unsigned char channel_protocol : 5; /* Channel protocol per table 6-2 */ + unsigned char __reserved3 : 3; +#endif +#if WORDS_BIGENDIAN + unsigned char session_support : 2; /* Description of session support */ + unsigned char active_sessions : 6; /* Count of active sessions */ +#else + unsigned char active_sessions : 6; /* Count of active sessions */ + unsigned char session_support : 2; /* Description of session support */ +#endif + unsigned char vendor_id[3]; /* For OEM that specified the protocol */ + unsigned char aux_info[2]; /* Not used*/ +} __attribute__ ((packed)); + + + +/* + * The Get Channel Access response structure + * From table 22-28 of the IPMI v2.0 spec + */ +struct get_channel_access_rsp { +#if WORDS_BIGENDIAN + unsigned char __reserved1 : 2; + unsigned char alerting : 1; + unsigned char per_message_auth : 1; + unsigned char user_level_auth : 1; + unsigned char access_mode : 3; +#else + unsigned char access_mode : 3; + unsigned char user_level_auth : 1; + unsigned char per_message_auth : 1; + unsigned char alerting : 1; + unsigned char __reserved1 : 2; +#endif +#if WORDS_BIGENDIAN + unsigned char __reserved2 : 4; + unsigned char channel_priv_limit : 4; /* Channel privilege level limit */ +#else + unsigned char channel_priv_limit : 4; /* Channel privilege level limit */ + unsigned char __reserved2 : 4; +#endif +} __attribute__ ((packed)); + + + +int ipmi_channel_main(struct ipmi_intf *, int, char **); +void ipmi_get_channel_auth_cap(struct ipmi_intf * intf, unsigned char channel, unsigned char priv); +void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel); + +#endif /*IPMI_CHANNEL_H*/