]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Update the UdpIo to a combined UdpIo to support both v4 and v6 stack.
authortye <tye@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 30 Oct 2009 05:11:38 +0000 (05:11 +0000)
committertye <tye@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 30 Oct 2009 05:11:38 +0000 (05:11 +0000)
2. Update Dhcp4 and Mtftp4 driver to adopt the combined UdpIo.
3. Clean up coding style problems in combined IpIoLib/NetLib. Update Tcp4 and Udp4 to adopt the changes.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9382 6f19259b-4bc3-4df7-8a09-765794883524

24 files changed:
MdeModulePkg/Include/Library/IpIoLib.h
MdeModulePkg/Include/Library/NetLib.h
MdeModulePkg/Include/Library/UdpIoLib.h
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.h
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.h
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Func.h
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c

index 2f6f1e8f53900679b596c629ab808d56ae0b22dd..14f6884d1530cd145c66f3fcb08def14b9f9adf4 100644 (file)
@@ -81,41 +81,36 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 extern EFI_IP4_CONFIG_DATA  mIp4IoDefaultIpConfigData;\r
 extern EFI_IP6_CONFIG_DATA  mIp6IoDefaultIpConfigData;\r
 \r
-typedef enum {\r
-  IP_VERSION_4 = 4,\r
-  IP_VERSION_6 = 6\r
-} IP_VERSION;\r
+#define IP_VERSION_4 4\r
+#define IP_VERSION_6 6\r
 \r
 ///\r
 /// This error will be delivered to the\r
 /// listening transportation layer protocol\r
 /// that consumes IpIO.\r
 ///\r
-typedef enum {\r
-  ICMP_ERR_UNREACH_NET      = 0,\r
-  ICMP_ERR_UNREACH_HOST,\r
-  ICMP_ERR_UNREACH_PROTOCOL,\r
-  ICMP_ERR_UNREACH_PORT,\r
-  ICMP_ERR_MSGSIZE,\r
-  ICMP_ERR_UNREACH_SRCFAIL,\r
-  ICMP_ERR_TIMXCEED_INTRANS,\r
-  ICMP_ERR_TIMXCEED_REASS,\r
-  ICMP_ERR_QUENCH,\r
-  ICMP_ERR_PARAMPROB\r
-} ICMP_ERROR;\r
-\r
-typedef enum {\r
-  ICMP6_ERR_UNREACH_NET      = 0,\r
-  ICMP6_ERR_UNREACH_HOST,\r
-  ICMP6_ERR_UNREACH_PROTOCOL,\r
-  ICMP6_ERR_UNREACH_PORT,\r
-  ICMP6_ERR_PACKAGE_TOOBIG,\r
-  ICMP6_ERR_TIMXCEED_HOPLIMIT,\r
-  ICMP6_ERR_TIMXCEED_REASS,\r
-  ICMP6_ERR_PARAMPROB_HEADER,\r
-  ICMP6_ERR_PARAMPROB_NEXHEADER,\r
-  ICMP6_ERR_PARAMPROB_IPV6OPTION\r
-} ICMP6_ERROR;\r
+\r
+#define  ICMP_ERR_UNREACH_NET           0\r
+#define  ICMP_ERR_UNREACH_HOST          1\r
+#define  ICMP_ERR_UNREACH_PROTOCOL      2\r
+#define  ICMP_ERR_UNREACH_PORT          3\r
+#define  ICMP_ERR_MSGSIZE               4\r
+#define  ICMP_ERR_UNREACH_SRCFAIL       5\r
+#define  ICMP_ERR_TIMXCEED_INTRANS      6\r
+#define  ICMP_ERR_TIMXCEED_REASS        7\r
+#define  ICMP_ERR_QUENCH                8\r
+#define  ICMP_ERR_PARAMPROB             9\r
+\r
+#define  ICMP6_ERR_UNREACH_NET          0\r
+#define  ICMP6_ERR_UNREACH_HOST         1\r
+#define  ICMP6_ERR_UNREACH_PROTOCOL     2\r
+#define  ICMP6_ERR_UNREACH_PORT         3\r
+#define  ICMP6_ERR_PACKAGE_TOOBIG       4\r
+#define  ICMP6_ERR_TIMXCEED_HOPLIMIT    5\r
+#define  ICMP6_ERR_TIMXCEED_REASS       6\r
+#define  ICMP6_ERR_PARAMPROB_HEADER     7\r
+#define  ICMP6_ERR_PARAMPROB_NEXHEADER  8\r
+#define  ICMP6_ERR_PARAMPROB_IPV6OPTION 9\r
 \r
 ///\r
 /// The helper struct for IpIoGetIcmpErrStatus(). It is for internal use only.\r
@@ -150,17 +145,24 @@ typedef union {
   EFI_IP6_CONFIG_DATA       Ip6CfgData;\r
 } IP_IO_IP_CONFIG_DATA;\r
 \r
+typedef union {\r
+  EFI_IP4_HEADER            *Ip4Hdr;\r
+  EFI_IP6_HEADER            *Ip6Hdr;\r
+} IP_IO_IP_HEADER;\r
+\r
+typedef union {\r
+  IP4_ADDR                  SubnetMask;\r
+  UINT8                     PrefixLength;\r
+} IP_IO_IP_MASK;\r
+\r
 ///\r
 /// The IP session for an IP receive packet.\r
 ///\r
 typedef struct _EFI_NET_SESSION_DATA {\r
   EFI_IP_ADDRESS        Source;     ///< Source IP of the received packet\r
   EFI_IP_ADDRESS        Dest;       ///< Destination IP of the received packet\r
-  union {\r
-    EFI_IP4_HEADER      *Ip4Hdr;    ///< IP4 header of the received packet\r
-    EFI_IP6_HEADER      *Ip6Hdr;    ///< IP6 header of the received packet\r
-  } IpHdr;\r
-  IP_VERSION            IpVersion;  ///< The IP version of the received packet\r
+  IP_IO_IP_HEADER       IpHdr;      ///< IP header of the received packet\r
+  UINT8                 IpVersion;  ///< The IP version of the received packet\r
 } EFI_NET_SESSION_DATA;\r
 \r
 /**\r
@@ -178,7 +180,7 @@ typedef
 VOID\r
 (*PKT_RCVD_NOTIFY) (\r
   IN EFI_STATUS           Status, \r
-  IN ICMP_ERROR           IcmpErr,\r
+  IN UINT8                IcmpErr,\r
   IN EFI_NET_SESSION_DATA *NetSession,\r
   IN NET_BUF              *Pkt,\r
   IN VOID                 *Context\r
@@ -249,10 +251,7 @@ typedef struct _IP_IO {
   VOID                          *SndContext;     ///< See IP_IO_OPEN_DATA::SndContext\r
   PKT_RCVD_NOTIFY               PktRcvdNotify;   ///< See IP_IO_OPEN_DATA::PktRcvdNotify\r
   PKT_SENT_NOTIFY               PktSentNotify;   ///< See IP_IO_OPEN_DATA::PktSentNotify\r
-  //\r
-  // Ip Version \r
-  //\r
-  IP_VERSION                    IpVersion;\r
+  UINT8                         IpVersion;\r
 } IP_IO;\r
 \r
 ///\r
@@ -289,16 +288,13 @@ typedef struct _IP_IO_SEND_ENTRY {
 ///\r
 typedef struct _IP_IO_IP_INFO {\r
   EFI_IP_ADDRESS            Addr;\r
-  union {\r
-   IP4_ADDR                 SubnetMask;\r
-   UINT8                    PrefixLength;\r
-  } PreMask;\r
+  IP_IO_IP_MASK             PreMask;\r
   LIST_ENTRY                Entry;\r
   EFI_HANDLE                ChildHandle;\r
   VOID                      *Ip;\r
   IP_IO_IP_COMPLETION_TOKEN DummyRcvToken;\r
   INTN                      RefCnt;\r
-  IP_VERSION                IpVersion;\r
+  UINT8                     IpVersion;\r
 } IP_IO_IP_INFO;\r
 \r
 /**\r
@@ -322,7 +318,7 @@ EFIAPI
 IpIoCreate (\r
   IN EFI_HANDLE Image,\r
   IN EFI_HANDLE Controller,\r
-  IN IP_VERSION IpVersion\r
+  IN UINT8      IpVersion\r
   );\r
 \r
 /**\r
@@ -518,7 +514,7 @@ IP_IO_IP_INFO *
 EFIAPI\r
 IpIoFindSender (\r
   IN OUT IP_IO           **IpIo,\r
-  IN     IP_VERSION      IpVersion,\r
+  IN     UINT8           IpVersion,\r
   IN     EFI_IP_ADDRESS  *Src\r
   );\r
 \r
@@ -541,8 +537,8 @@ IpIoFindSender (
 EFI_STATUS\r
 EFIAPI\r
 IpIoGetIcmpErrStatus (\r
-  IN  ICMP_ERROR  IcmpError,\r
-  IN  IP_VERSION  IpVersion,\r
+  IN  UINT8       IcmpError,\r
+  IN  UINT8       IpVersion,\r
   OUT BOOLEAN     *IsHard  OPTIONAL,\r
   OUT BOOLEAN     *Notify  OPTIONAL\r
   );\r
index 61102a788b750c048868e09c22bb83a13ea6a61d..1a0507b9e6f939a6d4b18c3b590e464f568309b7 100644 (file)
@@ -22,34 +22,33 @@ typedef UINT32          IP4_ADDR;
 typedef UINT32          TCP_SEQNO;\r
 typedef UINT16          TCP_PORTNO;\r
 \r
-typedef enum {\r
-  NET_ETHER_ADDR_LEN    = 6,\r
-  NET_IFTYPE_ETHERNET   = 0x01,\r
-\r
-  EFI_IP_PROTO_UDP      = 0x11,\r
-  EFI_IP_PROTO_TCP      = 0x06,\r
-  EFI_IP_PROTO_ICMP     = 0x01,\r
-\r
-  //\r
-  // The address classification\r
-  //\r
-  IP4_ADDR_CLASSA       = 1,\r
-  IP4_ADDR_CLASSB,\r
-  IP4_ADDR_CLASSC,\r
-  IP4_ADDR_CLASSD,\r
-  IP4_ADDR_CLASSE,\r
-\r
-  IP4_MASK_NUM          = 33\r
-} IP4_CLASS_TYPE;\r
-\r
-typedef enum {\r
-  IP6_HOP_BY_HOP        = 0,\r
-  IP6_DESTINATION       = 60,\r
-  IP6_FRAGMENT          = 44,\r
-  IP6_AH                = 51,\r
-  IP6_ESP               = 50,\r
-  IP6_NO_NEXT_HEADER    = 59\r
-} IP6_EXTENSION_HEADER_TYPE;\r
+\r
+#define  NET_ETHER_ADDR_LEN    6\r
+#define  NET_IFTYPE_ETHERNET   0x01\r
+\r
+#define  EFI_IP_PROTO_UDP      0x11\r
+#define  EFI_IP_PROTO_TCP      0x06\r
+#define  EFI_IP_PROTO_ICMP     0x01\r
+\r
+//\r
+// The address classification\r
+//\r
+#define  IP4_ADDR_CLASSA       1\r
+#define  IP4_ADDR_CLASSB       2\r
+#define  IP4_ADDR_CLASSC       3\r
+#define  IP4_ADDR_CLASSD       4\r
+#define  IP4_ADDR_CLASSE       5\r
+\r
+#define  IP4_MASK_NUM          33\r
+\r
+\r
+#define  IP6_HOP_BY_HOP        0\r
+#define  IP6_DESTINATION       60\r
+#define  IP6_FRAGMENT          44\r
+#define  IP6_AH                51\r
+#define  IP6_ESP               50\r
+#define  IP6_NO_NEXT_HEADER    59\r
+\r
 \r
 #pragma pack(1)\r
 \r
@@ -275,6 +274,23 @@ Ip6IsValidUnicast (
   IN EFI_IPv6_ADDRESS       *Ip6\r
   );\r
 \r
+/**\r
+  Switches the endianess of an IPv6 address\r
+\r
+  This function swaps the bytes in a 128-bit IPv6 address to switch the value\r
+  from little endian to big endian or vice versa. The byte swapped value is\r
+  returned.\r
+\r
+  @param  Ip6 Points to an IPv6 address\r
+\r
+  @return The byte swapped IPv6 address.\r
+\r
+**/\r
+EFI_IPv6_ADDRESS *\r
+Ip6Swap128 (\r
+  EFI_IPv6_ADDRESS *Ip6\r
+  );\r
+\r
 extern IP4_ADDR gIp4AllMasks[IP4_MASK_NUM];\r
 \r
 \r
@@ -886,20 +902,19 @@ NetLibDefaultUnload (
   IN EFI_HANDLE             ImageHandle\r
   );\r
 \r
-typedef enum {\r
-  //\r
-  //Various signatures\r
-  //\r
-  NET_BUF_SIGNATURE    = SIGNATURE_32 ('n', 'b', 'u', 'f'),\r
-  NET_VECTOR_SIGNATURE = SIGNATURE_32 ('n', 'v', 'e', 'c'),\r
-  NET_QUE_SIGNATURE    = SIGNATURE_32 ('n', 'b', 'q', 'u'),\r
+\r
+//\r
+//Various signatures\r
+//\r
+#define  NET_BUF_SIGNATURE    SIGNATURE_32 ('n', 'b', 'u', 'f')\r
+#define  NET_VECTOR_SIGNATURE SIGNATURE_32 ('n', 'v', 'e', 'c')\r
+#define  NET_QUE_SIGNATURE    SIGNATURE_32 ('n', 'b', 'q', 'u')\r
 \r
 \r
-  NET_PROTO_DATA       = 64,   // Opaque buffer for protocols\r
-  NET_BUF_HEAD         = 1,    // Trim or allocate space from head\r
-  NET_BUF_TAIL         = 0,    // Trim or allocate space from tail\r
-  NET_VECTOR_OWN_FIRST = 0x01  // We allocated the 1st block in the vector\r
-} NET_SIGNATURE_TYPE;\r
+#define  NET_PROTO_DATA       64   // Opaque buffer for protocols\r
+#define  NET_BUF_HEAD         1    // Trim or allocate space from head\r
+#define  NET_BUF_TAIL         0    // Trim or allocate space from tail\r
+#define  NET_VECTOR_OWN_FIRST 0x01  // We allocated the 1st block in the vector\r
 \r
 #define NET_CHECK_SIGNATURE(PData, SIGNATURE) \\r
   ASSERT (((PData) != NULL) && ((PData)->Signature == (SIGNATURE)))\r
index 30a46fab04859588c5b3c907932d153776c5e980..c93fb1208590754855ed1384a337c5af7f68c103 100644 (file)
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.\r
   It provides the helper routines to access UDP service. It is used by both DHCP and MTFTP.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\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<BR>\r
@@ -13,33 +13,36 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#ifndef _UDP4IO_H_\r
-#define _UDP4IO_H_\r
+#ifndef _UDP_IO_H_\r
+#define _UDP_IO_H_\r
 \r
 #include <Protocol/Udp4.h>\r
+#include <Protocol/Udp6.h>\r
 \r
 #include <Library/NetLib.h>\r
 \r
-typedef struct _UDP_IO_PORT UDP_IO_PORT;\r
+typedef struct _UDP_IO UDP_IO;\r
 \r
 ///\r
 /// Signatures used by UdpIo Library.\r
 ///\r
-typedef enum {\r
-  UDP_IO_RX_SIGNATURE = SIGNATURE_32 ('U', 'D', 'P', 'R'),\r
-  UDP_IO_TX_SIGNATURE = SIGNATURE_32 ('U', 'D', 'P', 'T'),\r
-  UDP_IO_SIGNATURE    = SIGNATURE_32 ('U', 'D', 'P', 'I')\r
-} UDP_IO_SIGNATURE_TYPE;\r
+\r
+#define UDP_IO_RX_SIGNATURE  SIGNATURE_32 ('U', 'D', 'P', 'R')\r
+#define UDP_IO_TX_SIGNATURE  SIGNATURE_32 ('U', 'D', 'P', 'T')\r
+#define UDP_IO_SIGNATURE     SIGNATURE_32 ('U', 'D', 'P', 'I')\r
+\r
+#define UDP_IO_UDP4_VERSION  4\r
+#define UDP_IO_UDP6_VERSION  6\r
 \r
 ///\r
-/// The Udp4 address pair.\r
+/// The UDP address pair.\r
 ///\r
 typedef struct {\r
-  IP4_ADDR                  LocalAddr;\r
+  EFI_IP_ADDRESS            LocalAddr;\r
   UINT16                    LocalPort;\r
-  IP4_ADDR                  RemoteAddr;\r
+  EFI_IP_ADDRESS            RemoteAddr;\r
   UINT16                    RemotePort;\r
-} UDP_POINTS;\r
+} UDP_END_POINT;\r
 \r
 /**\r
   Prototype called when receiving or sending packets to or from a UDP point.\r
@@ -50,7 +53,7 @@ typedef struct {
   provided to the callback as a reference.\r
   \r
   @param[in] Packet       Packet received or sent\r
-  @param[in] Points       The Udp4 address pair corresponds to the Udp4 IO\r
+  @param[in] EndPoint     The UDP address pair corresponds to the UDP IO\r
   @param[in] IoStatus     Packet receiving or sending status\r
   @param[in] Context      User-defined data when calling UdpIoRecvDatagram() or\r
                           UdpIoSendDatagram()\r
@@ -59,7 +62,7 @@ typedef
 VOID\r
 (*UDP_IO_CALLBACK) (\r
   IN NET_BUF                *Packet,\r
-  IN UDP_POINTS             *Points,\r
+  IN UDP_END_POINT          *EndPoint,\r
   IN EFI_STATUS             IoStatus,\r
   IN VOID                   *Context\r
   );\r
@@ -72,17 +75,24 @@ VOID
 /// time. HeadLen gives the length of the application's header. UDP_IO will\r
 /// make the application's header continuous before delivering up.\r
 ///\r
+typedef union {\r
+  EFI_UDP4_COMPLETION_TOKEN   Udp4;\r
+  EFI_UDP6_COMPLETION_TOKEN   Udp6;\r
+} UDP_COMPLETION_TOKEN;\r
+\r
 typedef struct {\r
-  UINT32                    Signature;\r
-  UDP_IO_PORT               *UdpIo;\r
+  UINT32                      Signature;\r
+  UDP_IO                      *UdpIo;\r
 \r
-  UDP_IO_CALLBACK           CallBack;\r
-  VOID                      *Context;\r
+  UDP_IO_CALLBACK             CallBack;\r
+  VOID                        *Context;\r
+  UINT32                      HeadLen;\r
 \r
-  UINT32                    HeadLen;\r
-  EFI_UDP4_COMPLETION_TOKEN UdpToken;\r
+  UDP_COMPLETION_TOKEN        Token;\r
 } UDP_RX_TOKEN;\r
 \r
+\r
+\r
 ///\r
 /// This structure is used internally by UdpIo Library.\r
 ///\r
@@ -90,32 +100,41 @@ typedef struct {
 /// the CallBack will be called. There can be several transmit requests. All transmit requests\r
 /// are linked in a list.\r
 ///\r
-typedef struct {\r
-  UINT32                    Signature;\r
-  LIST_ENTRY                Link;\r
-  UDP_IO_PORT               *UdpIo;\r
 \r
-  UDP_IO_CALLBACK           CallBack;\r
-  NET_BUF                   *Packet;\r
-  VOID                      *Context;\r
+typedef union {\r
+  EFI_UDP4_SESSION_DATA       Udp4;\r
+  EFI_UDP6_SESSION_DATA       Udp6;\r
+} UDP_SESSION_DATA;\r
 \r
-  EFI_UDP4_SESSION_DATA     UdpSession;\r
-  EFI_IPv4_ADDRESS          Gateway;\r
+typedef union {\r
+  EFI_UDP4_TRANSMIT_DATA      Udp4;\r
+  EFI_UDP6_TRANSMIT_DATA      Udp6;\r
+} UDP_TRANSMIT_DATA;\r
 \r
-  EFI_UDP4_COMPLETION_TOKEN UdpToken;\r
-  EFI_UDP4_TRANSMIT_DATA    UdpTxData;\r
+typedef struct {\r
+  UINT32                      Signature;\r
+  LIST_ENTRY                  Link;\r
+  UDP_IO                      *UdpIo;\r
+  UDP_IO_CALLBACK             CallBack;\r
+  NET_BUF                     *Packet;\r
+  VOID                        *Context;\r
+  EFI_IPv4_ADDRESS            Gateway;\r
+  UDP_SESSION_DATA            Session;\r
+  UDP_COMPLETION_TOKEN        Token;\r
+  UDP_TRANSMIT_DATA           Data;\r
 } UDP_TX_TOKEN;\r
 \r
 ///\r
-/// Type defined as UDP_IO_PORT.\r
+/// Type defined as UDP_IO.\r
 ///\r
-/// This data structure wraps the Udp4 instance and configuration. \r
-/// UdpIo Library uses this structure for all Udp4 operations.\r
+/// This data structure wraps the UDP instance and configuration. \r
+/// UdpIo Library uses this structure for all Udp4 or Udp6 operations.\r
 ///\r
-struct _UDP_IO_PORT {\r
+struct _UDP_IO {\r
   UINT32                    Signature;\r
   LIST_ENTRY                Link;\r
   INTN                      RefCnt;\r
+  UINT8                     UdpVersion;\r
 \r
   //\r
   // Handle used to create/destory UDP child\r
@@ -124,30 +143,38 @@ struct _UDP_IO_PORT {
   EFI_HANDLE                Image;\r
   EFI_HANDLE                UdpHandle;\r
 \r
-  EFI_UDP4_PROTOCOL         *Udp;           ///< The wrapped Udp4 instance.\r
-  EFI_UDP4_CONFIG_DATA      UdpConfig;\r
   EFI_SIMPLE_NETWORK_MODE   SnpMode;\r
 \r
   LIST_ENTRY                SentDatagram;   ///< A list of UDP_TX_TOKEN.\r
   UDP_RX_TOKEN              *RecvRequest;\r
+\r
+  union {\r
+    EFI_UDP4_PROTOCOL       *Udp4;\r
+    EFI_UDP6_PROTOCOL       *Udp6;\r
+  } Protocol;  \r
+\r
+  union {\r
+    EFI_UDP4_CONFIG_DATA    Udp4;\r
+    EFI_UDP6_CONFIG_DATA    Udp6;\r
+  } Config;\r
 };\r
 \r
 /**\r
-  Prototype called when UdpIo Library configures a Udp4 instance.\r
+  Prototype called when UdpIo Library configures a UDP instance.\r
   \r
-  The prototype is set and called when creating a UDP_IO_PORT in UdpIoCreatePort().\r
+  The prototype is set and called when creating a UDP_IO in UdpIoCreatePort().\r
   \r
-  @param[in] UdpIo         The UDP_IO_PORT to configure\r
+  @param[in] UdpIo         The UDP_IO to configure\r
   @param[in] Context       User-defined data when calling UdpIoCreatePort()\r
   \r
   @retval EFI_SUCCESS  The configuration succeeded\r
-  @retval Others       The UDP_IO_PORT fails to configure indicating\r
+  @retval Others       The UDP_IO fails to configure indicating\r
                        UdpIoCreatePort() should fail\r
 **/\r
 typedef\r
 EFI_STATUS\r
 (*UDP_IO_CONFIG) (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN VOID                   *Context\r
   );\r
 \r
@@ -172,7 +199,7 @@ BOOLEAN
   Cancel all sent datagrams selected by the parameter ToCancel.\r
   If ToCancel is NULL, all the datagrams are cancelled.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to cancel packet.\r
+  @param[in]  UdpIo                 The UDP_IO to cancel packet.\r
   @param[in]  IoStatus              The IoStatus to return to the packet owners.\r
   @param[in]  ToCancel              Sets the criteria for canceling a packet. \r
   @param[in]  Context               The opaque parameter to the ToCancel.\r
@@ -181,14 +208,14 @@ BOOLEAN
 VOID\r
 EFIAPI\r
 UdpIoCancelDgrams (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN EFI_STATUS             IoStatus,\r
-  IN UDP_IO_TO_CANCEL       ToCancel,        OPTIONAL\r
+  IN UDP_IO_TO_CANCEL       ToCancel OPTIONAL,\r
   IN VOID                   *Context\r
   );\r
 \r
 /**\r
-  Creates a UDP_IO_PORT to access the UDP service. It creates and configures\r
+  Creates a UDP_IO to access the UDP service. It creates and configures\r
   a UDP child.\r
   \r
   This function:\r
@@ -199,65 +226,67 @@ UdpIoCancelDgrams (
 \r
   @param[in]  Controller            The controller that has the UDP service binding.\r
                                     protocol installed.\r
-  @param[in]  Image                 The image handle for the driver.\r
+  @param[in]  ImageHandle           The image handle for the driver.\r
   @param[in]  Configure             The function to configure the created UDP child.\r
+  @param[in]  UdpVersion            The UDP protocol version, UDP4 or UDP6.\r
   @param[in]  Context               The opaque parameter for the Configure funtion.\r
 \r
-  @return Newly-created UDP_IO_PORT or NULL if failed.\r
+  @return Newly-created UDP_IO or NULL if failed.\r
 \r
 **/\r
-UDP_IO_PORT *\r
+UDP_IO *\r
 EFIAPI\r
-UdpIoCreatePort (\r
+UdpIoCreateIo (\r
   IN  EFI_HANDLE            Controller,\r
-  IN  EFI_HANDLE            Image,\r
+  IN  EFI_HANDLE            ImageHandle,\r
   IN  UDP_IO_CONFIG         Configure,\r
+  IN  UINT8                 UdpVersion,\r
   IN  VOID                  *Context\r
   );\r
 \r
 /**\r
-  Free the UDP_IO_PORT and all its related resources.\r
+  Free the UDP_IO and all its related resources.\r
   \r
   The function cancels all sent datagrams and receive requests.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to free.\r
+  @param[in]  UdpIo             The UDP_IO to free.\r
 \r
-  @retval EFI_SUCCESS           The UDP_IO_PORT is freed.\r
+  @retval EFI_SUCCESS           The UDP_IO is freed.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-UdpIoFreePort (\r
-  IN  UDP_IO_PORT           *UdpIo\r
+UdpIoFreeIo (\r
+  IN  UDP_IO                *UdpIo\r
   );\r
 \r
 /**\r
-  Cleans up the UDP_IO_PORT without freeing it. Call this function \r
-  if you intend to later re-use the UDP_IO_PORT.\r
+  Cleans up the UDP_IO without freeing it. Call this function \r
+  if you intend to later re-use the UDP_IO.\r
   \r
   This function releases all transmitted datagrams and receive requests and configures NULL for the UDP instance.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to clean up.\r
+  @param[in]  UdpIo                 The UDP_IO to clean up.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-UdpIoCleanPort (\r
-  IN  UDP_IO_PORT           *UdpIo\r
+UdpIoCleanIo (\r
+  IN  UDP_IO                *UdpIo\r
   );\r
 \r
 /**\r
-  Sends a packet through the UDP_IO_PORT.\r
+  Send a packet through the UDP_IO.\r
   \r
-  The packet will be wrapped in UDP_TX_TOKEN. The function specific in the CallBack parameter will be called\r
-  when the packet is sent. If specified, the optional parameter EndPoint overrides the default\r
-  address pair.\r
+  The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called\r
+  when the packet is sent. The optional parameter EndPoint overrides the default\r
+  address pair if specified.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to send the packet through.\r
+  @param[in]  UdpIo                 The UDP_IO to send the packet through.\r
   @param[in]  Packet                The packet to send.\r
-  @param[in]  EndPoint              The local and remote access point. Overrides the\r
+  @param[in]  EndPoint              The local and remote access point. Override the\r
                                     default address pair set during configuration.\r
-  @param[in]  Gateway               The gateway to use.\r
+  @param[in]  Gateway               The gateway to use.  \r
   @param[in]  CallBack              The function being called when packet is\r
                                     transmitted or failed.\r
   @param[in]  Context               The opaque parameter passed to CallBack.\r
@@ -270,10 +299,10 @@ UdpIoCleanPort (
 EFI_STATUS\r
 EFIAPI\r
 UdpIoSendDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  NET_BUF               *Packet,\r
-  IN  UDP_POINTS            *EndPoint, OPTIONAL\r
-  IN  IP4_ADDR              Gateway,\r
+  IN  UDP_END_POINT         *EndPoint OPTIONAL,\r
+  IN  EFI_IP_ADDRESS        *Gateway  OPTIONAL,\r
   IN  UDP_IO_CALLBACK       CallBack,\r
   IN  VOID                  *Context\r
   );\r
@@ -281,43 +310,46 @@ UdpIoSendDatagram (
 /**\r
   Cancel a single sent datagram.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT from which to cancel the packet \r
+  @param[in]  UdpIo                 The UDP_IO from which to cancel the packet \r
   @param[in]  Packet                The packet to cancel\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 UdpIoCancelSentDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  NET_BUF               *Packet\r
   );\r
 \r
 /**\r
-  Issue a receive request to the UDP_IO_PORT.\r
+  Issue a receive request to the UDP_IO.\r
   \r
   This function is called when upper-layer needs packet from UDP for processing.\r
   Only one receive request is acceptable at a time. Therefore, one common usage model is\r
   to invoke this function inside its Callback function when the former packet\r
   is processed.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to receive the packet from.\r
+  @param[in]  UdpIo                 The UDP_IO to receive the packet from.\r
   @param[in]  CallBack              The call back function to execute when the packet\r
                                     is received.\r
   @param[in]  Context               The opaque context passed to Callback.\r
-  @param[in] HeadLen                The length of the upper-layer's protocol header.\r
+  @param[in]  HeadLen               The length of the upper-layer's protocol header.\r
 \r
   @retval EFI_ALREADY_STARTED   There is already a pending receive request. Only\r
                                 one receive request is supported at a time.\r
   @retval EFI_OUT_OF_RESOURCES  Failed to allocate needed resources.\r
   @retval EFI_SUCCESS           The receive request is issued successfully.\r
+  @retval EFI_UNSUPPORTED       The UDP version in UDP_IO is not supported.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UdpIoRecvDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  UDP_IO_CALLBACK       CallBack,\r
   IN  VOID                  *Context,\r
   IN  UINT32                HeadLen\r
   );\r
+\r
 #endif\r
+\r
index 5aaef6d743f55e1117587622f96187a008ce8f3d..032545b32baed319c1e1b1313926e63be3d67b0e 100644 (file)
@@ -136,7 +136,7 @@ IpIoCreateIpChildOpenProtocol (
   IN  EFI_HANDLE  ControllerHandle,\r
   IN  EFI_HANDLE  ImageHandle,\r
   IN  EFI_HANDLE  *ChildHandle,\r
-  IN  IP_VERSION  IpVersion,  \r
+  IN  UINT8       IpVersion,\r
   OUT VOID        **Interface\r
   )\r
 {\r
@@ -213,7 +213,7 @@ IpIoCloseProtocolDestroyIpChild (
   IN EFI_HANDLE  ControllerHandle,\r
   IN EFI_HANDLE  ImageHandle,\r
   IN EFI_HANDLE  ChildHandle,\r
-  IN IP_VERSION  IpVersion\r
+  IN UINT8       IpVersion\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -274,7 +274,7 @@ IpIoIcmpv4Handler (
 {\r
   IP4_ICMP_ERROR_HEAD  *IcmpHdr;\r
   EFI_IP4_HEADER       *IpHdr;\r
-  ICMP_ERROR           IcmpErr;\r
+  UINT8                IcmpErr;\r
   UINT8                *PayLoadHdr;\r
   UINT8                Type;\r
   UINT8                Code;\r
@@ -307,7 +307,7 @@ IpIoIcmpv4Handler (
     case ICMP_CODE_UNREACH_PROTOCOL:\r
     case ICMP_CODE_UNREACH_PORT:\r
     case ICMP_CODE_UNREACH_SRCFAIL:\r
-      IcmpErr = (ICMP_ERROR) (ICMP_ERR_UNREACH_NET + Code);\r
+      IcmpErr = (UINT8) (ICMP_ERR_UNREACH_NET + Code);\r
 \r
       break;\r
 \r
@@ -342,7 +342,7 @@ IpIoIcmpv4Handler (
       return EFI_ABORTED;\r
     }\r
 \r
-    IcmpErr = (ICMP_ERROR) (Code + ICMP_ERR_TIMXCEED_INTRANS);\r
+    IcmpErr = (UINT8) (Code + ICMP_ERR_TIMXCEED_INTRANS);\r
 \r
     break;\r
 \r
@@ -403,7 +403,7 @@ IpIoIcmpv6Handler (
 {\r
   IP6_ICMP_ERROR_HEAD  *IcmpHdr;\r
   EFI_IP6_HEADER       *IpHdr;\r
-  ICMP6_ERROR          IcmpErr;\r
+  UINT8                IcmpErr;\r
   UINT8                *PayLoadHdr;\r
   UINT8                Type;\r
   UINT8                Code;\r
@@ -470,7 +470,7 @@ IpIoIcmpv6Handler (
       return EFI_ABORTED;\r
     }\r
 \r
-    IcmpErr = (ICMP6_ERROR) (ICMP6_ERR_TIMXCEED_HOPLIMIT + Code);\r
+    IcmpErr = (UINT8) (ICMP6_ERR_TIMXCEED_HOPLIMIT + Code);\r
 \r
     break;\r
 \r
@@ -479,7 +479,7 @@ IpIoIcmpv6Handler (
       return EFI_ABORTED;\r
     }\r
 \r
-    IcmpErr = (ICMP6_ERROR) (ICMP6_ERR_PARAMPROB_HEADER + Code);\r
+    IcmpErr = (UINT8) (ICMP6_ERR_PARAMPROB_HEADER + Code);\r
 \r
     break;\r
 \r
@@ -538,7 +538,7 @@ IpIoIcmpv6Handler (
   \r
   NetbufTrim (Pkt, TrimBytes, TRUE);\r
 \r
-  IpIo->PktRcvdNotify (EFI_ICMP_ERROR, (ICMP_ERROR) IcmpErr, Session, Pkt, IpIo->RcvdContext);\r
+  IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, IpIo->RcvdContext);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -1098,7 +1098,7 @@ IpIoListenHandlerDpc (
 \r
   if (EFI_SUCCESS == Status) {\r
 \r
-    IpIo->PktRcvdNotify (EFI_SUCCESS, (ICMP_ERROR) 0, &Session, Pkt, IpIo->RcvdContext);\r
+    IpIo->PktRcvdNotify (EFI_SUCCESS, 0, &Session, Pkt, IpIo->RcvdContext);\r
   } else {\r
     //\r
     // Status is EFI_ICMP_ERROR\r
@@ -1170,7 +1170,7 @@ EFIAPI
 IpIoCreate (\r
   IN EFI_HANDLE Image,\r
   IN EFI_HANDLE Controller,\r
-  IN IP_VERSION IpVersion  \r
+  IN UINT8      IpVersion\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -1264,7 +1264,7 @@ IpIoOpen (
 {\r
   EFI_STATUS        Status;\r
   VOID              *Ip;\r
-  IP_VERSION        IpVersion;\r
+  UINT8             IpVersion;\r
 \r
   if (IpIo->IsConfigured) {\r
     return EFI_ACCESS_DENIED;\r
@@ -1379,7 +1379,7 @@ IpIoStop (
   EFI_STATUS        Status;\r
   VOID              *Ip;\r
   IP_IO_IP_INFO     *IpInfo;\r
-  IP_VERSION        IpVersion;\r
+  UINT8             IpVersion;\r
 \r
   if (!IpIo->IsConfigured) {\r
     return EFI_SUCCESS;\r
@@ -1728,7 +1728,7 @@ IpIoConfigIp (
 {\r
   EFI_STATUS         Status;\r
   VOID               *Ip;\r
-  IP_VERSION         IpVersion;\r
+  UINT8              IpVersion;\r
   EFI_IP4_MODE_DATA  Ip4ModeData;\r
   EFI_IP6_MODE_DATA  Ip6ModeData;\r
 \r
@@ -1885,7 +1885,7 @@ IpIoRemoveIp (
   )\r
 {\r
 \r
-  IP_VERSION          IpVersion;\r
+  UINT8               IpVersion;\r
 \r
   ASSERT (IpInfo->RefCnt > 0);\r
 \r
@@ -1957,7 +1957,7 @@ IP_IO_IP_INFO *
 EFIAPI\r
 IpIoFindSender (\r
   IN OUT IP_IO           **IpIo,\r
-  IN     IP_VERSION      IpVersion,\r
+  IN     UINT8           IpVersion,\r
   IN     EFI_IP_ADDRESS  *Src\r
   )\r
 {\r
@@ -2021,14 +2021,14 @@ IpIoFindSender (
 EFI_STATUS\r
 EFIAPI\r
 IpIoGetIcmpErrStatus (\r
-  IN  ICMP_ERROR  IcmpError,\r
-  IN  IP_VERSION  IpVersion,\r
+  IN  UINT8       IcmpError,\r
+  IN  UINT8       IpVersion,\r
   OUT BOOLEAN     *IsHard  OPTIONAL,\r
   OUT BOOLEAN     *Notify  OPTIONAL\r
   )\r
 {\r
   if (IpVersion == IP_VERSION_4 ) {\r
-    ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB));\r
+    ASSERT (IcmpError <= ICMP_ERR_PARAMPROB);\r
 \r
     if (IsHard != NULL) {\r
       *IsHard = mIcmpErrMap[IcmpError].IsHard;\r
@@ -2066,7 +2066,7 @@ IpIoGetIcmpErrStatus (
 \r
   } else if (IpVersion == IP_VERSION_6) {\r
 \r
-    ASSERT ((IcmpError >= ICMP6_ERR_UNREACH_NET) && (IcmpError <= ICMP6_ERR_PARAMPROB_IPV6OPTION));\r
+    ASSERT (IcmpError <= ICMP6_ERR_PARAMPROB_IPV6OPTION);\r
 \r
     if (IsHard != NULL) {\r
       *IsHard = mIcmp6ErrMap[IcmpError].IsHard;\r
index 4c7414acfb0a32d31ac35156096bfcd54c1f528d..fb296e5f595d20f65698dcfc08a08ef5d1a5df6d 100644 (file)
@@ -222,28 +222,60 @@ Ip6IsValidUnicast (
   IN EFI_IPv6_ADDRESS       *Ip6\r
   ) \r
 {\r
-  UINT8 t;\r
-  UINT8 i;\r
+  UINT8 Byte;\r
+  UINT8 Index;\r
   \r
   if (Ip6->Addr[0] == 0xFF) {\r
     return FALSE;\r
   }\r
 \r
-  for (i = 0; i < 15; i++) {\r
-    if (Ip6->Addr[i] != 0) {\r
+  for (Index = 0; Index < 15; Index++) {\r
+    if (Ip6->Addr[Index] != 0) {\r
       return TRUE;\r
     }\r
   }\r
 \r
-  t = Ip6->Addr[i];\r
+  Byte = Ip6->Addr[Index];\r
 \r
-  if (t == 0x0 || t == 0x1) {\r
+  if (Byte == 0x0 || Byte == 0x1) {\r
     return FALSE;\r
   }\r
 \r
   return TRUE;  \r
 }\r
 \r
+/**\r
+  Switches the endianess of an IPv6 address\r
+\r
+  This function swaps the bytes in a 128-bit IPv6 address to switch the value\r
+  from little endian to big endian or vice versa. The byte swapped value is\r
+  returned.\r
+\r
+  @param  Ip6 Points to an IPv6 address\r
+\r
+  @return The byte swapped IPv6 address.\r
+\r
+**/\r
+EFI_IPv6_ADDRESS *\r
+Ip6Swap128 (\r
+  EFI_IPv6_ADDRESS *Ip6\r
+  )\r
+{\r
+  UINT64 High;\r
+  UINT64 Low;\r
+\r
+  CopyMem (&High, Ip6, sizeof (UINT64));\r
+  CopyMem (&Low, &Ip6->Addr[8], sizeof (UINT64));\r
+\r
+  High = SwapBytes64 (High);\r
+  Low  = SwapBytes64 (Low);\r
+\r
+  CopyMem (Ip6, &Low, sizeof (UINT64));\r
+  CopyMem (&Ip6->Addr[8], &High, sizeof (UINT64));\r
+\r
+  return Ip6;\r
+}\r
+\r
 /**\r
   Initialize a random seed using current time.\r
   \r
index 91e211a9bdca379fa36d6719918c08da6fa5616a..bb85aebc282a13f76bb603ded45eea784fa5b083 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Help functions to access UDP service, it is used by both the DHCP and MTFTP.\r
   \r
-Copyright (c) 2005 - 2007, Intel Corporation.<BR>\r
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>\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<BR>\r
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Uefi.h>\r
 \r
 #include <Protocol/Udp4.h>\r
+#include <Protocol/Udp6.h>\r
 \r
 #include <Library/UdpIoLib.h>\r
 #include <Library/BaseLib.h>\r
@@ -27,31 +28,46 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\r
   Free a UDP_TX_TOKEN. The TX event is closed.\r
 \r
-  @param[in]  Token                 The UDP_TX_TOKEN to release.\r
+  @param[in]  TxToken                 The UDP_TX_TOKEN to release.\r
 \r
 **/\r
 VOID\r
 UdpIoFreeTxToken (\r
-  IN UDP_TX_TOKEN           *Token\r
+  IN UDP_TX_TOKEN           *TxToken\r
   )\r
 {\r
-  gBS->CloseEvent (Token->UdpToken.Event);\r
-  gBS->FreePool (Token);\r
+\r
+  if (TxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    gBS->CloseEvent (TxToken->Token.Udp4.Event);\r
+  } else if (TxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION) {\r
+    gBS->CloseEvent (TxToken->Token.Udp6.Event);\r
+  } else {\r
+    ASSERT (FALSE);\r
+  }\r
+  \r
+  FreePool (TxToken);\r
 }\r
 \r
 /**\r
   Free a UDP_RX_TOKEN. The RX event is closed.\r
 \r
-  @param[in]  Token                 The UDP_RX_TOKEN to release.\r
+  @param[in]  RxToken                 The UDP_RX_TOKEN to release.\r
 \r
 **/\r
 VOID\r
 UdpIoFreeRxToken (\r
-  IN UDP_RX_TOKEN           *Token\r
+  IN UDP_RX_TOKEN           *RxToken\r
   )\r
 {\r
-  gBS->CloseEvent (Token->UdpToken.Event);\r
-  gBS->FreePool (Token);\r
+  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    gBS->CloseEvent (RxToken->Token.Udp4.Event);\r
+  } else if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION) {\r
+    gBS->CloseEvent (RxToken->Token.Udp6.Event);\r
+  } else {\r
+    ASSERT (FALSE);\r
+  }  \r
+\r
+  FreePool (RxToken);\r
 }\r
 \r
 /**\r
@@ -69,15 +85,22 @@ UdpIoOnDgramSentDpc (
   IN VOID                   *Context\r
   )\r
 {\r
-  UDP_TX_TOKEN              *Token;\r
+  UDP_TX_TOKEN              *TxToken;\r
 \r
-  Token   = (UDP_TX_TOKEN *) Context;\r
-  ASSERT (Token->Signature == UDP_IO_TX_SIGNATURE);\r
+  TxToken = (UDP_TX_TOKEN *) Context;\r
+  ASSERT (TxToken->Signature == UDP_IO_TX_SIGNATURE);\r
+  ASSERT ((TxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (TxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
+  \r
+  RemoveEntryList (&TxToken->Link);\r
 \r
-  RemoveEntryList (&Token->Link);\r
-  Token->CallBack (Token->Packet, NULL, Token->UdpToken.Status, Token->Context);\r
+  if (TxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    TxToken->CallBack (TxToken->Packet, NULL, TxToken->Token.Udp4.Status, TxToken->Context);\r
+  } else {\r
+    TxToken->CallBack (TxToken->Packet, NULL, TxToken->Token.Udp6.Status, TxToken->Context);\r
+  }\r
 \r
-  UdpIoFreeTxToken (Token);\r
+  UdpIoFreeTxToken (TxToken);\r
 }\r
 \r
 /**\r
@@ -110,12 +133,20 @@ VOID
 UdpIoRecycleDgram (\r
   IN VOID                   *Context\r
   )\r
-{\r
-  UDP_RX_TOKEN              *Token;\r
+{ \r
+  UDP_RX_TOKEN              *RxToken;\r
+\r
+  RxToken = (UDP_RX_TOKEN *) Context;\r
+\r
+  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    gBS->SignalEvent (RxToken->Token.Udp4.Packet.RxData->RecycleSignal);\r
+  } else if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION) {\r
+    gBS->SignalEvent (RxToken->Token.Udp6.Packet.RxData->RecycleSignal);\r
+  } else {\r
+    ASSERT (FALSE);\r
+  }\r
 \r
-  Token = (UDP_RX_TOKEN *) Context;\r
-  gBS->SignalEvent (Token->UdpToken.Packet.RxData->RecycleSignal);\r
-  UdpIoFreeRxToken (Token);\r
+  UdpIoFreeRxToken (RxToken);\r
 }\r
 \r
 /**\r
@@ -133,69 +164,132 @@ UdpIoOnDgramRcvdDpc (
   IN VOID                   *Context\r
   )\r
 {\r
-  EFI_UDP4_COMPLETION_TOKEN *UdpToken;\r
-  EFI_UDP4_RECEIVE_DATA     *UdpRxData;\r
-  EFI_UDP4_SESSION_DATA     *UdpSession;\r
-  UDP_RX_TOKEN              *Token;\r
-  UDP_POINTS                Points;\r
+  EFI_STATUS                Status;\r
+  VOID                      *Token;\r
+  VOID                      *RxData;\r
+  VOID                      *Session;\r
+  UDP_RX_TOKEN              *RxToken;\r
+  UDP_END_POINT             EndPoint;\r
   NET_BUF                   *Netbuf;\r
 \r
-  Token   = (UDP_RX_TOKEN *) Context;\r
+  RxToken = (UDP_RX_TOKEN *) Context;\r
 \r
-  ASSERT ((Token->Signature == UDP_IO_RX_SIGNATURE) &&\r
-          (Token == Token->UdpIo->RecvRequest));\r
+  ZeroMem (&EndPoint, sizeof(UDP_END_POINT));\r
+\r
+  ASSERT ((RxToken->Signature == UDP_IO_RX_SIGNATURE) && \r
+          (RxToken == RxToken->UdpIo->RecvRequest));\r
+\r
+  ASSERT ((RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (RxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
   //\r
   // Clear the receive request first in case that the caller\r
   // wants to restart the receive in the callback.\r
   //\r
-  Token->UdpIo->RecvRequest = NULL;\r
-\r
-  UdpToken  = &Token->UdpToken;\r
-  UdpRxData = UdpToken->Packet.RxData;\r
+  RxToken->UdpIo->RecvRequest = NULL;\r
+\r
+  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    Token  = &RxToken->Token.Udp4;\r
+    RxData = ((EFI_UDP4_COMPLETION_TOKEN *) Token)->Packet.RxData;\r
+    Status = ((EFI_UDP4_COMPLETION_TOKEN *) Token)->Status;\r
+  } else {\r
+    Token  = &RxToken->Token.Udp6;\r
+    RxData = ((EFI_UDP6_COMPLETION_TOKEN *) Token)->Packet.RxData;\r
+    Status = ((EFI_UDP6_COMPLETION_TOKEN *) Token)->Status;\r
+  }\r
 \r
-  if (EFI_ERROR (UdpToken->Status) || (UdpRxData == NULL)) {\r
-    if (UdpToken->Status != EFI_ABORTED) {\r
+  if (EFI_ERROR (Status) || RxData == NULL) {\r
+    if (Status != EFI_ABORTED) {\r
       //\r
       // Invoke the CallBack only if the reception is not actively aborted.\r
       //\r
-      Token->CallBack (NULL, NULL, UdpToken->Status, Token->Context);\r
+      RxToken->CallBack (NULL, NULL, Status, RxToken->Context);\r
     }\r
 \r
-    UdpIoFreeRxToken (Token);\r
+    UdpIoFreeRxToken (RxToken);\r
     return;\r
   }\r
 \r
   //\r
   // Build a NET_BUF from the UDP receive data, then deliver it up.\r
   //\r
-  Netbuf = NetbufFromExt (\r
-             (NET_FRAGMENT *) UdpRxData->FragmentTable,\r
-             UdpRxData->FragmentCount,\r
-             0,\r
-             (UINT32) Token->HeadLen,\r
-             UdpIoRecycleDgram,\r
-             Token\r
-             );\r
-\r
-  if (Netbuf == NULL) {\r
-    gBS->SignalEvent (UdpRxData->RecycleSignal);\r
-    Token->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, Token->Context);\r
-\r
-    UdpIoFreeRxToken (Token);\r
-    return;\r
-  }\r
-\r
-  UdpSession        = &UdpRxData->UdpSession;\r
-  Points.LocalPort  = UdpSession->DestinationPort;\r
-  Points.RemotePort = UdpSession->SourcePort;\r
+  if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    \r
+    Netbuf = NetbufFromExt (\r
+               (NET_FRAGMENT *)((EFI_UDP4_RECEIVE_DATA *) RxData)->FragmentTable,\r
+               ((EFI_UDP4_RECEIVE_DATA *) RxData)->FragmentCount,\r
+               0,\r
+               (UINT32) RxToken->HeadLen,\r
+               UdpIoRecycleDgram,\r
+               RxToken\r
+               );\r
+\r
+    if (Netbuf == NULL) {\r
+      gBS->SignalEvent (((EFI_UDP4_RECEIVE_DATA *) RxData)->RecycleSignal);\r
+      RxToken->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, RxToken->Context);\r
+\r
+      UdpIoFreeRxToken (RxToken);\r
+      return;\r
+    }\r
 \r
-  CopyMem (&Points.LocalAddr, &UdpSession->DestinationAddress, sizeof (IP4_ADDR));\r
-  CopyMem (&Points.RemoteAddr, &UdpSession->SourceAddress, sizeof (IP4_ADDR));\r
-  Points.LocalAddr  = NTOHL (Points.LocalAddr);\r
-  Points.RemoteAddr = NTOHL (Points.RemoteAddr);\r
+    Session             = &((EFI_UDP4_RECEIVE_DATA *) RxData)->UdpSession;\r
+    EndPoint.LocalPort  = ((EFI_UDP4_SESSION_DATA *) Session)->DestinationPort;\r
+    EndPoint.RemotePort = ((EFI_UDP4_SESSION_DATA *) Session)->SourcePort;\r
+\r
+    CopyMem (\r
+      &EndPoint.LocalAddr,\r
+      &((EFI_UDP4_SESSION_DATA *) Session)->DestinationAddress,\r
+      sizeof (EFI_IPv4_ADDRESS)\r
+      );\r
+\r
+    CopyMem (\r
+      &EndPoint.RemoteAddr,\r
+      &((EFI_UDP4_SESSION_DATA *) Session)->SourceAddress,\r
+      sizeof (EFI_IPv4_ADDRESS)\r
+      );\r
+\r
+    EndPoint.LocalAddr.Addr[0]  = NTOHL (EndPoint.LocalAddr.Addr[0]);\r
+    EndPoint.RemoteAddr.Addr[0] = NTOHL (EndPoint.RemoteAddr.Addr[0]);\r
+  } else {\r
+  \r
+    Netbuf = NetbufFromExt (\r
+               (NET_FRAGMENT *)((EFI_UDP6_RECEIVE_DATA *) RxData)->FragmentTable,\r
+               ((EFI_UDP6_RECEIVE_DATA *) RxData)->FragmentCount,\r
+               0,\r
+               (UINT32) RxToken->HeadLen,\r
+               UdpIoRecycleDgram,\r
+               RxToken\r
+               );\r
+  \r
+    if (Netbuf == NULL) {\r
+      gBS->SignalEvent (((EFI_UDP6_RECEIVE_DATA *) RxData)->RecycleSignal);\r
+      RxToken->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, RxToken->Context);\r
+  \r
+      UdpIoFreeRxToken (RxToken);\r
+      return;\r
+    }\r
+  \r
+    Session             = &((EFI_UDP6_RECEIVE_DATA *) RxData)->UdpSession;\r
+    EndPoint.LocalPort  = ((EFI_UDP6_SESSION_DATA *) Session)->DestinationPort;\r
+    EndPoint.RemotePort = ((EFI_UDP6_SESSION_DATA *) Session)->SourcePort;\r
+  \r
+    CopyMem (\r
+      &EndPoint.LocalAddr,\r
+      &((EFI_UDP6_SESSION_DATA *) Session)->DestinationAddress,\r
+      sizeof (EFI_IPv6_ADDRESS)\r
+      );\r
+\r
+    CopyMem (\r
+      &EndPoint.RemoteAddr,\r
+      &((EFI_UDP6_SESSION_DATA *) Session)->SourceAddress,\r
+      sizeof (EFI_IPv6_ADDRESS)\r
+      );\r
+\r
+    Ip6Swap128 (&EndPoint.LocalAddr.v6);\r
+    Ip6Swap128 (&EndPoint.RemoteAddr.v6);\r
+  }\r
 \r
-  Token->CallBack (Netbuf, &Points, EFI_SUCCESS, Token->Context);\r
+  RxToken->CallBack (Netbuf, &EndPoint, EFI_SUCCESS, RxToken->Context);\r
 }\r
 \r
 /**\r
@@ -231,7 +325,7 @@ UdpIoOnDgramRcvd (
 **/\r
 UDP_RX_TOKEN *\r
 UdpIoCreateRxToken (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN UDP_IO_CALLBACK        CallBack,\r
   IN VOID                   *Context,\r
   IN UINT32                 HeadLen\r
@@ -240,6 +334,9 @@ UdpIoCreateRxToken (
   UDP_RX_TOKEN              *Token;\r
   EFI_STATUS                Status;\r
 \r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
+\r
   Token = AllocatePool (sizeof (UDP_RX_TOKEN));\r
 \r
   if (Token == NULL) {\r
@@ -252,19 +349,35 @@ UdpIoCreateRxToken (
   Token->Context                = Context;\r
   Token->HeadLen                = HeadLen;\r
 \r
-  Token->UdpToken.Status        = EFI_NOT_READY;\r
-  Token->UdpToken.Packet.RxData = NULL;\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+\r
+    Token->Token.Udp4.Status        = EFI_NOT_READY;\r
+    Token->Token.Udp4.Packet.RxData = NULL;\r
+\r
+    Status = gBS->CreateEvent (\r
+                    EVT_NOTIFY_SIGNAL,\r
+                    TPL_NOTIFY,\r
+                    UdpIoOnDgramRcvd,\r
+                    Token,\r
+                    &Token->Token.Udp4.Event\r
+                    );\r
+    } else {\r
+  \r
+    Token->Token.Udp6.Status        = EFI_NOT_READY;\r
+    Token->Token.Udp6.Packet.RxData = NULL;\r
+\r
+    Status = gBS->CreateEvent (\r
+                    EVT_NOTIFY_SIGNAL,\r
+                    TPL_NOTIFY,\r
+                    UdpIoOnDgramRcvd,\r
+                    Token,\r
+                    &Token->Token.Udp6.Event\r
+                    );\r
+  } \r
 \r
-  Status = gBS->CreateEvent (\r
-                  EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
-                  UdpIoOnDgramRcvd,\r
-                  Token,\r
-                  &Token->UdpToken.Event\r
-                  );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Token);\r
+    FreePool (Token);\r
     return NULL;\r
   }\r
 \r
@@ -272,9 +385,9 @@ UdpIoCreateRxToken (
 }\r
 \r
 /**\r
-  Wrap a transmit request into a UDP_TX_TOKEN.\r
+  Wrap a transmit request into a new created UDP_TX_TOKEN.\r
 \r
-  @param[in]  UdpIo                 The UdpIo port to send packet to.\r
+  @param[in]  UdpIo                 The UdpIo to send packet to.\r
   @param[in]  Packet                The user's packet.\r
   @param[in]  EndPoint              The local and remote access point.\r
   @param[in]  Gateway               The overrided next hop.\r
@@ -286,188 +399,329 @@ UdpIoCreateRxToken (
 \r
 **/\r
 UDP_TX_TOKEN *\r
-UdpIoWrapTx (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+UdpIoCreateTxToken (\r
+  IN UDP_IO                 *UdpIo,\r
   IN NET_BUF                *Packet,\r
-  IN UDP_POINTS             *EndPoint  OPTIONAL,\r
-  IN IP4_ADDR               Gateway,\r
+  IN UDP_END_POINT          *EndPoint OPTIONAL,\r
+  IN EFI_IP_ADDRESS         *Gateway  OPTIONAL,\r
   IN UDP_IO_CALLBACK        CallBack,\r
   IN VOID                   *Context\r
   )\r
 {\r
-  UDP_TX_TOKEN              *Token;\r
-  EFI_UDP4_COMPLETION_TOKEN *UdpToken;\r
-  EFI_UDP4_TRANSMIT_DATA    *UdpTxData;\r
+  UDP_TX_TOKEN              *TxToken;\r
+  VOID                      *Token;\r
+  VOID                      *Data;\r
   EFI_STATUS                Status;\r
   UINT32                    Count;\r
-  IP4_ADDR                  Ip;\r
+  UINTN                     Size;\r
+  IP4_ADDR                  Ip;  \r
 \r
-  Token = AllocatePool (sizeof (UDP_TX_TOKEN) +\r
-                           sizeof (EFI_UDP4_FRAGMENT_DATA) * (Packet->BlockOpNum - 1));\r
+  ASSERT (Packet != NULL);\r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
-  if (Token == NULL) {\r
-    return NULL;\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    Size = sizeof (UDP_TX_TOKEN) + sizeof (EFI_UDP4_FRAGMENT_DATA) * (Packet->BlockOpNum - 1);\r
+  } else {\r
+    Size = sizeof (UDP_TX_TOKEN) + sizeof (EFI_UDP6_FRAGMENT_DATA) * (Packet->BlockOpNum - 1);\r
   }\r
 \r
-  Token->Signature  = UDP_IO_TX_SIGNATURE;\r
-  InitializeListHead (&Token->Link);\r
+  TxToken = AllocatePool (Size);\r
 \r
-  Token->UdpIo      = UdpIo;\r
-  Token->CallBack   = CallBack;\r
-  Token->Packet     = Packet;\r
-  Token->Context    = Context;\r
+  if (TxToken == NULL) {\r
+    return NULL;\r
+  }\r
 \r
-  UdpToken          = &(Token->UdpToken);\r
-  UdpToken->Status  = EFI_NOT_READY;\r
+  TxToken->Signature = UDP_IO_TX_SIGNATURE;\r
+  InitializeListHead (&TxToken->Link);\r
 \r
-  Status = gBS->CreateEvent (\r
-                  EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
-                  UdpIoOnDgramSent,\r
-                  Token,\r
-                  &UdpToken->Event\r
-                  );\r
+  TxToken->UdpIo     = UdpIo;\r
+  TxToken->CallBack  = CallBack;\r
+  TxToken->Packet    = Packet;\r
+  TxToken->Context   = Context;\r
 \r
-  if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Token);\r
-    return NULL;\r
-  }\r
+  Token              = &(TxToken->Token);\r
+  Count              = Packet->BlockOpNum;\r
 \r
-  UdpTxData                 = &Token->UdpTxData;\r
-  UdpToken->Packet.TxData   = UdpTxData;\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
 \r
-  UdpTxData->UdpSessionData = NULL;\r
-  UdpTxData->GatewayAddress = NULL;\r
+    ((EFI_UDP4_COMPLETION_TOKEN *) Token)->Status = EFI_NOT_READY;\r
 \r
-  if (EndPoint != NULL) {\r
-    Ip = HTONL (EndPoint->LocalAddr);\r
-    CopyMem (&Token->UdpSession.SourceAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+    Status = gBS->CreateEvent (\r
+                    EVT_NOTIFY_SIGNAL,\r
+                    TPL_NOTIFY,\r
+                    UdpIoOnDgramSent,\r
+                    TxToken,\r
+                    &((EFI_UDP4_COMPLETION_TOKEN *) Token)->Event\r
+                    );\r
 \r
-    Ip = HTONL (EndPoint->RemoteAddr);\r
-    CopyMem (&Token->UdpSession.DestinationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (TxToken);\r
+      return NULL;\r
+    }\r
 \r
-    Token->UdpSession.SourcePort      = EndPoint->LocalPort;\r
-    Token->UdpSession.DestinationPort = EndPoint->RemotePort;\r
-    UdpTxData->UdpSessionData         = &Token->UdpSession;\r
-  }\r
+    Data = &(TxToken->Data.Udp4);\r
+    ((EFI_UDP4_COMPLETION_TOKEN *) Token)->Packet.TxData = Data;\r
+\r
+    ((EFI_UDP4_TRANSMIT_DATA *) Data)->UdpSessionData    = NULL;\r
+    ((EFI_UDP4_TRANSMIT_DATA *) Data)->GatewayAddress    = NULL;\r
+    ((EFI_UDP4_TRANSMIT_DATA *) Data)->DataLength        = Packet->TotalSize;\r
+\r
+    NetbufBuildExt (\r
+      Packet,\r
+      (NET_FRAGMENT *)((EFI_UDP4_TRANSMIT_DATA *) Data)->FragmentTable,\r
+      &Count\r
+      );\r
+\r
+    ((EFI_UDP4_TRANSMIT_DATA *) Data)->FragmentCount     = Count;\r
+\r
+    if (EndPoint != NULL) {\r
+      Ip = HTONL (EndPoint->LocalAddr.Addr[0]);\r
+      CopyMem (\r
+        &TxToken->Session.Udp4.SourceAddress, \r
+        &Ip, \r
+        sizeof (EFI_IPv4_ADDRESS)\r
+        );\r
+\r
+      Ip = HTONL (EndPoint->RemoteAddr.Addr[0]);\r
+      CopyMem (\r
+        &TxToken->Session.Udp4.DestinationAddress, \r
+        &Ip, \r
+        sizeof (EFI_IPv4_ADDRESS)\r
+        );\r
+\r
+      TxToken->Session.Udp4.SourcePort                   = EndPoint->LocalPort;\r
+      TxToken->Session.Udp4.DestinationPort              = EndPoint->RemotePort;\r
+      ((EFI_UDP4_TRANSMIT_DATA *) Data)->UdpSessionData  = &(TxToken->Session.Udp4);\r
+    }\r
 \r
-  if (Gateway != 0) {\r
-    Ip = HTONL (Gateway);\r
-    CopyMem (&Token->Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+    if (Gateway != NULL && (Gateway->Addr[0] != 0)) {\r
+      Ip = HTONL (Gateway->Addr[0]);\r
+      CopyMem (&TxToken->Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+      ((EFI_UDP4_TRANSMIT_DATA *) Data)->GatewayAddress = &TxToken->Gateway;      \r
+    }\r
 \r
-    UdpTxData->GatewayAddress = &Token->Gateway;\r
+  } else {\r
+  \r
+    ((EFI_UDP6_COMPLETION_TOKEN *) Token)->Status = EFI_NOT_READY;\r
+    \r
+    Status = gBS->CreateEvent (\r
+                    EVT_NOTIFY_SIGNAL,\r
+                    TPL_NOTIFY,\r
+                    UdpIoOnDgramSent,\r
+                    TxToken,\r
+                    &((EFI_UDP6_COMPLETION_TOKEN *) Token)->Event\r
+                    );\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (TxToken);\r
+      return NULL;\r
+    }\r
+    \r
+    Data = &(TxToken->Data.Udp6);\r
+    ((EFI_UDP6_COMPLETION_TOKEN *) Token)->Packet.TxData  = Data;\r
+    ((EFI_UDP6_TRANSMIT_DATA *) Data)->UdpSessionData     = NULL;\r
+    ((EFI_UDP6_TRANSMIT_DATA *) Data)->DataLength         = Packet->TotalSize;\r
+\r
+    NetbufBuildExt (\r
+      Packet,\r
+      (NET_FRAGMENT *)((EFI_UDP6_TRANSMIT_DATA *) Data)->FragmentTable,\r
+      &Count\r
+      );\r
+\r
+    ((EFI_UDP6_TRANSMIT_DATA *) Data)->FragmentCount      = Count;\r
+\r
+    if (EndPoint != NULL) {\r
+      CopyMem (\r
+        &TxToken->Session.Udp6.SourceAddress, \r
+        &EndPoint->LocalAddr.v6, \r
+        sizeof(EFI_IPv6_ADDRESS)\r
+        );\r
+\r
+      CopyMem (\r
+        &TxToken->Session.Udp6.DestinationAddress, \r
+        &EndPoint->RemoteAddr.v6, \r
+        sizeof(EFI_IPv6_ADDRESS)\r
+        );\r
+\r
+      TxToken->Session.Udp6.SourcePort                   = EndPoint->LocalPort;\r
+      TxToken->Session.Udp6.DestinationPort              = EndPoint->RemotePort;\r
+      ((EFI_UDP6_TRANSMIT_DATA *) Data)->UdpSessionData  = &(TxToken->Session.Udp6);\r
+    } \r
   }\r
 \r
-  UdpTxData->DataLength = Packet->TotalSize;\r
-  Count                 = Packet->BlockOpNum;\r
-  NetbufBuildExt (Packet, (NET_FRAGMENT *) UdpTxData->FragmentTable, &Count);\r
-  UdpTxData->FragmentCount = Count;\r
-\r
-  return Token;\r
+  return TxToken;\r
 }\r
 \r
 /**\r
-  Create a UDP_IO_PORT to access the UDP service. It will create and configure\r
+  Creates a UDP_IO to access the UDP service. It creates and configures\r
   a UDP child.\r
   \r
-  The function will locate the UDP service binding prototype on the Controller\r
-  parameter and use it to create a UDP child (aka Udp instance). Then the UDP\r
-  child will be configured by calling Configure function prototype. Any failures\r
-  in creating or configure the UDP child will lead to the failure of UDP_IO_PORT\r
-  creation.\r
+  This function:\r
+  # locates the UDP service binding prototype on the Controller parameter\r
+  # uses the UDP service binding prototype to create a UDP child (also known as a UDP instance)\r
+  # configures the UDP child by calling Configure function prototype. \r
+  Any failures in creating or configuring the UDP child return NULL for failure. \r
 \r
   @param[in]  Controller            The controller that has the UDP service binding.\r
                                     protocol installed.\r
-  @param[in]  Image                 The image handle for the driver.\r
+  @param[in]  ImageHandle           The image handle for the driver.\r
   @param[in]  Configure             The function to configure the created UDP child.\r
+  @param[in]  UdpVersion            The UDP protocol version, UDP4 or UDP6.\r
   @param[in]  Context               The opaque parameter for the Configure funtion.\r
 \r
-  @return Newly-created UDP_IO_PORT or NULL if failed.\r
+  @return Newly-created UDP_IO or NULL if failed.\r
 \r
 **/\r
-UDP_IO_PORT *\r
+UDP_IO *\r
 EFIAPI\r
-UdpIoCreatePort (\r
+UdpIoCreateIo (\r
   IN  EFI_HANDLE            Controller,\r
-  IN  EFI_HANDLE            Image,\r
+  IN  EFI_HANDLE            ImageHandle,\r
   IN  UDP_IO_CONFIG         Configure,\r
+  IN  UINT8                 UdpVersion,\r
   IN  VOID                  *Context\r
   )\r
 {\r
-  UDP_IO_PORT               *UdpIo;\r
+  UDP_IO                    *UdpIo;\r
   EFI_STATUS                Status;\r
 \r
   ASSERT (Configure != NULL);\r
+  ASSERT ((UdpVersion == UDP_IO_UDP4_VERSION) || (UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
-  UdpIo = AllocatePool (sizeof (UDP_IO_PORT));\r
+  UdpIo = AllocatePool (sizeof (UDP_IO));\r
 \r
   if (UdpIo == NULL) {\r
     return NULL;\r
   }\r
 \r
+  UdpIo->UdpVersion   = UdpVersion;\r
   UdpIo->Signature    = UDP_IO_SIGNATURE;\r
   InitializeListHead (&UdpIo->Link);\r
   UdpIo->RefCnt       = 1;\r
 \r
   UdpIo->Controller   = Controller;\r
-  UdpIo->Image        = Image;\r
+  UdpIo->Image        = ImageHandle;\r
 \r
   InitializeListHead (&UdpIo->SentDatagram);\r
   UdpIo->RecvRequest  = NULL;\r
   UdpIo->UdpHandle    = NULL;\r
 \r
-  //\r
-  // Create a UDP child then open and configure it\r
-  //\r
-  Status = NetLibCreateServiceChild (\r
-             Controller,\r
-             Image,\r
-             &gEfiUdp4ServiceBindingProtocolGuid,\r
-             &UdpIo->UdpHandle\r
-             );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    goto FREE_MEM;\r
-  }\r
-\r
-  Status = gBS->OpenProtocol (\r
-                  UdpIo->UdpHandle,\r
-                  &gEfiUdp4ProtocolGuid,\r
-                  (VOID **) &UdpIo->Udp,\r
-                  Image,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    goto FREE_CHILD;\r
-  }\r
+  if (UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    //\r
+    // Create a UDP child then open and configure it\r
+    //\r
+    Status = NetLibCreateServiceChild (\r
+               Controller,\r
+               ImageHandle,\r
+               &gEfiUdp4ServiceBindingProtocolGuid,\r
+               &UdpIo->UdpHandle\r
+               );\r
+  \r
+    if (EFI_ERROR (Status)) {\r
+      goto FREE_MEM;\r
+    }\r
 \r
-  if (EFI_ERROR (Configure (UdpIo, Context))) {\r
-    goto CLOSE_PROTOCOL;\r
-  }\r
+    Status = gBS->OpenProtocol (\r
+                    UdpIo->UdpHandle,\r
+                    &gEfiUdp4ProtocolGuid,\r
+                    (VOID **) &UdpIo->Protocol.Udp4,\r
+                    ImageHandle,\r
+                    Controller,\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    );\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      goto FREE_CHILD;\r
+    }\r
 \r
-  Status = UdpIo->Udp->GetModeData (UdpIo->Udp, NULL, NULL, NULL, &UdpIo->SnpMode);\r
+    if (EFI_ERROR (Configure (UdpIo, Context))) {\r
+      goto CLOSE_PROTOCOL;\r
+    }\r
+  \r
+    Status = UdpIo->Protocol.Udp4->GetModeData (\r
+                                     UdpIo->Protocol.Udp4, \r
+                                     NULL, \r
+                                     NULL, \r
+                                     NULL, \r
+                                     &UdpIo->SnpMode\r
+                                     );\r
+  \r
+    if (EFI_ERROR (Status)) {\r
+      goto CLOSE_PROTOCOL;\r
+    }\r
 \r
-  if (EFI_ERROR (Status)) {\r
-    goto CLOSE_PROTOCOL;\r
+  } else {\r
+    \r
+    Status = NetLibCreateServiceChild (\r
+               Controller,\r
+               ImageHandle,\r
+               &gEfiUdp6ServiceBindingProtocolGuid,\r
+               &UdpIo->UdpHandle\r
+               );\r
+  \r
+    if (EFI_ERROR (Status)) {\r
+      goto FREE_MEM;\r
+    }\r
+  \r
+    Status = gBS->OpenProtocol (\r
+                    UdpIo->UdpHandle,\r
+                    &gEfiUdp6ProtocolGuid,\r
+                    (VOID **) &UdpIo->Protocol.Udp6,\r
+                    ImageHandle,\r
+                    Controller,\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    );\r
+  \r
+    if (EFI_ERROR (Status)) {\r
+      goto FREE_CHILD;\r
+    }\r
+  \r
+    if (EFI_ERROR (Configure (UdpIo, Context))) {\r
+      goto CLOSE_PROTOCOL;\r
+    }\r
+  \r
+    Status = UdpIo->Protocol.Udp6->GetModeData (\r
+                                     UdpIo->Protocol.Udp6, \r
+                                     NULL, \r
+                                     NULL, \r
+                                     NULL, \r
+                                     &UdpIo->SnpMode\r
+                                     );\r
+  \r
+    if (EFI_ERROR (Status)) {\r
+      goto CLOSE_PROTOCOL;\r
+    }\r
   }\r
 \r
   return UdpIo;\r
 \r
 CLOSE_PROTOCOL:\r
-  gBS->CloseProtocol (UdpIo->UdpHandle, &gEfiUdp4ProtocolGuid, Image, Controller);\r
+  if (UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    gBS->CloseProtocol (UdpIo->UdpHandle, &gEfiUdp4ProtocolGuid, ImageHandle, Controller);\r
+  } else {\r
+    gBS->CloseProtocol (UdpIo->UdpHandle, &gEfiUdp6ProtocolGuid, ImageHandle, Controller);\r
+  }\r
 \r
 FREE_CHILD:\r
-  NetLibDestroyServiceChild (\r
-    Controller,\r
-    Image,\r
-    &gEfiUdp4ServiceBindingProtocolGuid,\r
-    UdpIo->UdpHandle\r
-    );\r
+  if (UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    NetLibDestroyServiceChild (\r
+      Controller,\r
+      ImageHandle,\r
+      &gEfiUdp4ServiceBindingProtocolGuid,\r
+      UdpIo->UdpHandle\r
+      );\r
+  } else {\r
+    NetLibDestroyServiceChild (\r
+      Controller,\r
+      ImageHandle,\r
+      &gEfiUdp6ServiceBindingProtocolGuid,\r
+      UdpIo->UdpHandle\r
+      );\r
+  }\r
 \r
 FREE_MEM:\r
-  gBS->FreePool (UdpIo);\r
+  FreePool (UdpIo);\r
   return NULL;\r
 }\r
 \r
@@ -475,7 +729,7 @@ FREE_MEM:
   Cancel all the sent datagram that pass the selection criteria of ToCancel.\r
   If ToCancel is NULL, all the datagrams are cancelled.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to cancel packet.\r
+  @param[in]  UdpIo                 The UDP_IO to cancel packet.\r
   @param[in]  IoStatus              The IoStatus to return to the packet owners.\r
   @param[in]  ToCancel              The select funtion to test whether to cancel this\r
                                     packet or not.\r
@@ -485,7 +739,7 @@ FREE_MEM:
 VOID\r
 EFIAPI\r
 UdpIoCancelDgrams (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN EFI_STATUS             IoStatus,\r
   IN UDP_IO_TO_CANCEL       ToCancel,        OPTIONAL\r
   IN VOID                   *Context\r
@@ -493,34 +747,45 @@ UdpIoCancelDgrams (
 {\r
   LIST_ENTRY                *Entry;\r
   LIST_ENTRY                *Next;\r
-  UDP_TX_TOKEN              *Token;\r
+  UDP_TX_TOKEN              *TxToken;\r
+\r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
   NET_LIST_FOR_EACH_SAFE (Entry, Next, &UdpIo->SentDatagram) {\r
-    Token = NET_LIST_USER_STRUCT (Entry, UDP_TX_TOKEN, Link);\r
+    TxToken = NET_LIST_USER_STRUCT (Entry, UDP_TX_TOKEN, Link);\r
+\r
+    if ((ToCancel == NULL) || (ToCancel (TxToken, Context))) {\r
 \r
-    if ((ToCancel == NULL) || (ToCancel (Token, Context))) {\r
-      UdpIo->Udp->Cancel (UdpIo->Udp, &Token->UdpToken);\r
+      if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+        UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &TxToken->Token.Udp4);\r
+      } else {\r
+        UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &TxToken->Token.Udp6);\r
+      }\r
     }\r
-  }\r
+  }  \r
 }\r
 \r
 /**\r
-  Free the UDP_IO_PORT and all its related resources.\r
+  Free the UDP_IO and all its related resources.\r
   \r
   The function will cancel all sent datagram and receive request.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to free.\r
+  @param[in]  UdpIo             The UDP_IO to free.\r
 \r
-  @retval EFI_SUCCESS           The UDP_IO_PORT is freed.\r
+  @retval EFI_SUCCESS           The UDP_IO is freed.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-UdpIoFreePort (\r
-  IN  UDP_IO_PORT           *UdpIo\r
+UdpIoFreeIo (\r
+  IN  UDP_IO           *UdpIo\r
   )\r
 {\r
-  UDP_RX_TOKEN  *RxToken;\r
+  UDP_RX_TOKEN         *RxToken;\r
+\r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
   //\r
   // Cancel all the sent datagram and receive requests. The\r
@@ -532,78 +797,116 @@ UdpIoFreePort (
   //\r
   UdpIoCancelDgrams (UdpIo, EFI_ABORTED, NULL, NULL);\r
 \r
-  if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
-    UdpIo->Udp->Cancel (UdpIo->Udp, &RxToken->UdpToken);\r
-  }\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
 \r
-  //\r
-  // Close then destory the UDP child\r
-  //\r
-  gBS->CloseProtocol (\r
-         UdpIo->UdpHandle,\r
-         &gEfiUdp4ProtocolGuid,\r
-         UdpIo->Image,\r
-         UdpIo->Controller\r
-         );\r
-\r
-  NetLibDestroyServiceChild (\r
-    UdpIo->Controller,\r
-    UdpIo->Image,\r
-    &gEfiUdp4ServiceBindingProtocolGuid,\r
-    UdpIo->UdpHandle\r
-    );\r
+    if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
+      UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);\r
+    }\r
+\r
+    //\r
+    // Close then destory the Udp4 child\r
+    //\r
+    gBS->CloseProtocol (\r
+           UdpIo->UdpHandle,\r
+           &gEfiUdp4ProtocolGuid,\r
+           UdpIo->Image,\r
+           UdpIo->Controller\r
+           );\r
+\r
+    NetLibDestroyServiceChild (\r
+      UdpIo->Controller,\r
+      UdpIo->Image,\r
+      &gEfiUdp4ServiceBindingProtocolGuid,\r
+      UdpIo->UdpHandle\r
+      );\r
+\r
+  } else {\r
+\r
+    if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
+      UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);\r
+    }\r
+    \r
+    //\r
+    // Close then destory the Udp6 child\r
+    //\r
+    gBS->CloseProtocol (\r
+           UdpIo->UdpHandle,\r
+           &gEfiUdp6ProtocolGuid,\r
+           UdpIo->Image,\r
+           UdpIo->Controller\r
+           );\r
+  \r
+    NetLibDestroyServiceChild (\r
+      UdpIo->Controller,\r
+      UdpIo->Image,\r
+      &gEfiUdp6ServiceBindingProtocolGuid,\r
+      UdpIo->UdpHandle\r
+      );\r
+    }\r
 \r
   if (!IsListEmpty(&UdpIo->Link)) {\r
     RemoveEntryList (&UdpIo->Link);\r
   }\r
 \r
-  gBS->FreePool (UdpIo);\r
+  FreePool (UdpIo);\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  Clean up the UDP_IO_PORT without freeing it. The function is called when\r
-  user wants to re-use the UDP_IO_PORT later.\r
+  Clean up the UDP_IO without freeing it. The function is called when\r
+  user wants to re-use the UDP_IO later.\r
   \r
   It will release all the transmitted datagrams and receive request. It will\r
   also configure NULL for the UDP instance.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to clean up.\r
+  @param[in]  UdpIo                 The UDP_IO to clean up.\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
-UdpIoCleanPort (\r
-  IN  UDP_IO_PORT           *UdpIo\r
+UdpIoCleanIo (\r
+  IN  UDP_IO                *UdpIo\r
   )\r
 {\r
   UDP_RX_TOKEN              *RxToken;\r
 \r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
+\r
   //\r
   // Cancel all the sent datagram and receive requests.\r
   //\r
   UdpIoCancelDgrams (UdpIo, EFI_ABORTED, NULL, NULL);\r
 \r
-  if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
-    UdpIo->Udp->Cancel (UdpIo->Udp, &RxToken->UdpToken);\r
-  }\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
+      UdpIo->Protocol.Udp4->Cancel (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);\r
+    }\r
+\r
+    UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, NULL);\r
 \r
-  UdpIo->Udp->Configure (UdpIo->Udp, NULL);\r
+  } else {\r
+    if ((RxToken = UdpIo->RecvRequest) != NULL) {\r
+      UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);\r
+    }\r
+\r
+    UdpIo->Protocol.Udp6->Configure (UdpIo->Protocol.Udp6, NULL);\r
+  }\r
 }\r
 \r
 /**\r
-  Send a packet through the UDP_IO_PORT.\r
+  Send a packet through the UDP_IO.\r
   \r
   The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called\r
   when the packet is sent. The optional parameter EndPoint overrides the default\r
   address pair if specified.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to send the packet through.\r
+  @param[in]  UdpIo                 The UDP_IO to send the packet through.\r
   @param[in]  Packet                The packet to send.\r
   @param[in]  EndPoint              The local and remote access point. Override the\r
                                     default address pair set during configuration.\r
-  @param[in]  Gateway               The gateway to use.\r
+  @param[in]  Gateway               The gateway to use.  \r
   @param[in]  CallBack              The function being called when packet is\r
                                     transmitted or failed.\r
   @param[in]  Context               The opaque parameter passed to CallBack.\r
@@ -616,20 +919,23 @@ UdpIoCleanPort (
 EFI_STATUS\r
 EFIAPI\r
 UdpIoSendDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  NET_BUF               *Packet,\r
-  IN  UDP_POINTS            *EndPoint, OPTIONAL\r
-  IN  IP4_ADDR              Gateway,\r
+  IN  UDP_END_POINT         *EndPoint OPTIONAL,\r
+  IN  EFI_IP_ADDRESS        *Gateway  OPTIONAL,\r
   IN  UDP_IO_CALLBACK       CallBack,\r
   IN  VOID                  *Context\r
   )\r
 {\r
-  UDP_TX_TOKEN              *Token;\r
+  UDP_TX_TOKEN              *TxToken;\r
   EFI_STATUS                Status;\r
 \r
-  Token = UdpIoWrapTx (UdpIo, Packet, EndPoint, Gateway, CallBack, Context);\r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
 \r
-  if (Token == NULL) {\r
+  TxToken = UdpIoCreateTxToken (UdpIo, Packet, EndPoint, Gateway, CallBack, Context);\r
+\r
+  if (TxToken == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -637,11 +943,17 @@ UdpIoSendDatagram (
   // Insert the tx token into SendDatagram list before transmitting it. Remove\r
   // it from the list if the returned status is not EFI_SUCCESS.\r
   //\r
-  InsertHeadList (&UdpIo->SentDatagram, &Token->Link);\r
-  Status = UdpIo->Udp->Transmit (UdpIo->Udp, &Token->UdpToken);\r
+  InsertHeadList (&UdpIo->SentDatagram, &TxToken->Link);\r
+\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    Status = UdpIo->Protocol.Udp4->Transmit (UdpIo->Protocol.Udp4, &TxToken->Token.Udp4);\r
+  } else {\r
+    Status = UdpIo->Protocol.Udp6->Transmit (UdpIo->Protocol.Udp6, &TxToken->Token.Udp6);\r
+  }\r
+\r
   if (EFI_ERROR (Status)) {\r
-    RemoveEntryList (&Token->Link);\r
-    UdpIoFreeTxToken (Token);\r
+    RemoveEntryList (&TxToken->Link);\r
+    UdpIoFreeTxToken (TxToken);\r
     return Status;\r
   }\r
 \r
@@ -678,14 +990,14 @@ UdpIoCancelSingleDgram (
 /**\r
   Cancel a single sent datagram.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to cancel the packet from\r
+  @param[in]  UdpIo                 The UDP_IO to cancel the packet from\r
   @param[in]  Packet                The packet to cancel\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 UdpIoCancelSentDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  NET_BUF               *Packet\r
   )\r
 {\r
@@ -693,53 +1005,61 @@ UdpIoCancelSentDatagram (
 }\r
 \r
 /**\r
-  Issue a receive request to the UDP_IO_PORT.\r
+  Issue a receive request to the UDP_IO.\r
   \r
   This function is called when upper-layer needs packet from UDP for processing.\r
   Only one receive request is acceptable at a time so a common usage model is\r
   to invoke this function inside its Callback function when the former packet\r
   is processed.\r
 \r
-  @param[in]  UdpIo                 The UDP_IO_PORT to receive the packet from.\r
+  @param[in]  UdpIo                 The UDP_IO to receive the packet from.\r
   @param[in]  CallBack              The call back function to execute when the packet\r
                                     is received.\r
   @param[in]  Context               The opaque context passed to Callback.\r
-  @param[in] HeadLen                The length of the upper-layer's protocol header.\r
+  @param[in]  HeadLen               The length of the upper-layer's protocol header.\r
 \r
   @retval EFI_ALREADY_STARTED   There is already a pending receive request. Only\r
                                 one receive request is supported at a time.\r
   @retval EFI_OUT_OF_RESOURCES  Failed to allocate needed resources.\r
   @retval EFI_SUCCESS           The receive request is issued successfully.\r
+  @retval EFI_UNSUPPORTED       The UDP version in UDP_IO is not supported.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UdpIoRecvDatagram (\r
-  IN  UDP_IO_PORT           *UdpIo,\r
+  IN  UDP_IO                *UdpIo,\r
   IN  UDP_IO_CALLBACK       CallBack,\r
   IN  VOID                  *Context,\r
   IN  UINT32                HeadLen\r
   )\r
 {\r
-  UDP_RX_TOKEN              *Token;\r
+  UDP_RX_TOKEN              *RxToken;\r
   EFI_STATUS                Status;\r
 \r
+  ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||\r
+          (UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));\r
+\r
   if (UdpIo->RecvRequest != NULL) {\r
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
-  Token = UdpIoCreateRxToken (UdpIo, CallBack, Context, HeadLen);\r
+  RxToken = UdpIoCreateRxToken (UdpIo, CallBack, Context, HeadLen);\r
 \r
-  if (Token == NULL) {\r
+  if (RxToken == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  UdpIo->RecvRequest = Token;\r
-  Status = UdpIo->Udp->Receive (UdpIo->Udp, &Token->UdpToken);\r
+  UdpIo->RecvRequest = RxToken;\r
+  if (UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {\r
+    Status = UdpIo->Protocol.Udp4->Receive (UdpIo->Protocol.Udp4, &RxToken->Token.Udp4);\r
+  } else {\r
+    Status = UdpIo->Protocol.Udp6->Receive (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);\r
+  }\r
 \r
   if (EFI_ERROR (Status)) {\r
     UdpIo->RecvRequest = NULL;\r
-    UdpIoFreeRxToken (Token);\r
+    UdpIoFreeRxToken (RxToken);\r
   }\r
 \r
   return Status;\r
index 1ca0589b900025f454447f80aace89682c353e92..76c55c4478bcf861292e049cb16ecdc684619464 100644 (file)
@@ -106,16 +106,16 @@ Dhcp4DriverBindingSupported (
   Configure the default UDP child to receive all the DHCP traffics\r
   on this network interface.\r
 \r
-  @param[in]  UdpIo                  The UDP IO port to configure\r
+  @param[in]  UdpIo                  The UDP IO to configure\r
   @param[in]  Context                The context to the function\r
 \r
-  @retval EFI_SUCCESS            The UDP IO port is successfully configured.\r
+  @retval EFI_SUCCESS            The UDP IO is successfully configured.\r
   @retval Others                 Failed to configure the UDP child.\r
 \r
 **/\r
 EFI_STATUS\r
 DhcpConfigUdpIo (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -139,7 +139,7 @@ DhcpConfigUdpIo (
   ZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));\r
   ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-  return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);;\r
+  return UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfigData);;\r
 }\r
 \r
 \r
@@ -162,7 +162,7 @@ Dhcp4CloseService (
   DhcpCleanLease (DhcpSb);\r
 \r
   if (DhcpSb->UdpIo != NULL) {\r
-    UdpIoFreePort (DhcpSb->UdpIo);\r
+    UdpIoFreeIo (DhcpSb->UdpIo);\r
     DhcpSb->UdpIo = NULL;\r
   }\r
 \r
@@ -237,7 +237,13 @@ Dhcp4CreateService (
     goto ON_ERROR;\r
   }\r
 \r
-  DhcpSb->UdpIo = UdpIoCreatePort (Controller, ImageHandle, DhcpConfigUdpIo, NULL);\r
+  DhcpSb->UdpIo = UdpIoCreateIo (\r
+                    Controller,\r
+                    ImageHandle,\r
+                    DhcpConfigUdpIo,\r
+                    UDP_IO_UDP4_VERSION,\r
+                    NULL\r
+                    );\r
 \r
   if (DhcpSb->UdpIo == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
index f95dfed5acea594b285cc6f707f3da710b35a289..44c9d84bdbfcea792637a5130be955a966e3c386 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
 # Component name for module Dhcp4\r
 #\r
-# Copyright (c) 2007, Intel Corporation\r
+# Copyright (c) 2007 - 2009, Intel Corporation\r
 #\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
@@ -63,4 +63,6 @@
   gEfiDhcp4ServiceBindingProtocolGuid           # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUdp4ProtocolGuid                          # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDhcp4ProtocolGuid                         # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiUdp6ServiceBindingProtocolGuid            # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiUdp6ProtocolGuid                          # PROTOCOL ALWAYS_CONSUMED\r
 \r
index a4b8fa8137d3860dc19d3abcae531c3cb9c1a84b..acacec7bb150d2c187bacb0d32b3f85e56cd27b5 100644 (file)
@@ -826,7 +826,7 @@ EfiDhcp4Start (
 \r
   if (CompletionEvent == NULL) {\r
     while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {\r
-      DhcpSb->UdpIo->Udp->Poll (DhcpSb->UdpIo->Udp);\r
+      DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);\r
     }\r
 \r
     return DhcpSb->IoStatus;\r
@@ -951,7 +951,8 @@ EfiDhcp4RenewRebind (
 \r
   if (CompletionEvent == NULL) {\r
     while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {\r
-      DhcpSb->UdpIo->Udp->Poll (DhcpSb->UdpIo->Udp);\r
+      DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);\r
+\r
     }\r
 \r
     return DhcpSb->IoStatus;\r
@@ -1173,7 +1174,7 @@ EfiDhcp4Build (
 **/\r
 EFI_STATUS\r
 Dhcp4InstanceConfigUdpIo (\r
-  IN UDP_IO_PORT  *UdpIo,\r
+  IN UDP_IO       *UdpIo,\r
   IN VOID         *Context\r
   )\r
 {\r
@@ -1206,7 +1207,7 @@ Dhcp4InstanceConfigUdpIo (
     UdpConfigData.StationPort = Token->ListenPoints[0].ListenPort;\r
   }\r
 \r
-  return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
+  return UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfigData);\r
 }\r
 \r
 /**\r
@@ -1228,7 +1229,13 @@ Dhcp4InstanceCreateUdpIo (
   ASSERT (Instance->Token != NULL);\r
 \r
   DhcpSb          = Instance->Service;\r
-  Instance->UdpIo = UdpIoCreatePort (DhcpSb->Controller, DhcpSb->Image, Dhcp4InstanceConfigUdpIo, Instance);\r
+  Instance->UdpIo = UdpIoCreateIo (\r
+                      DhcpSb->Controller,\r
+                      DhcpSb->Image,\r
+                      Dhcp4InstanceConfigUdpIo,\r
+                      UDP_IO_UDP4_VERSION,\r
+                      Instance\r
+                      );\r
   if (Instance->UdpIo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   } else {\r
@@ -1256,7 +1263,7 @@ DhcpDummyExtFree (
   sent out. The packet will be queued to the response queue.\r
   \r
   @param UdpPacket        The Dhcp4 packet.\r
-  @param Points           Udp4 address pair.\r
+  @param EndPoint         Udp4 address pair.\r
   @param IoStatus         Status of the input.\r
   @param Context          Extra info for the input.\r
   \r
@@ -1264,7 +1271,7 @@ DhcpDummyExtFree (
 VOID\r
 PxeDhcpInput (\r
   NET_BUF                   *UdpPacket,\r
-  UDP_POINTS                *Points,\r
+  UDP_END_POINT             *EndPoint,\r
   EFI_STATUS                IoStatus,\r
   VOID                      *Context\r
   )\r
@@ -1397,8 +1404,8 @@ SIGNAL_USER:
   // Clean up the resources dedicated for this transmit receive transaction.\r
   //\r
   NetbufQueFlush (&Instance->ResponseQueue);\r
-  UdpIoCleanPort (Instance->UdpIo);\r
-  UdpIoFreePort (Instance->UdpIo);\r
+  UdpIoCleanIo (Instance->UdpIo);\r
+  UdpIoFreeIo (Instance->UdpIo);\r
   Instance->UdpIo = NULL;\r
   Instance->Token = NULL;\r
 \r
@@ -1439,10 +1446,10 @@ EfiDhcp4TransmitReceive (
   EFI_STATUS     Status;\r
   NET_FRAGMENT   Frag;\r
   NET_BUF        *Wrap;\r
-  UDP_POINTS     EndPoint;\r
+  UDP_END_POINT  EndPoint;\r
   IP4_ADDR       Ip;\r
   DHCP_SERVICE   *DhcpSb;\r
-  IP4_ADDR       Gateway;\r
+  EFI_IP_ADDRESS Gateway;\r
   IP4_ADDR       SubnetMask;\r
 \r
   if ((This == NULL) || (Token == NULL) || (Token->Packet == NULL)) {\r
@@ -1516,16 +1523,15 @@ EfiDhcp4TransmitReceive (
   }\r
 \r
   //\r
-  // Set the local address and local port.\r
+  // Set the local address and local port to ZERO.\r
   //\r
-  EndPoint.LocalAddr = 0;\r
-  EndPoint.LocalPort = 0;\r
+  ZeroMem (&EndPoint, sizeof (UDP_END_POINT));\r
 \r
   //\r
   // Set the destination address and destination port.\r
   //\r
   CopyMem (&Ip, &Token->RemoteAddress, sizeof (EFI_IPv4_ADDRESS));\r
-  EndPoint.RemoteAddr = NTOHL (Ip);\r
+  EndPoint.RemoteAddr.Addr[0] = NTOHL (Ip);\r
 \r
   if (Token->RemotePort == 0) {\r
     EndPoint.RemotePort = DHCP_SERVER_PORT;\r
@@ -1537,16 +1543,16 @@ EfiDhcp4TransmitReceive (
   // Get the gateway.\r
   //\r
   SubnetMask = DhcpSb->Netmask;\r
-  Gateway    = 0;\r
-  if (!IP4_NET_EQUAL (DhcpSb->ClientAddr, EndPoint.RemoteAddr, SubnetMask)) {\r
-    CopyMem (&Gateway, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
-    Gateway = NTOHL (Gateway);\r
+  ZeroMem (&Gateway, sizeof (Gateway));\r
+  if (!IP4_NET_EQUAL (DhcpSb->ClientAddr, EndPoint.RemoteAddr.Addr[0], SubnetMask)) {\r
+    CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
+    Gateway.Addr[0] = NTOHL (Gateway.Addr[0]);\r
   }\r
 \r
   //\r
   // Transmit the DHCP packet.\r
   //\r
-  Status = UdpIoSendDatagram (Instance->UdpIo, Wrap, &EndPoint, Gateway, DhcpOnPacketSent, NULL);\r
+  Status = UdpIoSendDatagram (Instance->UdpIo, Wrap, &EndPoint, &Gateway, DhcpOnPacketSent, NULL);\r
   if (EFI_ERROR (Status)) {\r
     NetbufFree (Wrap);\r
     goto ON_ERROR;\r
@@ -1563,8 +1569,8 @@ EfiDhcp4TransmitReceive (
 ON_ERROR:\r
 \r
   if (EFI_ERROR (Status) && (Instance->UdpIo != NULL)) {\r
-    UdpIoCleanPort (Instance->UdpIo);\r
-    UdpIoFreePort (Instance->UdpIo);\r
+    UdpIoCleanIo (Instance->UdpIo);\r
+    UdpIoFreeIo (Instance->UdpIo);\r
     Instance->UdpIo = NULL;\r
     Instance->Token = NULL;\r
   }\r
@@ -1583,7 +1589,7 @@ ON_ERROR:
       // free it when timeout.\r
       //\r
       if (Instance->Timeout > 0) {\r
-        Instance->UdpIo->Udp->Poll (Instance->UdpIo->Udp);\r
+        Instance->UdpIo->Protocol.Udp4->Poll (Instance->UdpIo->Protocol.Udp4);\r
         gBS->RestoreTPL (OldTpl);\r
       } else {\r
         gBS->RestoreTPL (OldTpl);\r
index 36f3ecb81978155b8fffbaf4217497853dbac477..7d15b846c0fea0187c791c586cac18fee12a62e4 100644 (file)
@@ -69,7 +69,7 @@ struct _DHCP_PROTOCOL {
   EFI_EVENT                         RenewRebindEvent;\r
 \r
   EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN  *Token;\r
-  UDP_IO_PORT                       *UdpIo; // The UDP IO used for TransmitReceive.\r
+  UDP_IO                            *UdpIo; // The UDP IO used for TransmitReceive.\r
   UINT32                            Timeout;\r
   NET_BUF_QUEUE                     ResponseQueue;\r
 };\r
@@ -108,8 +108,8 @@ struct _DHCP_SERVICE {
   UINT32                        T2;\r
   INTN                          ExtraRefresh; // This refresh is reqested by user\r
 \r
-  UDP_IO_PORT                   *UdpIo;       // Udp child receiving all DHCP message\r
-  UDP_IO_PORT                   *LeaseIoPort; // Udp child with lease IP\r
+  UDP_IO                        *UdpIo;       // Udp child receiving all DHCP message\r
+  UDP_IO                        *LeaseIoPort; // Udp child with lease IP\r
   EFI_DHCP4_PACKET              *LastPacket;  // The last sent packet for retransmission\r
   EFI_MAC_ADDRESS               Mac;\r
   UINT8                         HwType;\r
index be8ceb045086f737d47466fa154aad463ee2986c..7c1fa4746a7fac43a18b5b09cd51318daf454cbc 100644 (file)
@@ -305,7 +305,7 @@ DhcpComputeLease (
   DHCP driver needs this port to unicast packet to the server\r
   such as DHCP release.\r
 \r
-  @param[in]  UdpIo                 The UDP IO port to configure\r
+  @param[in]  UdpIo                 The UDP IO to configure\r
   @param[in]  Context               Dhcp service instance.\r
 \r
   @retval EFI_SUCCESS           The UDP IO port is successfully configured.\r
@@ -314,7 +314,7 @@ DhcpComputeLease (
 **/\r
 EFI_STATUS\r
 DhcpConfigLeaseIoPort (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -349,7 +349,7 @@ DhcpConfigLeaseIoPort (
 \r
   ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-  Status = UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);\r
+  Status = UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfigData);\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -364,7 +364,7 @@ DhcpConfigLeaseIoPort (
     Ip = HTONL (DhcpSb->Para->Router);\r
     CopyMem (&Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-    UdpIo->Udp->Routes (UdpIo->Udp, FALSE, &Subnet, &Subnet, &Gateway);\r
+    UdpIo->Protocol.Udp4->Routes (UdpIo->Protocol.Udp4, FALSE, &Subnet, &Subnet, &Gateway);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -402,7 +402,7 @@ DhcpLeaseAcquired (
   }\r
 \r
   if (DhcpSb->LeaseIoPort != NULL) {\r
-    UdpIoFreePort (DhcpSb->LeaseIoPort);\r
+    UdpIoFreeIo (DhcpSb->LeaseIoPort);\r
   }\r
 \r
   //\r
@@ -410,10 +410,11 @@ DhcpLeaseAcquired (
   // and transmit unicast packet with it as source address. Don't\r
   // start receive on this port, the queued packet will be timeout.\r
   //\r
-  DhcpSb->LeaseIoPort = UdpIoCreatePort (\r
+  DhcpSb->LeaseIoPort = UdpIoCreateIo (\r
                           DhcpSb->Controller,\r
                           DhcpSb->Image,\r
                           DhcpConfigLeaseIoPort,\r
+                          UDP_IO_UDP4_VERSION,\r
                           DhcpSb\r
                           );\r
 \r
@@ -467,7 +468,7 @@ DhcpCleanLease (
   DhcpSb->ExtraRefresh  = FALSE;\r
 \r
   if (DhcpSb->LeaseIoPort != NULL) {\r
-    UdpIoFreePort (DhcpSb->LeaseIoPort);\r
+    UdpIoFreeIo (DhcpSb->LeaseIoPort);\r
     DhcpSb->LeaseIoPort = NULL;\r
   }\r
 \r
@@ -935,7 +936,7 @@ ON_EXIT:
   state machine.\r
 \r
   @param  UdpPacket             The UDP packets received.\r
-  @param  Points                The local/remote UDP access points\r
+  @param  EndPoint              The local/remote UDP access point\r
   @param  IoStatus              The status of the UDP receive\r
   @param  Context               The opaque parameter to the function.\r
 \r
@@ -943,7 +944,7 @@ ON_EXIT:
 VOID\r
 DhcpInput (\r
   NET_BUF                   *UdpPacket,\r
-  UDP_POINTS                *Points,\r
+  UDP_END_POINT             *EndPoint,\r
   EFI_STATUS                IoStatus,\r
   VOID                      *Context\r
   )\r
@@ -1106,7 +1107,7 @@ DhcpReleasePacket (
   Release the net buffer when packet is sent.\r
 \r
   @param  UdpPacket             The UDP packets received.\r
-  @param  Points                The local/remote UDP access points\r
+  @param  EndPoint              The local/remote UDP access point\r
   @param  IoStatus              The status of the UDP receive\r
   @param  Context               The opaque parameter to the function.\r
 \r
@@ -1114,7 +1115,7 @@ DhcpReleasePacket (
 VOID\r
 DhcpOnPacketSent (\r
   NET_BUF                   *Packet,\r
-  UDP_POINTS                *Points,\r
+  UDP_END_POINT             *EndPoint,\r
   EFI_STATUS                IoStatus,\r
   VOID                      *Context\r
   )\r
@@ -1157,8 +1158,8 @@ DhcpSendMessage (
   EFI_DHCP4_PACKET          *NewPacket;\r
   EFI_DHCP4_HEADER          *Head;\r
   EFI_DHCP4_HEADER          *SeedHead;\r
-  UDP_IO_PORT               *UdpIo;\r
-  UDP_POINTS                EndPoint;\r
+  UDP_IO                    *UdpIo;\r
+  UDP_END_POINT             EndPoint;\r
   NET_BUF                   *Wrap;\r
   NET_FRAGMENT              Frag;\r
   EFI_STATUS                Status;\r
@@ -1363,16 +1364,16 @@ DhcpSendMessage (
   // Broadcast the message, unless we know the server address.\r
   // Use the lease UdpIo port to send the unicast packet.\r
   //\r
-  EndPoint.RemoteAddr = 0xffffffff;\r
-  EndPoint.LocalAddr  = 0;\r
-  EndPoint.RemotePort = DHCP_SERVER_PORT;\r
-  EndPoint.LocalPort  = DHCP_CLIENT_PORT;\r
-  UdpIo               = DhcpSb->UdpIo;\r
+  EndPoint.RemoteAddr.Addr[0] = 0xffffffff;\r
+  EndPoint.LocalAddr.Addr[0]  = 0;\r
+  EndPoint.RemotePort         = DHCP_SERVER_PORT;\r
+  EndPoint.LocalPort          = DHCP_CLIENT_PORT;\r
+  UdpIo                       = DhcpSb->UdpIo;\r
 \r
   if ((DhcpSb->DhcpState == Dhcp4Renewing) || (Type == DHCP_MSG_RELEASE)) {\r
-    EndPoint.RemoteAddr = DhcpSb->ServerAddr;\r
-    EndPoint.LocalAddr  = DhcpSb->ClientAddr;\r
-    UdpIo               = DhcpSb->LeaseIoPort;\r
+    EndPoint.RemoteAddr.Addr[0] = DhcpSb->ServerAddr;\r
+    EndPoint.LocalAddr.Addr[0]  = DhcpSb->ClientAddr;\r
+    UdpIo                       = DhcpSb->LeaseIoPort;\r
   }\r
 \r
   ASSERT (UdpIo != NULL);\r
@@ -1382,7 +1383,7 @@ DhcpSendMessage (
              UdpIo, \r
              Wrap, \r
              &EndPoint, \r
-             0\r
+             NULL\r
              DhcpOnPacketSent, \r
              DhcpSb\r
              );\r
@@ -1411,8 +1412,8 @@ DhcpRetransmit (
   IN DHCP_SERVICE           *DhcpSb\r
   )\r
 {\r
-  UDP_IO_PORT               *UdpIo;\r
-  UDP_POINTS                EndPoint;\r
+  UDP_IO                    *UdpIo;\r
+  UDP_END_POINT             EndPoint;\r
   NET_BUF                   *Wrap;\r
   NET_FRAGMENT              Frag;\r
   EFI_STATUS                Status;\r
@@ -1435,16 +1436,16 @@ DhcpRetransmit (
   //\r
   // Broadcast the message, unless we know the server address.\r
   //\r
-  EndPoint.RemotePort = DHCP_SERVER_PORT;\r
-  EndPoint.LocalPort  = DHCP_CLIENT_PORT;\r
-  EndPoint.RemoteAddr = 0xffffffff;\r
-  EndPoint.LocalAddr  = 0;\r
-  UdpIo               = DhcpSb->UdpIo;\r
+  EndPoint.RemotePort         = DHCP_SERVER_PORT;\r
+  EndPoint.LocalPort          = DHCP_CLIENT_PORT;\r
+  EndPoint.RemoteAddr.Addr[0] = 0xffffffff;\r
+  EndPoint.LocalAddr.Addr[0]  = 0;\r
+  UdpIo                       = DhcpSb->UdpIo;\r
 \r
   if (DhcpSb->DhcpState == Dhcp4Renewing) {\r
-    EndPoint.RemoteAddr = DhcpSb->ServerAddr;\r
-    EndPoint.LocalAddr  = DhcpSb->ClientAddr;\r
-    UdpIo               = DhcpSb->LeaseIoPort;\r
+    EndPoint.RemoteAddr.Addr[0] = DhcpSb->ServerAddr;\r
+    EndPoint.LocalAddr.Addr[0]  = DhcpSb->ClientAddr;\r
+    UdpIo                       = DhcpSb->LeaseIoPort;\r
   }\r
 \r
   ASSERT (UdpIo != NULL);\r
@@ -1454,7 +1455,7 @@ DhcpRetransmit (
              UdpIo,\r
              Wrap,\r
              &EndPoint,\r
-             0,\r
+             NULL,\r
              DhcpOnPacketSent,\r
              DhcpSb\r
              );\r
index d9298ada2f744ae59f991c2c9ad6007a2bad4e13..bc7ef689e13a29cca4b999f6ef8c7f072048bc2f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The DHCP4 protocol implementation.\r
   \r
-Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\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
@@ -140,7 +140,7 @@ DhcpOnTimerTick (
   state machine.\r
 \r
   @param  UdpPacket             The UDP packets received.\r
-  @param  Points                The local/remote UDP access points\r
+  @param  EndPoint              The local/remote UDP access point\r
   @param  IoStatus              The status of the UDP receive\r
   @param  Context               The opaque parameter to the function.\r
 \r
@@ -148,7 +148,7 @@ DhcpOnTimerTick (
 VOID\r
 DhcpInput (\r
   NET_BUF                   *UdpPacket,\r
-  UDP_POINTS                *Points,\r
+  UDP_END_POINT             *EndPoint,\r
   EFI_STATUS                IoStatus,\r
   VOID                      *Context\r
   );\r
@@ -183,7 +183,7 @@ DhcpCleanLease (
   Release the net buffer when packet is sent.\r
 \r
   @param  UdpPacket             The UDP packets received.\r
-  @param  Points                The local/remote UDP access points\r
+  @param  EndPoint              The local/remote UDP access point\r
   @param  IoStatus              The status of the UDP receive\r
   @param  Context               The opaque parameter to the function.\r
 \r
@@ -191,7 +191,7 @@ DhcpCleanLease (
 VOID\r
 DhcpOnPacketSent (\r
   NET_BUF                   *Packet,\r
-  UDP_POINTS                *Points,\r
+  UDP_END_POINT             *EndPoint,\r
   EFI_STATUS                IoStatus,\r
   VOID                      *Context\r
   );\r
index 56c993eee7a6e995c458e88606072c0b83d874d8..63dcc6c5dfd83ddacb5376a12d598da2dba7c2c2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of Mtftp drivers.\r
   \r
-Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation<BR>\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
@@ -107,7 +107,7 @@ Mtftp4DriverBindingSupported (
   Just leave the Udp child unconfigured. When UDP is unloaded, \r
     MTFTP will be informed with DriverBinding Stop.\r
 \r
-  @param  UdpIo                  The UDP port to configure\r
+  @param  UdpIo                  The UDP_IO to configure\r
   @param  Context                The opaque parameter to the callback\r
 \r
   @retval EFI_SUCCESS            It always return EFI_SUCCESS directly.\r
@@ -115,7 +115,7 @@ Mtftp4DriverBindingSupported (
 **/\r
 EFI_STATUS\r
 Mtftp4ConfigNullUdp (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -201,7 +201,13 @@ Mtftp4CreateService (
     return Status;\r
   }\r
 \r
-  MtftpSb->ConnectUdp = UdpIoCreatePort (Controller, Image, Mtftp4ConfigNullUdp, NULL);\r
+  MtftpSb->ConnectUdp = UdpIoCreateIo (\r
+                          Controller,\r
+                          Image,\r
+                          Mtftp4ConfigNullUdp,\r
+                          UDP_IO_UDP4_VERSION,\r
+                          NULL\r
+                          );\r
 \r
   if (MtftpSb->ConnectUdp == NULL) {\r
     gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
@@ -226,7 +232,7 @@ Mtftp4CleanService (
   IN MTFTP4_SERVICE     *MtftpSb\r
   )\r
 {\r
-  UdpIoFreePort (MtftpSb->ConnectUdp);\r
+  UdpIoFreeIo (MtftpSb->ConnectUdp);\r
   gBS->CloseEvent (MtftpSb->TimerToGetMap);\r
   gBS->CloseEvent (MtftpSb->Timer);\r
 }\r
@@ -467,10 +473,11 @@ Mtftp4ServiceBindingCreateChild (
 \r
   Mtftp4InitProtocol (MtftpSb, Instance);\r
 \r
-  Instance->UnicastPort = UdpIoCreatePort (\r
+  Instance->UnicastPort = UdpIoCreateIo (\r
                             MtftpSb->Controller,\r
                             MtftpSb->Image,\r
                             Mtftp4ConfigNullUdp,\r
+                            UDP_IO_UDP4_VERSION,\r
                             Instance\r
                             );\r
 \r
@@ -530,7 +537,7 @@ Mtftp4ServiceBindingCreateChild (
 ON_ERROR:\r
 \r
   if (EFI_ERROR (Status)) {\r
-    UdpIoFreePort (Instance->UnicastPort);\r
+    UdpIoFreeIo (Instance->UnicastPort);\r
     gBS->FreePool (Instance);\r
   }\r
 \r
@@ -623,7 +630,7 @@ Mtftp4ServiceBindingDestroyChild (
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   Mtftp4CleanOperation (Instance, EFI_DEVICE_ERROR);\r
-  UdpIoFreePort (Instance->UnicastPort);\r
+  UdpIoFreeIo (Instance->UnicastPort);\r
 \r
   RemoveEntryList (&Instance->Link);\r
   MtftpSb->ChildrenNum--;\r
index b45914d3af39d15008deab22f7abfe1ba6fd545c..feb1594b25b33bfa8854d0189bd99ab8da4b107a 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
 # Component name for module Mtftp4\r
 #\r
-# Copyright (c) 2007, Intel Corporation\r
+# Copyright (c) 2007 - 2009, Intel Corporation\r
 #\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
@@ -67,4 +67,6 @@
   gEfiMtftp4ProtocolGuid                        # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUdp4ServiceBindingProtocolGuid            # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUdp4ProtocolGuid                          # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiUdp6ServiceBindingProtocolGuid            # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiUdp6ProtocolGuid                          # PROTOCOL ALWAYS_CONSUMED\r
 \r
index 4c459b22b88f40a3e54bacc6c243f1498b3a1861..06f0231e8b33d7b5d1175a9a529f21a35e344dd3 100644 (file)
@@ -50,7 +50,7 @@ Mtftp4CleanOperation (
   }\r
 \r
   ASSERT (Instance->UnicastPort != NULL);\r
-  UdpIoCleanPort (Instance->UnicastPort);\r
+  UdpIoCleanIo (Instance->UnicastPort);\r
 \r
   if (Instance->LastPacket != NULL) {\r
     NetbufFree (Instance->LastPacket);\r
@@ -58,7 +58,7 @@ Mtftp4CleanOperation (
   }\r
 \r
   if (Instance->McastUdpPort != NULL) {\r
-    UdpIoFreePort (Instance->McastUdpPort);\r
+    UdpIoFreeIo (Instance->McastUdpPort);\r
     Instance->McastUdpPort = NULL;\r
   }\r
 \r
@@ -211,9 +211,8 @@ Mtftp4OverrideValid (
   the UDP is reconfigured.\r
 \r
   @param  Instance               The Mtftp instance\r
-  @param  UdpPort                The UDP port to poll\r
-  @param  UdpCfgData             The UDP configure data to reconfigure the UDP\r
-                                 port.\r
+  @param  UdpIo                  The UDP_IO to poll\r
+  @param  UdpCfgData             The UDP configure data to reconfigure the UDP_IO\r
 \r
   @retval TRUE                   The default address is retrieved and UDP is reconfigured.\r
   @retval FALSE                  Some error occured.\r
@@ -222,7 +221,7 @@ Mtftp4OverrideValid (
 BOOLEAN\r
 Mtftp4GetMapping (\r
   IN MTFTP4_PROTOCOL        *Instance,\r
-  IN UDP_IO_PORT            *UdpPort,\r
+  IN UDP_IO                 *UdpIo,\r
   IN EFI_UDP4_CONFIG_DATA   *UdpCfgData\r
   )\r
 {\r
@@ -234,7 +233,7 @@ Mtftp4GetMapping (
   ASSERT (Instance->Config.UseDefaultSetting);\r
 \r
   Service = Instance->Service;\r
-  Udp     = UdpPort->Udp;\r
+  Udp     = UdpIo->Protocol.Udp4;\r
 \r
   Status = gBS->SetTimer (\r
                   Service->TimerToGetMap,\r
@@ -263,7 +262,7 @@ Mtftp4GetMapping (
 /**\r
   Configure the UDP port for unicast receiving.\r
 \r
-  @param  UdpIo                  The UDP port\r
+  @param  UdpIo                  The UDP_IO instance\r
   @param  Instance               The MTFTP session\r
 \r
   @retval EFI_SUCCESS            The UDP port is successfully configured for the\r
@@ -272,7 +271,7 @@ Mtftp4GetMapping (
 **/\r
 EFI_STATUS\r
 Mtftp4ConfigUnicastPort (\r
-  IN UDP_IO_PORT            *UdpIo,\r
+  IN UDP_IO                 *UdpIo,\r
   IN MTFTP4_PROTOCOL        *Instance\r
   )\r
 {\r
@@ -301,7 +300,7 @@ Mtftp4ConfigUnicastPort (
   Ip = HTONL (Instance->ServerIp);\r
   CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-  Status = UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfig);\r
+  Status = UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfig);\r
 \r
   if ((Status == EFI_NO_MAPPING) && Mtftp4GetMapping (Instance, UdpIo, &UdpConfig)) {\r
     return EFI_SUCCESS;\r
@@ -312,9 +311,15 @@ Mtftp4ConfigUnicastPort (
     // The station IP address is manually configured and the Gateway IP is not 0.\r
     // Add the default route for this UDP instance.\r
     //\r
-    Status = UdpIo->Udp->Routes (UdpIo->Udp, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, &Config->GatewayIp);\r
+    Status = UdpIo->Protocol.Udp4->Routes (\r
+                                     UdpIo->Protocol.Udp4,\r
+                                     FALSE,\r
+                                     &mZeroIp4Addr,\r
+                                     &mZeroIp4Addr,\r
+                                     &Config->GatewayIp\r
+                                     );\r
     if (EFI_ERROR (Status)) {\r
-      UdpIo->Udp->Configure (UdpIo->Udp, NULL);\r
+      UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, NULL);\r
     }\r
   }\r
   return Status;\r
@@ -1070,7 +1075,7 @@ EfiMtftp4Poll (
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  Udp = Instance->UnicastPort->Udp;\r
+  Udp = Instance->UnicastPort->Protocol.Udp4;\r
   return Udp->Poll (Udp);\r
 }\r
 \r
index 8f39df3c4f2edeae414f019b1b2656b72c7d4b9f..d4644c7084118f461e530a47e479377d0c39bc36 100644 (file)
@@ -85,7 +85,7 @@ struct _MTFTP4_SERVICE {
   // This UDP child is used to keep the connection between the UDP\r
   // and MTFTP, so MTFTP will be notified when UDP is uninstalled.\r
   //\r
-  UDP_IO_PORT                   *ConnectUdp;\r
+  UDP_IO                        *ConnectUdp;\r
 };\r
 \r
 \r
@@ -131,7 +131,7 @@ struct _MTFTP4_PROTOCOL {
   UINT16                        ListeningPort;\r
   UINT16                        ConnectedPort;\r
   IP4_ADDR                      Gateway;\r
-  UDP_IO_PORT                   *UnicastPort;\r
+  UDP_IO                        *UnicastPort;\r
 \r
   //\r
   // Timeout and retransmit status\r
@@ -148,7 +148,7 @@ struct _MTFTP4_PROTOCOL {
   IP4_ADDR                      McastIp;\r
   UINT16                        McastPort;\r
   BOOLEAN                       Master;\r
-  UDP_IO_PORT                   *McastUdpPort;\r
+  UDP_IO                        *McastUdpPort;\r
 };\r
 \r
 /**\r
index f5b6bbc8878e19c5fcced077ef5fe85567fc69f0..524db8ff635cdfff8c97756007ce07910257f108 100644 (file)
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   The packet process callback for MTFTP download.\r
 \r
   @param  UdpPacket             The packet received\r
-  @param  Points                The local/remote access point of the packet\r
+  @param  EndPoint              The local/remote access point of the packet\r
   @param  IoStatus              The status of the receiving\r
   @param  Context               Opaque parameter, which is the MTFTP session\r
 \r
@@ -28,7 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 VOID\r
 Mtftp4RrqInput (\r
   IN NET_BUF                *UdpPacket,\r
-  IN UDP_POINTS             *Points,\r
+  IN UDP_END_POINT          *EndPoint,\r
   IN EFI_STATUS             IoStatus,\r
   IN VOID                   *Context\r
   );\r
@@ -370,7 +370,7 @@ Mtftp4RrqOackValid (
 /**\r
   Configure a UDP IO port to receive the multicast.\r
 \r
-  @param  McastIo               The UDP IO port to configure\r
+  @param  McastIo               The UDP IO to configure\r
   @param  Context               The opaque parameter to the function which is the\r
                                 MTFTP session.\r
 \r
@@ -380,7 +380,7 @@ Mtftp4RrqOackValid (
 **/\r
 EFI_STATUS\r
 Mtftp4RrqConfigMcastPort (\r
-  IN UDP_IO_PORT            *McastIo,\r
+  IN UDP_IO                 *McastIo,\r
   IN VOID                   *Context\r
   )\r
 {\r
@@ -412,7 +412,7 @@ Mtftp4RrqConfigMcastPort (
   Ip = HTONL (Instance->ServerIp);\r
   CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-  Status = McastIo->Udp->Configure (McastIo->Udp, &UdpConfig);\r
+  Status = McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, &UdpConfig);\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -424,16 +424,16 @@ Mtftp4RrqConfigMcastPort (
     // The station IP address is manually configured and the Gateway IP is not 0.\r
     // Add the default route for this UDP instance.\r
     //\r
-    Status = McastIo->Udp->Routes (\r
-                             McastIo->Udp\r
-                             FALSE,\r
-                             &mZeroIp4Addr,\r
-                             &mZeroIp4Addr,\r
-                             &Config->GatewayIp\r
-                             );\r
+    Status = McastIo->Protocol.Udp4->Routes (\r
+                                       McastIo->Protocol.Udp4\r
+                                       FALSE,\r
+                                       &mZeroIp4Addr,\r
+                                       &mZeroIp4Addr,\r
+                                       &Config->GatewayIp\r
+                                       );\r
                              \r
     if (EFI_ERROR (Status)) {\r
-      McastIo->Udp->Configure (McastIo->Udp, NULL);\r
+      McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, NULL);\r
       return Status;\r
     }\r
   }\r
@@ -444,7 +444,7 @@ Mtftp4RrqConfigMcastPort (
   Ip = HTONL (Instance->McastIp);\r
   CopyMem (&Group, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
 \r
-  return McastIo->Udp->Groups (McastIo->Udp, TRUE, &Group);\r
+  return McastIo->Protocol.Udp4->Groups (McastIo->Protocol.Udp4, TRUE, &Group);\r
 }\r
 \r
 \r
@@ -539,10 +539,11 @@ Mtftp4RrqHandleOack (
       //\r
       Instance->McastIp      = Reply.McastIp;\r
       Instance->McastPort    = Reply.McastPort;\r
-      Instance->McastUdpPort = UdpIoCreatePort (\r
+      Instance->McastUdpPort = UdpIoCreateIo (\r
                                  Instance->Service->Controller,\r
                                  Instance->Service->Image,\r
                                  Mtftp4RrqConfigMcastPort,\r
+                                 UDP_IO_UDP4_VERSION,\r
                                  Instance\r
                                  );\r
 \r
@@ -598,7 +599,7 @@ Mtftp4RrqHandleOack (
   The packet process callback for MTFTP download.\r
 \r
   @param  UdpPacket             The packet received\r
-  @param  Points                The local/remote access point of the packet\r
+  @param  EndPoint              The local/remote access point of the packet\r
   @param  IoStatus              The status of the receiving\r
   @param  Context               Opaque parameter, which is the MTFTP session\r
 \r
@@ -606,7 +607,7 @@ Mtftp4RrqHandleOack (
 VOID\r
 Mtftp4RrqInput (\r
   IN NET_BUF                *UdpPacket,\r
-  IN UDP_POINTS             *Points,\r
+  IN UDP_END_POINT          *EndPoint,\r
   IN EFI_STATUS             IoStatus,\r
   IN VOID                   *Context\r
   )\r
@@ -637,7 +638,7 @@ Mtftp4RrqInput (
   //\r
   // Find the port this packet is from to restart receive correctly.\r
   //\r
-  Multicast = (BOOLEAN) (Points->LocalAddr == Instance->McastIp);\r
+  Multicast = (BOOLEAN) (EndPoint->LocalAddr.Addr[0] == Instance->McastIp);\r
 \r
   if (UdpPacket->TotalSize < MTFTP4_OPCODE_LEN) {\r
     goto ON_EXIT;\r
@@ -649,11 +650,11 @@ Mtftp4RrqInput (
   // is required to use the same port as RemotePort to multicast the\r
   // data.\r
   //\r
-  if (Points->RemotePort != Instance->ConnectedPort) {\r
+  if (EndPoint->RemotePort != Instance->ConnectedPort) {\r
     if (Instance->ConnectedPort != 0) {\r
       goto ON_EXIT;\r
     } else {\r
-      Instance->ConnectedPort = Points->RemotePort;\r
+      Instance->ConnectedPort = EndPoint->RemotePort;\r
     }\r
   }\r
 \r
index 5c8516f6307496fb60dabb078beaeb3ded02cbb2..a758f4bb0c998c3e9ba24c802ce83481e617331e 100644 (file)
@@ -359,7 +359,7 @@ Mtftp4SendError (
   It simply frees the packet.\r
 \r
   @param  Packet                The transmitted (or failed to) packet\r
-  @param  Points                The local and remote UDP access point\r
+  @param  EndPoint              The local and remote UDP access point\r
   @param  IoStatus              The result of the transmission\r
   @param  Context               Opaque parameter to the callback\r
 \r
@@ -367,7 +367,7 @@ Mtftp4SendError (
 VOID\r
 Mtftp4OnPacketSent (\r
   IN NET_BUF                   *Packet,\r
-  IN UDP_POINTS                *Points,\r
+  IN UDP_END_POINT             *EndPoint,\r
   IN EFI_STATUS                IoStatus,\r
   IN VOID                      *Context\r
   )\r
@@ -415,7 +415,7 @@ Mtftp4SendPacket (
   IN OUT NET_BUF                *Packet\r
   )\r
 {\r
-  UDP_POINTS                UdpPoint;\r
+  UDP_END_POINT             UdpPoint;\r
   EFI_STATUS                Status;\r
   UINT16                    OpCode;\r
   UINT16                    Value;\r
@@ -427,14 +427,13 @@ Mtftp4SendPacket (
     NetbufFree (Instance->LastPacket);\r
   }\r
 \r
-  Instance->LastPacket  = Packet;\r
+  Instance->LastPacket        = Packet;\r
 \r
-  Instance->CurRetry    = 0;\r
+  Instance->CurRetry          = 0;\r
   Mtftp4SetTimeout (Instance);\r
 \r
-  UdpPoint.LocalAddr    = 0;\r
-  UdpPoint.LocalPort    = 0;\r
-  UdpPoint.RemoteAddr   = Instance->ServerIp;\r
+  ZeroMem (&UdpPoint, sizeof (UdpPoint));\r
+  UdpPoint.RemoteAddr.Addr[0] = Instance->ServerIp;\r
 \r
   //\r
   // Send the requests to the listening port, other packets\r
@@ -457,7 +456,7 @@ Mtftp4SendPacket (
              Instance->UnicastPort,\r
              Packet,\r
              &UdpPoint,\r
-             0,\r
+             NULL,\r
              Mtftp4OnPacketSent,\r
              Instance\r
              );\r
@@ -484,16 +483,15 @@ Mtftp4Retransmit (
   IN MTFTP4_PROTOCOL        *Instance\r
   )\r
 {\r
-  UDP_POINTS                UdpPoint;\r
+  UDP_END_POINT             UdpPoint;\r
   EFI_STATUS                Status;\r
   UINT16                    OpCode;\r
   UINT16                    Value;\r
 \r
   ASSERT (Instance->LastPacket != NULL);\r
 \r
-  UdpPoint.LocalAddr  = 0;\r
-  UdpPoint.LocalPort  = 0;\r
-  UdpPoint.RemoteAddr = Instance->ServerIp;\r
+  ZeroMem (&UdpPoint, sizeof (UdpPoint));\r
+  UdpPoint.RemoteAddr.Addr[0] = Instance->ServerIp;\r
 \r
   //\r
   // Set the requests to the listening port, other packets to the connected port\r
@@ -514,7 +512,7 @@ Mtftp4Retransmit (
              Instance->UnicastPort,\r
              Instance->LastPacket,\r
              &UdpPoint,\r
-             0,\r
+             NULL,\r
              Mtftp4OnPacketSent,\r
              Instance\r
              );\r
index 872b2953c2897fa0a1b9fe469a97fb46ea8d4adb..87ec0c1d64e4caf48899b228dfbaa9de3ad105a4 100644 (file)
@@ -329,7 +329,7 @@ Mtftp4WrqHandleOack (
   The input process routine for MTFTP upload.\r
 \r
   @param  UdpPacket             The received MTFTP packet.\r
-  @param  Points                The local/remote access point\r
+  @param  EndPoint              The local/remote access point\r
   @param  IoStatus              The result of the packet receiving\r
   @param  Context               Opaque parameter for the callback, which is the\r
                                 MTFTP session.\r
@@ -337,7 +337,7 @@ Mtftp4WrqHandleOack (
 VOID\r
 Mtftp4WrqInput (\r
   IN NET_BUF                *UdpPacket,\r
-  IN UDP_POINTS             *Points,\r
+  IN UDP_END_POINT          *EndPoint,\r
   IN EFI_STATUS             IoStatus,\r
   IN VOID                   *Context\r
   )\r
@@ -371,11 +371,11 @@ Mtftp4WrqInput (
   // Client send initial request to server's listening port. Server\r
   // will select a UDP port to communicate with the client.\r
   //\r
-  if (Points->RemotePort != Instance->ConnectedPort) {\r
+  if (EndPoint->RemotePort != Instance->ConnectedPort) {\r
     if (Instance->ConnectedPort != 0) {\r
       goto ON_EXIT;\r
     } else {\r
-      Instance->ConnectedPort = Points->RemotePort;\r
+      Instance->ConnectedPort = EndPoint->RemotePort;\r
     }\r
   }\r
 \r
index 09388b5d83b7308d45a523a8936716cfb196c16b..f43043758ec4e5b7ae5d6891b7eacc20ee1e9939 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Tcp driver function header.\r
 \r
-Copyright (c) 2005 - 2006, Intel Corporation<BR>\r
+Copyright (c) 2005 - 2009, Intel Corporation<BR>\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
@@ -78,7 +78,7 @@ typedef struct _TCP4_PROTO_DATA {
 VOID\r
 Tcp4RxCallback (\r
   IN EFI_STATUS                       Status,\r
-  IN ICMP_ERROR                       IcmpErr,\r
+  IN UINT8                            IcmpErr,\r
   IN EFI_NET_SESSION_DATA             *NetSession,\r
   IN NET_BUF                          *Pkt,\r
   IN VOID                             *Context    OPTIONAL\r
index fc14b3b4a66e46346be26006b74302dfdde5bf46..2c6054b5b32539256e21ab66ac38be22f9036485 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Tcp function header file.\r
 \r
-Copyright (c) 2005 - 2006, Intel Corporation<BR>\r
+Copyright (c) 2005 - 2009, Intel Corporation<BR>\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
@@ -433,7 +433,7 @@ TcpGetMaxSndNxt (
 VOID\r
 TcpIcmpInput (\r
   IN NET_BUF     *Nbuf,\r
-  IN ICMP_ERROR  IcmpErr,\r
+  IN UINT8       IcmpErr,\r
   IN UINT32      Src,\r
   IN UINT32      Dst\r
   );\r
index a2cf20edf18ce54c2f3d33e8a696db63630890fc..b29e6cb67202abfc70955bdcb93fbdd89f4c82c1 100644 (file)
@@ -1407,7 +1407,7 @@ DISCARD:
 VOID\r
 TcpIcmpInput (\r
   IN NET_BUF     *Nbuf,\r
-  IN ICMP_ERROR  IcmpErr,\r
+  IN UINT8       IcmpErr,\r
   IN UINT32      Src,\r
   IN UINT32      Dst\r
   )\r
index 39e8fbe9df9192180ea465c48bc68641e95e5b7c..3adf356e0b9e4ebf31ecde7617ebcd9d5b5dd1c2 100644 (file)
@@ -30,7 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 VOID\r
 Tcp4RxCallback (\r
   IN EFI_STATUS                       Status,\r
-  IN ICMP_ERROR                       IcmpErr,\r
+  IN UINT8                            IcmpErr,\r
   IN EFI_NET_SESSION_DATA             *NetSession,\r
   IN NET_BUF                          *Pkt,\r
   IN VOID                             *Context    OPTIONAL\r
index b0bc0ae43df9f550747f4ff21d5937f8dc472132..c923117a1c8762e2d692bb7c5773834d8e0f2ed7 100644 (file)
@@ -86,7 +86,7 @@ Udp4DgramSent (
 VOID\r
 Udp4DgramRcvd (\r
   IN EFI_STATUS            Status,\r
-  IN ICMP_ERROR            IcmpError,\r
+  IN UINT8                 IcmpError,\r
   IN EFI_NET_SESSION_DATA  *NetSession,\r
   IN NET_BUF               *Packet,\r
   IN VOID                  *Context\r
@@ -227,7 +227,7 @@ Udp4Demultiplex (
 VOID\r
 Udp4IcmpHandler (\r
   IN UDP4_SERVICE_DATA     *Udp4Service,\r
-  IN ICMP_ERROR            IcmpError,\r
+  IN UINT8                 IcmpError,\r
   IN EFI_NET_SESSION_DATA  *NetSession,\r
   IN NET_BUF               *Packet\r
   );\r
@@ -1029,7 +1029,7 @@ Udp4DgramSent (
 VOID\r
 Udp4DgramRcvd (\r
   IN EFI_STATUS            Status,\r
-  IN ICMP_ERROR            IcmpError,\r
+  IN UINT8                 IcmpError,\r
   IN EFI_NET_SESSION_DATA  *NetSession,\r
   IN NET_BUF               *Packet,\r
   IN VOID                  *Context\r
@@ -1780,7 +1780,7 @@ Udp4SendPortUnreach (
 VOID\r
 Udp4IcmpHandler (\r
   IN UDP4_SERVICE_DATA     *Udp4Service,\r
-  IN ICMP_ERROR            IcmpError,\r
+  IN UINT8                 IcmpError,\r
   IN EFI_NET_SESSION_DATA  *NetSession,\r
   IN NET_BUF               *Packet\r
   )\r