]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add Dhcp6/Mtftp6/Udp6 three protocol's definitions into MdePkg to comply with UEFI2...
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 18 Aug 2009 07:00:38 +0000 (07:00 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 18 Aug 2009 07:00:38 +0000 (07:00 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9087 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Protocol/Dhcp6.h [new file with mode: 0644]
MdePkg/Include/Protocol/Mtftp6.h [new file with mode: 0644]
MdePkg/Include/Protocol/Udp6.h [new file with mode: 0644]

diff --git a/MdePkg/Include/Protocol/Dhcp6.h b/MdePkg/Include/Protocol/Dhcp6.h
new file mode 100644 (file)
index 0000000..95aa6bc
--- /dev/null
@@ -0,0 +1,768 @@
+/** @file\r
+  UEFI Dynamic Host Configuration Protocol 6 Definition, which is used to get IPv6\r
+  addresses and other configuration parameters from DHCPv6 servers.\r
+\r
+Copyright (c) 2008 - 2009, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __EFI_DHCP6_PROTOCOL_H__\r
+#define __EFI_DHCP6_PROTOCOL_H__\r
+\r
+#define EFI_DHCP6_PROTOCOL_GUID \\r
+  { \\r
+    0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b } \\r
+  }\r
+\r
+#define EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5 } \\r
+  }\r
+\r
+typedef struct _EFI_DHCP6_PROTOCOL EFI_DHCP6_PROTOCOL;\r
+\r
+typedef enum { \r
+  ///\r
+  /// The EFI DHCPv6 Protocol instance is configured, and start() needs \r
+  /// to be called\r
+  ///\r
+  Dhcp6Init                    = 0x0,\r
+  ///\r
+  /// A Solicit packet is sent out to discover DHCPv6 server, and the EFI\r
+  /// DHCPv6 Protocol instance is collecting Advertise packets.\r
+  ///\r
+  Dhcp6Selecting               = 0x1,\r
+  ///\r
+  /// A Request is sent out to the DHCPv6 server, and the EFI DHCPv6 \r
+  /// Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Requesting              = 0x2,\r
+  ///\r
+  /// A Decline packet is sent out to indicate one or more addresses of the\r
+  /// configured IA are in use by another node, and the EFI DHCPv6.\r
+  /// Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Declining               = 0x3,\r
+  ///\r
+  /// A Confirm packet is sent out to confirm the IPv6 addresses of the \r
+  /// configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Confirming              = 0x4,\r
+  ///\r
+  /// A Release packet is sent out to release one or more IPv6 addresses of\r
+  /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Releasing               = 0x5,\r
+  ///\r
+  /// The DHCPv6 S.A.R.R process is completed for the configured IA.\r
+  ///\r
+  Dhcp6Bound                   = 0x6,\r
+  ///\r
+  /// A Renew packet is sent out to extend lifetime for the IPv6 addresses of\r
+  /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Renewing                = 0x7,\r
+  ///\r
+  /// A Rebind packet is sent out to extend lifetime for the IPv6 addresses of\r
+  /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
+  ///\r
+  Dhcp6Rebinding               = 0x8\r
+} EFI_DHCP6_STATE;\r
+\r
+typedef enum {\r
+  ///     \r
+  /// A Solicit packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6SendSolicit             = 0x0,\r
+  ///     \r
+  /// An Advertise packet is received and will be passed to Dhcp6Callback.\r
+  ///\r
+  Dhcp6RcvdAdvertise           = 0x1,\r
+  ///     \r
+  /// It is time for Dhcp6Callback to determine whether select the default Advertise\r
+  /// packet by RFC 3315 policy, or overwrite it by specific user policy.\r
+  ///\r
+  Dhcp6SelectAdvertise         = 0x2,\r
+  ///     \r
+  /// A Request packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6SendRequest             = 0x3,\r
+  ///     \r
+  /// A Reply packet is received and will be passed to Dhcp6Callback.\r
+  ///\r
+  Dhcp6RcvdReply               = 0x4,\r
+  ///     \r
+  /// A Reconfigure packet is received and will be passed to Dhcp6Callback.\r
+  ///\r
+  Dhcp6RcvdReconfigure         = 0x5,\r
+  ///     \r
+  /// A Decline packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6SendDecline             = 0x6,\r
+  ///     \r
+  /// A Confirm packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6SendConfirm             = 0x7,\r
+  ///     \r
+  /// A Release packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6SendRelease             = 0x8,\r
+  ///     \r
+  /// A Renew packet is about to be sent. The packet is passed to Dhcp6Callback and\r
+  /// can be modified or replaced in Dhcp6Callback. \r
+  ///\r
+  Dhcp6EnterRenewing           = 0x9,\r
+  ///     \r
+  /// A Rebind packet is about to be sent. The packet is passed to Dhcp6Callback and \r
+  /// can be modified or replaced in Dhcp6Callback.\r
+  ///\r
+  Dhcp6EnterRebinding          = 0xa\r
+} EFI_DHCP6_EVENT;\r
+\r
+///\r
+/// An IA which carries assigned not temporary address.\r
+///\r
+#define EFI_DHCP6_IA_TYPE_NA   3\r
+///\r
+/// An IA which carries assigned temporary address.\r
+///\r
+#define EFI_DHCP6_IA_TYPE_TA   4\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+  ///\r
+  /// The DHCPv6 option code.\r
+  ///\r
+  UINT16                       OpCode;\r
+  ///\r
+  /// Length of the DHCPv6 option data. From the first byte to the last byte of the Data field.\r
+  ///\r
+  UINT16                       OpLen;\r
+  ///\r
+  /// The data for the DHCPv6 option.\r
+  ///\r
+  UINT8                        Data[1];\r
+} EFI_DHCP6_PACKET_OPTION;\r
+\r
+typedef struct{\r
+  ///\r
+  /// The DHCPv6 transaction ID.\r
+  ///\r
+  UINT32                       MessageType:8;\r
+  ///\r
+  /// The DHCPv6 message type.\r
+  ///\r
+  UINT32                       TransactionId:24;\r
+} EFI_DHCP6_HEADER;\r
+\r
+typedef struct {\r
+  ///\r
+  /// Size of the EFI_DHCP6_PACKET buffer.\r
+  ///\r
+  UINT32                       Size;\r
+  ///\r
+  /// Length of the EFI_DHCP6_PACKET from the first byte of the Header field to the last\r
+  /// byte of the Option[] field.\r
+  ///\r
+  UINT32                       Length;\r
+  struct{\r
+    ///\r
+    /// The DHCPv6 packet header.\r
+    ///\r
+    EFI_DHCP6_HEADER           Header;\r
+    ///\r
+    /// Start of the DHCPv6 packed option data.\r
+    ///\r
+    UINT8                      Option[1];\r
+  } Dhcp6;\r
+} EFI_DHCP6_PACKET;\r
+\r
+#pragma pack()\r
+\r
+typedef struct {\r
+  ///\r
+  /// Length of DUID in octects.\r
+  ///\r
+  UINT16                       Length;\r
+  ///\r
+  /// Array of DUID octects.\r
+  ///\r
+  UINT8                        Duid[1];\r
+} EFI_DHCP6_DUID;\r
+\r
+typedef struct {\r
+  ///\r
+  /// Initial retransmission timeout.\r
+  ///\r
+  UINT32                       Irt;\r
+  ///\r
+  /// Maximum retransmission count for one packet. If Mrc is zero, there¡¯s no upper limit \r
+  /// for retransmission count.\r
+  ///\r
+  UINT32                       Mrc;\r
+  ///\r
+  /// Maximum retransmission timeout for each retry. It¡¯s the upper bound of the number of \r
+  /// retransmission timeout. If Mrt is zero, there is no upper limit for retransmission \r
+  /// timeout.\r
+  ///\r
+  UINT32                       Mrt;\r
+  ///\r
+  /// Maximum retransmission duration for one packet. It¡¯s the upper bound of the numbers \r
+  /// the client may retransmit a message. If Mrd is zero, there¡¯s no upper limit for \r
+  /// retransmission duration.\r
+  ///\r
+  UINT32                       Mrd;\r
+} EFI_DHCP6_RETRANSMISSION;\r
+\r
+typedef struct {\r
+  ///\r
+  /// The IPv6 address.\r
+  ///\r
+  EFI_IPv6_ADDRESS             IpAddress;\r
+  ///\r
+  /// The preferred lifetime in unit of seconds for the IPv6 address.\r
+  ///\r
+  UINT32                       PreferredLifetime;\r
+  ///\r
+  /// The valid lifetime in unit of seconds for the IPv6 address.\r
+  ///\r
+  UINT32                       ValidLifetime;\r
+} EFI_DHCP6_IA_ADDRESS;\r
+\r
+typedef struct {\r
+  UINT16                       Type; ///< Type for an IA.\r
+  UINT32                       IaId; ///< The identifier for an IA.\r
+} EFI_DHCP6_IA_DESCRIPTOR;\r
+\r
+typedef struct {\r
+  ///\r
+  /// The descriptor for IA.\r
+  ///\r
+  EFI_DHCP6_IA_DESCRIPTOR      Descriptor;\r
+  ///\r
+  /// The state of the configured IA.\r
+  ///\r
+  EFI_DHCP6_STATE              State;\r
+  ///\r
+  /// Pointer to the cached latest Reply packet. May be NULL if no packet is cached.\r
+  ///\r
+  EFI_DHCP6_PACKET             *ReplyPacket;\r
+  ///\r
+  /// Number of IPv6 addresses of the configured IA.\r
+  ///\r
+  UINT32                       IaAddressCount;\r
+  ///\r
+  /// List of the IPv6 addresses of the configured IA. When the state of the configured IA is \r
+  /// in Dhcp6Bound, Dhcp6Renewing and Dhcp6Rebinding, the IPv6 addresses are usable.\r
+  ///\r
+  EFI_DHCP6_IA_ADDRESS         IaAddress[1];\r
+} EFI_DHCP6_IA;\r
+\r
+typedef struct {\r
+  ///\r
+  /// Pointer to the DHCPv6 unique identifier. The caller is responsible for freeing this buffer.\r
+  ///\r
+  EFI_DHCP6_DUID               *ClientId;\r
+  ///\r
+  /// Pointer to the configured IA of current instance. The caller can free this buffer after\r
+  /// using it.\r
+  ///\r
+  EFI_DHCP6_IA                 *Ia;\r
+} EFI_DHCP6_MODE_DATA;\r
+\r
+/**\r
+  EFI_DHCP6_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol instance to \r
+  intercept events that occurs in the DHCPv6 S.A.R.R process.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance that is used to configure this \r
+                                callback function.\r
+  @param[in]  Context           Pointer to the context that is initialized by EFI_DHCP6_PROTOCOL.Configure().\r
+  @param[in]  CurrentState      The current state of the configured IA.\r
+  @param[in]  Dhcp6Event        The event that occurs in the current state, which usually means a state transition.\r
+  @param[in]  Packet            Pointer to the DHCPv6 packet that is about to be sent or has been received.\r
+                                The EFI DHCPv6 Protocol instance is responsible for freeing the buffer. \r
+  @param[out] NewPacket         Pointer to the new DHCPv6 packet to overwrite the Packet. NewPacket can not \r
+                                share the buffer with Packet. If *NewPacket is not NULL, the EFI DHCPv6 \r
+                                Protocol instance is responsible for freeing the buffer.\r
+\r
+  @retval EFI_SUCCESS           Tell the EFI DHCPv6 Protocol instance to continue the DHCPv6 S.A.R.R process.\r
+  @retval EFI_ABORTED           Tell the EFI DHCPv6 Protocol instance to abort the DHCPv6 S.A.R.R process, \r
+                                and the state of the configured IA will be transferred to Dhcp6Init.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(*EFI_DHCP6_CALLBACK)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN VOID                      *Context,\r
+  IN EFI_DHCP6_STATE           CurrentState,\r
+  IN EFI_DHCP6_EVENT           Dhcp6Event,\r
+  IN EFI_DHCP6_PACKET          *Packet,        \r
+  OUT EFI_DHCP6_PACKET         **NewPacket OPTIONAL\r
+  );\r
+\r
+typedef struct {\r
+  ///\r
+  /// The callback function is to intercept various events that occur in the DHCPv6 S.A.R.R \r
+  /// process. Set to NULL to ignore all those events.\r
+  ///\r
+  EFI_DHCP6_CALLBACK           Dhcp6Callback;\r
+  ///\r
+  /// Pointer to the context that will be passed to Dhcp6Callback.\r
+  ///\r
+  VOID                         *CallbackContext;\r
+  ///\r
+  /// Number of the DHCPv6 options in the OptionList.\r
+  ///\r
+  UINT32                       OptionCount;\r
+  ///\r
+  /// List of the DHCPv6 options to be included in Solicit and Request packet. The buffer \r
+  /// can be freed after EFI_DHCP6_PROTOCOL.Configure() returns. Ignored if \r
+  /// OptionCount is zero. OptionList should not contain Client Identifier option \r
+  /// and any IA option, which will be appended by EFI DHCPv6 Protocol instance \r
+  /// automatically. \r
+  ///\r
+  EFI_DHCP6_PACKET_OPTION      **OptionList;\r
+  ///\r
+  /// The descriptor for the IA of the EFI DHCPv6 Protocol instance.\r
+  ///\r
+  EFI_DHCP6_IA_DESCRIPTOR      IaDescriptor;\r
+  ///\r
+  /// If not NULL, the event will be signaled when any IPv6 address information of the \r
+  /// configured IA is updated, including IPv6 address, preferred lifetime and valid \r
+  /// lifetime, or the DHCPv6 S.A.R.R process fails. Otherwise, Start(), \r
+  /// renewrebind(), decline(), release() and stop() will be blocking \r
+  /// operations, and they will wait for the exchange process completion or failure.\r
+  ///\r
+  EFI_EVENT                    IaInfoEvent;\r
+  ///\r
+  /// If TRUE, the EFI DHCPv6 Protocol instance is willing to accept Reconfigure packet. \r
+  /// Otherwise, it will ignore it. Reconfigure Accept option can not be specified through \r
+  /// OptionList parameter.\r
+  ///\r
+  BOOLEAN                      ReconfigureAccept;\r
+  ///\r
+  /// If TRUE, the EFI DHCPv6 Protocol instance will send Solicit packet with Rapid \r
+  /// Commit option. Otherwise, Rapid Commit option will not be included in Solicit \r
+  /// packet. Rapid Commit option can not be specified through OptionList parameter.\r
+  ///\r
+  BOOLEAN                      RapidCommit;\r
+  ///\r
+  /// Parameter to control Solicit packet retransmission behavior. The \r
+  /// buffer can be freed after EFI_DHCP6_PROTOCOL.Configure() returns.\r
+  ///\r
+  EFI_DHCP6_RETRANSMISSION     *SolicitRetransmission;\r
+} EFI_DHCP6_CONFIG_DATA;\r
+\r
+/**\r
+  EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol \r
+  instance to intercept events that occurs in the DHCPv6 Information Request exchange process.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance that is used to configure this \r
+                                callback function.\r
+  @param[in]  Context           Pointer to the context that is initialized in the EFI_DHCP6_PROTOCOL.InfoRequest().\r
+  @param[in]  Packet            Pointer to Reply packet that has been received. The EFI DHCPv6 Protocol instance is \r
+                                responsible for freeing the buffer.\r
+\r
+  @retval EFI_SUCCESS           Tell the EFI DHCPv6 Protocol instance to finish Information Request exchange process.\r
+  @retval EFI_NOT_READY         Tell the EFI DHCPv6 Protocol instance to continue Information Request exchange process.\r
+  @retval EFI_ABORTED           Tell the EFI DHCPv6 Protocol instance to abort the Information Request exchange process.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(*EFI_DHCP6_INFO_CALLBACK)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN VOID                      *Context,\r
+  IN EFI_DHCP6_PACKET          *Packet\r
+  );\r
+\r
+/**\r
+  Retrieve the current operating mode data and configuration data for the EFI DHCPv6 Protocol instance.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+  @param[out] Dhcp6ModeData     Pointer to the DHCPv6 mode data structure. The caller is responsible for freeing this \r
+                                structure and each reference buffer.\r
+  @param[out] Dhcp6ConfigData   Pointer to the DHCPv6 configuration data structure. The caller is responsible for \r
+                                freeing this structure and each reference buffer.\r
+\r
+  @retval EFI_SUCCESS           The mode data was returned.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Protocol instance has not been configured when Dhcp6ConfigData is not NULL.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+                                - This is NULL. \r
+                                - Both Dhcp6ConfigData and Dhcp6ModeData are NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_DHCP6_GET_MODE_DATA)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  OUT EFI_DHCP6_MODE_DATA      *Dhcp6ModeData OPTIONAL,\r
+  OUT EFI_DHCP6_CONFIG_DATA    *Dhcp6ConfigData OPTIONAL\r
+  );\r
+\r
+/**\r
+  Initialize or clean up the configuration data for the EFI DHCPv6 Protocol instance.\r
+\r
+  The Configure() function is used to initialize or clean up the configuration data of the EFI \r
+  DHCPv6 Protocol instance.\r
+  - When Dhcp6CfgData is not NULL and Configure() is called successfully, the \r
+    configuration data will be initialized in the EFI DHCPv6 Protocol instance and the state of the \r
+    configured IA will be transferred into Dhcp6Init.\r
+  - When Dhcp6CfgData is NULL and Configure() is called successfully, the configuration \r
+    data will be cleaned up and no IA will be associated with the EFI DHCPv6 Protocol instance.\r
+\r
+  To update the configuration data for an EFI DCHPv6 Protocol instance, the original data must be \r
+  cleaned up before setting the new configuration data.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+  @param[in]  Dhcp6CfgData      Pointer to the DHCPv6 configuration data structure.\r
+\r
+  @retval EFI_SUCCESS           The mode data was returned.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
+                                - This is NULL. \r
+                                - OptionCount > 0 and OptionList is NULL.\r
+                                - OptionList is not NULL, and Client Id option, Reconfigure Accept option,\r
+                                  Rapid Commit option or any IA option is specified in the OptionList.\r
+                                - IaDescriptor.Type is neither EFI_DHCP6_IA_TYPE_NA nor EFI_DHCP6_IA_TYPE_NA.\r
+                                - IaDescriptor is not unique.\r
+                                - Both IaInfoEvent and SolicitRetransimssion are NULL.\r
+                                - SolicitRetransmission is not NULL, and both SolicitRetransimssion->Mrc and \r
+                                  SolicitRetransmission->Mrd are zero.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Protocol instance has been already configured \r
+                                when Dhcp6CfgData is not NULL.\r
+                                The EFI DHCPv6 Protocol instance has already started the \r
+                                DHCPv6 S.A.R.R when Dhcp6CfgData is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_CONFIGURE)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN EFI_DHCP6_CONFIG_DATA     *Dhcp6CfgData OPTIONAL\r
+  );\r
+\r
+/**\r
+  Start the DHCPv6 S.A.R.R process.\r
+\r
+  The Start() function starts the DHCPv6 S.A.R.R process. This function can be called only when \r
+  the state of the configured IA is in the Dhcp6Init state. If the DHCPv6 S.A.R.R process completes\r
+  successfully, the state of the configured IA will be transferred through Dhcp6Selecting and \r
+  Dhcp6Requesting to Dhcp6Bound state. The update of the IPv6 addresses will be notified through \r
+  EFI_DHCP6_CONFIG_DATA.IaInfoEvent. At the time when each event occurs in this process, the \r
+  callback function set by EFI_DHCP6_PROTOCOL.Configure() will be called and the user can take \r
+  this opportunity to control the process. If EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, the \r
+  Start() function call is a blocking operation. It will return after the DHCPv6 S.A.R.R process\r
+  completes or aborted by users. If the process is aborted by system or network error, the state of\r
+  the configured IA will be transferred to Dhcp6Init. The Start() function can be called again to\r
+  restart the process.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The DHCPv6 S.A.R.R process is completed and at least one IPv6 \r
+                                address has been bound to the configured IA when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL. \r
+                                The DHCPv6 S.A.R.R process is started when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Child instance hasn¡¯t been configured.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_ALREADY_STARTED   The DHCPv6 S.A.R.R process has already started.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval EFI_NO_RESPONSE       The DHCPv6 S.A.R.R process failed because of no response.\r
+  @retval EFI_NO_MAPPING        No IPv6 address has been bound to the configured IA after the \r
+                                DHCPv6 S.A.R.R process.\r
+  @retval EFI_ABORTED           The DHCPv6 S.A.R.R process aborted by user.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_START)(\r
+  IN EFI_DHCP6_PROTOCOL        *This\r
+  );\r
+\r
+/**\r
+  Request configuration information without the assignment of any IA addresses of the client.\r
+\r
+  The InfoRequest() function is used to request configuration information without the assignment\r
+  of any IPv6 address of the client. Client sends out Information Request packet to obtain \r
+  the required configuration information, and DHCPv6 server responds with Reply packet containing \r
+  the information for the client. The received Reply packet will be passed to the user by \r
+  ReplyCallback function. If user returns EFI_NOT_READY from ReplyCallback, the EFI DHCPv6\r
+  Protocol instance will continue to receive other Reply packets unless timeout according to \r
+  the Retransmission parameter. Otherwise, the Information Request exchange process will be \r
+  finished successfully if user returns EFI_SUCCESS from ReplyCallback.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+  @param[in]  SendClientId      If TRUE, the EFI DHCPv6 Protocol instance will build Client\r
+                                Identifier option and include it into Information Request\r
+                                packet. If FALSE, Client Identifier option will not be included.\r
+                                Client Identifier option can not be specified through OptionList \r
+                                parameter.\r
+  @param[in]  OptionRequest     Pointer to the Option Request option in the Information Request\r
+                                packet. Option Request option can not be specified through\r
+                                OptionList parameter.\r
+  @param[in]  OptionCount       Number of options in OptionList.\r
+  @param[in]  OptionList        List of other DHCPv6 options. These options will be appended\r
+                                to the Option Request option. The caller is responsible for\r
+                                freeing this buffer. Type is defined in EFI_DHCP6_PROTOCOL.GetModeData().\r
+  @param[in]  Retransmission    Parameter to control Information Request packet retransmission\r
+                                behavior. The buffer can be freed after EFI_DHCP6_PROTOCOL.InfoRequest()\r
+                                returns.\r
+  @param[in]  TimeoutEvent      If not NULL, this event is signaled when the information request\r
+                                exchange aborted because of no response. If NULL, the function\r
+                                call is a blocking operation; and it will return after the \r
+                                information-request exchange process finish or aborted by users.\r
+  @param[in]  ReplyCallback     The callback function is to intercept various events that occur\r
+                                in the Information Request exchange process. It should not be\r
+                                set to NULL.\r
+  @param[in]  CallbackContext   Pointer to the context that will be passed to ReplyCallback.\r
+\r
+  @retval EFI_SUCCESS           The DHCPv6 S.A.R.R process is completed and at least one IPv6 \r
+  @retval EFI_SUCCESS           The DHCPv6 information request exchange process completed \r
+                                when TimeoutEvent is NULL. Information Request packet has been\r
+                                sent to DHCPv6 server when TimeoutEvent is not NULL.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+                                - This is NULL. \r
+                                - OptionRequest is NULL or OptionRequest->OpCode is invalid.\r
+                                - OptionCount > 0 and OptionList is NULL.\r
+                                - OptionList is not NULL, and Client Identify option or \r
+                                  Option Request option is specified in the OptionList.\r
+                                - Retransimssion is NULL.\r
+                                - Both Retransimssion->Mrc and Retransmission->Mrd are zero.\r
+                                - ReplyCallback is NULL.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval EFI_NO_RESPONSE       The DHCPv6 information request exchange process failed \r
+                                because of no response, or not all requested-options are \r
+                                responded by DHCPv6 servers when Timeout happened.\r
+  @retval EFI_ABORTED           The DHCPv6 information request exchange process aborted by user.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_INFO_REQUEST)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN BOOLEAN                   SendClientId,\r
+  IN EFI_DHCP6_PACKET_OPTION   *OptionRequest,\r
+  IN UINT32                    OptionCount,\r
+  IN EFI_DHCP6_PACKET_OPTION   *OptionList[] OPTIONAL,\r
+  IN EFI_DHCP6_RETRANSMISSION  *Retransmission, \r
+  IN EFI_EVENT                 TimeoutEvent OPTIONAL,\r
+  IN EFI_DHCP6_INFO_CALLBACK   ReplyCallback,\r
+  IN VOID                      *CallbackContext OPTIONAL\r
+  );\r
+\r
+/**\r
+  Manually extend the valid and preferred lifetimes for the IPv6 addresses of the configured\r
+  IA and update other configuration parameters by sending Renew or Rebind packet.\r
+\r
+  The RenewRebind() function is used to manually extend the valid and preferred lifetimes for the \r
+  IPv6 addresses of the configured IA and update other configuration parameters by sending Renew or \r
+  Rebind packet. \r
+  - When RebindRequest is FALSE and the state of the configured IA is Dhcp6Bound, it \r
+  will send Renew packet to the previously DHCPv6 server and transfer the state of the configured \r
+  IA to Dhcp6Renewing. If valid Reply packet received, the state transfers to Dhcp6Bound \r
+  and the valid and preferred timer restarts. If fails, the state transfers to Dhcp6Bound but the \r
+  timer continues. \r
+  - When RebindRequest is TRUE and the state of the configured IA is Dhcp6Bound, it will \r
+  send Rebind packet. If valid Reply packet received, the state transfers to Dhcp6Bound and the \r
+  valid and preferred timer restarts. If fails, the state transfers to Dhcp6Init and the IA can¡¯t\r
+  be used.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param[in]  RebindRequest     If TRUE, it will send Rebind packet and enter the Dhcp6Rebinding state. \r
+                                Otherwise, it will send Renew packet and enter the Dhcp6Renewing state.\r
+\r
+  @retval EFI_SUCCESS           The DHCPv6 renew/rebind exchange process has completed and at \r
+                                least one IPv6 address of the configured IA has been bound again\r
+                                when EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL. \r
+                                The EFI DHCPv6 Protocol instance has sent Renew or Rebind packet \r
+                                when EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Child instance hasn¡¯t been configured, or the state\r
+                                of the configured IA is not in Dhcp6Bound.\r
+  @retval EFI_ALREADY_STARTED   The state of the configured IA has already entered Dhcp6Renewing \r
+                                when RebindRequest is FALSE. \r
+                                The state of the configured IA has already entered Dhcp6Rebinding \r
+                                when RebindRequest is TRUE.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or system error occurred.\r
+  @retval EFI_NO_RESPONSE       The DHCPv6 renew/rebind exchange process failed because of no response.\r
+  @retval EFI_NO_MAPPING        No IPv6 address has been bound to the configured IA after the DHCPv6 \r
+                                renew/rebind exchange process.\r
+  @retval EFI_ABORTED           The DHCPv6 renew/rebind exchange process aborted by user.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_RENEW_REBIND)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN BOOLEAN                   RebindRequest\r
+  );\r
+\r
+/**\r
+  Inform that one or more IPv6 addresses assigned by a server are already in use by\r
+  another node.\r
+\r
+  The Decline() function is used to manually decline the assignment of IPv6 addresses, which \r
+  have been already used by another node. If all IPv6 addresses of the configured IA are declined \r
+  through this function, the state of the IA will switch through Dhcp6Declining to Dhcp6Init, \r
+  otherwise, the state of the IA will restore to Dhcp6Bound after the declining process. The \r
+  Decline() can only be called when the IA is in Dhcp6Bound state. If the \r
+  EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, this function is a blocking operation. It \r
+  will return after the declining process finishes, or aborted by user.\r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param[in]  AddressCount      Number of declining IPv6 addresses. \r
+  @param[in]  Addresses         Pointer to the buffer stored all the declining IPv6 addresses.\r
+\r
+  @retval EFI_SUCCESS           The DHCPv6 decline exchange process has completed when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
+                                The EFI DHCPv6 Protocol instance has sent Decline packet when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
+                                - This is NULL.  \r
+                                - AddressCount is zero or Addresses is NULL.\r
+  @retval EFI_NOT_FOUND         Any specified IPv6 address is not correlated with the configured IA \r
+                                for this instance.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Child instance hasn¡¯t been configured, or the \r
+                                state of the configured IA is not in Dhcp6Bound.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval EFI_ABORTED           The DHCPv6 decline exchange process aborted by user.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_DECLINE)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN UINT32                    AddressCount,\r
+  IN EFI_IPv6_ADDRESS          *Addresses\r
+  );\r
+\r
+/**\r
+  Release one or more IPv6 addresses associated with the configured IA for current instance.\r
+\r
+  The Release() function is used to manually release the one or more IPv6 address. If AddressCount\r
+  is zero, it will release all IPv6 addresses of the configured IA. If all IPv6 addresses of the IA\r
+  are released through this function, the state of the IA will switch through Dhcp6Releasing to \r
+  Dhcp6Init, otherwise, the state of the IA will restore to Dhcp6Bound after the releasing process.\r
+  The Release() can only be called when the IA is in Dhcp6Bound state. If the\r
+  EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, the function is a blocking operation. It will return\r
+  after the releasing process finishes, or aborted by user. \r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+  @param[in]  AddressCount      Number of releasing IPv6 addresses. \r
+  @param[in]  Addresses         Pointer to the buffer stored all the releasing IPv6 addresses.\r
+                                Ignored if AddressCount is zero.\r
+  @retval EFI_SUCCESS           The DHCPv6 release exchange process has completed when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
+                                The EFI DHCPv6 Protocol instance has sent Release packet when \r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
+                                - This is NULL.  \r
+                                - AddressCount is not zero or Addresses is NULL.\r
+  @retval EFI_NOT_FOUND         Any specified IPv6 address is not correlated with the configured\r
+                                IA for this instance.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Child instance hasn¡¯t been configured, or the \r
+                                state of the configured IA is not in Dhcp6Bound.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval EFI_ABORTED           The DHCPv6 release exchange process aborted by user. \r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_RELEASE)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN UINT32                    AddressCount,\r
+  IN EFI_IPv6_ADDRESS          *Addresses\r
+  );\r
+\r
+/**\r
+  Stop the DHCPv6 S.A.R.R process.\r
+\r
+  The Stop() function is used to stop the DHCPv6 S.A.R.R process. If this function is called\r
+  successfully, all the IPv6 addresses of the configured IA will be released and the state of\r
+  the configured IA will be transferred to Dhcp6Init.   \r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The DHCPv6 S.A.R.R process has been stopped when\r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
+                                The EFI DHCPv6 Protocol instance has sent Release packet if\r
+                                need release or has been stopped if needn¡¯t, when\r
+                                EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_STOP)(\r
+  IN EFI_DHCP6_PROTOCOL        *This\r
+  );\r
+\r
+/**\r
+  Parse the option data in the DHCPv6 packet.\r
+\r
+  The Parse() function is used to retrieve the option list in the DHCPv6 packet. \r
+\r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance.\r
+\r
+  @param[in]  Packet            Pointer to packet to be parsed.\r
+  @param[in]  OptionCount       On input, the number of entries in the PacketOptionList.\r
+                                On output, the number of DHCPv6 options in the Packet.\r
+  @param[in]  PacketOptionList  List of pointers to the DHCPv6 options in the Packet.\r
+                                The OpCode and OpLen in EFI_DHCP6_PACKET_OPTION are\r
+                                both stored in network byte order.\r
+  @retval EFI_SUCCESS           The packet was successfully parsed.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
+                                - This is NULL.\r
+                                - Packet is NULL.\r
+                                - Packet is not a well-formed DHCPv6 packet.\r
+                                - OptionCount is NULL.\r
+                                - *OptionCount is not zero and PacketOptionList is NULL.\r
+  @retval EFI_BUFFER_TOO_SMALL  *OptionCount is smaller than the number of options that were \r
+                                found in the Packet.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP6_PARSE)(\r
+  IN EFI_DHCP6_PROTOCOL        *This,\r
+  IN EFI_DHCP6_PACKET          *Packet,\r
+  IN OUT UINT32                *OptionCount,\r
+  OUT EFI_DHCP6_PACKET_OPTION  *PacketOptionList[] OPTIONAL\r
+);\r
+\r
+///\r
+/// The EFI DHCPv6 Protocol is used to get IPv6 addresses and other configuration parameters\r
+/// from DHCPv6 servers.\r
+///\r
+struct _EFI_DHCP6_PROTOCOL {\r
+  EFI_DHCP6_GET_MODE_DATA      GetModeData;\r
+  EFI_DHCP6_CONFIGURE          Configure;\r
+  EFI_DHCP6_START              Start;\r
+  EFI_DHCP6_INFO_REQUEST       InfoRequest;\r
+  EFI_DHCP6_RENEW_REBIND       RenewRebind;\r
+  EFI_DHCP6_DECLINE            Decline;\r
+  EFI_DHCP6_RELEASE            Release;\r
+  EFI_DHCP6_STOP               Stop;\r
+  EFI_DHCP6_PARSE              Parse;\r
+};\r
+\r
+extern EFI_GUID gEfiDhcp6ProtocolGuid;\r
+extern EFI_GUID gEfiDhcp6ServiceBindingProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Mtftp6.h b/MdePkg/Include/Protocol/Mtftp6.h
new file mode 100644 (file)
index 0000000..1595ef5
--- /dev/null
@@ -0,0 +1,806 @@
+/** @file\r
+  UEFI Multicast Trivial File Tranfer Protocol v6 Definition, which is built upon\r
+  the EFI UDPv6 Protocol and provides basic services for client-side unicast and/or\r
+  multicast TFTP operations.\r
+\r
+Copyright (c) 2008 - 2009, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __EFI_MTFTP6_PROTOCOL_H__\r
+#define __EFI_MTFTP6_PROTOCOL_H__\r
+\r
+\r
+#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 } \\r
+  }\r
+\r
+#define EFI_MTFTP6_PROTOCOL_GUID \\r
+  { \\r
+    0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 } \\r
+  }\r
+\r
+typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;\r
+typedef struct _EFI_MTFTP6_TOKEN    EFI_MTFTP6_TOKEN;\r
+\r
+///\r
+/// MTFTP Packet OpCodes\r
+///@{\r
+#define EFI_MTFTP6_OPCODE_RRQ      1 ///< The MTFTPv6 packet is a read request.\r
+#define EFI_MTFTP6_OPCODE_WRQ      2 ///< The MTFTPv6 packet is a write request.\r
+#define EFI_MTFTP6_OPCODE_DATA     3 ///< The MTFTPv6 packet is a data packet.\r
+#define EFI_MTFTP6_OPCODE_ACK      4 ///< The MTFTPv6 packet is an acknowledgement packet.\r
+#define EFI_MTFTP6_OPCODE_ERROR    5 ///< The MTFTPv6 packet is an error packet.\r
+#define EFI_MTFTP6_OPCODE_OACK     6 ///< The MTFTPv6 packet is an option acknowledgement packet.\r
+#define EFI_MTFTP6_OPCODE_DIR      7 ///< The MTFTPv6 packet is a directory query packet.\r
+#define EFI_MTFTP6_OPCODE_DATA8    8 ///< The MTFTPv6 packet is a data packet with a big block number. \r
+#define EFI_MTFTP6_OPCODE_ACK8     9 ///< The MTFTPv6 packet is an acknowledgement packet with a big block number.\r
+///@}\r
+\r
+///\r
+/// MTFTP ERROR Packet ErrorCodes\r
+///@{\r
+///\r
+/// The error code is not defined. See the error message in the packet (if any) for details. \r
+///\r
+#define EFI_MTFTP6_ERRORCODE_NOT_DEFINED           0\r
+///\r
+/// The file was not found.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND        1\r
+///\r
+/// There was an access violation.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION      2\r
+///\r
+/// The disk was full or its allocation was exceeded.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_DISK_FULL             3\r
+///\r
+/// The MTFTPv6 operation was illegal.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION     6\r
+///\r
+/// The transfer ID is unknown.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID   5\r
+///\r
+/// The file already exists.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS   6\r
+///\r
+/// There is no such user.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER          7\r
+///\r
+/// The request has been denied due to option negotiation.\r
+///\r
+#define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED        8\r
+///@}\r
+\r
+#pragma pack(1)\r
+\r
+///\r
+/// EFI_MTFTP6_REQ_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_RRQ for a read request\r
+  /// or OpCode = EFI_MTFTP6_OPCODE_WRQ for a write request.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The file name to be downloaded or uploaded.\r
+  ///\r
+  UINT8     Filename[1];\r
+} EFI_MTFTP6_REQ_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_OACK_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_OACK.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The option strings in the option acknowledgement packet.\r
+  ///\r
+  UINT8     Data[1];\r
+} EFI_MTFTP6_OACK_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_DATA_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// Block number of this data packet.\r
+  ///\r
+  UINT16    Block;\r
+  ///\r
+  /// The content of this data packet.\r
+  ///\r
+  UINT8     Data[1];\r
+} EFI_MTFTP6_DATA_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ACK_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The block number of the data packet that is being acknowledged.\r
+  ///\r
+  UINT16    Block[1];\r
+} EFI_MTFTP6_ACK_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_DATA8_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA8.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The block number of data packet.\r
+  ///\r
+  UINT64    Block;\r
+  ///\r
+  /// The content of this data packet.\r
+  ///\r
+  UINT8     Data[1];\r
+} EFI_MTFTP6_DATA8_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ACK8_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK8.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The block number of the data packet that is being acknowledged.\r
+  ///\r
+  UINT64    Block[1];\r
+} EFI_MTFTP6_ACK8_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_ERROR_HEADER \r
+///\r
+typedef struct {\r
+  ///\r
+  /// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.\r
+  ///\r
+  UINT16    OpCode;\r
+  ///\r
+  /// The error number as defined by the MTFTPv6 packet error codes. \r
+  ///\r
+  UINT16    ErrorCode;\r
+  ///\r
+  /// Error message string.\r
+  ///\r
+  UINT8     ErrorMessage[1];\r
+} EFI_MTFTP6_ERROR_HEADER;\r
+\r
+///\r
+/// EFI_MTFTP6_PACKET  \r
+///\r
+typedef union {\r
+  UINT16                   OpCode; ///< Type of packets as defined by the MTFTPv6 packet opcodes.\r
+  EFI_MTFTP6_REQ_HEADER    Rrq;    ///< Read request packet header.\r
+  EFI_MTFTP6_REQ_HEADER    Wrq;    ///< write request packet header.\r
+  EFI_MTFTP6_OACK_HEADER   Oack;   ///< Option acknowledge packet header.\r
+  EFI_MTFTP6_DATA_HEADER   Data;   ///< Data packet header.\r
+  EFI_MTFTP6_ACK_HEADER    Ack;    ///< Acknowledgement packet header.\r
+  EFI_MTFTP6_DATA8_HEADER  Data8;  ///< Data packet header with big block number.\r
+  EFI_MTFTP6_ACK8_HEADER   Ack8;   ///< Acknowledgement header with big block number.\r
+  EFI_MTFTP6_ERROR_HEADER  Error;  ///< Error packet header.\r
+} EFI_MTFTP6_PACKET;\r
+\r
+#pragma pack()\r
+\r
+///\r
+/// EFI_MTFTP6_CONFIG_DATA\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The local IP address to use. Set to zero to let the underlying IPv6 \r
+  /// driver choose a source address. If not zero it must be one of the \r
+  /// configured IP addresses in the underlying IPv6 driver.\r
+  ///\r
+  EFI_IPv6_ADDRESS       StationIp;\r
+  ///\r
+  /// Local port number. Set to zero to use the automatically assigned port number.\r
+  ///\r
+  UINT16                 LocalPort;\r
+  ///\r
+  /// The IP address of the MTFTPv6 server.\r
+  ///\r
+  EFI_IPv6_ADDRESS       ServerIp;\r
+  ///\r
+  /// The initial MTFTPv6 server port number. Request packets are \r
+  /// sent to this port. This number is almost always 69 and using zero \r
+  /// defaults to 69.\r
+  UINT16                 InitialServerPort;\r
+  ///\r
+  /// The number of times to transmit MTFTPv6 request packets and wait for a response.\r
+  ///\r
+  UINT16                 TryCount;\r
+  ///\r
+  /// The number of seconds to wait for a response after sending the MTFTPv6 request packet. \r
+  ///\r
+  UINT16                 TimeoutValue;\r
+} EFI_MTFTP6_CONFIG_DATA;\r
+\r
+///\r
+/// EFI_MTFTP6_MODE_DATA\r
+///\r
+typedef struct {\r
+  ///\r
+  /// The configuration data of this instance.\r
+  ///\r
+  EFI_MTFTP6_CONFIG_DATA  ConfigData;\r
+  ///\r
+  /// The number of option strings in the following SupportedOptions array.\r
+  ///\r
+  UINT8                   SupportedOptionCount;\r
+  ///\r
+  /// An array of option strings that are recognized and supported by \r
+  /// this EFI MTFTPv6 Protocol driver implementation. The buffer is \r
+  /// read only to the caller and the caller should NOT free the buffer.\r
+  ///\r
+  UINT8                   **SupportedOptions;\r
+} EFI_MTFTP6_MODE_DATA;\r
+\r
+///\r
+/// EFI_MTFTP_OVERRIDE_DATA\r
+///\r
+typedef struct {\r
+  ///\r
+  /// IP address of the MTFTPv6 server. If set to all zero, the value that \r
+  /// was set by the EFI_MTFTP6_PROTOCOL.Configure() function will be used. \r
+  ///\r
+  EFI_IPv6_ADDRESS       ServerIp;\r
+  ///\r
+  /// MTFTPv6 server port number. If set to zero, it will use the value \r
+  /// that was set by the EFI_MTFTP6_PROTOCOL.Configure() function. \r
+  ///\r
+  UINT16                 ServerPort;\r
+  ///\r
+  /// Number of times to transmit MTFTPv6 request packets and wait \r
+  /// for a response. If set to zero, the value that was set by \r
+  /// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
+  ///\r
+  UINT16                 TryCount;\r
+  ///\r
+  /// Number of seconds to wait for a response after sending the \r
+  /// MTFTPv6 request packet. If set to zero, the value that was set by \r
+  /// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.\r
+  ///\r
+  UINT16                 TimeoutValue;\r
+} EFI_MTFTP6_OVERRIDE_DATA;\r
+\r
+///\r
+/// EFI_MTFTP6_OPTION\r
+///\r
+typedef struct {\r
+  UINT8                  *OptionStr; ///< Pointer to the ASCIIZ MTFTPv6 option string. \r
+  UINT8                  *ValueStr;  ///< Pointer to the ASCIIZ MTFTPv6 value string.\r
+} EFI_MTFTP6_OPTION;\r
+\r
+/**\r
+  EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r
+  timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r
+  EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r
+  \r
+  Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r
+  function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r
+  that is returned from this function will abort the current download process. \r
+\r
+  @param[in] This          Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in] Token         The token that the caller provided in the EFI_MTFTP6_PROTOCOl.ReadFile(),\r
+                           WriteFile() or ReadDirectory() function.\r
+  @param[in] PacketLen     Indicates the length of the packet.\r
+  @param[in] Packet        Pointer to an MTFTPv6 packet.\r
+\r
+  @retval EFI_SUCCESS      Operation sucess.\r
+  @retval Others           Aborts session.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_CHECK_PACKET)( \r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token,\r
+  IN UINT16                   PacketLen,\r
+  IN EFI_MTFTP6_PACKET        *Packet\r
+  );\r
+\r
+/**\r
+  EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the \r
+  timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or \r
+  EFI_MTFTP6_PROTOCOL.ReadDirectory() functions. \r
+  \r
+  Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK\r
+  function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS\r
+  that is returned from this function will abort the current download process. \r
+\r
+  @param[in]      This     Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]      Token    The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or \r
+                           EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()\r
+                           functions by the caller.\r
+\r
+  @retval EFI_SUCCESS      Operation sucess.\r
+  @retval Others           Aborts session.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)( \r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token\r
+  );\r
+\r
+/**\r
+  EFI_MTFTP6_PACKET_NEEDED is a callback function that the caller provides to feed data to the \r
+  EFI_MTFTP6_PROTOCOL.WriteFile() function. \r
+  \r
+  EFI_MTFTP6_PACKET_NEEDED provides another mechanism for the caller to provide data to upload\r
+  other than a static buffer. The EFI MTFTP6 Protocol driver always calls EFI_MTFTP6_PACKET_NEEDED\r
+  to get packet data from the caller if no static buffer was given in the initial call to\r
+  EFI_MTFTP6_PROTOCOL.WriteFile() function. Setting *Length to zero signals the end of the session.\r
+  Returning a status code other than EFI_SUCCESS aborts the session.\r
+\r
+  @param[in]      This     Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]      Token    The token provided in the EFI_MTFTP6_PROTOCOL.WriteFile() by the caller.\r
+  @param[in, out] Length   Indicates the length of the raw data wanted on input, and the \r
+                           length the data available on output.\r
+  @param[out]     Buffer   Pointer to the buffer where the data is stored.\r
+\r
+  @retval EFI_SUCCESS      Operation sucess.\r
+  @retval Others           Aborts session.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_PACKET_NEEDED)( \r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token,\r
+  IN OUT UINT16               *Length,\r
+  OUT VOID                    **Buffer\r
+  );\r
+\r
+struct _EFI_MTFTP6_TOKEN {\r
+  ///\r
+  /// The status that is returned to the caller at the end of the operation \r
+  /// to indicate whether this operation completed successfully. \r
+  /// Defined Status values are listed below.\r
+  ///\r
+  EFI_STATUS                  Status;\r
+  ///\r
+  /// The event that will be signaled when the operation completes. If \r
+  /// set to NULL, the corresponding function will wait until the read or \r
+  /// write operation finishes. The type of Event must be EVT_NOTIFY_SIGNAL. \r
+  ///\r
+  EFI_EVENT                   Event;\r
+  ///\r
+  /// If not NULL, the data that will be used to override the existing \r
+  /// configure data. \r
+  ///\r
+  EFI_MTFTP6_OVERRIDE_DATA    *OverrideData;\r
+  ///\r
+  /// Pointer to the ASCIIZ file name string.\r
+  ///\r
+  UINT8                       *Filename;\r
+  ///\r
+  /// Pointer to the ASCIIZ mode string. If NULL, octet is used.\r
+  ///\r
+  UINT8                       *ModeStr;\r
+  ///\r
+  /// Number of option/value string pairs.\r
+  ///\r
+  UINT32                      OptionCount;\r
+  ///\r
+  /// Pointer to an array of option/value string pairs. Ignored if \r
+  /// OptionCount is zero. Both a remote server and this driver \r
+  /// implementation should support these options. If one or more \r
+  /// options are unrecognized by this implementation, it is sent to the \r
+  /// remote server without being changed.\r
+  ///\r
+  EFI_MTFTP6_OPTION           *OptionList;\r
+  ///\r
+  /// On input, the size, in bytes, of Buffer. On output, the number \r
+  /// of bytes transferred.\r
+  ///\r
+  UINT64                      BufferSize;        \r
+  ///\r
+  /// Pointer to the data buffer. Data that is downloaded from the \r
+  /// MTFTPv6 server is stored here. Data that is uploaded to the \r
+  /// MTFTPv6 server is read from here. Ignored if BufferSize is zero.\r
+  ///\r
+  VOID                        *Buffer;\r
+  ///\r
+  /// Pointer to the context that will be used by CheckPacket, \r
+  /// TimeoutCallback and PacketNeeded.\r
+  ///\r
+  VOID                        *Context;\r
+  ///\r
+  /// Pointer to the callback function to check the contents of the \r
+  /// received packet. \r
+  ///\r
+  EFI_MTFTP6_CHECK_PACKET      CheckPacket;\r
+  ///\r
+  /// Pointer to the function to be called when a timeout occurs.\r
+  ///\r
+  EFI_MTFTP6_TIMEOUT_CALLBACK  TimeoutCallback;\r
+  ///\r
+  /// Pointer to the function to provide the needed packet contents. \r
+  /// Only used in WriteFile() operation.\r
+  ///\r
+  EFI_MTFTP6_PACKET_NEEDED     PacketNeeded;\r
+};\r
+\r
+/**\r
+  Read the current operational settings.\r
+  \r
+  The GetModeData() function reads the current operational settings of this EFI MTFTPv6\r
+  Protocol driver instance.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[out] ModeData           The buffer in which the EFI MTFTPv6 Protocol driver mode\r
+                                 data is returned.\r
+\r
+  @retval  EFI_SUCCESS           The configuration data was successfully returned.\r
+  @retval  EFI_OUT_OF_RESOURCES  The required mode data could not be allocated.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_GET_MODE_DATA)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  OUT EFI_MTFTP6_MODE_DATA    *ModeData\r
+  );\r
+\r
+/**\r
+  Initializes, changes, or resets the default operational setting for this EFI MTFTPv6\r
+  Protocol driver instance.\r
+  \r
+  The Configure() function is used to set and change the configuration data for this EFI \r
+  MTFTPv6 Protocol driver instance. The configuration data can be reset to startup defaults by calling \r
+  Configure() with MtftpConfigData set to NULL. Whenever the instance is reset, any \r
+  pending operation is aborted. By changing the EFI MTFTPv6 Protocol driver instance configuration \r
+  data, the client can connect to different MTFTPv6 servers. The configuration parameters in \r
+  MtftpConfigData are used as the default parameters in later MTFTPv6 operations and can be \r
+  overridden in later operations.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  MtftpConfigData    Pointer to the configuration data structure. \r
+\r
+  @retval  EFI_SUCCESS           The EFI MTFTPv6 Protocol instance was configured successfully.\r
+  @retval  EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+                                 - This is NULL.\r
+                                 - MtftpConfigData.StationIp is neither zero nor one \r
+                                   of the configured IP addresses in the underlying IPv6 driver.\r
+                                 - MtftpCofigData.ServerIp is not a valid IPv6 unicast address.\r
+                                 - The StationIP and LocalPort is already in use\r
+  @retval  EFI_ACCESS_DENIED     The configuration could not be changed at this time because there \r
+                                 is some MTFTP background operation in progress.\r
+  @retval  EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                 address for this instance, but no source address was available for use\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_CONFIGURE)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_CONFIG_DATA      *MtftpConfigData OPTIONAL\r
+);\r
+\r
+/**\r
+  Get information about a file from an MTFTPv6 server.\r
+  \r
+  The GetInfo() function assembles an MTFTPv6 request packet with options, sends it to the \r
+  MTFTPv6 server, and may return an MTFTPv6 OACK, MTFTPv6 ERROR, or ICMP ERROR packet. \r
+  Retries occur only if no response packets are received from the MTFTPv6 server before the \r
+  timeout expires.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  OverrideData       Data that is used to override the existing parameters. If NULL, the \r
+                                 default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()\r
+                                 function are used. \r
+  @param[in]  Filename           Pointer to ASCIIZ file name string.\r
+  @param[in]  ModeStr            Pointer to ASCIIZ mode string. If NULL, octet will be used \r
+  @param[in]  OptionCount        Number of option/value string pairs in OptionList.\r
+  @param[in]  OptionList         Pointer to array of option/value string pairs. Ignored if \r
+                                 OptionCount is zero.\r
+  @param[out] PacketLength       The number of bytes in the returned packet.\r
+  @param[out] Packet             The pointer to the received packet. This buffer must be freed by \r
+                                 the caller.\r
+\r
+  @retval  EFI_SUCCESS           An MTFTPv6 OACK packet was received and is in the Buffer.\r
+  @retval  EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - Filename is NULL\r
+                                 - OptionCount is not zero and OptionList is NULL.\r
+                                 - One or more options in OptionList have wrong format.\r
+                                 - PacketLength is NULL.\r
+                                 - OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+  @retval  EFI_UNSUPPORTED       One or more options in the OptionList are unsupported by \r
+                                 this implementation.\r
+  @retval  EFI_NOT_STARTED       The EFI MTFTPv6 Protocol driver has not been started.\r
+  @retval  EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                 address for this instance, but no source address was available for use.\r
+  @retval  EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval  EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval  EFI_TFTP_ERROR        An MTFTPv6 ERROR packet was received and is in the Packet.\r
+  @retval  EFI_ICMP_ERROR        An ICMP ERROR packet was received and the Packet is set to NULL.\r
+  @retval  EFI_PROTOCOL_ERROR    An unexpected MTFTPv6 packet was received and is in the Packet.\r
+  @retval  EFI_TIMEOUT           No responses were received from the MTFTPv6 server.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_GET_INFO)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_OVERRIDE_DATA *OverrideData OPTIONAL,\r
+  IN UINT8                    *Filename,\r
+  IN UINT8                    *ModeStr OPTIONAL,\r
+  IN UINT8                    OptionCount,\r
+  IN EFI_MTFTP6_OPTION        *OptionList OPTIONAL,\r
+  OUT UINT32                  *PacketLength,\r
+  OUT EFI_MTFTP6_PACKET       **Packet OPTIONAL\r
+);\r
+\r
+/**\r
+  Parse the options in an MTFTPv6 OACK packet.\r
+\r
+  The ParseOptions() function parses the option fields in an MTFTPv6 OACK packet and \r
+  returns the number of options that were found and optionally a list of pointers to \r
+  the options in the packet.\r
+  If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned\r
+  and *OptionCount and *OptionList stop at the last valid option.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  PacketLen          Length of the OACK packet to be parsed.\r
+  @param[in]  Packet             Pointer to the OACK packet to be parsed. \r
+  @param[out] OptionCount        Pointer to the number of options in the following OptionList. \r
+  @param[out] OptionList         Pointer to EFI_MTFTP6_OPTION storage. Each pointer in the \r
+                                 OptionList points to the corresponding MTFTP option buffer \r
+                                 in the Packet. Call the EFI Boot Service FreePool() to \r
+                                 release the OptionList if the options in this OptionList \r
+                                 are not needed any more. \r
+\r
+  @retval  EFI_SUCCESS           The OACK packet was valid and the OptionCount and \r
+                                 OptionList parameters have been updated.\r
+  @retval  EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                 - PacketLen is 0.\r
+                                 - Packet is NULL or Packet is not a valid MTFTPv6 packet.\r
+                                 - OptionCount is NULL.\r
+  @retval  EFI_NOT_FOUND         No options were found in the OACK packet.\r
+  @retval  EFI_OUT_OF_RESOURCES  Storage for the OptionList array can not be allocated.\r
+  @retval  EFI_PROTOCOL_ERROR    One or more of the option fields is invalid.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_PARSE_OPTIONS)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN UINT32                   PacketLen,\r
+  IN EFI_MTFTP6_PACKET        *Packet,\r
+  OUT UINT32                  *OptionCount,\r
+  OUT EFI_MTFTP6_OPTION       **OptionList OPTIONAL\r
+  );\r
+\r
+/**\r
+  Download a file from an MTFTPv6 server.\r
+\r
+  The ReadFile() function is used to initialize and start an MTFTPv6 download process and \r
+  optionally wait for completion. When the download operation completes, whether successfully or \r
+  not, the Token.Status field is updated by the EFI MTFTPv6 Protocol driver and then \r
+  Token.Event is signaled if it is not NULL.\r
+  \r
+  Data can be downloaded from the MTFTPv6 server into either of the following locations:\r
+  - A fixed buffer that is pointed to by Token.Buffer \r
+  - A download service function that is pointed to by Token.CheckPacket \r
+\r
+  If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r
+  will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  Token              Pointer to the token structure to provide the parameters that are \r
+                                 used in this operation.\r
+\r
+  @retval  EFI_SUCCESS           The data file has been transferred successfully.\r
+  @retval  EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval  EFI_BUFFER_TOO_SMALL  BufferSize is not large enough to hold the downloaded data \r
+                                 in downloading process.\r
+  @retval  EFI_ABORTED           Current operation is aborted by user.\r
+  @retval  EFI_ICMP_ERROR        An ICMP ERROR packet was received.\r
+  @retval  EFI_TIMEOUT           No responses were received from the MTFTPv6 server.\r
+  @retval  EFI_TFTP_ERROR        An MTFTPv6 ERROR packet was received.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_READ_FILE)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token\r
+  );\r
+\r
+/**\r
+  Send a file to an MTFTPv6 server. May be unsupported in some implementations.\r
+\r
+  The WriteFile() function is used to initialize an uploading operation with the given option list \r
+  and optionally wait for completion. If one or more of the options is not supported by the server, the \r
+  unsupported options are ignored and a standard TFTP process starts instead. When the upload \r
+  process completes, whether successfully or not, Token.Event is signaled, and the EFI MTFTPv6 \r
+  Protocol driver updates Token.Status.\r
+\r
+  The caller can supply the data to be uploaded in the following two modes:\r
+  - Through the user-provided buffer\r
+  - Through a callback function\r
+\r
+  With the user-provided buffer, the Token.BufferSize field indicates the length of the buffer, \r
+  and the driver will upload the data in the buffer. With an EFI_MTFTP6_PACKET_NEEDED \r
+  callback function, the driver will call this callback function to get more data from the user to upload. \r
+  See the definition of EFI_MTFTP6_PACKET_NEEDED for more information. These two modes \r
+  cannot be used at the same time. The callback function will be ignored if the user provides the \r
+  buffer.\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  Token              Pointer to the token structure to provide the parameters that are \r
+                                 used in this operation.\r
+\r
+  @retval  EFI_SUCCESS           The upload session has started.\r
+  @retval  EFI_UNSUPPORTED       The operation is not supported by this implementation.\r
+  @retval  EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - Token is NULL.\r
+                                 - Token.Filename is NULL.\r
+                                 - Token.OptionCount is not zero and Token.OptionList is NULL.\r
+                                 - One or more options in Token.OptionList have wrong format.\r
+                                 - Token.Buffer and Token.PacketNeeded are both NULL.\r
+                                 - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+  @retval  EFI_UNSUPPORTED       One or more options in the Token.OptionList are not \r
+                                 supported by this implementation.\r
+  @retval  EFI_NOT_STARTED       The EFI MTFTPv6 Protocol driver has not been started.\r
+  @retval  EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                 address for this instance, but no source address was available for use.\r
+  @retval  EFI_ALREADY_STARTED   This Token is already being used in another MTFTPv6 session.\r
+  @retval  EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval  EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_WRITE_FILE)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token\r
+  );\r
+\r
+/**\r
+  Download a data file directory from an MTFTPv6 server. May be unsupported in some implementations.\r
+\r
+  The ReadDirectory() function is used to return a list of files on the MTFTPv6 server that are \r
+  logically (or operationally) related to Token.Filename. The directory request packet that is sent \r
+  to the server is built with the option list that was provided by caller, if present.\r
+  \r
+  The file information that the server returns is put into either of the following locations:\r
+  - A fixed buffer that is pointed to by Token.Buffer \r
+  - A download service function that is pointed to by Token.CheckPacket \r
+  \r
+  If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket \r
+  will be called first. If the call is successful, the packet will be stored in Token.Buffer.\r
+  \r
+  The returned directory listing in the Token.Buffer or EFI_MTFTP6_PACKET consists of a list \r
+  of two or three variable-length ASCII strings, each terminated by a null character, for each file in the \r
+  directory. If the multicast option is involved, the first field of each directory entry is the static \r
+  multicast IP address and UDP port number that is associated with the file name. The format of the \r
+  field is ip:ip:ip:ip:port. If the multicast option is not involved, this field and its terminating \r
+  null character are not present.\r
+  \r
+  The next field of each directory entry is the file name and the last field is the file information string. \r
+  The information string contains the file size and the create/modify timestamp. The format of the \r
+  information string is filesize yyyy-mm-dd hh:mm:ss:ffff. The timestamp is \r
+  Coordinated Universal Time (UTC; also known as Greenwich Mean Time [GMT]).\r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+  @param[in]  Token              Pointer to the token structure to provide the parameters that are \r
+                                 used in this operation.\r
+\r
+  @retval  EFI_SUCCESS           The MTFTPv6 related file "directory" has been downloaded.\r
+  @retval  EFI_UNSUPPORTED       The EFI MTFTPv6 Protocol driver does not support this function.\r
+  @retval  EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - Token is NULL.\r
+                                 - Token.Filename is NULL.\r
+                                 - Token.OptionCount is not zero and Token.OptionList is NULL.\r
+                                 - One or more options in Token.OptionList have wrong format.\r
+                                 - Token.Buffer and Token.CheckPacket are both NULL.\r
+                                 - Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.\r
+  @retval  EFI_UNSUPPORTED       One or more options in the Token.OptionList are not \r
+                                 supported by this implementation.\r
+  @retval  EFI_NOT_STARTED       The EFI MTFTPv6 Protocol driver has not been started.\r
+  @retval  EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                 address for this instance, but no source address was available for use.\r
+  @retval  EFI_ALREADY_STARTED   This Token is already being used in another MTFTPv6 session.\r
+  @retval  EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval  EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This,\r
+  IN EFI_MTFTP6_TOKEN         *Token\r
+);\r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets. \r
+\r
+  The Poll() function can be used by network drivers and applications to increase the rate that data \r
+  packets are moved between the communications device and the transmit and receive queues.\r
+  In some systems, the periodic timer event in the managed network driver may not poll the \r
+  underlying communications device fast enough to transmit and/or receive all data packets without \r
+  missing incoming packets or dropping outgoing packets. Drivers and applications that are \r
+  experiencing packet loss should try calling the Poll() function more often. \r
+\r
+  @param[in]  This               Pointer to the EFI_MTFTP6_PROTOCOL instance.\r
+\r
+  @retval  EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval  EFI_NOT_STARTED       This EFI MTFTPv6 Protocol instance has not been started.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred. \r
+  @retval  EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MTFTP6_POLL)(\r
+  IN EFI_MTFTP6_PROTOCOL      *This\r
+  );\r
+\r
+///\r
+/// The EFI_MTFTP6_PROTOCOL is designed to be used by UEFI drivers and applications to transmit \r
+/// and receive data files. The EFI MTFTPv6 Protocol driver uses the underlying EFI UDPv6 Protocol \r
+/// driver and EFI IPv6 Protocol driver.\r
+///\r
+struct _EFI_MTFTP6_PROTOCOL {\r
+  EFI_MTFTP6_GET_MODE_DATA  GetModeData;\r
+  EFI_MTFTP6_CONFIGURE      Configure;\r
+  EFI_MTFTP6_GET_INFO       GetInfo;\r
+  EFI_MTFTP6_PARSE_OPTIONS  ParseOptions;\r
+  EFI_MTFTP6_READ_FILE      ReadFile;\r
+  EFI_MTFTP6_WRITE_FILE     WriteFile;\r
+  EFI_MTFTP6_READ_DIRECTORY ReadDirectory;\r
+  EFI_MTFTP6_POLL           Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiMtftp6ProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/Udp6.h b/MdePkg/Include/Protocol/Udp6.h
new file mode 100644 (file)
index 0000000..8709a09
--- /dev/null
@@ -0,0 +1,569 @@
+/** @file\r
+  The EFI UDPv6 (User Datagram Protocol version 6) Protocol Definition, which is built upon\r
+  the EFI IPv6 Protocol and provides simple packet-oriented services to transmit and receive\r
+  UDP packets.\r
+\r
+Copyright (c) 2008 - 2009, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#ifndef __EFI_UDP6_PROTOCOL_H__\r
+#define __EFI_UDP6_PROTOCOL_H__\r
+\r
+#include <Protocol/Ip6.h>\r
+\r
+#define EFI_UDP6_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 } \\r
+  }\r
+\r
+#define EFI_UDP6_PROTOCOL_GUID \\r
+  { \\r
+    0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 } \\r
+  }\r
+\r
+typedef struct {\r
+  ///\r
+  /// The EFI UDPv6 Protocol instance handle that is using this address/port pair.\r
+  ///\r
+  EFI_HANDLE          InstanceHandle;\r
+  ///\r
+  /// The IPv6 address to which this instance of the EFI UDPv6 Protocol is bound.\r
+  /// Set to 0::/128, if this instance is used to listen all packets from any\r
+  /// source address.\r
+  ///\r
+  EFI_IPv6_ADDRESS    LocalAddress;\r
+  ///\r
+  /// The port number in host byte order on which the service is listening.\r
+  ///\r
+  UINT16              LocalPort;\r
+  ///\r
+  /// The IPv6 address of the remote host. May be 0::/128 if it is not connected\r
+  /// to any remote host or connected with more than one remote host.\r
+  ///\r
+  EFI_IPv6_ADDRESS    RemoteAddress;\r
+  ///\r
+  /// The port number in host byte order on which the remote host is \r
+  /// listening. Maybe zero if it is not connected to any remote host.\r
+  ///\r
+  UINT16              RemotePort;\r
+} EFI_UDP6_SERVICE_POINT;\r
+\r
+typedef struct {\r
+  ///\r
+  /// The handle of the driver that creates this entry.\r
+  ///\r
+  EFI_HANDLE              DriverHandle;\r
+  ///\r
+  /// The number of address/port pairs that follow this data structure.\r
+  ///\r
+  UINT32                  ServiceCount;\r
+  ///\r
+  /// List of address/port pairs that are currently in use.\r
+  ///\r
+  EFI_UDP6_SERVICE_POINT  Services[1];\r
+} EFI_UDP6_VARIABLE_DATA;\r
+\r
+typedef struct _EFI_UDP6_PROTOCOL EFI_UDP6_PROTOCOL;\r
+\r
+///\r
+/// EFI_UDP6_FRAGMENT_DATA allows multiple receive or transmit buffers to be specified.\r
+/// The purpose of this structure is to avoid copying the same packet multiple times.\r
+///\r
+typedef struct {\r
+  UINT32        FragmentLength;  ///< Length of the fragment data buffer.\r
+  VOID          *FragmentBuffer; ///< Pointer to the fragment data buffer.\r
+} EFI_UDP6_FRAGMENT_DATA;\r
+\r
+///\r
+/// The EFI_UDP6_SESSION_DATA is used to retrieve the settings when receiving packets or\r
+/// to override the existing settings (only DestinationAddress and DestinationPort can\r
+/// be overridden) of this EFI UDPv6 Protocol instance when sending packets.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Address from which this packet is sent. This field should not be used when\r
+  /// sending packets.\r
+  ///\r
+  EFI_IPv6_ADDRESS   SourceAddress;\r
+  ///\r
+  /// Port from which this packet is sent. It is in host byte order. This field should\r
+  /// not be used when sending packets.\r
+  ///\r
+  UINT16             SourcePort;\r
+  ///\r
+  /// Address to which this packet is sent. When sending packet, it¡¯ll be ignored\r
+  /// if it is zero.\r
+  ///\r
+  EFI_IPv6_ADDRESS   DestinationAddress;\r
+  ///\r
+  /// Port to which this packet is sent. When sending packet, it¡¯ll be \r
+  /// ignored if it is zero.\r
+  ///\r
+  UINT16             DestinationPort;\r
+} EFI_UDP6_SESSION_DATA;\r
+\r
+typedef struct {\r
+  ///\r
+  /// Set to TRUE to accept UDP packets that are sent to any address.\r
+  ///\r
+  BOOLEAN           AcceptPromiscuous;\r
+  ///\r
+  /// Set to TRUE to accept UDP packets that are sent to any port.\r
+  ///\r
+  BOOLEAN           AcceptAnyPort;\r
+  ///\r
+  /// Set to TRUE to allow this EFI UDPv6 Protocol child instance to open a port number\r
+  /// that is already being used by another EFI UDPv6 Protocol child instance.\r
+  ///\r
+  BOOLEAN           AllowDuplicatePort;\r
+  ///\r
+  /// TrafficClass field in transmitted IPv6 packets.\r
+  ///\r
+  UINT8             TrafficClass;\r
+  ///\r
+  /// HopLimit field in transmitted IPv6 packets.\r
+  ///\r
+  UINT8             HopLimit;\r
+  ///\r
+  /// The receive timeout value (number of microseconds) to be associated with each\r
+  /// incoming packet. Zero means do not drop incoming packets.\r
+  ///\r
+  UINT32            ReceiveTimeout;\r
+  ///\r
+  /// The transmit timeout value (number of microseconds) to be associated with each\r
+  /// outgoing packet. Zero means do not drop outgoing packets.\r
+  ///\r
+  UINT32            TransmitTimeout;\r
+  ///\r
+  /// The station IP address that will be assigned to this EFI UDPv6 Protocol instance.\r
+  /// The EFI UDPv6 and EFI IPv6 Protocol drivers will only deliver incoming packets\r
+  /// whose destination matches this IP address exactly. Address 0::/128 is also accepted\r
+  /// as a special case. Under this situation, underlying IPv6 driver is responsible for\r
+  /// binding a source address to this EFI IPv6 protocol instance according to source\r
+  /// address selection algorithm. Only incoming packet from the selected source address\r
+  /// is delivered. This field can be set and changed only when the EFI IPv6 driver is\r
+  /// transitioning from the stopped to the started states. If no address is available\r
+  /// for selecting, the EFI IPv6 Protocol driver will use EFI_IP6_CONFIG_PROTOCOL to\r
+  /// retrieve the IPv6 address.\r
+  EFI_IPv6_ADDRESS  StationAddress;\r
+  ///\r
+  /// The port number to which this EFI UDPv6 Protocol instance is bound. If a client\r
+  /// of the EFI UDPv6 Protocol does not care about the port number, set StationPort\r
+  /// to zero. The EFI UDPv6 Protocol driver will assign a random port number to transmitted \r
+  /// UDP packets. Ignored it if AcceptAnyPort is TRUE.\r
+  ///\r
+  UINT16            StationPort;\r
+  ///\r
+  /// The IP address of remote host to which this EFI UDPv6 Protocol instance is connecting.\r
+  /// If RemoteAddress is not 0::/128, this EFI UDPv6 Protocol instance will be connected to\r
+  /// RemoteAddress; i.e., outgoing packets of this EFI UDPv6 Protocol instance will be sent\r
+  /// to this address by default and only incoming packets from this address will be delivered\r
+  /// to client. Ignored for incoming filtering if AcceptPromiscuous is TRUE.\r
+  EFI_IPv6_ADDRESS  RemoteAddress;\r
+  ///\r
+  /// The port number of the remote host to which this EFI UDPv6 Protocol instance is connecting.\r
+  /// If it is not zero, outgoing packets of this EFI UDPv6 Protocol instance will be sent to\r
+  /// this port number by default and only incoming packets from this port will be delivered\r
+  /// to client. Ignored if RemoteAddress is 0::/128 and ignored for incoming filtering if\r
+  /// AcceptPromiscuous is TRUE.\r
+  UINT16            RemotePort;\r
+} EFI_UDP6_CONFIG_DATA;\r
+\r
+///\r
+/// The EFI UDPv6 Protocol client must fill this data structure before sending a packet.\r
+/// The packet may contain multiple buffers that may be not in a continuous memory location.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// If not NULL, the data that is used to override the transmitting settings.Only the two\r
+  /// filed UdpSessionData.DestinationAddress and UdpSessionData.DestionPort can be used as\r
+  /// the transmitting setting filed.\r
+  ///\r
+  EFI_UDP6_SESSION_DATA     *UdpSessionData;\r
+  ///\r
+  /// Sum of the fragment data length. Must not exceed the maximum UDP packet size.\r
+  ///\r
+  UINT32                    DataLength;\r
+  ///\r
+  /// Number of fragments.\r
+  ///\r
+  UINT32                    FragmentCount;\r
+  ///\r
+  /// Array of fragment descriptors.\r
+  ///\r
+  EFI_UDP6_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP6_TRANSMIT_DATA;\r
+\r
+///\r
+/// EFI_UDP6_RECEIVE_DATA is filled by the EFI UDPv6 Protocol driver when this EFI UDPv6\r
+/// Protocol instance receives an incoming packet. If there is a waiting token for incoming\r
+/// packets, the CompletionToken.Packet.RxData field is updated to this incoming packet and\r
+/// the CompletionToken.Event is signaled. The EFI UDPv6 Protocol client must signal the\r
+/// RecycleSignal after processing the packet.\r
+/// FragmentTable could contain multiple buffers that are not in the continuous memory locations. \r
+/// The EFI UDPv6 Protocol client might need to combine two or more buffers in FragmentTable to \r
+/// form their own protocol header.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Time when the EFI UDPv6 Protocol accepted the packet.\r
+  ///\r
+  EFI_TIME                  TimeStamp;\r
+  ///\r
+  /// Indicates the event to signal when the received data has been processed.\r
+  ///\r
+  EFI_EVENT                 RecycleSignal;\r
+  ///\r
+  /// The UDP session data including SourceAddress, SourcePort, DestinationAddress,\r
+  /// and DestinationPort.\r
+  ///\r
+  EFI_UDP6_SESSION_DATA     UdpSession;\r
+  ///\r
+  /// The sum of the fragment data length.\r
+  ///\r
+  UINT32                    DataLength;\r
+  ///\r
+  /// Number of fragments. Maybe zero.\r
+  ///\r
+  UINT32                    FragmentCount;\r
+  ///\r
+  /// Array of fragment descriptors. Maybe zero.\r
+  ///\r
+  EFI_UDP6_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP6_RECEIVE_DATA;\r
+\r
+///\r
+/// The EFI_UDP6_COMPLETION_TOKEN structures are used for both transmit and receive operations.\r
+/// When used for transmitting, the Event and TxData fields must be filled in by the EFI UDPv6\r
+/// Protocol client. After the transmit operation completes, the Status field is updated by the\r
+/// EFI UDPv6 Protocol and the Event is signaled.\r
+/// When used for receiving, only the Event field must be filled in by the EFI UDPv6 Protocol\r
+/// client. After a packet is received, RxData and Status are filled in by the EFI UDPv6 Protocol\r
+/// and the Event is signaled.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// This Event will be signaled after the Status field is updated by the EFI UDPv6 Protocol\r
+  /// driver. The type of Event must be EVT_NOTIFY_SIGNAL.\r
+  ///\r
+  EFI_EVENT                             Event;\r
+  ///\r
+  /// Will be set to one of the following values:\r
+  ///   - EFI_SUCCESS: The receive or transmit operation completed successfully.\r
+  ///   - EFI_ABORTED: The receive or transmit was aborted.\r
+  ///   - EFI_TIMEOUT: The transmit timeout expired.\r
+  ///   - EFI_NETWORK_UNREACHABLE: The destination network is unreachable. RxData is set to \r
+  ///     NULL in this situation.\r
+  ///   - EFI_HOST_UNREACHABLE: The destination host is unreachable. RxData is set to NULL in \r
+  ///     this situation.\r
+  ///   - EFI_PROTOCOL_UNREACHABLE: The UDP protocol is unsupported in the remote system. \r
+  ///     RxData is set to NULL in this situation.\r
+  ///   - EFI_PORT_UNREACHABLE: No service is listening on the remote port. RxData is set to \r
+  ///     NULL in this situation.\r
+  ///   - EFI_ICMP_ERROR: Some other Internet Control Message Protocol (ICMP) error report was \r
+  ///     received. For example, packets are being sent too fast for the destination to receive them\r
+  ///     and the destination sent an ICMP source quench report. RxData is set to NULL in this situation.\r
+  ///   - EFI_DEVICE_ERROR: An unexpected system or network error occurred.\r
+  ///   - EFI_SECURITY_VIOLATION: The transmit or receive was failed because of IPsec policy check.\r
+  ///\r
+  EFI_STATUS                            Status;\r
+  union {\r
+    ///\r
+    /// When this token is used for receiving, RxData is a pointer to EFI_UDP6_RECEIVE_DATA.\r
+    ///\r
+    EFI_UDP6_RECEIVE_DATA               *RxData;\r
+    ///\r
+    /// When this token is used for transmitting, TxData is a pointer to EFI_UDP6_TRANSMIT_DATA.\r
+    ///\r
+    EFI_UDP6_TRANSMIT_DATA              *TxData;\r
+  } Packet;\r
+} EFI_UDP6_COMPLETION_TOKEN;\r
+\r
+/**\r
+  Read the current operational settings.\r
+\r
+  The GetModeData() function copies the current operational settings of this EFI UDPv6 Protocol\r
+  instance into user-supplied buffers. This function is used optionally to retrieve the operational\r
+  mode data of underlying networks or drivers. \r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[out]  Udp6ConfigData   The buffer in which the current UDP configuration data is returned.\r
+  @param[out]  Ip6ModeData      The buffer in which the current EFI IPv6 Protocol mode data is returned.\r
+  @param[out]  MnpConfigData    The buffer in which the current managed network configuration data is\r
+                                returned.\r
+  @param[out]  SnpModeData      The buffer in which the simple network mode data is returned.\r
+\r
+  @retval EFI_SUCCESS           The mode data was read.\r
+  @retval EFI_NOT_STARTED       When Udp6ConfigData is queried, no configuration data is available\r
+                                because this instance has not been started.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_GET_MODE_DATA)(\r
+  IN EFI_UDP6_PROTOCOL                 *This,\r
+  OUT EFI_UDP6_CONFIG_DATA             *Udp6ConfigData OPTIONAL,\r
+  OUT EFI_IP6_MODE_DATA                *Ip6ModeData    OPTIONAL,\r
+  OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,\r
+  OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL\r
+);\r
+\r
+/**\r
+  Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv6 \r
+  Protocol.\r
+\r
+  The Configure() function is used to do the following:\r
+  - Initialize and start this instance of the EFI UDPv6 Protocol.\r
+  - Change the filtering rules and operational parameters.\r
+  - Reset this instance of the EFI UDPv6 Protocol. \r
+\r
+  Until these parameters are initialized, no network traffic can be sent or received by this instance.\r
+  This instance can be also reset by calling Configure() with UdpConfigData set to NULL.\r
+  Once reset, the receiving queue and transmitting queue are flushed and no traffic is allowed through\r
+  this instance.\r
+\r
+  With different parameters in UdpConfigData, Configure() can be used to bind this instance to specified\r
+  port.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[in]   UdpConfigData    Pointer to the buffer contained the configuration data.\r
+\r
+  @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
+  @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source \r
+                                address for this instance, but no source address was available for use.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+                                - This is NULL.\r
+                                - UdpConfigData.StationAddress neither zero nor one of the configured IP\r
+                                  addresses in the underlying IPv6 driver.\r
+                                - UdpConfigData.RemoteAddress is not a valid unicast IPv6 address if it\r
+                                  is not zero.\r
+  @retval EFI_ALREADY_STARTED   The EFI UDPv6 Protocol instance is already started/configured and must be\r
+                                stopped/reset before it can be reconfigured. Only TrafficClass, HopLimit,\r
+                                ReceiveTimeout, and TransmitTimeout can be reconfigured without stopping\r
+                                the current instance of the EFI UDPv6 Protocol.\r
+  @retval EFI_ACCESS_DENIED     UdpConfigData.AllowDuplicatePort is FALSE and UdpConfigData.StationPort\r
+                                is already used by other instance. \r
+  @retval EFI_OUT_OF_RESOURCES  The EFI UDPv6 Protocol driver cannot allocate memory for this EFI UDPv6\r
+                                Protocol instance.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance was not\r
+                                opened.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_CONFIGURE)(\r
+  IN EFI_UDP6_PROTOCOL     *This,\r
+  IN EFI_UDP6_CONFIG_DATA  *UdpConfigData OPTIONAL\r
+);\r
+\r
+/**\r
+  Joins and leaves multicast groups.\r
+\r
+  The Groups() function is used to join or leave one or more multicast group.\r
+  If the JoinFlag is FALSE and the MulticastAddress is NULL, then all currently joined groups are left.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[in]   JoinFlag         Set to TRUE to join a multicast group. Set to FALSE to leave one\r
+                                or all multicast groups.\r
+  @param[in]   MulticastAddress Pointer to multicast group address to join or leave.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI UDPv6 Protocol instance has not been started.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate resources to join the group.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - JoinFlag is TRUE and MulticastAddress is NULL.\r
+                                - JoinFlag is TRUE and *MulticastAddress is not a valid multicast address.\r
+  @retval EFI_ALREADY_STARTED   The group address is already in the group table (when JoinFlag is TRUE).\r
+  @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is FALSE).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_GROUPS)(\r
+  IN EFI_UDP6_PROTOCOL  *This,\r
+  IN BOOLEAN            JoinFlag,\r
+  IN EFI_IPv6_ADDRESS   *MulticastAddress OPTIONAL\r
+);\r
+\r
+/**\r
+  Queues outgoing data packets into the transmit queue.\r
+\r
+  The Transmit() function places a sending request to this instance of the EFI UDPv6 Protocol,\r
+  alongside the transmit data that was filled by the user. Whenever the packet in the token is\r
+  sent out or some errors occur, the Token.Event will be signaled and Token.Status is updated.\r
+  Providing a proper notification function and context for the event will enable the user to\r
+  receive the notification and transmitting status.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[in]   Token            Pointer to the completion token that will be placed into the \r
+                                transmit queue.\r
+\r
+  @retval EFI_SUCCESS           The data has been queued for transmission.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv6 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source\r
+                                address for this instance, but no source address was available\r
+                                for use.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
+                                - This is NULL.\r
+                                - Token is NULL.\r
+                                - Token.Event is NULL.\r
+                                - Token.Packet.TxData is NULL.\r
+                                - Token.Packet.TxData.FragmentCount is zero.\r
+                                - Token.Packet.TxData.DataLength is not equal to the sum of fragment\r
+                                  lengths.\r
+                                - One or more of the Token.Packet.TxData.FragmentTable[].FragmentLength\r
+                                  fields is zero.\r
+                                - One or more of the Token.Packet.TxData.FragmentTable[].FragmentBuffer\r
+                                  fields is NULL.\r
+                                - Token.Packet.TxData.UdpSessionData.DestinationAddress is not zero\r
+                                  and is not valid unicast Ipv6 address if UdpSessionData is not NULL.\r
+                                - Token.Packet.TxData.UdpSessionData is NULL and this instance¡¯s \r
+                                  UdpConfigData.RemoteAddress is unspecified.\r
+                                - Token.Packet.TxData.UdpSessionData.DestinationAddress is non-zero\r
+                                  when DestinationAddress is configured as non-zero when doing Configure()\r
+                                  for this EFI Udp6 protocol instance.\r
+                                - Token.Packet.TxData.UdpSesionData.DestinationAddress is zero when \r
+                                  DestinationAddress is unspecified when doing Configure() for this\r
+                                  EFI Udp6 protocol instance.\r
+  @retval EFI_ACCESS_DENIED     The transmit completion token with the same Token.Event was already\r
+                                in the transmit queue.\r
+  @retval EFI_NOT_READY         The completion token could not be queued because the transmit queue\r
+                                is full.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not queue the transmit data.\r
+  @retval EFI_NOT_FOUND         There is no route to the destination network or address.\r
+  @retval EFI_BAD_BUFFER_SIZE   The data length is greater than the maximum UDP packet size.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_TRANSMIT)(\r
+  IN EFI_UDP6_PROTOCOL          *This,\r
+  IN EFI_UDP6_COMPLETION_TOKEN  *Token\r
+);\r
+\r
+/**\r
+  Places an asynchronous receive request into the receiving queue.\r
+\r
+  The Receive() function places a completion token into the receive packet queue. This function is\r
+  always asynchronous.\r
+  The caller must fill in the Token.Event field in the completion token, and this field cannot be \r
+  NULL. When the receive operation completes, the EFI UDPv6 Protocol driver updates the Token.Status\r
+  and Token.Packet.RxData fields and the Token.Event is signaled.\r
+  Providing a proper notification function and context for the event will enable the user to receive\r
+  the notification and receiving status. That notification function is guaranteed to not be re-entered.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[in]   Token            Pointer to a token that is associated with the receive data descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv6 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source\r
+                                address for this instance, but no source address was available\r
+                                for use.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r
+                                - This is NULL.\r
+                                - Token is NULL.\r
+                                - Token.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system \r
+                                resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. The EFI UDPv6 Protocol\r
+                                instance has been reset to startup defaults.\r
+  @retval EFI_ACCESS_DENIED     A receive completion token with the same Token.Event was already in \r
+                                the receive queue.\r
+  @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_RECEIVE)(\r
+  IN EFI_UDP6_PROTOCOL          *This,\r
+  IN EFI_UDP6_COMPLETION_TOKEN  *Token\r
+);\r
+\r
+/**\r
+  Aborts an asynchronous transmit or receive request.\r
+\r
+  The Cancel() function is used to abort a pending transmit or receive request. If the token is in the\r
+  transmit or receive request queues, after calling this function, Token.Status will be set to\r
+  EFI_ABORTED and then Token.Event will be signaled. If the token is not in one of the queues,\r
+  which usually means that the asynchronous operation has completed, this function will not signal the\r
+  token and EFI_NOT_FOUND is returned.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+  @param[in]   Token            Pointer to a token that has been issued by EFI_UDP6_PROTOCOL.Transmit()\r
+                                or EFI_UDP6_PROTOCOL.Receive().If NULL, all pending tokens are aborted.\r
+\r
+  @retval EFI_SUCCESS           The asynchronous I/O request was aborted and Token.Event was signaled.\r
+                                When Token is NULL, all pending requests are aborted and their events\r
+                                are signaled.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_STARTED       This instance has not been started.\r
+  @retval EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was not found in\r
+                                the transmit or receive queue. It has either completed or was not issued\r
+                                by Transmit() and Receive().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_CANCEL)(\r
+  IN EFI_UDP6_PROTOCOL          *This,\r
+  IN EFI_UDP6_COMPLETION_TOKEN  *Token OPTIONAL\r
+);\r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  The Poll() function can be used by network drivers and applications to increase the rate that data\r
+  packets are moved between the communications device and the transmit and receive queues.\r
+  In some systems, the periodic timer event in the managed network driver may not poll the underlying\r
+  communications device fast enough to transmit and/or receive all data packets without missing incoming\r
+  packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should\r
+  try calling the Poll() function more often.\r
+\r
+  @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. \r
+  @retval EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+                                Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP6_POLL)(\r
+  IN EFI_UDP6_PROTOCOL  *This\r
+);\r
+\r
+///\r
+/// The EFI_UDP6_PROTOCOL defines an EFI UDPv6 Protocol session that can be used by any network drivers,\r
+/// applications, or daemons to transmit or receive UDP packets. This protocol instance can either be\r
+/// bound to a specified port as a service or connected to some remote peer as an active client.\r
+/// Each instance has its own settings, such as group table, that are independent from each other.\r
+/// \r
+struct _EFI_UDP6_PROTOCOL {\r
+  EFI_UDP6_GET_MODE_DATA  GetModeData;\r
+  EFI_UDP6_CONFIGURE      Configure;\r
+  EFI_UDP6_GROUPS         Groups;\r
+  EFI_UDP6_TRANSMIT       Transmit;\r
+  EFI_UDP6_RECEIVE        Receive;\r
+  EFI_UDP6_CANCEL         Cancel;\r
+  EFI_UDP6_POLL           Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiUdp6ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiUdp6ProtocolGuid;\r
+extern EFI_GUID gEfiUdp6RegistryDataGuid;\r
+\r
+#endif\r