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.

137 lines
4.6 KiB

  1. //============================================================================
  2. // Copyright (c) 1995, Microsoft Corporation
  3. //
  4. // File: ipmgm.h
  5. //
  6. // History:
  7. // V Raman Aug-6-1997 Created.
  8. //
  9. // Contains type definitions and declarations for IP MGM.
  10. //============================================================================
  11. #ifndef _MGMDEFS_H_
  12. #define _MGMDEFS_H_
  13. #define MGM_CLIENT_HANDLE_TAG ('MGMc' << 8)
  14. #define MGM_ENUM_HANDLE_TAG ('MGMe' << 8)
  15. //----------------------------------------------------------------------------
  16. // Protocol constants
  17. //----------------------------------------------------------------------------
  18. #define INVALID_PROTOCOL_ID 0xffffffff
  19. #define INVALID_COMPONENT_ID 0xffffffff
  20. #define IS_VALID_PROTOCOL( a, b ) \
  21. (a) != INVALID_PROTOCOL_ID && (b) != INVALID_COMPONENT_ID
  22. #define IS_PROTOCOL_IGMP( p ) \
  23. ( (p)-> dwProtocolId == PROTO_IP_IGMP )
  24. #define IS_ROUTING_PROTOCOL( p ) \
  25. !IS_PROTOCOL_IGMP( p )
  26. #define IS_PROTOCOL_ID_IGMP( i ) \
  27. (i) == PROTO_IP_IGMP
  28. //----------------------------------------------------------------------------
  29. // Interface constants
  30. //----------------------------------------------------------------------------
  31. #define INVALID_INTERFACE_INDEX 0x0
  32. #define INVALID_NEXT_HOP_ADDR 0x0
  33. #define IS_VALID_INTERFACE( a, b ) \
  34. (a) != INVALID_INTERFACE_INDEX
  35. //----------------------------------------------------------------------------
  36. // Wildcard source/group macros
  37. //----------------------------------------------------------------------------
  38. #define WILDCARD_GROUP 0x0
  39. #define WILDCARD_GROUP_MASK 0x0
  40. #define WILDCARD_SOURCE 0x0
  41. #define WILDCARD_SOURCE_MASK 0x0
  42. #define IS_WILDCARD_GROUP( a, b ) (a) == WILDCARD_GROUP
  43. #define IS_WILDCARD_SOURCE( a, b ) (a) == WILDCARD_SOURCE
  44. //----------------------------------------------------------------------------
  45. // Time conversion constants and macros
  46. //----------------------------------------------------------------------------
  47. #define SYSTIME_UNITS_PER_MSEC (1000 * 10)
  48. #define SYSTIME_UNITS_PER_SEC (1000 * SYSTIME_UNITS_PER_MSEC)
  49. #define SYSTIME_UNITS_PER_MINUTE (60 * SYSTIME_UNITS_PER_SEC)
  50. #define EXPIRY_INTERVAL 15 * 60 * 1000
  51. #define ROUTE_CHECK_INTERVAL \
  52. SYSTIME_UNITS_PER_MINUTE / SYSTIME_UNITS_PER_MSEC
  53. #define MgmQuerySystemTime(p) NtQuerySystemTime((p))
  54. #define MgmSetExpiryTime(p, i) \
  55. { \
  56. LARGE_INTEGER __li = { i }; \
  57. *(p) = RtlLargeIntegerAdd( *(p), __li ); \
  58. }
  59. #define MgmElapsedTime( p, q, u ) \
  60. { \
  61. LARGE_INTEGER __li1, __li2; \
  62. ULONG __rem; \
  63. MgmQuerySystemTime( &__li1); \
  64. __li2 = RtlLargeIntegerSubtract( __li1, *(p) ); \
  65. __li1 = RtlExtendedLargeIntegerDivide( __li2, u, &__rem ); \
  66. *(q) = __li1.LowPart; \
  67. }
  68. #define MgmElapsedSecs( p, q ) \
  69. MgmElapsedTime( p, q, SYSTIME_UNITS_PER_SEC )
  70. #define TIMER_TABLE_MAX_SIZE 16
  71. //----------------------------------------------------------------------------
  72. // IP address manipulation macros
  73. // Bolade's macro.
  74. //----------------------------------------------------------------------------
  75. //
  76. // This macro compares two IP addresses in network order by
  77. // masking off each pair of octets and doing a subtraction;
  78. // the result of the final subtraction is stored in the third argument.
  79. //
  80. #define INET_CMP(a,b,c) \
  81. (((c) = (((a) & 0x000000ff) - ((b) & 0x000000ff))) ? (c) : \
  82. (((c) = (((a) & 0x0000ff00) - ((b) & 0x0000ff00))) ? (c) : \
  83. (((c) = (((a) & 0x00ff0000) - ((b) & 0x00ff0000))) ? (c) : \
  84. (((c) = ((((a)>>8) & 0x00ff0000) - (((b)>>8) & 0x00ff0000)))))))
  85. //
  86. // IP address conversion macro:
  87. // calls inet_ntoa directly on a DWORD, by casting it as an IN_ADDR.
  88. //
  89. #define INET_NTOA(dw) inet_ntoa( *(PIN_ADDR)&(dw) )
  90. //
  91. // IPv4 mask len
  92. //
  93. #define IPv4_ADDR_LEN 32
  94. #endif // _MGMDEFS_H_