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.

98 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name: group.hxx
  4. Abstract:
  5. Manages cache group.
  6. Author:
  7. Danpo Zhang (DanpoZ) 02-08-98
  8. --*/
  9. #ifndef _GROUP_
  10. #define _GROUP_
  11. #define GROUP_INFO_TO_ENTRY 1
  12. #define GROUP_ENTRY_TO_INFO 2
  13. class GroupMgr
  14. {
  15. public:
  16. GroupMgr();
  17. ~GroupMgr();
  18. BOOL Init(URL_CONTAINER* pContainer);
  19. DWORD CreateGroup(DWORD, GROUPID*);
  20. DWORD CreateDefaultGroups();
  21. DWORD DeleteGroup(GROUPID, DWORD);
  22. DWORD GetNextGroup(DWORD*, GROUPID*);
  23. DWORD GetGroup(GROUPID, DWORD, INTERNET_CACHE_GROUP_INFOA*, DWORD*);
  24. DWORD SetGroup(GROUPID, DWORD, INTERNET_CACHE_GROUP_INFOA*);
  25. protected:
  26. URL_CONTAINER* _pContainer;
  27. private:
  28. GROUPID ObtainNewGID();
  29. DWORD CreateNewPage(DWORD* dwOffset, BOOL fIsFirstPage);
  30. DWORD FindRootEntry(GROUP_ENTRY** ppEntryOut, BOOL fCreate);
  31. DWORD FindEntry(GROUPID gid, GROUP_ENTRY** ppEntryOut, BOOL fCreate);
  32. BOOL IsIndexToNewPage(GROUP_ENTRY* pG)
  33. {
  34. return (pG->gid == GID_INDEX_TO_NEXT_PAGE) ? TRUE : FALSE;
  35. }
  36. BOOL Translate(DWORD, INTERNET_CACHE_GROUP_INFOA*, GROUP_ENTRY*,
  37. DWORD, DWORD*);
  38. BOOL GetHeaderData(DWORD nIdx, LPDWORD pdwData)
  39. {
  40. return _pContainer->_UrlObjStorage->GetHeaderData(
  41. nIdx, pdwData);
  42. }
  43. BOOL SetHeaderData(DWORD nIdx, DWORD dwData)
  44. {
  45. return _pContainer->_UrlObjStorage->SetHeaderData(
  46. nIdx, dwData);
  47. }
  48. DWORD FindDataEntry(LPGROUP_ENTRY, GROUP_DATA_ENTRY**, BOOL);
  49. VOID FreeDataEntry(GROUP_DATA_ENTRY*);
  50. LPGROUP_DATA_ENTRY GetHeadDataEntry(BOOL);
  51. BOOL IsLastPage(GROUP_ENTRY*);
  52. BOOL IsPageEmpty(GROUP_ENTRY*);
  53. BOOL FreeEmptyPages(DWORD);
  54. DWORD CreateNewGroupList(DWORD*);
  55. DWORD GetOffsetFromList(DWORD, GROUPID, DWORD*);
  56. DWORD AddToGroupList(DWORD, DWORD);
  57. DWORD RemoveFromGroupList(DWORD, DWORD, DWORD*);
  58. void AdjustUsageOnList(DWORD dwHeadOffset, LONGLONG llDelta);
  59. DWORD FindEmptySlotInListPage(DWORD* pdwOffset);
  60. DWORD CreateNewListPage(DWORD* pdwOffset, BOOL fIsFirstPage);
  61. BOOL IsIndexToNewListPage(LIST_GROUP_ENTRY* p)
  62. {
  63. return
  64. (p->dwGroupOffset == OFFSET_TO_NEXT_PAGE) ? TRUE : FALSE;
  65. }
  66. BOOL IsGroupOnList(DWORD dwHeadOffset, DWORD dwGroupOffset);
  67. BOOL NoMoreStickyEntryOnList(DWORD dwHeadOffset);
  68. void AddToFreeList(LIST_GROUP_ENTRY* pFreeListGroup);
  69. friend class URL_CONTAINER;
  70. };
  71. #endif