Class MsgPackExtensionCodes
- Namespace
- ShapeShift.MsgPack
- Assembly
- ShapeShift.MsgPack.dll
The MessagePack extension type codes that ShapeShift reserves, reads, and writes.
public static class MsgPackExtensionCodes
- Inheritance
-
MsgPackExtensionCodes
- Inherited Members
Remarks
The MessagePack specification splits the signed 8-bit extension type space in two: codes
0 through 127 are application specific, while negative codes are reserved for the
specification itself (Timestamp being the only one defined so far). ShapeShift
therefore places every encoding it invents in the application-specific half, and claims a
contiguous block (ReservedInclusiveLowerBound through
ReservedInclusiveUpperBound) so that future ShapeShift features never have to
negotiate with codes an application may already be using for its own extensions.
Codes outside that block are opaque to ShapeShift: they decode as binary values so that unknown extension payloads survive an unknown-data round trip, and they are never produced by ShapeShift itself.
Payload shapes are fixed for each reserved code, and readers reject payloads whose length or type code does not match what the reader expects. Reserved codes ShapeShift does not (yet) define are rejected rather than silently treated as data.
Fields
BigInteger
A BigInteger, encoded as a variable length big-endian two's complement integer.
public const sbyte BigInteger = 103
Field Value
Decimal
A decimal, encoded as the four big-endian int words that GetBits(decimal) produces, in that order. Payloads are always 16 bytes.
public const sbyte Decimal = 100
Field Value
Int128
An Int128, encoded as a 16-byte big-endian two's complement integer.
public const sbyte Int128 = 101
Field Value
Reference
A reference to an object that appeared earlier in the same payload, written when ReferencePreservationMode is not Off.
public const sbyte Reference = 105
Field Value
Remarks
The payload is a big-endian unsigned integer of 1, 2, or 4 bytes identifying the 0-based order in which the referenced object was first written. Readers reject any other payload length.
ReservedInclusiveLowerBound
The first extension type code in the block ShapeShift reserves for itself.
public const sbyte ReservedInclusiveLowerBound = 100
Field Value
ReservedInclusiveUpperBound
The last extension type code in the block ShapeShift reserves for itself.
public const sbyte ReservedInclusiveUpperBound = 109
Field Value
TimeSpan
A TimeSpan, encoded as a big-endian signed 64-bit tick count. Payloads are always 8 bytes.
public const sbyte TimeSpan = 104
Field Value
Timestamp
The MessagePack specification's timestamp extension, used for DateTime and DateTimeOffset instants.
public const sbyte Timestamp = -1
Field Value
Remarks
Payloads are the standard 4-, 8-, or 12-byte timestamp encodings. This is the only negative (specification-reserved) code ShapeShift emits.
UInt128
A UInt128, encoded as a 16-byte big-endian unsigned integer.
public const sbyte UInt128 = 102
Field Value
Methods
IsReservedByShapeShift(sbyte)
Gets a value indicating whether a given extension type code falls within the block ShapeShift reserves.
public static bool IsReservedByShapeShift(sbyte typeCode)
Parameters
typeCodesbyteThe extension type code found in a payload.