UnknownPacket
sealed class
Represents a packet whose wire id has no mapping in the registry for the current phase and direction.
Declaration
public sealed class UnknownPacket : IPacket
| Namespace | McProtoNet.Protocol |
| Assembly | McProtoNet.Protocol.dll |
| Source | src/McProtoNet.Protocol/Flow/UnknownPacket.cs#L18 ↗ |
Implements: IPacket
Remarks
The instance carries the wire id, the phase and the direction, but no body. The raw bytes stay
with the raw packet that was dispatched, so they are not copied here; a consumer that needs the
body keeps that packet through its Retain method instead.
An unmapped id is a normal condition of the stream and is not an error. The type implements
IPacket so that mapped and unmapped packets share one type in a switch.
Constructors
| Signature | Description |
|---|---|
UnknownPacket(int id, PacketPhase phase, PacketDirection direction) | Initializes a new instance of the UnknownPacket class with the specified wire id, phase and direction. |
UnknownPacket(int, PacketPhase, PacketDirection)
public UnknownPacket(int id, PacketPhase phase, PacketDirection direction)
Initializes a new instance of the UnknownPacket class with the specified wire id,
phase and direction.
Parameters: id (int), phase (PacketPhase), direction (PacketDirection)
Exceptions: ArgumentOutOfRangeException - phase is not a defined value. -or- direction is not a defined value.
Properties
| Signature | Description |
|---|---|
PacketDirection Direction | Gets the direction in which the packet travelled. |
int Id | Gets the wire id that had no mapping in the registry. |
PacketIdentity Identity | Gets the identity of the unmapped packet. |
PacketPhase Phase | Gets the protocol phase in which the packet arrived. |
Direction
public PacketDirection Direction { get; }
Gets the direction in which the packet travelled.
Returns: PacketDirection
Id
public int Id { get; }
Gets the wire id that had no mapping in the registry.
Returns: int
Identity
public PacketIdentity Identity { get; }
Gets the identity of the unmapped packet.
An unmapped id has no key, name or ordinal of its own. UnknownPacket.Id holds the only wire
fact this packet carries.
Returns: PacketIdentity - A PacketIdentity whose phase and direction are those of the received packet and whose key, name and ordinal are UnknownPacket.UnmappedKey, UnknownPacket.UnmappedName and UnknownPacket.UnmappedOrdinal.
Phase
public PacketPhase Phase { get; }
Gets the protocol phase in which the packet arrived.
Returns: PacketPhase
Fields
| Signature | Description |
|---|---|
const string UnmappedKey = "unknown" | The manifest key reported by UnknownPacket.Identity. |
const string UnmappedName = "Unknown" | The packet name reported by UnknownPacket.Identity. |
const ushort UnmappedOrdinal = 65535 | The ordinal reported by UnknownPacket.Identity. |
UnmappedKey
public const string UnmappedKey = "unknown"
The manifest key reported by UnknownPacket.Identity.
Manifest keys are dotted, such as play.toClient.teams, so this key collides with none of
them.
Returns: string
UnmappedName
public const string UnmappedName = "Unknown"
The packet name reported by UnknownPacket.Identity.
Returns: string
UnmappedOrdinal
public const ushort UnmappedOrdinal = 65535
The ordinal reported by UnknownPacket.Identity.
Catalog ordinals are dense from zero and every catalog is far smaller than this value, so the value belongs to no packet and marks an identity outside the catalog.
Returns: ushort