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 @param IpInstance The instance that sent or received the packet.
44 IpInstance can be NULL which means that it is the IP4 driver
45 itself sending the packets. IP4 driver may send packets that
46 don't belong to any instance, such as ICMP errors, ICMP echo
47 responses, or IGMP packets. IpInstance is used as a tag in
49 @param Packet The sent or received packet.
50 @param IoStatus Status of sending or receiving.
51 @param LinkFlag Indicate if the frame is received as link broadcast/multicast.
52 When transmitting, it is not used.
53 @param Context Additional data for callback.
59 (*IP4_FRAME_CALLBACK
)(
60 IN IP4_PROTOCOL
*IpInstance
, OPTIONAL
62 IN EFI_STATUS IoStatus
,
68 /// Each receive request is wrapped in an IP4_LINK_RX_TOKEN.
69 /// Upon completion, the Callback will be called. Only one
70 /// receive request is send to MNP. IpInstance is always NULL.
71 /// Reference MNP's spec for information.
75 IP4_INTERFACE
*Interface
;
77 IP4_PROTOCOL
*IpInstance
;
78 IP4_FRAME_CALLBACK CallBack
;
81 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
85 /// Each transmit request is wrapped in an IP4_LINK_TX_TOKEN.
86 /// Upon completion, the Callback will be called.
92 IP4_INTERFACE
*Interface
;
94 IP4_PROTOCOL
*IpInstance
;
95 IP4_FRAME_CALLBACK CallBack
;
99 EFI_MAC_ADDRESS DstMac
;
100 EFI_MAC_ADDRESS SrcMac
;
102 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
103 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData
;
107 /// Only one ARP request is requested for all the frames in
108 /// a time. It is started for the first frames to the Ip. Any
109 /// subsequent transmission frame will be linked to Frames, and
110 /// be sent all at once the ARP requests succeed.
117 IP4_INTERFACE
*Interface
;
120 // ARP requesting staffs
122 EFI_EVENT OnResolved
;
128 Callback to select which frame to cancel. Caller can cancel a
129 single frame, or all the frame from an IP instance.
131 @param Frame The sending frame to check for cancellation.
132 @param Context Additional data for callback.
134 @retval TRUE The sending of the frame should be cancelled.
135 @retval FALSE Do not cancel the frame sending.
139 (*IP4_FRAME_TO_CANCEL
)(
140 IP4_LINK_TX_TOKEN
*Frame
,
145 // Each IP4 instance has its own station address. All the instances
146 // with the same station address share a single interface structure.
147 // Each interface has its own ARP child, and shares one MNP child.
148 // Notice the special cases that DHCP can configure the interface
149 // with 0.0.0.0/0.0.0.0.
151 struct _IP4_INTERFACE
{
157 // IP address and subnet mask of the interface. It also contains
158 // the subnet/net broadcast address for quick access. The fileds
159 // are invalid if (Configured == FALSE)
163 IP4_ADDR SubnetBrdcast
;
168 // Handle used to create/destory ARP child. All the IP children
169 // share one MNP which is owned by IP service binding.
171 EFI_HANDLE Controller
;
174 EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
;
175 EFI_ARP_PROTOCOL
*Arp
;
176 EFI_HANDLE ArpHandle
;
179 // Queues to keep the frames sent and waiting ARP request.
182 LIST_ENTRY SentFrames
;
183 IP4_LINK_RX_TOKEN
*RecvRequest
;
186 // The interface's MAC and broadcast MAC address.
189 EFI_MAC_ADDRESS BroadcastMac
;
193 // All the IP instances that have the same IP/SubnetMask are linked
194 // together through IpInstances. If any of the instance enables
195 // promiscuous receive, PromiscRecv is true.
197 LIST_ENTRY IpInstances
;
203 IN EFI_MANAGED_NETWORK_PROTOCOL
*Mnp
,
204 IN EFI_HANDLE Controller
,
205 IN EFI_HANDLE ImageHandle
210 IN IP4_INTERFACE
*Interface
,
212 IN IP4_ADDR SubnetMask
217 IN IP4_INTERFACE
*Interface
,
218 IN IP4_PROTOCOL
*IpInstance OPTIONAL
223 IN IP4_INTERFACE
*Interface
,
224 IN IP4_PROTOCOL
*IpInstance
, OPTIONAL
227 IN IP4_FRAME_CALLBACK CallBack
,
233 IN IP4_INTERFACE
*Interface
,
234 IN EFI_STATUS IoStatus
,
235 IN IP4_FRAME_TO_CANCEL FrameToCancel
, OPTIONAL
241 IN IP4_INTERFACE
*Interface
246 IN IP4_INTERFACE
*Interface
,
247 IN IP4_PROTOCOL
*IpInstance
, OPTIONAL
248 IN IP4_FRAME_CALLBACK CallBack
,