summaryrefslogtreecommitdiff
path: root/src/analysis/db/misc/snapshot.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-10-12 16:21:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-10-12 16:25:05 (GMT)
commit986125d4c2d8b049017b6d0770f16b9058076165 (patch)
treec89e6b7967a731e68d72f6d5a2150b0347db4ef3 /src/analysis/db/misc/snapshot.h
parent96afc0325e1c85bf1a76d63c6441cf8f044708fe (diff)
Defined a new type dedicated to snapshot identifiers.
Diffstat (limited to 'src/analysis/db/misc/snapshot.h')
-rw-r--r--src/analysis/db/misc/snapshot.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/analysis/db/misc/snapshot.h b/src/analysis/db/misc/snapshot.h
new file mode 100644
index 0000000..4aaa6f9
--- /dev/null
+++ b/src/analysis/db/misc/snapshot.h
@@ -0,0 +1,82 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * snapshot.h - prototypes pour l'encodage des informations utiles aux instantanés
+ *
+ * Copyright (C) 2019 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ANALYSIS_DB_MISC_SNAPSHOT_H
+#define _ANALYSIS_DB_MISC_SNAPSHOT_H
+
+
+#include <stdbool.h>
+#include <stdint.h>
+
+
+#include "../../../common/packed.h"
+
+
+
+/* -------------------------- IDENTIFIANTS DES INSTANTANES -------------------------- */
+
+
+#define SNAP_ID_RAND_SZ 32
+#define SNAP_ID_HEX_SZ (SNAP_ID_RAND_SZ * 2 + 1)
+
+/* Représentation d'un instantané */
+typedef struct _snapshot_id_t
+{
+ char name[SNAP_ID_HEX_SZ];
+
+} snapshot_id_t;
+
+
+/* Construit un identifiant pour instantané de base de données. */
+bool init_snapshot_id(snapshot_id_t *);
+
+/* Construit un identifiant pour instantané de base de données. */
+bool init_snapshot_id_from_text(snapshot_id_t *, const char *);
+
+#define snapshot_id_as_string(id) (id)->name
+
+/* Effectue une copie d'identifiant d'instantané. */
+void copy_snapshot_id(snapshot_id_t *, const snapshot_id_t *);
+
+/* Effectue la comparaison entre deux identifiants. */
+int cmp_snapshot_id(const snapshot_id_t *, const snapshot_id_t *);
+
+/* Importe la définition d'un identifiant d'instantané. */
+bool unpack_snapshot_id(snapshot_id_t *, packed_buffer *);
+
+/* Exporte la définition d'un identifiant d'instantané. */
+bool pack_snapshot_id(const snapshot_id_t *, packed_buffer *);
+
+
+
+/* --------------------------- PROPRIETES DES INSTANTANES --------------------------- */
+
+
+
+
+
+
+
+
+
+#endif /* _ANALYSIS_DB_MISC_SNAPSHOT_H */