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