1. Add new interface Ip6IsValidUnicast 
2. Add new enum IP6_EXTENSION_HEADER_TYPE
3. Add new structure IP6_ICMP_* definitions
4. Update structure from EFI_UDP4_HEADER to EFI_UDP_HEADER
5. Add new macro EFI_IP6_EQUAL


IpIoLib:
1. Update the IpIoLib to a combined library for both v4 and v6 network stack 
2. Fix a bug in IpIoIcmpHandler() - for IPv6 packet, the header length is variable (basic header + extension) rathar than fixed length.
   The fix removes the IPv6 header fields and notify the user with the ICMPv6 packet only containing payload.

TcpDxe/UdpDxe:
1. Update to adapt the new combined IpIoLib
2. Add gEfiIp6ProtocolGuid/gEfiIp6ServiceBindingProtocolGuid to [Protocols] in INF file since the Ip6.h is included in IpIoLib and NetLib.
3. Pass the TCP4/UDP4 UEFI SCT test on NT32 platform.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9374 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
tye
2009-10-26 10:15:40 +00:00
parent 326f0711dc
commit fb115c6150
14 changed files with 1217 additions and 312 deletions

View File

@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _NET_LIB_H_
#define _NET_LIB_H_
#include <Protocol/Ip6.h>
typedef UINT32 IP4_ADDR;
typedef UINT32 TCP_SEQNO;
typedef UINT16 TCP_PORTNO;
@@ -40,6 +42,15 @@ typedef enum {
IP4_MASK_NUM = 33
} IP4_CLASS_TYPE;
typedef enum {
IP6_HOP_BY_HOP = 0,
IP6_DESTINATION = 60,
IP6_FRAGMENT = 44,
IP6_AH = 51,
IP6_ESP = 50,
IP6_NO_NEXT_HEADER = 59
} IP6_EXTENSION_HEADER_TYPE;
#pragma pack(1)
//
@@ -95,6 +106,22 @@ typedef struct {
UINT16 Seq;
} IP4_ICMP_QUERY_HEAD;
typedef struct {
UINT8 Type;
UINT8 Code;
UINT16 Checksum;
} IP6_ICMP_HEAD;
typedef struct {
IP6_ICMP_HEAD Head;
UINT32 Fourth;
EFI_IP6_HEADER IpHead;
} IP6_ICMP_ERROR_HEAD;
typedef struct {
IP6_ICMP_HEAD Head;
UINT32 Fourth;
} IP6_ICMP_INFORMATION_HEAD;
//
// UDP header definition
@@ -104,8 +131,7 @@ typedef struct {
UINT16 DstPort;
UINT16 Length;
UINT16 Checksum;
} EFI_UDP4_HEADER;
} EFI_UDP_HEADER;
//
// TCP header definition
@@ -160,6 +186,9 @@ typedef struct {
#define EFI_NTOHL(EfiIp) (NTOHL (EFI_IP4 ((EfiIp))))
#define EFI_IP4_EQUAL(Ip1, Ip2) (CompareMem ((Ip1), (Ip2), sizeof (EFI_IPv4_ADDRESS)) == 0)
#define EFI_IP6_EQUAL(Ip1, Ip2) (CompareMem ((Ip1), (Ip2), sizeof (EFI_IPv6_ADDRESS)) == 0)
/**
Return the length of the mask.
@@ -227,6 +256,25 @@ Ip4IsUnicast (
IN IP4_ADDR NetMask
);
/**
Check whether the incoming IPv6 address is a valid unicast address.
If the address is a multicast address has binary 0xFF at the start, it is not
a valid unicast address. If the address is unspecified ::, it is not a valid
unicast address to be assigned to any node. If the address is loopback address
::1, it is also not a valid unicast address to be assigned to any physical
interface.
@param[in] Ip6 The IPv6 address to check against.
@return TRUE if Ip6 is a valid unicast address on the network, otherwise FALSE.
**/
BOOLEAN
Ip6IsValidUnicast (
IN EFI_IPv6_ADDRESS *Ip6
);
extern IP4_ADDR gIp4AllMasks[IP4_MASK_NUM];