steghide 0.5.1
common.h
Go to the documentation of this file.
1/*
2 * steghide 0.5.1 - a steganography program
3 * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 */
20
21#ifndef SH_COMMON_H
22#define SH_COMMON_H
23
24//
25// this file contains some definitions that are/can be used throughout the whole program
26//
27
28//
29// include config.h
30#ifdef HAVE_CONFIG_H
31#include "config.h"
32#endif
33
34//
35// generic type definitions
36#ifdef HAVE_CONFIG_H
37typedef TYPE_UWORD32 UWORD32 ;
38typedef TYPE_UWORD16 UWORD16 ;
39typedef TYPE_BYTE BYTE ;
40typedef TYPE_SWORD32 SWORD32 ;
41typedef TYPE_SWORD16 SWORD16 ;
42typedef TYPE_SBYTE SBYTE ;
43#else
44// use types that are at least the correct size
45typedef unsigned long UWORD32 ;
46typedef unsigned short UWORD16 ;
47typedef unsigned char BYTE ;
48typedef long SWORD32 ;
49typedef short SWORD16 ;
50typedef char SBYTE ;
51#endif
52
53#define UWORD32_MAX 0xFFFFFFFFUL
54#define UWORD16_MAX 0xFFFF
55#define BYTE_MAX 0xFF
56#define SWORD32_MIN -2147483647 - 1 // to avoid a gcc warning (caused by an overflow)
57#define SWORD32_MAX 2147483647
58#define SWORD16_MIN -32768
59#define SWORD16_MAX 32767
60#define SBYTE_MIN -128
61#define SBYTE_MAX 127
62
63//
64// specialised type definitions
65typedef bool BIT ;
66typedef BYTE EmbValue ;
71
72#define SAMPLEKEY_MAX UWORD32_MAX
73#define VERTEXLABEL_MAX UWORD32_MAX
74
75//
76// gettext support
77#include "gettext.h"
78#define _(S) gettext (S)
79
80//
81// global variables
82#include "Globals.h"
83extern Globals Globs ;
84
85//
86// every class should (be able to) do assertions
87// (myassert(expr) is more verbose than the standard C assert)
88#include "AssertionFailed.h"
89#define myassert(expr) if (!(expr)) throw AssertionFailed (__FILE__, __LINE__)
90
91//
92// every class can have debugging output
93#include <iostream> // for verbose testing output
94#if DEBUG
95#define RUNDEBUGLEVEL(LEVEL) ((LEVEL) <= Args.DebugLevel.getValue())
96extern void printDebug (unsigned short level, const char *msgfmt, ...) ;
97#endif
98
99//
100// every class has access to the command line arguments
101#include "Arguments.h"
102extern Arguments Args ;
103
104//
105// every class has access to random data
106#include "RandomSource.h"
107extern RandomSource RndSrc ;
108
109#endif // ndef SH_COMMON_H
Arguments Args
Definition Arguments.cc:37
parsing and data representation of command-line arguments
Definition Arguments.h:38
some useful pointers that should be global
Definition Globals.h:52
objects of this class are used as a source of random (non reproduceable) data
Definition RandomSource.h:33
UWORD32 SamplePos
Definition common.h:67
Globals Globs
Definition Embedder.cc:41
UWORD32 SampleValueLabel
Definition common.h:69
unsigned char BYTE
Definition common.h:47
RandomSource RndSrc
Definition RandomSource.cc:31
unsigned long UWORD32
Definition common.h:45
short SWORD16
Definition common.h:49
long SWORD32
Definition common.h:48
unsigned short UWORD16
Definition common.h:46
UWORD32 SampleKey
Definition common.h:70
UWORD32 VertexLabel
Definition common.h:68
BYTE EmbValue
Definition common.h:66
bool BIT
Definition common.h:65
char SBYTE
Definition common.h:50