|
|
1.1 root 1: /********************************************************************/
2: /** Microsoft LAN Manager **/
3: /** Copyright (c) Microsoft Corporation. All rights reserved. **/
4: /********************************************************************/
5: /* :ts=4 */
6:
7: //** IPEXPORT.H - IP public definitions.
8: //
9: // This file contains public definitions exported to transport layer and
10: // application software.
11: //
12:
13: #ifndef IP_EXPORT_INCLUDED
14: #define IP_EXPORT_INCLUDED 1
15:
16: #if _MSC_VER > 1000
17: #pragma once
18: #endif
19:
20: //
21: // IP type definitions.
22: //
23: typedef ULONG IPAddr; // An IP address.
24: typedef ULONG IPMask; // An IP subnet mask.
25: typedef ULONG IP_STATUS; // Status code returned from IP APIs.
26:
27: #ifndef s6_addr
28: //
29: // Duplicate these definitions here so that this file can be included by
30: // kernel-mode components which cannot include ws2tcpip.h, as well as
31: // by user-mode components which do.
32: //
33:
34: typedef struct in6_addr {
35: union {
36: UCHAR Byte[16];
37: USHORT Word[8];
38: } u;
39: } IN6_ADDR;
40:
41: #define in_addr6 in6_addr
42:
43: //
44: // Defines to match RFC 2553.
45: //
46: #define _S6_un u
47: #define _S6_u8 Byte
48: #define s6_addr _S6_un._S6_u8
49:
50: //
51: // Defines for our implementation.
52: //
53: #define s6_bytes u.Byte
54: #define s6_words u.Word
55:
56: #endif
57:
58: typedef struct in6_addr IPv6Addr;
59:
60: #ifndef s_addr
61:
62: struct in_addr {
63: union {
64: struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
65: struct { USHORT s_w1,s_w2; } S_un_w;
66: ULONG S_addr;
67: } S_un;
68: };
69: #define s_addr S_un.S_addr /* can be used for most tcp & ip code */
70:
71: #endif
72:
73: /*INC*/
74:
75: //
76: // The ip_option_information structure describes the options to be
77: // included in the header of an IP packet. The TTL, TOS, and Flags
78: // values are carried in specific fields in the header. The OptionsData
79: // bytes are carried in the options area following the standard IP header.
80: // With the exception of source route options, this data must be in the
81: // format to be transmitted on the wire as specified in RFC 791. A source
82: // route option should contain the full route - first hop thru final
83: // destination - in the route data. The first hop will be pulled out of the
84: // data and the option will be reformatted accordingly. Otherwise, the route
85: // option should be formatted as specified in RFC 791.
86: //
87:
88: typedef struct ip_option_information {
89: UCHAR Ttl; // Time To Live
90: UCHAR Tos; // Type Of Service
91: UCHAR Flags; // IP header flags
92: UCHAR OptionsSize; // Size in bytes of options data
93: PUCHAR OptionsData; // Pointer to options data
94: } IP_OPTION_INFORMATION, *PIP_OPTION_INFORMATION;
95:
96: #if defined(_WIN64)
97:
98: typedef struct ip_option_information32 {
99: UCHAR Ttl;
100: UCHAR Tos;
101: UCHAR Flags;
102: UCHAR OptionsSize;
103: UCHAR * POINTER_32 OptionsData;
104: } IP_OPTION_INFORMATION32, *PIP_OPTION_INFORMATION32;
105:
106: #endif // _WIN64
107:
108: //
109: // The icmp_echo_reply structure describes the data returned in response
110: // to an echo request.
111: //
112:
113: typedef struct icmp_echo_reply {
114: IPAddr Address; // Replying address
115: ULONG Status; // Reply IP_STATUS
116: ULONG RoundTripTime; // RTT in milliseconds
117: USHORT DataSize; // Reply data size in bytes
118: USHORT Reserved; // Reserved for system use
119: PVOID Data; // Pointer to the reply data
120: struct ip_option_information Options; // Reply options
121: } ICMP_ECHO_REPLY, *PICMP_ECHO_REPLY;
122:
123: #if defined(_WIN64)
124:
125: typedef struct icmp_echo_reply32 {
126: IPAddr Address;
127: ULONG Status;
128: ULONG RoundTripTime;
129: USHORT DataSize;
130: USHORT Reserved;
131: VOID * POINTER_32 Data;
132: struct ip_option_information32 Options;
133: } ICMP_ECHO_REPLY32, *PICMP_ECHO_REPLY32;
134:
135: #endif // _WIN64
136:
137: typedef struct arp_send_reply {
138: IPAddr DestAddress;
139: IPAddr SrcAddress;
140: } ARP_SEND_REPLY, *PARP_SEND_REPLY;
141:
142: typedef struct tcp_reserve_port_range {
143: USHORT UpperRange;
144: USHORT LowerRange;
145: } TCP_RESERVE_PORT_RANGE, *PTCP_RESERVE_PORT_RANGE;
146:
147: #define MAX_ADAPTER_NAME 128
148:
149: typedef struct _IP_ADAPTER_INDEX_MAP {
150: ULONG Index;
151: WCHAR Name[MAX_ADAPTER_NAME];
152: } IP_ADAPTER_INDEX_MAP, *PIP_ADAPTER_INDEX_MAP;
153:
154: typedef struct _IP_INTERFACE_INFO {
155: LONG NumAdapters;
156: IP_ADAPTER_INDEX_MAP Adapter[1];
157: } IP_INTERFACE_INFO,*PIP_INTERFACE_INFO;
158:
159: typedef struct _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS {
160: ULONG NumAdapters;
161: IPAddr Address[1];
162: } IP_UNIDIRECTIONAL_ADAPTER_ADDRESS, *PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
163:
164: typedef struct _IP_ADAPTER_ORDER_MAP {
165: ULONG NumAdapters;
166: ULONG AdapterOrder[1];
167: } IP_ADAPTER_ORDER_MAP, *PIP_ADAPTER_ORDER_MAP;
168:
169: typedef struct _IP_MCAST_COUNTER_INFO {
170: ULONG64 InMcastOctets;
171: ULONG64 OutMcastOctets;
172: ULONG64 InMcastPkts;
173: ULONG64 OutMcastPkts;
174: } IP_MCAST_COUNTER_INFO, *PIP_MCAST_COUNTER_INFO;
175:
176: //
177: // IP_STATUS codes returned from IP APIs
178: //
179:
180: #define IP_STATUS_BASE 11000
181:
182: #define IP_SUCCESS 0
183: #define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
184: #define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
185: #define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
186: #define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
187: #define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
188: #define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
189: #define IP_BAD_OPTION (IP_STATUS_BASE + 7)
190: #define IP_HW_ERROR (IP_STATUS_BASE + 8)
191: #define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
192: #define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
193: #define IP_BAD_REQ (IP_STATUS_BASE + 11)
194: #define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
195: #define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
196: #define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
197: #define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
198: #define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
199: #define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
200: #define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
201:
202: //
203: // Variants of the above using IPv6 terminology, where different
204: //
205:
206: #define IP_DEST_NO_ROUTE (IP_STATUS_BASE + 2)
207: #define IP_DEST_ADDR_UNREACHABLE (IP_STATUS_BASE + 3)
208: #define IP_DEST_PROHIBITED (IP_STATUS_BASE + 4)
209: #define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
210: #define IP_HOP_LIMIT_EXCEEDED (IP_STATUS_BASE + 13)
211: #define IP_REASSEMBLY_TIME_EXCEEDED (IP_STATUS_BASE + 14)
212: #define IP_PARAMETER_PROBLEM (IP_STATUS_BASE + 15)
213:
214: //
215: // IPv6-only status codes
216: //
217:
218: #define IP_DEST_UNREACHABLE (IP_STATUS_BASE + 40)
219: #define IP_TIME_EXCEEDED (IP_STATUS_BASE + 41)
220: #define IP_BAD_HEADER (IP_STATUS_BASE + 42)
221: #define IP_UNRECOGNIZED_NEXT_HEADER (IP_STATUS_BASE + 43)
222: #define IP_ICMP_ERROR (IP_STATUS_BASE + 44)
223: #define IP_DEST_SCOPE_MISMATCH (IP_STATUS_BASE + 45)
224:
225: //
226: // The next group are status codes passed up on status indications to
227: // transport layer protocols.
228: //
229: #define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
230: #define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
231: #define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
232: #define IP_UNLOAD (IP_STATUS_BASE + 22)
233: #define IP_ADDR_ADDED (IP_STATUS_BASE + 23)
234: #define IP_MEDIA_CONNECT (IP_STATUS_BASE + 24)
235: #define IP_MEDIA_DISCONNECT (IP_STATUS_BASE + 25)
236: #define IP_BIND_ADAPTER (IP_STATUS_BASE + 26)
237: #define IP_UNBIND_ADAPTER (IP_STATUS_BASE + 27)
238: #define IP_DEVICE_DOES_NOT_EXIST (IP_STATUS_BASE + 28)
239: #define IP_DUPLICATE_ADDRESS (IP_STATUS_BASE + 29)
240: #define IP_INTERFACE_METRIC_CHANGE (IP_STATUS_BASE + 30)
241: #define IP_RECONFIG_SECFLTR (IP_STATUS_BASE + 31)
242: #define IP_NEGOTIATING_IPSEC (IP_STATUS_BASE + 32)
243: #define IP_INTERFACE_WOL_CAPABILITY_CHANGE (IP_STATUS_BASE + 33)
244: #define IP_DUPLICATE_IPADD (IP_STATUS_BASE + 34)
245: #define IP_NO_FURTHER_SENDS (IP_STATUS_BASE + 35)
246:
247: #define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
248: #define MAX_IP_STATUS IP_GENERAL_FAILURE
249: #define IP_PENDING (IP_STATUS_BASE + 255)
250:
251:
252: //
253: // Values used in the IP header Flags field.
254: //
255: #define IP_FLAG_DF 0x2 // Don't fragment this packet.
256:
257: //
258: // Supported IP Option Types.
259: //
260: // These types define the options which may be used in the OptionsData field
261: // of the ip_option_information structure. See RFC 791 for a complete
262: // description of each.
263: //
264: #define IP_OPT_EOL 0 // End of list option
265: #define IP_OPT_NOP 1 // No operation
266: #define IP_OPT_SECURITY 0x82 // Security option
267: #define IP_OPT_LSRR 0x83 // Loose source route
268: #define IP_OPT_SSRR 0x89 // Strict source route
269: #define IP_OPT_RR 0x7 // Record route
270: #define IP_OPT_TS 0x44 // Timestamp
271: #define IP_OPT_SID 0x88 // Stream ID (obsolete)
272: #define IP_OPT_ROUTER_ALERT 0x94 // Router Alert Option
273:
274: #define MAX_OPT_SIZE 40 // Maximum length of IP options in bytes
275:
276: #ifdef CHICAGO
277:
278: // Ioctls code exposed by Memphis tcpip stack.
279: // For NT these ioctls are define in ntddip.h (private\inc)
280:
281: #define IOCTL_IP_RTCHANGE_NOTIFY_REQUEST 101
282: #define IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST 102
283: #define IOCTL_ARP_SEND_REQUEST 103
284: #define IOCTL_IP_INTERFACE_INFO 104
285: #define IOCTL_IP_GET_BEST_INTERFACE 105
286: #define IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS 106
287:
288: #endif
289:
290:
291: #endif // IP_EXPORT_INCLUDED
292:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.