Show / Hide Table of Contents

Class NetMQMessageCodec

Inheritance
Object
NetMQMessageCodec
Implements
IMessageCodec<NetMQ.NetMQMessage>
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Net.Messages
Assembly: Libplanet.Net.dll
Syntax
public class NetMQMessageCodec : IMessageCodec<NetMQMessage>

Constructors

| Improve this Doc View Source

NetMQMessageCodec()

Creates a NetMQMessageCodec instance.

Declaration
public NetMQMessageCodec()

Fields

| Improve this Doc View Source

CommonFrames

Declaration
public static readonly int CommonFrames
Field Value
Type Description
Int32

Methods

| Improve this Doc View Source

Decode(NetMQMessage, Boolean)

Decodes given -typed encoded into Message and checks its validity. Encode(MessageContent, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset, Byte[])

Declaration
public Message Decode(NetMQMessage encoded, bool reply)
Parameters
Type Name Description
NetMQ.NetMQMessage encoded
Boolean reply

A flag to express whether the target is a reply of other message.

Returns
Type Description
Message

A Message parsed from encoded.

Exceptions
Type Condition
ArgumentException

Thrown when empty encoded is given.

InvalidMessageSignatureException

Thrown when the signer of encoded is invalid.

| Improve this Doc View Source

Encode(MessageContent, PrivateKey, AppProtocolVersion, BoundPeer, DateTimeOffset, Byte[])

Encodes the message to -typed instance with given privateKey and peer.

Declaration
public NetMQMessage Encode(MessageContent content, PrivateKey privateKey, AppProtocolVersion appProtocolVersion, BoundPeer peer, DateTimeOffset timestamp, byte[] identity = null)
Parameters
Type Name Description
MessageContent content

The message body to encode.

PrivateKey privateKey

The PrivateKey to sign the encoded message.

AppProtocolVersion appProtocolVersion

The AppProtocolVersion of the transport layer.

BoundPeer peer

The BoundPeer-typed representation of the transport layer. AsPeer

DateTimeOffset timestamp

The DateTimeOffset of the time content is encoded.

Byte[] identity

The byte array identifies the message to match between message and its respond used in NetMQ.

Returns
Type Description
NetMQ.NetMQMessage

A containing the signed MessageContent.

Exceptions
Type Condition
InvalidCredentialException

Thrown when privateKey's PublicKey does not match that of peer.

| Improve this Doc View Source

ParseMessageType(NetMQMessage, Boolean)

Parses a MessageContent.MessageType from given NetMQ.NetMQMessage.

Declaration
public MessageContent.MessageType ParseMessageType(NetMQMessage encoded, bool reply)
Parameters
Type Name Description
NetMQ.NetMQMessage encoded

A encoded NetMQ.NetMQMessage.

Boolean reply

A flag to express whether the target is a reply of other message.

Returns
Type Description
MessageContent.MessageType

Returns a MessageContent.MessageType of given encoded. If given value cannot be interpreted in MessageContent.MessageType, this would return a integer number.

Exceptions
Type Condition
IndexOutOfRangeException

Thrown if given NetMQ.NetMQMessage has not enough NetMQ.NetMQFrame for parsing a message type.

Implements

IMessageCodec<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium