diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-03-11 21:57:05 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-03-11 21:57:05 (GMT) |
commit | 8088f1cbb4304c686ff41520099707a333084a4e (patch) | |
tree | 147411c3f90097dc1ae950ec390df2dfccf07ad7 /src/common/ibuf.h | |
parent | a33dd28e763e3a8b04145fb549aca9320e100a4b (diff) |
Defined a new Dex demangler with MUTF-8 support as plugin.
Diffstat (limited to 'src/common/ibuf.h')
-rw-r--r-- | src/common/ibuf.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/common/ibuf.h b/src/common/ibuf.h new file mode 100644 index 0000000..b57e374 --- /dev/null +++ b/src/common/ibuf.h @@ -0,0 +1,71 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * ibuf.h - prototypes pour la lecture progressive d'un tampon de données + * + * Copyright (C) 2018 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 Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _COMMON_IBUF_H +#define _COMMON_IBUF_H + + +#include <stdint.h> +#include <sys/types.h> + + + +/* Rassemblement de données d'un tampon */ +typedef struct _input_buffer +{ + union + { + const char *text; /* Contenu textuel disponible */ + const uint8_t *data; /* Données brutes à traiter */ + }; + + size_t len; /* Quantité d'octets présents */ + size_t pos; /* Position de tête de lecture */ + +} input_buffer; + + +/* Initialise un contenu textuel pour une lecture ultérieure. */ +void init_text_input_buffer(input_buffer *, const char *); + +/* Compte le nombre d'octets encore non lus. */ +size_t count_input_buffer_remaining(const input_buffer *); + +/* Avance la tête de lecture dans le tampon de données. */ +void advance_input_buffer(input_buffer *, size_t); + +/* Fournit un accès brut au niveau de la tête de lecture. */ +const char *get_input_buffer_text_access(const input_buffer *); + +/* Fournit et avance la tête de lecture courante. */ +char text_input_buffer_next_char(input_buffer *); + +/* Note la position courante de la tête de lecture. */ +void save_input_buffer_pos(const input_buffer *, size_t *); + +/* Restaure la position de la tête de lecture. */ +void restore_input_buffer_pos(input_buffer *, size_t); + + + +#endif /* _COMMON_IBUF_H */ |