00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef IP_EXPORT_INCLUDED
00036 #define IP_EXPORT_INCLUDED 1
00037
00038 #if _MSC_VER > 1000
00039 #pragma once
00040 #endif
00041
00042
00043
00044
00045 typedef ULONG IPAddr;
00046 typedef ULONG IPMask;
00047 typedef ULONG IP_STATUS;
00048
00049 #ifndef s6_addr
00050
00051
00052
00053
00054
00055
00056 typedef struct in6_addr {
00057 union {
00058 UCHAR Byte[16];
00059 USHORT Word[8];
00060 } u;
00061 } IN6_ADDR;
00062
00063 #define in_addr6 in6_addr
00064
00065
00066
00067
00068 #define _S6_un u
00069 #define _S6_u8 Byte
00070 #define s6_addr _S6_un._S6_u8
00071
00072
00073
00074
00075 #define s6_bytes u.Byte
00076 #define s6_words u.Word
00077
00078 #endif
00079
00080 typedef struct in6_addr IPv6Addr;
00081
00082 #ifndef s_addr
00083
00084 struct in_addr {
00085 union {
00086 struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
00087 struct { USHORT s_w1,s_w2; } S_un_w;
00088 ULONG S_addr;
00089 } S_un;
00090 };
00091 #define s_addr S_un.S_addr
00092
00093 #endif
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 typedef struct ip_option_information {
00111 UCHAR Ttl;
00112 UCHAR Tos;
00113 UCHAR Flags;
00114 UCHAR OptionsSize;
00115 PUCHAR OptionsData;
00116 } IP_OPTION_INFORMATION, *PIP_OPTION_INFORMATION;
00117
00118 #if defined(_WIN64)
00119
00120 typedef struct ip_option_information32 {
00121 UCHAR Ttl;
00122 UCHAR Tos;
00123 UCHAR Flags;
00124 UCHAR OptionsSize;
00125 UCHAR * POINTER_32 OptionsData;
00126 } IP_OPTION_INFORMATION32, *PIP_OPTION_INFORMATION32;
00127
00128 #endif // _WIN64
00129
00130
00131
00132
00133
00134
00135 typedef struct icmp_echo_reply {
00136 IPAddr Address;
00137 ULONG Status;
00138 ULONG RoundTripTime;
00139 USHORT DataSize;
00140 USHORT Reserved;
00141 PVOID Data;
00142 struct ip_option_information Options;
00143 } ICMP_ECHO_REPLY, *PICMP_ECHO_REPLY;
00144
00145 #if defined(_WIN64)
00146
00147 typedef struct icmp_echo_reply32 {
00148 IPAddr Address;
00149 ULONG Status;
00150 ULONG RoundTripTime;
00151 USHORT DataSize;
00152 USHORT Reserved;
00153 VOID * POINTER_32 Data;
00154 struct ip_option_information32 Options;
00155 } ICMP_ECHO_REPLY32, *PICMP_ECHO_REPLY32;
00156
00157 #endif // _WIN64
00158
00159 typedef struct arp_send_reply {
00160 IPAddr DestAddress;
00161 IPAddr SrcAddress;
00162 } ARP_SEND_REPLY, *PARP_SEND_REPLY;
00163
00164 typedef struct tcp_reserve_port_range {
00165 USHORT UpperRange;
00166 USHORT LowerRange;
00167 } TCP_RESERVE_PORT_RANGE, *PTCP_RESERVE_PORT_RANGE;
00168
00169 #define MAX_ADAPTER_NAME 128
00170
00171 typedef struct _IP_ADAPTER_INDEX_MAP {
00172 ULONG Index;
00173 WCHAR Name[MAX_ADAPTER_NAME];
00174 } IP_ADAPTER_INDEX_MAP, *PIP_ADAPTER_INDEX_MAP;
00175
00176 typedef struct _IP_INTERFACE_INFO {
00177 LONG NumAdapters;
00178 IP_ADAPTER_INDEX_MAP Adapter[1];
00179 } IP_INTERFACE_INFO,*PIP_INTERFACE_INFO;
00180
00181 typedef struct _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS {
00182 ULONG NumAdapters;
00183 IPAddr Address[1];
00184 } IP_UNIDIRECTIONAL_ADAPTER_ADDRESS, *PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
00185
00186 typedef struct _IP_ADAPTER_ORDER_MAP {
00187 ULONG NumAdapters;
00188 ULONG AdapterOrder[1];
00189 } IP_ADAPTER_ORDER_MAP, *PIP_ADAPTER_ORDER_MAP;
00190
00191 typedef struct _IP_MCAST_COUNTER_INFO {
00192 ULONG64 InMcastOctets;
00193 ULONG64 OutMcastOctets;
00194 ULONG64 InMcastPkts;
00195 ULONG64 OutMcastPkts;
00196 } IP_MCAST_COUNTER_INFO, *PIP_MCAST_COUNTER_INFO;
00197
00198
00199
00200
00201
00202 #define IP_STATUS_BASE 11000
00203
00204 #define IP_SUCCESS 0
00205 #define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
00206 #define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
00207 #define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
00208 #define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
00209 #define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
00210 #define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
00211 #define IP_BAD_OPTION (IP_STATUS_BASE + 7)
00212 #define IP_HW_ERROR (IP_STATUS_BASE + 8)
00213 #define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
00214 #define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
00215 #define IP_BAD_REQ (IP_STATUS_BASE + 11)
00216 #define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
00217 #define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
00218 #define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
00219 #define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
00220 #define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
00221 #define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
00222 #define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
00223
00224
00225
00226
00227
00228 #define IP_DEST_NO_ROUTE (IP_STATUS_BASE + 2)
00229 #define IP_DEST_ADDR_UNREACHABLE (IP_STATUS_BASE + 3)
00230 #define IP_DEST_PROHIBITED (IP_STATUS_BASE + 4)
00231 #define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
00232 #define IP_HOP_LIMIT_EXCEEDED (IP_STATUS_BASE + 13)
00233 #define IP_REASSEMBLY_TIME_EXCEEDED (IP_STATUS_BASE + 14)
00234 #define IP_PARAMETER_PROBLEM (IP_STATUS_BASE + 15)
00235
00236
00237
00238
00239
00240 #define IP_DEST_UNREACHABLE (IP_STATUS_BASE + 40)
00241 #define IP_TIME_EXCEEDED (IP_STATUS_BASE + 41)
00242 #define IP_BAD_HEADER (IP_STATUS_BASE + 42)
00243 #define IP_UNRECOGNIZED_NEXT_HEADER (IP_STATUS_BASE + 43)
00244 #define IP_ICMP_ERROR (IP_STATUS_BASE + 44)
00245 #define IP_DEST_SCOPE_MISMATCH (IP_STATUS_BASE + 45)
00246
00247
00248
00249
00250
00251 #define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
00252 #define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
00253 #define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
00254 #define IP_UNLOAD (IP_STATUS_BASE + 22)
00255 #define IP_ADDR_ADDED (IP_STATUS_BASE + 23)
00256 #define IP_MEDIA_CONNECT (IP_STATUS_BASE + 24)
00257 #define IP_MEDIA_DISCONNECT (IP_STATUS_BASE + 25)
00258 #define IP_BIND_ADAPTER (IP_STATUS_BASE + 26)
00259 #define IP_UNBIND_ADAPTER (IP_STATUS_BASE + 27)
00260 #define IP_DEVICE_DOES_NOT_EXIST (IP_STATUS_BASE + 28)
00261 #define IP_DUPLICATE_ADDRESS (IP_STATUS_BASE + 29)
00262 #define IP_INTERFACE_METRIC_CHANGE (IP_STATUS_BASE + 30)
00263 #define IP_RECONFIG_SECFLTR (IP_STATUS_BASE + 31)
00264 #define IP_NEGOTIATING_IPSEC (IP_STATUS_BASE + 32)
00265 #define IP_INTERFACE_WOL_CAPABILITY_CHANGE (IP_STATUS_BASE + 33)
00266 #define IP_DUPLICATE_IPADD (IP_STATUS_BASE + 34)
00267
00268 #define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
00269 #define MAX_IP_STATUS IP_GENERAL_FAILURE
00270 #define IP_PENDING (IP_STATUS_BASE + 255)
00271
00272
00273
00274
00275
00276 #define IP_FLAG_DF 0x2 // Don't fragment this packet.
00277
00278
00279
00280
00281
00282
00283
00284
00285 #define IP_OPT_EOL 0 // End of list option
00286 #define IP_OPT_NOP 1 // No operation
00287 #define IP_OPT_SECURITY 0x82 // Security option
00288 #define IP_OPT_LSRR 0x83 // Loose source route
00289 #define IP_OPT_SSRR 0x89 // Strict source route
00290 #define IP_OPT_RR 0x7 // Record route
00291 #define IP_OPT_TS 0x44 // Timestamp
00292 #define IP_OPT_SID 0x88 // Stream ID (obsolete)
00293 #define IP_OPT_ROUTER_ALERT 0x94 // Router Alert Option
00294
00295 #define MAX_OPT_SIZE 40 // Maximum length of IP options in bytes
00296
00297 #ifdef CHICAGO
00298
00299
00300
00301
00302 #define IOCTL_IP_RTCHANGE_NOTIFY_REQUEST 101
00303 #define IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST 102
00304 #define IOCTL_ARP_SEND_REQUEST 103
00305 #define IOCTL_IP_INTERFACE_INFO 104
00306 #define IOCTL_IP_GET_BEST_INTERFACE 105
00307 #define IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS 106
00308
00309 #endif
00310
00311
00312 #endif // IP_EXPORT_INCLUDED
00313