diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-08-18 21:55:24 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-08-18 21:55:24 (GMT) |
commit | a0a7b6c1e05c78ae433f353d15e3366107b67d03 (patch) | |
tree | bca0b187778cf016c6131bfc982b08c67a38442b /src/analysis/db/misc/rlestr.h | |
parent | 161c0f8ab227af5033b1b6456607b9b9c3bc60df (diff) |
Inserted storages and collections into loaded binaries (first steps).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@389 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/db/misc/rlestr.h')
-rw-r--r-- | src/analysis/db/misc/rlestr.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/analysis/db/misc/rlestr.h b/src/analysis/db/misc/rlestr.h new file mode 100644 index 0000000..2aa863f --- /dev/null +++ b/src/analysis/db/misc/rlestr.h @@ -0,0 +1,83 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * rlestr.h - prototypes pour l'encodage par plage unique d'une chaîne de caractères + * + * Copyright (C) 2014 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * 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_MISC_RLESTR_H +#define _ANALYSIS_DB_MISC_RLESTR_H + + +#include <stdbool.h> +#include <stdint.h> +#include <sys/types.h> + + + +/* Informations de base pour tout élément ajouté */ +typedef struct _rle_string +{ + char *data; /* Chaîne de caractères */ + uint32_t length; /* Taille de la chaîne */ + +} rle_string; + + +/* Définit une représentation de chaîne de caractères. */ +void init_rle_string(rle_string *, const char *); + +#define exit_rle_string(rle) /* TODO */ + +#define dup_rle_string(dst, src) init_rle_string(dst, (src)->data); + +#define get_rle_string(rle) (rle)->data + +/* Constitue une représentation de chaîne de caractères. */ +void set_rle_string(rle_string *, const char *); + +/* Libère la mémoire associée à la représentation. */ +void unset_rle_string(rle_string *); + +/* Effectue la comparaison entre deux chaînes de caractères. */ +int cmp_rle_string(const rle_string *, const rle_string *); + + + +/* Importe la définition d'une chaîne de caractères. */ +bool load_rle_string(rle_string *, int); + +/* Exporte la définition d'une chaîne de caractères. */ +bool store_rle_string(const rle_string *, int); + + + +#define is_rle_string_empty(rle) ((rle)->data == NULL) + + + +/* Importe la définition d'une chaîne de caractères. */ +bool recv_rle_string(rle_string *, int, int); + +/* Exporte la définition d'une chaîne de caractères. */ +bool send_rle_string(const rle_string *, int, int); + + + +#endif /* _ANALYSIS_DB_MISC_RLESTR_H */ |