Skip to main content

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
NamespaceMcProtoNet.Protocol
AssemblyMcProtoNet.Protocol.dll
Sourcesrc/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 live in a transport window that is valid only until the next read, so they are not exposed here; a consumer that needs the body reads the raw packet stream 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

SignatureDescription
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 (Int32), phase (PacketPhase), direction (PacketDirection)

Exceptions: ArgumentOutOfRangeException - <code class="paramref">phase</code> is not a defined value. -or- <code class="paramref">direction</code> is not a defined value.

Properties

SignatureDescription
PacketDirection DirectionGets the direction in which the packet travelled.
int IdGets the wire id that had no mapping in the registry.
PacketIdentity IdentityGets the identity of the unmapped packet.
PacketPhase PhaseGets 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: Int32

Identity

public PacketIdentity Identity { get; }

Gets the identity of the unmapped packet.

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

SignatureDescription
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 = 65535The ordinal reported by UnknownPacket.Identity.

UnmappedKey

public const string UnmappedKey = "unknown"

The manifest key reported by UnknownPacket.Identity.

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.

Returns: UInt16