forked from mhssamadani/Autolykos2_AMD_Miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
definitions.h
executable file
·85 lines (65 loc) · 1.96 KB
/
definitions.h
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
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
/*******************************************************************************
DEFINITIONS -- Constants, Structs and Macros
*******************************************************************************/
#include "jsmn.h"
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <time.h>
#include <atomic>
#include <mutex>
#include <string.h>
#define global
#include "OCLdefs.h"
#undef global
// puzzle global info
struct info_t
{
// Mutex for reading/writing data from info_t safely
std::mutex info_mutex;
// Mutex for curl usage/maybe future websocket
// not used now
// std::mutex io_mutex;
// Puzzle data to read
uint8_t bound[NUM_SIZE_8];
uint8_t mes[NUM_SIZE_8];
uint8_t sk[NUM_SIZE_8];
uint8_t pk[PK_SIZE_8];
char skstr[NUM_SIZE_4];
char pkstr[PK_SIZE_4 + 1];
int keepPrehash;
char to[MAX_URL_SIZE];
char endJob[MAX_URL_SIZE];
bool doJob;
uint8_t Hblock[HEIGHT_SIZE];
uint64_t N_LEN = INIT_N_LEN;
char stratumMode;
uint8_t extraNonceStart[NONCE_SIZE_8];
uint8_t extraNonceEnd[NONCE_SIZE_8];
// Increment when new block is sent by node
std::atomic<uint_t> blockId;
};
// json string for CURL http requests and config
struct json_t
{
size_t cap;
size_t len;
char * ptr;
jsmntok_t * toks;
json_t(const int strlen, const int toklen);
json_t(const json_t & newjson);
~json_t(void);
// reset len to zero
void Reset(void) { len = 0; return; }
// tokens access methods
int GetTokenStartPos(const int pos) { return toks[pos].start; }
int GetTokenEndPos(const int pos) { return toks[pos].end; }
int GetTokenLen(const int pos) { return toks[pos].end - toks[pos].start; }
char * GetTokenStart(const int pos) { return ptr + toks[pos].start; }
char * GetTokenEnd(const int pos) { return ptr + toks[pos].end; }
// token name check
int jsoneq(const int pos, const char * str);
};
#endif // DEFINITIONS_H