TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip6Impl.h
Go to the documentation of this file.
1
11#ifndef __EFI_IP6_IMPL_H__
12#define __EFI_IP6_IMPL_H__
13
14#include <Uefi.h>
15
17
20#include <Protocol/IpSec.h>
21#include <Protocol/Ip6.h>
22#include <Protocol/Ip6Config.h>
23#include <Protocol/Dhcp6.h>
24#include <Protocol/DevicePath.h>
27
28#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/HiiLib.h>
40#include <Library/PrintLib.h>
41
42#include <Guid/MdeModuleHii.h>
43
44#include "Ip6Common.h"
45#include "Ip6Driver.h"
46#include "Ip6Icmp.h"
47#include "Ip6If.h"
48#include "Ip6Input.h"
49#include "Ip6Mld.h"
50#include "Ip6Nd.h"
51#include "Ip6Option.h"
52#include "Ip6Output.h"
53#include "Ip6Route.h"
54#include "Ip6ConfigNv.h"
55#include "Ip6ConfigImpl.h"
56
57#define IP6_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'P')
58#define IP6_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'S')
59
60//
61// The state of IP6 protocol. It starts from UNCONFIGED. if it is
62// successfully configured, it goes to CONFIGED. if configure NULL
63// is called, it becomes UNCONFIGED again. If (partly) destroyed, it
64// becomes DESTROY.
65//
66#define IP6_STATE_UNCONFIGED 0
67#define IP6_STATE_CONFIGED 1
68
69//
70// The state of IP6 service. It starts from UNSTARTED. It transits
71// to STARTED if autoconfigure is started. If default address is
72// configured, it becomes CONFIGED. and if partly destroyed, it goes
73// to DESTROY.
74//
75#define IP6_SERVICE_UNSTARTED 0
76#define IP6_SERVICE_STARTED 1
77#define IP6_SERVICE_CONFIGED 2
78#define IP6_SERVICE_DESTROY 3
79
80#define IP6_INSTANCE_FROM_PROTOCOL(Ip6) \
81 CR ((Ip6), IP6_PROTOCOL, Ip6Proto, IP6_PROTOCOL_SIGNATURE)
82
83#define IP6_SERVICE_FROM_PROTOCOL(Sb) \
84 CR ((Sb), IP6_SERVICE, ServiceBinding, IP6_SERVICE_SIGNATURE)
85
86#define IP6_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
87
88extern EFI_IPSEC2_PROTOCOL *mIpSec;
89extern BOOLEAN mIpSec2Installed;
90
91//
92// IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.
93// The user's data is kept in the Packet. When fragment is
94// needed, each fragment of the Packet has a reference to the
95// Packet, no data is actually copied. The Packet will be
96// released when all the fragments of it have been recycled by
97// MNP. Upon then, the IP6_TXTOKEN_WRAP will be released, and
98// user's event signalled.
99//
100typedef struct {
101 IP6_PROTOCOL *IpInstance;
103 EFI_EVENT IpSecRecycleSignal;
104 NET_BUF *Packet;
105 BOOLEAN Sent;
106 INTN Life;
108
109typedef struct {
110 EFI_EVENT IpSecRecycleSignal;
111 NET_BUF *Packet;
113
114//
115// IP6_RXDATA_WRAP wraps the data IP6 child delivers to the
116// upper layers. The received packet is kept in the Packet.
117// The Packet itself may be constructured from some fragments.
118// All the fragments of the Packet is organized by a
119// IP6_ASSEMBLE_ENTRY structure. If the Packet is recycled by
120// the upper layer, the assemble entry and its associated
121// fragments will be freed at last.
122//
123typedef struct {
124 LIST_ENTRY Link;
125 IP6_PROTOCOL *IpInstance;
126 NET_BUF *Packet;
129
131 UINT32 Signature;
132
133 EFI_IP6_PROTOCOL Ip6Proto;
134 EFI_HANDLE Handle;
135 INTN State;
136
137 IP6_SERVICE *Service;
138 LIST_ENTRY Link; // Link to all the IP protocol from the service
139
140 UINT8 PrefixLength; // PrefixLength of the configured station address.
141 //
142 // User's transmit/receive tokens, and received/delivered packets
143 //
144 NET_MAP RxTokens;
145 NET_MAP TxTokens; // map between (User's Token, IP6_TXTOKE_WRAP)
146 LIST_ENTRY Received; // Received but not delivered packet
147 LIST_ENTRY Delivered; // Delivered and to be recycled packets
148 EFI_LOCK RecycleLock;
149
150 IP6_INTERFACE *Interface;
151 LIST_ENTRY AddrLink; // Ip instances with the same IP address.
152
153 EFI_IPv6_ADDRESS *GroupList; // stored in network order.
154 UINT32 GroupCount;
155
156 EFI_IP6_CONFIG_DATA ConfigData;
157 BOOLEAN InDestroy;
158};
159
161 UINT32 Signature;
162 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
163 INTN State;
164
165 //
166 // List of all the IP instances and interfaces, and default
167 // interface and route table and caches.
168 //
169 UINTN NumChildren;
170 LIST_ENTRY Children;
171
172 LIST_ENTRY Interfaces;
173
174 IP6_INTERFACE *DefaultInterface;
175 IP6_ROUTE_TABLE *RouteTable;
176
177 IP6_LINK_RX_TOKEN RecvRequest;
178
179 //
180 // Ip reassemble utilities and MLD data
181 //
182 IP6_ASSEMBLE_TABLE Assemble;
183 IP6_MLD_SERVICE_DATA MldCtrl;
184
185 EFI_IPv6_ADDRESS LinkLocalAddr;
186 BOOLEAN LinkLocalOk;
187 BOOLEAN LinkLocalDadFail;
188 BOOLEAN Dhcp6NeedStart;
189 BOOLEAN Dhcp6NeedInfoRequest;
190
191 //
192 // ND data
193 //
194 UINT8 CurHopLimit;
195 UINT32 LinkMTU;
196 UINT32 BaseReachableTime;
197 UINT32 ReachableTime;
198 UINT32 RetransTimer;
199 LIST_ENTRY NeighborTable;
200
201 LIST_ENTRY OnlinkPrefix;
202 LIST_ENTRY AutonomousPrefix;
203
204 LIST_ENTRY DefaultRouterList;
205 UINT32 RoundRobin;
206
207 UINT8 InterfaceIdLen;
208 UINT8 *InterfaceId;
209
210 BOOLEAN RouterAdvertiseReceived;
211 UINT8 SolicitTimer;
212 UINT32 Ticks;
213
214 //
215 // Low level protocol used by this service instance
216 //
217 EFI_HANDLE Image;
218 EFI_HANDLE Controller;
219
220 EFI_HANDLE MnpChildHandle;
222
225
226 EFI_EVENT Timer;
227 EFI_EVENT FasterTimer;
228
229 //
230 // IPv6 Configuration Protocol instance
231 //
232 IP6_CONFIG_INSTANCE Ip6ConfigInstance;
233
234 //
235 // The string representation of the current mac address of the
236 // NIC this IP6_SERVICE works on.
237 //
238 CHAR16 *MacString;
239 UINT32 MaxPacketSize;
240 UINT32 OldMaxPacketSize;
241};
242
264VOID
265EFIAPI
267 IN VOID *Context
268 );
269
290 IN IP6_SERVICE *IpSb,
291 IN BOOLEAN Force
292 );
293
309Ip6Cancel (
310 IN IP6_PROTOCOL *IpInstance,
311 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
312 );
313
321VOID
323 IN IP6_SERVICE *IpSb,
324 IN OUT IP6_PROTOCOL *IpInstance
325 );
326
338 IN OUT IP6_PROTOCOL *IpInstance
339 );
340
341//
342// EFI_IP6_PROTOCOL interface prototypes
343//
344
363EFIAPI
365 IN EFI_IP6_PROTOCOL *This,
366 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
367 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
368 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
369 );
370
419EFIAPI
421 IN EFI_IP6_PROTOCOL *This,
422 IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
423 );
424
457EFIAPI
459 IN EFI_IP6_PROTOCOL *This,
460 IN BOOLEAN JoinFlag,
461 IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
462 );
463
508EFIAPI
510 IN EFI_IP6_PROTOCOL *This,
511 IN BOOLEAN DeleteRoute,
512 IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
513 IN UINT8 PrefixLength,
514 IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
515 );
516
564EFIAPI
566 IN EFI_IP6_PROTOCOL *This,
567 IN BOOLEAN DeleteFlag,
568 IN EFI_IPv6_ADDRESS *TargetIp6Address,
569 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
570 IN UINT32 Timeout,
571 IN BOOLEAN Override
572 );
573
627EFIAPI
629 IN EFI_IP6_PROTOCOL *This,
631 );
632
676EFIAPI
678 IN EFI_IP6_PROTOCOL *This,
680 );
681
711EFIAPI
713 IN EFI_IP6_PROTOCOL *This,
714 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
715 );
716
743EFIAPI
745 IN EFI_IP6_PROTOCOL *This
746 );
747
748#endif
UINT64 UINTN
INT64 INTN
EFI_STATUS EFIAPI EfiIp6Receive(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token)
Definition: Ip6Impl.c:1481
EFI_STATUS EFIAPI EfiIp6Transmit(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token)
Definition: Ip6Impl.c:1238
EFI_STATUS EFIAPI EfiIp6Routes(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN DeleteRoute, IN EFI_IPv6_ADDRESS *Destination OPTIONAL, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL)
Definition: Ip6Impl.c:825
EFI_STATUS EFIAPI EfiIp6Poll(IN EFI_IP6_PROTOCOL *This)
Definition: Ip6Impl.c:1804
EFI_STATUS Ip6Cancel(IN IP6_PROTOCOL *IpInstance, IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Ip6Impl.c:1660
EFI_STATUS EFIAPI EfiIp6Neighbors(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN DeleteFlag, IN EFI_IPv6_ADDRESS *TargetIp6Address, IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, IN UINT32 Timeout, IN BOOLEAN Override)
Definition: Ip6Impl.c:937
EFI_STATUS Ip6CleanProtocol(IN OUT IP6_PROTOCOL *IpInstance)
Definition: Ip6Impl.c:444
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
Definition: Ip6Impl.c:740
EFI_STATUS Ip6ServiceConfigMnp(IN IP6_SERVICE *IpSb, IN BOOLEAN Force)
Definition: Ip6Impl.c:502
VOID EFIAPI Ip6FreeTxToken(IN VOID *Context)
Definition: Ip6Impl.c:1117
EFI_STATUS EFIAPI EfiIp6GetModeData(IN EFI_IP6_PROTOCOL *This, OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
Definition: Ip6Impl.c:46
VOID Ip6InitProtocol(IN IP6_SERVICE *IpSb, IN OUT IP6_PROTOCOL *IpInstance)
Definition: Ip6Impl.c:299
EFI_STATUS EFIAPI EfiIp6Configure(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL)
Definition: Ip6Impl.c:610
EFI_STATUS EFIAPI EfiIp6Cancel(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Ip6Impl.c:1748
#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