-/** @file
-
-Copyright (c) 2005 - 2006, Intel Corporation
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ip4Input.h
-
-Abstract:
-
-
-**/
-
-#ifndef __EFI_IP4_INPUT_H__
-#define __EFI_IP4_INPUT_H__
-
-enum {
- IP4_MIN_HEADLEN = 20,
- IP4_MAX_HEADLEN = 60,
-
- IP4_ASSEMLE_HASH_SIZE = 31,
- IP4_FRAGMENT_LIFE = 120,
- IP4_MAX_PACKET_SIZE = 65535
-};
-
-//
-// Per packet information for input process. LinkFlag specifies whether
-// the packet is received as Link layer unicast, multicast or broadcast.
-// The CastType is the IP layer cast type, such as IP multicast or unicast.
-// Start, End and Length are staffs used to assemble the packets. Start
-// is the sequence number of the first byte of data in the packet. Length
-// is the number of bytes of data. End = Start + Length, that is, the
-// sequence number of last byte + 1. Each assembled packet has a count down
-// life. If it isn't consumed before Life reaches zero, the packet is released.
-//
-typedef struct {
- UINTN LinkFlag;
- INTN CastType;
- INTN Start;
- INTN End;
- INTN Length;
- UINT32 Life;
- EFI_STATUS Status;
-} IP4_CLIP_INFO;
-
-//
-// Structure used to assemble IP packets.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
-
- //
- // Identity of one IP4 packet. Each fragment of a packet has
- // the same (Dst, Src, Id, Protocol).
- //
- IP4_ADDR Dst;
- IP4_ADDR Src;
- UINT16 Id;
- UINT8 Protocol;
-
- INTN TotalLen;
- INTN CurLen;
- NET_LIST_ENTRY Fragments; // List of all the fragments of this packet
-
- IP4_HEAD *Head; // IP head of the first fragment
- IP4_CLIP_INFO *Info; // Per packet info of the first fragment
- INTN Life; // Count down life for the packet.
-} IP4_ASSEMBLE_ENTRY;
-
-//
-// Each Ip service instance has an assemble table to reassemble
-// the packets before delivery to its children. It is organized
-// as hash table.
-//
-typedef struct {
- NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];
-} IP4_ASSEMBLE_TABLE;
-
-#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))
-
-#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \
- (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)
-
-#define IP4_RXDATA_WRAP_SIZE(NumFrag) \
- (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))
-
-VOID
-Ip4InitAssembleTable (
- IN IP4_ASSEMBLE_TABLE *Table
- );
-
-VOID
-Ip4CleanAssembleTable (
- IN IP4_ASSEMBLE_TABLE *Table
- );
-
-VOID
-Ip4AccpetFrame (
- IN IP4_PROTOCOL *Ip4Instance,
- IN NET_BUF *Packet,
- IN EFI_STATUS IoStatus,
- IN UINT32 Flag,
- IN VOID *Context
- );
-
-EFI_STATUS
-Ip4Demultiplex (
- IN IP4_SERVICE *SbInstance,
- IN IP4_HEAD *Head,
- IN NET_BUF *Packet
- );
-
-INTN
-Ip4InterfaceEnquePacket (
- IN IP4_SERVICE *SbInstance,
- IN IP4_HEAD *Head,
- IN NET_BUF *Packet,
- IN IP4_INTERFACE *Interface
- );
-
-EFI_STATUS
-Ip4InstanceDeliverPacket (
- IN IP4_PROTOCOL *Ip4Instance
- );
-
-VOID
-Ip4PacketTimerTicking (
- IN IP4_SERVICE *IpSb
- );
-
-#endif
+/** @file\r
+\r
+Copyright (c) 2005 - 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+\r
+ Ip4Input.h\r
+\r
+Abstract:\r
+\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_INPUT_H__\r
+#define __EFI_IP4_INPUT_H__\r
+\r
+enum {\r
+ IP4_MIN_HEADLEN = 20,\r
+ IP4_MAX_HEADLEN = 60,\r
+\r
+ IP4_ASSEMLE_HASH_SIZE = 31,\r
+ IP4_FRAGMENT_LIFE = 120,\r
+ IP4_MAX_PACKET_SIZE = 65535\r
+};\r
+\r
+//\r
+// Per packet information for input process. LinkFlag specifies whether\r
+// the packet is received as Link layer unicast, multicast or broadcast.\r
+// The CastType is the IP layer cast type, such as IP multicast or unicast.\r
+// Start, End and Length are staffs used to assemble the packets. Start\r
+// is the sequence number of the first byte of data in the packet. Length\r
+// is the number of bytes of data. End = Start + Length, that is, the\r
+// sequence number of last byte + 1. Each assembled packet has a count down\r
+// life. If it isn't consumed before Life reaches zero, the packet is released.\r
+//\r
+typedef struct {\r
+ UINTN LinkFlag;\r
+ INTN CastType;\r
+ INTN Start;\r
+ INTN End;\r
+ INTN Length;\r
+ UINT32 Life;\r
+ EFI_STATUS Status;\r
+} IP4_CLIP_INFO;\r
+\r
+//\r
+// Structure used to assemble IP packets.\r
+//\r
+typedef struct {\r
+ NET_LIST_ENTRY Link;\r
+\r
+ //\r
+ // Identity of one IP4 packet. Each fragment of a packet has\r
+ // the same (Dst, Src, Id, Protocol).\r
+ //\r
+ IP4_ADDR Dst;\r
+ IP4_ADDR Src;\r
+ UINT16 Id;\r
+ UINT8 Protocol;\r
+\r
+ INTN TotalLen;\r
+ INTN CurLen;\r
+ NET_LIST_ENTRY Fragments; // List of all the fragments of this packet\r
+\r
+ IP4_HEAD *Head; // IP head of the first fragment\r
+ IP4_CLIP_INFO *Info; // Per packet info of the first fragment\r
+ INTN Life; // Count down life for the packet.\r
+} IP4_ASSEMBLE_ENTRY;\r
+\r
+//\r
+// Each Ip service instance has an assemble table to reassemble\r
+// the packets before delivery to its children. It is organized\r
+// as hash table.\r
+//\r
+typedef struct {\r
+ NET_LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];\r
+} IP4_ASSEMBLE_TABLE;\r
+\r
+#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))\r
+\r
+#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \\r
+ (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)\r
+\r
+#define IP4_RXDATA_WRAP_SIZE(NumFrag) \\r
+ (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))\r
+\r
+VOID\r
+Ip4InitAssembleTable (\r
+ IN IP4_ASSEMBLE_TABLE *Table\r
+ );\r
+\r
+VOID\r
+Ip4CleanAssembleTable (\r
+ IN IP4_ASSEMBLE_TABLE *Table\r
+ );\r
+\r
+VOID\r
+Ip4AccpetFrame (\r
+ IN IP4_PROTOCOL *Ip4Instance,\r
+ IN NET_BUF *Packet,\r
+ IN EFI_STATUS IoStatus,\r
+ IN UINT32 Flag,\r
+ IN VOID *Context\r
+ );\r
+\r
+EFI_STATUS\r
+Ip4Demultiplex (\r
+ IN IP4_SERVICE *SbInstance,\r
+ IN IP4_HEAD *Head,\r
+ IN NET_BUF *Packet\r
+ );\r
+\r
+INTN\r
+Ip4InterfaceEnquePacket (\r
+ IN IP4_SERVICE *SbInstance,\r
+ IN IP4_HEAD *Head,\r
+ IN NET_BUF *Packet,\r
+ IN IP4_INTERFACE *Interface\r
+ );\r
+\r
+EFI_STATUS\r
+Ip4InstanceDeliverPacket (\r
+ IN IP4_PROTOCOL *Ip4Instance\r
+ );\r
+\r
+VOID\r
+Ip4PacketTimerTicking (\r
+ IN IP4_SERVICE *IpSb\r
+ );\r
+\r
+#endif\r