Aruna
Performer.h
Go to the documentation of this file.
1 //
2 // Created by noeel on 15-04-20.
3 //
4 
5 #ifndef ARUNA_PERFORMER_H
6 #define ARUNA_PERFORMER_H
7 
8 #include <cstdint>
9 #include "aruna/sis/sisTypes.h"
10 #include <pthread.h>
11 #include <aruna/log.h>
12 
13 namespace aruna {
14  namespace sis {
15  class Performer {
16  private:
18  protected:
19 // update thread
20  pthread_t thread;
21  pthread_cond_t do_update_con;
22  pthread_mutex_t do_update_mut;
23 //
25  char log_tag[10] = "SIS perf";
26 // use set_update()
27  bool do_update = false;
28 
29 // update thread handlers
30  void update_handler();
31 
32  static void *_update_handler(void *_this);
33 
34 // set to true to cancel creation of update thread.
35  bool interrupt_based = false;
36  public:
40  uint32_t update_ms = 500;
41 
45  Performer();
46 
47  ~Performer();
48 
49 // TODO actions to bring system back to a secure state
50 // virtual void action() = 0;
51 // virtual void action_abort() = 0;
52 
57  virtual status_t *update_status() = 0;
58 
63  void set_update(bool do_update);
64 
65  };
66 
67  }
68 }
69 
70 #endif //ARUNA_PERFORMER_H
Definition: comm.cpp:14
pthread_cond_t do_update_con
Definition: Performer.h:21
pthread_mutex_t do_update_mut
Definition: Performer.h:22
log::channel_t * log
Definition: Performer.h:24
void set_update(bool do_update)
Use to pauze and resume the update process.
Definition: Performer.cpp:57
uint32_t update_ms
update frequency
Definition: Performer.h:40
static void * _update_handler(void *_this)
Definition: Performer.cpp:31
virtual status_t * update_status()=0
Perform check to see if system is secure and return updated status.
status that is to be reported to the watcher
Definition: sisTypes.h:36
Performer()
Performs check to see if the system is in a secure state.
Definition: Performer.cpp:16