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.

220 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ntos\tdi\isn\fwd\send.c
  5. Abstract:
  6. Send routines
  7. Author:
  8. Vadim Eydelman
  9. Revision History:
  10. --*/
  11. #ifndef IPXFWD_SEND
  12. #define IPXFWD_SEND
  13. typedef struct _INTERNAL_PACKET_TAG {
  14. LIST_ENTRY IPT_QueueLink;
  15. PNDIS_PACKET IPT_Packet;
  16. PUCHAR IPT_DataPtr;
  17. ULONG IPT_Length;
  18. PINTERFACE_CB IPT_InterfaceReference;
  19. IPX_LOCAL_TARGET IPT_Target;
  20. } INTERNAL_PACKET_TAG, *PINTERNAL_PACKET_TAG;
  21. #define DEF_SPOOFING_TIMEOUT (120*60) // Seconds
  22. extern ULONG SpoofingTimeout;
  23. extern LIST_ENTRY SpoofingQueue;
  24. extern KSPIN_LOCK SpoofingQueueLock;
  25. extern WORK_QUEUE_ITEM SpoofingWorker;
  26. extern BOOLEAN SpoofingWorkerActive;
  27. extern ULONG DontSuppressNonAgentSapAdvertisements;
  28. VOID
  29. Spoofer (
  30. PVOID Context
  31. );
  32. #define InitializeSendQueue() { \
  33. InitializeListHead (&SpoofingQueue); \
  34. KeInitializeSpinLock (&SpoofingQueueLock); \
  35. ExInitializeWorkItem (&SpoofingWorker, Spoofer, NULL); \
  36. SpoofingWorkerActive = FALSE; \
  37. }
  38. #define DeleteSendQueue() { \
  39. while (!IsListEmpty (&SpoofingQueue)) { \
  40. PPACKET_TAG pktTag = CONTAINING_RECORD (SpoofingQueue.Flink, \
  41. PACKET_TAG, \
  42. PT_QueueLink); \
  43. RemoveEntryList (&pktTag->PT_QueueLink); \
  44. if (pktTag->PT_InterfaceReference!=NULL) \
  45. ReleaseInterfaceReference (pktTag->PT_InterfaceReference); \
  46. FreePacket (pktTag); \
  47. } \
  48. }
  49. /*++
  50. *******************************************************************
  51. S e n d P a c k e t
  52. Routine Description:
  53. Enqueues packets to be sent by IPX stack
  54. Arguments:
  55. dstIf - over which interface to send
  56. pktTag - packet to send
  57. Return Value:
  58. None
  59. *******************************************************************
  60. --*/
  61. VOID
  62. SendPacket (
  63. PINTERFACE_CB dstIf,
  64. PPACKET_TAG pktTag
  65. );
  66. /*++
  67. *******************************************************************
  68. F w S e n d C o m p l e t e
  69. Routine Description:
  70. Called by IPX stack when send completes asynchronously
  71. Arguments:
  72. pktDscr - descriptor of the completed packet
  73. status - result of send operation
  74. Return Value:
  75. None
  76. *******************************************************************
  77. --*/
  78. VOID
  79. IpxFwdSendComplete (
  80. PNDIS_PACKET pktDscr,
  81. NDIS_STATUS NdisStatus
  82. );
  83. /*++
  84. *******************************************************************
  85. F w I n t e r n a l S e n d
  86. Routine Description:
  87. Filter and routes packets sent by IPX stack
  88. Arguments:
  89. LocalTarget - the NicId and next hop router MAC address
  90. Context - preferred interface on which to send
  91. Packet - packet to be sent
  92. ipxHdr - pointer to ipx header inside the packet
  93. PacketLength - length of the packet
  94. fIterate - a flag to indicate if this is a packet for the
  95. iteration of which the Fwd takes responsibility
  96. - typically type 20 NetBIOS frames
  97. Return Value:
  98. STATUS_SUCCESS - if the preferred NIC was OK and packet passed filtering
  99. STATUS_NETWORK_UNREACHABLE - if the preferred was not OK or packet failed filtering
  100. STATUS_PENDING - packet was queued until connection is established
  101. *******************************************************************
  102. --*/
  103. NTSTATUS
  104. IpxFwdInternalSend (
  105. IN OUT PIPX_LOCAL_TARGET LocalTarget,
  106. IN ULONG_PTR Context,
  107. IN PNDIS_PACKET pktDscr,
  108. IN PUCHAR ipxHdr,
  109. IN PUCHAR data,
  110. IN ULONG PacketLength,
  111. IN BOOLEAN fIterate
  112. );
  113. /*++
  114. *******************************************************************
  115. P r o c e s s I n t e r n a l Q u e u e
  116. Routine Description:
  117. Processes packets in the interface internal queue.
  118. Called when connection request completes
  119. Arguments:
  120. dstIf - interface to process
  121. Return Value:
  122. None
  123. *******************************************************************
  124. --*/
  125. VOID
  126. ProcessInternalQueue (
  127. PINTERFACE_CB dstIf
  128. );
  129. /*++
  130. *******************************************************************
  131. P r o c e s s E x t e r n a l Q u e u e
  132. Routine Description:
  133. Processes packets in the interface external queue.
  134. Called when connection request completes
  135. Arguments:
  136. dstIf - interface to process
  137. Return Value:
  138. None
  139. *******************************************************************
  140. --*/
  141. VOID
  142. ProcessExternalQueue (
  143. PINTERFACE_CB dstIf
  144. );
  145. /*++
  146. *******************************************************************
  147. D o S e n d
  148. Routine Description:
  149. Prepares and sends packet. Interface lock must be help while
  150. callin this routine
  151. Arguments:
  152. dstIf - over which interface to send
  153. pktTag - packet to send
  154. Return Value:
  155. result returned by IPX
  156. *******************************************************************
  157. --*/
  158. NDIS_STATUS
  159. DoSend (
  160. PINTERFACE_CB dstIf,
  161. PPACKET_TAG pktTag,
  162. KIRQL oldIRQL
  163. );
  164. /*++
  165. *******************************************************************
  166. P r o c e s s S e n t P a c k e t
  167. Routine Description:
  168. Process completed sent packets
  169. Arguments:
  170. dstIf - interface over which packet was sent
  171. pktTag - completed packet
  172. status - result of send operation
  173. Return Value:
  174. None
  175. *******************************************************************
  176. --*/
  177. VOID
  178. ProcessSentPacket (
  179. PINTERFACE_CB dstIf,
  180. PPACKET_TAG pktTag,
  181. NDIS_STATUS status
  182. );
  183. #endif