message

package
v0.5.1-alpha-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgHdrLen      = 24
	MsgCmdLen      = 12
	MsgCmdOffset   = 4
	MsgChecksumLen = 4
	NetID          = 0x00000000
	MaxHdrCnt      = 500
	MaxInvHdrCnt   = 500
	HashLen        = 32
)

Variables

This section is empty.

Functions

func GetHeadersFromHash

func GetHeadersFromHash(startHash Uint256, stopHash Uint256) ([]ledger.Header, uint32, error)

func HandleNodeMsg

func HandleNodeMsg(node Noder, buf []byte) error

func MsgType

func MsgType(buf []byte) (string, error)

func NewBlock

func NewBlock(bk *ledger.Block) ([]byte, error)

func NewBlockFromHash

func NewBlockFromHash(hash common.Uint256) (*ledger.Block, error)

func NewHeaders

func NewHeaders(headers []ledger.Header, count uint32) ([]byte, error)

func NewHeadersReq

func NewHeadersReq(stopHash Uint256) ([]byte, error)

func NewIsingConsensus

func NewIsingConsensus(pld *IsingPayload) ([]byte, error)

func NewNotFound

func NewNotFound(hash common.Uint256) ([]byte, error)

func NewTxn

func NewTxn(txn *transaction.Transaction) ([]byte, error)

func NewTxnFromHash

func NewTxnFromHash(hash common.Uint256) (*transaction.Transaction, error)

func PayloadLen

func PayloadLen(buf []byte) int

func ReqBlkData

func ReqBlkData(node Noder, hash common.Uint256) error

func ReqTxnPool

func ReqTxnPool(node Noder) error

func SendMsgSyncHeaders

func SendMsgSyncHeaders(node Noder, stopHash Uint256)

func ValidMsgHdr

func ValidMsgHdr(buf []byte) bool

Types

type IsingMessage

type IsingMessage struct {
	// contains filtered or unexported fields
}

func (*IsingMessage) Deserialize

func (p *IsingMessage) Deserialize(r io.Reader) error

func (IsingMessage) Handle

func (msg IsingMessage) Handle(node Noder) error

func (*IsingMessage) Serialize

func (p *IsingMessage) Serialize(w io.Writer) error

func (IsingMessage) Verify

func (hdr IsingMessage) Verify(buf []byte) error

Verify the message header information @p payload of the message

type IsingPayload

type IsingPayload struct {
	PayloadData []byte
	Sender      *crypto.PubKey
	Signature   []byte
}

func (*IsingPayload) DataHash

func (p *IsingPayload) DataHash() ([]byte, error)

func (*IsingPayload) Deserialize

func (p *IsingPayload) Deserialize(r io.Reader) error

func (*IsingPayload) DeserializeUnsigned

func (p *IsingPayload) DeserializeUnsigned(r io.Reader) error

func (*IsingPayload) Serialize

func (p *IsingPayload) Serialize(w io.Writer) error

func (*IsingPayload) SerializeUnsigned

func (p *IsingPayload) SerializeUnsigned(w io.Writer) error

type Messenger

type Messenger interface {
	Verify([]byte) error
	Handle(Noder) error
	serialization.SerializableData
}

func AllocMsg

func AllocMsg(t string, length int) Messenger

Alloc different message stucture @t the message name or type @len the message length only valid for varible length structure

Return: @Messenger the Messenger interface @error error code FixMe fix the ugly multiple return.

func ParseMsg

func ParseMsg(buf []byte) (Messenger, error)

type NotifyInfo

type NotifyInfo struct {
	Payload  *IsingPayload
	SenderID uint64
}

type RelayMessage

type RelayMessage struct {
	Packet RelayPacket
	// contains filtered or unexported fields
}

func NewRelayMessage

func NewRelayMessage(packet *RelayPacket) (*RelayMessage, error)

func (*RelayMessage) Deserialize

func (msg *RelayMessage) Deserialize(r io.Reader) error

func (RelayMessage) Handle

func (msg RelayMessage) Handle(node protocol.Noder) error

func (*RelayMessage) Serialize

func (msg *RelayMessage) Serialize(w io.Writer) error

func (*RelayMessage) ToBytes

func (msg *RelayMessage) ToBytes() ([]byte, error)

func (RelayMessage) Verify

func (hdr RelayMessage) Verify(buf []byte) error

Verify the message header information @p payload of the message

type RelayPacket

type RelayPacket struct {
	SrcAddr           string
	DestID            []byte
	Payload           []byte
	SigChain          *por.SigChain
	MaxHoldingSeconds uint32
}

func NewRelayPacket

func NewRelayPacket(srcAddr string, destID, payload []byte, sigChain *por.SigChain, maxHoldingSeconds uint32) (*RelayPacket, error)

func (*RelayPacket) Deserialize

func (packet *RelayPacket) Deserialize(r io.Reader) error

func (*RelayPacket) Serialize

func (packet *RelayPacket) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL