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_SOL_H 34 #define IPMI_SOL_H 35 36 #include <ipmitool/ipmi.h> 37 38 #define SOL_ESCAPE_CHARACTER_DEFAULT '~' 39 #define SOL_KEEPALIVE_TIMEOUT 15 40 #define SOL_KEEPALIVE_RETRIES 3 41 42 #define IPMI_SOL_SERIAL_ALERT_MASK_SUCCEED 0x08 43 #define IPMI_SOL_SERIAL_ALERT_MASK_DEFERRED 0x04 44 #define IPMI_SOL_SERIAL_ALERT_MASK_FAIL 0x00 45 #define IPMI_SOL_BMC_ASSERTS_CTS_MASK_TRUE 0x00 46 #define IPMI_SOL_BMC_ASSERTS_CTS_MASK_FALSE 0x02 47 48 49 struct sol_config_parameters { 50 uint8_t set_in_progress; 51 uint8_t enabled; 52 uint8_t force_encryption; 53 uint8_t force_authentication; 54 uint8_t privilege_level; 55 uint8_t character_accumulate_level; 56 uint8_t character_send_threshold; 57 uint8_t retry_count; 58 uint8_t retry_interval; 59 uint8_t non_volatile_bit_rate; 60 uint8_t volatile_bit_rate; 61 uint8_t payload_channel; 62 uint16_t payload_port; 63 }; 64 65 66 /* 67 * The ACTIVATE PAYLOAD command reponse structure 68 * From table 24-2 of the IPMI v2.0 spec 69 */ 70 #ifdef PRAGMA_PACK 71 #pramga pack(1) 72 #endif 73 struct activate_payload_rsp { 74 uint8_t auxiliary_data[4]; 75 uint8_t inbound_payload_size[2]; /* LS byte first */ 76 uint8_t outbound_payload_size[2]; /* LS byte first */ 77 uint8_t payload_udp_port[2]; /* LS byte first */ 78 uint8_t payload_vlan_number[2]; /* LS byte first */ 79 } ATTRIBUTE_PACKING; 80 #ifdef PRAGMA_PACK 81 #pramga pack(0) 82 #endif 83 84 /* 85 * Small function to validate that user-supplied SOL 86 * configuration parameter values we store in uint8_t 87 * data type falls within valid range. With minval 88 * and maxval parameters we can use the same function 89 * to validate parameters that have different ranges 90 * of values. 91 * 92 * function will return -1 if value is not valid, or 93 * will return 0 if valid. 94 */ 95 int ipmi_sol_set_param_isvalid_uint8_t( const char *strval, 96 const char *name, 97 int base, 98 uint8_t minval, 99 uint8_t maxval, 100 uint8_t *out_value); 101 102 int ipmi_sol_main(struct ipmi_intf *, int, char **); 103 int ipmi_get_sol_info(struct ipmi_intf * intf, 104 uint8_t channel, 105 struct sol_config_parameters * params); 106 107 108 #endif /* IPMI_SOL_H */ 109