Heraia  0.1.8
decode.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  decode.h
4  Heraia's library decode.c
5 
6  (C) Copyright 2008 Sébastien Tricaud e-mail : toady@gscore.org
7  (C) Copyright 2008 - 2011 Olivier Delhomme e-mail : heraia@delhomme.org
8  URL : http://heraia.tuxfamily.org
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2, or (at your option)
13  any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
23 /**
24  * @file decode.h
25  * Header for decoding things (numbers, dates, binary, ...)
26  */
27 #ifndef _LIBHERAIA_DECODE_H_
28 #define _LIBHERAIA_DECODE_H_
29 
30 /*-- Decoding function --*/
31 /* Numbers */
32 extern gchar *decode_8bits_unsigned(guchar *data, gpointer data_struct);
33 extern gchar *decode_8bits_signed(guchar *data, gpointer data_struct);
34 extern gchar *decode_16bits_signed(guchar *data, gpointer data_struct);
35 extern gchar *decode_16bits_unsigned(guchar *data, gpointer data_struct);
36 extern gchar *decode_32bits_signed(guchar *data, gpointer data_struct);
37 extern gchar *decode_32bits_unsigned(guchar *data, gpointer data_struct);
38 extern gchar *decode_64bits_signed(guchar *data, gpointer data_struct);
39 extern gchar *decode_64bits_unsigned(guchar *data, gpointer data_struct);
40 
41 /* Floats */
42 extern gchar *decode_float_normal(guchar *data, gpointer data_struct);
43 extern gchar *decode_float_scientific(guchar *data, gpointer data_struct);
44 extern gchar *decode_double_normal(guchar *data, gpointer data_struct);
45 extern gchar *decode_double_scientific(guchar *data, gpointer data_struct);
46 
47 /* bits */
48 extern gchar *decode_to_bits(guchar *data, gpointer data_struct);
49 
50 /* dates */
51 extern gchar *decode_dos_date(guchar *data, gpointer data_struct);
52 extern gchar *decode_filetime_date(guchar *data, gpointer data_struct);
53 extern gchar *decode_C_date(guchar *data, gpointer data_struct);
54 extern gchar *decode_HFS_date(guchar *data, gpointer data_struct);
55 
56 /* bcd */
57 extern gchar *decode_packed_BCD(guchar *data, gpointer data_struct);
58 
59 /*-- Non decoding functions --*/
60 /* Utils */
61 extern gboolean swap_bytes(guchar *to_swap, guint first, guint last);
62 extern void reverse_byte_order(guchar *to_reverse);
63 extern decode_parameters_t *new_decode_parameters_t(guint endianness, guint stream_size);
64 extern decode_t * new_decode_t(DecodeFunc decode_func, GtkWidget *entry, const gchar *err_msg);
65 extern decode_generic_t *new_decode_generic_t(const gchar *label, guint data_size, gboolean fixed_size, const gchar *err_msg, guint nb_cols, ...);
66 
67 #endif /* _LIBHERAIA_DECODE_H_ */
68 
gchar * decode_16bits_unsigned(guchar *data, gpointer data_struct)
general purpose of this function is to take a 2 byte data stream and convert it as if it is a 16 bits...
Definition: decode.c:118
gchar * decode_64bits_signed(guchar *data, gpointer data_struct)
general purpose of this function is to take a 8 byte data stream and convert it as if it is a 64 bits...
Definition: decode.c:187
gchar * decode_C_date(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a C date...
Definition: decode.c:659
gchar * decode_32bits_unsigned(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a 32 bits...
Definition: decode.c:164
decode_parameters_t * new_decode_parameters_t(guint endianness, guint stream_size)
Make an new decode_parameters_t in order to pass to the functions.
Definition: decode.c:961
gchar * decode_float_normal(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a float n...
Definition: decode.c:233
gboolean swap_bytes(guchar *to_swap, guint first, guint last)
Swap bytes from the buffer to_swap.
Definition: decode.c:913
gchar * decode_packed_BCD(guchar *data, gpointer data_struct)
Decode one byte as a Packed BCD (Binary Coded Decimal) and return a gchar* that may be freed when no ...
Definition: decode.c:872
gchar * decode_16bits_signed(guchar *data, gpointer data_struct)
general purpose of this function is to take a 2 byte data stream and convert it as if it is a 16 bits...
Definition: decode.c:95
gchar * decode_to_bits(guchar *data, gpointer data_struct)
decodes the stream represented by *data (one byte) to a string containing eight 0 or 1 (Little Endian...
Definition: decode.c:739
gchar * decode_64bits_unsigned(guchar *data, gpointer data_struct)
general purpose of this function is to take a 8 byte data stream and convert it as if it is a 64 bits...
Definition: decode.c:210
gchar * decode_8bits_unsigned(guchar *data, gpointer data_struct)
general purpose of this function is to take a 1 byte data stream and convert it as if it is an 8 bits...
Definition: decode.c:72
gchar * decode_32bits_signed(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a 32 bits...
Definition: decode.c:141
decode_generic_t * new_decode_generic_t(const gchar *label, guint data_size, gboolean fixed_size, const gchar *err_msg, guint nb_cols,...)
Make a new decode_generic_t structure and creates the associated widgets.
Definition: decode.c:1018
Basic way to associate a decode function and an entry that will receive the result.
Definition: libheraia.h:160
gchar *(* DecodeFunc)(guchar *, gpointer)
Templates for the decoding functions.
Definition: libheraia.h:139
gchar * decode_double_scientific(guchar *data, gpointer data_struct)
general purpose of this function is to take a 8 byte data stream and convert it as if it is a float n...
Definition: decode.c:302
gchar * decode_double_normal(guchar *data, gpointer data_struct)
general purpose of this function is to take a 8 byte data stream and convert it as if it is a float n...
Definition: decode.c:279
gchar * decode_float_scientific(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a float n...
Definition: decode.c:256
void reverse_byte_order(guchar *to_reverse)
Reverse the byte order LSB -> MSB in MSB -> LSB 12345678 in 87654321.
Definition: decode.c:936
gchar * decode_8bits_signed(guchar *data, gpointer data_struct)
General purpose of this function is to take a 1 byte data stream and convert it as if it is an 8 bits...
Definition: decode.c:49
decode_t * new_decode_t(DecodeFunc decode_func, GtkWidget *entry, const gchar *err_msg)
Make a new decode_t structure.
Definition: decode.c:983
gchar * decode_dos_date(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a dos dat...
Definition: decode.c:563
gchar * decode_HFS_date(guchar *data, gpointer data_struct)
general purpose of this function is to take a 4 byte data stream and convert it as if it is a HFS dat...
Definition: decode.c:690
gchar * decode_filetime_date(guchar *data, gpointer data_struct)
general purpose of this function is to take a 8 byte data stream and convert it as if it is a filetim...
Definition: decode.c:628
Basic way to have as many as we want decoding functions corresponding to one label.
Definition: libheraia.h:176
Used to pass decoding options to the functions.
Definition: libheraia.h:147