crate::ix!();
pub struct MessageHeader {
pch_message_start: [u8; MESSAGE_HEADER_MESSAGE_START_SIZE],
pch_command: [u8; MESSAGE_HEADER_COMMAND_SIZE],
n_message_size: u32, pch_checksum: [u8; MESSAGE_HEADER_CHECKSUM_SIZE],
}
pub const MESSAGE_HEADER_MESSAGE_START_SIZE: usize = 4;
pub const MESSAGE_HEADER_COMMAND_SIZE: usize = 12;
pub const MESSAGE_HEADER_MESSAGE_SIZE_SIZE: usize = 4;
pub const MESSAGE_HEADER_CHECKSUM_SIZE: usize = 4;
pub const MESSAGE_HEADER_MESSAGE_SIZE_OFFSET: usize = MESSAGE_HEADER_MESSAGE_START_SIZE + MESSAGE_HEADER_COMMAND_SIZE;
pub const MESSAGE_HEADER_CHECKSUM_OFFSET: usize = MESSAGE_HEADER_MESSAGE_SIZE_OFFSET + MESSAGE_HEADER_MESSAGE_SIZE_SIZE;
pub const MESSAGE_HEADER_HEADER_SIZE: usize = MESSAGE_HEADER_MESSAGE_START_SIZE + MESSAGE_HEADER_COMMAND_SIZE + MESSAGE_HEADER_MESSAGE_SIZE_SIZE + MESSAGE_HEADER_CHECKSUM_SIZE;
pub type MessageHeaderMessageStartChars = [u8; MESSAGE_HEADER_MESSAGE_START_SIZE];
lazy_static!{
}
impl MessageHeader {
pub fn new(
pch_message_start_in: &MessageHeaderMessageStartChars,
psz_command: *const u8,
n_message_size_in: u32) -> Self {
todo!();
}
pub fn get_command(&self) -> String {
todo!();
}
pub fn is_command_valid(&self) -> bool {
todo!();
}
}
pub const MSG_WITNESS_FLAG: u32 = 1 << 30;
pub const MSG_TYPE_MASK: u32 = 0xffffffff >> 2;
bitflags!{
pub struct GetDataMsg: u32 {
const UNDEFINED = 0;
const MSG_TX = 1;
const MSG_BLOCK = 2;
const MSG_WTX = 5;
const MSG_FILTERED_BLOCK = 3;
const MSG_CMPCT_BLOCK = 4;
const MSG_WITNESS_BLOCK = Self::MSG_BLOCK.bits | MSG_WITNESS_FLAG;
const MSG_WITNESS_TX = Self::MSG_TX.bits | MSG_WITNESS_FLAG;
}
}
#[derive(Clone,Debug,Serialize,Deserialize)]
pub struct Inv {
pub ty: u32,
pub hash: u256,
}
impl Into<GenTxId> for Inv {
fn into(self) -> GenTxId {
todo!();
}
}
impl Inv {
pub fn new(
type_in: u32,
hash_in: &u256) -> Self {
todo!();
}
pub fn get_command(&self) -> String {
todo!();
}
pub fn to_string(&self) -> String {
todo!();
}
pub fn is_msg_tx(&self) -> bool {
todo!();
}
pub fn is_msg_blk(&self) -> bool {
todo!();
}
pub fn is_msg_wtx(&self) -> bool {
todo!();
}
pub fn is_msg_filtered_blk(&self) -> bool {
todo!();
}
pub fn is_msg_cmpct_blk(&self) -> bool {
todo!();
}
pub fn is_msg_witness_blk(&self) -> bool {
todo!();
}
pub fn is_gen_tx_msg(&self) -> bool {
todo!();
}
pub fn is_gen_blk_msg(&self) -> bool {
todo!();
}
}
lazy_static!{
static ref INITIAL_BLOCK_DOWNLOAD_COMPLETED: AtomicBool = AtomicBool::new(false);
}
pub mod NetMsgType {
pub const VERSION: &'static str = "version";
pub const VERACK: &'static str = "verack";
pub const ADDR: &'static str = "addr";
pub const ADDRV2: &'static str = "addrv2";
pub const SENDADDRV2: &'static str = "sendaddrv2";
pub const INV: &'static str = "inv";
pub const GETDATA: &'static str = "getdata";
pub const MERKLEBLOCK: &'static str = "merkleblock";
pub const GETBLOCKS: &'static str = "getblocks";
pub const GETHEADERS: &'static str = "getheaders";
pub const TX: &'static str = "tx";
pub const HEADERS: &'static str = "headers";
pub const BLOCK: &'static str = "block";
pub const GETADDR: &'static str = "getaddr";
pub const MEMPOOL: &'static str = "mempool";
pub const PING: &'static str = "ping";
pub const PONG: &'static str = "pong";
pub const NOTFOUND: &'static str = "notfound";
pub const FILTERLOAD: &'static str = "filterload";
pub const FILTERADD: &'static str = "filteradd";
pub const FILTERCLEAR: &'static str = "filterclear";
pub const SENDHEADERS: &'static str = "sendheaders";
pub const FEEFILTER: &'static str = "feefilter";
pub const SENDCMPCT: &'static str = "sendcmpct";
pub const CMPCTBLOCK: &'static str = "cmpctblock";
pub const GETBLOCKTXN: &'static str = "getblocktxn";
pub const BLOCKTXN: &'static str = "blocktxn";
pub const GETCFILTERS: &'static str = "getcfilters";
pub const CFILTER: &'static str = "cfilter";
pub const GETCFHEADERS: &'static str = "getcfheaders";
pub const CFHEADERS: &'static str = "cfheaders";
pub const GETCFCHECKPT: &'static str = "getcfcheckpt";
pub const CFCHECKPT: &'static str = "cfcheckpt";
pub const WTXIDRELAY: &'static str = "wtxidrelay";
}
lazy_static!{
}
lazy_static!{
}
impl PartialEq<Inv> for Inv {
#[inline] fn eq(&self, other: &Inv) -> bool {
todo!();
}
}
impl Eq for Inv {}
impl Ord for Inv {
#[inline] fn cmp(&self, other: &Inv) -> Ordering {
todo!();
}
}
impl PartialOrd<Inv> for Inv {
#[inline] fn partial_cmp(&self, other: &Inv) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Default for Inv {
fn default() -> Self {
todo!();
}
}
pub fn get_all_net_message_types() -> &'static Vec<String> {
todo!();
}