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.

371 lines
14 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. routing\inc\iprtinfo.h
  5. Abstract:
  6. Header for IP Router Manager Information Structures
  7. Revision History:
  8. Gurdeep Singh Pall 6/8/95 Created
  9. --*/
  10. #ifndef __IPRTINFO_H__
  11. #define __IPRTINFO_H__
  12. //
  13. // This file uses structures from fltdefs.h rtinfo.h ipinfoid.h and
  14. // iprtrmib.h
  15. //
  16. #ifndef ANY_SIZE
  17. #define ANY_SIZE 1
  18. #endif
  19. #define TOCS_ALWAYS_IN_INTERFACE_INFO 4
  20. #define TOCS_ALWAYS_IN_GLOBAL_INFO 2
  21. //////////////////////////////////////////////////////////////////////////////
  22. // //
  23. // Filter information is passed in two blocks, one for IN and one for OUT //
  24. // Each is a RTR_INFO_BLOCK_HEADER with ONE TOC. The ID for the in filters //
  25. // is IP_IN_FILTER_INFO and for the out filters is IP_OUT_FILTER_INFO //
  26. // The structure describing the filters is a FILTER_DESCRIPTOR and within //
  27. // it is a FILTER_INFO structure, one for each FILTER. These structures are //
  28. // in ipfltdrv.h //
  29. // //
  30. //////////////////////////////////////////////////////////////////////////////
  31. //////////////////////////////////////////////////////////////////////////////
  32. // //
  33. // IP_ROUTE_INFO type, for backwards compatability, this structure is //
  34. // currently the same length as MIB_IPFORWARDROW, but a few fields are //
  35. // different. //
  36. // //
  37. //////////////////////////////////////////////////////////////////////////////
  38. typedef struct _INTERFACE_ROUTE_INFO
  39. {
  40. DWORD dwRtInfoDest;
  41. DWORD dwRtInfoMask;
  42. DWORD dwRtInfoPolicy;
  43. DWORD dwRtInfoNextHop;
  44. DWORD dwRtInfoIfIndex;
  45. DWORD dwRtInfoType;
  46. DWORD dwRtInfoProto;
  47. DWORD dwRtInfoAge;
  48. DWORD dwRtInfoNextHopAS;
  49. DWORD dwRtInfoMetric1;
  50. DWORD dwRtInfoMetric2;
  51. DWORD dwRtInfoMetric3;
  52. DWORD dwRtInfoPreference;
  53. DWORD dwRtInfoViewSet;
  54. }INTERFACE_ROUTE_INFO, *PINTERFACE_ROUTE_INFO;
  55. typedef struct _INTERFACE_ROUTE_TABLE
  56. {
  57. DWORD dwNumEntries;
  58. INTERFACE_ROUTE_INFO table[ANY_SIZE];
  59. }INTERFACE_ROUTE_TABLE, *PINTERFACE_ROUTE_TABLE;
  60. #define SIZEOF_INTERFACEROUTETABLE(X) (FIELD_OFFSET(INTERFACE_ROUTE_TABLE,table[0]) + ((X) * sizeof(INTERFACE_ROUTE_INFO)) + ALIGN_SIZE)
  61. //////////////////////////////////////////////////////////////////////////////
  62. // //
  63. // IP_INTERFACE_STATUS_INFO //
  64. // //
  65. //////////////////////////////////////////////////////////////////////////////
  66. typedef struct _INTERFACE_STATUS_INFO
  67. {
  68. IN OUT DWORD dwAdminStatus;
  69. }INTERFACE_STATUS_INFO, *PINTERFACE_STATUS_INFO;
  70. //////////////////////////////////////////////////////////////////////////////
  71. // //
  72. // IP_GLOBAL_INFO type //
  73. // //
  74. //////////////////////////////////////////////////////////////////////////////
  75. #define MAX_DLL_NAME 48
  76. #define IPRTR_LOGGING_NONE ((DWORD) 0)
  77. #define IPRTR_LOGGING_ERROR ((DWORD) 1)
  78. #define IPRTR_LOGGING_WARN ((DWORD) 2)
  79. #define IPRTR_LOGGING_INFO ((DWORD) 3)
  80. typedef struct _GLOBAL_INFO
  81. {
  82. IN OUT BOOL bFilteringOn;
  83. IN OUT DWORD dwLoggingLevel;
  84. }GLOBAL_INFO, *PGLOBAL_INFO;
  85. //////////////////////////////////////////////////////////////////////////////
  86. // //
  87. // IP_PRIORITY_INFO type //
  88. // //
  89. //////////////////////////////////////////////////////////////////////////////
  90. #define IP_PRIORITY_MAX_METRIC 255
  91. #define IP_PRIORITY_DEFAULT_METRIC 127
  92. typedef struct _PROTOCOL_METRIC
  93. {
  94. IN OUT DWORD dwProtocolId;
  95. IN OUT DWORD dwMetric;
  96. }PROTOCOL_METRIC, *PPROTOCOL_METRIC;
  97. typedef struct _PRIORITY_INFO
  98. {
  99. IN OUT DWORD dwNumProtocols;
  100. IN OUT PROTOCOL_METRIC ppmProtocolMetric[1];
  101. }PRIORITY_INFO, *PPRIORITY_INFO;
  102. #define SIZEOF_PRIORITY_INFO(X) \
  103. (FIELD_OFFSET(PRIORITY_INFO, ppmProtocolMetric[0]) + ((X) * sizeof(PROTOCOL_METRIC)))
  104. //////////////////////////////////////////////////////////////////////////////
  105. // //
  106. // Constants and structures related to ICMP Router Discovery. See RFC 1256 //
  107. // //
  108. //////////////////////////////////////////////////////////////////////////////
  109. //////////////////////////////////////////////////////////////////////////////
  110. // //
  111. // The Maximum Advertisement Interval is the max time (in seconds) between //
  112. // two advertisements. //
  113. // Its minimum value is MIN_MAX_ADVT_INTERVAL //
  114. // Its maximum value is MAX_MAX_ADVT_INTERVAL //
  115. // Its default value is DEFAULT_MAX_ADVT_INTERVAL //
  116. // //
  117. //////////////////////////////////////////////////////////////////////////////
  118. #define DEFAULT_MAX_ADVT_INTERVAL 600
  119. #define MIN_MAX_ADVT_INTERVAL 4
  120. #define MAX_MAX_ADVT_INTERVAL 1800
  121. //////////////////////////////////////////////////////////////////////////////
  122. // //
  123. // The Minimum Advertisement Interval is the min time (in seconds) between //
  124. // two unsolicited advertisements //
  125. // It must be greater than MIN_MIN_ADVT_INTERVAL //
  126. // Obviously must be less than the Maximum Advertisement Interval //
  127. // Its default value for a given Maximum Advertisement Interval is: //
  128. // DEFAULT_MIN_ADVT_INTERVAL_RATIO * Maximum Advertisement Interval //
  129. // //
  130. // When using the ratio, BE CAREFUL ABOUT FLOATING POINT VALUES //
  131. // //
  132. //////////////////////////////////////////////////////////////////////////////
  133. #define MIN_MIN_ADVT_INTERVAL 3
  134. #define DEFAULT_MIN_ADVT_INTERVAL_RATIO 0.75
  135. //////////////////////////////////////////////////////////////////////////////
  136. // //
  137. // The Advertisement Lifetime is the value (of time in seconds) placed in //
  138. // the advertisement's lifetime field. //
  139. // It must be greater than the Maximum Advertisement Interval //
  140. // Its maximum value is MAX_ADVT_LIFETIME //
  141. // Its default value for a given Maximum Advertisement Interval is: //
  142. // DEFAULT_ADVT_LIFETIME_RATIO * Maximum Advertisement Interval //
  143. // //
  144. //////////////////////////////////////////////////////////////////////////////
  145. #define DEFAULT_ADVT_LIFETIME_RATIO 3
  146. #define MAX_ADVT_LIFETIME 9000
  147. #define DEFAULT_PREF_LEVEL 0
  148. #define MAX_INITIAL_ADVTS 3
  149. #define MAX_INITIAL_ADVT_TIME 16
  150. #define MIN_RESPONSE_DELAY 1
  151. #define RESPONSE_DELAY_INTERVAL 1
  152. typedef struct _RTR_DISC_INFO
  153. {
  154. IN OUT WORD wMaxAdvtInterval;
  155. IN OUT WORD wMinAdvtInterval;
  156. IN OUT WORD wAdvtLifetime;
  157. IN OUT BOOL bAdvertise;
  158. IN OUT LONG lPrefLevel;
  159. }RTR_DISC_INFO, *PRTR_DISC_INFO;
  160. #define IP_FILTER_DRIVER_VERSION_1 1
  161. #define IP_FILTER_DRIVER_VERSION_2 1
  162. #define IP_FILTER_DRIVER_VERSION IP_FILTER_DRIVER_VERSION_2
  163. typedef struct _FILTER_INFO
  164. {
  165. DWORD dwSrcAddr;
  166. DWORD dwSrcMask;
  167. DWORD dwDstAddr;
  168. DWORD dwDstMask;
  169. DWORD dwProtocol;
  170. DWORD fLateBound;
  171. WORD wSrcPort;
  172. WORD wDstPort;
  173. }FILTER_INFO, *PFILTER_INFO;
  174. typedef struct _FILTER_DESCRIPTOR
  175. {
  176. DWORD dwVersion;
  177. DWORD dwNumFilters;
  178. PFFORWARD_ACTION faDefaultAction;
  179. FILTER_INFO fiFilter[1];
  180. }FILTER_DESCRIPTOR, *PFILTER_DESCRIPTOR;
  181. //////////////////////////////////////////////////////////////////////////////
  182. // //
  183. // For WAN interfaces, the address is unknown at the time the filters are //
  184. // set. Use these two constants two specify "Local Address". The address //
  185. // and mask are set with IOCTL_INTERFACE_BOUND //
  186. // //
  187. //////////////////////////////////////////////////////////////////////////////
  188. //////////////////////////////////////////////////////////////////////////////
  189. // //
  190. // The constants that should be used to set up the FILTER_INFO_STRUCTURE //
  191. // //
  192. //////////////////////////////////////////////////////////////////////////////
  193. #define FILTER_PROTO(ProtoId) MAKELONG(MAKEWORD((ProtoId),0x00),0x00000)
  194. #define FILTER_PROTO_ANY FILTER_PROTO(0x00)
  195. #define FILTER_PROTO_ICMP FILTER_PROTO(0x01)
  196. #define FILTER_PROTO_TCP FILTER_PROTO(0x06)
  197. #define FILTER_PROTO_UDP FILTER_PROTO(0x11)
  198. #define FILTER_TCPUDP_PORT_ANY (WORD)0x0000
  199. #define FILTER_ICMP_TYPE_ANY (BYTE)0xff
  200. #define FILTER_ICMP_CODE_ANY (BYTE)0xff
  201. #define SRC_ADDR_USE_LOCAL_FLAG 0x00000001
  202. #define SRC_ADDR_USE_REMOTE_FLAG 0x00000002
  203. #define DST_ADDR_USE_LOCAL_FLAG 0x00000004
  204. #define DST_ADDR_USE_REMOTE_FLAG 0x00000008
  205. #define SRC_MASK_LATE_FLAG 0x00000010
  206. #define DST_MASK_LATE_FLAG 0x00000020
  207. #define TCP_ESTABLISHED_FLAG 0x00000040
  208. #define SetSrcAddrToLocalAddr(pFilter) \
  209. ((pFilter)->fLateBound |= SRC_ADDR_USE_LOCAL_FLAG)
  210. #define SetSrcAddrToRemoteAddr(pFilter) \
  211. ((pFilter)->fLateBound |= SRC_ADDR_USE_REMOTE_FLAG)
  212. #define SetDstAddrToLocalAddr(pFilter) \
  213. ((pFilter)->fLateBound |= DST_ADDR_USE_LOCAL_FLAG)
  214. #define SetDstAddrToRemoteAddr(pFilter) \
  215. ((pFilter)->fLateBound |= DST_ADDR_USE_REMOTE_FLAG)
  216. #define SetSrcMaskLateFlag(pFilter) \
  217. ((pFilter)->fLateBound |= SRC_MASK_LATE_FLAG)
  218. #define SetDstMaskLateFlag(pFilter) \
  219. ((pFilter)->fLateBound |= DST_MASK_LATE_FLAG)
  220. #define AreAllFieldsUnchanged(pFilter) \
  221. ((pFilter)->fLateBound == 0x00000000)
  222. #define DoesSrcAddrUseLocalAddr(pFilter) \
  223. ((pFilter)->fLateBound & SRC_ADDR_USE_LOCAL_FLAG)
  224. #define DoesSrcAddrUseRemoteAddr(pFilter) \
  225. ((pFilter)->fLateBound & SRC_ADDR_USE_REMOTE_FLAG)
  226. #define DoesDstAddrUseLocalAddr(pFilter) \
  227. ((pFilter)->fLateBound & DST_ADDR_USE_LOCAL_FLAG)
  228. #define DoesDstAddrUseRemoteAddr(pFilter) \
  229. ((pFilter)->fLateBound & DST_ADDR_USE_REMOTE_FLAG)
  230. #define IsSrcMaskLateBound(pFilter) \
  231. ((pFilter)->fLateBound & SRC_MASK_LATE_FLAG)
  232. #define IsDstMaskLateBound(pFilter) \
  233. ((pFilter)->fLateBound & DST_MASK_LATE_FLAG)
  234. #define IsTcpEstablished(pFilter) \
  235. ((pFilter)->fLateBound & TCP_ESTABLISHED_FLAG)
  236. //////////////////////////////////////////////////////////////////////////////
  237. // //
  238. // Multicast Heartbeat information //
  239. // //
  240. //////////////////////////////////////////////////////////////////////////////
  241. #define MAX_GROUP_LEN 64
  242. typedef struct _MCAST_HBEAT_INFO
  243. {
  244. //
  245. // The multicast address or group name which we wish to listen to in order
  246. // to receive heartbeat info
  247. // The code first tries to see if the stored string is a valid
  248. // IP Address using inet_addr. If so, then that is used as the group .
  249. // Otherwise, gethostbyname is used to retrieve the group information
  250. //
  251. WCHAR pwszGroup[MAX_GROUP_LEN];
  252. //
  253. // TRUE if heartbeat detection is on
  254. //
  255. BOOL bActive;
  256. //
  257. // The dead interval in minutes
  258. //
  259. ULONG ulDeadInterval;
  260. //
  261. // The protocol on which to listen for packets. Currently this can be
  262. // UDP or RAW. If the protocol is UDP, then the wPort field has the
  263. // destination port number (which could be 0 => any port).
  264. // If RAW, then it has the protocolId (which must be less than 255)
  265. //
  266. BYTE byProtocol;
  267. WORD wPort;
  268. }MCAST_HBEAT_INFO, *PMCAST_HBEAT_INFO;
  269. typedef struct _IPINIP_CONFIG_INFO
  270. {
  271. DWORD dwRemoteAddress;
  272. DWORD dwLocalAddress;
  273. BYTE byTtl;
  274. }IPINIP_CONFIG_INFO, *PIPINIP_CONFIG_INFO;
  275. //////////////////////////////////////////////////////////////////////////////
  276. // //
  277. // Per Interfce filter settings //
  278. // (IP_IFFILTER_INFO) //
  279. // //
  280. //////////////////////////////////////////////////////////////////////////////
  281. typedef struct _IFFILTER_INFO
  282. {
  283. BOOL bEnableFragChk;
  284. }IFFILTER_INFO, *PIFFILTER_INFO;
  285. #endif