Electroneum
jsonrpc_structs.h
Go to the documentation of this file.
1
#ifndef JSONRPC_STRUCTS_H
2
#define JSONRPC_STRUCTS_H
3
4
#include <string>
5
#include <cstdint>
6
#include "
serialization/keyvalue_serialization.h
"
7
#include "
storages/portable_storage_base.h
"
8
9
namespace
epee
10
{
11
namespace
json_rpc
12
{
13
template
<
typename
t_param>
14
struct
request
15
{
16
std::string
jsonrpc
;
17
std::string
method
;
18
epee::serialization::storage_entry
id
;
19
t_param
params
;
20
21
request
():
id
{},
params
{} {}
22
23
BEGIN_KV_SERIALIZE_MAP
()
24
KV_SERIALIZE
(
jsonrpc
)
25
KV_SERIALIZE
(
id
)
26
KV_SERIALIZE
(
method
)
27
KV_SERIALIZE
(
params
)
28
END_KV_SERIALIZE_MAP
()
29
};
30
31
struct
error
32
{
33
int64_t
code
;
34
std::string
message
;
35
36
error
(): code(0) {}
37
38
BEGIN_KV_SERIALIZE_MAP
()
39
KV_SERIALIZE
(code)
40
KV_SERIALIZE
(
message
)
41
END_KV_SERIALIZE_MAP
()
42
};
43
44
struct
dummy_error
45
{
46
BEGIN_KV_SERIALIZE_MAP
()
47
END_KV_SERIALIZE_MAP
()
48
};
49
50
struct
dummy_result
51
{
52
BEGIN_KV_SERIALIZE_MAP
()
53
END_KV_SERIALIZE_MAP
()
54
};
55
56
template
<
typename
t_param,
typename
t_error>
57
struct
response
58
{
59
std::string
jsonrpc
;
60
t_param
result
;
61
epee::serialization::storage_entry
id
;
62
t_error
error
;
63
64
response
(): result{},
id
(),
error
{} {}
65
66
BEGIN_KV_SERIALIZE_MAP
()
67
KV_SERIALIZE
(
jsonrpc
)
68
KV_SERIALIZE
(
id
)
69
KV_SERIALIZE
(result)
70
KV_SERIALIZE
(
error
)
71
END_KV_SERIALIZE_MAP
()
72
};
73
74
template<typename t_param>
75
struct
response
<t_param,
dummy_error
>
76
{
77
std::string
jsonrpc
;
78
t_param
result
;
79
epee::serialization::storage_entry
id
;
80
81
response
(): result{},
id
{} {}
82
83
BEGIN_KV_SERIALIZE_MAP
()
84
KV_SERIALIZE
(
jsonrpc
)
85
KV_SERIALIZE
(
id
)
86
KV_SERIALIZE
(result)
87
END_KV_SERIALIZE_MAP
()
88
};
89
90
template<typename t_error>
91
struct
response
<
dummy_result
, t_error>
92
{
93
std::string
jsonrpc
;
94
t_error
error
;
95
epee::serialization::storage_entry
id
;
96
97
response
():
error
{},
id
{} {}
98
99
BEGIN_KV_SERIALIZE_MAP
()
100
KV_SERIALIZE
(
jsonrpc
)
101
KV_SERIALIZE
(
id
)
102
KV_SERIALIZE
(
error
)
103
END_KV_SERIALIZE_MAP
()
104
};
105
106
typedef
response
<
dummy_result
,
error
>
error_response
;
107
}
108
}
109
110
#endif
/* JSONRPC_STRUCTS_H */
epee::json_rpc::error::error
error()
Definition:
jsonrpc_structs.h:36
epee::json_rpc::error::code
int64_t code
Definition:
jsonrpc_structs.h:33
epee::json_rpc::response::jsonrpc
std::string jsonrpc
Definition:
jsonrpc_structs.h:59
epee::json_rpc::request::jsonrpc
std::string jsonrpc
Definition:
jsonrpc_structs.h:16
epee::json_rpc::error
Definition:
jsonrpc_structs.h:31
epee::json_rpc::response< dummy_result, t_error >::error
t_error error
Definition:
jsonrpc_structs.h:94
epee::json_rpc::request::id
epee::serialization::storage_entry id
Definition:
jsonrpc_structs.h:18
testing::internal::string
::std::string string
Definition:
gtest-port.h:1097
epee::json_rpc::request::request
request()
Definition:
jsonrpc_structs.h:21
epee::serialization::storage_entry
boost::variant< uint64_t, uint32_t, uint16_t, uint8_t, int64_t, int32_t, int16_t, int8_t, double, bool, std::string, section, array_entry > storage_entry
Definition:
portable_storage_base.h:154
KV_SERIALIZE
#define KV_SERIALIZE(varialble)
Definition:
keyvalue_serialization.h:104
epee::json_rpc::dummy_result
Definition:
jsonrpc_structs.h:50
keyvalue_serialization.h
epee::json_rpc::request::method
std::string method
Definition:
jsonrpc_structs.h:17
epee::json_rpc::response::response
response()
Definition:
jsonrpc_structs.h:64
epee::json_rpc::response< dummy_result, t_error >::id
epee::serialization::storage_entry id
Definition:
jsonrpc_structs.h:95
epee::json_rpc::response< t_param, dummy_error >::result
t_param result
Definition:
jsonrpc_structs.h:78
epee::json_rpc::error::message
std::string message
Definition:
jsonrpc_structs.h:34
portable_storage_base.h
epee::json_rpc::response< t_param, dummy_error >::id
epee::serialization::storage_entry id
Definition:
jsonrpc_structs.h:79
epee::json_rpc::response::id
epee::serialization::storage_entry id
Definition:
jsonrpc_structs.h:61
epee::json_rpc::response< t_param, dummy_error >::response
response()
Definition:
jsonrpc_structs.h:81
message
std::string message("Message requiring signing")
epee::json_rpc::dummy_error
Definition:
jsonrpc_structs.h:44
epee::json_rpc::request
Definition:
jsonrpc_structs.h:14
epee
Definition:
ado_db_helper.h:66
epee::json_rpc::response< t_param, dummy_error >::jsonrpc
std::string jsonrpc
Definition:
jsonrpc_structs.h:77
epee::json_rpc::response::error
t_error error
Definition:
jsonrpc_structs.h:62
epee::json_rpc::response< dummy_result, t_error >::response
response()
Definition:
jsonrpc_structs.h:97
int64_t
signed __int64 int64_t
Definition:
stdint.h:135
epee::json_rpc::response::result
t_param result
Definition:
jsonrpc_structs.h:60
epee::json_rpc::request::params
t_param params
Definition:
jsonrpc_structs.h:19
END_KV_SERIALIZE_MAP
#define END_KV_SERIALIZE_MAP()
Definition:
keyvalue_serialization.h:102
epee::json_rpc::response< dummy_result, t_error >::jsonrpc
std::string jsonrpc
Definition:
jsonrpc_structs.h:93
lmdb::error
error
Tracks LMDB error codes.
Definition:
error.h:44
BEGIN_KV_SERIALIZE_MAP
#define BEGIN_KV_SERIALIZE_MAP()
Definition:
keyvalue_serialization.h:43
epee::json_rpc::response
Definition:
jsonrpc_structs.h:57
contrib
epee
include
net
jsonrpc_structs.h
Generated on Sun Mar 10 2024 12:00:00 for Electroneum by
1.8.14