This repository has been archived by the owner on Jul 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
/
protocol.h
89 lines (71 loc) · 2.82 KB
/
protocol.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
86
87
88
89
#ifndef __PROTOCOL_H__
#define __PROTOCOL_H__
/*
bitcoin binary protocol
Copyright 2011 Jeff Garzik
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define PUSHPOOL_UBBP_MAGIC "PMIN"
struct bc_work {
unsigned char data[128];
unsigned char hash1[64];
unsigned char midstate[32];
unsigned char target[32];
};
/*
* Client/message UBBP messages
*
* Key to packet abbreviations:
* HDR: Only the UBBP header. No payload.
* BIN: Payload is binary message data
* JSON: Payload is zlib-compressed JSON message
*
* If JSON response includes 'error' in object, that indicates failure,
* similar to JSON-RPC 1.1.
*/
enum {
/* client or server originated; and receive NOP as response */
BC_OP_NOP = 0, /* HDR; no-op */
/* client-originated messages */
BC_OP_LOGIN = 1, /* JSON + sha256 digest trailer; login*/
/* Ret: BC_OP_LOGIN_RESP */
BC_OP_CONFIG = 2, /* JSON; config */
/* Ret: BC_OP_CONFIG_RESP */
BC_OP_WORK_GET = 3, /* HDR; getwork */
/* Ret: BC_OP_WORK, BC_OP_RESP_ERR */
BC_OP_WORK_SUBMIT = 4, /* BIN; work solution */
/* Ret: BC_OP_RESP_OK, BC_OP_RESP_ERR */
/* server-originated messages */
BC_OP_RESP_OK = 100, /* HDR; general success response */
BC_OP_RESP_ERR = 101, /* JSON; general failure response */
BC_OP_LOGIN_RESP = 102, /* JSON; login response */
BC_OP_CONFIG_RESP = 103, /* JSON; config response */
BC_OP_WORK = 104, /* BIN; work unit */
};
/* error codes returned in JSON response messages */
enum {
BC_ERR_NONE = 0, /* no error (success) */
BC_ERR_INVALID = 1, /* invalid parameter */
BC_ERR_AUTH = 2, /* invalid user or pass */
BC_ERR_CONFIG = 3, /* invalid configuration */
BC_ERR_RPC = 4, /* upstream RPC problem */
BC_ERR_WORK_REJECT = 5, /* work submit rejected upstrm*/
BC_ERR_INTERNAL = 6, /* internal server err */
};
#endif /* __PROTOCOL_H__ */