xref: /titanic_41/usr/src/cmd/lms/LMS_if_compat.h (revision 56e2cc86321ec889bf83a888d902c60d6fb2ef8d)
1 /*******************************************************************************
2  * Copyright (C) 2004-2008 Intel Corp. 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 are met:
6  *
7  *  - Redistributions of source code must retain the above copyright notice,
8  *    this list of conditions and the following disclaimer.
9  *
10  *  - Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  *  - Neither the name of Intel Corp. nor the names of its
15  *    contributors may be used to endorse or promote products derived from this
16  *    software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *******************************************************************************/
30 
31 #ifndef _LMS_IF_COMPAT_H_
32 #define _LMS_IF_COMPAT_H_
33 
34 #include "types.h"
35 
36 // disable the "zero-sized array" warning in Visual C++
37 #ifdef _MSC_VER
38 #pragma warning(disable:4200)
39 #endif
40 
41 #pragma pack(1)
42 
43 typedef enum {
44 	LMS_MESSAGE_TYPE_OPEN_CONNECTION       = 0x01,
45 	LMS_MESSAGE_TYPE_OPEN_CONNECTION_REPLY = 0x02,
46 	LMS_MESSAGE_TYPE_CLOSE_CONNECTION      = 0x03,
47 	LMS_MESSAGE_TYPE_SEND_DATA             = 0x04,
48 	LMS_MESSAGE_TYPE_IP_FQDN_REQUEST       = 0x05,
49 	LMS_MESSAGE_TYPE_IP_FQDN               = 0x06,
50 	LMS_MESSAGE_TYPE_PROTO_VERSION         = 0x07,
51 	LMS_MESSAGE_TYPE_PROTO_VERSION_REPLY   = 0x08,
52 	LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX    = 0x0a
53 } LMS_MESSAGE_TYPE;
54 
55 typedef enum {
56 	LMS_PROTOCOL_TYPE_TCP_IPV4 = 0x00,
57 	LMS_PROTOCOL_TYPE_UDP_IPV4 = 0x01,
58 	LMS_PROTOCOL_TYPE_TCP_IPV6 = 0x02,
59 	LMS_PROTOCOL_TYPE_UDP_IPV6 = 0x03
60 } LMS_PROTOCOL_TYPE;
61 
62 typedef enum {
63 	LMS_CONNECTION_STATUS_OK       = 0x00,
64 	LMS_CONNECTION_STATUS_FAILED   = 0x01,
65 	LMS_CONNECTION_STATUS_TOO_MANY = 0x02
66 } LMS_CONNECTION_STATUS;
67 
68 typedef enum {
69 	LMS_CLOSE_STATUS_CLIENT   = 0x00,
70 	LMS_CLOSE_STATUS_INTERNAL = 0x01,
71 	LMS_CLOSE_STATUS_SOCKET   = 0x02,
72 	LMS_CLOSE_STATUS_SHUTDOWN = 0x03
73 } LMS_CLOSE_STATUS;
74 
75 typedef enum {
76 	LMS_IP_ADDRESS_SHARED    = 0x00,
77 	LMS_IP_ADDRESS_DUAL_IPV4 = 0x01,
78 	LMS_IP_ADDRESS_DUAL_IPV6 = 0x02
79 } LMS_IP_ADDRESS_TYPE;
80 
81 typedef enum {
82 	LMS_PROTOCOL_STATUS_OK              = 0x00,
83 	LMS_PROTOCOL_STATUS_PROPOSE_ANOTHER = 0x01
84 } LMS_PROTOCOL_STATUS;
85 
86 /**
87  * LMS_OPEN_CONNECTION_MESSAGE - open connection request
88  *
89  * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION
90  * @ConnectionId: 0 if sent from LMS, positive if sent from LME
91  * @Protocol: One of LMS_PROTOCOL_TYPE
92  * @OpenRequestId: Any number; used to match the request to the response
93  * @HostIPAddress: Source IP address of the initiating application, in network
94  *                 order (Big Endian). If IPv4, only the first 4 bytes are used
95  *                 and the rest must be 0.
96  * @HostPort: Source port of the initiating application, in network order (Big
97  *            Endian).
98  * @MEPort: Destination port of the initiating application, in network order
99  *          (Big Endian).
100  */
101 typedef struct {
102 	UINT8 MessageType;
103 	UINT8 ConnectionId;
104 	UINT8 Protocol;
105 	UINT8 OpenRequestId;
106 	UINT8 HostIPAddress[16];
107 	UINT16 HostPort;
108 	UINT16 MEPort;
109 } LMS_OPEN_CONNECTION_MESSAGE;
110 
111 /**
112  * LMS_OPEN_CONNECTION_REPLY_MESSAGE - open connection reply
113  *
114  * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_REPLY
115  * @ConnectionId: Assigned by LME
116  * @Status: One of LMS_CONNECTION_STATUS
117  * @OpenRequestId: The same as the OpenRequestID value in the open connection
118  *                 request message.
119  */
120 typedef struct {
121 	UINT8 MessageType;
122 	UINT8 ConnectionId;
123 	UINT8 Status;
124 	UINT8 OpenRequestId;
125 } LMS_OPEN_CONNECTION_REPLY_MESSAGE;
126 
127 /**
128  * LMS_OPEN_CONNECTION_EX_MESSAGE - open connection request
129  *
130  * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX
131  * @ConnectionId: Unique identifier
132  * @Protocol: One of LMS_PROTOCOL_TYPE
133  * @Flags: If first bit is set then Host is an hostname, otherwise Host is an IP address.
134  *         If second bit is set then connection is from remote console, otherwise
135  *         it is from local application. The other bits must be zero.
136  * @Reserved: Must be zero
137  * @OpenRequestId: Any number; used to match the request to the response
138  * @Host: Source IP address of the initiating application, in network
139  *                 order (Big Endian). If IPv4, only the first 4 bytes are used
140  *                 and the rest must be 0.
141  * @HostPort: Source port of the initiating application, in network order (Big
142  *            Endian).
143  * @MEPort: Destination port of the initiating application, in network order
144  *          (Big Endian).
145  */
146 
147 #define HOSTNAME_BIT 0x1
148 #define REMOTE_BIT 0x2
149 
150 #define FQDN_MAX_SIZE 256
151 
152 typedef struct {
153 	UINT8 MessageType;
154 	UINT8 ConnectionId;
155 	UINT8 Protocol;
156 	UINT8 Flags;
157 	UINT32 Reserved;
158 	UINT8 OpenRequestId;
159 	UINT8 Host[FQDN_MAX_SIZE];
160 	UINT16 HostPort;
161 	UINT16 MEPort;
162 } LMS_OPEN_CONNECTION_EX_MESSAGE;
163 
164 ///**
165 // * LMS_OPEN_CONNECTION_EX_REPLY_MESSAGE - open connection reply
166 // *
167 // * @MessageType: LMS_MESSAGE_TYPE_OPEN_CONNECTION_EX_REPLY
168 // * @ConnectionId: Should match value in connection request
169 // * @Status: One of LMS_CONNECTION_STATUS
170 // * @OpenRequestId: The same as the OpenRequestID value in the open connection
171 // *                 request message.
172 // */
173 //typedef struct {
174 //	UINT8 MessageType;
175 //	UINT8 ConnectionId;
176 //	UINT8 Status;
177 //	UINT8 OpenRequestId;
178 //} LMS_OPEN_CONNECTION_EX_REPLY_MESSAGE;
179 
180 /**
181  * LMS_CLOSE_CONNECTION_MESSAGE - close connection request
182  *
183  * @MessageType: LMS_MESSAGE_TYPE_CLOSE_CONNECTION
184  * @ConnectionId: The connection ID chosen by the LME when the connection
185  *                was established.
186  * @ClosingReason: One of LMS_CLOSE_STATUS
187  */
188 typedef struct {
189 	UINT8 MessageType;
190 	UINT8 ConnectionId;
191 	UINT8 ClosingReason;
192 } LMS_CLOSE_CONNECTION_MESSAGE;
193 
194 /**
195  * LMS_SEND_DATA_MESSAGE - sends data betwen LMS and LME
196  *
197  * @MessageType: LMS_MESSAGE_TYPE_SEND_DATA
198  * @ConnectionId: The connection ID chosen by the LME when the connection
199  *                was established.
200  * @DataLength: Length of data field, in Big Endian.
201  * @Data: The data to transfer
202  */
203 typedef struct {
204 	UINT8 MessageType;
205 	UINT8 ConnectionId;
206 	UINT16 DataLength;
207 	UINT8 Data[0];
208 } LMS_SEND_DATA_MESSAGE;
209 
210 /**
211  * LMS_IP_FQDN_REQUEST_MESSAGE - Requests IP/FQDN data
212  *
213  * @MessageType: LMS_MESSAGE_TYPE_IP_FQDN_REQUEST
214  * @ConnectionId: Must be 0.
215  */
216 typedef struct {
217 	UINT8 MessageType;
218 	UINT8 ConnectionId;
219 } LMS_IP_FQDN_REQUEST_MESSAGE;
220 
221 /**
222  * LMS_IP_FQDN_MESSAGE - sends IP/FQDN info
223  *
224  * @MessageType: LMS_MESSAGE_TYPE_IP_FQDN
225  * @ConnectionId: Must be 0.
226  * @IPType: One of LMS_IP_ADDRESS_TYPE.
227  * @Reserved: Must be 0.
228  * @AMTIPAddress: The Intel(R) AMT IP address, in network order (Big Endian).
229  *                If IPv4, then only the first 4 bytes are used and the rest
230  *                must be 0.
231  * @FQDN: A NUL terminated string specifying the Fully Qualified Domain Name.
232  */
233 typedef struct {
234 	UINT8 MessageType;
235 	UINT8 ConnectionId;
236 	UINT8 IPType;
237 	UINT8 Reserved;
238 	UINT8 AMTIPAddress[16];
239 	UINT8 FQDN[FQDN_MAX_SIZE];
240 } LMS_IP_FQDN_MESSAGE;
241 
242 /**
243  * LMS_PROTO_VERSION_MESSAGE - sends protocol version information
244  *
245  * @MessageType: LMS_MESSAGE_TYPE_PROTO_VERSION
246  * @ConnectionId: Must be 0.
247  * @Protocol: Protocol version.
248  */
249 typedef struct {
250 	UINT8 MessageType;
251 	UINT8 ConnectionId;
252 	UINT8 Protocol;
253 } LMS_PROTO_VERSION_MESSAGE;
254 
255 /**
256  * LMS_PROTO_VERSION_REPLY_MESSAGE - sends protocol version information
257  *
258  * @MessageType: LMS_MESSAGE_TYPE_PROTO_VERSION_REPLY
259  * @ConnectionId: Must be 0.
260  * @Protocol: Protocol version.
261  * @Status: One of LMS_PROTOCOL_STATUS.
262  */
263 typedef struct {
264 	UINT8 MessageType;
265 	UINT8 ConnectionId;
266 	UINT8 Protocol;
267 	UINT8 Status;
268 } LMS_PROTO_VERSION_REPLY_MESSAGE;
269 
270 #pragma pack()
271 
272 #endif
273 
274