Prepare fix for datatypes, not final
[hashcat.git] / include / common.h
1 /**
2 * Author......: Jens Steube <jens.steube@gmail.com>
3 * License.....: MIT
4 */
5
6 #ifndef COMMON_H
7 #define COMMON_H
8
9 #define _POSIX_SOURCE
10 #define _GNU_SOURCE
11 #define _FILE_OFFSET_BITS 64
12 #define _CRT_SECURE_NO_WARNINGS
13
14 #include <stdarg.h>
15 #include <stdint.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <stdbool.h>
19 #include <string.h>
20 #include <errno.h>
21 #include <getopt.h>
22 #include <math.h>
23 #include <ctype.h>
24 #include <dirent.h>
25 #include <time.h>
26 #include <unistd.h>
27 #include <signal.h>
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 #include <search.h>
31
32 #ifdef _POSIX
33 #include <sys/time.h>
34 #include <pthread.h>
35 #include <semaphore.h>
36 #include <dlfcn.h>
37 #include <pwd.h>
38
39 #ifdef LINUX
40 #include <termio.h>
41 #endif
42
43 #ifdef OSX
44 #include <termios.h>
45 #include <sys/ioctl.h>
46 #endif
47
48 typedef void *HM_LIB;
49 #endif
50
51 #ifdef _WIN
52 #define WIN32_LEAN_AND_MEAN
53 #include <windows.h>
54 #include <process.h>
55 #include <conio.h>
56 #include <tchar.h>
57 #include <psapi.h>
58 #include <io.h>
59 #include <fcntl.h>
60
61 typedef UINT8 uint8_t;
62 typedef UINT16 uint16_t;
63 typedef UINT32 uint32_t;
64 typedef UINT64 uint64_t;
65 typedef INT8 int8_t;
66 typedef INT16 int16_t;
67 typedef INT32 int32_t;
68 typedef INT64 int64_t;
69
70 typedef UINT32 uint;
71 typedef UINT64 uint64_t;
72
73 typedef HINSTANCE HM_LIB;
74
75 #define mkdir(name,mode) mkdir (name)
76
77 #endif
78
79 typedef uint8_t u8;
80 typedef uint16_t u16;
81 typedef uint32_t u32;
82 typedef uint64_t u64;
83
84 typedef uint32_t uint; // we need to get rid of this sooner or later, for consistency
85
86 #define SPEED_CACHE 128
87 #define SPEED_MAXAGE 4096
88
89 #undef BUFSIZ
90 #define BUFSIZ 8192
91
92 /**
93 * functions
94 */
95
96 void log_out_nn (FILE *fp, const char *fmt, ...);
97 void log_info_nn (const char *fmt, ...);
98 void log_error_nn (const char *fmt, ...);
99
100 void log_out (FILE *fp, const char *fmt, ...);
101 void log_info (const char *fmt, ...);
102 void log_error (const char *fmt, ...);
103
104 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
105 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
106
107 #endif