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.

111 lines
4.4 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990-1993 **/
  4. /********************************************************************/
  5. /* :ts=4 */
  6. //** TCB.H - TCB management definitions.
  7. //
  8. // This file contains the definitons needed for TCB management.
  9. //
  10. extern uint MaxHashTableSize;
  11. #define TCB_TABLE_SIZE MaxHashTableSize
  12. extern uint LogPerPartitionSize;
  13. #define GET_PARTITION(i) (i >> (ulong) LogPerPartitionSize)
  14. #define MAX_REXMIT_CNT 5
  15. #define MAX_CONNECT_REXMIT_CNT 2 //dropped from 3 to 2
  16. #define MAX_CONNECT_RESPONSE_REXMIT_CNT 2
  17. #define ADAPTED_MAX_CONNECT_RESPONSE_REXMIT_CNT 1
  18. extern uint TCPTime;
  19. #define ROR8(x) (ushort)( ( (ushort)(x) >> 1) | (ushort) ( ( (ushort)(x) & 1) << 15) )
  20. #define TCB_HASH(DA,SA,DP,SP) (uint)( ((uint)(ROR8( ROR8 (ROR8( *(ushort*)&(DP)+ \
  21. *(ushort *)&(SP) ) + *(ushort *)&(DA) )+ \
  22. *((ushort *)&(DA)+1) ) ) ) & (TCB_TABLE_SIZE-1))
  23. // These values indicate what action should be taken upon return
  24. // of FindSynTCB - sending a reset, restting out own connection or
  25. // just dropping the packet that was received.
  26. #define SYN_PKT_SEND_RST 0x01
  27. #define SYN_PKT_RST_RCVD 0x02
  28. #define SYN_PKT_DROP 0x03
  29. // Maximum Increment of 32K per connection.
  30. #define MAX_ISN_INCREMENT_PER_CONNECTION 0x7FFF
  31. // Number of connections that can increment the ISN per 100ms without
  32. // the problem of old duplicates being a threat. Note that, this still does
  33. // not guarantee that "wrap-around of sequence number space does not
  34. // happen within 2MSL", which could lead to failures in reuse of Time-wait
  35. // TCBs etc.
  36. #define MAX_ISN_INCREMENTABLE_CONNECTIONS_PER_100MS ((0xFFFFFFFF) / \
  37. (MAX_REXMIT_TO * MAX_ISN_INCREMENT_PER_CONNECTION ))
  38. // Converts a quantity represented in 100 ns units to ms.
  39. #define X100NSTOMS(x) ((x)/10000)
  40. extern ULONG GetDeltaTime();
  41. extern struct TCB *FindTCB(IPAddr Src, IPAddr Dest, ushort DestPort,
  42. ushort SrcPort,CTELockHandle *Handle, BOOLEAN Dpc,uint *index);
  43. extern struct TCB * FindSynTCB(IPAddr Src, IPAddr Dest,
  44. ushort DestPort, ushort SrcPort,
  45. TCPRcvInfo RcvInfo, uint Size,
  46. uint index,
  47. PUCHAR Action);
  48. extern uint InsertTCB(struct TCB *NewTCB, BOOLEAN ForceInsert);
  49. extern struct TCB *AllocTCB(void);
  50. extern struct SYNTCB *AllocSynTCB(void);
  51. extern struct TWTCB *AllocTWTCB(uint index);
  52. extern void FreeTCB(struct TCB *FreedTCB);
  53. extern void FreeSynTCB(struct SYNTCB *FreedTCB);
  54. extern void FreeTWTCB(struct TWTCB *FreedTCB);
  55. extern uint RemoveTCB(struct TCB *RemovedTCB, uint PreviousState);
  56. extern void RemoveTWTCB(struct TWTCB *RemovedTCB, uint Partition);
  57. extern struct TWTCB *FindTCBTW(IPAddr Src, IPAddr Dest, ushort DestPort,
  58. ushort SrcPort,uint index);
  59. extern uint RemoveAndInsert(struct TCB *RemovedTCB);
  60. extern uint ValidateTCBContext(void *Context, uint *Valid);
  61. extern uint ReadNextTCB(void *Context, void *OutBuf);
  62. extern int InitTCB(void);
  63. extern void UnInitTCB(void);
  64. extern void TCBWalk(uint (*CallRtn)(struct TCB *, void *, void *,
  65. void *), void *Context1, void *Context2,
  66. void *Context3);
  67. extern uint DeleteTCBWithSrc(struct TCB *CheckTCB, void *AddrPtr,
  68. void *Unused1, void *Unused2);
  69. extern uint SetTCBMTU(struct TCB *CheckTCB, void *DestPtr,
  70. void *SrcPtr, void *MTUPtr);
  71. extern void ReetSendNext(struct TCB *SeqTCB, SeqNum DropSeq);
  72. extern uint InsertSynTCB(SYNTCB * NewTCB,CTELockHandle *Handle);
  73. extern ushort FindMSSAndOptions(TCPHeader UNALIGNED * TCPH,
  74. TCB * SynTCB, BOOLEAN syntcb);
  75. extern void SendSYNOnSynTCB(SYNTCB * SYNTcb,CTELockHandle TCBHandle);
  76. extern void AddHalfOpenTCB(void);
  77. extern void AddHalfOpenRetry(uint RexmitCnt);
  78. extern void DropHalfOpenTCB(uint RexmitCnt);
  79. extern uint TCBWalkCount;
  80. extern uint NumTcbTablePartions;
  81. extern uint PerPartionSize;
  82. extern uint LogPerPartion;