Skip to main content

Unity.Networking.Transport.Utilities.ReliableUtility

Inherited Members#

ValueType.Equals(Object)

ValueType.GetHashCode()

ValueType.ToString()

Object.Equals(Object, Object)

Object.GetType()

Object.ReferenceEquals(Object, Object)

Namespace: System.Dynamic.ExpandoObject#
Assembly: transport.dll#
Syntax#
public struct ReliableUtility

DefaultMinimumResendTime#

Declaration#

public const int DefaultMinimumResendTime = 64

Field Value#

TypeDescription
System.Int32

MaximumResendTime#

Declaration#

public const int MaximumResendTime = 200

Field Value#

TypeDescription
System.Int32

NullEntry#

Declaration#

public const int NullEntry = -1

Field Value#

TypeDescription
System.Int32

#

CalculateProcessingTime(Byte*, UInt16, Int64)#

Declaration#

public static ushort CalculateProcessingTime(byte *sharedBuffer, ushort sequenceId, long timestamp)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId
System.Int64timestamp

Returns#

TypeDescription
System.UInt16

GetLocalPacketTimer(Byte*, UInt16)#

Declaration#

public static ReliableUtility.PacketTimers*GetLocalPacketTimer(byte *sharedBuffer, ushort sequenceId)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId

Returns#

TypeDescription
ReliableUtility.PacketTimers*

GetPacket(Byte*, Int32)#

Declaration#

public static ReliableUtility.Packet*GetPacket(byte *self, int sequence)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence

Returns#

TypeDescription
ReliableUtility.Packet*

GetPacketInformation(Byte*, Int32)#

Declaration#

public static ReliableUtility.PacketInformation*GetPacketInformation(byte *self, int sequence)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence

Returns#

TypeDescription
ReliableUtility.PacketInformation*

GetRemotePacketTimer(Byte*, UInt16)#

Declaration#

public static ReliableUtility.PacketTimers*GetRemotePacketTimer(byte *sharedBuffer, ushort sequenceId)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId

Returns#

TypeDescription
ReliableUtility.PacketTimers*

InitializeContext(Byte*, Int32, Byte*, Int32, Byte*, Int32, ReliableUtility.Parameters)#

Declaration#

public static ReliableUtility.SharedContext InitializeContext(byte *sharedBuffer, int sharedBufferLength, byte *sendBuffer, int sendBufferLength, byte *recvBuffer, int recvBufferLength, ReliableUtility.Parameters param)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.Int32sharedBufferLength
System.Byte*sendBuffer
System.Int32sendBufferLength
System.Byte*recvBuffer
System.Int32recvBufferLength
ReliableUtility.Parametersparam

Returns#

TypeDescription
ReliableUtility.SharedContext

InitializeProcessContext(Byte*, Int32, ReliableUtility.Parameters)#

Declaration#

public static int InitializeProcessContext(byte *buffer, int bufferLength, ReliableUtility.Parameters param)

Parameters#

TypeNameDescription
System.Byte*buffer
System.Int32bufferLength
ReliableUtility.Parametersparam

Returns#

TypeDescription
System.Int32

ProcessCapacityNeeded(ReliableUtility.Parameters)#

Declaration#

public static int ProcessCapacityNeeded(ReliableUtility.Parameters param)

Parameters#

TypeNameDescription
ReliableUtility.Parametersparam

Returns#

TypeDescription
System.Int32

Read(NetworkPipelineContext, ReliableUtility.PacketHeader)#

Read header data and update reliability tracking information in the shared context.

  • If the packets sequence ID is lower than the last received ID+1, then it's stale
  • If the packets sequence ID is higher, then we'll process it and update tracking info in the shared context

Declaration#

public static int Read(NetworkPipelineContext context, ReliableUtility.PacketHeader header)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, the reliability shared state is used here.
ReliableUtility.PacketHeaderheaderPacket header of a new received packet.

Returns#

TypeDescription
System.Int32Sequence ID of the received packet.

ReadAckPacket(NetworkPipelineContext, ReliableUtility.PacketHeader)#

Declaration#

public static void ReadAckPacket(NetworkPipelineContext context, ReliableUtility.PacketHeader header)

Parameters#

TypeNameDescription
NetworkPipelineContextcontext
ReliableUtility.PacketHeaderheader

Release(Byte*, Int32)#

Declaration#

public static void Release(byte *self, int sequence)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence

Release(Byte*, Int32, Int32)#

Declaration#

public static void Release(byte *self, int start_sequence, int count)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32start_sequence
System.Int32count

ReleaseOrResumePackets(NetworkPipelineContext)#

Acknowledge the reception of packets which have been sent. The reliability shared context/state is updated when packets are received from the other end of the connection. The other side will update it's ackmask with which packets have been received (starting from last received sequence ID) each time it sends a packet back. This checks the resend timers on each non-acknowledged packet and notifies if it's time to resend yet.

Declaration#

public static bool ReleaseOrResumePackets(NetworkPipelineContext context)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, contains the buffer slices this pipeline connection owns.

Returns#

TypeDescription
System.Boolean

ResumeReceive(NetworkPipelineContext, Int32, ref Boolean)#

Resume or play back a packet we had received earlier out of order. When an out of order packet is received it is stored since we need to first return the packet with the next sequence ID. When that packet finally arrives it is returned but a pipeline resume is requested since we already have the next packet stored and it can be processed immediately after.

Declaration#

public static InboundRecvBuffer ResumeReceive(NetworkPipelineContext context, int startSequence, ref bool needsResume)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, we'll use both the shared reliability context and receive context.
System.Int32startSequenceThe first packet which we need to retrieve now, there could be more after that.
System.BooleanneedsResumeIndicates if we need the pipeline to resume again.

Returns#

TypeDescription
InboundRecvBuffer

ResumeSend(NetworkPipelineContext, out ReliableUtility.PacketHeader, ref Boolean)#

Resend a packet which we have not received an acknowledgement for in time. Pipeline resume will be enabled if there are more packets which we need to resend. The send reliability context will then also be updated to track the next packet we need to resume.

Declaration#

public static InboundSendBuffer ResumeSend(NetworkPipelineContext context, out ReliableUtility.PacketHeader header, ref bool needsResume)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, we'll use both the shared reliability context and send context.
ReliableUtility.PacketHeaderheaderPacket header for the packet payload we're resending.
System.BooleanneedsResumeIndicates if a pipeline resume is needed again.

Returns#

TypeDescription
InboundSendBufferBuffer slice to packet payload.

Exceptions#

TypeCondition
System.InvalidOperationException

SetHeaderAndPacket(Byte*, Int32, ReliableUtility.PacketHeader, InboundSendBuffer, Int64)#

Write packet, packet header and tracking information to the given buffer space. This buffer should contain the reliability Context at the front, that contains the capacity of the buffer and pointer offsets needed to find the slots we can copy the packet to.

Declaration#

public static void SetHeaderAndPacket(byte *self, int sequence, ReliableUtility.PacketHeader header, InboundSendBuffer data, long timestamp)

Parameters#

TypeNameDescription
System.Byte*selfBuffer space where we can store packets.
System.Int32sequenceThe sequence ID of the packet, this is used to find a slot inside the buffer.
ReliableUtility.PacketHeaderheaderThe packet header which we'll store with the packet payload.
InboundSendBufferdataThe packet data which we're storing.
System.Int64timestamp

Exceptions#

TypeCondition
System.OverflowException

SetMinimumResendTime(Int32, NetworkDriver, NetworkPipeline, NetworkConnection)#

Declaration#

public static void SetMinimumResendTime(int value, NetworkDriver driver, NetworkPipeline pipeline, NetworkConnection con)

Parameters#

TypeNameDescription
System.Int32value
NetworkDriverdriver
NetworkPipelinepipeline
NetworkConnectioncon

SetPacket(Byte*, Int32, Void*, Int32)#

Declaration#

public static void SetPacket(byte *self, int sequence, void *data, int length)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence
System.Void*data
System.Int32length

SetPacket(Byte*, Int32, InboundRecvBuffer)#

Declaration#

public static void SetPacket(byte *self, int sequence, InboundRecvBuffer data)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence
InboundRecvBufferdata

SharedCapacityNeeded(ReliableUtility.Parameters)#

Declaration#

public static int SharedCapacityNeeded(ReliableUtility.Parameters param)

Parameters#

TypeNameDescription
ReliableUtility.Parametersparam

Returns#

TypeDescription
System.Int32

ShouldSendAck(NetworkPipelineContext)#

Declaration#

public static bool ShouldSendAck(NetworkPipelineContext ctx)

Parameters#

TypeNameDescription
NetworkPipelineContextctx

Returns#

TypeDescription
System.Boolean

StoreReceiveTimestamp(Byte*, UInt16, Int64, UInt16)#

Declaration#

public static void StoreReceiveTimestamp(byte *sharedBuffer, ushort sequenceId, long timestamp, ushort processingTime)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId
System.Int64timestamp
System.UInt16processingTime

StoreRemoteReceiveTimestamp(Byte*, UInt16, Int64)#

Declaration#

public static void StoreRemoteReceiveTimestamp(byte *sharedBuffer, ushort sequenceId, long timestamp)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId
System.Int64timestamp

StoreTimestamp(Byte*, UInt16, Int64)#

Declaration#

public static void StoreTimestamp(byte *sharedBuffer, ushort sequenceId, long timestamp)

Parameters#

TypeNameDescription
System.Byte*sharedBuffer
System.UInt16sequenceId
System.Int64timestamp

TryAquire(Byte*, Int32)#

Declaration#

public static bool TryAquire(byte *self, int sequence)

Parameters#

TypeNameDescription
System.Byte*self
System.Int32sequence

Returns#

TypeDescription
System.Boolean

Write(NetworkPipelineContext, InboundSendBuffer, ref ReliableUtility.PacketHeader)#

Store the packet for possible later resends, and fill in the header we'll use to send it (populate with sequence ID, last acknowledged ID from remote with ackmask.

Declaration#

public static int Write(NetworkPipelineContext context, InboundSendBuffer inboundBuffer, ref ReliableUtility.PacketHeader header)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, the reliability shared state is used here.
InboundSendBufferinboundBufferBuffer with packet data.
ReliableUtility.PacketHeaderheaderPacket header which will be populated.

Returns#

TypeDescription
System.Int32Sequence ID assigned to this packet.

WriteAckPacket(NetworkPipelineContext, ref ReliableUtility.PacketHeader)#

Write an ack packet, only the packet header is used and this doesn't advance the sequence ID. The packet is not stored away for resend routine.

Declaration#

public static void WriteAckPacket(NetworkPipelineContext context, ref ReliableUtility.PacketHeader header)

Parameters#

TypeNameDescription
NetworkPipelineContextcontextPipeline context, the reliability shared state is used here.
ReliableUtility.PacketHeaderheaderPacket header which will be populated.