Table of Contents

Class CatalogValidator

Namespace
Typhon.Protocol
Assembly
Typhon.Protocol.dll

Checks a catalog against the registration rules of 03-wire-protocol § 12 before anything is encoded or decoded against it.

public static class CatalogValidator
Inheritance
CatalogValidator
Inherited Members

Remarks

A server validates at Start, so a bad declaration fails the application, never a session; a client validates what it receives, so a broken or hostile server fails at WELCOME, never mid-stream. The rules are the ones that make decoding well-defined: widths the codecs accept, bounds a quantizer can use without losing the round trip, groups a u8 mask can address, grids whose cell index fits, lists whose elements decode as numbers, and built-ins whose shape is the engine's, not merely their name.

Hostile input is a catalog too. Every collection may contain null elements after a parse; each one is a problem, never a crash. A parameter the codec kind does not read is refused rather than ignored: a decoder that honoured, say, fixedBytes on a known codec would read a different width than the one that encoded it.

Fields

MaxGridCells

The most cells a grid may have: its cell index must fit comfortably in 32 bits and its counts in memory.

public const long MaxGridCells = 16777216

Field Value

long

Methods

IsListElement(CodecKind)

Whether a codec may be a list element: numeric, byte-aligned, and independent of the frame.

public static bool IsListElement(CodecKind kind)

Parameters

kind CodecKind

The element kind.

Returns

bool

true when allowed.

TakesCount(CodecKind)

Whether a codec may carry a count (W33): the byte-aligned scalar codecs. Never bool or bits (packed), the length-prefixed and raw codecs, entityRef, tickLo, a list, or a position, vector or quaternion codec — each of those is already a shape of its own.

public static bool TakesCount(CodecKind kind)

Parameters

kind CodecKind

The codec kind.

Returns

bool

true when a count is allowed.

Validate(Catalog)

Throws CatalogException listing every rule catalog breaks.

public static void Validate(Catalog catalog)

Parameters

catalog Catalog

The catalog, canonical or as declared.