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, Olivier Delhomme 00007 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 #ifndef _LIBHERAIA_DECODE_H_ 00025 #define _LIBHERAIA_DECODE_H_ 00026 00027 /* A human struct to store a date with a time. TODO : add an UTC info */ 00028 typedef struct 00029 { 00030 guint32 year; 00031 guint32 month; 00032 guint32 day; 00033 00034 guint32 hour; 00035 guint32 minutes; 00036 guint32 seconds; 00037 } date_and_time_t; 00038 00039 /* templates */ 00040 typedef gchar *(* DecodeFunc) (guchar *); /* Decode function template for numbers*/ 00041 typedef gchar *(* DecodeDateFunc) (guchar *, date_and_time_t *mydate); /* Decode function template for dates */ 00042 00043 /* Numbers */ 00044 extern gchar *decode_8bits_unsigned(guchar *data); 00045 extern gchar *decode_8bits_signed(guchar *data); 00046 extern gchar *decode_16bits_signed(guchar *data); 00047 extern gchar *decode_16bits_unsigned(guchar *data); 00048 extern gchar *decode_32bits_signed(guchar *data); 00049 extern gchar *decode_32bits_unsigned(guchar *data); 00050 extern gchar *decode_64bits_signed(guchar *data); 00051 extern gchar *decode_64bits_unsigned(guchar *data); 00052 00053 /* bits */ 00054 extern gchar *decode_to_bits(guchar *data); 00055 00056 /* dates */ 00057 extern gchar *decode_dos_date(guchar *data, date_and_time_t *mydate); 00058 extern gchar *decode_filetime_date(guchar *data, date_and_time_t *mydate); 00059 extern gchar *decode_C_date(guchar *data, date_and_time_t *mydate); 00060 extern gchar *decode_HFS_date(guchar *data, date_and_time_t *mydate); 00061 00062 /* bcd */ 00063 extern gchar *decode_packed_BCD(guchar *data); 00064 00065 /* Utils */ 00066 extern gboolean swap_bytes(guchar *to_swap, guint first, guint last); 00067 extern void reverse_byte_order(guchar *to_reverse); 00068 00069 #endif /* _LIBHERAIA_DECODE_H_ */ 00070