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_RMCP_H 34 #define IPMI_RMCP_H 35 36 #include <ipmitool/helper.h> 37 #include "lan.h" 38 #include "asf.h" 39 40 #define RMCP_VERSION_1 0x06 41 42 #define RMCP_UDP_PORT 0x26f /* port 623 */ 43 #define RMCP_UDP_SECURE_PORT 0x298 /* port 664 */ 44 45 #define RMCP_TYPE_MASK 0x80 46 #define RMCP_TYPE_NORM 0x00 47 #define RMCP_TYPE_ACK 0x01 48 49 static const struct valstr rmcp_type_vals[] __attribute__((unused)) = { 50 { RMCP_TYPE_NORM, "Normal RMCP" }, 51 { RMCP_TYPE_ACK, "RMCP ACK" }, 52 { 0, NULL } 53 }; 54 55 #define RMCP_CLASS_MASK 0x1f 56 #define RMCP_CLASS_ASF 0x06 57 #define RMCP_CLASS_IPMI 0x07 58 #define RMCP_CLASS_OEM 0x08 59 60 static const struct valstr rmcp_class_vals[] __attribute__((unused)) = { 61 { RMCP_CLASS_ASF, "ASF" }, 62 { RMCP_CLASS_IPMI, "IPMI" }, 63 { RMCP_CLASS_OEM, "OEM" }, 64 { 0, NULL } 65 }; 66 67 #ifdef HAVE_PRAGMA_PACK 68 #pragma pack(1) 69 #endif 70 /* RMCP message header */ 71 struct rmcp_hdr { 72 uint8_t ver; 73 uint8_t __reserved; 74 uint8_t seq; 75 uint8_t class; 76 } ATTRIBUTE_PACKING; 77 #ifdef HAVE_PRAGMA_PACK 78 #pragma pack(0) 79 #endif 80 81 #ifdef HAVE_PRAGMA_PACK 82 #pragma pack(1) 83 #endif 84 struct rmcp_pong { 85 struct rmcp_hdr rmcp; 86 struct asf_hdr asf; 87 uint32_t iana; 88 uint32_t oem; 89 uint8_t sup_entities; 90 uint8_t sup_interact; 91 uint8_t reserved[6]; 92 } ATTRIBUTE_PACKING; 93 #ifdef HAVE_PRAGMA_PACK 94 #pragma pack(0) 95 #endif 96 97 int handle_rmcp(struct ipmi_intf * intf, uint8_t * data, int data_len); 98 99 #endif /* IPMI_RMCP_H */ 100