summaryrefslogtreecommitdiff
path: root/usr/src/lib/libipmi/common/ipmi_lan.h
blob: b84e728b32474933945df13e020a9722f57a631c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef IPMI_LAN_H
#define	IPMI_LAN_H

#ifdef	__cplusplus
extern "C" {
#endif

#pragma pack(1)

#define	IPMI_CMD_GET_SESSION_CHALLENGE	0x39
#define	IPMI_CMD_ACTIVATE_SESSION	0x3a
#define	IPMI_CMD_SET_SESSION_PRIVLVL	0x3b
#define	IPMI_CMD_CLOSE_SESSION		0x3c

#define	IPMI_AUTHCODE_BUF_SIZE		20
/*
 * See section 22.13
 */
#define	IPMI_SESSION_AUTHTYPE_NONE	0x01
#define	IPMI_SESSION_AUTHTYPE_MD2	0x02
#define	IPMI_SESSION_AUTHTYPE_MD5	0x04
#define	IPMI_SESSION_AUTHTYPE_PASSWORD	0x10
#define	IPMI_SESSION_AUTHTYPE_OEM	0x20

#define	IPMI_SESSION_PRIV_UNSPECIFIED   0x0
#define	IPMI_SESSION_PRIV_CALLBACK	0x1
#define	IPMI_SESSION_PRIV_USER		0x2
#define	IPMI_SESSION_PRIV_OPERATOR	0x3
#define	IPMI_SESSION_PRIV_ADMIN		0x4
#define	IPMI_SESSION_PRIV_OEM		0x5

#define	IPMI_BMC_SLAVE_ADDR	0x20
#define	IPMI_BUF_SIZE		1024
#define	IPMI_REMOTE_SWID	0x81

/*
 * The primary RMCP port
 */
#define	RMCP_UDP_PORT		623

/*
 * The ASF IANA Enterprise Number
 */
#define	ASF_RMCP_IANA		4542

/*
 * ASF Message Types for presence ping and pong
 */
#define	ASF_TYPE_PING		0x80
#define	ASF_TYPE_PONG		0x40

/*
 * ASF message header
 *
 * See section 13.2.3
 */
typedef struct asf_hdr {
	uint32_t	ah_iana;
	uint8_t		ah_msg_type;
	uint8_t		ah_msg_tag;
	uint8_t		__reserved1;
	uint8_t		ah_dlen;
} asf_hdr_t;

/*
 * RMCP message header
 *
 * See section 13.1.3
 */
#define	RMCP_VERSION_1		0x06
#define	RMCP_CLASS_ASF		0x06
#define	RMCP_CLASS_IPMI		0x07
#define	RMCP_CLASS_OEM		0x08

typedef struct rmcp_hdr {
	uint8_t rh_version;
	uint8_t __reserved1;
	uint8_t rh_seq;
	DECL_BITFIELD3(
	    rh_msg_class:5,
	    __reserved2:2,
	    rh_msg_type:1);
} rmcp_hdr_t;

/*
 * IPMI Session Header
 *
 * The IPMI session header contains some optional payload fields that are only
 * present in RMCP+ sessions or if the payload type is "OEM explicit".  This
 * structure is only intended to represent the session header for IPMI v1.5
 * messages.
 *
 * See section 13.6
 */
typedef struct v15_session_hdr {
	uint8_t		sh_authtype;
	uint32_t	sh_seq;
	uint32_t	sh_id;
}  v15_session_hdr_t;

/*
 * IPMI Lan Message Header
 *
 * See section 13.8
 */
typedef struct ipmi_msg_hdr {
	uint8_t imh_addr1;
	DECL_BITFIELD2(
	    imh_lun:2,
	    imh_netfn:6);
	uint8_t	imh_csum;
	uint8_t imh_addr2;
	uint8_t imh_seq;
	uint8_t imh_cmd;
} ipmi_msg_hdr_t;

#pragma pack()

#ifdef	__cplusplus
}
#endif

#endif /* IPMI_LAN_H */