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