TianoCore EDK2 master
Loading...
Searching...
No Matches
IpIoLib.h
Go to the documentation of this file.
1
10#ifndef _IP_IO_H_
11#define _IP_IO_H_
12
13#include <Protocol/Ip4.h>
14#include <Protocol/Ip6.h>
15
16#include <Library/NetLib.h>
17
18//
19// type and code define for ICMP protocol error
20// from IP
21//
22#define ICMP_TYPE_UNREACH 3
23#define ICMP_TYPE_TIMXCEED 11
24#define ICMP_TYPE_PARAMPROB 12
25#define ICMP_TYPE_SOURCEQUENCH 4
26
27#define ICMP_CODE_UNREACH_NET 0
28#define ICMP_CODE_UNREACH_HOST 1
29#define ICMP_CODE_UNREACH_PROTOCOL 2
30#define ICMP_CODE_UNREACH_PORT 3
31#define ICMP_CODE_UNREACH_NEEDFRAG 4
32#define ICMP_CODE_UNREACH_SRCFAIL 5
33#define ICMP_CODE_UNREACH_NET_UNKNOWN 6
34#define ICMP_CODE_UNREACH_HOST_UNKNOWN 7
35#define ICMP_CODE_UNREACH_ISOLATED 8
36#define ICMP_CODE_UNREACH_NET_PROHIB 9
37#define ICMP_CODE_UNREACH_HOST_PROHIB 10
38#define ICMP_CODE_UNREACH_TOSNET 11
39#define ICMP_CODE_UNREACH_TOSHOST 12
40
50#define EFI_IP4_HEADER_LEN(HdrPtr) ((HdrPtr)->HeaderLength << 2)
51
61#define ICMP_ERRLEN(IpHdr) \
62 (sizeof(IP4_ICMP_HEAD) + EFI_IP4_HEADER_LEN(IpHdr) + 8)
63
72#define NET_PROTO_HDR(Buf, Type) ((Type *) ((Buf)->BlockOp[0].Head))
73
74extern EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData;
75extern EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData;
76
82
83#define ICMP_ERR_UNREACH_NET 0
84#define ICMP_ERR_UNREACH_HOST 1
85#define ICMP_ERR_UNREACH_PROTOCOL 2
86#define ICMP_ERR_UNREACH_PORT 3
87#define ICMP_ERR_MSGSIZE 4
88#define ICMP_ERR_UNREACH_SRCFAIL 5
89#define ICMP_ERR_TIMXCEED_INTRANS 6
90#define ICMP_ERR_TIMXCEED_REASS 7
91#define ICMP_ERR_QUENCH 8
92#define ICMP_ERR_PARAMPROB 9
93
94#define ICMP6_ERR_UNREACH_NET 0
95#define ICMP6_ERR_UNREACH_HOST 1
96#define ICMP6_ERR_UNREACH_PROTOCOL 2
97#define ICMP6_ERR_UNREACH_PORT 3
98#define ICMP6_ERR_PACKAGE_TOOBIG 4
99#define ICMP6_ERR_TIMXCEED_HOPLIMIT 5
100#define ICMP6_ERR_TIMXCEED_REASS 6
101#define ICMP6_ERR_PARAMPROB_HEADER 7
102#define ICMP6_ERR_PARAMPROB_NEXHEADER 8
103#define ICMP6_ERR_PARAMPROB_IPV6OPTION 9
104
108typedef struct {
109 BOOLEAN IsHard;
110 BOOLEAN Notify;
112
113typedef union {
117
118typedef union {
119 EFI_IP4_TRANSMIT_DATA Ip4TxData;
120 EFI_IP6_TRANSMIT_DATA Ip6TxData;
122
123typedef union {
124 EFI_IP4_RECEIVE_DATA Ip4RxData;
125 EFI_IP6_RECEIVE_DATA Ip6RxData;
127
128typedef union {
129 EFI_IP4_OVERRIDE_DATA Ip4OverrideData;
130 EFI_IP6_OVERRIDE_DATA Ip6OverrideData;
132
133typedef union {
134 EFI_IP4_CONFIG_DATA Ip4CfgData;
135 EFI_IP6_CONFIG_DATA Ip6CfgData;
137
138typedef union {
139 EFI_IP4_HEADER *Ip4Hdr;
140 EFI_IP6_HEADER *Ip6Hdr;
142
143typedef union {
144 IP4_ADDR SubnetMask;
145 UINT8 PrefixLength;
147
148typedef union {
149 EFI_IP4_PROTOCOL *Ip4;
150 EFI_IP6_PROTOCOL *Ip6;
152
156typedef struct _EFI_NET_SESSION_DATA {
160 UINT32 IpHdrLen;
165 UINT8 IpVersion;
167
179typedef
180VOID
181(EFIAPI *PKT_RCVD_NOTIFY)(
182 IN EFI_STATUS Status,
183 IN UINT8 IcmpErr,
184 IN EFI_NET_SESSION_DATA *NetSession,
185 IN NET_BUF *Pkt,
186 IN VOID *Context
187 );
188
200typedef
201VOID
202(EFIAPI *PKT_SENT_NOTIFY)(
203 IN EFI_STATUS Status,
204 IN VOID *Context,
205 IN IP_IO_IP_PROTOCOL Sender,
206 IN VOID *NotifyData
207 );
208
213typedef struct _IP_IO {
218
223
224 EFI_HANDLE Controller;
225 EFI_HANDLE Image;
226 EFI_HANDLE ChildHandle;
227 //
228 // The IP instance consumed by this IP_IO
229 //
231 BOOLEAN IsConfigured;
232
236 UINT8 Protocol;
237
242
247
248 //
249 // User interface used to get notify from IP_IO
250 //
255 UINT8 IpVersion;
256 IP4_ADDR StationIp;
257 IP4_ADDR SubnetMask;
259
264typedef struct _IP_IO_OPEN_DATA {
271
278typedef struct _IP_IO_SEND_ENTRY {
279 LIST_ENTRY Entry;
280 IP_IO *IpIo;
281 VOID *Context;
282 VOID *NotifyData;
284 NET_BUF *Pkt;
287
292typedef struct _IP_IO_IP_INFO {
293 EFI_IP_ADDRESS Addr;
294 IP_IO_IP_MASK PreMask;
295 LIST_ENTRY Entry;
296 EFI_HANDLE ChildHandle;
298 IP_IO_IP_COMPLETION_TOKEN DummyRcvToken;
299 INTN RefCnt;
300 UINT8 IpVersion;
302
321IP_IO *
322EFIAPI
324 IN EFI_HANDLE Image,
325 IN EFI_HANDLE Controller,
326 IN UINT8 IpVersion
327 );
328
343EFIAPI
345 IN OUT IP_IO *IpIo
346 );
347
364EFIAPI
365IpIoStop (
366 IN OUT IP_IO *IpIo
367 );
368
393EFIAPI
394IpIoOpen (
395 IN OUT IP_IO *IpIo,
396 IN IP_IO_OPEN_DATA *OpenData
397 );
398
426EFIAPI
427IpIoSend (
428 IN OUT IP_IO *IpIo,
429 IN OUT NET_BUF *Pkt,
430 IN IP_IO_IP_INFO *Sender OPTIONAL,
431 IN VOID *Context OPTIONAL,
432 IN VOID *NotifyData OPTIONAL,
433 IN EFI_IP_ADDRESS *Dest OPTIONAL,
434 IN IP_IO_OVERRIDE *OverrideData OPTIONAL
435 );
436
447VOID
448EFIAPI
450 IN IP_IO *IpIo,
451 IN VOID *Packet
452 );
453
471EFIAPI
472IpIoAddIp (
473 IN OUT IP_IO *IpIo
474 );
475
495EFIAPI
497 IN OUT IP_IO_IP_INFO *IpInfo,
498 IN OUT VOID *IpConfigData OPTIONAL
499 );
500
515VOID
516EFIAPI
518 IN IP_IO *IpIo,
519 IN IP_IO_IP_INFO *IpInfo
520 );
521
539EFIAPI
541 IN OUT IP_IO **IpIo,
542 IN UINT8 IpVersion,
543 IN EFI_IP_ADDRESS *Src
544 );
545
563EFIAPI
565 IN UINT8 IcmpError,
566 IN UINT8 IpVersion,
567 OUT BOOLEAN *IsHard OPTIONAL,
568 OUT BOOLEAN *Notify OPTIONAL
569 );
570
597EFIAPI
599 IN IP_IO *IpIo,
600 IN EFI_IP_ADDRESS *Neighbor,
601 IN UINT32 Timeout
602 );
603
604#endif
INT64 INTN
struct _EFI_NET_SESSION_DATA EFI_NET_SESSION_DATA
EFI_STATUS EFIAPI IpIoRefreshNeighbor(IN IP_IO *IpIo, IN EFI_IP_ADDRESS *Neighbor, IN UINT32 Timeout)
Definition: DxeIpIoLib.c:2224
VOID(EFIAPI * PKT_RCVD_NOTIFY)(IN EFI_STATUS Status, IN UINT8 IcmpErr, IN EFI_NET_SESSION_DATA *NetSession, IN NET_BUF *Pkt, IN VOID *Context)
Definition: IpIoLib.h:181
struct _IP_IO_SEND_ENTRY IP_IO_SEND_ENTRY
EFI_STATUS EFIAPI IpIoDestroy(IN OUT IP_IO *IpIo)
Definition: DxeIpIoLib.c:1518
IP_IO *EFIAPI IpIoCreate(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN UINT8 IpVersion)
Definition: DxeIpIoLib.c:1217
VOID EFIAPI IpIoRemoveIp(IN IP_IO *IpIo, IN IP_IO_IP_INFO *IpInfo)
Definition: DxeIpIoLib.c:1968
struct _IP_IO IP_IO
EFI_STATUS EFIAPI IpIoStop(IN OUT IP_IO *IpIo)
Definition: DxeIpIoLib.c:1436
EFI_STATUS EFIAPI IpIoOpen(IN OUT IP_IO *IpIo, IN IP_IO_OPEN_DATA *OpenData)
Definition: DxeIpIoLib.c:1310
struct _IP_IO_IP_INFO IP_IO_IP_INFO
EFI_STATUS EFIAPI IpIoSend(IN OUT IP_IO *IpIo, IN OUT NET_BUF *Pkt, IN IP_IO_IP_INFO *Sender OPTIONAL, IN VOID *Context OPTIONAL, IN VOID *NotifyData OPTIONAL, IN EFI_IP_ADDRESS *Dest OPTIONAL, IN IP_IO_OVERRIDE *OverrideData OPTIONAL)
Definition: DxeIpIoLib.c:1578
VOID EFIAPI IpIoCancelTxToken(IN IP_IO *IpIo, IN VOID *Packet)
Definition: DxeIpIoLib.c:1648
EFI_STATUS EFIAPI IpIoConfigIp(IN OUT IP_IO_IP_INFO *IpInfo, IN OUT VOID *IpConfigData OPTIONAL)
Definition: DxeIpIoLib.c:1806
IP_IO_IP_INFO *EFIAPI IpIoAddIp(IN OUT IP_IO *IpIo)
Definition: DxeIpIoLib.c:1700
VOID(EFIAPI * PKT_SENT_NOTIFY)(IN EFI_STATUS Status, IN VOID *Context, IN IP_IO_IP_PROTOCOL Sender, IN VOID *NotifyData)
Definition: IpIoLib.h:202
IP_IO_IP_INFO *EFIAPI IpIoFindSender(IN OUT IP_IO **IpIo, IN UINT8 IpVersion, IN EFI_IP_ADDRESS *Src)
Definition: DxeIpIoLib.c:2043
struct _IP_IO_OPEN_DATA IP_IO_OPEN_DATA
EFI_STATUS EFIAPI IpIoGetIcmpErrStatus(IN UINT8 IcmpError, IN UINT8 IpVersion, OUT BOOLEAN *IsHard OPTIONAL, OUT BOOLEAN *Notify OPTIONAL)
Definition: DxeIpIoLib.c:2109
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
UINT8 IpVersion
The IP version of the received packet.
Definition: IpIoLib.h:165
EFI_IP_ADDRESS Source
Source IP of the received packet.
Definition: IpIoLib.h:157
EFI_IP_ADDRESS Dest
Destination IP of the received packet.
Definition: IpIoLib.h:158
IP_IO_IP_HEADER IpHdr
IP header of the received packet.
Definition: IpIoLib.h:159
PKT_RCVD_NOTIFY PktRcvdNotify
Receive callback.
Definition: IpIoLib.h:268
VOID * SndContext
Context data used by send callback.
Definition: IpIoLib.h:267
IP_IO_IP_CONFIG_DATA IpConfigData
Configuration of the IP instance.
Definition: IpIoLib.h:265
VOID * RcvdContext
Context data used by receive callback.
Definition: IpIoLib.h:266
PKT_SENT_NOTIFY PktSentNotify
Send callback.
Definition: IpIoLib.h:269
PKT_RCVD_NOTIFY PktRcvdNotify
See IP_IO_OPEN_DATA::PktRcvdNotify.
Definition: IpIoLib.h:253
VOID * RcvdContext
See IP_IO_OPEN_DATA::RcvdContext.
Definition: IpIoLib.h:251
VOID * SndContext
See IP_IO_OPEN_DATA::SndContext.
Definition: IpIoLib.h:252
IP_IO_IP_COMPLETION_TOKEN RcvToken
Definition: IpIoLib.h:241
LIST_ENTRY IpList
Definition: IpIoLib.h:222
UINT8 Protocol
Definition: IpIoLib.h:236
LIST_ENTRY PendingSndList
Definition: IpIoLib.h:246
LIST_ENTRY Entry
Definition: IpIoLib.h:217
PKT_SENT_NOTIFY PktSentNotify
See IP_IO_OPEN_DATA::PktSentNotify.
Definition: IpIoLib.h:254