]>
Commit | Line | Data |
---|---|---|
5d6a636c | 1 | /** @file\r |
2 | UEFI Multicast Trivial File Tranfer Protocol v6 Definition, which is built upon\r | |
3 | the EFI UDPv6 Protocol and provides basic services for client-side unicast and/or\r | |
4 | multicast TFTP operations.\r | |
5 | \r | |
6 | Copyright (c) 2008 - 2009, Intel Corporation \r | |
7 | All rights reserved. This program and the accompanying materials \r | |
8 | are licensed and made available under the terms and conditions of the BSD License \r | |
9 | which accompanies this distribution. The full text of the license may be found at \r | |
10 | http://opensource.org/licenses/bsd-license.php \r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __EFI_MTFTP6_PROTOCOL_H__\r | |
18 | #define __EFI_MTFTP6_PROTOCOL_H__\r | |
19 | \r | |
20 | \r | |
21 | #define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \\r | |
22 | { \\r | |
23 | 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 } \\r | |
24 | }\r | |
25 | \r | |
26 | #define EFI_MTFTP6_PROTOCOL_GUID \\r | |
27 | { \\r | |
28 | 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 } \\r | |
29 | }\r | |
30 | \r | |
31 | typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;\r | |
32 | typedef struct _EFI_MTFTP6_TOKEN EFI_MTFTP6_TOKEN;\r | |
33 | \r | |
34 | ///\r | |
35 | /// MTFTP Packet OpCodes\r | |
36 | ///@{\r | |
37 | #define EFI_MTFTP6_OPCODE_RRQ 1 ///< The MTFTPv6 packet is a read request.\r | |
38 | #define EFI_MTFTP6_OPCODE_WRQ 2 ///< The MTFTPv6 packet is a write request.\r | |
39 | #define EFI_MTFTP6_OPCODE_DATA 3 ///< The MTFTPv6 packet is a data packet.\r | |
40 | #define EFI_MTFTP6_OPCODE_ACK 4 ///< The MTFTPv6 packet is an acknowledgement packet.\r | |
41 | #define EFI_MTFTP6_OPCODE_ERROR 5 ///< The MTFTPv6 packet is an error packet.\r | |
42 | #define EFI_MTFTP6_OPCODE_OACK 6 ///< The MTFTPv6 packet is an option acknowledgement packet.\r | |
43 | #define EFI_MTFTP6_OPCODE_DIR 7 ///< The MTFTPv6 packet is a directory query packet.\r | |
44 | #define EFI_MTFTP6_OPCODE_DATA8 8 ///< The MTFTPv6 packet is a data packet with a big block number. \r | |
45 | #define EFI_MTFTP6_OPCODE_ACK8 9 ///< The MTFTPv6 packet is an acknowledgement packet with a big block number.\r | |
46 | ///@}\r | |
47 | \r | |
48 | ///\r | |
49 | /// MTFTP ERROR Packet ErrorCodes\r | |
50 | ///@{\r | |
51 | ///\r | |
52 | /// The error code is not defined. See the error message in the packet (if any) for details. \r | |
53 | ///\r | |
54 | #define EFI_MTFTP6_ERRORCODE_NOT_DEFINED 0\r | |
55 | ///\r | |
56 | /// The file was not found.\r | |
57 | ///\r | |
58 | #define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND 1\r | |
59 | ///\r | |
60 | /// There was an access violation.\r | |
61 | ///\r | |
62 | #define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION 2\r | |
63 | ///\r | |
64 | /// The disk was full or its allocation was exceeded.\r | |
65 | ///\r | |
66 | #define EFI_MTFTP6_ERRORCODE_DISK_FULL 3\r | |
67 | ///\r | |
68 | /// The MTFTPv6 operation was illegal.\r | |
69 | ///\r | |
70 | #define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 6\r | |
71 | ///\r | |
72 | /// The transfer ID is unknown.\r | |
73 | ///\r | |
74 | #define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r | |
75 | ///\r | |
76 | /// The file already exists.\r | |
77 | ///\r | |
78 | #define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS 6\r | |
79 | ///\r | |
80 | /// There is no such user.\r | |
81 | ///\r | |
82 | #define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER 7\r | |
83 | ///\r | |
84 | /// The request has been denied due to option negotiation.\r | |
85 | ///\r | |
86 | #define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED 8\r | |
87 | ///@}\r | |
88 | \r | |
89 | #pragma pack(1)\r | |
90 | \r | |
91 | ///\r | |
92 | /// EFI_MTFTP6_REQ_HEADER \r | |
93 | ///\r | |
94 | typedef struct {\r | |
95 | ///\r | |
96 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_RRQ for a read request\r | |
97 | /// or OpCode = EFI_MTFTP6_OPCODE_WRQ for a write request.\r | |
98 | ///\r | |
99 | UINT16 OpCode;\r | |
100 | ///\r | |
101 | /// The file name to be downloaded or uploaded.\r | |
102 | ///\r | |
103 | UINT8 Filename[1];\r | |
104 | } EFI_MTFTP6_REQ_HEADER;\r | |
105 | \r | |
106 | ///\r | |
107 | /// EFI_MTFTP6_OACK_HEADER \r | |
108 | ///\r | |
109 | typedef struct {\r | |
110 | ///\r | |
111 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_OACK.\r | |
112 | ///\r | |
113 | UINT16 OpCode;\r | |
114 | ///\r | |
115 | /// The option strings in the option acknowledgement packet.\r | |
116 | ///\r | |
117 | UINT8 Data[1];\r | |
118 | } EFI_MTFTP6_OACK_HEADER;\r | |
119 | \r | |
120 | ///\r | |
121 | /// EFI_MTFTP6_DATA_HEADER \r | |
122 | ///\r | |
123 | typedef struct {\r | |
124 | ///\r | |
125 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA.\r | |
126 | ///\r | |
127 | UINT16 OpCode;\r | |
128 | ///\r | |
129 | /// Block number of this data packet.\r | |
130 | ///\r | |
131 | UINT16 Block;\r | |
132 | ///\r | |
133 | /// The content of this data packet.\r | |
134 | ///\r | |
135 | UINT8 Data[1];\r | |
136 | } EFI_MTFTP6_DATA_HEADER;\r | |
137 | \r | |
138 | ///\r | |
139 | /// EFI_MTFTP6_ACK_HEADER \r | |
140 | ///\r | |
141 | typedef struct {\r | |
142 | ///\r | |
143 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK.\r | |
144 | ///\r | |
145 | UINT16 OpCode;\r | |
146 | ///\r | |
147 | /// The block number of the data packet that is being acknowledged.\r | |
148 | ///\r | |
149 | UINT16 Block[1];\r | |
150 | } EFI_MTFTP6_ACK_HEADER;\r | |
151 | \r | |
152 | ///\r | |
153 | /// EFI_MTFTP6_DATA8_HEADER \r | |
154 | ///\r | |
155 | typedef struct {\r | |
156 | ///\r | |
157 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA8.\r | |
158 | ///\r | |
159 | UINT16 OpCode;\r | |
160 | ///\r | |
161 | /// The block number of data packet.\r | |
162 | ///\r | |
163 | UINT64 Block;\r | |
164 | ///\r | |
165 | /// The content of this data packet.\r | |
166 | ///\r | |
167 | UINT8 Data[1];\r | |
168 | } EFI_MTFTP6_DATA8_HEADER;\r | |
169 | \r | |
170 | ///\r | |
171 | /// EFI_MTFTP6_ACK8_HEADER \r | |
172 | ///\r | |
173 | typedef struct {\r | |
174 | ///\r | |
175 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK8.\r | |
176 | ///\r | |
177 | UINT16 OpCode;\r | |
178 | ///\r | |
179 | /// The block number of the data packet that is being acknowledged.\r | |
180 | ///\r | |
181 | UINT64 Block[1];\r | |
182 | } EFI_MTFTP6_ACK8_HEADER;\r | |
183 | \r | |
184 | ///\r | |
185 | /// EFI_MTFTP6_ERROR_HEADER \r | |
186 | ///\r | |
187 | typedef struct {\r | |
188 | ///\r | |
189 | /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.\r | |
190 | ///\r | |
191 | UINT16 OpCode;\r | |
192 | ///\r | |
193 | /// The error number as defined by the MTFTPv6 packet error codes. \r | |
194 | ///\r | |
195 | UINT16 ErrorCode;\r | |
196 | ///\r | |
197 | /// Error message string.\r | |
198 | ///\r | |
199 | UINT8 ErrorMessage[1];\r | |
200 | } EFI_MTFTP6_ERROR_HEADER;\r | |
201 | \r | |
202 | ///\r | |
203 | /// EFI_MTFTP6_PACKET \r | |
204 | ///\r | |
205 | typedef union {\r | |
206 | UINT16 OpCode; ///< Type of packets as defined by the MTFTPv6 packet opcodes.\r | |
207 | EFI_MTFTP6_REQ_HEADER Rrq; ///< Read request packet header.\r | |
208 | EFI_MTFTP6_REQ_HEADER Wrq; ///< write request packet header.\r | |
209 | EFI_MTFTP6_OACK_HEADER Oack; ///< Option acknowledge packet header.\r | |
210 | EFI_MTFTP6_DATA_HEADER Data; ///< Data packet header.\r | |
211 | EFI_MTFTP6_ACK_HEADER Ack; ///< Acknowledgement packet header.\r | |
212 | EFI_MTFTP6_DATA8_HEADER Data8; ///< Data packet header with big block number.\r | |
213 | EFI_MTFTP6_ACK8_HEADER Ack8; ///< Acknowledgement header with big block number.\r | |
214 | EFI_MTFTP6_ERROR_HEADER Error; ///< Error packet header.\r | |
215 | } EFI_MTFTP6_PACKET;\r | |
216 | \r | |
217 | #pragma pack()\r | |
218 | \r | |
219 | ///\r | |
220 | /// EFI_MTFTP6_CONFIG_DATA\r | |
221 | ///\r | |
222 | typedef struct {\r | |
223 | ///\r | |
224 | /// The local IP address to use. Set to zero to let the underlying IPv6 \r | |
225 | /// driver choose a source address. If not zero it must be one of the \r | |
226 | /// configured IP addresses in the underlying IPv6 driver.\r | |
227 | ///\r | |
228 | EFI_IPv6_ADDRESS StationIp;\r | |
229 | ///\r | |
230 | /// Local port number. Set to zero to use the automatically assigned port number.\r | |
231 | ///\r | |
232 | UINT16 LocalPort;\r | |
233 | ///\r | |
234 | /// The IP address of the MTFTPv6 server.\r | |
235 | ///\r | |
236 | EFI_IPv6_ADDRESS ServerIp;\r | |
237 | ///\r | |
238 | /// The initial MTFTPv6 server port number. Request packets are \r | |
239 | /// sent to this port. This number is almost always 69 and using zero \r | |
240 | /// defaults to 69.\r | |
241 | UINT16 InitialServerPort;\r | |
242 | ///\r | |
243 | /// The number of times to transmit MTFTPv6 request packets and wait for a response.\r | |
244 | ///\r | |
245 | UINT16 TryCount;\r | |
246 | ///\r | |
247 | /// The number of seconds to wait for a response after sending the MTFTPv6 request packet. \r | |
248 | ///\r | |
249 | UINT16 TimeoutValue;\r | |
250 | } EFI_MTFTP6_CONFIG_DATA;\r | |
251 | \r | |
252 | ///\r | |
253 | /// EFI_MTFTP6_MODE_DATA\r | |
254 | ///\r | |
255 | typedef struct {\r | |
256 | ///\r | |
257 | /// The configuration data of this instance.\r | |
258 | ///\r | |
259 | EFI_MTFTP6_CONFIG_DATA ConfigData;\r | |
260 | ///\r | |
261 | /// The number of option strings in the following SupportedOptions array.\r | |
262 | ///\r | |
263 | UINT8 SupportedOptionCount;\r | |
264 | ///\r | |
265 | /// An array of option strings that are recognized and supported by \r | |
266 | /// this EFI MTFTPv6 Protocol driver implementation. The buffer is \r | |
267 | /// read only to the caller and the caller should NOT free the buffer.\r | |
268 | ///\r | |
269 | UINT8 **SupportedOptions;\r | |
270 | } EFI_MTFTP6_MODE_DATA;\r | |
271 | \r | |
272 | ///\r | |
273 | /// EFI_MTFTP_OVERRIDE_DATA\r | |
274 | ///\r | |
275 | typedef struct {\r | |
276 | ///\r | |
277 | /// IP address of the MTFTPv6 server. If set to all zero, the value that \r | |
278 | /// was set by the EFI_MTFTP6_PROTOCOL.Configure() function will be used. \r | |
279 | ///\r | |
280 | EFI_IPv6_ADDRESS ServerIp;\r | |
281 | ///\r | |
282 | /// MTFTPv6 server port number. If set to zero, it will use the value \r | |
283 | /// that was set by the EFI_MTFTP6_PROTOCOL.Configure() function. \r | |
284 | ///\r | |
285 | UINT16 ServerPort;\r | |
286 | ///\r | |
287 | /// Number of times to transmit MTFTPv6 request packets and wait \r | |
288 | /// for a response. If set to zero, the value that was set by \r | |
289 | /// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.\r | |
290 | ///\r | |
291 | UINT16 TryCount;\r | |
292 | ///\r | |
293 | /// Number of seconds to wait for a response after sending the \r | |
294 | /// MTFTPv6 request packet. If set to zero, the value that was set by \r | |
295 | /// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r | |
296 | ///\r | |
297 | UINT16 TimeoutValue;\r | |
298 | } EFI_MTFTP6_OVERRIDE_DATA;\r | |
299 | \r | |
300 | ///\r | |
301 | /// EFI_MTFTP6_OPTION\r | |
302 | ///\r | |
303 | typedef struct {\r | |
304 | UINT8 *OptionStr; ///< Pointer to the ASCIIZ MTFTPv6 option string. \r | |
305 | UINT8 *ValueStr; ///< Pointer to the ASCIIZ MTFTPv6 value string.\r | |
306 | } EFI_MTFTP6_OPTION;\r | |
307 | \r | |
308 | /**\r | |
309 | EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r | |
310 | timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r | |
311 | EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r | |
312 | \r | |
313 | Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r | |
314 | function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r | |
315 | that is returned from this function will abort the current download process. \r | |
316 | \r | |
317 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
318 | @param[in] Token The token that the caller provided in the EFI_MTFTP6_PROTOCOl.ReadFile(),\r | |
319 | WriteFile() or ReadDirectory() function.\r | |
320 | @param[in] PacketLen Indicates the length of the packet.\r | |
321 | @param[in] Packet Pointer to an MTFTPv6 packet.\r | |
322 | \r | |
323 | @retval EFI_SUCCESS Operation sucess.\r | |
324 | @retval Others Aborts session.\r | |
325 | \r | |
326 | **/\r | |
327 | typedef\r | |
328 | EFI_STATUS \r | |
329 | (EFIAPI *EFI_MTFTP6_CHECK_PACKET)( \r | |
330 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
331 | IN EFI_MTFTP6_TOKEN *Token,\r | |
332 | IN UINT16 PacketLen,\r | |
333 | IN EFI_MTFTP6_PACKET *Packet\r | |
334 | );\r | |
335 | \r | |
336 | /**\r | |
337 | EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r | |
338 | timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r | |
339 | EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r | |
340 | \r | |
341 | Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r | |
342 | function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r | |
343 | that is returned from this function will abort the current download process. \r | |
344 | \r | |
345 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
346 | @param[in] Token The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or \r | |
347 | EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()\r | |
348 | functions by the caller.\r | |
349 | \r | |
350 | @retval EFI_SUCCESS Operation sucess.\r | |
351 | @retval Others Aborts session.\r | |
352 | \r | |
353 | **/\r | |
354 | typedef \r | |
355 | EFI_STATUS \r | |
356 | (EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)( \r | |
357 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
358 | IN EFI_MTFTP6_TOKEN *Token\r | |
359 | );\r | |
360 | \r | |
361 | /**\r | |
362 | EFI_MTFTP6_PACKET_NEEDED is a callback function that the caller provides to feed data to the \r | |
363 | EFI_MTFTP6_PROTOCOL.WriteFile() function. \r | |
364 | \r | |
365 | EFI_MTFTP6_PACKET_NEEDED provides another mechanism for the caller to provide data to upload\r | |
366 | other than a static buffer. The EFI MTFTP6 Protocol driver always calls EFI_MTFTP6_PACKET_NEEDED\r | |
367 | to get packet data from the caller if no static buffer was given in the initial call to\r | |
368 | EFI_MTFTP6_PROTOCOL.WriteFile() function. Setting *Length to zero signals the end of the session.\r | |
369 | Returning a status code other than EFI_SUCCESS aborts the session.\r | |
370 | \r | |
371 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
372 | @param[in] Token The token provided in the EFI_MTFTP6_PROTOCOL.WriteFile() by the caller.\r | |
373 | @param[in, out] Length Indicates the length of the raw data wanted on input, and the \r | |
374 | length the data available on output.\r | |
375 | @param[out] Buffer Pointer to the buffer where the data is stored.\r | |
376 | \r | |
377 | @retval EFI_SUCCESS Operation sucess.\r | |
378 | @retval Others Aborts session.\r | |
379 | \r | |
380 | **/\r | |
381 | typedef \r | |
382 | EFI_STATUS \r | |
383 | (EFIAPI *EFI_MTFTP6_PACKET_NEEDED)( \r | |
384 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
385 | IN EFI_MTFTP6_TOKEN *Token,\r | |
386 | IN OUT UINT16 *Length,\r | |
387 | OUT VOID **Buffer\r | |
388 | );\r | |
389 | \r | |
390 | struct _EFI_MTFTP6_TOKEN {\r | |
391 | ///\r | |
392 | /// The status that is returned to the caller at the end of the operation \r | |
393 | /// to indicate whether this operation completed successfully. \r | |
394 | /// Defined Status values are listed below.\r | |
395 | ///\r | |
396 | EFI_STATUS Status;\r | |
397 | ///\r | |
398 | /// The event that will be signaled when the operation completes. If \r | |
399 | /// set to NULL, the corresponding function will wait until the read or \r | |
400 | /// write operation finishes. The type of Event must be EVT_NOTIFY_SIGNAL. \r | |
401 | ///\r | |
402 | EFI_EVENT Event;\r | |
403 | ///\r | |
404 | /// If not NULL, the data that will be used to override the existing \r | |
405 | /// configure data. \r | |
406 | ///\r | |
407 | EFI_MTFTP6_OVERRIDE_DATA *OverrideData;\r | |
408 | ///\r | |
409 | /// Pointer to the ASCIIZ file name string.\r | |
410 | ///\r | |
411 | UINT8 *Filename;\r | |
412 | ///\r | |
413 | /// Pointer to the ASCIIZ mode string. If NULL, octet is used.\r | |
414 | ///\r | |
415 | UINT8 *ModeStr;\r | |
416 | ///\r | |
417 | /// Number of option/value string pairs.\r | |
418 | ///\r | |
419 | UINT32 OptionCount;\r | |
420 | ///\r | |
421 | /// Pointer to an array of option/value string pairs. Ignored if \r | |
422 | /// OptionCount is zero. Both a remote server and this driver \r | |
423 | /// implementation should support these options. If one or more \r | |
424 | /// options are unrecognized by this implementation, it is sent to the \r | |
425 | /// remote server without being changed.\r | |
426 | ///\r | |
427 | EFI_MTFTP6_OPTION *OptionList;\r | |
428 | ///\r | |
429 | /// On input, the size, in bytes, of Buffer. On output, the number \r | |
430 | /// of bytes transferred.\r | |
431 | ///\r | |
432 | UINT64 BufferSize; \r | |
433 | ///\r | |
434 | /// Pointer to the data buffer. Data that is downloaded from the \r | |
435 | /// MTFTPv6 server is stored here. Data that is uploaded to the \r | |
436 | /// MTFTPv6 server is read from here. Ignored if BufferSize is zero.\r | |
437 | ///\r | |
438 | VOID *Buffer;\r | |
439 | ///\r | |
440 | /// Pointer to the context that will be used by CheckPacket, \r | |
441 | /// TimeoutCallback and PacketNeeded.\r | |
442 | ///\r | |
443 | VOID *Context;\r | |
444 | ///\r | |
445 | /// Pointer to the callback function to check the contents of the \r | |
446 | /// received packet. \r | |
447 | ///\r | |
448 | EFI_MTFTP6_CHECK_PACKET CheckPacket;\r | |
449 | ///\r | |
450 | /// Pointer to the function to be called when a timeout occurs.\r | |
451 | ///\r | |
452 | EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback;\r | |
453 | ///\r | |
454 | /// Pointer to the function to provide the needed packet contents. \r | |
455 | /// Only used in WriteFile() operation.\r | |
456 | ///\r | |
457 | EFI_MTFTP6_PACKET_NEEDED PacketNeeded;\r | |
458 | };\r | |
459 | \r | |
460 | /**\r | |
461 | Read the current operational settings.\r | |
462 | \r | |
463 | The GetModeData() function reads the current operational settings of this EFI MTFTPv6\r | |
464 | Protocol driver instance.\r | |
465 | \r | |
466 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
467 | @param[out] ModeData The buffer in which the EFI MTFTPv6 Protocol driver mode\r | |
468 | data is returned.\r | |
469 | \r | |
470 | @retval EFI_SUCCESS The configuration data was successfully returned.\r | |
471 | @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r | |
472 | @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r | |
473 | \r | |
474 | **/\r | |
475 | typedef \r | |
476 | EFI_STATUS \r | |
477 | (EFIAPI *EFI_MTFTP6_GET_MODE_DATA)(\r | |
478 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
479 | OUT EFI_MTFTP6_MODE_DATA *ModeData\r | |
480 | );\r | |
481 | \r | |
482 | /**\r | |
483 | Initializes, changes, or resets the default operational setting for this EFI MTFTPv6\r | |
484 | Protocol driver instance.\r | |
485 | \r | |
486 | The Configure() function is used to set and change the configuration data for this EFI \r | |
487 | MTFTPv6 Protocol driver instance. The configuration data can be reset to startup defaults by calling \r | |
488 | Configure() with MtftpConfigData set to NULL. Whenever the instance is reset, any \r | |
489 | pending operation is aborted. By changing the EFI MTFTPv6 Protocol driver instance configuration \r | |
490 | data, the client can connect to different MTFTPv6 servers. The configuration parameters in \r | |
491 | MtftpConfigData are used as the default parameters in later MTFTPv6 operations and can be \r | |
492 | overridden in later operations.\r | |
493 | \r | |
494 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
495 | @param[in] MtftpConfigData Pointer to the configuration data structure. \r | |
496 | \r | |
497 | @retval EFI_SUCCESS The EFI MTFTPv6 Protocol instance was configured successfully.\r | |
498 | @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r | |
499 | - This is NULL.\r | |
500 | - MtftpConfigData.StationIp is neither zero nor one \r | |
501 | of the configured IP addresses in the underlying IPv6 driver.\r | |
502 | - MtftpCofigData.ServerIp is not a valid IPv6 unicast address.\r | |
503 | - The StationIP and LocalPort is already in use\r | |
504 | @retval EFI_ACCESS_DENIED The configuration could not be changed at this time because there \r | |
505 | is some MTFTP background operation in progress.\r | |
506 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r | |
507 | address for this instance, but no source address was available for use\r | |
508 | \r | |
509 | **/\r | |
510 | typedef \r | |
511 | EFI_STATUS \r | |
512 | (EFIAPI *EFI_MTFTP6_CONFIGURE)(\r | |
513 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
01a54966 | 514 | IN EFI_MTFTP6_CONFIG_DATA *MtftpConfigData OPTIONAL\r |
5d6a636c | 515 | );\r |
516 | \r | |
517 | /**\r | |
518 | Get information about a file from an MTFTPv6 server.\r | |
519 | \r | |
520 | The GetInfo() function assembles an MTFTPv6 request packet with options, sends it to the \r | |
521 | MTFTPv6 server, and may return an MTFTPv6 OACK, MTFTPv6 ERROR, or ICMP ERROR packet. \r | |
522 | Retries occur only if no response packets are received from the MTFTPv6 server before the \r | |
523 | timeout expires.\r | |
524 | \r | |
525 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
526 | @param[in] OverrideData Data that is used to override the existing parameters. If NULL, the \r | |
527 | default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()\r | |
528 | function are used. \r | |
529 | @param[in] Filename Pointer to ASCIIZ file name string.\r | |
530 | @param[in] ModeStr Pointer to ASCIIZ mode string. If NULL, octet will be used \r | |
531 | @param[in] OptionCount Number of option/value string pairs in OptionList.\r | |
532 | @param[in] OptionList Pointer to array of option/value string pairs. Ignored if \r | |
533 | OptionCount is zero.\r | |
534 | @param[out] PacketLength The number of bytes in the returned packet.\r | |
535 | @param[out] Packet The pointer to the received packet. This buffer must be freed by \r | |
536 | the caller.\r | |
537 | \r | |
538 | @retval EFI_SUCCESS An MTFTPv6 OACK packet was received and is in the Buffer.\r | |
539 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
540 | - This is NULL.\r | |
541 | - Filename is NULL\r | |
542 | - OptionCount is not zero and OptionList is NULL.\r | |
543 | - One or more options in OptionList have wrong format.\r | |
544 | - PacketLength is NULL.\r | |
545 | - OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
546 | @retval EFI_UNSUPPORTED One or more options in the OptionList are unsupported by \r | |
547 | this implementation.\r | |
548 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
549 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r | |
550 | address for this instance, but no source address was available for use.\r | |
551 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
552 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
553 | @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received and is in the Packet.\r | |
554 | @retval EFI_ICMP_ERROR An ICMP ERROR packet was received and the Packet is set to NULL.\r | |
555 | @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received and is in the Packet.\r | |
556 | @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r | |
557 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
558 | \r | |
559 | **/\r | |
560 | typedef \r | |
561 | EFI_STATUS \r | |
562 | (EFIAPI *EFI_MTFTP6_GET_INFO)(\r | |
563 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
564 | IN EFI_MTFTP6_OVERRIDE_DATA *OverrideData OPTIONAL,\r | |
565 | IN UINT8 *Filename,\r | |
566 | IN UINT8 *ModeStr OPTIONAL,\r | |
567 | IN UINT8 OptionCount,\r | |
568 | IN EFI_MTFTP6_OPTION *OptionList OPTIONAL,\r | |
569 | OUT UINT32 *PacketLength,\r | |
570 | OUT EFI_MTFTP6_PACKET **Packet OPTIONAL\r | |
571 | );\r | |
572 | \r | |
573 | /**\r | |
574 | Parse the options in an MTFTPv6 OACK packet.\r | |
575 | \r | |
576 | The ParseOptions() function parses the option fields in an MTFTPv6 OACK packet and \r | |
577 | returns the number of options that were found and optionally a list of pointers to \r | |
578 | the options in the packet.\r | |
579 | If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned\r | |
580 | and *OptionCount and *OptionList stop at the last valid option.\r | |
581 | \r | |
582 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
583 | @param[in] PacketLen Length of the OACK packet to be parsed.\r | |
584 | @param[in] Packet Pointer to the OACK packet to be parsed. \r | |
585 | @param[out] OptionCount Pointer to the number of options in the following OptionList. \r | |
586 | @param[out] OptionList Pointer to EFI_MTFTP6_OPTION storage. Each pointer in the \r | |
587 | OptionList points to the corresponding MTFTP option buffer \r | |
588 | in the Packet. Call the EFI Boot Service FreePool() to \r | |
589 | release the OptionList if the options in this OptionList \r | |
590 | are not needed any more. \r | |
591 | \r | |
592 | @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and \r | |
593 | OptionList parameters have been updated.\r | |
594 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
595 | - PacketLen is 0.\r | |
596 | - Packet is NULL or Packet is not a valid MTFTPv6 packet.\r | |
597 | - OptionCount is NULL.\r | |
598 | @retval EFI_NOT_FOUND No options were found in the OACK packet.\r | |
599 | @retval EFI_OUT_OF_RESOURCES Storage for the OptionList array can not be allocated.\r | |
600 | @retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.\r | |
601 | \r | |
602 | **/\r | |
603 | typedef \r | |
604 | EFI_STATUS \r | |
605 | (EFIAPI *EFI_MTFTP6_PARSE_OPTIONS)(\r | |
606 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
607 | IN UINT32 PacketLen,\r | |
608 | IN EFI_MTFTP6_PACKET *Packet,\r | |
609 | OUT UINT32 *OptionCount,\r | |
610 | OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL\r | |
611 | );\r | |
612 | \r | |
613 | /**\r | |
614 | Download a file from an MTFTPv6 server.\r | |
615 | \r | |
616 | The ReadFile() function is used to initialize and start an MTFTPv6 download process and \r | |
617 | optionally wait for completion. When the download operation completes, whether successfully or \r | |
618 | not, the Token.Status field is updated by the EFI MTFTPv6 Protocol driver and then \r | |
619 | Token.Event is signaled if it is not NULL.\r | |
620 | \r | |
621 | Data can be downloaded from the MTFTPv6 server into either of the following locations:\r | |
622 | - A fixed buffer that is pointed to by Token.Buffer \r | |
623 | - A download service function that is pointed to by Token.CheckPacket \r | |
624 | \r | |
625 | If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r | |
626 | will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r | |
627 | \r | |
628 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
629 | @param[in] Token Pointer to the token structure to provide the parameters that are \r | |
630 | used in this operation.\r | |
631 | \r | |
632 | @retval EFI_SUCCESS The data file has been transferred successfully.\r | |
633 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
634 | @retval EFI_BUFFER_TOO_SMALL BufferSize is not large enough to hold the downloaded data \r | |
635 | in downloading process.\r | |
636 | @retval EFI_ABORTED Current operation is aborted by user.\r | |
637 | @retval EFI_ICMP_ERROR An ICMP ERROR packet was received.\r | |
638 | @retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.\r | |
639 | @retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received.\r | |
640 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
641 | \r | |
642 | **/\r | |
643 | typedef \r | |
644 | EFI_STATUS \r | |
645 | (EFIAPI *EFI_MTFTP6_READ_FILE)(\r | |
646 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
647 | IN EFI_MTFTP6_TOKEN *Token\r | |
648 | );\r | |
649 | \r | |
650 | /**\r | |
651 | Send a file to an MTFTPv6 server. May be unsupported in some implementations.\r | |
652 | \r | |
653 | The WriteFile() function is used to initialize an uploading operation with the given option list \r | |
654 | and optionally wait for completion. If one or more of the options is not supported by the server, the \r | |
655 | unsupported options are ignored and a standard TFTP process starts instead. When the upload \r | |
656 | process completes, whether successfully or not, Token.Event is signaled, and the EFI MTFTPv6 \r | |
657 | Protocol driver updates Token.Status.\r | |
658 | \r | |
659 | The caller can supply the data to be uploaded in the following two modes:\r | |
660 | - Through the user-provided buffer\r | |
661 | - Through a callback function\r | |
662 | \r | |
663 | With the user-provided buffer, the Token.BufferSize field indicates the length of the buffer, \r | |
664 | and the driver will upload the data in the buffer. With an EFI_MTFTP6_PACKET_NEEDED \r | |
665 | callback function, the driver will call this callback function to get more data from the user to upload. \r | |
666 | See the definition of EFI_MTFTP6_PACKET_NEEDED for more information. These two modes \r | |
667 | cannot be used at the same time. The callback function will be ignored if the user provides the \r | |
668 | buffer.\r | |
669 | \r | |
670 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
671 | @param[in] Token Pointer to the token structure to provide the parameters that are \r | |
672 | used in this operation.\r | |
673 | \r | |
674 | @retval EFI_SUCCESS The upload session has started.\r | |
675 | @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r | |
676 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
677 | - This is NULL.\r | |
678 | - Token is NULL.\r | |
679 | - Token.Filename is NULL.\r | |
680 | - Token.OptionCount is not zero and Token.OptionList is NULL.\r | |
681 | - One or more options in Token.OptionList have wrong format.\r | |
682 | - Token.Buffer and Token.PacketNeeded are both NULL.\r | |
683 | - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
684 | @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not \r | |
685 | supported by this implementation.\r | |
686 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
687 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r | |
688 | address for this instance, but no source address was available for use.\r | |
689 | @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r | |
690 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
691 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
692 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
693 | \r | |
694 | **/\r | |
695 | typedef \r | |
696 | EFI_STATUS \r | |
697 | (EFIAPI *EFI_MTFTP6_WRITE_FILE)(\r | |
698 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
699 | IN EFI_MTFTP6_TOKEN *Token\r | |
700 | );\r | |
701 | \r | |
702 | /**\r | |
703 | Download a data file directory from an MTFTPv6 server. May be unsupported in some implementations.\r | |
704 | \r | |
705 | The ReadDirectory() function is used to return a list of files on the MTFTPv6 server that are \r | |
706 | logically (or operationally) related to Token.Filename. The directory request packet that is sent \r | |
707 | to the server is built with the option list that was provided by caller, if present.\r | |
708 | \r | |
709 | The file information that the server returns is put into either of the following locations:\r | |
710 | - A fixed buffer that is pointed to by Token.Buffer \r | |
711 | - A download service function that is pointed to by Token.CheckPacket \r | |
712 | \r | |
713 | If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r | |
714 | will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r | |
715 | \r | |
716 | The returned directory listing in the Token.Buffer or EFI_MTFTP6_PACKET consists of a list \r | |
717 | of two or three variable-length ASCII strings, each terminated by a null character, for each file in the \r | |
718 | directory. If the multicast option is involved, the first field of each directory entry is the static \r | |
719 | multicast IP address and UDP port number that is associated with the file name. The format of the \r | |
720 | field is ip:ip:ip:ip:port. If the multicast option is not involved, this field and its terminating \r | |
721 | null character are not present.\r | |
722 | \r | |
723 | The next field of each directory entry is the file name and the last field is the file information string. \r | |
724 | The information string contains the file size and the create/modify timestamp. The format of the \r | |
725 | information string is filesize yyyy-mm-dd hh:mm:ss:ffff. The timestamp is \r | |
726 | Coordinated Universal Time (UTC; also known as Greenwich Mean Time [GMT]).\r | |
727 | \r | |
728 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
729 | @param[in] Token Pointer to the token structure to provide the parameters that are \r | |
730 | used in this operation.\r | |
731 | \r | |
732 | @retval EFI_SUCCESS The MTFTPv6 related file "directory" has been downloaded.\r | |
733 | @retval EFI_UNSUPPORTED The EFI MTFTPv6 Protocol driver does not support this function.\r | |
734 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
735 | - This is NULL.\r | |
736 | - Token is NULL.\r | |
737 | - Token.Filename is NULL.\r | |
738 | - Token.OptionCount is not zero and Token.OptionList is NULL.\r | |
739 | - One or more options in Token.OptionList have wrong format.\r | |
740 | - Token.Buffer and Token.CheckPacket are both NULL.\r | |
741 | - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r | |
742 | @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not \r | |
743 | supported by this implementation.\r | |
744 | @retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.\r | |
745 | @retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source \r | |
746 | address for this instance, but no source address was available for use.\r | |
747 | @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.\r | |
748 | @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r | |
749 | @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r | |
750 | @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r | |
751 | \r | |
752 | **/\r | |
753 | typedef \r | |
754 | EFI_STATUS \r | |
755 | (EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(\r | |
756 | IN EFI_MTFTP6_PROTOCOL *This,\r | |
757 | IN EFI_MTFTP6_TOKEN *Token\r | |
758 | );\r | |
759 | \r | |
760 | /**\r | |
761 | Polls for incoming data packets and processes outgoing data packets. \r | |
762 | \r | |
763 | The Poll() function can be used by network drivers and applications to increase the rate that data \r | |
764 | packets are moved between the communications device and the transmit and receive queues.\r | |
765 | In some systems, the periodic timer event in the managed network driver may not poll the \r | |
766 | underlying communications device fast enough to transmit and/or receive all data packets without \r | |
767 | missing incoming packets or dropping outgoing packets. Drivers and applications that are \r | |
768 | experiencing packet loss should try calling the Poll() function more often. \r | |
769 | \r | |
770 | @param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.\r | |
771 | \r | |
772 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
773 | @retval EFI_NOT_STARTED This EFI MTFTPv6 Protocol instance has not been started.\r | |
774 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
775 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. \r | |
776 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r | |
777 | Consider increasing the polling rate.\r | |
778 | \r | |
779 | **/\r | |
780 | typedef\r | |
781 | EFI_STATUS\r | |
782 | (EFIAPI *EFI_MTFTP6_POLL)(\r | |
783 | IN EFI_MTFTP6_PROTOCOL *This\r | |
784 | );\r | |
785 | \r | |
786 | ///\r | |
787 | /// The EFI_MTFTP6_PROTOCOL is designed to be used by UEFI drivers and applications to transmit \r | |
788 | /// and receive data files. The EFI MTFTPv6 Protocol driver uses the underlying EFI UDPv6 Protocol \r | |
789 | /// driver and EFI IPv6 Protocol driver.\r | |
790 | ///\r | |
791 | struct _EFI_MTFTP6_PROTOCOL {\r | |
792 | EFI_MTFTP6_GET_MODE_DATA GetModeData;\r | |
793 | EFI_MTFTP6_CONFIGURE Configure;\r | |
794 | EFI_MTFTP6_GET_INFO GetInfo;\r | |
795 | EFI_MTFTP6_PARSE_OPTIONS ParseOptions;\r | |
796 | EFI_MTFTP6_READ_FILE ReadFile;\r | |
797 | EFI_MTFTP6_WRITE_FILE WriteFile;\r | |
798 | EFI_MTFTP6_READ_DIRECTORY ReadDirectory;\r | |
799 | EFI_MTFTP6_POLL Poll;\r | |
800 | };\r | |
801 | \r | |
802 | extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;\r | |
803 | extern EFI_GUID gEfiMtftp6ProtocolGuid;\r | |
804 | \r | |
805 | #endif\r | |
806 | \r |