Files
hpcore/src/msg/fbuf/p2pmsg_content.fbs
2020-12-22 16:55:44 +05:30

170 lines
3.4 KiB
Plaintext

// IDL file for p2p message content schema.
// flatc -o src/msg/fbuf/ --gen-mutable --cpp src/msg/fbuf/p2pmsg_content.fbs
include "common_schema.fbs";
namespace msg.fbuf.p2pmsg;
table Peer_Challenge_Message {
contract_id:string;
challenge:string;
}
table Peer_Challenge_Response_Message {
challenge:string;
sig:[ubyte];
}
table UserInput {
input_container:[ubyte];
signature:[ubyte];
protocol:uint8;
}
table UserInputGroup {
pubkey:[ubyte];
messages:[UserInput];
}
union Message {
Peer_Challenge_Response_Message,
Peer_Challenge_Message,
NonUnl_Proposal_Message,
Proposal_Message,
Npl_Message,
State_Request_Message,
State_Response_Message,
History_Request_Message,
History_Response_Message,
Peer_Requirement_Announcement_Message,
Peer_List_Request_Message,
Peer_List_Response_Message,
Available_Capacity_Announcement_Message,
Unl_Request_Message,
Unl_Response_Message
} //message content type
table Content {
message:Message;
}
table NonUnl_Proposal_Message {
user_inputs:[UserInputGroup];
}
table Unl_Changeset {
additions:[ByteArray];
removals:[ByteArray];
}
table Proposal_Message { //Proposal type message schema
stage:uint8;
time:uint64;
nonce: [ubyte];
users:[ByteArray];
input_hashes:[ByteArray];
output_hash:[ubyte];
output_sig:[ubyte];
state: [ubyte];
unl_hash: [ubyte]; // Hash of the current unl list.
unl_changeset: Unl_Changeset;
}
table Npl_Message { //NPL type message schema
data:[ubyte];
}
table History_Request_Message { //Ledger History request type message schema
required_lcl:[ubyte];
}
table Unl_Request_Message {
required_unl: [ubyte];
}
table Unl_Response_Message {
requester_unl:[ubyte]; // Unl hash of the sender.
unl_list: [ByteArray];
}
enum Ledger_Response_Error : ubyte
{
None = 0,
Invalid_Min_Ledger = 1,
Req_Ledger_Not_Found = 2
}
table History_Response_Message { //Ledger History request type message schema
requester_lcl:[ubyte];
hist_ledger_blocks:[HistoryLedgerBlockPair];
error: Ledger_Response_Error;
}
table HistoryLedgerBlockPair { //A key, value pair of byte[].
seq_no:uint64;
ledger:HistoryLedgerBlock;
}
table HistoryLedgerBlock {
lcl:[ubyte];
block_buffer:[ubyte];
}
table State_Request_Message { //State request message schema
parent_path:string;
is_file:bool;
block_id:int32;
expected_hash:[ubyte];
}
union State_Response{ File_HashMap_Response, Block_Response, Fs_Entry_Response }
table State_Response_Message{
state_response:State_Response;
hash:[ubyte];
path: string;
}
table Fs_Entry_Response{
entries: [State_FS_Hash_Entry];
}
table File_HashMap_Response{
file_length:uint64;
hash_map:[ubyte];
}
table Block_Response{
block_id:uint32;
data: [ubyte];
}
table State_FS_Hash_Entry{
name: string;
is_file: bool;
hash: [ubyte];
}
table Peer_Requirement_Announcement_Message{
need_consensus_msg_forwarding: bool;
}
table Available_Capacity_Announcement_Message{
available_capacity:int16;
timestamp:uint64;
}
table Peer_List_Request_Message{
}
table Peer_List_Response_Message{
peer_list: [Peer_Properties];
}
table Peer_Properties {
host_address:string;
port:uint16;
available_capacity:int16;
timestamp:uint64;
}
root_type Content; //root type for message content