2 Definition for IP6 pesudo interface structure.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __EFI_IP6_IF_H__
17 #define __EFI_IP6_IF_H__
19 #define IP6_LINK_RX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'R')
20 #define IP6_LINK_TX_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'T')
21 #define IP6_INTERFACE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'I')
22 #define IP6_ADDR_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', 'A', 'I')
25 // This prototype is used by both receive and transmission.
26 // When receiving Netbuf is allocated by IP6_INTERFACE, and
27 // released by IP6. Flag shows whether the frame is received
28 // as unicast/multicast/anycast...
30 // When transmitting, the Netbuf is from IP6, and provided
31 // to the callback as a reference. Flag isn't used.
33 // IpInstance can be NULL which means that it is the IP6 driver
34 // itself sending the packets. IP6 driver may send packets that
35 // don't belong to any instance, such as ICMP errors, ICMP
36 // informational packets. IpInstance is used as a tag in
41 (*IP6_FRAME_CALLBACK
) (
49 // Each receive request is wrapped in an IP6_LINK_RX_TOKEN.
50 // Upon completion, the Callback will be called. Only one
51 // receive request is send to MNP. IpInstance is always NULL.
52 // Reference MNP's spec for information.
56 IP6_FRAME_CALLBACK CallBack
;
58 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
62 // Each transmit request is wrapped in an IP6_LINK_TX_TOKEN.
63 // Upon completion, the Callback will be called.
69 IP6_PROTOCOL
*IpInstance
;
70 IP6_FRAME_CALLBACK CallBack
;
74 EFI_MAC_ADDRESS DstMac
;
75 EFI_MAC_ADDRESS SrcMac
;
77 EFI_MANAGED_NETWORK_COMPLETION_TOKEN MnpToken
;
78 EFI_MANAGED_NETWORK_TRANSMIT_DATA MnpTxData
;
81 struct _IP6_ADDRESS_INFO
{
84 EFI_IPv6_ADDRESS Address
;
88 UINT32 PreferredLifetime
;
92 // Callback to select which frame to cancel. Caller can cancel a
93 // single frame, or all the frame from an IP instance.
97 (*IP6_FRAME_TO_CANCEL
) (
98 IP6_LINK_TX_TOKEN
*Frame
,
102 struct _IP6_INTERFACE
{
108 // IP address and prefix length of the interface. The fileds
109 // are invalid if (Configured == FALSE)
111 LIST_ENTRY AddressList
;
115 IP6_SERVICE
*Service
;
117 EFI_HANDLE Controller
;
122 // Queues to keep the frames sent and waiting ARP request.
125 LIST_ENTRY SentFrames
;
129 // The interface's configuration variables
131 UINT32 DupAddrDetect
;
132 LIST_ENTRY DupAddrDetectList
;
133 LIST_ENTRY DelayJoinList
;
136 // All the IP instances that have the same IP/SubnetMask are linked
137 // together through IpInstances. If any of the instance enables
138 // promiscuous receive, PromiscRecv is true.
140 LIST_ENTRY IpInstances
;
145 Create an IP6_INTERFACE.
147 @param[in] IpSb The IP6 service binding instance.
148 @param[in] LinkLocal If TRUE, the instance is created for link-local address.
149 Otherwise, it is not for a link-local address.
151 @return Point to the created IP6_INTERFACE, otherwise NULL.
156 IN IP6_SERVICE
*IpSb
,
161 Free the interface used by IpInstance. All the IP instance with
162 the same Ip/prefix pair share the same interface. It is reference
163 counted. All the frames that haven't been sent will be cancelled.
164 Because the IpInstance is optional, the caller must remove
165 IpInstance from the interface's instance list.
167 @param[in] Interface The interface used by the IpInstance.
168 @param[in] IpInstance The IP instance that free the interface. NULL if
169 the IP driver is releasing the default interface.
174 IN IP6_INTERFACE
*Interface
,
175 IN IP6_PROTOCOL
*IpInstance OPTIONAL
179 Free the link layer transmit token. It will close the event
180 then free the memory used.
182 @param[in] Token Token to free.
187 IN IP6_LINK_TX_TOKEN
*Token
191 Request Ip6OnFrameReceivedDpc as a DPC at TPL_CALLBACK
193 @param Event The receive event delivered to MNP for receive.
194 @param Context Context for the callback.
205 Request to receive the packet from the interface.
207 @param[in] CallBack Function to call when the receive finished.
208 @param[in] IpSb Points to the IP6 service binding instance.
210 @retval EFI_ALREADY_STARTED There is already a pending receive request.
211 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to receive.
212 @retval EFI_SUCCESS The recieve request has been started.
217 IN IP6_FRAME_CALLBACK CallBack
,
222 Send a frame from the interface. If the next hop is multicast address,
223 it is transmitted immediately. If the next hop is a unicast,
224 and the NextHop's MAC is not known, it will perform address resolution.
225 If some error happened, the CallBack won't be called. So, the caller
226 must test the return value, and take action when there is an error.
228 @param[in] Interface The interface to send the frame from
229 @param[in] IpInstance The IP child that request the transmission.
230 NULL if it is the IP6 driver itself.
231 @param[in] Packet The packet to transmit.
232 @param[in] NextHop The immediate destination to transmit the packet to.
233 @param[in] CallBack Function to call back when transmit finished.
234 @param[in] Context Opaque parameter to the call back.
236 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame.
237 @retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop.
238 @retval EFI_SUCCESS The packet successfully transmitted.
243 IN IP6_INTERFACE
*Interface
,
244 IN IP6_PROTOCOL
*IpInstance OPTIONAL
,
246 IN EFI_IPv6_ADDRESS
*NextHop
,
247 IN IP6_FRAME_CALLBACK CallBack
,
252 The heartbeat timer of IP6 service instance. It times out
253 all of its IP6 children's received-but-not-delivered and
254 transmitted-but-not-recycle packets.
256 @param[in] Event The IP6 service instance's heart beat timer.
257 @param[in] Context The IP6 service instance.