xref: /reactos/drivers/network/tcpip/include/icmp.h (revision 740a859e)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS TCP/IP protocol driver
4  * FILE:        include/icmp.h
5  * PURPOSE:     Internet Control Message Protocol definitions
6  */
7 
8 #pragma once
9 
10 #include <pshpack1.h>
11 typedef struct ICMP_HEADER {
12     UINT8 Type;        /* ICMP message type */
13     UINT8 Code;        /* ICMP message code */
14     UINT16 Checksum;   /* ICMP message checksum */
15     UINT16 Identifier; /* ICMP Echo message identifier */
16     UINT16 Seq;        /* ICMP Echo message sequence num */
17 } ICMP_HEADER, *PICMP_HEADER;
18 #include <poppack.h>
19 
20 /* ICMP message types */
21 #define ICMP_TYPE_ECHO_REPLY        0  /* Echo reply */
22 #define ICMP_TYPE_DEST_UNREACH      3  /* Destination unreachable */
23 #define ICMP_TYPE_SOURCE_QUENCH     4  /* Source quench */
24 #define ICMP_TYPE_REDIRECT          5  /* Redirect */
25 #define ICMP_TYPE_ECHO_REQUEST      8  /* Echo request */
26 #define ICMP_TYPE_TIME_EXCEEDED     11 /* Time exceeded */
27 #define ICMP_TYPE_PARAMETER         12 /* Parameter problem */
28 #define ICMP_TYPE_TIMESTAMP_REQUEST 13 /* Timestamp request */
29 #define ICMP_TYPE_TIMESTAMP_REPLY   14 /* Timestamp reply */
30 #define ICMP_TYPE_INFO_REQUEST      15 /* Information request */
31 #define ICMP_TYPE_INFO_REPLY        16 /* Information reply */
32 
33 /* ICMP codes for ICMP_TYPE_DEST_UNREACH */
34 #define ICMP_CODE_DU_NET_UNREACH         0 /* Network unreachable */
35 #define ICMP_CODE_DU_HOST_UNREACH        1 /* Host unreachable */
36 #define ICMP_CODE_DU_PROTOCOL_UNREACH    2 /* Protocol unreachable */
37 #define ICMP_CODE_DU_PORT_UNREACH        3 /* Port unreachable */
38 #define ICMP_CODE_DU_FRAG_DF_SET         4 /* Fragmentation needed and DF set */
39 #define ICMP_CODE_DU_SOURCE_ROUTE_FAILED 5 /* Source route failed */
40 
41 /* ICMP codes for ICMP_TYPE_REDIRECT */
42 #define ICMP_CODE_RD_NET      0 /* Redirect datagrams for the network */
43 #define ICMP_CODE_RD_HOST     1 /* Redirect datagrams for the host */
44 #define ICMP_CODE_RD_TOS_NET  2 /* Redirect datagrams for the Type of Service and network */
45 #define ICMP_CODE_RD_TOS_HOST 3 /* Redirect datagrams for the Type of Service and host */
46 
47 /* ICMP codes for ICMP_TYPE_TIME_EXCEEDED */
48 #define ICMP_CODE_TE_TTL        0 /* Time to live exceeded in transit */
49 #define ICMP_CODE_TE_REASSEMBLY 1 /* Fragment reassembly time exceeded */
50 
51 /* ICMP codes for ICMP_TYPE_PARAMETER */
52 #define ICMP_CODE_TP_POINTER 1 /* Pointer indicates the error */
53 
54 NTSTATUS
55 DispEchoRequest(
56     PDEVICE_OBJECT DeviceObject,
57     PIRP Irp,
58     PIO_STACK_LOCATION IrpSp);
59 
60 NTSTATUS ICMPSendDatagram(
61     PADDRESS_FILE AddrFile,
62     PTDI_CONNECTION_INFORMATION ConnInfo,
63     PCHAR BufferData,
64     ULONG DataSize,
65     PULONG DataUsed );
66 
67 NTSTATUS ICMPStartup(VOID);
68 
69 NTSTATUS ICMPShutdown(VOID);
70 
71 VOID ICMPReceive(
72     PIP_INTERFACE Interface,
73     PIP_PACKET IPPacket);
74 
75 VOID ICMPReply(
76     PIP_INTERFACE Interface,
77     PIP_PACKET IPPacket,
78     UCHAR Type,
79     UCHAR Code);
80 
81 /* EOF */
82