| 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 |
#ifndef STATE_H |
| 33 |
#define STATE_H |
| 34 |
|
| 35 |
#include <stdint.h> |
| 36 |
|
| 37 |
#include "ophcrack.h" |
| 38 |
#include "message.h" |
| 39 |
#include "arg.h" |
| 40 |
|
| 41 |
#ifdef __cplusplus |
| 42 |
extern "C" { |
| 43 |
#endif |
| 44 |
|
| 45 |
typedef enum { st_wait = 0x01, |
| 46 |
st_pause1 = 0x02, |
| 47 |
st_pause2 = 0x04, |
| 48 |
st_start = 0x08, |
| 49 |
st_preload = 0x10, |
| 50 |
st_work1 = 0x20, |
| 51 |
st_work2 = 0x40 } state_t; |
| 52 |
|
| 53 |
typedef struct fsm_t_ { |
| 54 |
state_t oldstate; |
| 55 |
state_t state; |
| 56 |
|
| 57 |
ophcrack_t *crack; |
| 58 |
arg_t *arg; |
| 59 |
|
| 60 |
int preload; |
| 61 |
int bforce; |
| 62 |
int pwait; |
| 63 |
int ssave; |
| 64 |
|
| 65 |
uint64_t psize_curr; |
| 66 |
uint64_t psize_total; |
| 67 |
uint64_t bforce_curr; |
| 68 |
uint64_t bforce_total; |
| 69 |
|
| 70 |
list_t *pending_msg; |
| 71 |
list_t *htoremove; |
| 72 |
} fsm_t; |
| 73 |
|
| 74 |
fsm_t *fsm_alloc(ophcrack_t *ophcrack); |
| 75 |
|
| 76 |
message_t *fsm_next(fsm_t *fsm, message_t *msg); |
| 77 |
|
| 78 |
void fsm_handle_start(fsm_t *fsm); |
| 79 |
message_t *fsm_handle_preload(fsm_t *fsm, message_t *msg); |
| 80 |
message_t *fsm_handle_pause1(fsm_t *fsm, message_t *msg); |
| 81 |
message_t *fsm_handle_pause2(fsm_t *fsm, message_t *msg); |
| 82 |
message_t *fsm_handle_work1(fsm_t *fsm, message_t *msg); |
| 83 |
message_t *fsm_handle_work2(fsm_t *fsm, message_t *msg); |
| 84 |
|
| 85 |
void fsm_reset_preload(fsm_t *fsm); |
| 86 |
void fsm_reset_bforce(fsm_t *fsm); |
| 87 |
|
| 88 |
void fsm_launch_preload(fsm_t *fsm); |
| 89 |
void fsm_launch_bforce(fsm_t *fsm); |
| 90 |
|
| 91 |
void fsm_ssave(fsm_t *fsm); |
| 92 |
void fsm_pause(fsm_t *fsm); |
| 93 |
void fsm_reset(fsm_t *fsm); |
| 94 |
|
| 95 |
#ifdef __cplusplus |
| 96 |
} |
| 97 |
#endif |
| 98 |
#endif |