2 Support functions declaration for UefiPxeBc Driver.
4 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __EFI_PXEBC_SUPPORT_H__
11 #define __EFI_PXEBC_SUPPORT_H__
14 #define ICMP_DEST_UNREACHABLE 3
15 #define ICMP_SOURCE_QUENCH 4
16 #define ICMP_REDIRECT 5
17 #define ICMP_ECHO_REQUEST 8
18 #define ICMP_TIME_EXCEEDED 11
19 #define ICMP_PARAMETER_PROBLEM 12
24 Flush the previous configration using the new station Ip address.
26 @param[in] Private Pointer to PxeBc private data.
27 @param[in] StationIp Pointer to the station Ip address.
28 @param[in] SubnetMask Pointer to the subnet mask address for v4.
30 @retval EFI_SUCCESS Successfully flushed the previous config.
31 @retval Others Failed to flush using the new station Ip.
36 PXEBC_PRIVATE_DATA
*Private
,
37 EFI_IP_ADDRESS
*StationIp
, OPTIONAL
38 EFI_IP_ADDRESS
*SubnetMask OPTIONAL
43 Notify callback function when an event is triggered.
45 @param[in] Event The triggered event.
46 @param[in] Context The opaque parameter to the function.
58 Perform arp resolution from the arp cache in PxeBcMode.
60 @param Mode Pointer to EFI_PXE_BASE_CODE_MODE.
61 @param Ip4Addr The Ip4 address for resolution.
62 @param MacAddress The resoluted MAC address if the resolution is successful.
63 The value is undefined if resolution fails.
65 @retval TRUE Found a matched entry.
66 @retval FALSE Did not find a matched entry.
71 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
72 IN EFI_IPv4_ADDRESS
*Ip4Addr
,
73 OUT EFI_MAC_ADDRESS
*MacAddress
78 Update arp cache periodically.
80 @param Event Pointer to EFI_PXE_BC_PROTOCOL.
81 @param Context Context of the timer event.
95 @param Event The event signaled.
96 @param Context The context passed in by the event notifier.
101 PxeBcIcmpErrorUpdate (
110 @param Event The event signaled.
111 @param Context The context passed in by the event notifier.
116 PxeBcIcmp6ErrorUpdate (
123 This function is to configure a UDPv4 instance for UdpWrite.
125 @param[in] Udp4 The pointer to EFI_UDP4_PROTOCOL.
126 @param[in] StationIp The pointer to the station address.
127 @param[in] SubnetMask The pointer to the subnet mask.
128 @param[in] Gateway The pointer to the gateway address.
129 @param[in, out] SrcPort The pointer to the source port.
130 @param[in] DoNotFragment If TRUE, fragment is not enabled.
131 Otherwise, fragment is enabled.
132 @param[in] Ttl The time to live field of the IP header.
133 @param[in] ToS The type of service field of the IP header.
135 @retval EFI_SUCCESS Successfully configured this instance.
136 @retval Others Failed to configure this instance.
140 PxeBcConfigUdp4Write (
141 IN EFI_UDP4_PROTOCOL
*Udp4
,
142 IN EFI_IPv4_ADDRESS
*StationIp
,
143 IN EFI_IPv4_ADDRESS
*SubnetMask
,
144 IN EFI_IPv4_ADDRESS
*Gateway
,
145 IN OUT UINT16
*SrcPort
,
146 IN BOOLEAN DoNotFragment
,
153 This function is to configure a UDPv6 instance for UdpWrite.
155 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
156 @param[in] StationIp Pointer to the station address.
157 @param[in, out] SrcPort Pointer to the source port.
159 @retval EFI_SUCCESS Successfuly configured this instance.
160 @retval Others Failed to configure this instance.
164 PxeBcConfigUdp6Write (
165 IN EFI_UDP6_PROTOCOL
*Udp6
,
166 IN EFI_IPv6_ADDRESS
*StationIp
,
167 IN OUT UINT16
*SrcPort
171 This function is to configure a UDPv4 instance for UdpWrite.
173 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
174 @param[in] Session Pointer to the UDP4 session data.
175 @param[in] TimeoutEvent The event for timeout.
176 @param[in] Gateway Pointer to the gateway address.
177 @param[in] HeaderSize An optional field which may be set to the length of a header
178 at HeaderPtr to be prefixed to the data at BufferPtr.
179 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
180 prefixed to the data at BufferPtr.
181 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
182 @param[in] BufferPtr A pointer to the data to be written.
184 @retval EFI_SUCCESS Successfully sent out data with Udp4Write.
185 @retval Others Failed to send out data.
190 IN EFI_UDP4_PROTOCOL
*Udp4
,
191 IN EFI_UDP4_SESSION_DATA
*Session
,
192 IN EFI_EVENT TimeoutEvent
,
193 IN EFI_IPv4_ADDRESS
*Gateway OPTIONAL
,
194 IN UINTN
*HeaderSize OPTIONAL
,
195 IN VOID
*HeaderPtr OPTIONAL
,
196 IN UINTN
*BufferSize
,
202 This function is to configure a UDPv6 instance for UdpWrite.
204 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
205 @param[in] Session Pointer to the UDP6 session data.
206 @param[in] TimeoutEvent The event for timeout.
207 @param[in] HeaderSize An optional field which may be set to the length of a header
208 at HeaderPtr to be prefixed to the data at BufferPtr.
209 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
210 prefixed to the data at BufferPtr.
211 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
212 @param[in] BufferPtr A pointer to the data to be written.
214 @retval EFI_SUCCESS Successfully to send out data with Udp6Write.
215 @retval Others Failed to send out data.
220 IN EFI_UDP6_PROTOCOL
*Udp6
,
221 IN EFI_UDP6_SESSION_DATA
*Session
,
222 IN EFI_EVENT TimeoutEvent
,
223 IN UINTN
*HeaderSize OPTIONAL
,
224 IN VOID
*HeaderPtr OPTIONAL
,
225 IN UINTN
*BufferSize
,
231 Check the received packet with the Ip filter.
233 @param[in] Mode Pointer to mode data of PxeBc.
234 @param[in] Session Pointer to the current UDPv4 session.
235 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
237 @retval TRUE Succesfully passed the Ip filter.
238 @retval FALSE Failed to pass the Ip filter.
242 PxeBcCheckByIpFilter (
243 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
250 Filter the received packet with the destination Ip.
252 @param[in] Mode Pointer to mode data of PxeBc.
253 @param[in] Session Pointer to the current UDPv4 session.
254 @param[in, out] DestIp Pointer to the dest Ip address.
255 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
257 @retval TRUE Succesfully passed the IPv4 filter.
258 @retval FALSE Failed to pass the IPv4 filter.
263 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
265 IN OUT EFI_IP_ADDRESS
*DestIp
,
271 Check the received packet with the destination port.
273 @param[in] Mode Pointer to mode data of PxeBc.
274 @param[in] Session Pointer to the current UDPv4 session.
275 @param[in, out] DestPort Pointer to the destination port.
276 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
278 @retval TRUE Succesfully passed the IPv4 filter.
279 @retval FALSE Failed to pass the IPv4 filter.
283 PxeBcCheckByDestPort (
284 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
286 IN OUT UINT16
*DestPort
,
292 Filter the received packet with the source Ip.
294 @param[in] Mode Pointer to mode data of PxeBc.
295 @param[in] Session Pointer to the current UDPv4 session.
296 @param[in, out] SrcIp Pointer to the source Ip address.
297 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
299 @retval TRUE Succesfully passed the IPv4 filter.
300 @retval FALSE Failed to pass the IPv4 filter.
305 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
307 IN OUT EFI_IP_ADDRESS
*SrcIp
,
313 Filter the received packet with the source port.
315 @param[in] Mode Pointer to mode data of PxeBc.
316 @param[in] Session Pointer to the current UDPv4 session.
317 @param[in, out] SrcPort Pointer to the source port.
318 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
320 @retval TRUE Succesfully passed the IPv4 filter.
321 @retval FALSE Failed to pass the IPv4 filter.
325 PxeBcFilterBySrcPort (
326 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
328 IN OUT UINT16
*SrcPort
,
334 This function is to receive packet with Udp4Read.
336 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
337 @param[in] Token Pointer to EFI_UDP4_COMPLETION_TOKEN.
338 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
339 @param[in] TimeoutEvent The event for timeout.
340 @param[in] OpFlags The UDP operation flags.
341 @param[in] IsDone Pointer to IsDone flag.
342 @param[out] IsMatched Pointer to IsMatched flag.
343 @param[in, out] DestIp Pointer to destination address.
344 @param[in, out] DestPort Pointer to destination port.
345 @param[in, out] SrcIp Pointer to source address.
346 @param[in, out] SrcPort Pointer to source port.
348 @retval EFI_SUCCESS Successfully read data with Udp4.
349 @retval Others Failed to send out data.
354 IN EFI_UDP4_PROTOCOL
*Udp4
,
355 IN EFI_UDP4_COMPLETION_TOKEN
*Token
,
356 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
357 IN EFI_EVENT TimeoutEvent
,
360 OUT BOOLEAN
*IsMatched
,
361 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
362 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
363 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
364 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
369 This function is to receive packet with Udp6Read.
371 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
372 @param[in] Token Pointer to EFI_UDP6_COMPLETION_TOKEN.
373 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
374 @param[in] TimeoutEvent The event for timeout.
375 @param[in] OpFlags The UDP operation flags.
376 @param[in] IsDone Pointer to IsDone flag.
377 @param[out] IsMatched Pointer to IsMatched flag.
378 @param[in, out] DestIp Pointer to destination address.
379 @param[in, out] DestPort Pointer to destination port.
380 @param[in, out] SrcIp Pointer to source address.
381 @param[in, out] SrcPort Pointer to source port.
383 @retval EFI_SUCCESS Successfully read data with Udp6.
384 @retval Others Failed to send out data.
389 IN EFI_UDP6_PROTOCOL
*Udp6
,
390 IN EFI_UDP6_COMPLETION_TOKEN
*Token
,
391 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
392 IN EFI_EVENT TimeoutEvent
,
395 OUT BOOLEAN
*IsMatched
,
396 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
397 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
398 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
399 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
404 This function is to display the IPv4 address.
406 @param[in] Ip Pointer to the IPv4 address.
411 IN EFI_IPv4_ADDRESS
*Ip
416 This function is to display the IPv6 address.
418 @param[in] Ip Pointer to the IPv6 address.
423 IN EFI_IPv6_ADDRESS
*Ip
428 This function is to convert UINTN to ASCII string with required format.
430 @param[in] Number Numeric value to be converted.
431 @param[in] Buffer Pointer to the buffer for ASCII string.
432 @param[in] Length Length of the required format.
436 PxeBcUintnToAscDecWithFormat (
444 This function is to convert a UINTN to a ASCII string, and return the
445 actual length of the buffer.
447 @param[in] Number Numeric value to be converted.
448 @param[in] Buffer Pointer to the buffer for ASCII string.
449 @param[in] BufferSize The maxsize of the buffer.
451 @return Length The actual length of the ASCII string.
462 This function is to convert unicode hex number to a UINT8.
464 @param[out] Digit The converted UINT8 for output.
465 @param[in] Char The unicode hex number to be converted.
467 @retval EFI_SUCCESS Successfully converted the unicode hex.
468 @retval EFI_INVALID_PARAMETER Failed to convert the unicode hex.
478 Calculate the elapsed time.
480 @param[in] Private The pointer to PXE private data
485 IN PXEBC_PRIVATE_DATA
*Private
489 Get the Nic handle using any child handle in the IPv4 stack.
491 @param[in] ControllerHandle Pointer to child handle over IPv4.
493 @return NicHandle The pointer to the Nic handle.
497 PxeBcGetNicByIp4Children (
498 IN EFI_HANDLE ControllerHandle
502 Get the Nic handle using any child handle in the IPv6 stack.
504 @param[in] ControllerHandle Pointer to child handle over IPv6.
506 @return NicHandle The pointer to the Nic handle.
510 PxeBcGetNicByIp6Children (
511 IN EFI_HANDLE ControllerHandle