TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Impl.h
Go to the documentation of this file.
1
11#ifndef __EFI_IP4_IMPL_H__
12#define __EFI_IP4_IMPL_H__
13
14#include <Uefi.h>
15
16#include <Protocol/IpSec.h>
17#include <Protocol/Ip4.h>
18#include <Protocol/Ip4Config2.h>
19#include <Protocol/Arp.h>
21#include <Protocol/Dhcp4.h>
24
26
27#include <Library/DebugLib.h>
31#include <Library/BaseLib.h>
32#include <Library/UefiLib.h>
33#include <Library/NetLib.h>
36#include <Library/DpcLib.h>
37#include <Library/PrintLib.h>
39#include <Library/HiiLib.h>
41
42#include "Ip4Common.h"
43#include "Ip4Driver.h"
44#include "Ip4If.h"
45#include "Ip4Icmp.h"
46#include "Ip4Option.h"
47#include "Ip4Igmp.h"
48#include "Ip4Route.h"
49#include "Ip4Input.h"
50#include "Ip4Output.h"
51#include "Ip4Config2Impl.h"
52#include "Ip4Config2Nv.h"
53#include "Ip4NvData.h"
54
55#define IP4_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'P')
56#define IP4_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'S')
57
58//
59// The state of IP4 protocol. It starts from UNCONFIGED. if it is
60// successfully configured, it goes to CONFIGED. if configure NULL
61// is called, it becomes UNCONFIGED again.
62//
63#define IP4_STATE_UNCONFIGED 0
64#define IP4_STATE_CONFIGED 1
65
66//
67// The state of IP4 service. It starts from UNSTARTED. It transits
68// to STARTED if autoconfigure is started. If default address is
69// configured, it becomes CONFIGED. and if partly destroyed, it goes
70// to DESTROY.
71//
72#define IP4_SERVICE_UNSTARTED 0
73#define IP4_SERVICE_STARTED 1
74#define IP4_SERVICE_CONFIGED 2
75#define IP4_SERVICE_DESTROY 3
76
86typedef struct {
87 IP4_PROTOCOL *IpInstance;
89 EFI_EVENT IpSecRecycleSignal;
90 NET_BUF *Packet;
91 BOOLEAN Sent;
92 INTN Life;
94
101typedef struct {
102 EFI_EVENT IpSecRecycleSignal;
103 NET_BUF *Packet;
105
115typedef struct {
116 LIST_ENTRY Link;
117 IP4_PROTOCOL *IpInstance;
118 NET_BUF *Packet;
121
123 UINT32 Signature;
124
125 EFI_IP4_PROTOCOL Ip4Proto;
126 EFI_HANDLE Handle;
127 INTN State;
128
129 BOOLEAN InDestroy;
130
131 IP4_SERVICE *Service;
132 LIST_ENTRY Link; // Link to all the IP protocol from the service
133
134 //
135 // User's transmit/receive tokens, and received/delivered packets
136 //
137 NET_MAP RxTokens;
138 NET_MAP TxTokens; // map between (User's Token, IP4_TXTOKE_WRAP)
139 LIST_ENTRY Received; // Received but not delivered packet
140 LIST_ENTRY Delivered; // Delivered and to be recycled packets
141 EFI_LOCK RecycleLock;
142
143 //
144 // Instance's address and route tables. There are two route tables.
145 // RouteTable is used by the IP4 driver to route packet. EfiRouteTable
146 // is used to communicate the current route info to the upper layer.
147 //
148 IP4_INTERFACE *Interface;
149 LIST_ENTRY AddrLink; // Ip instances with the same IP address.
150 IP4_ROUTE_TABLE *RouteTable;
151
152 EFI_IP4_ROUTE_TABLE *EfiRouteTable;
153 UINT32 EfiRouteCount;
154
155 //
156 // IGMP data for this instance
157 //
158 IP4_ADDR *Groups; // stored in network byte order
159 UINT32 GroupCount;
160
161 EFI_IP4_CONFIG_DATA ConfigData;
162};
163
165 UINT32 Signature;
166 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
167 INTN State;
168
169 //
170 // List of all the IP instances and interfaces, and default
171 // interface and route table and caches.
172 //
173 UINTN NumChildren;
174 LIST_ENTRY Children;
175
176 LIST_ENTRY Interfaces;
177
178 IP4_INTERFACE *DefaultInterface;
179 IP4_ROUTE_TABLE *DefaultRouteTable;
180
181 //
182 // Ip reassemble utilities, and IGMP data
183 //
184 IP4_ASSEMBLE_TABLE Assemble;
185 IGMP_SERVICE_DATA IgmpCtrl;
186
187 //
188 // Low level protocol used by this service instance
189 //
190 EFI_HANDLE Image;
191 EFI_HANDLE Controller;
192
193 EFI_HANDLE MnpChildHandle;
195
198
199 EFI_EVENT Timer;
200 EFI_EVENT ReconfigCheckTimer;
201 EFI_EVENT ReconfigEvent;
202
203 BOOLEAN Reconfig;
204
205 //
206 // Underlying media present status.
207 //
208 BOOLEAN MediaPresent;
209
210 //
211 // IPv4 Configuration II Protocol instance
212 //
213 IP4_CONFIG2_INSTANCE Ip4Config2Instance;
214
215 CHAR16 *MacString;
216
217 UINT32 MaxPacketSize;
219};
220
221#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
222 CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
223
224#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
225 CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
226
227#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This) \
228 CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)
229
230#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
231
232extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
233
254 IN IP4_SERVICE *IpSb,
255 IN BOOLEAN Force
256 );
257
265VOID
267 IN IP4_SERVICE *IpSb,
268 IN OUT IP4_PROTOCOL *IpInstance
269 );
270
282 IN IP4_PROTOCOL *IpInstance
283 );
284
299Ip4Cancel (
300 IN IP4_PROTOCOL *IpInstance,
301 IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
302 );
303
320Ip4Groups (
321 IN IP4_PROTOCOL *IpInstance,
322 IN BOOLEAN JoinFlag,
323 IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
324 );
325
335VOID
336EFIAPI
338 IN EFI_EVENT Event,
339 IN VOID *Context
340 );
341
354VOID
355EFIAPI
357 IN EFI_EVENT Event,
358 IN VOID *Context
359 );
360
376EFIAPI
378 IN NET_MAP *Map,
379 IN NET_MAP_ITEM *Item,
380 IN VOID *Context
381 );
382
404VOID
405EFIAPI
407 IN VOID *Context
408 );
409
410extern EFI_IPSEC2_PROTOCOL *mIpSec;
411extern BOOLEAN mIpSec2Installed;
412
413#endif
UINT64 UINTN
INT64 INTN
EFI_STATUS Ip4ServiceConfigMnp(IN IP4_SERVICE *IpSb, IN BOOLEAN Force)
Definition: Ip4Impl.c:465
VOID Ip4InitProtocol(IN IP4_SERVICE *IpSb, IN OUT IP4_PROTOCOL *IpInstance)
Definition: Ip4Impl.c:532
VOID EFIAPI Ip4FreeTxToken(IN VOID *Context)
Definition: Ip4Impl.c:1455
VOID EFIAPI Ip4TimerTicking(IN EFI_EVENT Event, IN VOID *Context)
Definition: Ip4Impl.c:2242
EFI_STATUS Ip4Groups(IN IP4_PROTOCOL *IpInstance, IN BOOLEAN JoinFlag, IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL)
Definition: Ip4Impl.c:986
VOID EFIAPI Ip4TimerReconfigChecking(IN EFI_EVENT Event, IN VOID *Context)
Definition: Ip4Impl.c:2270
EFI_STATUS EFIAPI Ip4SentPacketTicking(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
Definition: Ip4Impl.c:2213
EFI_STATUS Ip4Cancel(IN IP4_PROTOCOL *IpInstance, IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Ip4Impl.c:2016
EFI_STATUS Ip4CleanProtocol(IN IP4_PROTOCOL *IpInstance)
Definition: Ip4Impl.c:760
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
UINT32 OldMaxPacketSize
The MTU before IPsec enable.
Definition: Ip4Impl.h:218