]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Mtftp4.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / Mtftp4.h
CommitLineData
d1f95000 1/** @file\r
00b7cc0f 2 EFI Multicast Trivial File Transfer Protocol Definition\r
d1f95000 3\r
9095d37b 4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
5899caf0 6\r
bce46f7e 7 @par Revision Reference:\r
5899caf0 8 This Protocol is introduced in UEFI Specification 2.0\r
d1f95000 9\r
d1f95000 10**/\r
11\r
12#ifndef __EFI_MTFTP4_PROTOCOL_H__\r
13#define __EFI_MTFTP4_PROTOCOL_H__\r
14\r
15#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \\r
16 { \\r
17 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } \\r
18 }\r
19\r
20#define EFI_MTFTP4_PROTOCOL_GUID \\r
21 { \\r
22 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b } \\r
23 }\r
24\r
25typedef struct _EFI_MTFTP4_PROTOCOL EFI_MTFTP4_PROTOCOL;\r
26typedef struct _EFI_MTFTP4_TOKEN EFI_MTFTP4_TOKEN;\r
27\r
28//\r
29//MTFTP4 packet opcode definition\r
30//\r
31#define EFI_MTFTP4_OPCODE_RRQ 1\r
32#define EFI_MTFTP4_OPCODE_WRQ 2\r
33#define EFI_MTFTP4_OPCODE_DATA 3\r
34#define EFI_MTFTP4_OPCODE_ACK 4\r
35#define EFI_MTFTP4_OPCODE_ERROR 5\r
36#define EFI_MTFTP4_OPCODE_OACK 6\r
37#define EFI_MTFTP4_OPCODE_DIR 7\r
38#define EFI_MTFTP4_OPCODE_DATA8 8\r
39#define EFI_MTFTP4_OPCODE_ACK8 9\r
40\r
41//\r
42// MTFTP4 error code definition\r
43//\r
44#define EFI_MTFTP4_ERRORCODE_NOT_DEFINED 0\r
45#define EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND 1\r
46#define EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION 2\r
47#define EFI_MTFTP4_ERRORCODE_DISK_FULL 3\r
48#define EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION 4\r
49#define EFI_MTFTP4_ERRORCODE_UNKNOWN_TRANSFER_ID 5\r
50#define EFI_MTFTP4_ERRORCODE_FILE_ALREADY_EXISTS 6\r
51#define EFI_MTFTP4_ERRORCODE_NO_SUCH_USER 7\r
52#define EFI_MTFTP4_ERRORCODE_REQUEST_DENIED 8\r
53\r
54//\r
55// MTFTP4 pacekt definitions\r
56//\r
57#pragma pack(1)\r
58\r
59typedef struct {\r
60 UINT16 OpCode;\r
61 UINT8 Filename[1];\r
62} EFI_MTFTP4_REQ_HEADER;\r
63\r
64typedef struct {\r
65 UINT16 OpCode;\r
66 UINT8 Data[1];\r
67} EFI_MTFTP4_OACK_HEADER;\r
68\r
69typedef struct {\r
70 UINT16 OpCode;\r
71 UINT16 Block;\r
72 UINT8 Data[1];\r
73} EFI_MTFTP4_DATA_HEADER;\r
74\r
75typedef struct {\r
76 UINT16 OpCode;\r
77 UINT16 Block[1];\r
78} EFI_MTFTP4_ACK_HEADER;\r
79\r
80typedef struct {\r
81 UINT16 OpCode;\r
82 UINT64 Block;\r
83 UINT8 Data[1];\r
84} EFI_MTFTP4_DATA8_HEADER;\r
85\r
86typedef struct {\r
87 UINT16 OpCode;\r
88 UINT64 Block[1];\r
89} EFI_MTFTP4_ACK8_HEADER;\r
90\r
91typedef struct {\r
92 UINT16 OpCode;\r
93 UINT16 ErrorCode;\r
94 UINT8 ErrorMessage[1];\r
95} EFI_MTFTP4_ERROR_HEADER;\r
96\r
97typedef union {\r
992f22b9
LG
98 ///\r
99 /// Type of packets as defined by the MTFTPv4 packet opcodes.\r
100 ///\r
d1f95000 101 UINT16 OpCode;\r
992f22b9
LG
102 ///\r
103 /// Read request packet header.\r
104 ///\r
d1f95000 105 EFI_MTFTP4_REQ_HEADER Rrq;\r
992f22b9
LG
106 ///\r
107 /// Write request packet header.\r
108 ///\r
d1f95000 109 EFI_MTFTP4_REQ_HEADER Wrq;\r
992f22b9
LG
110 ///\r
111 /// Option acknowledge packet header.\r
112 ///\r
d1f95000 113 EFI_MTFTP4_OACK_HEADER Oack;\r
992f22b9
LG
114 ///\r
115 /// Data packet header.\r
116 ///\r
d1f95000 117 EFI_MTFTP4_DATA_HEADER Data;\r
992f22b9
LG
118 ///\r
119 /// Acknowledgement packet header.\r
120 ///\r
d1f95000 121 EFI_MTFTP4_ACK_HEADER Ack;\r
992f22b9
LG
122 ///\r
123 /// Data packet header with big block number.\r
124 ///\r
d1f95000 125 EFI_MTFTP4_DATA8_HEADER Data8;\r
992f22b9
LG
126 ///\r
127 /// Acknowledgement header with big block num.\r
128 ///\r
d1f95000 129 EFI_MTFTP4_ACK8_HEADER Ack8;\r
992f22b9
LG
130 ///\r
131 /// Error packet header.\r
132 ///\r
d1f95000 133 EFI_MTFTP4_ERROR_HEADER Error;\r
134} EFI_MTFTP4_PACKET;\r
135\r
136#pragma pack()\r
137\r
99e8ed21 138///\r
af2dc6a7 139/// MTFTP4 option definition.\r
99e8ed21 140///\r
d1f95000 141typedef struct {\r
142 UINT8 *OptionStr;\r
143 UINT8 *ValueStr;\r
144} EFI_MTFTP4_OPTION;\r
145\r
146\r
147typedef struct {\r
148 BOOLEAN UseDefaultSetting;\r
149 EFI_IPv4_ADDRESS StationIp;\r
150 EFI_IPv4_ADDRESS SubnetMask;\r
151 UINT16 LocalPort;\r
152 EFI_IPv4_ADDRESS GatewayIp;\r
153 EFI_IPv4_ADDRESS ServerIp;\r
154 UINT16 InitialServerPort;\r
155 UINT16 TryCount;\r
156 UINT16 TimeoutValue;\r
157} EFI_MTFTP4_CONFIG_DATA;\r
158\r
159\r
160typedef struct {\r
161 EFI_MTFTP4_CONFIG_DATA ConfigData;\r
bce46f7e 162 UINT8 SupportedOptionCount;\r
d1f95000 163 UINT8 **SupportedOptoins;\r
bce46f7e 164 UINT8 UnsupportedOptionCount;\r
d1f95000 165 UINT8 **UnsupportedOptoins;\r
166} EFI_MTFTP4_MODE_DATA;\r
167\r
168\r
169typedef struct {\r
170 EFI_IPv4_ADDRESS GatewayIp;\r
171 EFI_IPv4_ADDRESS ServerIp;\r
172 UINT16 ServerPort;\r
173 UINT16 TryCount;\r
174 UINT16 TimeoutValue;\r
175} EFI_MTFTP4_OVERRIDE_DATA;\r
176\r
177//\r
178// Protocol interfaces definition\r
179//\r
180\r
181/**\r
bce46f7e 182 A callback function that is provided by the caller to intercept\r
d1f95000 183 the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the\r
bce46f7e 184 EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept\r
185 EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to\r
186 EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory().\r
d1f95000 187\r
af2dc6a7 188 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 189 @param Token The token that the caller provided in the\r
190 EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile()\r
191 or ReadDirectory() function.\r
192 @param PacketLen Indicates the length of the packet.\r
af2dc6a7 193 @param Packet The pointer to an MTFTPv4 packet.\r
d1f95000 194\r
af2dc6a7 195 @retval EFI_SUCCESS The operation was successful.\r
196 @retval Others Aborts the transfer process.\r
d1f95000 197\r
198**/\r
bce46f7e 199typedef\r
200EFI_STATUS\r
201(EFIAPI *EFI_MTFTP4_CHECK_PACKET)(\r
d1f95000 202 IN EFI_MTFTP4_PROTOCOL *This,\r
203 IN EFI_MTFTP4_TOKEN *Token,\r
204 IN UINT16 PacketLen,\r
205 IN EFI_MTFTP4_PACKET *Paket\r
ed66e1bc 206 );\r
d1f95000 207\r
208/**\r
00b7cc0f 209 Timeout callback function.\r
d1f95000 210\r
af2dc6a7 211 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 212 @param Token The token that is provided in the\r
213 EFI_MTFTP4_PROTOCOL.ReadFile() or\r
214 EFI_MTFTP4_PROTOCOL.WriteFile() or\r
215 EFI_MTFTP4_PROTOCOL.ReadDirectory() functions\r
216 by the caller.\r
bce46f7e 217\r
af2dc6a7 218 @retval EFI_SUCCESS The operation was successful.\r
d1f95000 219 @retval Others Aborts download process.\r
220\r
221**/\r
bce46f7e 222typedef\r
223EFI_STATUS\r
224(EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)(\r
d1f95000 225 IN EFI_MTFTP4_PROTOCOL *This,\r
226 IN EFI_MTFTP4_TOKEN *Token\r
ed66e1bc 227 );\r
d1f95000 228\r
229/**\r
630b4187 230 A callback function that the caller provides to feed data to the\r
d1f95000 231 EFI_MTFTP4_PROTOCOL.WriteFile() function.\r
232\r
af2dc6a7 233 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 234 @param Token The token provided in the\r
235 EFI_MTFTP4_PROTOCOL.WriteFile() by the caller.\r
236 @param Length Indicates the length of the raw data wanted on input, and the\r
237 length the data available on output.\r
af2dc6a7 238 @param Buffer The pointer to the buffer where the data is stored.\r
d1f95000 239\r
af2dc6a7 240 @retval EFI_SUCCESS The operation was successful.\r
d1f95000 241 @retval Others Aborts session.\r
242\r
243**/\r
bce46f7e 244typedef\r
245EFI_STATUS\r
246(EFIAPI *EFI_MTFTP4_PACKET_NEEDED)(\r
d1f95000 247 IN EFI_MTFTP4_PROTOCOL *This,\r
248 IN EFI_MTFTP4_TOKEN *Token,\r
249 IN OUT UINT16 *Length,\r
250 OUT VOID **Buffer\r
ed66e1bc 251 );\r
d1f95000 252\r
253\r
254/**\r
255 Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
256\r
af2dc6a7 257 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
258 @param ModeData The pointer to storage for the EFI MTFTPv4 Protocol driver mode data.\r
d1f95000 259\r
260 @retval EFI_SUCCESS The configuration data was successfully returned.\r
261 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r
262 @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r
263\r
264**/\r
bce46f7e 265typedef\r
266EFI_STATUS\r
d1f95000 267(EFIAPI *EFI_MTFTP4_GET_MODE_DATA)(\r
268 IN EFI_MTFTP4_PROTOCOL *This,\r
269 OUT EFI_MTFTP4_MODE_DATA *ModeData\r
ed66e1bc 270 );\r
d1f95000 271\r
272\r
273/**\r
bce46f7e 274 Initializes, changes, or resets the default operational setting for this\r
d1f95000 275 EFI MTFTPv4 Protocol driver instance.\r
276\r
af2dc6a7 277 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
278 @param MtftpConfigData The pointer to the configuration data structure.\r
d1f95000 279\r
280 @retval EFI_SUCCESS The EFI MTFTPv4 Protocol driver was configured successfully.\r
281 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
282 @retval EFI_ACCESS_DENIED The EFI configuration could not be changed at this time because\r
283 there is one MTFTP background operation in progress.\r
284 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
285 RARP, etc.) has not finished yet.\r
286 @retval EFI_UNSUPPORTED A configuration protocol (DHCP, BOOTP, RARP, etc.) could not\r
287 be located when clients choose to use the default address\r
288 settings.\r
289 @retval EFI_OUT_OF_RESOURCES The EFI MTFTPv4 Protocol driver instance data could not be\r
290 allocated.\r
291 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI\r
292 MTFTPv4 Protocol driver instance is not configured.\r
293\r
294**/\r
bce46f7e 295typedef\r
296EFI_STATUS\r
d1f95000 297(EFIAPI *EFI_MTFTP4_CONFIGURE)(\r
298 IN EFI_MTFTP4_PROTOCOL *This,\r
299 IN EFI_MTFTP4_CONFIG_DATA *MtftpConfigData OPTIONAL\r
bce46f7e 300 );\r
301\r
302\r
d1f95000 303/**\r
304 Gets information about a file from an MTFTPv4 server.\r
305\r
af2dc6a7 306 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 307 @param OverrideData Data that is used to override the existing parameters. If NULL,\r
308 the default parameters that were set in the\r
309 EFI_MTFTP4_PROTOCOL.Configure() function are used.\r
4f077902
SZ
310 @param Filename The pointer to null-terminated ASCII file name string.\r
311 @param ModeStr The pointer to null-terminated ASCII mode string. If NULL, "octet" will be used.\r
d1f95000 312 @param OptionCount Number of option/value string pairs in OptionList.\r
af2dc6a7 313 @param OptionList The pointer to array of option/value string pairs. Ignored if\r
d1f95000 314 OptionCount is zero.\r
315 @param PacketLength The number of bytes in the returned packet.\r
316 @param Packet The pointer to the received packet. This buffer must be freed by\r
317 the caller.\r
318\r
abbfadd7 319 @retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Packet.\r
320 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
321 - This is NULL.\r
322 - Filename is NULL.\r
323 - OptionCount is not zero and OptionList is NULL.\r
324 - One or more options in OptionList have wrong format.\r
325 - PacketLength is NULL.\r
326 - One or more IPv4 addresses in OverrideData are not valid\r
327 unicast IPv4 addresses if OverrideData is not NULL.\r
328 @retval EFI_UNSUPPORTED One or more options in the OptionList are in the\r
329 unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
330 @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
331 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
332 RARP, etc.) has not finished yet.\r
333 @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
334 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
335 @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received and is in the Packet.\r
336 @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received and the Packet is set to NULL.\r
337 @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received and the Packet is set to NULL.\r
338 @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received and the Packet is set to NULL.\r
339 @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received and the Packet is set to NULL.\r
340 @retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received and is in the Buffer.\r
341 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the Packet.\r
342 @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server.\r
343 @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
c5c3e7e2 344 @retval EFI_NO_MEDIA There was a media error.\r
d1f95000 345\r
346**/\r
bce46f7e 347typedef\r
348EFI_STATUS\r
d1f95000 349(EFIAPI *EFI_MTFTP4_GET_INFO)(\r
350 IN EFI_MTFTP4_PROTOCOL *This,\r
351 IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData OPTIONAL,\r
352 IN UINT8 *Filename,\r
353 IN UINT8 *ModeStr OPTIONAL,\r
354 IN UINT8 OptionCount,\r
355 IN EFI_MTFTP4_OPTION *OptionList,\r
356 OUT UINT32 *PacketLength,\r
357 OUT EFI_MTFTP4_PACKET **Packet OPTIONAL\r
ed66e1bc 358 );\r
d1f95000 359\r
360/**\r
361 Parses the options in an MTFTPv4 OACK packet.\r
362\r
af2dc6a7 363 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 364 @param PacketLen Length of the OACK packet to be parsed.\r
af2dc6a7 365 @param Packet The pointer to the OACK packet to be parsed.\r
366 @param OptionCount The pointer to the number of options in following OptionList.\r
367 @param OptionList The pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot\r
ea886bef 368 Service FreePool() to release the OptionList if the options\r
369 in this OptionList are not needed any more.\r
d1f95000 370\r
371 @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and\r
372 OptionList parameters have been updated.\r
373 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
374 - PacketLen is 0.\r
375 - Packet is NULL or Packet is not a valid MTFTPv4 packet.\r
376 - OptionCount is NULL.\r
377 @retval EFI_NOT_FOUND No options were found in the OACK packet.\r
378 @retval EFI_OUT_OF_RESOURCES Storage for the OptionList array cannot be allocated.\r
379 @retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.\r
380\r
381**/\r
bce46f7e 382typedef\r
383EFI_STATUS\r
d1f95000 384(EFIAPI *EFI_MTFTP4_PARSE_OPTIONS)(\r
385 IN EFI_MTFTP4_PROTOCOL *This,\r
386 IN UINT32 PacketLen,\r
387 IN EFI_MTFTP4_PACKET *Packet,\r
388 OUT UINT32 *OptionCount,\r
389 OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL\r
bce46f7e 390 );\r
d1f95000 391\r
392\r
393/**\r
394 Downloads a file from an MTFTPv4 server.\r
395\r
af2dc6a7 396 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
397 @param Token The pointer to the token structure to provide the parameters that are\r
d1f95000 398 used in this operation.\r
399\r
abbfadd7 400 @retval EFI_SUCCESS The data file has been transferred successfully.\r
401 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
402 @retval EFI_BUFFER_TOO_SMALL BufferSize is not zero but not large enough to hold the\r
403 downloaded data in downloading process.\r
404 @retval EFI_ABORTED Current operation is aborted by user.\r
405 @retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received.\r
406 @retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received.\r
407 @retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received.\r
408 @retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received.\r
409 @retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received.\r
410 @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server.\r
411 @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received.\r
412 @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
c5c3e7e2 413 @retval EFI_NO_MEDIA There was a media error.\r
d1f95000 414\r
415**/\r
bce46f7e 416typedef\r
417EFI_STATUS\r
d1f95000 418(EFIAPI *EFI_MTFTP4_READ_FILE)(\r
419 IN EFI_MTFTP4_PROTOCOL *This,\r
420 IN EFI_MTFTP4_TOKEN *Token\r
bce46f7e 421 );\r
422\r
d1f95000 423\r
424\r
425/**\r
426 Sends a file to an MTFTPv4 server.\r
427\r
af2dc6a7 428 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
429 @param Token The pointer to the token structure to provide the parameters that are\r
d1f95000 430 used in this operation.\r
431\r
432 @retval EFI_SUCCESS The upload session has started.\r
433 @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r
434 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
435 @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in\r
436 the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
437 @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
438 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
439 RARP, etc.) is not finished yet.\r
440 @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session.\r
441 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
442 @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
443 @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
444\r
445**/\r
bce46f7e 446typedef\r
447EFI_STATUS\r
d1f95000 448(EFIAPI *EFI_MTFTP4_WRITE_FILE)(\r
449 IN EFI_MTFTP4_PROTOCOL *This,\r
450 IN EFI_MTFTP4_TOKEN *Token\r
bce46f7e 451 );\r
452\r
d1f95000 453\r
454/**\r
455 Downloads a data file "directory" from an MTFTPv4 server. May be unsupported in some EFI\r
bce46f7e 456 implementations.\r
d1f95000 457\r
af2dc6a7 458 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
459 @param Token The pointer to the token structure to provide the parameters that are\r
d1f95000 460 used in this operation.\r
461\r
462 @retval EFI_SUCCESS The MTFTPv4 related file "directory" has been downloaded.\r
463 @retval EFI_UNSUPPORTED The operation is not supported by this implementation.\r
464 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
465 @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in\r
466 the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
467 @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.\r
468 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
469 RARP, etc.) is not finished yet.\r
470 @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session.\r
471 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
472 @retval EFI_ACCESS_DENIED The previous operation has not completed yet.\r
473 @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.\r
474\r
475**/\r
bce46f7e 476typedef\r
477EFI_STATUS\r
d1f95000 478(EFIAPI *EFI_MTFTP4_READ_DIRECTORY)(\r
479 IN EFI_MTFTP4_PROTOCOL *This,\r
480 IN EFI_MTFTP4_TOKEN *Token\r
bce46f7e 481 );\r
d1f95000 482\r
483/**\r
484 Polls for incoming data packets and processes outgoing data packets.\r
485\r
af2dc6a7 486 @param This The pointer to the EFI_MTFTP4_PROTOCOL instance.\r
d1f95000 487\r
488 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
489 @retval EFI_NOT_STARTED This EFI MTFTPv4 Protocol instance has not been started.\r
490 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,\r
491 RARP, etc.) is not finished yet.\r
492 @retval EFI_INVALID_PARAMETER This is NULL.\r
493 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
494 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
495 Consider increasing the polling rate.\r
496\r
497**/\r
498typedef\r
499EFI_STATUS\r
8b13229b 500(EFIAPI *EFI_MTFTP4_POLL)(\r
d1f95000 501 IN EFI_MTFTP4_PROTOCOL *This\r
bce46f7e 502 );\r
503\r
44717a39 504///\r
bce46f7e 505/// The EFI_MTFTP4_PROTOCOL is designed to be used by UEFI drivers and applications\r
506/// to transmit and receive data files. The EFI MTFTPv4 Protocol driver uses\r
44717a39 507/// the underlying EFI UDPv4 Protocol driver and EFI IPv4 Protocol driver.\r
bce46f7e 508///\r
d1f95000 509struct _EFI_MTFTP4_PROTOCOL {\r
510 EFI_MTFTP4_GET_MODE_DATA GetModeData;\r
511 EFI_MTFTP4_CONFIGURE Configure;\r
512 EFI_MTFTP4_GET_INFO GetInfo;\r
513 EFI_MTFTP4_PARSE_OPTIONS ParseOptions;\r
514 EFI_MTFTP4_READ_FILE ReadFile;\r
515 EFI_MTFTP4_WRITE_FILE WriteFile;\r
516 EFI_MTFTP4_READ_DIRECTORY ReadDirectory;\r
517 EFI_MTFTP4_POLL Poll;\r
518};\r
519\r
520struct _EFI_MTFTP4_TOKEN {\r
992f22b9
LG
521 ///\r
522 /// The status that is returned to the caller at the end of the operation\r
523 /// to indicate whether this operation completed successfully.\r
524 ///\r
bb8fb476 525 EFI_STATUS Status;\r
992f22b9
LG
526 ///\r
527 /// The event that will be signaled when the operation completes. If\r
528 /// set to NULL, the corresponding function will wait until the read or\r
529 /// write operation finishes. The type of Event must be\r
530 /// EVT_NOTIFY_SIGNAL. The Task Priority Level (TPL) of\r
531 /// Event must be lower than or equal to TPL_CALLBACK.\r
532 ///\r
bb8fb476 533 EFI_EVENT Event;\r
992f22b9
LG
534 ///\r
535 /// If not NULL, the data that will be used to override the existing configure data.\r
536 ///\r
bb8fb476 537 EFI_MTFTP4_OVERRIDE_DATA *OverrideData;\r
992f22b9 538 ///\r
4f077902 539 /// The pointer to the null-terminated ASCII file name string.\r
992f22b9 540 ///\r
bb8fb476 541 UINT8 *Filename;\r
992f22b9 542 ///\r
4f077902 543 /// The pointer to the null-terminated ASCII mode string. If NULL, "octet" is used.\r
992f22b9 544 ///\r
bb8fb476 545 UINT8 *ModeStr;\r
992f22b9
LG
546 ///\r
547 /// Number of option/value string pairs.\r
548 ///\r
bb8fb476 549 UINT32 OptionCount;\r
992f22b9 550 ///\r
af2dc6a7 551 /// The pointer to an array of option/value string pairs. Ignored if OptionCount is zero.\r
992f22b9 552 ///\r
bb8fb476 553 EFI_MTFTP4_OPTION *OptionList;\r
992f22b9 554 ///\r
af2dc6a7 555 /// The size of the data buffer.\r
992f22b9 556 ///\r
ea886bef 557 UINT64 BufferSize;\r
992f22b9 558 ///\r
af2dc6a7 559 /// The pointer to the data buffer. Data that is downloaded from the\r
992f22b9
LG
560 /// MTFTPv4 server is stored here. Data that is uploaded to the\r
561 /// MTFTPv4 server is read from here. Ignored if BufferSize is zero.\r
562 ///\r
ea886bef 563 VOID *Buffer;\r
564 ///\r
af2dc6a7 565 /// The pointer to the context that will be used by CheckPacket,\r
ea886bef 566 /// TimeoutCallback and PacketNeeded.\r
567 ///\r
568 VOID *Context;\r
992f22b9 569 ///\r
af2dc6a7 570 /// The pointer to the callback function to check the contents of the received packet.\r
992f22b9 571 ///\r
bb8fb476 572 EFI_MTFTP4_CHECK_PACKET CheckPacket;\r
992f22b9 573 ///\r
af2dc6a7 574 /// The pointer to the function to be called when a timeout occurs.\r
992f22b9 575 ///\r
bb8fb476 576 EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback;\r
992f22b9 577 ///\r
af2dc6a7 578 /// The pointer to the function to provide the needed packet contents.\r
992f22b9 579 ///\r
bb8fb476 580 EFI_MTFTP4_PACKET_NEEDED PacketNeeded;\r
d1f95000 581};\r
582\r
583extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid;\r
bce46f7e 584extern EFI_GUID gEfiMtftp4ProtocolGuid;\r
d1f95000 585\r
586#endif\r
587\r