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.

498 lines
14 KiB

  1. //============================================================================
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //
  4. // File: Mgm.h
  5. //
  6. // History:
  7. // V Raman June-25-1997 Created.
  8. //
  9. // Data structures and entry points into MGM.
  10. //============================================================================
  11. #ifndef _MGM_H_
  12. #define _MGM_H_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. //----------------------------------------------------------------------------
  17. //
  18. // typedefs for callback interface
  19. //
  20. //----------------------------------------------------------------------------
  21. //
  22. // MGM_IF_ENTRY
  23. //
  24. // structure used in MGM_CREATION_ALERT_CALLBACK. In the process of
  25. // creating an MFE the routing protocol needs to enable/disable
  26. // multicast forwarding on each interface
  27. //
  28. typedef struct _MGM_IF_ENTRY {
  29. DWORD dwIfIndex;
  30. DWORD dwIfNextHopAddr;
  31. BOOL bIGMP;
  32. BOOL bIsEnabled;
  33. } MGM_IF_ENTRY, *PMGM_IF_ENTRY;
  34. //----------------------------------------------------------------------------
  35. //
  36. // Callbacks into routing protocols
  37. //
  38. //----------------------------------------------------------------------------
  39. //
  40. // call into a routing protocol to perform RPF check.
  41. //
  42. // Invoked in the context of MgmNewPacketReceived into protocol component
  43. // owning the incoming interface.
  44. //
  45. typedef DWORD
  46. (*PMGM_RPF_CALLBACK)(
  47. IN DWORD dwSourceAddr,
  48. IN DWORD dwSourceMask,
  49. IN DWORD dwGroupAddr,
  50. IN DWORD dwGroupMask,
  51. IN OUT PDWORD pdwInIfIndex,
  52. IN OUT PDWORD pdwInIfNextHopAddr,
  53. IN OUT PDWORD pdwUpStreamNbr,
  54. IN DWORD dwHdrSize,
  55. IN PBYTE pbPacketHdr,
  56. IN OUT PBYTE pbRoute
  57. );
  58. //
  59. // call into a routing protocol to determine the subset of interfaces
  60. // (owned by the routing protocol) on which a multicast packet from a
  61. // "new" source should be forwarded.
  62. //
  63. // Invoked in the context of MgmNewPacketReceived into all
  64. // routing protocols that have outgoing interfaces for this source.
  65. //
  66. typedef
  67. DWORD (*PMGM_CREATION_ALERT_CALLBACK)(
  68. IN DWORD dwSourceAddr,
  69. IN DWORD dwSourceMask,
  70. IN DWORD dwGroupAddr,
  71. IN DWORD dwGroupMask,
  72. IN DWORD dwInIfIndex,
  73. IN DWORD dwInIfNextHopAddr,
  74. IN DWORD dwIfCount,
  75. IN OUT PMGM_IF_ENTRY pmieOutIfList
  76. );
  77. //
  78. // call into routing protocol to notify protocol that an interface has
  79. // been deleted from the outgoing interface list of a group entry / MFE
  80. //
  81. // invoked in the context of MgmDeleteMembershipEntry()
  82. //
  83. typedef
  84. DWORD (*PMGM_PRUNE_ALERT_CALLBACK)(
  85. IN DWORD dwSourceAddr,
  86. IN DWORD dwSourceMask,
  87. IN DWORD dwGroupAddr,
  88. IN DWORD dwGroupMask,
  89. IN DWORD dwIfIndex,
  90. IN DWORD dwIfNextHopAddr,
  91. IN BOOL bMemberDelete,
  92. IN OUT PDWORD pdwTimeout
  93. );
  94. //
  95. // call into routing protocol to notify protocol that an interface has
  96. // been added to the outgoing interface list of a group entry / MFE
  97. //
  98. // invoked in the context of MgmAddMembershipEntry()
  99. //
  100. typedef
  101. DWORD (*PMGM_JOIN_ALERT_CALLBACK)(
  102. IN DWORD dwSourceAddr,
  103. IN DWORD dwSourceMask,
  104. IN DWORD dwGroupAddr,
  105. IN DWORD dwGroupMask,
  106. IN BOOL bMemberUpdate
  107. );
  108. //
  109. // call into routing protocol to notify protocol that a packet
  110. // has been received from a (source, group) on a wrong interface
  111. //
  112. typedef
  113. DWORD (*PMGM_WRONG_IF_CALLBACK)(
  114. IN DWORD dwSourceAddr,
  115. IN DWORD dwGroupAddr,
  116. IN DWORD dwIfIndex,
  117. IN DWORD dwIfNextHopAddr,
  118. IN DWORD dwHdrSize,
  119. IN PBYTE pbPacketHdr
  120. );
  121. //
  122. // call into routing protocol to notify protocol that IGMP needs to add
  123. // an interface to the outgoing interface list of a group entry / MFE
  124. //
  125. // invoked in the context of MgmLocalGroupJoin()
  126. //
  127. typedef DWORD
  128. (*PMGM_LOCAL_JOIN_CALLBACK) (
  129. IN DWORD dwSourceAddr,
  130. IN DWORD dwSourceMask,
  131. IN DWORD dwGroupAddr,
  132. IN DWORD dwGroupMask,
  133. IN DWORD dwIfIndex,
  134. IN DWORD dwIfNextHopAddr
  135. );
  136. //
  137. // call into routing protocol to notify protocol that IGMP needs to
  138. // delete an interface to the outgoing interface list of a group
  139. // entry / MFE
  140. //
  141. // invoked in the context of MgmLocalGroupJoin()
  142. //
  143. typedef DWORD
  144. (*PMGM_LOCAL_LEAVE_CALLBACK) (
  145. IN DWORD dwSourceAddr,
  146. IN DWORD dwSourceMask,
  147. IN DWORD dwGroupAddr,
  148. IN DWORD dwGroupMask,
  149. IN DWORD dwIfIndex,
  150. IN DWORD dwIfNextHopAddr
  151. );
  152. //
  153. // call into IGMP to notify it that a protocol is taking or
  154. // releasing ownership of an interface that has IGMP enabled on it.
  155. //
  156. // When this callback is invoked IGMP should stop adding/deleting
  157. // group memberships on the specified interface.
  158. //
  159. typedef DWORD
  160. (*PMGM_DISABLE_IGMP_CALLBACK) (
  161. IN DWORD dwIfIndex,
  162. IN DWORD dwIfNextHopAddr
  163. );
  164. //
  165. // call into IGMP to notify it that a protocol has finished taking
  166. // or releasing ownership of an interface.
  167. //
  168. // When this callback is invoked IGMP should add all its group memberships
  169. // on the interface.
  170. //
  171. typedef DWORD
  172. (*PMGM_ENABLE_IGMP_CALLBACK) (
  173. IN DWORD dwIfIndex,
  174. IN DWORD dwIfNextHopAddr
  175. );
  176. //----------------------------------------------------------------------------
  177. //
  178. // typedefs for MGM API interface
  179. //
  180. //----------------------------------------------------------------------------
  181. //
  182. // ROUTING_PROTOCOL_CONFIG
  183. //
  184. // routing protocol configuration that is passed to MGM at registration.
  185. //
  186. //
  187. // Callbacks into routing protocols
  188. //
  189. typedef struct _ROUTING_PROTOCOL_CONFIG {
  190. DWORD dwCallbackFlags;
  191. PMGM_RPF_CALLBACK pfnRpfCallback;
  192. PMGM_CREATION_ALERT_CALLBACK pfnCreationAlertCallback;
  193. PMGM_PRUNE_ALERT_CALLBACK pfnPruneAlertCallback;
  194. PMGM_JOIN_ALERT_CALLBACK pfnJoinAlertCallback;
  195. PMGM_WRONG_IF_CALLBACK pfnWrongIfCallback;
  196. //
  197. // callbacks into Routing protocols
  198. //
  199. PMGM_LOCAL_JOIN_CALLBACK pfnLocalJoinCallback;
  200. PMGM_LOCAL_LEAVE_CALLBACK pfnLocalLeaveCallback;
  201. //
  202. // callbacks into IGMP
  203. //
  204. PMGM_DISABLE_IGMP_CALLBACK pfnDisableIgmpCallback;
  205. PMGM_ENABLE_IGMP_CALLBACK pfnEnableIgmpCallback;
  206. } ROUTING_PROTOCOL_CONFIG, *PROUTING_PROTOCOL_CONFIG;
  207. //
  208. // MGM_ENUM_TYPES
  209. //
  210. // Enumeration types to be specified when the
  211. //
  212. typedef enum _MGM_ENUM_TYPES
  213. {
  214. ANY_SOURCE = 0, // enumerate group entries with
  215. // atleast one source
  216. ALL_SOURCES // enumerate all source entries
  217. // for a group entry
  218. } MGM_ENUM_TYPES;
  219. //
  220. // SOURCE_GROUP_ENTRY
  221. //
  222. // (S, G) entry that is returned by the group entry enumeration API.
  223. //
  224. typedef struct _SOURCE_GROUP_ENTRY {
  225. DWORD dwSourceAddr;
  226. DWORD dwSourceMask;
  227. DWORD dwGroupAddr;
  228. DWORD dwGroupMask;
  229. } SOURCE_GROUP_ENTRY, *PSOURCE_GROUP_ENTRY;
  230. //----------------------------------------------------------------------------
  231. //
  232. // Entry points into MGM.
  233. //
  234. //----------------------------------------------------------------------------
  235. //============================================================================
  236. // Routing protocol registration / de-registration API
  237. //============================================================================
  238. DWORD
  239. MgmRegisterMProtocol(
  240. IN PROUTING_PROTOCOL_CONFIG prpiInfo,
  241. IN DWORD dwProtocolId,
  242. IN DWORD dwComponentId,
  243. OUT HANDLE * phProtocol
  244. );
  245. DWORD
  246. MgmDeRegisterMProtocol(
  247. IN HANDLE hProtocol
  248. );
  249. //============================================================================
  250. // Interface ownership API
  251. //============================================================================
  252. DWORD
  253. MgmTakeInterfaceOwnership(
  254. IN HANDLE hProtocol,
  255. IN DWORD dwIfIndex,
  256. IN DWORD dwIfNextHopAddr
  257. );
  258. DWORD
  259. MgmReleaseInterfaceOwnership(
  260. IN HANDLE hProtocol,
  261. IN DWORD dwIfIndex,
  262. IN DWORD dwIfNextHopAddr
  263. );
  264. DWORD
  265. MgmGetProtocolOnInterface(
  266. IN DWORD dwIfIndex,
  267. IN DWORD dwIfNextHopAddr,
  268. IN OUT PDWORD pdwIfProtocolId,
  269. IN OUT PDWORD pdwIfComponentId
  270. );
  271. //============================================================================
  272. // Group membership manipulation API. (addition / deletion )
  273. //============================================================================
  274. #define MGM_JOIN_STATE_FLAG 0x00000001
  275. #define MGM_FORWARD_STATE_FLAG 0x00000002
  276. DWORD
  277. MgmAddGroupMembershipEntry(
  278. IN HANDLE hProtocol,
  279. IN DWORD dwSourceAddr,
  280. IN DWORD dwSourceMask,
  281. IN DWORD dwGroupAddr,
  282. IN DWORD dwGroupMask,
  283. IN DWORD dwIfIndex,
  284. IN DWORD dwIfNextHopIPAddr,
  285. IN DWORD dwFlags
  286. );
  287. DWORD
  288. MgmDeleteGroupMembershipEntry(
  289. IN HANDLE hProtocol,
  290. IN DWORD dwSourceAddr,
  291. IN DWORD dwSourceMask,
  292. IN DWORD dwGroupAddr,
  293. IN DWORD dwGroupMask,
  294. IN DWORD dwIfIndex,
  295. IN DWORD dwIfNextHopIPAddr,
  296. IN DWORD dwFlags
  297. );
  298. //============================================================================
  299. //
  300. // Enumeration API
  301. //
  302. //============================================================================
  303. //----------------------------------------------------------------------------
  304. // MFE enumeration API
  305. //----------------------------------------------------------------------------
  306. DWORD
  307. MgmGetMfe(
  308. IN PMIB_IPMCAST_MFE pimm,
  309. IN OUT PDWORD pdwBufferSize,
  310. IN OUT PBYTE pbBuffer
  311. );
  312. DWORD
  313. MgmGetFirstMfe(
  314. IN OUT PDWORD pdwBufferSize,
  315. IN OUT PBYTE pbBuffer,
  316. IN OUT PDWORD pdwNumEntries
  317. );
  318. DWORD
  319. MgmGetNextMfe(
  320. IN PMIB_IPMCAST_MFE pimmStart,
  321. IN OUT PDWORD pdwBufferSize,
  322. IN OUT PBYTE pbBuffer,
  323. IN OUT PDWORD pdwNumEntries
  324. );
  325. //
  326. // Include statistics corresponding to MIB_IPMCAST_MFE_STATS
  327. //
  328. #define MGM_MFE_STATS_0 0x00000001
  329. //
  330. // Include statistics corresponding to MIB_IPMCAST_MFE_STATS_EX
  331. //
  332. #define MGM_MFE_STATS_1 0x00000002
  333. DWORD
  334. MgmGetMfeStats(
  335. IN PMIB_IPMCAST_MFE pimm,
  336. IN OUT PDWORD pdwBufferSize,
  337. IN OUT PBYTE pbBuffer,
  338. IN DWORD dwFlags
  339. );
  340. DWORD
  341. MgmGetFirstMfeStats(
  342. IN OUT PDWORD pdwBufferSize,
  343. IN OUT PBYTE pbBuffer,
  344. IN OUT PDWORD pdwNumEntries,
  345. IN DWORD dwFlags
  346. );
  347. DWORD
  348. MgmGetNextMfeStats(
  349. IN PMIB_IPMCAST_MFE pimmStart,
  350. IN OUT PDWORD pdwBufferSize,
  351. IN OUT PBYTE pbBuffer,
  352. IN OUT PDWORD pdwNumEntries,
  353. IN DWORD dwFlags
  354. );
  355. //----------------------------------------------------------------------------
  356. // Group menbership entry enumeration API
  357. //----------------------------------------------------------------------------
  358. DWORD
  359. MgmGroupEnumerationStart(
  360. IN HANDLE hProtocol,
  361. IN MGM_ENUM_TYPES metEnumType,
  362. OUT HANDLE * phEnumHandle
  363. );
  364. DWORD
  365. MgmGroupEnumerationGetNext(
  366. IN HANDLE hEnum,
  367. IN OUT PDWORD pdwBufferSize,
  368. IN OUT PBYTE pbBuffer,
  369. IN OUT PDWORD pdwNumEntries
  370. );
  371. DWORD
  372. MgmGroupEnumerationEnd(
  373. IN HANDLE hEnum
  374. );
  375. //-----------------------------------------------------------------
  376. // Mgm MFE Update API.
  377. //
  378. //-----------------------------------------------------------------
  379. DWORD
  380. MgmSetMfe(
  381. IN HANDLE hProtocol,
  382. IN PMIB_IPMCAST_MFE pmimm
  383. );
  384. #endif //_MGM_H_