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.

129 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. routing\monitor2\ip\defs.h
  5. Abstract:
  6. global definitions
  7. Revision History:
  8. Anand Mahalingam 7/10/98 Created
  9. --*/
  10. #ifndef _DEBUG
  11. #define DEBUG(s)
  12. #define DEBUG1(s1,s2)
  13. #define DEBUG2(s1,s2)
  14. #else
  15. #define DEBUG(s) wprintf(L"%s\n", L##s)
  16. #define DEBUG1(s1,s2) wprintf(L##s1, L##s2)
  17. #define DEBUG2(s1,s2) wprintf(L##s1, L##s2)
  18. #endif
  19. #define is ==
  20. #define isnot !=
  21. #define or ||
  22. #define and &&
  23. #define REG_VALUE_ENTRY_PT L"EntryPoint"
  24. #define REG_VALUE_DUMP_FN L"DumpFunction"
  25. #define REG_KEY_DHCPMGR_HELPER L"SOFTWARE\\Microsoft\\Netsh\\Dhcp"
  26. #define MaxIfDisplayLength 1024
  27. #define ADDR_LENGTH 24
  28. #define ADDR_LEN 4
  29. #define DISPLAYLEN_PHYSADDR 3*MAXLEN_PHYSADDR + 8
  30. #define PRINT(s) wprintf(L"%s\n",L##s)
  31. #define PRINT1(s,s1) wprintf(L##s , L##s1)
  32. #ifdef UNICODE
  33. #define MakeUnicodeIpAddr(ptszUnicode,pszAddr) \
  34. MultiByteToWideChar(CP_ACP, \
  35. 0, \
  36. (pszAddr), \
  37. -1, \
  38. (ptszUnicode), \
  39. ADDR_LENGTH)
  40. #else
  41. #define MakeUnicodeIpAddr(ptszUnicode,pszAddr) \
  42. strcpy((ptszUnicode),(pszAddr))
  43. #endif //UNICODE
  44. #ifdef UNICODE
  45. #define MakeUnicodePhysAddr(ptszUnicode,pszAddr,dwLen) \
  46. { \
  47. CHAR __szTemp[DISPLAYLEN_PHYSADDR + 1]; \
  48. DWORD __i,__dwTempLen; \
  49. __dwTempLen = (((dwLen) <= MAXLEN_PHYSADDR) ? (dwLen) : MAXLEN_PHYSADDR); \
  50. for(__i = 0; __i < __dwTempLen; __i++) \
  51. { \
  52. sprintf(&(__szTemp[3*__i]),"%02X-",pszAddr[__i]); \
  53. } \
  54. MultiByteToWideChar(CP_ACP, \
  55. 0, \
  56. (__szTemp), \
  57. -1, \
  58. (ptszUnicode), \
  59. 3*__i); \
  60. ptszUnicode[(3*__i) - 1] = TEXT('\0'); \
  61. }
  62. #else
  63. #define MakeUnicodePhysAddr(ptszUnicode,pszAddr,dwLen) \
  64. { \
  65. CHAR __szTemp[DISPLAYLEN_PHYSADDR + 1]; \
  66. DWORD __i,__dwTempLen; \
  67. __dwTempLen = (((dwLen) <= MAXLEN_PHYSADDR) ? (dwLen) : MAXLEN_PHYSADDR); \
  68. for(__i = 0; __i < __dwTempLen; __i++) \
  69. { \
  70. sprintf(&(__szTemp[3*__i]),"%02X-",pszAddr[__i]); \
  71. } \
  72. strncpy((ptszUnicode),__szTemp,3*__i); \
  73. ptszUnicode[(3*__i) - 1] = TEXT('\0'); \
  74. }
  75. #endif //UNICODE
  76. #define GetDispString(gModule, val, str, count, table) \
  77. { \
  78. DWORD __dwInd = 0; \
  79. for( ; __dwInd < (count); __dwInd += 2 ) \
  80. { \
  81. if ( (val) != (table)[ __dwInd ] ) { continue; } \
  82. (str) = MakeString( (gModule), (table)[ __dwInd + 1 ] ); \
  83. break; \
  84. } \
  85. if ( __dwInd >= (count) ) { (str) = MakeString( (gModule), STRING_UNKNOWN ); } \
  86. }
  87. #define FREE_STRING_NOT_NULL(ptszString) if (ptszString) FreeString(ptszString)
  88. #define ERROR_CONFIG 1
  89. #define ERROR_ADMIN 2
  90. #define ERROR_UNIDENTIFIED_MIB 2312
  91. #define ERROR_TOO_FEW_ARGS (ERROR_UNIDENTIFIED_MIB+1)
  92. #define MAX_NUM_INDICES 6
  93. #define PRINT_IPADDR(x) \
  94. ((x)&0x000000ff),(((x)&0x0000ff00)>>8),(((x)&0x00ff0000)>>16),(((x)&0xff000000)>>24)
  95. #define IP_TO_WSTR(str,addr) swprintf((str),L"%d.%d.%d.%d", \
  96. (addr)[0], \
  97. (addr)[1], \
  98. (addr)[2], \
  99. (addr)[3])
  100. #define GET_TOKEN_PRESENT(tokenMask) (dwBitVector & tokenMask)
  101. #define SET_TOKEN_PRESENT(tokenMask) (dwBitVector |= tokenMask)
  102. #define SetErrorType(pdw) *(pdw) = IsRouterRunning()?ERROR_ADMIN:ERROR_CONFIG