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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // snfGBUdbmgr.hpp
  2. // Copyright (C) 2006 - 2020 ARM Research Labs, LLC.
  3. // See www.armresearch.com for the copyright terms.
  4. //
  5. // This module manages the GBUdb(s) that are used in the SNF scanner engine.
  6. // It is responsible for setting parameters, monitoring activity, and handling
  7. // scheduled maintenance tasks.
  8. #pragma once
  9. #ifdef WIN32
  10. // Required because threading.hpp includes windows.h.
  11. #include <winsock2.h>
  12. #endif
  13. #include "../CodeDweller/threading.hpp"
  14. #include "../CodeDweller/timing.hpp"
  15. #include "snfCFGmgr.hpp"
  16. #include "snfLOGmgr.hpp"
  17. #include "GBUdb.hpp"
  18. namespace cd = codedweller;
  19. class snfLOGmgr;
  20. class snfGBUdbmgr : public cd::Thread {
  21. private:
  22. cd::Mutex MyMutex;
  23. GBUdb* MyGBUdb;
  24. snfLOGmgr* MyLOGmgr;
  25. bool Configured;
  26. volatile bool TimeToStop;
  27. // Condensation parts
  28. cd::Timeout CondenseGuardTime;
  29. bool TimeTriggerOnOff;
  30. cd::Timeout TimeTrigger;
  31. bool PostsTriggerOnOff;
  32. int PostsTriggerValue;
  33. bool RecordsTriggerOnOff;
  34. int RecordsTriggerValue;
  35. bool SizeTriggerOnOff;
  36. int SizeTriggerValue;
  37. // Checkpoint parts
  38. bool CheckpointOnOff;
  39. cd::Timeout CheckpointTrigger;
  40. // Utility functions
  41. void DoMaintenanceWork();
  42. public:
  43. snfGBUdbmgr(); // Clean init and start thread.
  44. ~snfGBUdbmgr(); // Clean shutdown & stop thread.
  45. void linkGBUdb(GBUdb& G); // Connect to our GBUdb.
  46. void linkLOGmgr(snfLOGmgr& L); // Connect to our LOGmgr.
  47. void configure(snfCFGData& CFGData); // Establish or change our CFG.
  48. void load(); // Load the GBUdb as configured.
  49. void stop(); // Stop the thread.
  50. void myTask(); // Establish our thread's task.
  51. void GetAlertsForSync(std::list<GBUdbAlert>& AlertList); // Fill AlertList w/ outgoing alerts.
  52. void ProcessReflections(std::list<GBUdbAlert>& Reflections); // Integrate returning reflections.
  53. const static cd::ThreadType Type; // The thread's type.
  54. };