/* * database.h * * Created on: Dec 4, 2015 * Author: Philipp Hinz */ #ifndef DATABASE_H_ #define DATABASE_H_ #include #include #include #include #include #include #include "sqlite/sqlite3.h" using namespace std; // Config Keys typedef enum { CRC = 1, AliveCRC = 2, lastTC1 = 3, lastTC2 = 4, lastTC3 = 5, lastTerm = 6, testSlowCnt = 7, } config_key_t; int sqlOpen(); void sqlClose(); int sqlSetup(); int sqlExecute(string query); int sqlInsertNode(uint8_t *guid, bool terminal); int sqlReadNodes(); char *inttochar(uint8_t *guid); uint8_t *chartoint(const unsigned char *guid); uint8_t *int64to8bit(sqlite_int64 guid); sqlite_int64 int8to64bit(uint8_t *guid); void sqltest(); std::string string_sprintf(const char* format, ...); uint64_t sqlGetConf(config_key_t id); int sqlSetConf(config_key_t id, uint64_t value); #endif /* DATABASE_H_ */