1 /* 2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistribution of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * Redistribution in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * Neither the name of Sun Microsystems, Inc. or the names of 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * This software is provided "AS IS," without a warranty of any kind. 20 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, 21 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A 22 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. 23 * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE 24 * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING 25 * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL 26 * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, 27 * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR 28 * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF 29 * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, 30 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 31 */ 32 33 #ifndef IPMI_SESSION_H 34 #define IPMI_SESSION_H 35 36 #if HAVE_CONFIG_H 37 # include <config.h> 38 #endif 39 #include <ipmitool/ipmi.h> 40 41 #define IPMI_GET_SESSION_INFO 0x3D 42 43 /* 44 * From table 22.25 of the IPMIv2 specification 45 */ 46 #ifdef HAVE_PRAGMA_PACK 47 #pragma pack(1) 48 #endif 49 struct get_session_info_rsp 50 { 51 uint8_t session_handle; 52 53 #if WORDS_BIGENDIAN 54 uint8_t __reserved1 : 2; 55 uint8_t session_slot_count : 6; /* 1-based */ 56 #else 57 uint8_t session_slot_count : 6; /* 1-based */ 58 uint8_t __reserved1 : 2; 59 #endif 60 61 #if WORDS_BIGENDIAN 62 uint8_t __reserved2 : 2; 63 uint8_t active_session_count : 6; /* 1-based */ 64 #else 65 uint8_t active_session_count : 6; /* 1-based */ 66 uint8_t __reserved2 : 2; 67 #endif 68 69 #if WORDS_BIGENDIAN 70 uint8_t __reserved3 : 2; 71 uint8_t user_id : 6; 72 #else 73 uint8_t user_id : 6; 74 uint8_t __reserved3 : 2; 75 #endif 76 77 #if WORDS_BIGENDIAN 78 uint8_t __reserved4 : 4; 79 uint8_t privilege_level : 4; 80 #else 81 uint8_t privilege_level : 4; 82 uint8_t __reserved4 : 4; 83 #endif 84 85 #if WORDS_BIGENDIAN 86 uint8_t auxiliary_data : 4; 87 uint8_t channel_number : 4; 88 #else 89 uint8_t channel_number : 4; 90 uint8_t auxiliary_data : 4; 91 #endif 92 93 union 94 { 95 /* Only exists if channel type is 802.3 LAN */ 96 struct 97 { 98 uint8_t console_ip[4]; /* MSBF */ 99 uint8_t console_mac[6]; /* MSBF */ 100 uint16_t console_port; /* LSBF */ 101 } lan_data; 102 103 /* Only exists if channel type is async. serial modem */ 104 struct 105 { 106 uint8_t session_channel_activity_type; 107 108 #if WORDS_BIGENDIAN 109 uint8_t __reserved5 : 4; 110 uint8_t destination_selector : 4; 111 #else 112 uint8_t destination_selector : 4; 113 uint8_t __reserved5 : 4; 114 #endif 115 116 uint8_t console_ip[4]; /* MSBF */ 117 118 /* Only exists if session is PPP */ 119 uint16_t console_port; /* LSBF */ 120 } modem_data; 121 } channel_data; 122 } ATTRIBUTE_PACKING; 123 #ifdef HAVE_PRAGMA_PACK 124 #pragma pack(0) 125 #endif 126 127 128 129 int ipmi_session_main(struct ipmi_intf *, int, char **); 130 131 #endif /*IPMI_CHANNEL_H*/ 132