File: common.h

package info (click to toggle)
guymager 0.6.7-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,500 kB
  • sloc: cpp: 13,963; makefile: 50; sh: 17
file content (111 lines) | stat: -rw-r--r-- 3,507 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// ****************************************************************************
//  Project:        GUYMAGER
// ****************************************************************************
//  Programmer:     Guy Voncken
//                  Police Grand-Ducale
//                  Service de Police Judiciaire
//                  Section Nouvelles Technologies
// ****************************************************************************
//  Module:         Standard include file
// ****************************************************************************

// Copyright 2008, 2009, 2010, 2011, 2012 Guy Voncken
//
// This file is part of guymager.
//
// guymager 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 2 of the License, or
// (at your option) any later version.
//
// guymager 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 guymager. If not, see <http://www.gnu.org/licenses/>.


#ifdef LINT_CODE_CHECK
#include "macros_for_lint.h"
#endif

#ifndef __COMMON_H__
#define __COMMON_H__

//#define USE_MD5_FROM_OPENSSL
//#define USE_SHA256_FROM_OPENSSL

// GNU C lib definitions
// ---------------------
#ifndef _LARGEFILE_SOURCE
   #define _LARGEFILE_SOURCE 1
#endif

#ifndef _FILE_OFFSET_BITS
   #define _FILE_OFFSET_BITS 64
#endif

#ifndef _GNU_SOURCE
   #define _GNU_SOURCE 1
#endif

#ifndef _THREAD_SAFE
   #define _THREAD_SAFE 1
#endif

#ifndef _STDIO_H
   #include <stdio.h>
#endif

#include <limits.h>

#include "toolglobalid.h"
#include "toolerror.h"
#include "toollog.h"
#include "tooltypes.h"

#include "modules.h"
#include "error.h"

#define QSTR_TO_PSZ(QStr) (QStr).toAscii().constData()


extern void *pOffsetOfNullPointer;
#define OFFSET_OF(Type, Element)                            \
   ((unsigned int) &(((Type*)pOffsetOfNullPointer)->Element))

#endif


class   t_Device;                    // As t_Device is the core structure of guymager and as it is needed
typedef t_Device       *t_pDevice;   // all the time, it is easiest to declare it here (eventhough I don't
typedef t_Device const *t_pcDevice;  // like that style too much, but we won't change C++ at this time).

#define EWF_MULTITHREADED_COMPRESSION_CHUNK_SIZE       32768

const unsigned long long BYTES_PER_MiB = 1ULL << 20;
const unsigned long long BYTES_PER_GiB = 1ULL << 30;
const unsigned long long BYTES_PER_TiB = 1ULL << 40;
const unsigned long long BYTES_PER_PiB = 1ULL << 50;
const unsigned long long BYTES_PER_EiB = 1ULL << 60;

const unsigned long long EWF_MIN_SEGMENT_SIZE     =   20 * BYTES_PER_MiB;
const unsigned long long EWF_MAX_SEGMENT_SIZE     = 2047 * BYTES_PER_MiB;
const unsigned long long EWF_MAX_SEGMENT_SIZE_EXT = LONG_LONG_MAX - 10 * BYTES_PER_PiB; // Let's keep some distance from the absolute maximum - just for safety.

#define GETMAX(a,b) ((a)>(b)?(a):(b))
#define GETMIN(a,b) ((a)<(b)?(a):(b))


typedef unsigned char      t_uint8;
typedef unsigned short     t_uint16;
typedef unsigned int       t_uint32;
typedef unsigned long long t_uint64;

typedef char               t_int8;
typedef short              t_int16;
typedef int                t_int32;
typedef long long          t_int64;