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.

176 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. net\routing\ip\infoutil\defs.h
  5. Abstract:
  6. Revision History:
  7. MohsinA, 04-Jul-97. Console debugging support for Memphis.
  8. --*/
  9. #ifndef __DEFS_H__
  10. #define __DEFS_H__
  11. #define is ==
  12. #define isnot !=
  13. #define and &&
  14. #define or ||
  15. #define INVALID_INDEX_OR_INSTANCE 0xffffffff
  16. #define INVALID_IF_INSTANCE INVALID_INDEX_OR_INSTANCE
  17. #define INVALID_AT_INSTANCE INVALID_INDEX_OR_INSTANCE
  18. #define MAP_HASH_SIZE 37
  19. #define GET_IF_ENTRY 0
  20. #define SET_IF_ENTRY 1
  21. #define OVERFLOW_COUNT 10
  22. #define ROUTE_OVERFLOW_COUNT 20
  23. #define IF_CACHE_LIFE (60 * 1000)
  24. #define ARP_CACHE_LIFE (60 * 1000)
  25. #define MAX_IF_TYPE_LENGTH 256
  26. //
  27. // VOID
  28. // ConvertRouteToForward(IPRouteEntry* route, PMIB_IPFORWARDROW forwardRow)
  29. //
  30. #define ConvertRouteToForward(route,forwardRow){ \
  31. (forwardRow)->dwForwardDest = (route)->ire_dest; \
  32. (forwardRow)->dwForwardIfIndex = (route)->ire_index; \
  33. (forwardRow)->dwForwardMetric1 = (route)->ire_metric1; \
  34. (forwardRow)->dwForwardMetric2 = (route)->ire_metric2; \
  35. (forwardRow)->dwForwardMetric3 = (route)->ire_metric3; \
  36. (forwardRow)->dwForwardMetric4 = (route)->ire_metric4; \
  37. (forwardRow)->dwForwardMetric5 = (route)->ire_metric5; \
  38. (forwardRow)->dwForwardNextHop = (route)->ire_nexthop; \
  39. (forwardRow)->dwForwardType = (route)->ire_type; \
  40. (forwardRow)->dwForwardProto = (route)->ire_proto; \
  41. (forwardRow)->dwForwardAge = (route)->ire_age; \
  42. (forwardRow)->dwForwardMask = (route)->ire_mask; \
  43. (forwardRow)->dwForwardNextHopAS = 0; \
  44. (forwardRow)->dwForwardPolicy = 0; \
  45. }
  46. #ifdef CHICAGO
  47. #define ConvertForwardToRoute(route,forwardRow){ \
  48. (route)->ire_dest = (forwardRow)->dwForwardDest; \
  49. (route)->ire_index = (forwardRow)->dwForwardIfIndex; \
  50. (route)->ire_metric1 = (forwardRow)->dwForwardMetric1; \
  51. (route)->ire_metric2 = (forwardRow)->dwForwardMetric2; \
  52. (route)->ire_metric3 = (forwardRow)->dwForwardMetric3; \
  53. (route)->ire_metric4 = (forwardRow)->dwForwardMetric4; \
  54. (route)->ire_metric5 = (forwardRow)->dwForwardMetric5; \
  55. (route)->ire_nexthop = (forwardRow)->dwForwardNextHop; \
  56. (route)->ire_type = (forwardRow)->dwForwardType; \
  57. (route)->ire_proto = (forwardRow)->dwForwardProto; \
  58. (route)->ire_age = (forwardRow)->dwForwardAge; \
  59. (route)->ire_mask = (forwardRow)->dwForwardMask; \
  60. }
  61. #else
  62. #define ConvertForwardToRoute(route,forwardRow){ \
  63. (route)->ire_dest = (forwardRow)->dwForwardDest; \
  64. (route)->ire_index = (forwardRow)->dwForwardIfIndex; \
  65. (route)->ire_metric1 = (forwardRow)->dwForwardMetric1; \
  66. (route)->ire_metric2 = (forwardRow)->dwForwardMetric2; \
  67. (route)->ire_metric3 = (forwardRow)->dwForwardMetric3; \
  68. (route)->ire_metric4 = (forwardRow)->dwForwardMetric4; \
  69. (route)->ire_metric5 = (forwardRow)->dwForwardMetric5; \
  70. (route)->ire_nexthop = (forwardRow)->dwForwardNextHop; \
  71. (route)->ire_type = (forwardRow)->dwForwardType; \
  72. (route)->ire_proto = (forwardRow)->dwForwardProto; \
  73. (route)->ire_age = (forwardRow)->dwForwardAge; \
  74. (route)->ire_mask = (forwardRow)->dwForwardMask; \
  75. (route)->ire_context = 0x00000000; \
  76. }
  77. #endif
  78. #if API_TRACE
  79. #define IPHLPAPI_TRACE_ANY ((DWORD)0xFFFF0000 | TRACE_USE_MASK)
  80. #define IPHLPAPI_TRACE_ERR ((DWORD)0x00010000 | TRACE_USE_MASK)
  81. #define IPHLPAPI_TRACE_TRACE ((DWORD)0x00020000 | TRACE_USE_MASK)
  82. #define IPHLPAPI_TRACE_ENTER ((DWORD)0x80000000 | TRACE_USE_MASK)
  83. #define TRACEID g_dwTraceHandle
  84. #define Trace0(l,a) \
  85. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ ## l, a)
  86. #define Trace1(l,a,b) \
  87. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ ## l, a, b)
  88. #define Trace2(l,a,b,c) \
  89. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ ## l, a, b, c)
  90. #define Trace3(l,a,b,c,d) \
  91. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ ## l, a, b, c, d)
  92. #define Trace4(l,a,b,c,d,e) \
  93. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ ## l, a, b, c, d, e)
  94. #if DBG
  95. #define TraceEnter(X) \
  96. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ENTER, "Entered: " X)
  97. #define TraceLeave(X) \
  98. TracePrintfEx(TRACEID, IPHLPAPI_TRACE_ENTER, "Leaving: " X"\n")
  99. #endif // DBG
  100. #else // API_TRACE
  101. #define Trace0(l,a)
  102. #define Trace1(l,a,b)
  103. #define Trace2(l,a,b,c)
  104. #define Trace3(l,a,b,c,d)
  105. #define Trace4(l,a,b,c,d,e)
  106. #define TraceEnter(X)
  107. #define TraceLeave(X)
  108. #endif // API_TRACE
  109. typedef struct _AIHASH
  110. {
  111. LIST_ENTRY leList;
  112. DWORD dwAdapterIndex;
  113. DWORD dwATInstance;
  114. DWORD dwIFInstance;
  115. }AIHASH, *LPAIHASH;
  116. #endif
  117. // MohsinA, 04-Jul-97. Debugging on console.
  118. #if 0
  119. #undef Trace0
  120. #undef Trace1
  121. #undef Trace2
  122. #undef Trace3
  123. #undef Trace4
  124. #undef TraceEnter
  125. #undef TraceLeave
  126. #define Trace0(l,a) DEBUG_PRINT((" " ## #l ## " " ## a ## "\n" ));
  127. #define Trace1(l,a,b) DEBUG_PRINT((" " ## #l ## " " ## a ## "\n", b ));
  128. #define Trace2(l,a,b,c) DEBUG_PRINT((" " ## #l ## " " ## a ## "\n", b, c ));
  129. #define Trace3(l,a,b,c,d) DEBUG_PRINT((" " ## #l ## " " ## a ## "\n", b, c, d ));
  130. #define Trace4(l,a,b,c,d,e) DEBUG_PRINT((" " ## #l ## " " ## a ## "\n", b, c, d, e ));
  131. #define TraceEnter(X) DEBUG_PRINT(("-> " ## X "\n" ));
  132. #define TraceLeave(X) DEBUG_PRINT(("<- " ## X "\n" ));
  133. #endif