3 Copyright (c) 2005 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Definition for IP4 pesudo interface structure.
24 #ifndef __EFI_IP4_IF_H__
25 #define __EFI_IP4_IF_H__
28 IP4_FRAME_RX_SIGNATURE
= EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
29 IP4_FRAME_TX_SIGNATURE
= EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
30 IP4_FRAME_ARP_SIGNATURE
= EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
31 IP4_INTERFACE_SIGNATURE
= EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
35 // This prototype is used by both receive and transmission.
36 // When receiving Netbuf is allocated by IP4_INTERFACE, and
37 // released by IP4. Flag shows whether the frame is received
38 // as link broadcast/multicast...
40 // When transmitting, the Netbuf is from IP4, and provided
41 // to the callback as a reference. Flag isn't used.
43 // IpInstance can be NULL which means that it is the IP4 driver
44 // itself sending the packets. IP4 driver may send packets that
45 // don't belong to any instance, such as ICMP errors, ICMP echo
46 // responses, or IGMP packets. IpInstance is used as a tag in
51 (*IP4_FRAME_CALLBACK
) (
52 IP4_PROTOCOL
*IpInstance
, OPTIONAL
60 // Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
61 // Upon completion, the Callback will be called. Only one
62 // receive request is send to MNP. IpInstance is always NULL.
63 // Reference MNP's spec for information.
67 IP4_INTERFACE
*Interface
;
69 IP4_PROTOCOL
*IpInstance
;
70 IP4_FRAME_CALLBACK CallBack
;
73 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
77 // Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
78 // Upon completion, the Callback will be called.
84 IP4_INTERFACE
*Interface
;
86 IP4_PROTOCOL
*IpInstance
;
87 IP4_FRAME_CALLBACK CallBack
;
91 EFI_MAC_ADDRESS DstMac
;
92 EFI_MAC_ADDRESS SrcMac
;
94 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
95 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData
;
99 // Only one ARP request is requested for all the frames in
100 // a time. It is started for the first frames to the Ip. Any
101 // subsequent transmission frame will be linked to Frames, and
102 // be sent all at once the ARP requests succeed.
109 IP4_INTERFACE
*Interface
;
112 // ARP requesting staffs
114 EFI_EVENT OnResolved
;
120 // Callback to select which frame to cancel. Caller can cancel a
121 // single frame, or all the frame from an IP instance.
125 (*IP4_FRAME_TO_CANCEL
) (
126 IP4_LINK_TX_TOKEN
*Frame
,
131 // Each IP4 instance has its own station address. All the instances
132 // with the same station address share a single interface structure.
133 // Each interface has its own ARP child, and shares one MNP child.
134 // Notice the special cases that DHCP can configure the interface
135 // with 0.0.0.0/0.0.0.0.
137 struct _IP4_INTERFACE
{
143 // IP address and subnet mask of the interface. It also contains
144 // the subnet/net broadcast address for quick access. The fileds
145 // are invalid if (Configured == FALSE)
149 IP4_ADDR SubnetBrdcast
;
154 // Handle used to create/destory ARP child. All the IP children
155 // share one MNP which is owned by IP service binding.
157 EFI_HANDLE Controller
;
160 EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
;
161 EFI_ARP_PROTOCOL
*Arp
;
162 EFI_HANDLE ArpHandle
;
165 // Queues to keep the frames sent and waiting ARP request.
168 LIST_ENTRY SentFrames
;
169 IP4_LINK_RX_TOKEN
*RecvRequest
;
172 // The interface's MAC and broadcast MAC address.
175 EFI_MAC_ADDRESS BroadcastMac
;
179 // All the IP instances that have the same IP/SubnetMask are linked
180 // together through IpInstances. If any of the instance enables
181 // promiscuous receive, PromiscRecv is true.
183 LIST_ENTRY IpInstances
;
189 IN EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
,
190 IN EFI_HANDLE Controller
,
191 IN EFI_HANDLE ImageHandle
196 IN IP4_INTERFACE
*Interface
,
198 IN IP4_ADDR SubnetMask
203 IN IP4_INTERFACE
*Interface
,
204 IN IP4_PROTOCOL
*IpInstance OPTIONAL
209 IN IP4_INTERFACE
*Interface
,
210 IN IP4_PROTOCOL
*IpInstance
, OPTIONAL
213 IN IP4_FRAME_CALLBACK CallBack
,
219 IN IP4_INTERFACE
*Interface
,
220 IN EFI_STATUS IoStatus
,
221 IN IP4_FRAME_TO_CANCEL FrameToCancel
, OPTIONAL
227 IN IP4_INTERFACE
*Interface
232 IN IP4_INTERFACE
*Interface
,
233 IN IP4_PROTOCOL
*IpInstance
, OPTIONAL
234 IN IP4_FRAME_CALLBACK CallBack
,