]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.h
ECP_PEI_PCI_CFG_PPI should be passed to ECP_PEI_PCI_CFG_PPI's function.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Input.h
CommitLineData
83cbd279 1/** @file\r
2\r
3Copyright (c) 2005 - 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Ip4Input.h\r
15\r
16Abstract:\r
17\r
18\r
19**/\r
20\r
21#ifndef __EFI_IP4_INPUT_H__\r
22#define __EFI_IP4_INPUT_H__\r
23\r
24enum {\r
25 IP4_MIN_HEADLEN = 20,\r
26 IP4_MAX_HEADLEN = 60,\r
27\r
28 IP4_ASSEMLE_HASH_SIZE = 31,\r
29 IP4_FRAGMENT_LIFE = 120,\r
30 IP4_MAX_PACKET_SIZE = 65535\r
31};\r
32\r
33//\r
34// Per packet information for input process. LinkFlag specifies whether\r
35// the packet is received as Link layer unicast, multicast or broadcast.\r
36// The CastType is the IP layer cast type, such as IP multicast or unicast.\r
37// Start, End and Length are staffs used to assemble the packets. Start\r
38// is the sequence number of the first byte of data in the packet. Length\r
39// is the number of bytes of data. End = Start + Length, that is, the\r
40// sequence number of last byte + 1. Each assembled packet has a count down\r
41// life. If it isn't consumed before Life reaches zero, the packet is released.\r
42//\r
43typedef struct {\r
44 UINTN LinkFlag;\r
45 INTN CastType;\r
46 INTN Start;\r
47 INTN End;\r
48 INTN Length;\r
49 UINT32 Life;\r
50 EFI_STATUS Status;\r
51} IP4_CLIP_INFO;\r
52\r
53//\r
54// Structure used to assemble IP packets.\r
55//\r
56typedef struct {\r
e48e37fc 57 LIST_ENTRY Link;\r
83cbd279 58\r
59 //\r
60 // Identity of one IP4 packet. Each fragment of a packet has\r
61 // the same (Dst, Src, Id, Protocol).\r
62 //\r
63 IP4_ADDR Dst;\r
64 IP4_ADDR Src;\r
65 UINT16 Id;\r
66 UINT8 Protocol;\r
67\r
68 INTN TotalLen;\r
69 INTN CurLen;\r
e48e37fc 70 LIST_ENTRY Fragments; // List of all the fragments of this packet\r
83cbd279 71\r
72 IP4_HEAD *Head; // IP head of the first fragment\r
73 IP4_CLIP_INFO *Info; // Per packet info of the first fragment\r
74 INTN Life; // Count down life for the packet.\r
75} IP4_ASSEMBLE_ENTRY;\r
76\r
77//\r
78// Each Ip service instance has an assemble table to reassemble\r
79// the packets before delivery to its children. It is organized\r
80// as hash table.\r
81//\r
82typedef struct {\r
e48e37fc 83 LIST_ENTRY Bucket[IP4_ASSEMLE_HASH_SIZE];\r
83cbd279 84} IP4_ASSEMBLE_TABLE;\r
85\r
86#define IP4_GET_CLIP_INFO(Packet) ((IP4_CLIP_INFO *) ((Packet)->ProtoData))\r
87\r
88#define IP4_ASSEMBLE_HASH(Dst, Src, Id, Proto) \\r
89 (((Dst) + (Src) + ((Id) << 16) + (Proto)) % IP4_ASSEMLE_HASH_SIZE)\r
90\r
91#define IP4_RXDATA_WRAP_SIZE(NumFrag) \\r
92 (sizeof (IP4_RXDATA_WRAP) + sizeof (EFI_IP4_FRAGMENT_DATA) * ((NumFrag) - 1))\r
93\r
94VOID\r
95Ip4InitAssembleTable (\r
96 IN IP4_ASSEMBLE_TABLE *Table\r
97 );\r
98\r
99VOID\r
100Ip4CleanAssembleTable (\r
101 IN IP4_ASSEMBLE_TABLE *Table\r
102 );\r
103\r
104VOID\r
105Ip4AccpetFrame (\r
106 IN IP4_PROTOCOL *Ip4Instance,\r
107 IN NET_BUF *Packet,\r
108 IN EFI_STATUS IoStatus,\r
109 IN UINT32 Flag,\r
110 IN VOID *Context\r
111 );\r
112\r
113EFI_STATUS\r
114Ip4Demultiplex (\r
115 IN IP4_SERVICE *SbInstance,\r
116 IN IP4_HEAD *Head,\r
117 IN NET_BUF *Packet\r
118 );\r
119\r
120INTN\r
121Ip4InterfaceEnquePacket (\r
122 IN IP4_SERVICE *SbInstance,\r
123 IN IP4_HEAD *Head,\r
124 IN NET_BUF *Packet,\r
125 IN IP4_INTERFACE *Interface\r
126 );\r
127\r
128EFI_STATUS\r
129Ip4InstanceDeliverPacket (\r
130 IN IP4_PROTOCOL *Ip4Instance\r
131 );\r
132\r
133VOID\r
134Ip4PacketTimerTicking (\r
135 IN IP4_SERVICE *IpSb\r
136 );\r
137\r
138#endif\r