[][src]Module grin_p2p::msg

Message types that transit over the network and related serialization code.

Structs

BanReason
GetPeerAddrs

Ask for other peers addresses, required for network discovery.

Hand

First part of a handshake, sender advertises its version and characteristics.

Headers

Serializable wrapper for a list of block headers.

Locator

Serializable wrapper for the block locator.

MsgHeader

Header of any protocol message, used to identify incoming messages.

PeerAddrs

Peer addresses we know of that are fresh enough, in response to GetPeerAddrs.

PeerError

We found some issue in the communication, sending an error back, usually followed by closing the connection.

Ping
Pong
Shake

Second part of a handshake, receiver of the first part replies with its own version and characteristics.

SockAddr

Only necessary so we can implement Readable and Writeable. Rust disallows implementing traits when both types are outside of this crate (which is the case for SocketAddr and Readable/Writeable).

TxHashSetArchive

Response to a txhashset archive request, must include a zip stream of the archive after the message body.

TxHashSetRequest

Request to get an archive of the full txhashset store, required to sync a new node.

Enums

Type

Constants

PROTOCOL_VERSION

Current latest version of the protocol

USER_AGENT

Grin's user agent with current version

Functions

read_body

Read a message body from the provided stream, always blocking until we have a result (or timeout).

read_header

Read a header from the provided stream without blocking if the underlying stream is async. Typically headers will be polled for, so we do not want to block.

read_item

Read a single item from the provided stream, always blocking until we have a result (or timeout). Returns the item and the total bytes read.

read_message

Reads a full message from the underlying stream.

write_message
write_to_buf