summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lms/LMS_if_compat.h
blob: b6224fa470a7f83b18d84d0ab5483d2bbaed34f8 (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*******************************************************************************
 * Copyright (C) 2004-2008 Intel Corp. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  - Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 *  - Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 *  - Neither the name of Intel Corp. nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *******************************************************************************/

#ifndef _LMS_IF_COMPAT_H_
#define _LMS_IF_COMPAT_H_

#include "types.h"

// disable the "zero-sized array" warning in Visual C++
#ifdef _MSC_VER
#pragma warning(disable:4200)
#endif

#pragma pack(1)

typedef enum {
	LMS_MESSAGE_TYPE_OPEN_CONNECTION       = 0x01,
	LMS_MESSAGE_TYPE_OPEN_CONNECTION_REPLY = 0x02,
	LMS_MESSAGE_TYPE_CLOSE_CONNECTION      = 0x03,
	LMS_MESSAGE_TYPE_SEND_DATA             = 0x04,
	LMS_MESSAGE_TYPE_IP_FQDN_REQUEST       = 0x05,
	LMS_MESSAGE_TYPE_IP_FQDN               = 0x06,
	LMS_MESSAGE_TYPE_PROTO_VERSION         = 0x07,
	LMS_MESSAGE_TYPE_PROTO_VERSION_REPLY   = 0x08,
	LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX    = 0x0a
} LMS_MESSAGE_TYPE;

typedef enum {
	LMS_PROTOCOL_TYPE_TCP_IPV4 = 0x00,
	LMS_PROTOCOL_TYPE_UDP_IPV4 = 0x01,
	LMS_PROTOCOL_TYPE_TCP_IPV6 = 0x02,
	LMS_PROTOCOL_TYPE_UDP_IPV6 = 0x03
} LMS_PROTOCOL_TYPE;

typedef enum {
	LMS_CONNECTION_STATUS_OK       = 0x00,
	LMS_CONNECTION_STATUS_FAILED   = 0x01,
	LMS_CONNECTION_STATUS_TOO_MANY = 0x02
} LMS_CONNECTION_STATUS;

typedef enum {
	LMS_CLOSE_STATUS_CLIENT   = 0x00,
	LMS_CLOSE_STATUS_INTERNAL = 0x01,
	LMS_CLOSE_STATUS_SOCKET   = 0x02,
	LMS_CLOSE_STATUS_SHUTDOWN = 0x03
} LMS_CLOSE_STATUS;

typedef enum {
	LMS_IP_ADDRESS_SHARED    = 0x00,
	LMS_IP_ADDRESS_DUAL_IPV4 = 0x01,
	LMS_IP_ADDRESS_DUAL_IPV6 = 0x02
} LMS_IP_ADDRESS_TYPE;

typedef enum {
	LMS_PROTOCOL_STATUS_OK              = 0x00,
	LMS_PROTOCOL_STATUS_PROPOSE_ANOTHER = 0x01
} LMS_PROTOCOL_STATUS;

/**
 * LMS_OPEN_CONNECTION_MESSAGE - open connection request
 *
 * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION
 * @ConnectionId: 0 if sent from LMS, positive if sent from LME
 * @Protocol: One of LMS_PROTOCOL_TYPE
 * @OpenRequestId: Any number; used to match the request to the response
 * @HostIPAddress: Source IP address of the initiating application, in network
 *                 order (Big Endian). If IPv4, only the first 4 bytes are used
 *                 and the rest must be 0.
 * @HostPort: Source port of the initiating application, in network order (Big
 *            Endian).
 * @MEPort: Destination port of the initiating application, in network order
 *          (Big Endian).
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 Protocol;
	UINT8 OpenRequestId;
	UINT8 HostIPAddress[16];
	UINT16 HostPort;
	UINT16 MEPort;
} LMS_OPEN_CONNECTION_MESSAGE;

/**
 * LMS_OPEN_CONNECTION_REPLY_MESSAGE - open connection reply
 *
 * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_REPLY
 * @ConnectionId: Assigned by LME
 * @Status: One of LMS_CONNECTION_STATUS
 * @OpenRequestId: The same as the OpenRequestID value in the open connection
 *                 request message.
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 Status;
	UINT8 OpenRequestId;
} LMS_OPEN_CONNECTION_REPLY_MESSAGE;

/**
 * LMS_OPEN_CONNECTION_EX_MESSAGE - open connection request
 *
 * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX
 * @ConnectionId: Unique identifier
 * @Protocol: One of LMS_PROTOCOL_TYPE
 * @Flags: If first bit is set then Host is an hostname, otherwise Host is an IP address.
 *         If second bit is set then connection is from remote console, otherwise
 *         it is from local application. The other bits must be zero.
 * @Reserved: Must be zero
 * @OpenRequestId: Any number; used to match the request to the response
 * @Host: Source IP address of the initiating application, in network
 *                 order (Big Endian). If IPv4, only the first 4 bytes are used
 *                 and the rest must be 0. 
 * @HostPort: Source port of the initiating application, in network order (Big
 *            Endian).
 * @MEPort: Destination port of the initiating application, in network order
 *          (Big Endian).
 */

#define HOSTNAME_BIT 0x1
#define REMOTE_BIT 0x2

#define FQDN_MAX_SIZE 256

typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 Protocol;
	UINT8 Flags;
	UINT32 Reserved;
	UINT8 OpenRequestId;
	UINT8 Host[FQDN_MAX_SIZE];
	UINT16 HostPort;
	UINT16 MEPort;
} LMS_OPEN_CONNECTION_EX_MESSAGE;

///**
// * LMS_OPEN_CONNECTION_EX_REPLY_MESSAGE - open connection reply
// *
// * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX_REPLY
// * @ConnectionId: Should match value in connection request
// * @Status: One of LMS_CONNECTION_STATUS
// * @OpenRequestId: The same as the OpenRequestID value in the open connection
// *                 request message.
// */
//typedef struct {
//	UINT8 MessageType;
//	UINT8 ConnectionId;
//	UINT8 Status;
//	UINT8 OpenRequestId;
//} LMS_OPEN_CONNECTION_EX_REPLY_MESSAGE;

/**
 * LMS_CLOSE_CONNECTION_MESSAGE - close connection request
 *
 * @MessageType: LMS_MESSAGE_TYPE_CLOSE_CONNECTION
 * @ConnectionId: The connection ID chosen by the LME when the connection
 *                was established.
 * @ClosingReason: One of LMS_CLOSE_STATUS
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 ClosingReason;
} LMS_CLOSE_CONNECTION_MESSAGE;

/**
 * LMS_SEND_DATA_MESSAGE - sends data betwen LMS and LME
 *
 * @MessageType: LMS_MESSAGE_TYPE_SEND_DATA
 * @ConnectionId: The connection ID chosen by the LME when the connection
 *                was established.
 * @DataLength: Length of data field, in Big Endian.
 * @Data: The data to transfer
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT16 DataLength;
	UINT8 Data[0];
} LMS_SEND_DATA_MESSAGE;

/**
 * LMS_IP_FQDN_REQUEST_MESSAGE - Requests IP/FQDN data
 *
 * @MessageType: LMS_MESSAGE_TYPE_IP_FQDN_REQUEST
 * @ConnectionId: Must be 0.
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
} LMS_IP_FQDN_REQUEST_MESSAGE;

/**
 * LMS_IP_FQDN_MESSAGE - sends IP/FQDN info
 *
 * @MessageType: LMS_MESSAGE_TYPE_IP_FQDN
 * @ConnectionId: Must be 0.
 * @IPType: One of LMS_IP_ADDRESS_TYPE.
 * @Reserved: Must be 0.
 * @AMTIPAddress: The Intel(R) AMT IP address, in network order (Big Endian).
 *                If IPv4, then only the first 4 bytes are used and the rest
 *                must be 0.
 * @FQDN: A NUL terminated string specifying the Fully Qualified Domain Name.
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 IPType;
	UINT8 Reserved;
	UINT8 AMTIPAddress[16];
	UINT8 FQDN[FQDN_MAX_SIZE];
} LMS_IP_FQDN_MESSAGE;

/**
 * LMS_PROTO_VERSION_MESSAGE - sends protocol version information
 *
 * @MessageType: LMS_MESSAGE_TYPE_PROTO_VERSION
 * @ConnectionId: Must be 0.
 * @Protocol: Protocol version.
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 Protocol;
} LMS_PROTO_VERSION_MESSAGE;

/**
 * LMS_PROTO_VERSION_REPLY_MESSAGE - sends protocol version information
 *
 * @MessageType: LMS_MESSAGE_TYPE_PROTO_VERSION_REPLY
 * @ConnectionId: Must be 0.
 * @Protocol: Protocol version.
 * @Status: One of LMS_PROTOCOL_STATUS.
 */
typedef struct {
	UINT8 MessageType;
	UINT8 ConnectionId;
	UINT8 Protocol;
	UINT8 Status;
} LMS_PROTO_VERSION_REPLY_MESSAGE;

#pragma pack()

#endif