summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe
diff options
context:
space:
mode:
authortye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-04 08:18:34 +0000
committertye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-04 08:18:34 +0000
commitf6b7393ceb34c9b3a27434268bf2ce517047641f (patch)
treee0183d3d6c4773dec89876ab0aa2f85df5202cc4 /MdeModulePkg/Universal/Network/Ip4Dxe
parent7be273b7f583ef202bb4e3d4cede9e332cb306e5 (diff)
downloadedk2-platforms-f6b7393ceb34c9b3a27434268bf2ce517047641f.tar.xz
[Change summary]:
1. Update NetLib to a combined NetLib support dual network stack: 1) Add Network Debug facility for IPv4 stack. 2) Extend the library APIs to support IPv6 stack: a. NetIp6IsUnspecifiedAddr b. NetIp6IsLinkLocalAddr c. NetIp6IsNetEqual d. NetLibCreateIPv6DPathNode. e. NetIp6PseudoHeadChecksum f. NetIp6IsValidUnicast 3) Update the structure definitions: a. Update NET_BUF to add EFI_IP6_HEADER and EFI_UDP_HEADER b. Add NET_IP6_PSEUDO_HDR 4) Update Ip4IsUnicast to NetIp4IsUnicast 2. Update the impacted modules to adopt the combined NetLib. 3. Clean up coding style errors in all network drivers and libraries. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9391 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h60
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c6
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h72
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h12
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h26
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c2
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h51
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c22
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h14
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h16
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c4
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c8
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h14
13 files changed, 143 insertions, 164 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
index af01a03b00..0e221f7c62 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
@@ -1,7 +1,7 @@
/** @file
Common definition for IP4.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -19,38 +19,32 @@ typedef struct _IP4_INTERFACE IP4_INTERFACE;
typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
typedef struct _IP4_SERVICE IP4_SERVICE;
-
-typedef enum {
- IP4_ETHER_PROTO = 0x0800,
-
- IP4_PROTO_ICMP = 0x01,
- IP4_PROTO_IGMP = 0x02,
-
- //
- // The packet is received as link level broadcast/multicast/promiscuous.
- //
- IP4_LINK_BROADCAST = 0x00000001,
- IP4_LINK_MULTICAST = 0x00000002,
- IP4_LINK_PROMISC = 0x00000004,
-
- //
- // IP4 address cast type classfication. Keep it true that any
- // type bigger than or equal to LOCAL_BROADCAST is broadcast.
- //
- IP4_PROMISCUOUS = 1,
- IP4_LOCAL_HOST,
- IP4_MULTICAST,
- IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255
- IP4_SUBNET_BROADCAST,
- IP4_NET_BROADCAST,
-
- //
- // IP4 header flags
- //
- IP4_HEAD_DF_MASK = 0x4000,
- IP4_HEAD_MF_MASK = 0x2000,
- IP4_HEAD_OFFSET_MASK = 0x1fff
-} IP_ENUM_TYPES;
+#define IP4_ETHER_PROTO 0x0800
+
+//
+// The packet is received as link level broadcast/multicast/promiscuous.
+//
+#define IP4_LINK_BROADCAST 0x00000001
+#define IP4_LINK_MULTICAST 0x00000002
+#define IP4_LINK_PROMISC 0x00000004
+
+//
+// IP4 address cast type classfication. Keep it true that any
+// type bigger than or equal to LOCAL_BROADCAST is broadcast.
+//
+#define IP4_PROMISCUOUS 1
+#define IP4_LOCAL_HOST 2
+#define IP4_MULTICAST 3
+#define IP4_LOCAL_BROADCAST 4 // Destination is 255.255.255.255
+#define IP4_SUBNET_BROADCAST 5
+#define IP4_NET_BROADCAST 6
+
+//
+// IP4 header flags
+//
+#define IP4_HEAD_DF_MASK 0x4000
+#define IP4_HEAD_MF_MASK 0x2000
+#define IP4_HEAD_OFFSET_MASK 0x1fff
#define IP4_ALLZERO_ADDRESS 0x00000000u
#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
index 757d7aadc0..76208e071b 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -62,7 +62,7 @@ mIp4SupportedIcmp[23] = {
{ICMP_ECHO_REQUEST, ICMP_DEFAULT_CODE },
{ICMP_TIME_EXCEEDED, ICMP_TIMEOUT_IN_TRANSIT },
- {ICMP_TIME_EXCEEDED, ICMp_TIMEOUT_REASSEMBLE },
+ {ICMP_TIME_EXCEEDED, ICMP_TIMEOUT_REASSEMBLE },
{ICMP_PARAMETER_PROBLEM, ICMP_DEFAULT_CODE },
};
@@ -247,7 +247,7 @@ Ip4IcmpReplyEcho (
ReplyHead.Tos = 0;
ReplyHead.Fragment = 0;
ReplyHead.Ttl = 64;
- ReplyHead.Protocol = IP4_PROTO_ICMP;
+ ReplyHead.Protocol = EFI_IP_PROTO_ICMP;
ReplyHead.Src = 0;
//
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
index f9db6a3da4..2488e61060 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.h
@@ -1,7 +1,7 @@
/** @file
Header file for ICMP protocol.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -15,63 +15,61 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_IP4_ICMP_H__
#define __EFI_IP4_ICMP_H__
-typedef enum {
//
// ICMP type definations
//
- ICMP_ECHO_REPLY = 0,
- ICMP_DEST_UNREACHABLE = 3,
- ICMP_SOURCE_QUENCH = 4,
- ICMP_REDIRECT = 5,
- ICMP_ECHO_REQUEST = 8,
- ICMP_TIME_EXCEEDED = 11,
- ICMP_PARAMETER_PROBLEM = 12,
- ICMP_TIMESTAMP = 13,
- ICMP_INFO_REQUEST = 15,
- ICMP_INFO_REPLY = 16,
- ICMP_TYPE_MAX = ICMP_INFO_REPLY,
+#define ICMP_ECHO_REPLY 0
+#define ICMP_DEST_UNREACHABLE 3
+#define ICMP_SOURCE_QUENCH 4
+#define ICMP_REDIRECT 5
+#define ICMP_ECHO_REQUEST 8
+#define ICMP_TIME_EXCEEDED 11
+#define ICMP_PARAMETER_PROBLEM 12
+#define ICMP_TIMESTAMP 13
+#define ICMP_INFO_REQUEST 15
+#define ICMP_INFO_REPLY 16
+#define ICMP_TYPE_MAX ICMP_INFO_REPLY
- ICMP_DEFAULT_CODE = 0,
+#define ICMP_DEFAULT_CODE 0
//
// ICMP code definations for ICMP_DEST_UNREACHABLE
//
- ICMP_NET_UNREACHABLE = 0,
- ICMP_HOST_UNREACHABLE = 1,
- ICMP_PROTO_UNREACHABLE = 2, // Host may generate
- ICMP_PORT_UNREACHABLE = 3, // Host may generate
- ICMP_FRAGMENT_FAILED = 4,
- ICMP_SOURCEROUTE_FAILED = 5, // Host may generate
- ICMP_NET_UNKNOWN = 6,
- ICMP_HOST_UNKNOWN = 7,
- ICMP_SOURCE_ISOLATED = 8,
- ICMP_NET_PROHIBITED = 9,
- ICMP_HOST_PROHIBITED = 10,
- ICMP_NET_UNREACHABLE_TOS = 11,
- ICMP_HOST_UNREACHABLE_TOS = 12,
+#define ICMP_NET_UNREACHABLE 0
+#define ICMP_HOST_UNREACHABLE 1
+#define ICMP_PROTO_UNREACHABLE 2 // Host may generate
+#define ICMP_PORT_UNREACHABLE 3 // Host may generate
+#define ICMP_FRAGMENT_FAILED 4
+#define ICMP_SOURCEROUTE_FAILED 5 // Host may generate
+#define ICMP_NET_UNKNOWN 6
+#define ICMP_HOST_UNKNOWN 7
+#define ICMP_SOURCE_ISOLATED 8
+#define ICMP_NET_PROHIBITED 9
+#define ICMP_HOST_PROHIBITED 10
+#define ICMP_NET_UNREACHABLE_TOS 11
+#define ICMP_HOST_UNREACHABLE_TOS 12
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
- ICMP_TIMEOUT_IN_TRANSIT = 0,
- ICMp_TIMEOUT_REASSEMBLE = 1, // Host may generate
+#define ICMP_TIMEOUT_IN_TRANSIT 0
+#define ICMP_TIMEOUT_REASSEMBLE 1 // Host may generate
//
// ICMP code definations for ICMP_TIME_EXCEEDED
//
- ICMP_NET_REDIRECT = 0,
- ICMP_HOST_REDIRECT = 1,
- ICMP_NET_TOS_REDIRECT = 2,
- ICMP_HOST_TOS_REDIRECT = 3,
+#define ICMP_NET_REDIRECT 0
+#define ICMP_HOST_REDIRECT 1
+#define ICMP_NET_TOS_REDIRECT 2
+#define ICMP_HOST_TOS_REDIRECT 3
//
// ICMP message classes, each class of ICMP message shares
// a common message format. INVALID_MESSAGE is only a flag.
//
- ICMP_INVALID_MESSAGE = 0,
- ICMP_ERROR_MESSAGE = 1,
- ICMP_QUERY_MESSAGE = 2
-} ICMP_ENUM_TYPES;
+#define ICMP_INVALID_MESSAGE 0
+#define ICMP_ERROR_MESSAGE 1
+#define ICMP_QUERY_MESSAGE 2
typedef struct {
UINT8 IcmpType;
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
index 305e826a8d..2032c6d28d 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h
@@ -1,7 +1,7 @@
/** @file
Definition for IP4 pesudo interface structure.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -15,12 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_IP4_IF_H__
#define __EFI_IP4_IF_H__
-typedef enum {
- IP4_FRAME_RX_SIGNATURE = SIGNATURE_32 ('I', 'P', 'F', 'R'),
- IP4_FRAME_TX_SIGNATURE = SIGNATURE_32 ('I', 'P', 'F', 'T'),
- IP4_FRAME_ARP_SIGNATURE = SIGNATURE_32 ('I', 'P', 'F', 'A'),
- IP4_INTERFACE_SIGNATURE = SIGNATURE_32 ('I', 'P', 'I', 'F')
-} IP4_IF_ENUM_TYPES;
+#define IP4_FRAME_RX_SIGNATURE SIGNATURE_32 ('I', 'P', 'F', 'R')
+#define IP4_FRAME_TX_SIGNATURE SIGNATURE_32 ('I', 'P', 'F', 'T')
+#define IP4_FRAME_ARP_SIGNATURE SIGNATURE_32 ('I', 'P', 'F', 'A')
+#define IP4_INTERFACE_SIGNATURE SIGNATURE_32 ('I', 'P', 'I', 'F')
/**
This prototype is used by both receive and transmission.
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
index b82d3cc3ea..549d4a2176 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -14,6 +14,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_IP4_IGMP_H__
#define __EFI_IP4_IGMP_H__
+//
+// IGMP message type
+//
+#define IGMP_MEMBERSHIP_QUERY 0x11
+#define IGMP_V1_MEMBERSHIP_REPORT 0x12
+#define IGMP_V2_MEMBERSHIP_REPORT 0x16
+#define IGMP_LEAVE_GROUP 0x17
+
+#define IGMP_V1ROUTER_PRESENT 400
+#define IGMP_UNSOLICIATED_REPORT 10
+
#pragma pack(1)
typedef struct {
UINT8 Type;
@@ -48,19 +59,6 @@ typedef struct {
LIST_ENTRY Groups;
} IGMP_SERVICE_DATA;
-typedef enum {
- //
- // IGMP message type
- //
- IGMP_MEMBERSHIP_QUERY = 0x11,
- IGMP_V1_MEMBERSHIP_REPORT = 0x12,
- IGMP_V2_MEMBERSHIP_REPORT = 0x16,
- IGMP_LEAVE_GROUP = 0x17,
-
- IGMP_V1ROUTER_PRESENT = 400,
- IGMP_UNSOLICIATED_REPORT = 10
-} IGMP_ENUM_TYPES;
-
/**
Init the IGMP control data of the IP4 service instance, configure
MNP to receive ALL SYSTEM multicast.
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 714f3d9b82..4788d403fe 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -1962,7 +1962,7 @@ EfiIp4Transmit (
// a IP4_TXTOKEN_WRAP and the data in a netbuf
//
Status = EFI_OUT_OF_RESOURCES;
- Wrap = AllocatePool (sizeof (IP4_TXTOKEN_WRAP));
+ Wrap = AllocateZeroPool (sizeof (IP4_TXTOKEN_WRAP));
if (Wrap == NULL) {
goto ON_EXIT;
}
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
index 615e5ae2a8..8b2e286f0c 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.h
@@ -1,7 +1,7 @@
/** @file
Ip4 internal functions and type defintions.
-Copyright (c) 2005 - 2007, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -43,34 +43,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Ip4Input.h"
#include "Ip4Output.h"
+#define IP4_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'P')
+#define IP4_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'S')
+
+//
+// The state of IP4 protocol. It starts from UNCONFIGED. if it is
+// successfully configured, it goes to CONFIGED. if configure NULL
+// is called, it becomes UNCONFIGED again. If (partly) destoried, it
+// becomes DESTORY.
+//
+#define IP4_STATE_UNCONFIGED 0
+#define IP4_STATE_CONFIGED 1
+#define IP4_STATE_DESTORY 2
+
+//
+// The state of IP4 service. It starts from UNSTARTED. It transits
+// to STARTED if autoconfigure is started. If default address is
+// configured, it becomes CONFIGED. and if partly destoried, it goes
+// to DESTORY.
+//
+#define IP4_SERVICE_UNSTARTED 0
+#define IP4_SERVICE_STARTED 1
+#define IP4_SERVICE_CONFIGED 2
+#define IP4_SERVICE_DESTORY 3
-typedef enum {
- IP4_PROTOCOL_SIGNATURE = SIGNATURE_32 ('I', 'P', '4', 'P'),
- IP4_SERVICE_SIGNATURE = SIGNATURE_32 ('I', 'P', '4', 'S'),
-
- //
- // The state of IP4 protocol. It starts from UNCONFIGED. if it is
- // successfully configured, it goes to CONFIGED. if configure NULL
- // is called, it becomes UNCONFIGED again. If (partly) destoried, it
- // becomes DESTORY.
- //
- IP4_STATE_UNCONFIGED = 0,
- IP4_STATE_CONFIGED,
- IP4_STATE_DESTORY,
-
- //
- // The state of IP4 service. It starts from UNSTARTED. It transits
- // to STARTED if autoconfigure is started. If default address is
- // configured, it becomes CONFIGED. and if partly destoried, it goes
- // to DESTORY.
- //
- IP4_SERVICE_UNSTARTED = 0,
- IP4_SERVICE_STARTED,
- IP4_SERVICE_CONFIGED,
- IP4_SERVICE_DESTORY
-} IP4_IMPL_ENUM_TYPES;
-
///
/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
/// The user's data is kept in the Packet. When fragment is
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
index b495e75deb..7257353301 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
@@ -228,7 +228,7 @@ Ip4Reassemble (
NET_BUF *NewPacket;
INTN Index;
- IpHead = Packet->Ip;
+ IpHead = Packet->Ip.Ip4;
This = IP4_GET_CLIP_INFO (Packet);
ASSERT (IpHead != NULL);
@@ -417,7 +417,7 @@ Ip4Reassemble (
return NULL;
}
- NewPacket->Ip = Assemble->Head;
+ NewPacket->Ip.Ip4 = Assemble->Head;
CopyMem (IP4_GET_CLIP_INFO (NewPacket), Assemble->Info, sizeof (*IP4_GET_CLIP_INFO (NewPacket)));
return NewPacket;
}
@@ -501,7 +501,7 @@ Ip4AccpetFrame (
//
// Convert the IP header to host byte order, then get the per packet info.
//
- Packet->Ip = Ip4NtohHead (Head);
+ Packet->Ip.Ip4 = Ip4NtohHead (Head);
Info = IP4_GET_CLIP_INFO (Packet);
Info->LinkFlag = Flag;
@@ -570,11 +570,11 @@ Ip4AccpetFrame (
// info must be reloaded bofore use. The ownership of the packet
// is transfered to the packet process logic.
//
- Head = Packet->Ip;
+ Head = Packet->Ip.Ip4;
IP4_GET_CLIP_INFO (Packet)->Status = EFI_SUCCESS;
switch (Head->Protocol) {
- case IP4_PROTO_ICMP:
+ case EFI_IP_PROTO_ICMP:
Ip4IcmpHandle (IpSb, Head, Packet);
break;
@@ -655,7 +655,7 @@ Ip4InstanceFrameAcceptable (
//
Proto = Head->Protocol;
- if (Proto == IP4_PROTO_ICMP) {
+ if (Proto == EFI_IP_PROTO_ICMP) {
NetbufCopy (Packet, 0, sizeof (Icmp.Head), (UINT8 *) &Icmp.Head);
if (mIcmpClass[Icmp.Head.Type].IcmpClass == ICMP_ERROR_MESSAGE) {
@@ -850,13 +850,13 @@ Ip4WrapRxData (
return NULL;
}
- ASSERT (Packet->Ip != NULL);
+ ASSERT (Packet->Ip.Ip4 != NULL);
//
// The application expects a network byte order header.
//
- RxData->HeaderLength = (Packet->Ip->HeadLen << 2);
- RxData->Header = (EFI_IP4_HEADER *) Ip4NtohHead (Packet->Ip);
+ RxData->HeaderLength = (Packet->Ip.Ip4->HeadLen << 2);
+ RxData->Header = (EFI_IP4_HEADER *) Ip4NtohHead (Packet->Ip.Ip4);
RxData->OptionsLength = RxData->HeaderLength - IP4_MIN_HEADLEN;
RxData->Options = NULL;
@@ -938,9 +938,9 @@ Ip4InstanceDeliverPacket (
// may be not continuous before the data.
//
Head = NetbufAllocSpace (Dup, IP4_MAX_HEADLEN, NET_BUF_HEAD);
- Dup->Ip = (IP4_HEAD *) Head;
+ Dup->Ip.Ip4 = (IP4_HEAD *) Head;
- CopyMem (Head, Packet->Ip, Packet->Ip->HeadLen << 2);
+ CopyMem (Head, Packet->Ip.Ip4, Packet->Ip.Ip4->HeadLen << 2);
NetbufTrim (Dup, IP4_MAX_HEADLEN, TRUE);
Wrap = Ip4WrapRxData (IpInstance, Dup);
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
index eea4d7e0cf..cd1367b012 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -14,14 +14,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_IP4_INPUT_H__
#define __EFI_IP4_INPUT_H__
-typedef enum {
- IP4_MIN_HEADLEN = 20,
- IP4_MAX_HEADLEN = 60,
+#define IP4_MIN_HEADLEN 20
+#define IP4_MAX_HEADLEN 60
- IP4_ASSEMLE_HASH_SIZE = 31,
- IP4_FRAGMENT_LIFE = 120,
- IP4_MAX_PACKET_SIZE = 65535
-} IP4_INPUT_ENUM_TYPES;
+#define IP4_ASSEMLE_HASH_SIZE 31
+#define IP4_FRAGMENT_LIFE 120
+#define IP4_MAX_PACKET_SIZE 65535
///
/// Per packet information for input process. LinkFlag specifies whether
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
index 206c92031d..421872c2ed 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
@@ -1,7 +1,7 @@
/** @file
IP4 option support routines.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -15,15 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __EFI_IP4_OPTION_H__
#define __EFI_IP4_OPTION_H__
-typedef enum {
- IP4_OPTION_EOP = 0,
- IP4_OPTION_NOP = 1,
- IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
- IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
- IP4_OPTION_RR = 7, // Record routing, 00000111
+#define IP4_OPTION_EOP 0
+#define IP4_OPTION_NOP 1
+#define IP4_OPTION_LSRR 131 // Loss source and record routing, 10000011
+#define IP4_OPTION_SSRR 137 // Strict source and record routing, 10001001
+#define IP4_OPTION_RR 7 // Record routing, 00000111
- IP4_OPTION_COPY_MASK = 0x80
-} IP4_OPTION_ENUM_TYPES;
+#define IP4_OPTION_COPY_MASK 0x80
/**
Validate the IP4 option format for both the packets we received
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
index 306ab2ddf6..53317c829b 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
@@ -1,7 +1,7 @@
/** @file
Transmit the IP4 packet.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -83,7 +83,7 @@ Ip4PrependHead (
PacketHead->Dst = HTONL (Head->Dst);
PacketHead->Checksum = (UINT16) (~NetblockChecksum ((UINT8 *) PacketHead, HeadLen));
- Packet->Ip = PacketHead;
+ Packet->Ip.Ip4 = PacketHead;
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c
index 4c238a6e02..0c901e8266 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -145,7 +145,7 @@ Ip4InitRouteCache (
{
UINT32 Index;
- for (Index = 0; Index < IP4_ROUTE_CACHE_HASH; Index++) {
+ for (Index = 0; Index < IP4_ROUTE_CACHE_HASH_VALUE; Index++) {
InitializeListHead (&(RtCache->CacheBucket[Index]));
}
}
@@ -168,7 +168,7 @@ Ip4CleanRouteCache (
IP4_ROUTE_CACHE_ENTRY *RtCacheEntry;
UINT32 Index;
- for (Index = 0; Index < IP4_ROUTE_CACHE_HASH; Index++) {
+ for (Index = 0; Index < IP4_ROUTE_CACHE_HASH_VALUE; Index++) {
NET_LIST_FOR_EACH_SAFE (Entry, Next, &(RtCache->CacheBucket[Index])) {
RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_CACHE_ENTRY, Link);
@@ -278,7 +278,7 @@ Ip4PurgeRouteCache (
IP4_ROUTE_CACHE_ENTRY *RtCacheEntry;
UINT32 Index;
- for (Index = 0; Index < IP4_ROUTE_CACHE_HASH; Index++) {
+ for (Index = 0; Index < IP4_ROUTE_CACHE_HASH_VALUE; Index++) {
NET_LIST_FOR_EACH_SAFE (Entry, Next, &RtCache->CacheBucket[Index]) {
RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_CACHE_ENTRY, Link);
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
index ee1f6a907f..774dd60842 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Route.h
@@ -1,7 +1,7 @@
/** @file
EFI IP4 route table and route cache table defintions.
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>
+Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -17,14 +17,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Ip4Common.h"
-typedef enum {
- IP4_DIRECT_ROUTE = 0x00000001,
+#define IP4_DIRECT_ROUTE 0x00000001
- IP4_ROUTE_CACHE_HASH = 31,
- IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
-} IP4_ROUTE_ENUM_TYPES;
+#define IP4_ROUTE_CACHE_HASH_VALUE 31
+#define IP4_ROUTE_CACHE_MAX 64 // Max NO. of cache entry per hash bucket
-#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
+#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH_VALUE)
///
/// The route entry in the route table. Dest/Netmask is the destion
@@ -69,7 +67,7 @@ typedef struct {
/// detach them later.
///
typedef struct {
- LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
+ LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH_VALUE];
} IP4_ROUTE_CACHE;
///