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.

308 lines
10 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. private\inc\ddipmcst.h
  5. Abstract:
  6. Public IOCTLS and related structures for IP Multicasting
  7. See documentation for more details
  8. Author:
  9. Amritansh Raghav
  10. Revision History:
  11. AmritanR Created
  12. Notes:
  13. --*/
  14. #ifndef __DDIPMCAST_H__
  15. #define __DDIPMCAST_H__
  16. #pragma warning(disable:4201)
  17. #ifndef ANY_SIZE
  18. #define ANY_SIZE 1
  19. #endif
  20. //////////////////////////////////////////////////////////////////////////////
  21. // //
  22. // Device Name - this string is the name of the device. It is the name //
  23. // that should be passed to NtCreateFile when accessing the device. //
  24. // //
  25. //////////////////////////////////////////////////////////////////////////////
  26. #define DD_IPMCAST_DEVICE_NAME L"\\Device\\IPMULTICAST"
  27. //////////////////////////////////////////////////////////////////////////////
  28. // //
  29. // Win32 Name - This is the (Unicode and NonUnicode) name exposed by Win32 //
  30. // subsystem for the device. It is the name that should be passed to //
  31. // CreateFile(Ex) when opening the device. //
  32. // //
  33. //////////////////////////////////////////////////////////////////////////////
  34. #define IPMCAST_NAME L"\\\\.\\IPMULTICAST"
  35. #define IPMCAST_NAME_NUC "\\\\.\\IPMULTICAST"
  36. //////////////////////////////////////////////////////////////////////////////
  37. // //
  38. // IOCTL code definitions and related structures //
  39. // All the IOCTLs are synchronous except for IOCTL_POST_NOTIFICATION //
  40. // All need need administrator privilege //
  41. // //
  42. //////////////////////////////////////////////////////////////////////////////
  43. #define FSCTL_IPMCAST_BASE FILE_DEVICE_NETWORK
  44. #define _IPMCAST_CTL_CODE(function, method, access) \
  45. CTL_CODE(FSCTL_IPMCAST_BASE, function, method, access)
  46. #define MIN_IPMCAST_CODE 0
  47. #define SET_MFE_CODE (MIN_IPMCAST_CODE)
  48. #define GET_MFE_CODE (SET_MFE_CODE + 1)
  49. #define DELETE_MFE_CODE (GET_MFE_CODE + 1)
  50. #define SET_TTL_CODE (DELETE_MFE_CODE + 1)
  51. #define GET_TTL_CODE (SET_TTL_CODE + 1)
  52. #define POST_NOTIFICATION_CODE (GET_TTL_CODE + 1)
  53. #define START_STOP_CODE (POST_NOTIFICATION_CODE + 1)
  54. #define SET_IF_STATE_CODE (START_STOP_CODE + 1)
  55. #define MAX_IPMCAST_CODE (SET_IF_STATE_CODE)
  56. //////////////////////////////////////////////////////////////////////////////
  57. // //
  58. // The IOCTL used to set an MFE. //
  59. // //
  60. //////////////////////////////////////////////////////////////////////////////
  61. #define IOCTL_IPMCAST_SET_MFE \
  62. _IPMCAST_CTL_CODE(SET_MFE_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  63. //
  64. // WARNING WARNING!!!
  65. // The following structures are also called MIB_XXX in iprtrmib.h. There
  66. // is code in routing\ip\rtrmgr\access.c which assumes the structures are
  67. // the same. If this ever changes, the code in access.c needs to be fixed
  68. //
  69. typedef struct _IPMCAST_OIF
  70. {
  71. IN DWORD dwOutIfIndex;
  72. IN DWORD dwNextHopAddr;
  73. IN DWORD dwDialContext;
  74. IN DWORD dwReserved;
  75. }IPMCAST_OIF, *PIPMCAST_OIF;
  76. //
  77. // This must be the same as INVALID_WANARP_CONTEXT
  78. //
  79. #define INVALID_DIAL_CONTEXT 0x00000000
  80. typedef struct _IPMCAST_MFE
  81. {
  82. IN DWORD dwGroup;
  83. IN DWORD dwSource;
  84. IN DWORD dwSrcMask;
  85. IN DWORD dwInIfIndex;
  86. IN ULONG ulNumOutIf;
  87. IN ULONG ulTimeOut;
  88. IN DWORD fFlags;
  89. IN DWORD dwReserved;
  90. IN IPMCAST_OIF rgioOutInfo[ANY_SIZE];
  91. }IPMCAST_MFE, *PIPMCAST_MFE;
  92. #define SIZEOF_BASIC_MFE \
  93. (ULONG)(FIELD_OFFSET(IPMCAST_MFE, rgioOutInfo[0]))
  94. #define SIZEOF_MFE(X) \
  95. (SIZEOF_BASIC_MFE + ((X) * sizeof(IPMCAST_OIF)))
  96. //////////////////////////////////////////////////////////////////////////////
  97. // //
  98. // This IOCTL is used to retrieve an MFE and all the related statistics //
  99. // //
  100. //////////////////////////////////////////////////////////////////////////////
  101. #define IOCTL_IPMCAST_GET_MFE \
  102. _IPMCAST_CTL_CODE(GET_MFE_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  103. typedef struct _IPMCAST_OIF_STATS
  104. {
  105. OUT DWORD dwOutIfIndex;
  106. OUT DWORD dwNextHopAddr;
  107. OUT DWORD dwDialContext;
  108. OUT ULONG ulTtlTooLow;
  109. OUT ULONG ulFragNeeded;
  110. OUT ULONG ulOutPackets;
  111. OUT ULONG ulOutDiscards;
  112. }IPMCAST_OIF_STATS, *PIPMCAST_OIF_STATS;
  113. typedef struct _IPMCAST_MFE_STATS
  114. {
  115. IN DWORD dwGroup;
  116. IN DWORD dwSource;
  117. IN DWORD dwSrcMask;
  118. OUT DWORD dwInIfIndex;
  119. OUT ULONG ulNumOutIf;
  120. OUT ULONG ulInPkts;
  121. OUT ULONG ulInOctets;
  122. OUT ULONG ulPktsDifferentIf;
  123. OUT ULONG ulQueueOverflow;
  124. OUT ULONG ulUninitMfe;
  125. OUT ULONG ulNegativeMfe;
  126. OUT ULONG ulInDiscards;
  127. OUT ULONG ulInHdrErrors;
  128. OUT ULONG ulTotalOutPackets;
  129. OUT IPMCAST_OIF_STATS rgiosOutStats[ANY_SIZE];
  130. }IPMCAST_MFE_STATS, *PIPMCAST_MFE_STATS;
  131. #define SIZEOF_BASIC_MFE_STATS \
  132. (ULONG)(FIELD_OFFSET(IPMCAST_MFE_STATS, rgiosOutStats[0]))
  133. #define SIZEOF_MFE_STATS(X) \
  134. (SIZEOF_BASIC_MFE_STATS + ((X) * sizeof(IPMCAST_OIF_STATS)))
  135. //////////////////////////////////////////////////////////////////////////////
  136. // //
  137. // The IOCTL used to delete an MFE. //
  138. // //
  139. //////////////////////////////////////////////////////////////////////////////
  140. #define IOCTL_IPMCAST_DELETE_MFE \
  141. _IPMCAST_CTL_CODE(DELETE_MFE_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  142. typedef struct _IPMCAST_DELETE_MFE
  143. {
  144. IN DWORD dwGroup;
  145. IN DWORD dwSource;
  146. IN DWORD dwSrcMask;
  147. }IPMCAST_DELETE_MFE, *PIPMCAST_DELETE_MFE;
  148. //////////////////////////////////////////////////////////////////////////////
  149. // //
  150. // The IOCTL set the TTL scope for an interface. If a packet has a lower //
  151. // TTL than the scope, it will be dropped //
  152. // //
  153. //////////////////////////////////////////////////////////////////////////////
  154. #define IOCTL_IPMCAST_SET_TTL \
  155. _IPMCAST_CTL_CODE(SET_TTL_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  156. #define IOCTL_IPMCAST_GET_TTL \
  157. _IPMCAST_CTL_CODE(GET_TTL_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  158. typedef struct _IPMCAST_IF_TTL
  159. {
  160. IN OUT DWORD dwIfIndex;
  161. IN OUT BYTE byTtl;
  162. }IPMCAST_IF_TTL, *PIPMCAST_IF_TTL;
  163. //////////////////////////////////////////////////////////////////////////////
  164. // //
  165. // The IOCTL used to post a notification to the Multicast Driver. This //
  166. // is the only asynchronous IOCTL. When the IOCTL completes, the driver //
  167. // returns a message to the user mode component. The message type (dwEvent) //
  168. // and the corresponding data is defined below //
  169. // //
  170. //////////////////////////////////////////////////////////////////////////////
  171. #define IPMCAST_RCV_PKT_MSG 0
  172. #define IPMCAST_DELETE_MFE_MSG 1
  173. #define IPMCAST_WRONG_IF_MSG 2
  174. #define IOCTL_IPMCAST_POST_NOTIFICATION \
  175. _IPMCAST_CTL_CODE(POST_NOTIFICATION_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  176. #define PKT_COPY_SIZE 256
  177. typedef struct _IPMCAST_PKT_MSG
  178. {
  179. OUT DWORD dwInIfIndex;
  180. OUT DWORD dwInNextHopAddress;
  181. OUT ULONG cbyDataLen;
  182. OUT BYTE rgbyData[PKT_COPY_SIZE];
  183. }IPMCAST_PKT_MSG, *PIPMCAST_PKT_MSG;
  184. #define SIZEOF_PKT_MSG(p) \
  185. (FIELD_OFFSET(IPMCAST_PKT_MSG, rgbyData) + (p)->cbyDataLen)
  186. //
  187. // Since the msg is big because of packet msg, we may as well
  188. // pack more than one MFE into the delete msg
  189. //
  190. #define NUM_DEL_MFES PKT_COPY_SIZE/sizeof(IPMCAST_DELETE_MFE)
  191. typedef struct _IPMCAST_MFE_MSG
  192. {
  193. OUT ULONG ulNumMfes;
  194. OUT IPMCAST_DELETE_MFE idmMfe[NUM_DEL_MFES];
  195. }IPMCAST_MFE_MSG, *PIPMCAST_MFE_MSG;
  196. #define SIZEOF_MFE_MSG(p) \
  197. (FIELD_OFFSET(IPMCAST_MFE_MSG, idmMfe) + ((p)->ulNumMfes * sizeof(IPMCAST_DELETE_MFE)))
  198. typedef struct _IPMCAST_NOTIFICATION
  199. {
  200. OUT DWORD dwEvent;
  201. union
  202. {
  203. IPMCAST_PKT_MSG ipmPkt;
  204. IPMCAST_MFE_MSG immMfe;
  205. };
  206. }IPMCAST_NOTIFICATION, *PIPMCAST_NOTIFICATION;
  207. //////////////////////////////////////////////////////////////////////////////
  208. // //
  209. // The IOCTL used to start or stop multicasting. The corresponding buffer //
  210. // is a DWORD which is set to 1 to start the driver and to 0 to stop it //
  211. // //
  212. //////////////////////////////////////////////////////////////////////////////
  213. #define IOCTL_IPMCAST_START_STOP \
  214. _IPMCAST_CTL_CODE(START_STOP_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  215. //////////////////////////////////////////////////////////////////////////////
  216. // //
  217. // The IOCTL used to set the state on an interface. //
  218. // //
  219. //////////////////////////////////////////////////////////////////////////////
  220. #define IOCTL_IPMCAST_SET_IF_STATE \
  221. _IPMCAST_CTL_CODE(SET_IF_STATE_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  222. typedef struct _IPMCAST_IF_STATE
  223. {
  224. IN DWORD dwIfIndex;
  225. IN BYTE byState;
  226. }IPMCAST_IF_STATE, *PIPMCAST_IF_STATE;
  227. #pragma warning(default:4201)
  228. #endif // __DDIPMCST_H__