00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* 00003 decode.h 00004 Heraia's library decode.c 00005 00006 (C) Copyright 2008 Sébastien Tricaud e-mail : toady@gscore.org 00007 (C) Copyright 2008 - 2009 Olivier Delhomme e-mail : heraia@delhomme.org 00008 URL : http://heraia.tuxfamily.org 00009 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2, or (at your option) 00013 any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 00023 /** 00024 * @file decode.h 00025 * Header for decoding things (numbers, dates, binary, ...) 00026 */ 00027 #ifndef _LIBHERAIA_DECODE_H_ 00028 #define _LIBHERAIA_DECODE_H_ 00029 00030 /** 00031 * @struct date_and_time_t 00032 * A human struct to store a date with a time. 00033 * @todo add an UTC info field 00034 */ 00035 typedef struct 00036 { 00037 guint32 year; 00038 guint32 month; 00039 guint32 day; 00040 00041 guint32 hour; 00042 guint32 minutes; 00043 guint32 seconds; 00044 } date_and_time_t; 00045 00046 /* templates */ 00047 typedef gchar *(* DecodeFunc) (guchar *); /* Decode function template for numbers*/ 00048 typedef gchar *(* DecodeDateFunc) (guchar *, date_and_time_t *mydate); /* Decode function template for dates */ 00049 00050 /* Numbers */ 00051 extern gchar *decode_8bits_unsigned(guchar *data); 00052 extern gchar *decode_8bits_signed(guchar *data); 00053 extern gchar *decode_16bits_signed(guchar *data); 00054 extern gchar *decode_16bits_unsigned(guchar *data); 00055 extern gchar *decode_32bits_signed(guchar *data); 00056 extern gchar *decode_32bits_unsigned(guchar *data); 00057 extern gchar *decode_64bits_signed(guchar *data); 00058 extern gchar *decode_64bits_unsigned(guchar *data); 00059 00060 /* bits */ 00061 extern gchar *decode_to_bits(guchar *data); 00062 00063 /* dates */ 00064 extern gchar *decode_dos_date(guchar *data, date_and_time_t *mydate); 00065 extern gchar *decode_filetime_date(guchar *data, date_and_time_t *mydate); 00066 extern gchar *decode_C_date(guchar *data, date_and_time_t *mydate); 00067 extern gchar *decode_HFS_date(guchar *data, date_and_time_t *mydate); 00068 00069 /* bcd */ 00070 extern gchar *decode_packed_BCD(guchar *data); 00071 00072 /* Utils */ 00073 extern gboolean swap_bytes(guchar *to_swap, guint first, guint last); 00074 extern void reverse_byte_order(guchar *to_reverse); 00075 00076 #endif /* _LIBHERAIA_DECODE_H_ */ 00077