Source code of Windows XP (NT5)
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.

313 lines
7.6 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. routing\ip\rtrmgr\mbound.h
  5. Abstract:
  6. Header file for admin-scoped boundaries
  7. Revision History:
  8. Dave Thaler 20th Apr 1998 Created
  9. --*/
  10. #ifndef __MBOUND_H__
  11. #define __MBOUND_H__
  12. // Definitions for manipulating scope names
  13. #ifdef SN_UNICODE
  14. # define sn_strlen wcslen
  15. # define sn_strcpy wcscpy
  16. # define sn_strncpy wcsncpy
  17. # define sn_strcmp wcscmp
  18. # define sn_strncmp wcsncmp
  19. # define sn_sprintf wsprintf
  20. # define SN_L L
  21. #else
  22. # define sn_strlen strlen
  23. # define sn_strcpy strcpy
  24. # define sn_strncpy strncpy
  25. # define sn_strcmp strcmp
  26. # define sn_strncmp strncmp
  27. # define sn_sprintf sprintf
  28. # define SN_L
  29. #endif
  30. #define SNCHARSIZE sizeof(SN_CHAR)
  31. typedef struct _SCOPE_NAME_ENTRY {
  32. LIST_ENTRY leNameLink;
  33. LANGID idLanguage;
  34. SCOPE_NAME snScopeName; // in unicode
  35. BOOL bDefault;
  36. } SCOPE_NAME_ENTRY, *PSCOPE_NAME_ENTRY;
  37. typedef struct _SCOPE_ENTRY {
  38. LIST_ENTRY leScopeLink;
  39. IPV4_ADDRESS ipGroupAddress;
  40. IPV4_ADDRESS ipGroupMask;
  41. ULONG ulNumInterfaces;
  42. ULONG ulNumNames;
  43. LIST_ENTRY leNameList;
  44. // fields used by MZAP
  45. BOOL bDivisible;
  46. IPV4_ADDRESS ipMyZoneID;
  47. LIST_ENTRY leZBRList;
  48. BYTE bZTL;
  49. } SCOPE_ENTRY, *PSCOPE_ENTRY;
  50. typedef struct _ZBR_ENTRY {
  51. LIST_ENTRY leZBRLink;
  52. LIST_ENTRY leTimerLink;
  53. IPV4_ADDRESS ipAddress;
  54. LARGE_INTEGER liExpiryTime;
  55. } ZBR_ENTRY, *PZBR_ENTRY;
  56. typedef struct _BOUNDARY_BUCKET {
  57. LIST_ENTRY leInterfaceList;
  58. } BOUNDARY_BUCKET;
  59. typedef struct _BOUNDARY_IF {
  60. LIST_ENTRY leBoundaryIfLink; // entry in list per bucket
  61. LIST_ENTRY leBoundaryIfMasterLink; // entry in master list
  62. DWORD dwIfIndex;
  63. LIST_ENTRY leBoundaryList;
  64. // fields used by MZAP
  65. SOCKET sMzapSocket;
  66. IPV4_ADDRESS ipOtherLocalZoneID;
  67. } BOUNDARY_IF, *PBOUNDARY_IF;
  68. typedef struct _BOUNDARY_ENTRY {
  69. LIST_ENTRY leBoundaryLink;
  70. PSCOPE_ENTRY pScope;
  71. } BOUNDARY_ENTRY, *PBOUNDARY_ENTRY;
  72. typedef struct _RANGE_ENTRY {
  73. LIST_ENTRY leRangeLink;
  74. IPV4_ADDRESS ipFirst;
  75. IPV4_ADDRESS ipLast;
  76. } RANGE_ENTRY, *PRANGE_ENTRY;
  77. // should this be moved into some snmp header file?
  78. #define ROWSTATUS_ACTIVE 1
  79. #define ROWSTATUS_NOTINSERVICE 2
  80. #define ROWSTATUS_NOTREADY 3
  81. #define ROWSTATUS_CREATEANDGO 4
  82. #define ROWSTATUS_CREATEANDWAIT 5
  83. #define ROWSTATUS_DESTROY 6
  84. //
  85. // Function prototypes
  86. //
  87. DWORD
  88. SetMcastLimitInfo(
  89. IN PICB picb,
  90. IN PRTR_INFO_BLOCK_HEADER pInfoHdr
  91. );
  92. DWORD
  93. GetMcastLimitInfo(
  94. IN PICB picb,
  95. IN OUT PRTR_TOC_ENTRY pToc,
  96. IN OUT PDWORD pdwTocIndex,
  97. IN OUT PBYTE pBuffer,
  98. IN PRTR_INFO_BLOCK_HEADER pInfoHdr,
  99. IN OUT PDWORD pdwBufferSize
  100. );
  101. void
  102. InitializeBoundaryTable();
  103. BOOL
  104. RmHasBoundary(
  105. IN DWORD dwIfIndex,
  106. IN IPV4_ADDRESS ipGroupAddress
  107. );
  108. DWORD
  109. SetBoundaryInfo(
  110. IN PICB picb,
  111. IN PRTR_INFO_BLOCK_HEADER pInfoHdr
  112. );
  113. DWORD
  114. GetBoundaryInfo(
  115. IN PICB picb,
  116. IN OUT PRTR_TOC_ENTRY pToc,
  117. IN OUT PDWORD pdwTocIndex,
  118. IN OUT PBYTE pBuffer,
  119. IN PRTR_INFO_BLOCK_HEADER pInfoHdr,
  120. IN OUT PDWORD pdwBufferSize
  121. );
  122. DWORD
  123. SetScopeInfo(
  124. IN PRTR_INFO_BLOCK_HEADER pInfoHdr
  125. );
  126. DWORD
  127. GetScopeInfo(
  128. IN OUT PRTR_TOC_ENTRY pToc,
  129. IN OUT PDWORD pdwTocIndex,
  130. IN OUT PBYTE pBuffer,
  131. IN PRTR_INFO_BLOCK_HEADER pInfoHdr,
  132. IN OUT PDWORD pdwBufferSize
  133. );
  134. DWORD
  135. SNMPSetScope(
  136. IN IPV4_ADDRESS ipGroupAddress,
  137. IN IPV4_ADDRESS ipGroupMask,
  138. IN SCOPE_NAME snScopeName
  139. );
  140. DWORD
  141. SNMPAddScope(
  142. IN IPV4_ADDRESS ipGroupAddress,
  143. IN IPV4_ADDRESS ipGroupMask,
  144. IN SCOPE_NAME snScopeName,
  145. OUT PSCOPE_ENTRY *ppScope
  146. );
  147. DWORD
  148. SNMPDeleteScope(
  149. IN IPV4_ADDRESS ipGroupAddress,
  150. IN IPV4_ADDRESS ipGroupMask
  151. );
  152. DWORD
  153. SNMPAddBoundaryToInterface(
  154. IN DWORD dwIfIndex,
  155. IN IPV4_ADDRESS ipGroupAddress,
  156. IN IPV4_ADDRESS ipGroupMask
  157. );
  158. DWORD
  159. SNMPDeleteBoundaryFromInterface(
  160. IN DWORD dwIfIndex,
  161. IN IPV4_ADDRESS ipGroupAddress,
  162. IN IPV4_ADDRESS ipGroupMask
  163. );
  164. //----------------------------------------------------------------------------
  165. // BOUNDARY enumeration API
  166. //----------------------------------------------------------------------------
  167. DWORD
  168. RmGetBoundary(
  169. IN PMIB_IPMCAST_BOUNDARY pimm,
  170. IN OUT PDWORD pdwBufferSize,
  171. IN OUT PBYTE pbBuffer
  172. );
  173. DWORD
  174. RmGetFirstBoundary(
  175. IN OUT PDWORD pdwBufferSize,
  176. IN OUT PBYTE pbBuffer,
  177. IN OUT PDWORD pdwNumEntries
  178. );
  179. DWORD
  180. RmGetNextBoundary(
  181. IN PMIB_IPMCAST_BOUNDARY pimmStart,
  182. IN OUT PDWORD pdwBufferSize,
  183. IN OUT PBYTE pbBuffer,
  184. IN OUT PDWORD pdwNumEntries
  185. );
  186. //----------------------------------------------------------------------------
  187. // SCOPE enumeration API
  188. //----------------------------------------------------------------------------
  189. DWORD
  190. RmGetScope(
  191. IN PMIB_IPMCAST_SCOPE pimm,
  192. IN OUT PDWORD pdwBufferSize,
  193. IN OUT PBYTE pbBuffer
  194. );
  195. DWORD
  196. RmGetFirstScope(
  197. IN OUT PDWORD pdwBufferSize,
  198. IN OUT PBYTE pbBuffer,
  199. IN OUT PDWORD pdwNumEntries
  200. );
  201. DWORD
  202. RmGetNextScope(
  203. IN PMIB_IPMCAST_SCOPE pimmStart,
  204. IN OUT PDWORD pdwBufferSize,
  205. IN OUT PBYTE pbBuffer,
  206. IN OUT PDWORD pdwNumEntries
  207. );
  208. #endif
  209. // Constants used by MZAP
  210. #define MZAP_VERSION 0
  211. #define MZAP_LOCAL_GROUP ((DWORD)0xFcFFFFeF) // 239.255.255.252
  212. #define MZAP_RELATIVE_GROUP 3 // TOP-3
  213. #define MZAP_PORT 2106
  214. #define MZAP_DEFAULT_ZTL 32
  215. #if 0
  216. // values used for testing
  217. #define DEBUG_MZAP
  218. #define ZAM_INTERVAL 5 // 5 seconds
  219. #define ZAM_HOLDTIME 17 // 17 seconds
  220. #define ZAM_DUP_TIME 15 // 15 seconds
  221. #define ZAM_STARTUP_DELAY 0 // 0 seconds
  222. #define ZCM_INTERVAL 5 // 5 seconds
  223. #define ZCM_HOLDTIME 17 // 17 mins
  224. #define ZLE_SUPPRESSION_INTERVAL 5 // 5 seconds
  225. #define ZLE_MIN_INTERVAL 5 // 5 seconds
  226. #else
  227. #define ZAM_INTERVAL 600 // 10 mins
  228. #define ZAM_HOLDTIME 1860 // 31 mins
  229. #define ZAM_DUP_TIME 30 // 30 seconds
  230. #define ZAM_STARTUP_DELAY 0 // 0 seconds
  231. #define ZCM_INTERVAL 600 // 10 mins
  232. #define ZCM_HOLDTIME 1860 // 31 mins
  233. #define ZLE_SUPPRESSION_INTERVAL 300 // 5 mins
  234. #define ZLE_MIN_INTERVAL 300 // 5 mins
  235. #endif
  236. #define MZAP_BIG_BIT 0x80
  237. #define ADDRFAMILY_IPV4 1
  238. #define ADDRFAMILY_IPV6 2
  239. #define PTYPE_ZAM 0
  240. #define PTYPE_ZLE 1
  241. #define PTYPE_ZCM 2
  242. #define PTYPE_NIM 3
  243. DWORD
  244. StartMZAP();
  245. void
  246. StopMZAP();
  247. VOID
  248. HandleMZAPMessages();
  249. VOID
  250. HandleMzapTimer();
  251. DWORD
  252. BindBoundaryInterface(
  253. PICB picb
  254. );