reHDD/include/reHDD.h

99 lines
2.2 KiB
C++

/**
* @file reHDD.h
* @brief represent
* @author hendrik schutter
* @date 01.05.2020
*/
#ifndef REHDD_H_
#define REHDD_H_
#define REHDD_VERSION "bV0.1.0"
//#define DRYRUN
// Drive handling Settings
#define WORSE_HOURS 19200 //mark drive if at this limit or beyond
#define WORSE_POWERUP 10000 //mark drive if at this limit or beyond
#define SHRED_ITERATIONS 3
#define FROZEN_TIMEOUT 5 //After this timeout (minutes) the drive will be marked as frozen
// Logger Settings
#define LOG_PATH "./reHDD.log"
#define DESCRIPTION "reHDD - Copyright Hendrik Schutter 2020"
#define DEVICE_ID "generic"
#define SOFTWARE_VERSION "alpha"
#define HARDWARE_VERSION "generic"
#define LOG_LEVEL_HIGH //log everything, like drive scann thread
#ifndef LOG_LEVEL_HIGH
#define LOG_LEVEL_LOW //log only user actions and tasks
#endif
//IPC pipes
#define READ 0
#define WRITE 1
#include <iostream>
#include <string>
#include <fstream>
#include <tuple>
#include <vector>
#include <time.h>
#include <chrono>
#include <curses.h>
#include <thread>
#include <unistd.h>
#include <mutex>
#include <sys/select.h>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <signal.h>
using namespace std;
#include "drive.h"
#include "smart.h"
#include "shred/shred.h"
#include "delete.h"
#include "tui.h"
#include "logger/logger.h"
extern Logger* logging;
template <typename T, typename I> T* iterator_to_pointer(I i)
{
return (&(*i));
}
class reHDD
{
protected:
public:
reHDD(void);
static void app_logic();
private:
static void searchDrives(vector <Drive>* pvecDrives);
static void printDrives(vector <Drive>* pvecDrives);
static void filterIgnoredDrives(vector <Drive>* pvecDrives);
static void filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecNewDrives);
static void addSMARTData(vector <Drive>* pvecDrives);
static void ThreadScannDevices();
static void ThreadUserInput();
static void ThreadShred();
static void ThreadCheckFrozenDrives();
static void handleArrowKey(TUI::UserInput userInput);
static void handleEnter();
static void handleESC();
static void handleAbort();
static Drive* getSelectedDrive();
};
#endif // REHDD_H_