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.

78 lines
3.9 KiB

  1. #define ptszDelimiter L"="
  2. //-----------------------------------------------------------------------------
  3. // Macros to faciltate address list (DWORD list) access
  4. //-----------------------------------------------------------------------------
  5. #define GET_SERVER_INDEX( list, count, addr, index ) \
  6. { \
  7. DWORD __dwInd = 0; \
  8. for ( ; __dwInd < count; __dwInd++ ) \
  9. if ( list[ __dwInd ] == addr ) { break; } \
  10. index = __dwInd; \
  11. }
  12. #define DELETE_SERVER_ADDR( list1, list2, count, index ) \
  13. { \
  14. DWORD __dwInd1 = 0, __dwInd2 = 0; \
  15. for ( ; __dwInd1 < count; __dwInd1++ ) \
  16. { \
  17. if ( __dwInd1 == index ) { continue; } \
  18. list2[ __dwInd2++ ] = list1[ __dwInd1 ]; \
  19. } \
  20. }
  21. //-----------------------------------------------------------------------------
  22. // Macros to faciltate RIP filter list access
  23. //-----------------------------------------------------------------------------
  24. #define GET_FILTER_INDEX( list, count, filt, index ) \
  25. { \
  26. DWORD __dwInd = 0; \
  27. for ( ; __dwInd < count; __dwInd++ ) \
  28. if ( ( list[ __dwInd ].RF_LoAddress == filt.RF_LoAddress ) && \
  29. ( list[ __dwInd ].RF_HiAddress == filt.RF_HiAddress ) ) \
  30. { \
  31. break; \
  32. } \
  33. index = __dwInd; \
  34. }
  35. #define DELETE_FILTER( list1, list2, count, index ) \
  36. DELETE_SERVER_ADDR( list1, list2, count, index )
  37. #define IsHelpToken(pwszToken)\
  38. (MatchToken(pwszToken, CMD_HELP1) \
  39. || MatchToken(pwszToken, CMD_HELP2))
  40. #define GetDispString(gModule, val, str, count, table) \
  41. { \
  42. DWORD __dwInd = 0; \
  43. for( ; __dwInd < (count); __dwInd += 2 ) \
  44. { \
  45. if ( (val) != (table)[ __dwInd ] ) { continue; } \
  46. (str) = MakeString( (gModule), (table)[ __dwInd + 1 ] ); \
  47. break; \
  48. } \
  49. if ( __dwInd >= (count) ) { (str) = MakeString( (gModule), STRING_UNKNOWN ); } \
  50. }
  51. //
  52. // mcast addr: 224.0.0.0 < group <240.0.0.0
  53. //
  54. #define IS_MCAST_ADDR(Group) \
  55. ( (0x000000E0!=(Group)) \
  56. && (0x000000E0 <= ((Group)&0x000000FF) ) \
  57. && (0x000000F0 > ((Group)&0x000000FF) ) )
  58. #define HEAP_FREE_NOT_NULL(ptr) {\
  59. if (ptr) HeapFree(GetProcessHeap(), 0, (ptr));}
  60. #define HEAP_FREE(ptr) { \
  61. HeapFree(GetProcessHeap(), 0, ptr);}
  62. #define GET_TOKEN_PRESENT(tokenMask) (dwBitVector & tokenMask)
  63. #define SET_TOKEN_PRESENT(tokenMask) (dwBitVector |= tokenMask)
  64. #define MAX_NUM_INDICES 6