1 /*
2  *
3  *   Ophcrack is a Lanmanager/NTLM hash cracker based on the faster time-memory
4  *   trade-off using rainbow tables.
5  *
6  *   Created with the help of: Maxime Mueller, Luca Wullschleger, Claude
7  *   Hochreutiner, Andreas Huber and Etienne Dysli.
8  *
9  *   Copyright (c) 2008 Philippe Oechslin, Cedric Tissieres, Bertrand Mesot
10  *
11  *   Ophcrack is free software; you can redistribute it and/or modify
12  *   it under the terms of the GNU General Public License as published by
13  *   the Free Software Foundation; either version 2 of the License, or
14  *   (at your option) any later version.
15  *
16  *   Ophcrack is distributed in the hope that it will be useful,
17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *   GNU General Public License for more details.
20  *
21  *   You should have received a copy of the GNU General Public License
22  *   along with Ophcrack; if not, write to the Free Software
23  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  *
25  *   This program is released under the GPL with the additional exemption
26  *   that compiling, linking, and/or using OpenSSL is allowed.
27  *
28  *
29  *
30  *
31 */
32 #ifndef MESSAGE_H
33 #define MESSAGE_H
34 
35 #include <stdint.h>
36 #include <time.h>
37 #include <sys/time.h>
38 
39 #include "list.h"
40 #include "table.h"
41 #include "hash.h"
42 #include "ophtask.h"
43 
44 #ifdef  __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef enum { msg_done = 0,
49 	       msg_preload,
50 	       msg_unload,
51 	       msg_work,
52 	       msg_found,
53 	       msg_bforce,
54 	       msg_pause } msg_kind_t;
55 
56 typedef struct msg_done_t_ {
57   ophkind_t kind;
58 } msg_done_t;
59 
60 typedef struct msg_load_t_ {
61   table_t *tbl;
62   table_preload_t preload;
63   int done;
64   uint64_t size;
65 } msg_load_t;
66 
67 typedef struct msg_work_t_ {
68   hash_t *hsh;
69   table_t *tbl;
70   ophkind_t kind;
71   int cmin;
72   int cmax;
73 } msg_work_t;
74 
75 typedef struct msg_found_t_ {
76   hash_t *hsh;
77   table_t *tbl;
78   int col;
79 } msg_found_t;
80 
81 typedef struct msg_bforce_t_ {
82   int done;
83   uint64_t count;
84 } msg_bforce_t;
85 
86 typedef struct message_t_ {
87   msg_kind_t kind;
88   uint32_t id;
89 
90   void *data;
91 
92   struct timeval time;
93 } message_t;
94 
95 void message_init(void);
96 void message_free(message_t *msg);
97 void message_insert_first(list_t *messages);
98 
99 message_t *message_get(void);
100 message_t *message_tryget(void);
101 
102 void message_done(ophkind_t kind);
103 void message_preload(table_t *tbl, table_preload_t preload, int done, uint64_t size);
104 void message_unload(table_t *tbl, uint64_t size);
105 void message_work(hash_t *hsh, table_t *tbl, ophkind_t kind, int cmin, int cmax);
106 void message_found(hash_t *hsh, table_t *tbl, int col);
107 void message_bforce(int done, uint64_t count);
108 void message_pause(void);
109 
110 #ifdef  __cplusplus
111 }
112 #endif
113 #endif
114