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