mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 03:59:33 +00:00
default initialize rpc structures
This commit is contained in:
parent
ef93b0995c
commit
e396146aee
12 changed files with 658 additions and 330 deletions
|
@ -81,7 +81,7 @@ namespace demo
|
|||
{
|
||||
const static int ID = 1000;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::string example_string_data;
|
||||
some_test_data sub;
|
||||
|
@ -91,9 +91,10 @@ namespace demo
|
|||
KV_SERIALIZE(sub)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
bool m_success;
|
||||
std::list<some_test_data> subs;
|
||||
|
@ -104,6 +105,7 @@ namespace demo
|
|||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
|
||||
|
||||
|
||||
|
@ -111,7 +113,7 @@ namespace demo
|
|||
{
|
||||
const static int ID = 1001;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::string example_string_data2;
|
||||
|
||||
|
@ -119,8 +121,9 @@ namespace demo
|
|||
KV_SERIALIZE(example_string_data2)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
bool m_success;
|
||||
|
||||
|
@ -129,6 +132,7 @@ namespace demo
|
|||
KV_SERIALIZE(m_success)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -159,5 +159,10 @@ namespace misc_utils
|
|||
return slc;
|
||||
}
|
||||
|
||||
template<typename T> struct struct_init: T
|
||||
{
|
||||
struct_init(): T{} {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace epee
|
|||
epee::serialization::storage_entry id;
|
||||
t_param params;
|
||||
|
||||
request(): id{}, params{} {}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
|
@ -30,6 +32,9 @@ namespace epee
|
|||
{
|
||||
int64_t code;
|
||||
std::string message;
|
||||
|
||||
error(): code(0) {}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(code)
|
||||
KV_SERIALIZE(message)
|
||||
|
@ -55,6 +60,9 @@ namespace epee
|
|||
t_param result;
|
||||
epee::serialization::storage_entry id;
|
||||
t_error error;
|
||||
|
||||
response(): result{}, id(), error{} {}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
|
@ -69,6 +77,9 @@ namespace epee
|
|||
std::string jsonrpc;
|
||||
t_param result;
|
||||
epee::serialization::storage_entry id;
|
||||
|
||||
response(): result{}, id{} {}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
|
@ -82,6 +93,9 @@ namespace epee
|
|||
std::string jsonrpc;
|
||||
t_error error;
|
||||
epee::serialization::storage_entry id;
|
||||
|
||||
response(): error{}, id{} {}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace tests
|
|||
{
|
||||
const static int ID = 1000;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
|
||||
std::string example_string_data;
|
||||
|
@ -75,9 +75,9 @@ namespace tests
|
|||
SERIALIZE_T(sub)
|
||||
END_NAMED_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
bool m_success;
|
||||
uint64_t example_id_data;
|
||||
|
@ -89,13 +89,14 @@ namespace tests
|
|||
SERIALIZE_STL_CONTAINER_T(subs)
|
||||
END_NAMED_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_EXAMPLE_2
|
||||
{
|
||||
const static int ID = 1001;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::string example_string_data2;
|
||||
uint64_t example_id_data;
|
||||
|
@ -105,8 +106,9 @@ namespace tests
|
|||
SERIALIZE_STL_ANSI_STRING(example_string_data2)
|
||||
END_NAMED_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
bool m_success;
|
||||
uint64_t example_id_data;
|
||||
|
@ -116,6 +118,7 @@ namespace tests
|
|||
SERIALIZE_POD(m_success)
|
||||
END_NAMED_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
typedef boost::uuids::uuid uuid;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
namespace cryptonote
|
||||
{
|
||||
struct core_stat_info
|
||||
struct core_stat_info_t
|
||||
{
|
||||
uint64_t tx_pool_size;
|
||||
uint64_t blockchain_height;
|
||||
|
@ -50,4 +50,5 @@ namespace cryptonote
|
|||
KV_SERIALIZE(top_block_id_str)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<core_stat_info_t> core_stat_info;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 1;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
block_complete_entry b;
|
||||
uint64_t current_blockchain_height;
|
||||
|
@ -138,6 +138,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE(current_blockchain_height)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -147,7 +148,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 2;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::vector<blobdata> txs;
|
||||
std::string _; // padding
|
||||
|
@ -157,6 +158,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE(_)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
/************************************************************************/
|
||||
/* */
|
||||
|
@ -165,7 +167,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 3;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::vector<crypto::hash> txs;
|
||||
std::vector<crypto::hash> blocks;
|
||||
|
@ -175,13 +177,14 @@ namespace cryptonote
|
|||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(blocks)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
struct NOTIFY_RESPONSE_GET_OBJECTS
|
||||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 4;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::vector<blobdata> txs;
|
||||
std::vector<block_complete_entry> blocks;
|
||||
|
@ -195,6 +198,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE(current_blockchain_height)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
|
||||
|
@ -219,7 +223,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 6;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
std::list<crypto::hash> block_ids; /*IDs of the first 10 blocks are sequential, next goes with pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */
|
||||
|
||||
|
@ -227,13 +231,14 @@ namespace cryptonote
|
|||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
struct NOTIFY_RESPONSE_CHAIN_ENTRY
|
||||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 7;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
uint64_t start_height;
|
||||
uint64_t total_height;
|
||||
|
@ -247,6 +252,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -256,7 +262,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 8;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
block_complete_entry b;
|
||||
uint64_t current_blockchain_height;
|
||||
|
@ -266,6 +272,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE(current_blockchain_height)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -275,7 +282,7 @@ namespace cryptonote
|
|||
{
|
||||
const static int ID = BC_COMMANDS_POOL_BASE + 9;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
crypto::hash block_hash;
|
||||
uint64_t current_blockchain_height;
|
||||
|
@ -287,6 +294,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(missing_tx_indices)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -131,9 +131,9 @@ namespace nodetool
|
|||
struct network_zone;
|
||||
using connect_func = boost::optional<p2p_connection_context>(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t);
|
||||
|
||||
struct config
|
||||
struct config_t
|
||||
{
|
||||
config()
|
||||
config_t()
|
||||
: m_net_config(),
|
||||
m_peer_id(crypto::rand<uint64_t>()),
|
||||
m_support_flags(0)
|
||||
|
@ -143,6 +143,7 @@ namespace nodetool
|
|||
uint64_t m_peer_id;
|
||||
uint32_t m_support_flags;
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<config_t> config;
|
||||
|
||||
struct network_zone
|
||||
{
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 1;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
basic_node_data node_data;
|
||||
t_playload_type payload_data;
|
||||
|
@ -189,8 +189,9 @@ namespace nodetool
|
|||
KV_SERIALIZE(payload_data)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
basic_node_data node_data;
|
||||
t_playload_type payload_data;
|
||||
|
@ -230,6 +231,7 @@ namespace nodetool
|
|||
}
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
|
||||
|
@ -241,15 +243,16 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 2;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
t_playload_type payload_data;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(payload_data)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
uint64_t local_time;
|
||||
t_playload_type payload_data;
|
||||
|
@ -289,6 +292,7 @@ namespace nodetool
|
|||
}
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -306,15 +310,16 @@ namespace nodetool
|
|||
|
||||
#define PING_OK_RESPONSE_STATUS_TEXT "OK"
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
/*actually we don't need to send any real data*/
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
peerid_type peer_id;
|
||||
|
@ -324,6 +329,7 @@ namespace nodetool
|
|||
KV_SERIALIZE(peer_id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
|
||||
|
@ -350,15 +356,16 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 4;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
proof_of_trust tr;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(tr)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
std::string version;
|
||||
std::string os_version;
|
||||
|
@ -374,6 +381,7 @@ namespace nodetool
|
|||
KV_SERIALIZE(payload_info)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
|
||||
|
@ -384,15 +392,16 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 5;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
proof_of_trust tr;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(tr)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
std::vector<peerlist_entry> local_peerlist_white;
|
||||
std::vector<peerlist_entry> local_peerlist_gray;
|
||||
|
@ -407,6 +416,7 @@ namespace nodetool
|
|||
KV_SERIALIZE(local_time)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -416,13 +426,14 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 6;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
peerid_type my_id;
|
||||
|
||||
|
@ -430,6 +441,7 @@ namespace nodetool
|
|||
KV_SERIALIZE(my_id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -439,13 +451,14 @@ namespace nodetool
|
|||
{
|
||||
const static int ID = P2P_COMMANDS_POOL_BASE + 7;
|
||||
|
||||
struct request
|
||||
struct request_t
|
||||
{
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response
|
||||
struct response_t
|
||||
{
|
||||
uint32_t support_flags;
|
||||
|
||||
|
@ -453,6 +466,7 @@ namespace nodetool
|
|||
KV_SERIALIZE(support_flags)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@ namespace mms
|
|||
namespace bitmessage_rpc
|
||||
{
|
||||
|
||||
struct message_info
|
||||
struct message_info_t
|
||||
{
|
||||
uint32_t encodingType;
|
||||
std::string toAddress;
|
||||
|
@ -66,8 +66,9 @@ namespace bitmessage_rpc
|
|||
KV_SERIALIZE(subject)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<message_info_t> message_info;
|
||||
|
||||
struct inbox_messages_response
|
||||
struct inbox_messages_response_t
|
||||
{
|
||||
std::vector<message_info> inboxMessages;
|
||||
|
||||
|
@ -75,6 +76,7 @@ namespace bitmessage_rpc
|
|||
KV_SERIALIZE(inboxMessages)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<inbox_messages_response_t> inbox_messages_response;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
namespace mms
|
||||
{
|
||||
|
||||
struct transport_message
|
||||
struct transport_message_t
|
||||
{
|
||||
cryptonote::account_public_address source_monero_address;
|
||||
std::string source_transport_address;
|
||||
|
@ -78,6 +78,7 @@ struct transport_message
|
|||
KV_SERIALIZE(transport_id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<transport_message_t> transport_message;
|
||||
|
||||
class message_transporter
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue