-rw-r--r-- | shared-code/ms_icmp.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/shared-code/ms_icmp.h b/shared-code/ms_icmp.h new file mode 100644 index 0000000..32d97f5 --- a/dev/null +++ b/shared-code/ms_icmp.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /*------------------------------------------------------------------ | ||
2 | * Filename: MS_ICMP.H | ||
3 | * | ||
4 | * Description: Prototypes of Microsoft's ICMP.DLL functions for | ||
5 | * access to Internet Control Message Protocol (their stacks do | ||
6 | * not support the standard Berkeley Sockets raw socket API). | ||
7 | * Use this to do "ping" or "traceroute," although beware that | ||
8 | * Microsoft discourages its use. | ||
9 | */ | ||
10 | |||
11 | |||
12 | /* Note 2: For the most part, you can refer to RFC 791 for detials on | ||
13 | * how to fill in values for the IP option information structure. */ | ||
14 | typedef struct ip_option_information { | ||
15 | u_char Ttl; /* Time To Live (used for traceroute) */ | ||
16 | u_char Tos; /* Type Of Service (usually 0) */ | ||
17 | u_char Flags; /* IP header flags (usually 0) */ | ||
18 | u_char OptionsSize; /* Size of options data (usually 0, max 40) */ | ||
19 | u_char FAR *OptionsData;/* Options data buffer */ | ||
20 | }IPINFO, *PIPINFO, FAR *LPIPINFO; | ||
21 | |||
22 | /* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY | ||
23 | * structures, followed by options and the data in ICMP echo reply | ||
24 | * datagram received. You must have room for at least one ICMP | ||
25 | * echo reply structure, plus 8 bytes for an ICMP header. */ | ||
26 | typedef struct icmp_echo_reply { | ||
27 | u_long Address; /* source address */ | ||
28 | u_long Status; /* IP status value (see below) */ | ||
29 | u_long RTTime; /* Round Trip Time in milliseconds */ | ||
30 | u_short DataSize; /* reply data size */ | ||
31 | u_short Reserved; /* */ | ||
32 | void FAR *Data; /* reply data buffer */ | ||
33 | typedef struct ip_option_information Options; /* reply options */ | ||
34 | }ICMPECHO, *PICMPECHO, FAR *LPICMPECHO; | ||
35 | |||
36 | #define IP_STATUS_BASE 11000 | ||
37 | #define IP_SUCCESS 0 | ||
38 | #define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1) | ||
39 | #define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2) | ||
40 | #define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3) | ||
41 | #define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4) | ||
42 | #define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5) | ||
43 | #define IP_NO_RESOURCES (IP_STATUS_BASE + 6) | ||
44 | #define IP_BAD_OPTION (IP_STATUS_BASE + 7) | ||
45 | #define IP_HW_ERROR (IP_STATUS_BASE + 8) | ||
46 | #define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9) | ||
47 | #define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10) | ||
48 | #define IP_BAD_REQ (IP_STATUS_BASE + 11) | ||
49 | #define IP_BAD_ROUTE (IP_STATUS_BASE + 12) | ||
50 | #define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13) | ||
51 | #define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14) | ||
52 | #define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15) | ||
53 | #define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16) | ||
54 | #define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17) | ||
55 | #define IP_BAD_DESTINATION (IP_STATUS_BASE + 18) | ||
56 | #define IP_ADDR_DELETED (IP_STATUS_BASE + 19) | ||
57 | #define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20) | ||
58 | #define IP_MTU_CHANGE (IP_STATUS_BASE + 21) | ||
59 | #define IP_UNLOAD (IP_STATUS_BASE + 22) | ||
60 | #define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50) | ||
61 | #define MAX_IP_STATUS IP_GENERAL_FAILURE | ||
62 | #define IP_PENDING (IP_STATUS_BASE + 255) | ||
63 | |||
64 | |||
65 | HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */ | ||
66 | BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */ | ||
67 | DWORD WINAPI PASCAL IcmpSendEcho( | ||
68 | HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */ | ||
69 | u_long DestAddress, /* destination IP address (in network order) */ | ||
70 | LPVOID RequestData, /* pointer to buffer to send */ | ||
71 | WORD RequestSize, /* length of data in buffer */ | ||
72 | LPIPINFO RequestOptns, /* see Note 2 below */ | ||
73 | LPVOID ReplyBuffer, /* see Note 1 below */ | ||
74 | DWORD ReplySize, /* length of reply (must allow at least 1 reply) */ | ||
75 | DWORD Timeout /* time in milliseconds to wait for reply */ | ||
76 | ); | ||
77 | |||