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.

167 lines
3.0 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1996
  6. //
  7. // File: bndcache.h
  8. //
  9. // Contents: Prototypes and types for binding handle cache
  10. //
  11. //
  12. // History: 13-August-1996 Created MikeSw
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __BNDCACHE_H__
  16. #define __BNDCACHE_H__
  17. //
  18. // All global variables declared as EXTERN will be allocated in the file
  19. // that defines TKTCACHE_ALLOCATE
  20. //
  21. #ifdef EXTERN
  22. #undef EXTERN
  23. #endif
  24. #ifdef BNDCACHE_ALLOCATE
  25. #define EXTERN
  26. #else
  27. #define EXTERN extern
  28. #endif
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif // __cplusplus
  33. typedef struct _LSAP_LIST {
  34. LIST_ENTRY List;
  35. RTL_CRITICAL_SECTION Lock;
  36. } LSAP_LIST, *PLSAP_LIST;
  37. EXTERN BOOLEAN LsapBindingCacheInitialized;
  38. EXTERN LSAP_LIST LsapBindingCache;
  39. #define LsapLockList(_List_) RtlEnterCriticalSection(&(_List_)->Lock)
  40. #define LsapUnlockList(_List_) RtlLeaveCriticalSection(&(_List_)->Lock)
  41. typedef struct _LSAP_LIST_ENTRY {
  42. LIST_ENTRY Next;
  43. ULONG ReferenceCount;
  44. } LSAP_LIST_ENTRY, *PLSAP_LIST_ENTRY;
  45. typedef struct _LSAP_BINDING_CACHE_ENTRY {
  46. LSAP_LIST_ENTRY ListEntry;
  47. TimeStamp LastUsed;
  48. UNICODE_STRING RealmName;
  49. LPWSTR ServerName;
  50. LPWSTR ServerPrincipalName;
  51. PVOID ClientContext;
  52. LSA_HANDLE PolicyHandle;
  53. } LSAP_BINDING_CACHE_ENTRY, *PLSAP_BINDING_CACHE_ENTRY;
  54. VOID
  55. LsapDereferenceBindingCacheEntry(
  56. IN PLSAP_BINDING_CACHE_ENTRY BindingCacheEntry
  57. );
  58. VOID
  59. LsapReferenceBindingCacheEntry(
  60. IN PLSAP_BINDING_CACHE_ENTRY BindingCacheEntry,
  61. IN BOOLEAN RemoveFromList
  62. );
  63. NTSTATUS
  64. LsapInitBindingCache(
  65. VOID
  66. );
  67. VOID
  68. LsapCleanupBindingCache(
  69. VOID
  70. );
  71. PLSAP_BINDING_CACHE_ENTRY
  72. LsapLocateBindingCacheEntry(
  73. IN PUNICODE_STRING RealmName,
  74. IN BOOLEAN RemoveFromCache
  75. );
  76. VOID
  77. LsapFreeBindingCacheEntry(
  78. IN PLSAP_BINDING_CACHE_ENTRY BindingCacheEntry
  79. );
  80. VOID
  81. LsapRemoveBindingCacheEntry(
  82. IN PLSAP_BINDING_CACHE_ENTRY CacheEntry
  83. );
  84. NTSTATUS
  85. LsapCacheBinding(
  86. IN PUNICODE_STRING RealmName,
  87. IN PLSA_HANDLE Handle,
  88. IN OUT LPWSTR * ServerName,
  89. IN OUT LPWSTR * ServerPrincipalName,
  90. IN OUT PVOID * ClientContext,
  91. OUT PLSAP_BINDING_CACHE_ENTRY * NewCacheEntry
  92. );
  93. NTSTATUS
  94. LsapRefreshBindingCacheEntry(
  95. IN PLSAP_BINDING_CACHE_ENTRY CacheEntry
  96. );
  97. //
  98. // Functions for manipulating lsap lists
  99. //
  100. NTSTATUS
  101. LsapInitializeList(
  102. IN PLSAP_LIST List
  103. );
  104. VOID
  105. LsapFreeList(
  106. IN PLSAP_LIST List
  107. );
  108. VOID
  109. LsapInsertListEntry(
  110. IN PLSAP_LIST_ENTRY ListEntry,
  111. IN PLSAP_LIST List
  112. );
  113. VOID
  114. LsapReferenceListEntry(
  115. IN PLSAP_LIST List,
  116. IN PLSAP_LIST_ENTRY ListEntry,
  117. IN BOOLEAN RemoveFromList
  118. );
  119. BOOLEAN
  120. LsapDereferenceListEntry(
  121. IN PLSAP_LIST_ENTRY ListEntry,
  122. IN PLSAP_LIST List
  123. );
  124. VOID
  125. LsapInitializeListEntry(
  126. IN OUT PLSAP_LIST_ENTRY ListEntry
  127. );
  128. #ifdef __cplusplus
  129. }
  130. #endif // __cplusplus
  131. #endif // __TKTCACHE_H__