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.

101 lines
3.6 KiB

  1. // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
  2. //
  3. // Copyright (c) 1985-2000 Microsoft Corporation
  4. //
  5. // This file is part of the Microsoft Research IPv6 Network Protocol Stack.
  6. // You should have received a copy of the Microsoft End-User License Agreement
  7. // for this software along with this release; see the file "license.txt".
  8. // If not, please see http://www.research.microsoft.com/msripv6/license.htm,
  9. // or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
  10. //
  11. // Abstract:
  12. //
  13. // TCP send definitions.
  14. //
  15. #define NUM_TCP_HEADERS 32
  16. #define NUM_TCP_BUFFERS 150
  17. #define TCP_MAX_HDRS 0xffffffff
  18. //#define SEND_DEBUG 1
  19. #ifdef SEND_DEBUG
  20. #define SEND_TICKS 10
  21. extern KSPIN_LOCK SendUseLock;
  22. extern struct TCPSendReq *SendUseList;
  23. #endif
  24. //
  25. // Structure of a TCP send request.
  26. //
  27. #define tsr_signature 0x20525354 // 'TSR '
  28. typedef struct TCPSendReq {
  29. struct TCPReq tsr_req; // General request structure.
  30. #if DBG
  31. ulong tsr_sig;
  32. #endif
  33. uint tsr_size; // Size in bytes of data in send.
  34. long tsr_refcnt; // Reference count for this send.
  35. uchar tsr_flags; // Flags for this send.
  36. uchar tsr_pad[3]; // Pad to dword boundary.
  37. uint tsr_unasize; // Number of bytes unacked.
  38. uint tsr_offset; // Offset into first buffer in chain
  39. // of start of unacked data..
  40. PNDIS_BUFFER tsr_buffer; // Pointer to start of unacked buffer chain.
  41. PNDIS_BUFFER tsr_lastbuf; // Pointer to last buffer in chain.
  42. // Valid iff we've sent directly from the
  43. // buffer chain w/o doing an NdisCopyBuffer.
  44. uint tsr_time; // TCP time this was received.
  45. #ifdef SEND_DEBUG
  46. struct TCPSendReq *tsr_next; // Debug next field.
  47. uint tsr_timer; // Timer field.
  48. uint tsr_cmplt; // Who completed it.
  49. #endif
  50. } TCPSendReq;
  51. #define TSR_FLAG_URG 0x01 // Urgent data.
  52. //
  53. // Structure defining the context received during a send completes.
  54. //
  55. #define scc_signature 0x20434353 // 'SCC '
  56. typedef struct SendCmpltContext {
  57. #if DBG
  58. ulong scc_sig;
  59. #endif
  60. TCPSendReq *scc_firstsend; // First send in this context.
  61. uint scc_count; // Number of sends in count.
  62. ushort scc_ubufcount; // Number of 'user' buffers in send.
  63. ushort scc_tbufcount; // Number of transport buffers in send.
  64. } SendCmpltContext;
  65. extern KSPIN_LOCK TCPSendReqCompleteLock;
  66. extern void InitSendState(struct TCB *NewTCB);
  67. extern void SendSYN(struct TCB *SYNTcb, KIRQL);
  68. extern void SendKA(struct TCB *KATCB, KIRQL Irql);
  69. extern void SendRSTFromHeader(struct TCPHeader UNALIGNED *TCP, uint Length,
  70. IPv6Addr *Dest, uint DestScopeId,
  71. IPv6Addr *Src, uint SrcScopeId);
  72. extern void SendACK(struct TCB *ACKTcb);
  73. extern void SendRSTFromTCB(struct TCB *RSTTcb);
  74. extern void GoToEstab(struct TCB *EstabTCB);
  75. extern void FreeSendReq(TCPSendReq *FreedReq);
  76. extern void FreeTCPHeader(PNDIS_BUFFER FreedBuffer);
  77. extern int InitTCPSend(void);
  78. extern void UnloadTCPSend(void);
  79. extern void TCPSend(struct TCB *SendTCB, KIRQL Irql);
  80. extern TDI_STATUS TdiSend(PTDI_REQUEST Request, ushort Flags, uint SendLength,
  81. PNDIS_BUFFER SendBuffer);
  82. extern uint RcvWin(struct TCB *WinTCB);
  83. extern void ResetAndFastSend(TCB *SeqTCB, SeqNum NewSeq, uint NewCWin);
  84. extern void TCPFastSend(TCB *SendTCB, PNDIS_BUFFER in_SendBuf, uint SendOfs,
  85. TCPSendReq *CurSend, uint SendSize, SeqNum SendNext,
  86. int in_ToBeSent);