Skip to content

C# - Enums And Constants

The C# SDK uses the frozen NNRP/1 Preview4 names and numeric values. Public role APIs expose typed enums; callers must not send arbitrary integers for protocol fields.

csharp
using Nnrp.Core;
using Nnrp.Runtime;

Message Types

MessageType : byte is grouped by wire function.

GroupMembers and values
Connection/sessionClientHello=0x01, ServerHelloAck=0x02, SessionPatch=0x03, SessionPatchAck=0x04, Close=0x05, Error=0x06, SessionOpen=0x07, SessionOpenAck=0x08, SessionClose=0x09, SessionCloseAck=0x0A
Data/cache/flowFrameSubmit=0x10, FrameCancel=0x11, ResultPush=0x12, ResultDrop=0x13, CachePut=0x14, CacheAck=0x15, CacheInvalidate=0x16, FlowUpdate=0x17, ResultHint=0x18, TransportProbe=0x19, TransportProbeAck=0x1A, SessionMigrate=0x1B, SessionMigrateAck=0x1C
KeepalivePing=0x20, Pong=0x21
Runtime controlCancel=0x30, Abort=0x31, PriorityUpdate=0x32, Deadline=0x33, ExpireAt=0x34, Supersede=0x35, BudgetUpdate=0x36, Progress=0x37, PartialResult=0x38, Backpressure=0x39, CreditUpdate=0x3A, CapabilityNegotiation=0x3B, DegradeProfile=0x3C, RouteHint=0x3D, ExecutionHint=0x3E, TraceContext=0x3F, ResultDropReason=0x40
Runtime objects/cacheObjectDeclare=0x41, ObjectRef=0x42, ObjectRelease=0x43, ObjectPatch=0x44, ObjectDelta=0x45, CacheReference=0x46, CacheMiss=0x47, ErrorRecoverable=0x48, RetryAfter=0x49

Common Header

HeaderFlags : uint is a bitmask.

MemberValue
None0x00000000
AckRequired0x00000001
CanDrop0x00000002
Stale0x00000004
Eos0x00000008
Retransmit0x00000010
Keyframe0x00000020

The wire format itself is the byte value NnrpHeader.CurrentWireFormat; the SDK does not expose a separate WireFormat enum.

Session Lifecycle

EnumMembers
SessionPriorityClass : byteInteractive=0, Balanced=1, Background=2
SessionFlags : byteNone=0, AllowResume=0x01, AllowBackgroundResults=0x02, AllowCacheLeases=0x04, AllowSchemaOverride=0x08
SessionStatus : byteOpened=0, Rejected=1, RetryLater=2, Resumed=3
SessionAckFlags : uintNone=0, ResumeEnabled=0x01, BackgroundResultsEnabled=0x02, CacheLeasesEnabled=0x04, SchemaOverrideEnabled=0x08, PriorityDowngraded=0x10
SessionCloseReason : ushortNormal=0, ClientShutdown=1, ServerShutdown=2, IdleTimeout=3, ProtocolError=4, AuthRevoked=5
InFlightPolicy : byteDrain=0, Abort=1
SessionCloseStatus : byteAcknowledged=0, Draining=1, Closed=2, Rejected=3
NnrpSessionState : byteInit=0, Negotiating=1, Active=2, Draining=3, Closed=4

SessionErrorCode : uint, CacheErrorCode : uint, and SchemaErrorCode : uint preserve the namespaced protocol values. See the protocol standard for the complete code registry.

Transport Selection

EnumMembers
TransportId : uintUnspecified=0, Quic=1, Tcp=2, Ipc=3, WebSocket=4
TransportPolicy : byteAuto=0, PreferQuic=1, PreferTcp=2, PreferIpc=3, PreferWebSocket=4, ForceQuic=5, ForceTcp=6, ForceIpc=7, ForceWebSocket=8
LossTolerance : byteStrict=0, BestEffort=1, LowLatency=2, FireAndForget=3

Auto probes every installed provider and applies the deterministic comparator documented in the transport API. A force policy never silently selects another provider.

Data And Results

EnumMembers
FrameClass : byteKeyframe=0, Delta=1, Retransmit=2, Discardable=3
InputProfile : byteUnspecified=0, ChangedTilesLuma=1, DenseLumaFrame=2
TileIndexMode : byteDenseRange=0, RawUInt16=1, DeltaUInt16=2, Bitset=3
CodecId : byteRaw=0, Lz4=1
DTypeId : byteFloat16=0, Float32=1, Float8E4M3=2, Float8E5M2=3, Int8=4, UInt8=5, Int16=6, UInt16=7
TensorLayoutId : byteNhwc=0, Nchw=1
ScalePolicy : byteNone=0, PerTensor=1, PerTile=2, PerChannel=3
SubmitMode : byteInline=0, Reference=1, Mixed=2
ResultClass : byteComplete=0, Partial=1, StaleReuse=2, Degraded=3

BudgetPolicy : byte, ResultFlags : ushort, and PayloadKind : uint are bitmasks. Combine their named values with |; do not add their numeric values.

Cache

EnumMembers
CacheObjectKind : uintCameraBlock=0x0001, TileIndexTemplate=0x0002, TensorSectionTable=0x0003, CodecTable=0x0004, ReusableResultObject=0x0005, PayloadLayoutTemplate=0x0006, PromptSegment=0x0007, ToolSchema=0x0008, StructuredEventSchema=0x0009
CacheAckStatus : uintAccepted=0, Rejected=1, Replaced=2
CacheInvalidateScope : uintWholeSession=0, Namespace=1, ObjectKind=2, ObjectKey=3
CachePutFlags : uintNone=0, Pinned=0x01, Reusable=0x02
CacheLeaseOwnerScope : byteConnection=0, Session=1, Operation=2
CacheValidationFailureNone=0, Miss=1, LeaseExpired=2, VersionMismatch=3, DependencyInvalid=4, SchemaMismatch=5

Alias members in low-level cache enums represent identical wire values; role APIs use the canonical member names shown above.

Runtime Control And Objects

EnumMembers
RuntimeRole : byteUnspecified=0, Client=1, Server=2, Runtime=3, Subagent=4, Tool=5, Scheduler=6, ConformanceRunner=7
RuntimeObjectKind : ushortUnspecified=0, Tensor=1, TokenBlock=2, ImageTile=3, FeatureMap=4, ToolResult=5, TraceSegment=6, OpaqueBytes=7, DocumentChunk=8, AudioChunk=9, VideoChunk=10, RoutePlan=11, CacheManifest=12
MemoryLocationHint : ushortUnspecified=0, HostMemory=1, DeviceMemory=2, SharedMemory=3, RemoteMemory=4, MmapFile=5, ObjectStore=6
OwnershipHint : ushortUnspecified=0, ProducerOwned=1, ConsumerOwned=2, SessionOwned=3, Borrowed=4, TransferOnRef=5, ReleaseOnDrop=6
ObjectReleaseReason : ushortCompleted=0, Cancelled=1, Expired=2, Replaced=3, Invalidated=4, OwnerClosed=5, LeaseExpired=6, ConformanceInjection=7
CacheReuseScope : ushortOperation=0, Session=1, Connection=2, Global=3, Tenant=4, Profile=5
CacheMissReason : ushortUnknown=0, NotFound=1, Expired=2, Invalidated=3, SchemaMismatch=4, ProducerUnavailable=5, LeaseRequired=6, PermissionDenied=7

Runtime reason, stage, priority, pressure, executor, affinity, and result-drop code fields use the typed Preview4 code wrappers described in the runtime API. Reserved and private-use ranges are preserved; unknown values remain observable instead of being collapsed to a generic error.

NNRP Documentation