summaryrefslogtreecommitdiff
path: root/src/analysis/db/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db/core.h')
-rw-r--r--src/analysis/db/core.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/analysis/db/core.h b/src/analysis/db/core.h
new file mode 100644
index 0000000..d3f4e3d
--- /dev/null
+++ b/src/analysis/db/core.h
@@ -0,0 +1,70 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * core.h - prototypes pour les informations de base pour tout élément ajouté
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ANALYSIS_DB_CORE_H
+#define _ANALYSIS_DB_CORE_H
+
+
+#include <inttypes.h>
+#include <stdbool.h>
+
+
+
+/**
+ * Taille maximale pour un nom d'auteur.
+ * On considère comme exemple large '"Nom Prénom" xxx@yyy.tld'
+ */
+#define MAX_DB_AUTHOR_LEN 128
+
+
+/* Informations de base pour tout élément ajouté */
+typedef struct _core_db_info
+{
+ uint64_t type; /* Type de l'élément */
+ char hash[65]; /* Empreinte SHA256 */
+
+ char user[MAX_DB_AUTHOR_LEN]; /* Auteur humain ou NULL */
+
+ uint64_t created; /* Date de création */
+ uint64_t modified; /* Date de modification */
+
+ uint64_t saved; /* Statut de l'élément */
+
+} core_db_info;
+
+
+/* Détermine une fois pour toute la désignation de l'usager. */
+const char *get_local_author_name(void);
+
+/* Initialise le coeur des informations d'un élément ajouté. */
+void init_core_db_info(core_db_info *, uint64_t, const char *);
+
+/* Importe le coeur des informations d'un élément ajouté. */
+bool load_core_db_info(core_db_info *, uint64_t, int);
+
+/* Exporte le coeur des informations d'un élément ajouté. */
+bool store_core_db_info(core_db_info *, int);
+
+
+
+#endif /* _ANALYSIS_DB_CORE_H */