default initialize rpc structures

This commit is contained in:
moneromooo-monero 2019-01-18 01:05:58 +00:00
parent ef93b0995c
commit e396146aee
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
12 changed files with 658 additions and 330 deletions

View file

@ -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
{

View file

@ -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,7 +231,8 @@ 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