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.

265 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. rtmp.h
  5. Abstract:
  6. This module contains information for the Routing Table Maintainance Protocol.
  7. Author:
  8. Jameel Hyder (jameelh@microsoft.com)
  9. Nikhil Kamkolkar (nikhilk@microsoft.com)
  10. Revision History:
  11. 19 Jun 1992 Initial Version
  12. Notes: Tab stop: 4
  13. --*/
  14. #ifndef _RTMP_
  15. #define _RTMP_
  16. // RTMP specific data.
  17. #define RTMP_REQUEST 1
  18. #define RTMP_DATA_REQUEST 2
  19. #define RTMP_ENTIRE_DATA_REQUEST 3
  20. #define RTMP_REQ_DATAGRAM_SIZE 1
  21. #define RTMP_DATA_MIN_SIZE_EXT 10
  22. #define RTMP_DATA_MIN_SIZE_NON_EXT 7
  23. #define RTMP_RESPONSE_MAX_SIZE 10
  24. #define RTMP_VERSION (BYTE)0x82
  25. #define RTMP_TUPLE_WITHRANGE (BYTE)0x80
  26. #define RTMP_TUPLE_WITHOUTRANGE (BYTE)0x00
  27. #define RTMP_EXT_TUPLE_MASK 0x80
  28. #define RTMP_MAX_HOPS 0x0F
  29. #define RTMP_NUM_HOPS_MASK 0x1F
  30. #define RTMP_EXT_TUPLE_SIZE 6
  31. // When trying to find our network number on a non-extended port.
  32. #define RTMP_REQUEST_WAIT 100 // MilliSeconds
  33. #define RTMP_NUM_REQUESTS 30
  34. // The actual RTMP routing table. Entries are hashed by target network number
  35. // and contain the port number used to get to the target network, next bridge
  36. // used to get to the target network, the number of hops to that network,
  37. // and entry state (Good, Suspect, or Bad). Note that with AppleTalk phase II,
  38. // it takes two Validity timers to get from Suspect to Bad, so we let an entry
  39. // go through a PrettyBad state (we won't send these guys when the Send timer goes off).
  40. #define GOOD 1
  41. #define SUSPECT 2
  42. #define BAD 3
  43. #define UGLY 4
  44. extern ATALK_SPIN_LOCK AtalkRteLock;
  45. #define RTE_ZONELIST_VALID 0x01
  46. #define RTE_DELETE 0x80
  47. #define RTE_SIGNATURE *(PULONG)"RTMP"
  48. #if DBG
  49. #define VALID_RTE(pRte) ((pRte != NULL) && (pRte->rte_Signature == RTE_SIGNATURE))
  50. #else
  51. #define VALID_RTE(pRte) (pRte != NULL)
  52. #endif
  53. typedef struct _RoutingTableEntry
  54. {
  55. #if DBG
  56. ULONG rte_Signature;
  57. #endif
  58. struct _RoutingTableEntry * rte_Next;
  59. // Hashed by first network number,
  60. // overflow buckets.
  61. PPORT_DESCRIPTOR rte_PortDesc; // Port used to access this network range
  62. LONG rte_RefCount; // Reference count
  63. BYTE rte_Flags;
  64. BYTE rte_State; // State of the rtmp entry
  65. BYTE rte_NumHops; // Hops to get to net
  66. ATALK_NETWORKRANGE rte_NwRange; // The network range that we represent
  67. ATALK_NODEADDR rte_NextRouter; // Node number of next router on
  68. // the way to this net range
  69. struct _ZONE_LIST * rte_ZoneList; // Valid zones for this net
  70. ATALK_SPIN_LOCK rte_Lock;
  71. } RTE, *PRTE;
  72. #define NUM_RTMP_HASH_BUCKETS 15
  73. extern PRTE * AtalkRoutingTable;
  74. // To decrease the odds of having to do a scan of the routing tables to
  75. // find where to route a packet, we keep a cache of "recently used routes".
  76. // This cache is checked before we use the "first network number" hash and
  77. // before we resort of a full scan of the routing tables. The size of this
  78. // cache may want to be increased to get a proportional increase in
  79. // "hit rate".
  80. #define NUM_RECENT_ROUTES 63
  81. extern PRTE * AtalkRecentRoutes;
  82. // RTMP timer values:
  83. #define RTMP_SEND_TIMER 100 // In 100ms units
  84. #define RTMP_VALIDITY_TIMER 200 // In 100ms units
  85. #define RTMP_AGING_TIMER 500 // In 100ms units
  86. // RTMP Offsets into the Datagram
  87. #define RTMP_REQ_CMD_OFF 0
  88. #define RTMP_SENDER_NW_OFF 0
  89. #define RTMP_SENDER_IDLEN_OFF 2
  90. #define RTMP_SENDER_ID_OFF 3
  91. #define RTMP_VERSION_OFF_NE 6
  92. #define RTMP_RANGE_START_OFF 4
  93. #define RTMP_TUPLE_TYPE_OFF 6
  94. #define RTMP_RANGE_END_OFF 7
  95. #define RTMP_VERSION_OFF_EXT 9
  96. ATALK_ERROR
  97. AtalkRtmpInit(
  98. IN BOOLEAN Init
  99. );
  100. BOOLEAN
  101. AtalkInitRtmpStartProcessingOnPort(
  102. IN PPORT_DESCRIPTOR pPortDesc,
  103. IN PATALK_NODEADDR RouterNode
  104. );
  105. extern
  106. VOID
  107. AtalkRtmpPacketIn(
  108. IN PPORT_DESCRIPTOR pPortDesc,
  109. IN PDDP_ADDROBJ pDdpAddr,
  110. IN PBYTE pPkt,
  111. IN USHORT PktLen,
  112. IN PATALK_ADDR pSrcAddr,
  113. IN PATALK_ADDR pDstAddr,
  114. IN ATALK_ERROR ErrorCode,
  115. IN BYTE DdpType,
  116. IN PVOID pHandlerCtx,
  117. IN BOOLEAN OptimizePath,
  118. IN PVOID OptimizeCtx
  119. );
  120. extern
  121. VOID
  122. AtalkRtmpPacketInRouter(
  123. IN PPORT_DESCRIPTOR pPortDesc,
  124. IN PDDP_ADDROBJ pDdpAddr,
  125. IN PBYTE pPkt,
  126. IN USHORT PktLen,
  127. IN PATALK_ADDR pSrcAddr,
  128. IN PATALK_ADDR pDstAddr,
  129. IN ATALK_ERROR ErrorCode,
  130. IN BYTE DdpType,
  131. IN PVOID pHandlerCtx,
  132. IN BOOLEAN OptimizePath,
  133. IN PVOID OptimizeCtx
  134. );
  135. extern
  136. PRTE
  137. AtalkRtmpReferenceRte(
  138. IN USHORT Network
  139. );
  140. extern
  141. BOOLEAN
  142. atalkRtmpRemoveRte(
  143. IN USHORT Network
  144. );
  145. extern
  146. VOID
  147. AtalkRtmpDereferenceRte(
  148. IN PRTE pRte,
  149. IN BOOLEAN LockHeld
  150. );
  151. extern
  152. BOOLEAN
  153. atalkRtmpCreateRte(
  154. IN ATALK_NETWORKRANGE NwRange,
  155. IN PPORT_DESCRIPTOR pPortDesc,
  156. IN PATALK_NODEADDR pNextRouter,
  157. IN int NumHops
  158. );
  159. LONG FASTCALL
  160. AtalkRtmpAgingTimer(
  161. IN PTIMERLIST pContext,
  162. IN BOOLEAN TimerShuttingDown
  163. );
  164. VOID FASTCALL
  165. AtalkRtmpKillPortRtes(
  166. IN PPORT_DESCRIPTOR pPortDesc
  167. );
  168. typedef struct _RtmpSendDataHdr
  169. {
  170. BYTE rsd_RouterNetwork[2];
  171. BYTE rsd_IdLength;
  172. } *PRTMPSENDDATAHDR;
  173. typedef struct _RtmpTupleNonExt
  174. {
  175. BYTE rtne_Network[2];
  176. BYTE rtne_RangenDist;
  177. } *PRTMPTUPLE;
  178. typedef struct _RtmpTupleExt
  179. {
  180. BYTE rtne_NetworkStart[2];
  181. BYTE rtne_RangenDist;
  182. BYTE rtne_NetworkEnd[2];
  183. BYTE rtne_Version;
  184. } *PRTMPTUPLEEXT;
  185. extern TIMERLIST atalkRtmpVTimer;
  186. extern BOOLEAN atalkRtmpVdtTmrRunning;
  187. LOCAL VOID
  188. atalkRtmpSendRoutingData(
  189. IN PPORT_DESCRIPTOR pPortDesc,
  190. IN PATALK_ADDR pDstAddr,
  191. IN BOOLEAN fSplitHorizon
  192. );
  193. LOCAL BOOLEAN
  194. atalkRtmpGetOrSetNetworkNumber(
  195. IN PPORT_DESCRIPTOR pPortDesc,
  196. IN USHORT SuggestedNetwork
  197. );
  198. LOCAL LONG FASTCALL
  199. atalkRtmpSendTimer(
  200. IN PTIMERLIST pContext,
  201. IN BOOLEAN TimerShuttingDown
  202. );
  203. LOCAL LONG FASTCALL
  204. atalkRtmpValidityTimer(
  205. IN PTIMERLIST pContext,
  206. IN BOOLEAN TimerShuttingDown
  207. );
  208. LOCAL VOID FASTCALL
  209. atalkRtmpSendComplete(
  210. IN NDIS_STATUS Status,
  211. IN PSEND_COMPL_INFO pSendInfo
  212. );
  213. #endif // _RTMP_
  214.