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_H_
32#define _LMS_IF_H_
33
34#include "types.h"
35#include "LMS_if_constants.h"
36
37// disable the "zero-sized array" warning in Visual C++
38#ifdef _MSC_VER
39#pragma warning(disable:4200)
40#endif
41
42#pragma pack(1)
43
44typedef struct {
45	UINT8  MessageType;
46} APF_MESSAGE_HEADER;
47
48
49/**
50 * APF_GENERIC_HEADER - generic request header (note that its not complete header per protocol (missing WantReply)
51 *
52 * @MessageType:
53 * @RequestStringLength: length of the string identifies the request
54 * @RequestString: the string that identifies the request
55 **/
56
57typedef struct {
58	UINT8  MessageType;
59	UINT32 StringLength;
60	UINT8  String[0];
61} APF_GENERIC_HEADER;
62
63/**
64 * TCP forward reply message
65 * @MessageType - Protocol's Major version
66 * @PortBound - the TCP port was bound on the server
67 **/
68typedef struct {
69	UINT8  MessageType;
70	UINT32 PortBound;
71} APF_TCP_FORWARD_REPLY_MESSAGE;
72
73/**
74 * response to ChannelOpen when channel open succeed
75 * @MessageType - APF_CHANNEL_OPEN_CONFIRMATION
76 * @RecipientChannel - channel number given in the open request
77 * @SenderChannel - channel number assigned by the sender
78 * @InitialWindowSize - Number of bytes in the window
79 * @Reserved - Reserved
80 **/
81typedef struct {
82	UINT8  MessageType;
83	UINT32 RecipientChannel;
84	UINT32 SenderChannel;
85	UINT32 InitialWindowSize;
86	UINT32 Reserved;
87} APF_CHANNEL_OPEN_CONFIRMATION_MESSAGE;
88
89/**
90 * response to ChannelOpen when a channel open failed
91 * @MessageType - APF_CHANNEL_OPEN_FAILURE
92 * @RecipientChannel - channel number given in the open request
93 * @ReasonCode - code for the reason channel could not be open
94 * @Reserved - Reserved
95 **/
96typedef struct {
97	UINT8  MessageType;
98	UINT32 RecipientChannel;
99	UINT32 ReasonCode;
100	UINT32 Reserved;
101	UINT32 Reserved2;
102} APF_CHANNEL_OPEN_FAILURE_MESSAGE;
103
104/**
105 * close channel message
106 * @MessageType - APF_CHANNEL_CLOSE
107 * @RecipientChannel - channel number given in the open request
108 **/
109typedef struct {
110	UINT8  MessageType;
111	UINT32 RecipientChannel;
112} APF_CHANNEL_CLOSE_MESSAGE;
113
114/**
115 * used to send/receive data.
116 * @MessageType - APF_CHANNEL_DATA
117 * @RecipientChannel - channel number given in the open request
118 * @Length - Length of the data in the message
119 * @Data - The data in the message
120 **/
121typedef struct {
122	UINT8  MessageType;
123	UINT32 RecipientChannel;
124	UINT32 DataLength;
125	UINT8  Data[0];
126} APF_CHANNEL_DATA_MESSAGE;
127
128/**
129 * used to adjust receive window size.
130 * @MessageType - APF_WINDOW_ADJUST
131 * @RecipientChannel - channel number given in the open request
132 * @BytesToAdd - number of bytes to add to current window size value
133 **/
134typedef struct {
135	UINT8  MessageType;
136	UINT32 RecipientChannel;
137	UINT32 BytesToAdd;
138} APF_WINDOW_ADJUST_MESSAGE;
139
140/**
141 * This message causes immediate termination of the connection with AMT.
142 * @ReasonCode -  A Reason code for the disconnection event
143 * @Reserved - Reserved must be set to 0
144 **/
145typedef struct {
146	UINT8  MessageType;
147	UINT32 ReasonCode;
148	UINT16 Reserved;
149} APF_DISCONNECT_MESSAGE;
150
151/**
152 * Used to request a service identified by name
153 * @ServiceNameLength -  The length of the service name string.
154 * @ServiceName - The name of the service being requested.
155 **/
156typedef struct {
157	UINT8  MessageType;
158	UINT32 ServiceNameLength;
159	UINT8  ServiceName[0];
160} APF_SERVICE_REQUEST_MESSAGE;
161
162/**
163 * Used to send a service accept identified by name
164 * @ServiceNameLength -  The length of the service name string.
165 * @ServiceName - The name of the service being requested.
166 **/
167typedef struct {
168	UINT8  MessageType;
169	UINT32 ServiceNameLength;
170	UINT8  ServiceName[0];
171} APF_SERVICE_ACCEPT_MESSAGE;
172
173/**
174 * holds the protocl major and minor version implemented by AMT.
175 * @MajorVersion - Protocol's Major version
176 * @MinorVersion - Protocol's Minor version
177 * @Trigger - The open session reason
178 * @UUID - System Id
179 **/
180typedef struct {
181	UINT8  MessageType;
182	UINT32 MajorVersion;
183	UINT32 MinorVersion;
184	UINT32 TriggerReason;
185	UINT8  UUID[16];
186	UINT8  Reserved[64];
187} APF_PROTOCOL_VERSION_MESSAGE;
188
189/**
190 * holds the user authentication request.
191 * @UsernameLength - The length of the user name string.
192 * @Username - The name of the user in ASCII encoding.
193 *             Maximum allowed size is 64 bytes.
194 * @ServiceNameLength - The length of the service name string.
195 * @ServiceName - The name of the service to authorize.
196 * @MethodNameLength - The length of the method name string.
197 * @MethodName - The authentication method to use.
198 **/
199//typedef struct {
200//	UINT8  MessageType;
201//	UINT32 UsernameLength;
202//	UINT8  Username[0];
203//	UINT32 ServiceNameLength;
204//	UINT8  ServiceName[0];
205//	UINT32 MethodNameLength;
206//	UINT8  MethodName[0];
207//} APF_USERAUTH_REQUEST_MESSAGE;
208
209/**
210 * holds the user authentication request failure reponse.
211 * @MethodNameListLength - The length of the methods list string.
212 * @MethodNameList - A comma seperated string of authentication
213 *			methods supported by the server in ASCII.
214 **/
215//typedef struct {
216//	UINT8  MessageType;
217//	UINT32 MethodNameListLength;
218//	UINT8  MethodNameList[0];
219//	UINT8  Reserved;
220//} APF_USERAUTH_FAILURE_MESSAGE;
221
222/**
223 * holds the user authentication request success reponse.
224 **/
225typedef struct {
226	UINT8  MessageType;
227} APF_USERAUTH_SUCCESS_MESSAGE;
228
229#pragma pack()
230
231#endif
232
233