// snfGBUdbmgr.hpp // Copyright (C) 2006 - 2020 ARM Research Labs, LLC. // See www.armresearch.com for the copyright terms. // // This module manages the GBUdb(s) that are used in the SNF scanner engine. // It is responsible for setting parameters, monitoring activity, and handling // scheduled maintenance tasks. #ifndef snfGBUdbmgr_included #define snfGBUdbmgr_included #include "../CodeDweller/threading.hpp" #include "../CodeDweller/timing.hpp" #include "snfCFGmgr.hpp" #include "snfLOGmgr.hpp" #include "GBUdb.hpp" using namespace std; class snfLOGmgr; class snfGBUdbmgr : public cd::Thread { private: cd::Mutex MyMutex; GBUdb* MyGBUdb; snfLOGmgr* MyLOGmgr; bool Configured; volatile bool TimeToStop; // Condensation parts cd::Timeout CondenseGuardTime; bool TimeTriggerOnOff; cd::Timeout TimeTrigger; bool PostsTriggerOnOff; int PostsTriggerValue; bool RecordsTriggerOnOff; int RecordsTriggerValue; bool SizeTriggerOnOff; int SizeTriggerValue; // Checkpoint parts bool CheckpointOnOff; cd::Timeout CheckpointTrigger; // Utility functions void DoMaintenanceWork(); public: snfGBUdbmgr(); // Clean init and start thread. ~snfGBUdbmgr(); // Clean shutdown & stop thread. void linkGBUdb(GBUdb& G); // Connect to our GBUdb. void linkLOGmgr(snfLOGmgr& L); // Connect to our LOGmgr. void configure(snfCFGData& CFGData); // Establish or change our CFG. void load(); // Load the GBUdb as configured. void stop(); // Stop the thread. void myTask(); // Establish our thread's task. void GetAlertsForSync(list& AlertList); // Fill AlertList w/ outgoing alerts. void ProcessReflections(list& Reflections); // Integrate returning reflections. const static cd::ThreadType Type; // The thread's type. }; #endif