Files
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).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `acceptReliable`. |
packet | dynamic | — | Network packet to process. |
View source
# acceptUnreliable
function acceptUnreliable(channel, packet)
Implements the `acceptUnreliable` operation for `miniquake.net_datagram` (accept unreliable).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `acceptUnreliable`. |
packet | dynamic | — | Network packet to process. |
View source
# acknowledgement
function acknowledgement(sequence)
Implements the `acknowledgement` operation for `miniquake.net_datagram` (acknowledgement).
| Parameter | Type | Default | Description |
|---|
sequence | dynamic | — | The sequence input consumed by `acknowledgement`. |
View source
# appendBytes
function appendBytes(a, b)
Add state for append bytes.
| Parameter | Type | Default | Description |
|---|
a | dynamic | — | The a input consumed by `appendBytes`. |
b | dynamic | — | The b input consumed by `appendBytes`. |
View source
# beginReliable
function beginReliable(channel, payload, now)
Initialize state for begin reliable.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `beginReliable`. |
payload | dynamic | — | The payload input consumed by `beginReliable`. |
now | dynamic | — | The now input consumed by `beginReliable`. |
View source
# bigU32
function bigU32(data, offset)
Implements the `bigU32` operation for `miniquake.net_datagram` (big u32).
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Input data consumed by the operation. |
offset | dynamic | — | Zero-based offset of the requested data. |
View source
# control
function control(payload)
Implements the `control` operation for `miniquake.net_datagram` (control).
| Parameter | Type | Default | Description |
|---|
payload | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `Datagram_FlushSendNext`. |
now | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `Datagram_GetMessage`. |
packet | dynamic | — | Network packet to process. |
now | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `Datagram_SendMessage`. |
payload | dynamic | — | The payload input consumed by `Datagram_SendMessage`. |
now | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `Datagram_SendUnreliableMessage`. |
payload | dynamic | — | The payload input consumed by `Datagram_SendUnreliableMessage`. |
View source
# decodePacket
function decodePacket(data)
Read and validate packet.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Input data consumed by the operation. |
count | dynamic | — | Number of entries or units to process. |
View source
# encode
function encode(flags, sequence, payload)
Implements the `encode` operation for `miniquake.net_datagram` (encode).
| Parameter | Type | Default | Description |
|---|
flags | dynamic | — | The flags input consumed by `encode`. |
sequence | dynamic | — | The sequence input consumed by `encode`. |
payload | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
sequence | dynamic | — | The sequence input consumed by `negativeAcknowledgement`. |
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.
| Parameter | Type | Default | Description |
|---|
channels | dynamic | — | Number of interleaved audio channels. |
messagesSent | dynamic | — | The messages sent input consumed by `NET_Stats_f`. |
messagesReceived | dynamic | — | The messages received input consumed by `NET_Stats_f`. |
unreliableSent | dynamic | — | The unreliable sent input consumed by `NET_Stats_f`. |
unreliableReceived | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `nextReliablePacket`. |
now | dynamic | — | The now input consumed by `nextReliablePacket`. |
View source
# nextSequence
inline function nextSequence(sequence)
Return next sequence for the active module state.
| Parameter | Type | Default | Description |
|---|
sequence | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `pollRetransmit`. |
now | dynamic | — | The now input consumed by `pollRetransmit`. |
View source
# previousSequence
inline function previousSequence(sequence)
Implements the `previousSequence` operation for `miniquake.net_datagram` (previous sequence).
| Parameter | Type | Default | Description |
|---|
sequence | dynamic | — | The sequence input consumed by `previousSequence`. |
View source
# PrintStats
function PrintStats(channel)
Format and emit stats.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `processPacket`. |
wirePacket | dynamic | — | The wire packet input consumed by `processPacket`. |
now | dynamic | — | The now input consumed by `processPacket`. |
View source
# putBigU32
function putBigU32(data, offset, value)
Encode and write big u32.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Input data consumed by the operation. |
offset | dynamic | — | Zero-based offset of the requested data. |
value | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `reliable`. |
payload | dynamic | — | The payload input consumed by `reliable`. |
endOfMessage | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `ReSendMessage`. |
now | dynamic | — | The now input consumed by `ReSendMessage`. |
View source
# resendReliable
function resendReliable(channel, now)
Implements the `resendReliable` operation for `miniquake.net_datagram` (resend reliable).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `resendReliable`. |
now | dynamic | — | 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.
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `SendMessageNext`. |
now | dynamic | — | 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).
| Parameter | Type | Default | Description |
|---|
channel | dynamic | — | The channel input consumed by `unreliable`. |
payload | dynamic | — | The payload input consumed by `unreliable`. |
View source