Ip6Icmp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /** @file
  2. Header file for ICMPv6 protocol.
  3. Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __EFI_IP6_ICMP_H__
  7. #define __EFI_IP6_ICMP_H__
  8. #define ICMP_V6_DEFAULT_CODE 0
  9. #define ICMP_V6_ERROR_MAX 127
  10. //
  11. // ICMPv6 message classes, each class of ICMPv6 message shares
  12. // a common message format. INVALID_MESSAGE is only a flag.
  13. //
  14. #define ICMP_V6_INVALID_MESSAGE 0
  15. #define ICMP_V6_ERROR_MESSAGE 1
  16. #define ICMP_V6_INFORMATION_MESSAGE 2
  17. extern EFI_IP6_ICMP_TYPE mIp6SupportedIcmp[];
  18. /**
  19. Handle the ICMPv6 packet. First validate the message format,
  20. then, according to the message types, process it as an informational packet or
  21. an error packet.
  22. @param[in] IpSb The IP service that received the packet.
  23. @param[in] Head The IP head of the ICMPv6 packet.
  24. @param[in] Packet The content of the ICMPv6 packet with IP head
  25. removed.
  26. @retval EFI_INVALID_PARAMETER The packet is malformatted.
  27. @retval EFI_SUCCESS The ICMPv6 message successfully processed.
  28. @retval Others Failed to handle the ICMPv6 packet.
  29. **/
  30. EFI_STATUS
  31. Ip6IcmpHandle (
  32. IN IP6_SERVICE *IpSb,
  33. IN EFI_IP6_HEADER *Head,
  34. IN NET_BUF *Packet
  35. );
  36. /**
  37. Check whether the DestinationAddress is an anycast address.
  38. @param[in] IpSb The IP service that received the packet.
  39. @param[in] DestinationAddress Points to the Destination Address of the packet.
  40. @retval TRUE The DestinationAddress is anycast address.
  41. @retval FALSE The DestinationAddress is not anycast address.
  42. **/
  43. BOOLEAN
  44. Ip6IsAnycast (
  45. IN IP6_SERVICE *IpSb,
  46. IN EFI_IPv6_ADDRESS *DestinationAddress
  47. );
  48. /**
  49. Generate ICMPv6 error message and send it out to DestinationAddress. Currently
  50. Destination Unreachable message, Time Exceeded message and Parameter Problem
  51. message are supported.
  52. @param[in] IpSb The IP service that received the packet.
  53. @param[in] Packet The packet which invoking ICMPv6 error.
  54. @param[in] SourceAddress If not NULL, points to the SourceAddress.
  55. Otherwise, the IP layer will select a source address
  56. according to the DestinationAddress.
  57. @param[in] DestinationAddress Points to the Destination Address of the ICMPv6
  58. error message.
  59. @param[in] Type The type of the ICMPv6 message.
  60. @param[in] Code The additional level of the ICMPv6 message.
  61. @param[in] Pointer If not NULL, identifies the octet offset within
  62. the invoking packet where the error was detected.
  63. @retval EFI_INVALID_PARAMETER The packet is malformatted.
  64. @retval EFI_OUT_OF_RESOURCES There is no sufficient resource to complete the
  65. operation.
  66. @retval EFI_SUCCESS The ICMPv6 message was successfully sent out.
  67. @retval Others Failed to generate the ICMPv6 packet.
  68. **/
  69. EFI_STATUS
  70. Ip6SendIcmpError (
  71. IN IP6_SERVICE *IpSb,
  72. IN NET_BUF *Packet,
  73. IN EFI_IPv6_ADDRESS *SourceAddress OPTIONAL,
  74. IN EFI_IPv6_ADDRESS *DestinationAddress,
  75. IN UINT8 Type,
  76. IN UINT8 Code,
  77. IN UINT32 *Pointer OPTIONAL
  78. );
  79. #endif