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__
13 #define ICMP_DEST_UNREACHABLE 3
14 #define ICMP_SOURCE_QUENCH 4
15 #define ICMP_REDIRECT 5
16 #define ICMP_ECHO_REQUEST 8
17 #define ICMP_TIME_EXCEEDED 11
18 #define ICMP_PARAMETER_PROBLEM 12
21 Flush the previous configuration using the new station Ip address.
23 @param[in] Private Pointer to PxeBc private data.
24 @param[in] StationIp Pointer to the station Ip address.
25 @param[in] SubnetMask Pointer to the subnet mask address for v4.
27 @retval EFI_SUCCESS Successfully flushed the previous config.
28 @retval Others Failed to flush using the new station Ip.
33 PXEBC_PRIVATE_DATA
*Private
,
34 EFI_IP_ADDRESS
*StationIp OPTIONAL
,
35 EFI_IP_ADDRESS
*SubnetMask OPTIONAL
39 Notify callback function when an event is triggered.
41 @param[in] Event The triggered event.
42 @param[in] Context The opaque parameter to the function.
53 Perform arp resolution from the arp cache in PxeBcMode.
55 @param Mode Pointer to EFI_PXE_BASE_CODE_MODE.
56 @param Ip4Addr The Ip4 address for resolution.
57 @param MacAddress The resolved MAC address if the resolution is successful.
58 The value is undefined if resolution fails.
60 @retval TRUE Found a matched entry.
61 @retval FALSE Did not find a matched entry.
66 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
67 IN EFI_IPv4_ADDRESS
*Ip4Addr
,
68 OUT EFI_MAC_ADDRESS
*MacAddress
72 Update arp cache periodically.
74 @param Event Pointer to EFI_PXE_BC_PROTOCOL.
75 @param Context Context of the timer event.
88 @param Event The event signaled.
89 @param Context The context passed in by the event notifier.
94 PxeBcIcmpErrorUpdate (
102 @param Event The event signaled.
103 @param Context The context passed in by the event notifier.
108 PxeBcIcmp6ErrorUpdate (
114 This function is to configure a UDPv4 instance for UdpWrite.
116 @param[in] Udp4 The pointer to EFI_UDP4_PROTOCOL.
117 @param[in] StationIp The pointer to the station address.
118 @param[in] SubnetMask The pointer to the subnet mask.
119 @param[in] Gateway The pointer to the gateway address.
120 @param[in, out] SrcPort The pointer to the source port.
121 @param[in] DoNotFragment If TRUE, fragment is not enabled.
122 Otherwise, fragment is enabled.
123 @param[in] Ttl The time to live field of the IP header.
124 @param[in] ToS The type of service field of the IP header.
126 @retval EFI_SUCCESS Successfully configured this instance.
127 @retval Others Failed to configure this instance.
131 PxeBcConfigUdp4Write (
132 IN EFI_UDP4_PROTOCOL
*Udp4
,
133 IN EFI_IPv4_ADDRESS
*StationIp
,
134 IN EFI_IPv4_ADDRESS
*SubnetMask
,
135 IN EFI_IPv4_ADDRESS
*Gateway
,
136 IN OUT UINT16
*SrcPort
,
137 IN BOOLEAN DoNotFragment
,
143 This function is to configure a UDPv6 instance for UdpWrite.
145 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
146 @param[in] StationIp Pointer to the station address.
147 @param[in, out] SrcPort Pointer to the source port.
149 @retval EFI_SUCCESS Successfully configured this instance.
150 @retval Others Failed to configure this instance.
154 PxeBcConfigUdp6Write (
155 IN EFI_UDP6_PROTOCOL
*Udp6
,
156 IN EFI_IPv6_ADDRESS
*StationIp
,
157 IN OUT UINT16
*SrcPort
161 This function is to configure a UDPv4 instance for UdpWrite.
163 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
164 @param[in] Session Pointer to the UDP4 session data.
165 @param[in] TimeoutEvent The event for timeout.
166 @param[in] Gateway Pointer to the gateway address.
167 @param[in] HeaderSize An optional field which may be set to the length of a header
168 at HeaderPtr to be prefixed to the data at BufferPtr.
169 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
170 prefixed to the data at BufferPtr.
171 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
172 @param[in] BufferPtr A pointer to the data to be written.
174 @retval EFI_SUCCESS Successfully sent out data with Udp4Write.
175 @retval Others Failed to send out data.
180 IN EFI_UDP4_PROTOCOL
*Udp4
,
181 IN EFI_UDP4_SESSION_DATA
*Session
,
182 IN EFI_EVENT TimeoutEvent
,
183 IN EFI_IPv4_ADDRESS
*Gateway OPTIONAL
,
184 IN UINTN
*HeaderSize OPTIONAL
,
185 IN VOID
*HeaderPtr OPTIONAL
,
186 IN UINTN
*BufferSize
,
191 This function is to configure a UDPv6 instance for UdpWrite.
193 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
194 @param[in] Session Pointer to the UDP6 session data.
195 @param[in] TimeoutEvent The event for timeout.
196 @param[in] HeaderSize An optional field which may be set to the length of a header
197 at HeaderPtr to be prefixed to the data at BufferPtr.
198 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
199 prefixed to the data at BufferPtr.
200 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
201 @param[in] BufferPtr A pointer to the data to be written.
203 @retval EFI_SUCCESS Successfully to send out data with Udp6Write.
204 @retval Others Failed to send out data.
209 IN EFI_UDP6_PROTOCOL
*Udp6
,
210 IN EFI_UDP6_SESSION_DATA
*Session
,
211 IN EFI_EVENT TimeoutEvent
,
212 IN UINTN
*HeaderSize OPTIONAL
,
213 IN VOID
*HeaderPtr OPTIONAL
,
214 IN UINTN
*BufferSize
,
219 Check the received packet with the Ip filter.
221 @param[in] Mode Pointer to mode data of PxeBc.
222 @param[in] Session Pointer to the current UDPv4 session.
223 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
225 @retval TRUE Successfully passed the Ip filter.
226 @retval FALSE Failed to pass the Ip filter.
230 PxeBcCheckByIpFilter (
231 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
237 Filter the received packet with the destination Ip.
239 @param[in] Mode Pointer to mode data of PxeBc.
240 @param[in] Session Pointer to the current UDPv4 session.
241 @param[in, out] DestIp Pointer to the dest Ip address.
242 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
244 @retval TRUE Successfully passed the IPv4 filter.
245 @retval FALSE Failed to pass the IPv4 filter.
250 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
252 IN OUT EFI_IP_ADDRESS
*DestIp
,
257 Check the received packet with the destination port.
259 @param[in] Mode Pointer to mode data of PxeBc.
260 @param[in] Session Pointer to the current UDPv4 session.
261 @param[in, out] DestPort Pointer to the destination port.
262 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
264 @retval TRUE Successfully passed the IPv4 filter.
265 @retval FALSE Failed to pass the IPv4 filter.
269 PxeBcCheckByDestPort (
270 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
272 IN OUT UINT16
*DestPort
,
277 Filter the received packet with the source Ip.
279 @param[in] Mode Pointer to mode data of PxeBc.
280 @param[in] Session Pointer to the current UDPv4 session.
281 @param[in, out] SrcIp Pointer to the source Ip address.
282 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
284 @retval TRUE Successfully passed the IPv4 filter.
285 @retval FALSE Failed to pass the IPv4 filter.
290 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
292 IN OUT EFI_IP_ADDRESS
*SrcIp
,
297 Filter the received packet with the source port.
299 @param[in] Mode Pointer to mode data of PxeBc.
300 @param[in] Session Pointer to the current UDPv4 session.
301 @param[in, out] SrcPort Pointer to the source port.
302 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
304 @retval TRUE Successfully passed the IPv4 filter.
305 @retval FALSE Failed to pass the IPv4 filter.
309 PxeBcFilterBySrcPort (
310 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
312 IN OUT UINT16
*SrcPort
,
317 This function is to receive packet with Udp4Read.
319 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
320 @param[in] Token Pointer to EFI_UDP4_COMPLETION_TOKEN.
321 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
322 @param[in] TimeoutEvent The event for timeout.
323 @param[in] OpFlags The UDP operation flags.
324 @param[in] IsDone Pointer to IsDone flag.
325 @param[out] IsMatched Pointer to IsMatched flag.
326 @param[in, out] DestIp Pointer to destination address.
327 @param[in, out] DestPort Pointer to destination port.
328 @param[in, out] SrcIp Pointer to source address.
329 @param[in, out] SrcPort Pointer to source port.
331 @retval EFI_SUCCESS Successfully read data with Udp4.
332 @retval Others Failed to send out data.
337 IN EFI_UDP4_PROTOCOL
*Udp4
,
338 IN EFI_UDP4_COMPLETION_TOKEN
*Token
,
339 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
340 IN EFI_EVENT TimeoutEvent
,
343 OUT BOOLEAN
*IsMatched
,
344 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
345 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
346 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
347 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
351 This function is to receive packet with Udp6Read.
353 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
354 @param[in] Token Pointer to EFI_UDP6_COMPLETION_TOKEN.
355 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
356 @param[in] TimeoutEvent The event for timeout.
357 @param[in] OpFlags The UDP operation flags.
358 @param[in] IsDone Pointer to IsDone flag.
359 @param[out] IsMatched Pointer to IsMatched flag.
360 @param[in, out] DestIp Pointer to destination address.
361 @param[in, out] DestPort Pointer to destination port.
362 @param[in, out] SrcIp Pointer to source address.
363 @param[in, out] SrcPort Pointer to source port.
365 @retval EFI_SUCCESS Successfully read data with Udp6.
366 @retval Others Failed to send out data.
371 IN EFI_UDP6_PROTOCOL
*Udp6
,
372 IN EFI_UDP6_COMPLETION_TOKEN
*Token
,
373 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
374 IN EFI_EVENT TimeoutEvent
,
377 OUT BOOLEAN
*IsMatched
,
378 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
379 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
380 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
381 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
385 This function is to display the IPv4 address.
387 @param[in] Ip Pointer to the IPv4 address.
392 IN EFI_IPv4_ADDRESS
*Ip
396 This function is to display the IPv6 address.
398 @param[in] Ip Pointer to the IPv6 address.
403 IN EFI_IPv6_ADDRESS
*Ip
407 This function is to convert UINTN to ASCII string with required format.
409 @param[in] Number Numeric value to be converted.
410 @param[in] Buffer Pointer to the buffer for ASCII string.
411 @param[in] Length Length of the required format.
415 PxeBcUintnToAscDecWithFormat (
422 This function is to convert a UINTN to a ASCII string, and return the
423 actual length of the buffer.
425 @param[in] Number Numeric value to be converted.
426 @param[in] Buffer Pointer to the buffer for ASCII string.
427 @param[in] BufferSize The maxsize of the buffer.
429 @return Length The actual length of the ASCII string.
440 This function is to convert unicode hex number to a UINT8.
442 @param[out] Digit The converted UINT8 for output.
443 @param[in] Char The unicode hex number to be converted.
445 @retval EFI_SUCCESS Successfully converted the unicode hex.
446 @retval EFI_INVALID_PARAMETER Failed to convert the unicode hex.
456 Calculate the elapsed time.
458 @param[in] Private The pointer to PXE private data
463 IN PXEBC_PRIVATE_DATA
*Private
467 Get the Nic handle using any child handle in the IPv4 stack.
469 @param[in] ControllerHandle Pointer to child handle over IPv4.
471 @return NicHandle The pointer to the Nic handle.
475 PxeBcGetNicByIp4Children (
476 IN EFI_HANDLE ControllerHandle
480 Get the Nic handle using any child handle in the IPv6 stack.
482 @param[in] ControllerHandle Pointer to child handle over IPv6.
484 @return NicHandle The pointer to the Nic handle.
488 PxeBcGetNicByIp6Children (
489 IN EFI_HANDLE ControllerHandle