Show / Hide Table of Contents

Struct Header

The header of a multiplex message.

Inherited Members
ValueType.Equals(Object)
ValueType.GetHashCode()
ValueType.ToString()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: PeerTalk.Multiplex
Assembly: PeerTalk.dll
Syntax
public struct Header
Remarks

The header of a multiplex message contains the StreamId and PacketType encoded as a Varint.

Fields

| Improve this Doc View Source

MaxStreamId

The largest possible value of a StreamId.

Declaration
public const long MaxStreamId = 1152921504606846975L
Field Value
Type Description
Int64

long.MaxValue >> 3.

| Improve this Doc View Source

MinStreamId

The smallest possible value of a StreamId.

Declaration
public const long MinStreamId = 0L
Field Value
Type Description
Int64

Zero.

| Improve this Doc View Source

PacketType

The purpose of the multiplex message.

Declaration
public PacketType PacketType
Field Value
Type Description
PacketType

One of the PacketType enumeration values.

| Improve this Doc View Source

StreamId

The stream identifier.

Declaration
public long StreamId
Field Value
Type Description
Int64

The session initiator allocates odd IDs and the session receiver allocates even IDs.

Methods

| Improve this Doc View Source

ReadAsync(Stream, CancellationToken)

Reads the header from the specified Stream.

Declaration
public static Task<Header> ReadAsync(Stream stream, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Stream stream

The source Stream for the header.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Header>

A task that represents the asynchronous operation. The task's result is the decoded Header.

| Improve this Doc View Source

WriteAsync(Stream, CancellationToken)

Writes the header to the specified Stream.

Declaration
public Task WriteAsync(Stream stream, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Stream stream

The destination Stream for the header.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task

A task that represents the asynchronous operation.

See Also

https://github.com/libp2p/mplex
  • Improve this Doc
  • View Source
Back to top Generated by DocFX