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.

81 lines
3.1 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. // Definitions for TCP Control Block management.
  14. //
  15. #define MAX_REXMIT_CNT 5
  16. #define MAX_CONNECT_REXMIT_CNT 2 // Dropped from 3 to 2 to match IPv4.
  17. extern uint TCPTime;
  18. extern SeqNum ISNMonotonicPortion;
  19. // Maximum Increment of 32K per connection.
  20. #define MAX_ISN_INCREMENT_PER_CONNECTION 0x7FFF
  21. // Number of connections that can increment the ISN per 100ms without
  22. // the problem of old duplicates being a threat. Note that, this still does
  23. // not guarantee that "wrap-around of sequence number space does not
  24. // happen within 2MSL", which could lead to failures in reuse of Time-wait
  25. // TCBs etc.
  26. #define MAX_ISN_INCREMENTABLE_CONNECTIONS_PER_100MS ((0xFFFFFFFF) / \
  27. (MAX_REXMIT_TO * MAX_ISN_INCREMENT_PER_CONNECTION ))
  28. // Converts a quantity represented in 100 ns units to ms.
  29. #define X100NSTOMS(x) ((x)/10000)
  30. //
  31. // REVIEW: better hash function for IPv6 addresses?
  32. //
  33. #ifdef OLDHASH1
  34. #define TCB_HASH(DA,SA,DP,SP) ((uint)(*(uchar *)&(DA) + *((uchar *)&(DA) + 1) \
  35. + *((uchar *)&(DA) + 2) + *((uchar *)&(DA) + 3)) % TcbTableSize)
  36. #endif
  37. #ifdef OLDHASH
  38. #define TCB_HASH(DA,SA,DP,SP) (((DA) + (SA) + (uint)(DP) + (uint)(SP)) % \
  39. TcbTableSize)
  40. #endif
  41. #define ROR8(x) (ushort)(((ushort)(x) >> 1) | (ushort)(((ushort)(x) & 1) << 15))
  42. #define TCB_HASH(DA,SA,DP,SP) \
  43. (uint)(((uint)(ROR8(ROR8(ROR8(*(ushort *)&(DP) + \
  44. *(ushort *)&(SP)) + \
  45. *(ushort *)&(DA)) + \
  46. *((ushort *)&(DA) + 1)))) & \
  47. (TcbTableSize - 1))
  48. extern struct TCB *FindTCB(IPv6Addr *Src, IPv6Addr *Dest,
  49. uint SrcScopeId, uint DestScopeId,
  50. ushort SrcPort, ushort DestPort);
  51. extern uint InsertTCB(struct TCB *NewTCB);
  52. extern struct TCB *AllocTCB(void);
  53. extern void FreeTCB(struct TCB *FreedTCB);
  54. extern uint RemoveTCB(struct TCB *RemovedTCB);
  55. extern uint ValidateTCBContext(void *Context, uint *Valid);
  56. extern uint ReadNextTCB(void *Context, void *OutBuf);
  57. extern int InitTCB(void);
  58. extern void UnloadTCB(void);
  59. extern void CalculateMSSForTCB(struct TCB *);
  60. extern void TCBWalk(uint (*CallRtn)(struct TCB *, void *, void *, void *),
  61. void *Context1, void *Context2, void *Context3);
  62. extern uint DeleteTCBWithSrc(struct TCB *CheckTCB, void *AddrPtr,
  63. void *Unused1, void *Unused2);
  64. extern uint SetTCBMTU(struct TCB *CheckTCB, void *DestPtr, void *SrcPtr,
  65. void *MTUPtr);
  66. extern void ReetSendNext(struct TCB *SeqTCB, SeqNum DropSeq);
  67. extern uint TCBWalkCount;