HandleManager.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #include <map>
  3. #include <string>
  4. #include <vector>
  5. #include "CcosLock.h"
  6. #include "CcosFileHandle.h"
  7. using namespace std;
  8. class HandleManager : public CcosLock
  9. {
  10. //[LocalProc - [ LocalADDR - [OwnerMachine - [OwnerBusId - [OwnerProc - [OwnerAddr - FLAGS]]]]]]
  11. //map<UINT64, map<UINT64, map<string, map<string, map<UINT64, map<UINT64, DWORD>>>>>> m_HandleMap;
  12. map<UINT64, CcosDevFileHandle> m_CrcMap;//CRC - FileHandle
  13. bool CheckNotifyPacketAccessValidity(ResDataObject &packet, DWORD Flags);
  14. bool CheckNormalPacketAccessValidity(ResDataObject &packet, DWORD Flags);
  15. public:
  16. HandleManager();
  17. virtual ~HandleManager();
  18. void Clear();
  19. bool Registhandle(CcosDevFileHandle &Handle);
  20. bool UnRegistHandle(UINT64 CrcCode);
  21. void ClearRemoteHandles();
  22. void ClearLocalDrvHandles(vector<UINT64> &ServerSysIFList);
  23. bool GetHandle(UINT64 CrcCode, CcosDevFileHandle& filehandle);
  24. bool GetFileFlag(UINT64 CrcCode, UINT64 DevAddr, DWORD &fileFlag);
  25. void DeviceDetached(UINT64 ProcId, UINT64 Addr);
  26. //bool RegistHandle(UINT64 LocalProc, UINT64 LocalAddr, CcosTargetAddress &OwnerInfo, DWORD FileFlags);
  27. //bool UnRegistHandle(UINT64 LocalProc, UINT64 LocalAddr, CcosTargetAddress &OwnerInfo);
  28. //DWORD GetHandle(UINT64 LocalProc, UINT64 LocalAddr, CcosTargetAddress &OwnerInfo);
  29. //big check
  30. //-1:ignore,0:NoTarget,1:Failed,2:OK
  31. CMD_ECHO CheckReqPacketValidity(ResDataObject &packet, UINT64 &Addr);
  32. //only notify
  33. bool GetNotifyOwners(ResDataObject &packet, vector<CcosDevFileHandle> &OwnerList);
  34. };
  35. extern HandleManager g_HandleManager;