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.

235 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. routing\ip\rtrmgr\mcmisc.h
  5. Abstract:
  6. Header file for mrinfo and mtrace-related stuff
  7. Revision History:
  8. Dave Thaler 20th Apr 1998 Created
  9. --*/
  10. #ifndef __MCMISC_H__
  11. #define __MCMISC_H__
  12. #include <pshpack1.h>
  13. //
  14. // Identify all address variables by IPV4_ADDRESS to make it
  15. // easier to port to IPv6.
  16. //
  17. typedef DWORD IPV4_ADDRESS, *PIPV4_ADDRESS;
  18. typedef struct _IGMP_HEADER
  19. {
  20. BYTE byType;
  21. BYTE byCode;
  22. WORD wXSum;
  23. DWORD dwReserved;
  24. } IGMP_HEADER, *PIGMP_HEADER;
  25. #define MIN_IGMP_PACKET_SIZE sizeof(IGMP_HEADER)
  26. //
  27. // Format of an mrinfo message
  28. //
  29. typedef struct _MRINFO_HEADER
  30. {
  31. BYTE byType;
  32. BYTE byCode;
  33. WORD wChecksum;
  34. BYTE byReserved;
  35. BYTE byCapabilities;
  36. BYTE byMinor;
  37. BYTE byMajor;
  38. }MRINFO_HEADER, *PMRINFO_HEADER;
  39. //
  40. // Format of an mtrace header
  41. //
  42. typedef struct _MTRACE_HEADER
  43. {
  44. BYTE byType;
  45. BYTE byHops;
  46. WORD wChecksum;
  47. IPV4_ADDRESS dwGroupAddress;
  48. IPV4_ADDRESS dwSourceAddress;
  49. IPV4_ADDRESS dwDestAddress;
  50. IPV4_ADDRESS dwResponseAddress;
  51. BYTE byRespTtl;
  52. BYTE byQueryID1;
  53. WORD wQueryID2;
  54. }MTRACE_HEADER, *PMTRACE_HEADER;
  55. //
  56. // Format of a response block inside an mtrace message
  57. //
  58. typedef struct _MTRACE_RESPONSE_BLOCK
  59. {
  60. DWORD dwQueryArrivalTime;
  61. IPV4_ADDRESS dwIifAddr;
  62. IPV4_ADDRESS dwOifAddr;
  63. IPV4_ADDRESS dwPrevHopAddr;
  64. DWORD dwIifPacketCount;
  65. DWORD dwOifPacketCount;
  66. DWORD dwSGPacketCount;
  67. BYTE byIifProtocol;
  68. BYTE byOifThreshold;
  69. BYTE bySrcMaskLength;
  70. BYTE byStatusCode;
  71. }MTRACE_RESPONSE_BLOCK, *PMTRACE_RESPONSE_BLOCK;
  72. #include <poppack.h>
  73. //
  74. // igmp type field
  75. //
  76. #define IGMP_DVMRP 0x13
  77. #define IGMP_MTRACE_RESPONSE 0x1e
  78. #define IGMP_MTRACE_REQUEST 0x1f
  79. //
  80. // dvmrp code field
  81. //
  82. #define DVMRP_ASK_NEIGHBORS2 0x05
  83. #define DVMRP_NEIGHBORS2 0x06
  84. //
  85. // mrinfo flags field
  86. //
  87. #define MRINFO_TUNNEL_FLAG 0x01
  88. #define MRINFO_DOWN_FLAG 0x10
  89. #define MRINFO_DISABLED_FLAG 0x20
  90. #define MRINFO_QUERIER_FLAG 0x40
  91. #define MRINFO_LEAF_FLAG 0x80
  92. //
  93. // mrinfo capabilities field
  94. //
  95. #define MRINFO_CAP_LEAF 0x01
  96. #define MRINFO_CAP_PRUNE 0x02
  97. #define MRINFO_CAP_GENID 0x04
  98. #define MRINFO_CAP_MTRACE 0x08
  99. #define MRINFO_CAP_SNMP 0x10
  100. //
  101. // Function prototypes
  102. //
  103. DWORD
  104. McSetMulticastTtl(
  105. SOCKET s,
  106. DWORD dwTtl
  107. );
  108. DWORD
  109. McSetMulticastIfByIndex(
  110. SOCKET s,
  111. DWORD dwSockType,
  112. DWORD dwIfIndex
  113. );
  114. DWORD
  115. McSetMulticastIf(
  116. SOCKET s,
  117. IPV4_ADDRESS ipAddr
  118. );
  119. DWORD
  120. McJoinGroupByIndex(
  121. SOCKET s,
  122. DWORD dwSockType,
  123. IPV4_ADDRESS ipGroup,
  124. DWORD dwIfIndex
  125. );
  126. DWORD
  127. McJoinGroup(
  128. SOCKET s,
  129. IPV4_ADDRESS ipGroup,
  130. IPV4_ADDRESS ipInterface
  131. );
  132. DWORD
  133. StartMcMisc(
  134. VOID
  135. );
  136. VOID
  137. StopMcMisc(
  138. VOID
  139. );
  140. VOID
  141. HandleMrinfoRequest(
  142. IPV4_ADDRESS dwLocalAddr,
  143. SOCKADDR_IN *sinDestAddr
  144. );
  145. VOID
  146. HandleMtraceRequest(
  147. WSABUF *pWsabuf
  148. );
  149. VOID
  150. HandleMcMiscMessages(
  151. VOID
  152. );
  153. DWORD
  154. MulticastOwner(
  155. PICB picb, // IN: interface config block
  156. PPROTO_CB *pcbOwner, // OUT: owner
  157. PPROTO_CB *pcbQuerier // OUT: IGMP
  158. );
  159. BYTE
  160. MaskToMaskLen(
  161. IPV4_ADDRESS dwMask
  162. );
  163. IPV4_ADDRESS
  164. defaultSourceAddress(
  165. PICB picb
  166. );
  167. //
  168. // RAS Server Advertisement constants
  169. //
  170. #define RASADV_GROUP "239.255.2.2"
  171. #define RASADV_PORT 9753
  172. #define RASADV_PERIOD 3600000 // 1 hour (in milliseconds)
  173. #define RASADV_STARTUP_DELAY 0 // immediately
  174. #define RASADV_TTL 15
  175. DWORD
  176. SetRasAdvEnable(
  177. BOOL bEnabled
  178. );
  179. VOID
  180. HandleRasAdvTimer(
  181. VOID
  182. );
  183. #endif