/* 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 .
*/
#ifndef _ANALYSIS_DB_MISC_SNAPSHOT_H
#define _ANALYSIS_DB_MISC_SNAPSHOT_H
#include
#include
#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 */