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.

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