Source code of Windows XP (NT5)
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.

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