Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

291 lines
9.6 KiB

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