2 Support functions declaration for UefiPxeBc Driver.
4 Copyright (c) 2007 - 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_PXEBC_SUPPORT_H__
17 #define __EFI_PXEBC_SUPPORT_H__
20 #define ICMP_DEST_UNREACHABLE 3
21 #define ICMP_SOURCE_QUENCH 4
22 #define ICMP_REDIRECT 5
23 #define ICMP_ECHO_REQUEST 8
24 #define ICMP_TIME_EXCEEDED 11
25 #define ICMP_PARAMETER_PROBLEM 12
29 This function obtain the system guid and serial number from the smbios table.
31 @param[out] SystemGuid The pointer of returned system guid.
33 @retval EFI_SUCCESS Successfully obtained the system guid.
34 @retval EFI_NOT_FOUND Did not find the SMBIOS table.
39 OUT EFI_GUID
*SystemGuid
44 Flush the previous configration using the new station Ip address.
46 @param[in] Private Pointer to PxeBc private data.
47 @param[in] StationIp Pointer to the station Ip address.
48 @param[in] SubnetMask Pointer to the subnet mask address for v4.
50 @retval EFI_SUCCESS Successfully flushed the previous config.
51 @retval Others Failed to flush using the new station Ip.
56 PXEBC_PRIVATE_DATA
*Private
,
57 EFI_IP_ADDRESS
*StationIp
,
58 EFI_IP_ADDRESS
*SubnetMask OPTIONAL
63 Notify callback function when an event is triggered.
65 @param[in] Event The triggered event.
66 @param[in] Context The opaque parameter to the function.
78 Perform arp resolution from the arp cache in PxeBcMode.
80 @param Mode Pointer to EFI_PXE_BASE_CODE_MODE.
81 @param Ip4Addr The Ip4 address for resolution.
82 @param MacAddress The resoluted MAC address if the resolution is successful.
83 The value is undefined if resolution fails.
85 @retval TRUE Found a matched entry.
86 @retval FALSE Did not find a matched entry.
91 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
92 IN EFI_IPv4_ADDRESS
*Ip4Addr
,
93 OUT EFI_MAC_ADDRESS
*MacAddress
98 Update arp cache periodically.
100 @param Event Pointer to EFI_PXE_BC_PROTOCOL.
101 @param Context Context of the timer event.
106 PxeBcArpCacheUpdate (
115 @param Event The event signaled.
116 @param Context The context passed in by the event notifier.
121 PxeBcIcmpErrorUpdate (
130 @param Event The event signaled.
131 @param Context The context passed in by the event notifier.
136 PxeBcIcmp6ErrorUpdate (
143 This function is to configure a UDPv4 instance for UdpWrite.
145 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
146 @param[in] StationIp Pointer to the station address.
147 @param[in] SubnetMask Pointer to the subnet mask.
148 @param[in] Gateway Pointer to the gateway address.
149 @param[in, out] SrcPort Pointer to the source port.
150 @param[in] DoNotFragment The flag of DoNotFragment bit in the IPv4
153 @retval EFI_SUCCESS Successfully configured this instance.
154 @retval Others Failed to configure this instance.
158 PxeBcConfigUdp4Write (
159 IN EFI_UDP4_PROTOCOL
*Udp4
,
160 IN EFI_IPv4_ADDRESS
*StationIp
,
161 IN EFI_IPv4_ADDRESS
*SubnetMask
,
162 IN EFI_IPv4_ADDRESS
*Gateway
,
163 IN OUT UINT16
*SrcPort
,
164 IN BOOLEAN DoNotFragment
169 This function is to configure a UDPv6 instance for UdpWrite.
171 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
172 @param[in] StationIp Pointer to the station address.
173 @param[in, out] SrcPort Pointer to the source port.
175 @retval EFI_SUCCESS Successfuly configured this instance.
176 @retval Others Failed to configure this instance.
180 PxeBcConfigUdp6Write (
181 IN EFI_UDP6_PROTOCOL
*Udp6
,
182 IN EFI_IPv6_ADDRESS
*StationIp
,
183 IN OUT UINT16
*SrcPort
187 This function is to configure a UDPv4 instance for UdpWrite.
189 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
190 @param[in] Session Pointer to the UDP4 session data.
191 @param[in] TimeoutEvent The event for timeout.
192 @param[in] Gateway Pointer to the gateway address.
193 @param[in] HeaderSize An optional field which may be set to the length of a header
194 at HeaderPtr to be prefixed to the data at BufferPtr.
195 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
196 prefixed to the data at BufferPtr.
197 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
198 @param[in] BufferPtr A pointer to the data to be written.
200 @retval EFI_SUCCESS Successfully sent out data with Udp4Write.
201 @retval Others Failed to send out data.
206 IN EFI_UDP4_PROTOCOL
*Udp4
,
207 IN EFI_UDP4_SESSION_DATA
*Session
,
208 IN EFI_EVENT TimeoutEvent
,
209 IN EFI_IPv4_ADDRESS
*Gateway OPTIONAL
,
210 IN UINTN
*HeaderSize OPTIONAL
,
211 IN VOID
*HeaderPtr OPTIONAL
,
212 IN UINTN
*BufferSize
,
218 This function is to configure a UDPv6 instance for UdpWrite.
220 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
221 @param[in] Session Pointer to the UDP6 session data.
222 @param[in] TimeoutEvent The event for timeout.
223 @param[in] HeaderSize An optional field which may be set to the length of a header
224 at HeaderPtr to be prefixed to the data at BufferPtr.
225 @param[in] HeaderPtr If HeaderSize is not NULL, a pointer to a header to be
226 prefixed to the data at BufferPtr.
227 @param[in] BufferSize A pointer to the size of the data at BufferPtr.
228 @param[in] BufferPtr A pointer to the data to be written.
230 @retval EFI_SUCCESS Successfully to send out data with Udp6Write.
231 @retval Others Failed to send out data.
236 IN EFI_UDP6_PROTOCOL
*Udp6
,
237 IN EFI_UDP6_SESSION_DATA
*Session
,
238 IN EFI_EVENT TimeoutEvent
,
239 IN UINTN
*HeaderSize OPTIONAL
,
240 IN VOID
*HeaderPtr OPTIONAL
,
241 IN UINTN
*BufferSize
,
247 Check the received packet with the Ip filter.
249 @param[in] Mode Pointer to mode data of PxeBc.
250 @param[in] Session Pointer to the current UDPv4 session.
251 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
253 @retval TRUE Succesfully passed the Ip filter.
254 @retval FALSE Failed to pass the Ip filter.
258 PxeBcCheckByIpFilter (
259 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
266 Filter the received packet with the destination Ip.
268 @param[in] Mode Pointer to mode data of PxeBc.
269 @param[in] Session Pointer to the current UDPv4 session.
270 @param[in, out] DestIp Pointer to the dest Ip address.
271 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
273 @retval TRUE Succesfully passed the IPv4 filter.
274 @retval FALSE Failed to pass the IPv4 filter.
279 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
281 IN OUT EFI_IP_ADDRESS
*DestIp
,
287 Check the received packet with the destination port.
289 @param[in] PxeBcMode Pointer to mode data of PxeBc.
290 @param[in] Session Pointer to the current UDPv4 session.
291 @param[in, out] DestPort Pointer to the destination port.
292 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
294 @retval TRUE Succesfully passed the IPv4 filter.
295 @retval FALSE Failed to pass the IPv4 filter.
299 PxeBcCheckByDestPort (
300 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
302 IN OUT UINT16
*DestPort
,
308 Filter the received packet with the source Ip.
310 @param[in] Mode Pointer to mode data of PxeBc.
311 @param[in] Session Pointer to the current UDPv4 session.
312 @param[in, out] SrcIp Pointer to the source Ip address.
313 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
315 @retval TRUE Succesfully passed the IPv4 filter.
316 @retval FALSE Failed to pass the IPv4 filter.
321 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
323 IN OUT EFI_IP_ADDRESS
*SrcIp
,
329 Filter the received packet with the source port.
331 @param[in] Mode Pointer to mode data of PxeBc.
332 @param[in] Session Pointer to the current UDPv4 session.
333 @param[in, out] SrcPort Pointer to the source port.
334 @param[in] OpFlags Operation flag for UdpRead/UdpWrite.
336 @retval TRUE Succesfully passed the IPv4 filter.
337 @retval FALSE Failed to pass the IPv4 filter.
341 PxeBcFilterBySrcPort (
342 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
344 IN OUT UINT16
*SrcPort
,
350 This function is to receive packet with Udp4Read.
352 @param[in] Udp4 Pointer to EFI_UDP4_PROTOCOL.
353 @param[in] Token Pointer to EFI_UDP4_COMPLETION_TOKEN.
354 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
355 @param[in] TimeoutEvent The event for timeout.
356 @param[in] OpFlags The UDP operation flags.
357 @param[in] IsDone Pointer to IsDone flag.
358 @param[out] IsMatched Pointer to IsMatched flag.
359 @param[in, out] DestIp Pointer to destination address.
360 @param[in, out] DestPort Pointer to destination port.
361 @param[in, out] SrcIp Pointer to source address.
362 @param[in, out] SrcPort Pointer to source port.
364 @retval EFI_SUCCESS Successfully read data with Udp4.
365 @retval Others Failed to send out data.
370 IN EFI_UDP4_PROTOCOL
*Udp4
,
371 IN EFI_UDP4_COMPLETION_TOKEN
*Token
,
372 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
373 IN EFI_EVENT TimeoutEvent
,
376 OUT BOOLEAN
*IsMatched
,
377 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
378 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
379 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
380 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
385 This function is to receive packet with Udp6Read.
387 @param[in] Udp6 Pointer to EFI_UDP6_PROTOCOL.
388 @param[in] Token Pointer to EFI_UDP6_COMPLETION_TOKEN.
389 @param[in] Mode Pointer to EFI_PXE_BASE_CODE_MODE.
390 @param[in] TimeoutEvent The event for timeout.
391 @param[in] OpFlags The UDP operation flags.
392 @param[in] IsDone Pointer to IsDone flag.
393 @param[out] IsMatched Pointer to IsMatched flag.
394 @param[in, out] DestIp Pointer to destination address.
395 @param[in, out] DestPort Pointer to destination port.
396 @param[in, out] SrcIp Pointer to source address.
397 @param[in, out] SrcPort Pointer to source port.
399 @retval EFI_SUCCESS Successfully read data with Udp6.
400 @retval Others Failed to send out data.
405 IN EFI_UDP6_PROTOCOL
*Udp6
,
406 IN EFI_UDP6_COMPLETION_TOKEN
*Token
,
407 IN EFI_PXE_BASE_CODE_MODE
*Mode
,
408 IN EFI_EVENT TimeoutEvent
,
411 OUT BOOLEAN
*IsMatched
,
412 IN OUT EFI_IP_ADDRESS
*DestIp OPTIONAL
,
413 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*DestPort OPTIONAL
,
414 IN OUT EFI_IP_ADDRESS
*SrcIp OPTIONAL
,
415 IN OUT EFI_PXE_BASE_CODE_UDP_PORT
*SrcPort OPTIONAL
420 This function is to display the IPv4 address.
422 @param[in] Ip Pointer to the IPv4 address.
427 IN EFI_IPv4_ADDRESS
*Ip
432 This function is to display the IPv6 address.
434 @param[in] Ip Pointer to the IPv6 address.
439 IN EFI_IPv6_ADDRESS
*Ip
444 This function is to convert UINTN to ASCII string with required format.
446 @param[in] Number Numeric value to be converted.
447 @param[in] Buffer Pointer to the buffer for ASCII string.
448 @param[in] Length Length of the required format.
452 PxeBcUintnToAscDecWithFormat (
460 This function is to convert a UINTN to a ASCII string, and return the
461 actual length of the buffer.
463 @param[in] Number Numeric value to be converted.
464 @param[in] Buffer Pointer to the buffer for ASCII string.
466 @return Length The actual length of the ASCII string.
476 This function is to convert unicode hex number to a UINT8.
478 @param[out] Digit The converted UINT8 for output.
479 @param[in] Char The unicode hex number to be converted.
481 @retval EFI_SUCCESS Successfully converted the unicode hex.
482 @retval EFI_INVALID_PARAMETER Failed to convert the unicode hex.