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.

123 lines
3.9 KiB

  1. /*++ BUILD Version: 0009 // Increment this if a change has global effects
  2. Copyright (c) 1987-1993 Microsoft Corporation
  3. Module Name:
  4. midatlas.h
  5. Abstract:
  6. This module defines the data structure used in mapping MIDS to the corresponding requests/
  7. contexts associated with them.
  8. Author:
  9. Balan Sethu Raman (SethuR) 26-Aug-95 Created
  10. Notes:
  11. MID (Multiplex ID) is used at both the server and the client ( redirector ) to distinguish
  12. between the concurrently active requests on any connection. This data structure has been
  13. designed to meet the following criterion.
  14. 1) It should scale well to handle the differing capabilities of a server, e.g., the typical
  15. NT server permits 50 outstanding requests on any connection. The CORE level servers can go as
  16. low as one and on Gateway machines the desired number can be very high ( in the oreder of thousands)
  17. 2) The two primary operations that need to be handled well are
  18. i) mapping a MID to the context associated with it.
  19. -- This routine will be invoked to process every packet received along any connection
  20. at both the server and the client.
  21. ii) generating a new MID for sending requests to the server.
  22. -- This will be used at the client both for max. command enforcement as well as
  23. tagging each concurrent request with a unique id.
  24. The most common case is that of a connection between a NT client and a NT server. All
  25. design decisions have been made in order to ensure that the solutions are optimal
  26. for this case.
  27. The MID data structure must be efficiently able to manage the unique tagging and identification
  28. of a number of mids ( typically 50 ) from a possible combination of 65536 values. In order to
  29. ensure a proper time space tradeoff the lookup is organized as a three level hierarchy.
  30. The 16 bits used to represent a MID are split upinto three bit fields. The length of the
  31. rightmost field ( least signifiant ) is decided by the number of mids that are to be
  32. allocated on creation. The remaining length is split up equally between the next two
  33. fields, e.g., if 50 mids are to be allocated on creation , the length of the first field
  34. is 6 ( 64 ( 2 ** 6 ) is greater than 50 ), 5 and 5.
  35. --*/
  36. #ifndef _MIDATLAX_H_
  37. #define _MIDATLAX_H_
  38. typedef struct _RX_MID_ATLAS {
  39. USHORT MaximumNumberOfMids;
  40. USHORT MidsAllocated;
  41. USHORT NumberOfMidsInUse;
  42. USHORT NumberOfMidsDiscarded;
  43. USHORT MaximumMidFieldWidth;
  44. USHORT Reserved;
  45. USHORT MidQuantum;
  46. UCHAR MidQuantumFieldWidth;
  47. UCHAR NumberOfLevels;
  48. LIST_ENTRY MidMapFreeList;
  49. LIST_ENTRY MidMapExpansionList;
  50. struct _MID_MAP_ *pRootMidMap;
  51. } RX_MID_ATLAS, *PRX_MID_ATLAS;
  52. typedef
  53. VOID (*PCONTEXT_DESTRUCTOR)(
  54. PVOID pContext);
  55. typedef
  56. VOID (*PCONTEXT_ITERATOR)(
  57. PVOID pContext);
  58. #define RxGetMaximumNumberOfMids(pMidAtlas) \
  59. ((pMidAtlas)->MaximumNumberOfMids)
  60. #define RxGetNumberOfMidsInUse(pMidAtlas) \
  61. ((pMidAtlas)->NumberOfMidsInUse)
  62. PRX_MID_ATLAS
  63. RxCreateMidAtlas(
  64. USHORT MaximumNumberOfEntries,
  65. USHORT InitialAllocation);
  66. VOID
  67. RxDestroyMidAtlas(
  68. PRX_MID_ATLAS pMidAtlas,
  69. PCONTEXT_DESTRUCTOR pContextDestructor);
  70. void
  71. RxIterateMidAtlasAndRemove(
  72. PRX_MID_ATLAS pMidAtlas,
  73. PCONTEXT_ITERATOR pContextIterator);
  74. PVOID
  75. RxMapMidToContext(
  76. PRX_MID_ATLAS pMidAtlas,
  77. USHORT Mid);
  78. NTSTATUS
  79. RxAssociateContextWithMid(
  80. PRX_MID_ATLAS pMidAtlas,
  81. PVOID pContext,
  82. PUSHORT pNewMid);
  83. NTSTATUS
  84. RxMapAndDissociateMidFromContext(
  85. PRX_MID_ATLAS pMidAtlas,
  86. USHORT Mid,
  87. PVOID *pContextPointer);
  88. NTSTATUS
  89. RxReassociateMid(
  90. PRX_MID_ATLAS pMidAtlas,
  91. USHORT Mid,
  92. PVOID pNewContext);
  93. #endif
  94.