CDInterface.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "ResDataObject.h"
  2. #include <dlfcn.h>
  3. class CDInterface;
  4. static CDInterface* g_CDInterface = NULL;
  5. typedef CDInterface* (*GetCDInterface)();
  6. class CDInterface {
  7. public :
  8. CDInterface() {};
  9. virtual ~CDInterface() {};
  10. static CDInterface* GetCDI(const char* szModuleName = "CDIX64.so") {
  11. if (!g_CDInterface) {
  12. void* hCDI = dlopen(szModuleName, RTLD_LAZY);
  13. if (!hCDI)
  14. return nullptr;
  15. GetCDInterface func = reinterpret_cast<GetCDInterface>(dlsym(hCDI, "GetCDI"));
  16. if (!func) {
  17. dlclose(hCDI);
  18. return nullptr;
  19. }
  20. g_CDInterface = func();
  21. }
  22. return g_CDInterface;
  23. }
  24. //virtual bool RegistClient(UINT64 Address) = 0;
  25. //virtual bool UnRegistClient(UINT64 Address) = 0;
  26. //virtual bool ReceivedFromLocalBus(ResDataObject &packet) = 0;
  27. //virtual bool ReceivedFromEthBus(ResDataObject &packet) = 0;
  28. //virtual bool ReceivedFromClient(ResDataObject &packet) = 0;
  29. virtual bool ReceivedFromDevice(ResDataObject &packet) = 0;
  30. //virtual bool ReceivedDeviceNotify(ResDataObject &packet) = 0;
  31. virtual bool Registhandle(void * Handle) = 0;
  32. virtual bool UnRegistHandle(UINT64 CrcCode) = 0;
  33. //virtual bool RegistThread(PVOID pDiosThread) = 0;
  34. //virtual void UnRegistThread(DWORD Tid) = 0;
  35. //virtual bool GetThreadsLogger(DWORD Tid, PVOID& pLogger) = 0;
  36. };