Home | History | Annotate | Download | only in Ip4Dxe
      1 /** @file
      2   Header file for ICMP protocol.
      3 
      4 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
      5 This program and the accompanying materials
      6 are licensed and made available under the terms and conditions of the BSD License
      7 which accompanies this distribution.  The full text of the license may be found at
      8 http://opensource.org/licenses/bsd-license.php
      9 
     10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 #ifndef __EFI_IP4_ICMP_H__
     16 #define __EFI_IP4_ICMP_H__
     17 
     18   //
     19   // ICMP type definations
     20   //
     21 #define ICMP_ECHO_REPLY            0
     22 #define ICMP_DEST_UNREACHABLE      3
     23 #define ICMP_SOURCE_QUENCH         4
     24 #define ICMP_REDIRECT              5
     25 #define ICMP_ECHO_REQUEST          8
     26 #define ICMP_TIME_EXCEEDED         11
     27 #define ICMP_PARAMETER_PROBLEM     12
     28 #define ICMP_TIMESTAMP             13
     29 #define ICMP_INFO_REQUEST          15
     30 #define ICMP_INFO_REPLY            16
     31 #define ICMP_TYPE_MAX              ICMP_INFO_REPLY
     32 
     33 #define ICMP_DEFAULT_CODE          0
     34 
     35   //
     36   // ICMP code definations for ICMP_DEST_UNREACHABLE
     37   //
     38 #define ICMP_NET_UNREACHABLE       0
     39 #define ICMP_HOST_UNREACHABLE      1
     40 #define ICMP_PROTO_UNREACHABLE     2  // Host may generate
     41 #define ICMP_PORT_UNREACHABLE      3  // Host may generate
     42 #define ICMP_FRAGMENT_FAILED       4
     43 #define ICMP_SOURCEROUTE_FAILED    5  // Host may generate
     44 #define ICMP_NET_UNKNOWN           6
     45 #define ICMP_HOST_UNKNOWN          7
     46 #define ICMP_SOURCE_ISOLATED       8
     47 #define ICMP_NET_PROHIBITED        9
     48 #define ICMP_HOST_PROHIBITED       10
     49 #define ICMP_NET_UNREACHABLE_TOS   11
     50 #define ICMP_HOST_UNREACHABLE_TOS  12
     51 
     52   //
     53   // ICMP code definations for ICMP_TIME_EXCEEDED
     54   //
     55 #define ICMP_TIMEOUT_IN_TRANSIT    0
     56 #define ICMP_TIMEOUT_REASSEMBLE    1  // Host may generate
     57 
     58   //
     59   // ICMP code definations for ICMP_TIME_EXCEEDED
     60   //
     61 #define ICMP_NET_REDIRECT          0
     62 #define ICMP_HOST_REDIRECT         1
     63 #define ICMP_NET_TOS_REDIRECT      2
     64 #define ICMP_HOST_TOS_REDIRECT     3
     65 
     66   //
     67   // ICMP message classes, each class of ICMP message shares
     68   // a common message format. INVALID_MESSAGE is only a flag.
     69   //
     70 #define ICMP_INVALID_MESSAGE       0
     71 #define ICMP_ERROR_MESSAGE         1
     72 #define ICMP_QUERY_MESSAGE         2
     73 
     74 typedef struct {
     75   UINT8                   IcmpType;
     76   UINT8                   IcmpClass;
     77 } IP4_ICMP_CLASS;
     78 
     79 extern IP4_ICMP_CLASS     mIcmpClass[];
     80 extern EFI_IP4_ICMP_TYPE  mIp4SupportedIcmp[];
     81 
     82 /**
     83   Handle the ICMP packet. First validate the message format,
     84   then according to the message types, process it as query or
     85   error packet.
     86 
     87   @param[in]  IpSb               The IP4 service that receivd the packet.
     88   @param[in]  Head               The IP4 head of the ICMP query packet.
     89   @param[in]  Packet             The content of the ICMP query with IP4 head
     90                                  removed.
     91 
     92   @retval EFI_INVALID_PARAMETER  The packet is malformated.
     93   @retval EFI_SUCCESS            The ICMP message is successfully processed.
     94   @retval Others                 Failed to handle ICMP packet.
     95 
     96 **/
     97 EFI_STATUS
     98 Ip4IcmpHandle (
     99   IN IP4_SERVICE            *IpSb,
    100   IN IP4_HEAD               *Head,
    101   IN NET_BUF                *Packet
    102   );
    103 #endif
    104