xref: /openbmc/ipmitool/src/plugins/lanplus/rmcp.h (revision c18ec02f3304ce2a889a50e378f07a4168af3884)
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 "lanplus.h"
38 
39 #define RMCP_VERSION_1		0x06
40 
41 #define RMCP_UDP_PORT		0x26f /* port 623 */
42 #define RMCP_UDP_SECURE_PORT	0x298 /* port 664 */
43 
44 #define RMCP_TYPE_MASK		0x80
45 #define RMCP_TYPE_NORM		0x00
46 #define RMCP_TYPE_ACK		0x01
47 
48 static const struct valstr rmcp_type_vals[] __attribute__((unused)) = {
49 	{ RMCP_TYPE_NORM,	"Normal RMCP" },
50 	{ RMCP_TYPE_ACK,	"RMCP ACK" },
51 	{ 0,			NULL }
52 };
53 
54 #define RMCP_CLASS_MASK		0x1f
55 #define RMCP_CLASS_ASF		0x06
56 #define RMCP_CLASS_IPMI		0x07
57 #define RMCP_CLASS_OEM		0x08
58 
59 static const struct valstr rmcp_class_vals[] __attribute__((unused)) = {
60 	{ RMCP_CLASS_ASF,	"ASF" },
61 	{ RMCP_CLASS_IPMI,	"IPMI" },
62 	{ RMCP_CLASS_OEM,	"OEM" },
63 	{ 0,			NULL }
64 };
65 
66 /* RMCP message header */
67 #ifdef HAVE_PRAGMA_PACK
68 #pragma pack(1)
69 #endif
70 struct rmcp_hdr {
71 	uint8_t ver;
72 	uint8_t __reserved;
73 	uint8_t seq;
74 	uint8_t class;
75 } ATTRIBUTE_PACKING;
76 #ifdef HAVE_PRAGMA_PACK
77 #pragma pack(0)
78 #endif
79 
80 int handle_rmcp(struct ipmi_intf * intf, uint8_t * data, int data_len);
81 
82 #endif /* IPMI_RMCP_H */
83