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.

120 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. srvenum.h
  5. Abstract:
  6. Private header file to be included by Browser service modules that need
  7. to know about server enumeration routines (including the browse cache
  8. modules).
  9. Author:
  10. Larry Osterman (larryo) 23-Jun-1993
  11. Revision History:
  12. --*/
  13. #ifndef _SRVENUM_INCLUDED_
  14. #define _SRVENUM_INCLUDED_
  15. //
  16. // Cached browse response.
  17. //
  18. // The cached browse request structure is used to hold the response to
  19. // a NetServerEnum request.
  20. //
  21. // If a NetServerEnum request comes in through Xactsrv, the browser will
  22. // look up to see if there is a cached browse that matches this request,
  23. // and if there is, it will simply return that request to the caller.
  24. //
  25. //
  26. // In a nutshell, this is how the response cache works:
  27. //
  28. // The browser keeps a list of all of the browse requests that come into the
  29. // browser. This list is keyed by Level, ServerType, and buffer size. The
  30. // actual chain is protected by a CriticalSection called the
  31. // ResponseCacheLock. Entries in the list are protected by the global
  32. // network lock.
  33. //
  34. // When a browse request is received from Xactsrv, the browser looks up
  35. // the request in the response cache, and if it finds a matching response,
  36. // it increments 2 hit counters. The first hit counter indicates he number
  37. // of hits the request has seen since the last time the cache was aged.
  38. // The second indicates the total number of hits over the lifetime of the
  39. // browser for this response.
  40. //
  41. // If the lifetime hit count is over the configurable hit limit, the
  42. // browser will save a copy of the response buffer associated with the
  43. // request. Any and all subsequent browse requests will use this buffer
  44. // for their response instead of converting the response.
  45. //
  46. // When a call is made to BrAgeResponseCache, the browser will scan the
  47. // cache and free up all of the cached responses. It will also delete
  48. // any responses that have a hit count less than the hit limit.
  49. //
  50. typedef struct _CACHED_BROWSE_RESPONSE {
  51. LIST_ENTRY Next; // Pointer to next request.
  52. DWORD HitCount; // Hitcount for this cached request.
  53. DWORD TotalHitCount; // Total hit count for this request.
  54. DWORD LowHitCount; // Number of passes with a low hit count.
  55. DWORD ServerType; // Server type.
  56. DWORD Level; // Level of request
  57. WORD Size; // Request size
  58. WORD Converter; // Converter (used by client to get strings right).
  59. PVOID Buffer; // Response buffer.
  60. DWORD EntriesRead; // Number of entries in cached list
  61. DWORD TotalEntries; // Total # of entries available.
  62. WORD Status; // Status of request.
  63. WCHAR FirstNameToReturn[CNLEN+1]; // Name of first entry in buffer
  64. } CACHED_BROWSE_RESPONSE, *PCACHED_BROWSE_RESPONSE;
  65. PCACHED_BROWSE_RESPONSE
  66. BrLookupAndAllocateCachedEntry(
  67. IN PNETWORK Network,
  68. IN DWORD ServerType,
  69. IN WORD Size,
  70. IN ULONG Level,
  71. IN LPCWSTR FirstNameToReturn
  72. );
  73. NET_API_STATUS
  74. BrDestroyResponseCache(
  75. IN PNETWORK Network
  76. );
  77. NET_API_STATUS
  78. BrDestroyCacheEntry(
  79. IN PCACHED_BROWSE_RESPONSE CacheEntry
  80. );
  81. VOID
  82. BrAgeResponseCache(
  83. IN PNETWORK Network
  84. );
  85. PCACHED_BROWSE_RESPONSE
  86. BrAllocateResponseCacheEntry(
  87. IN PNETWORK Network,
  88. IN DWORD ServerType,
  89. IN WORD Size,
  90. IN ULONG Level,
  91. IN LPCWSTR FirstNameToReturn
  92. );
  93. extern LIST_ENTRY
  94. ServicedNetworks;
  95. #endif // _SRVENUM_INCLUDED_