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