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