blob: 4aaa6f96e07e69eb00771d779aa35e99f5a2c446 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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 */
|