MiniQuake

src/miniquake/net_datagram.ml

Package
miniquake.net_datagram
Reachable
Yes

Imports

Declarations

acceptReliable

function acceptReliable(channel, packet)

Implements the `acceptReliable` operation for `miniquake.net_datagram` (accept reliable).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `acceptReliable`.
packetdynamic—Network packet to process.

View source

acceptUnreliable

function acceptUnreliable(channel, packet)

Implements the `acceptUnreliable` operation for `miniquake.net_datagram` (accept unreliable).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `acceptUnreliable`.
packetdynamic—Network packet to process.

View source

acknowledgement

function acknowledgement(sequence)

Implements the `acknowledgement` operation for `miniquake.net_datagram` (acknowledgement).

ParameterTypeDefaultDescription
sequencedynamic—The sequence input consumed by `acknowledgement`.

View source

appendBytes

function appendBytes(a, b)

Add state for append bytes.

ParameterTypeDefaultDescription
adynamic—The a input consumed by `appendBytes`.
bdynamic—The b input consumed by `appendBytes`.

View source

beginReliable

function beginReliable(channel, payload, now)

Initialize state for begin reliable.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `beginReliable`.
payloaddynamic—The payload input consumed by `beginReliable`.
nowdynamic—The now input consumed by `beginReliable`.

View source

bigU32

function bigU32(data, offset)

Implements the `bigU32` operation for `miniquake.net_datagram` (big u32).

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.
offsetdynamic—Zero-based offset of the requested data.

View source

control

function control(payload)

Implements the `control` operation for `miniquake.net_datagram` (control).

ParameterTypeDefaultDescription
payloaddynamic—The payload input consumed by `control`.

View source

createChannel

function createChannel()

Create and initialize channel.

View source

Datagram_CanSendMessage

function Datagram_CanSendMessage(channel)

Mirror Quake's Datagram_CanSendMessage routine and its observable state changes.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_CanSendMessage`.

View source

Datagram_CanSendUnreliableMessage

function Datagram_CanSendUnreliableMessage(channel)

Mirror Quake's Datagram_CanSendUnreliableMessage routine and its observable state changes.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_CanSendUnreliableMessage`.

View source

Datagram_FlushSendNext

function Datagram_FlushSendNext(channel, now)

Mirror Quake's Datagram_FlushSendNext routine and its observable state changes.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_FlushSendNext`.
nowdynamic—The now input consumed by `Datagram_FlushSendNext`.

View source

Datagram_GetMessage

function Datagram_GetMessage(channel, packet, now)

Mirror Quake's Datagram_GetMessage routine and its observable state changes.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_GetMessage`.
packetdynamic—Network packet to process.
nowdynamic—The now input consumed by `Datagram_GetMessage`.

View source

Datagram_SendMessage

function Datagram_SendMessage(channel, payload, now)

Named net_dgrm.c entry points. The transport-facing net_loop module supplies the UDP socket operations; these functions own the original channel state.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_SendMessage`.
payloaddynamic—The payload input consumed by `Datagram_SendMessage`.
nowdynamic—The now input consumed by `Datagram_SendMessage`.

View source

Datagram_SendUnreliableMessage

function Datagram_SendUnreliableMessage(channel, payload)

Mirror Quake's Datagram_SendUnreliableMessage routine and its observable state changes.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `Datagram_SendUnreliableMessage`.
payloaddynamic—The payload input consumed by `Datagram_SendUnreliableMessage`.

View source

decodePacket

function decodePacket(data)

Read and validate packet.

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.

View source

droppedDatagrams

droppedDatagrams

Tracks the module-level dropped datagrams state owned by `miniquake.net_datagram`.

View source

dropPrefix

function dropPrefix(data, count)

Release state for drop prefix.

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.
countdynamic—Number of entries or units to process.

View source

encode

function encode(flags, sequence, payload)

Implements the `encode` operation for `miniquake.net_datagram` (encode).

ParameterTypeDefaultDescription
flagsdynamic—The flags input consumed by `encode`.
sequencedynamic—The sequence input consumed by `encode`.
payloaddynamic—The payload input consumed by `encode`.

View source

MAX_DATAGRAM

const MAX_DATAGRAM = 1024

Defines the max datagram value used by `miniquake.net_datagram`.

View source

negativeAcknowledgement

function negativeAcknowledgement(sequence)

Implements the `negativeAcknowledgement` operation for `miniquake.net_datagram` (negative acknowledgement).

ParameterTypeDefaultDescription
sequencedynamic—The sequence input consumed by `negativeAcknowledgement`.

View source

NET_HEADERSIZE

const NET_HEADERSIZE = 8

Defines the net headersize value used by `miniquake.net_datagram`.

View source

NET_MAXMESSAGE

const NET_MAXMESSAGE = 8192

Defines the net maxmessage value used by `miniquake.net_datagram`.

View source

NET_Stats_f

function NET_Stats_f(channels, messagesSent, messagesReceived, unreliableSent, unreliableReceived)

Mirror Quake's NET_Stats_f routine and its observable state changes.

ParameterTypeDefaultDescription
channelsdynamic—Number of interleaved audio channels.
messagesSentdynamic—The messages sent input consumed by `NET_Stats_f`.
messagesReceiveddynamic—The messages received input consumed by `NET_Stats_f`.
unreliableSentdynamic—The unreliable sent input consumed by `NET_Stats_f`.
unreliableReceiveddynamic—The unreliable received input consumed by `NET_Stats_f`.

View source

NETFLAG_ACK

const NETFLAG_ACK = 131072

Defines the netflag ack value used by `miniquake.net_datagram`.

View source

NETFLAG_CTL

const NETFLAG_CTL = 2147483648

Defines the netflag ctl value used by `miniquake.net_datagram`.

View source

NETFLAG_DATA

const NETFLAG_DATA = 65536

Defines the netflag data value used by `miniquake.net_datagram`.

View source

NETFLAG_EOM

const NETFLAG_EOM = 524288

Defines the netflag eom value used by `miniquake.net_datagram`.

View source

NETFLAG_LENGTH_MASK

const NETFLAG_LENGTH_MASK = 65535

Defines the netflag length mask value used by `miniquake.net_datagram`.

View source

NETFLAG_NAK

const NETFLAG_NAK = 262144

Defines the netflag nak value used by `miniquake.net_datagram`.

View source

NETFLAG_UNRELIABLE

const NETFLAG_UNRELIABLE = 1048576

Defines the netflag unreliable value used by `miniquake.net_datagram`.

View source

nextReliablePacket

function nextReliablePacket(channel, now)

Return next reliable packet for the active module state.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `nextReliablePacket`.
nowdynamic—The now input consumed by `nextReliablePacket`.

View source

nextSequence

inline function nextSequence(sequence)

Return next sequence for the active module state.

ParameterTypeDefaultDescription
sequencedynamic—The sequence input consumed by `nextSequence`.

View source

packetsReceived

packetsReceived

Tracks the module-level packets received state owned by `miniquake.net_datagram`.

View source

packetsReSent

packetsReSent

Tracks the module-level packets re sent state owned by `miniquake.net_datagram`.

View source

packetsSent

packetsSent

Tracks the module-level packets sent state owned by `miniquake.net_datagram`.

View source

pollRetransmit

function pollRetransmit(channel, now)

Implements the `pollRetransmit` operation for `miniquake.net_datagram` (poll retransmit).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `pollRetransmit`.
nowdynamic—The now input consumed by `pollRetransmit`.

View source

previousSequence

inline function previousSequence(sequence)

Implements the `previousSequence` operation for `miniquake.net_datagram` (previous sequence).

ParameterTypeDefaultDescription
sequencedynamic—The sequence input consumed by `previousSequence`.

View source

PrintStats

function PrintStats(channel)

Format and emit stats.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `PrintStats`.

View source

processPacket

function processPacket(channel, wirePacket, now)

Returns [message type, payload, ACK/NAK response, immediate transport reply]. Matching ACKs only mark sendNext. The transport flushes the next reliable fragment after its receive loop, matching net_dgrm.c. Message type follows NET_GetMessage: 0 = none, 1 = reliable, 2 = unreliable.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `processPacket`.
wirePacketdynamic—The wire packet input consumed by `processPacket`.
nowdynamic—The now input consumed by `processPacket`.

View source

putBigU32

function putBigU32(data, offset, value)

Encode and write big u32.

ParameterTypeDefaultDescription
datadynamic—Input data consumed by the operation.
offsetdynamic—Zero-based offset of the requested data.
valuedynamic—Value consumed by `putBigU32`.

View source

receivedDuplicateCount

receivedDuplicateCount

Tracks the module-level received duplicate count state owned by `miniquake.net_datagram`.

View source

reliable

function reliable(channel, payload, endOfMessage)

Implements the `reliable` operation for `miniquake.net_datagram` (reliable).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `reliable`.
payloaddynamic—The payload input consumed by `reliable`.
endOfMessagedynamic—The end of message input consumed by `reliable`.

View source

ReSendMessage

function ReSendMessage(channel, now)

Implements the `ReSendMessage` operation for `miniquake.net_datagram` (re send message).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `ReSendMessage`.
nowdynamic—The now input consumed by `ReSendMessage`.

View source

resendReliable

function resendReliable(channel, now)

Implements the `resendReliable` operation for `miniquake.net_datagram` (resend reliable).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `resendReliable`.
nowdynamic—The now input consumed by `resendReliable`.

View source

resetStats

function resetStats()

Update module state for stats.

View source

SendMessageNext

function SendMessageNext(channel, now)

Send message next through the active connection.

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `SendMessageNext`.
nowdynamic—The now input consumed by `SendMessageNext`.

View source

shortPacketCount

shortPacketCount

Tracks the module-level short packet count state owned by `miniquake.net_datagram`.

View source

unreliable

function unreliable(channel, payload)

Implements the `unreliable` operation for `miniquake.net_datagram` (unreliable).

ParameterTypeDefaultDescription
channeldynamic—The channel input consumed by `unreliable`.
payloaddynamic—The payload input consumed by `unreliable`.

View source