xref: /reactos/drivers/network/tcpip/include/icmp.h (revision c2c66aff)
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 typedef struct ICMP_HEADER {
11     UCHAR Type;      /* ICMP message type */
12     UCHAR Code;      /* ICMP message code */
13     USHORT Checksum; /* ICMP message checksum */
14     ULONG Unused;    /* ICMP unused */
15 } ICMP_HEADER, *PICMP_HEADER;
16 
17 /* ICMP message types */
18 #define ICMP_TYPE_ECHO_REPLY        0  /* Echo reply */
19 #define ICMP_TYPE_DEST_UNREACH      3  /* Destination unreachable */
20 #define ICMP_TYPE_SOURCE_QUENCH     4  /* Source quench */
21 #define ICMP_TYPE_REDIRECT          5  /* Redirect */
22 #define ICMP_TYPE_ECHO_REQUEST      8  /* Echo request */
23 #define ICMP_TYPE_TIME_EXCEEDED     11 /* Time exceeded */
24 #define ICMP_TYPE_PARAMETER         12 /* Parameter problem */
25 #define ICMP_TYPE_TIMESTAMP_REQUEST 13 /* Timestamp request */
26 #define ICMP_TYPE_TIMESTAMP_REPLY   14 /* Timestamp reply */
27 #define ICMP_TYPE_INFO_REQUEST      15 /* Information request */
28 #define ICMP_TYPE_INFO_REPLY        16 /* Information reply */
29 
30 /* ICMP codes for ICMP_TYPE_DEST_UNREACH */
31 #define ICMP_CODE_DU_NET_UNREACH         0 /* Network unreachable */
32 #define ICMP_CODE_DU_HOST_UNREACH        1 /* Host unreachable */
33 #define ICMP_CODE_DU_PROTOCOL_UNREACH    2 /* Protocol unreachable */
34 #define ICMP_CODE_DU_PORT_UNREACH        3 /* Port unreachable */
35 #define ICMP_CODE_DU_FRAG_DF_SET         4 /* Fragmentation needed and DF set */
36 #define ICMP_CODE_DU_SOURCE_ROUTE_FAILED 5 /* Source route failed */
37 
38 /* ICMP codes for ICMP_TYPE_REDIRECT */
39 #define ICMP_CODE_RD_NET      0 /* Redirect datagrams for the network */
40 #define ICMP_CODE_RD_HOST     1 /* Redirect datagrams for the host */
41 #define ICMP_CODE_RD_TOS_NET  2 /* Redirect datagrams for the Type of Service and network */
42 #define ICMP_CODE_RD_TOS_HOST 3 /* Redirect datagrams for the Type of Service and host */
43 
44 /* ICMP codes for ICMP_TYPE_TIME_EXCEEDED */
45 #define ICMP_CODE_TE_TTL        0 /* Time to live exceeded in transit */
46 #define ICMP_CODE_TE_REASSEMBLY 1 /* Fragment reassembly time exceeded */
47 
48 /* ICMP codes for ICMP_TYPE_PARAMETER */
49 #define ICMP_CODE_TP_POINTER 1 /* Pointer indicates the error */
50 
51 NTSTATUS ICMPSendDatagram(
52     PADDRESS_FILE AddrFile,
53     PTDI_CONNECTION_INFORMATION ConnInfo,
54     PCHAR BufferData,
55     ULONG DataSize,
56     PULONG DataUsed );
57 
58 NTSTATUS ICMPStartup(VOID);
59 
60 NTSTATUS ICMPShutdown(VOID);
61 
62 VOID ICMPReceive(
63     PIP_INTERFACE Interface,
64     PIP_PACKET IPPacket);
65 
66 VOID ICMPTransmit(
67     PIP_PACKET IPPacket,
68     PIP_TRANSMIT_COMPLETE Complete,
69     PVOID Context);
70 
71 VOID ICMPReply(
72     PIP_INTERFACE Interface,
73     PIP_PACKET IPPacket,
74     UCHAR Type,
75     UCHAR Code);
76 
77 /* EOF */
78