Table of Contents

Class CommandsMessage

Namespace
Typhon.Protocol
Assembly
Typhon.Protocol.dll

COMMANDS (0x83): u32 clientTick | varu count ≥ 1 | (varu cmdTypeIdx | u16 seq | fields)*, the client's batch for one rendered frame.

public static class CommandsMessage
Inheritance
CommandsMessage
Inherited Members

Remarks

Validated whole before anything is delivered (03-wire-protocol § 8: known type → length consumed exactly → decode). The message is decoded once into a checking sink — every type known, every enum value within its names (W13), not a byte left over — and only then decoded again into the caller's sink, so a malformed tail can never deliver the valid commands in front of it. Commands are small and rate-limited; decoding twice costs nothing measurable.

Methods

Read<TSink>(ReadOnlySpan<byte>, CatalogPlan, ref TSink, RealmFrame)

Validates, then decodes, a whole COMMANDS message, type byte included.

public static void Read<TSink>(ReadOnlySpan<byte> message, CatalogPlan plan, ref TSink sink, RealmFrame frame = null) where TSink : ICommandSink, allows ref struct

Parameters

message ReadOnlySpan<byte>

The message.

plan CatalogPlan

The session's compiled catalog.

sink TSink

Receives the commands, only once the whole message has been validated.

frame RealmFrame

The realm frame a realm-framed field decodes over, at CommandPositionBits.

Type Parameters

TSink

The sink type.

Exceptions

WireFormatException

The message is malformed; nothing reached sink.

Write(ref WireWriter, uint, IReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)>, RealmFrame)

Writes a COMMANDS message, type byte included.

public static void Write(ref WireWriter w, uint clientTick, IReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)> commands, RealmFrame frame = null)

Parameters

w WireWriter

The writer.

clientTick uint

The client's tick for the batch.

commands IReadOnlyList<(MessagePlan Type, ushort Seq, RecordValues Values)>

At least one command: its type, sequence and field values.

frame RealmFrame

The session's realm frame: a realm-framed field travels over its bounds at CommandPositionBits (ForCommands).

WriteCommand(ref WireWriter, MessagePlan, ushort, RecordValues, RealmFrame)

Writes one command of a COMMANDS message — varu cmdTypeIdx | u16 seq | fields — for a caller that writes the header itself.

public static void WriteCommand(ref WireWriter w, MessagePlan type, ushort seq, RecordValues values, RealmFrame commandFrame)

Parameters

w WireWriter

The writer.

type MessagePlan

The command type.

seq ushort

Its sequence number.

values RecordValues

Its field values, by name.

commandFrame RealmFrame

The realm frame at command width (ForCommands), or null.

WriteCommand<T>(ref WireWriter, MessageBinding<T>, ushort, in T, RealmFrame)

Writes one command of a COMMANDS message from its struct, through a MessageBinding<T>: no name lookup, no allocation.

public static void WriteCommand<T>(ref WireWriter w, MessageBinding<T> binding, ushort seq, in T command, RealmFrame commandFrame) where T : unmanaged, IReplicatedMessage

Parameters

w WireWriter

The writer.

binding MessageBinding<T>

The struct bound to the catalog's command.

seq ushort

Its sequence number.

command T

The command.

commandFrame RealmFrame

The realm frame at command width (ForCommands), or null.

Type Parameters

T

The command struct.