MiniQuake

src/miniquake/net_main.ml

Package
miniquake.net_main
Reachable
Yes

Imports

Declarations

appendUniqueSocket

function appendUniqueSocket(values, socket)

Add one socket identity at most once.

ParameterTypeDefaultDescription
valuesdynamic—The values input consumed by `appendUniqueSocket`.
socketdynamic—Network socket used for communication.

View source

arrayTail

function arrayTail(values)

Implements the `arrayTail` operation for `miniquake.net_main` (array tail).

ParameterTypeDefaultDescription
valuesdynamic—The values input consumed by `arrayTail`.

View source

cachedAddress

function cachedAddress(state, host)

Implements the `cachedAddress` operation for `miniquake.net_main` (cached address).

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `cachedAddress`.
hostdynamic—The host input consumed by `cachedAddress`.

View source

compactActiveSockets

function compactActiveSockets()

Compact the active list and reclaim externally disconnected qsocket slots. Driver code may mark a socket disconnected before NET_Close observes it. The C engine still returns that fixed qsocket_t to net_freeSockets; dropping the MiniLang object here permanently shrank the pool on every reconnect.

View source

DEFAULTnet_hostport

DEFAULTnet_hostport

Tracks the module-level defaul tnet hostport state owned by `miniquake.net_main`.

View source

ensureSocketPool

function ensureSocketPool()

Ensure sufficient storage or state for socket pool.

View source

ensureSocketPoolCapacity

function ensureSocketPoolCapacity(clientCount)

Grow the fixed qsocket arena when maxplayers is raised before a server starts. Host_FindMaxClients reserves at least four client slots in Quake; MiniQuake resizes its server dynamically, so the network arena must mirror that growth instead of retaining the two sockets from a single-player boot.

ParameterTypeDefaultDescription
clientCountdynamic—Number of entries or units to process.

View source

hostcache

hostcache

Tracks the module-level hostcache state owned by `miniquake.net_main`.

View source

hostCacheCount

hostCacheCount

Tracks the module-level host cache count state owned by `miniquake.net_main`.

View source

IsID

function IsID(address, idgodsEnabled)

Report whether is id.

ParameterTypeDefaultDescription
addressdynamic—Network address of the peer.
idgodsEnableddynamic—The idgods enabled input consumed by `IsID`.

View source

listening

listening

Tracks the module-level listening state owned by `miniquake.net_main`.

View source

maximumClients

maximumClients

Tracks the module-level maximum clients state owned by `miniquake.net_main`.

View source

MaxPlayers_f

function MaxPlayers_f(currentPlayers, maximumLimit, serverActive, requested)

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

ParameterTypeDefaultDescription
currentPlayersdynamic—The current players input consumed by `MaxPlayers_f`.
maximumLimitdynamic—The maximum limit input consumed by `MaxPlayers_f`.
serverActivedynamic—The server active input consumed by `MaxPlayers_f`.
requesteddynamic—The requested input consumed by `MaxPlayers_f`.

View source

messagesReceived

messagesReceived

Tracks the module-level messages received state owned by `miniquake.net_main`.

View source

messagesSent

messagesSent

Tracks the module-level messages sent state owned by `miniquake.net_main`.

View source

net_activeconnections

net_activeconnections

Tracks the module-level net activeconnections state owned by `miniquake.net_main`.

View source

net_activeSockets

net_activeSockets

Tracks the module-level net active sockets state owned by `miniquake.net_main`.

View source

NET_CanSendMessage

function NET_CanSendMessage(socket)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

NET_CanSendUnreliableMessage

function NET_CanSendUnreliableMessage(socket)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

NET_CheckNewConnections

function NET_CheckNewConnections(state)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_CheckNewConnections`.

View source

NET_ClearPollProcedures

function NET_ClearPollProcedures()

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

View source

NET_Close

function NET_Close(socket)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

NET_Connect

function NET_Connect(state, host, timeoutMilliseconds)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Connect`.
hostdynamic—The host input consumed by `NET_Connect`.
timeoutMillisecondsdynamic—The timeout milliseconds input consumed by `NET_Connect`.

View source

NET_ConnectInterop

function NET_ConnectInterop(state, host, timeoutMilliseconds, resendMilliseconds)

Strict external-reference connection path. Unlike the regular Quake menu connection, this keeps one UDP source endpoint alive and resends the Protocol-3 request at a short interval until the original server accepts.

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_ConnectInterop`.
hostdynamic—The host input consumed by `NET_ConnectInterop`.
timeoutMillisecondsdynamic—The timeout milliseconds input consumed by `NET_ConnectInterop`.
resendMillisecondsdynamic—The resend milliseconds input consumed by `NET_ConnectInterop`.

View source

NET_ConnectionAccepted

function NET_ConnectionAccepted()

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

View source

NET_ConnectionClosed

function NET_ConnectionClosed()

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

View source

net_driverlevel

net_driverlevel

Tracks the module-level net driverlevel state owned by `miniquake.net_main`.

View source

NET_FreeQSocket

function NET_FreeQSocket(socket)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

net_freeSockets

net_freeSockets

Tracks the module-level net free sockets state owned by `miniquake.net_main`.

View source

NET_GetMessage

function NET_GetMessage(socket, destination, timeoutSeconds)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.
destinationdynamic—Destination value or collection to update.
timeoutSecondsdynamic—The timeout seconds input consumed by `NET_GetMessage`.

View source

net_hostport

net_hostport

Tracks the module-level net hostport state owned by `miniquake.net_main`.

View source

NET_Init

function NET_Init(state, maxClients, dedicated, listenRequested, requestedPort, noLan)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Init`.
maxClientsdynamic—The max clients input consumed by `NET_Init`.
dedicateddynamic—The dedicated input consumed by `NET_Init`.
listenRequesteddynamic—The listen requested input consumed by `NET_Init`.
requestedPortdynamic—The requested port input consumed by `NET_Init`.
noLandynamic—The no lan input consumed by `NET_Init`.

View source

NET_IsListening

function NET_IsListening()

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

View source

NET_Listen_f

function NET_Listen_f(state, enabled, port)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Listen_f`.
enableddynamic—Whether the optional behavior is enabled.
portdynamic—The port input consumed by `NET_Listen_f`.

View source

NET_MessageCounters

function NET_MessageCounters()

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

View source

net_messagetimeout

net_messagetimeout

Tracks the module-level net messagetimeout state owned by `miniquake.net_main`.

View source

NET_NewQSocket

function NET_NewQSocket()

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

View source

net_numsockets

net_numsockets

Tracks the module-level net numsockets state owned by `miniquake.net_main`.

View source

NET_Poll

function NET_Poll()

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

View source

NET_PollProcedureSnapshot

inline function NET_PollProcedureSnapshot()

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

View source

NET_Port_f

function NET_Port_f(state, requested)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Port_f`.
requesteddynamic—The requested input consumed by `NET_Port_f`.

View source

NET_PortState

inline function NET_PortState()

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

View source

NET_QueueSnapshot

function NET_QueueSnapshot()

QSocket counts alone cannot reveal a reliable fragment permanently waiting for an ACK. Include completed queues and in-progress channel bytes so soak tests can prove that network work is bounded.

View source

NET_ReplaceHostCache

function NET_ReplaceHostCache(items)

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

ParameterTypeDefaultDescription
itemsdynamic—The items input consumed by `NET_ReplaceHostCache`.

View source

NET_SendMessage

function NET_SendMessage(socket, data)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.
datadynamic—Input data consumed by the operation.

View source

NET_SendToAll

function NET_SendToAll(clients, data, blocktime)

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

ParameterTypeDefaultDescription
clientsdynamic—The clients input consumed by `NET_SendToAll`.
datadynamic—Input data consumed by the operation.
blocktimedynamic—Time value used by the operation.

View source

NET_SendUnreliableMessage

function NET_SendUnreliableMessage(socket, data)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.
datadynamic—Input data consumed by the operation.

View source

NET_SetMaximumClients

function NET_SetMaximumClients(count)

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

ParameterTypeDefaultDescription
countdynamic—Number of entries or units to process.

View source

NET_SetMessageTimeout

function NET_SetMessageTimeout(timeoutSeconds)

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

ParameterTypeDefaultDescription
timeoutSecondsdynamic—The timeout seconds input consumed by `NET_SetMessageTimeout`.

View source

NET_SetSlistStartTime

function NET_SetSlistStartTime(value)

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

ParameterTypeDefaultDescription
valuedynamic—Value consumed by `NET_SetSlistStartTime`.

View source

NET_Shutdown

function NET_Shutdown(state)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Shutdown`.

View source

NET_Slist_f

function NET_Slist_f(state, silent, localOnly, port)

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

ParameterTypeDefaultDescription
statedynamic—Mutable `miniquake.net_main` state used by `NET_Slist_f`.
silentdynamic—The silent input consumed by `NET_Slist_f`.
localOnlydynamic—The local only input consumed by `NET_Slist_f`.
portdynamic—The port input consumed by `NET_Slist_f`.

View source

NET_SlistFlags

function NET_SlistFlags()

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

View source

NET_SocketCounts

function NET_SocketCounts()

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

View source

net_socketReserve

net_socketReserve

Tracks the module-level net socket reserve state owned by `miniquake.net_main`.

View source

NET_SocketTimedOut

function NET_SocketTimedOut(socket, timeoutSeconds)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.
timeoutSecondsdynamic—The timeout seconds input consumed by `NET_SocketTimedOut`.

View source

net_time

net_time

Tracks the module-level net time state owned by `miniquake.net_main`.

View source

NET_TrackSocket

function NET_TrackSocket(socket)

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

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

networkState

networkState

Tracks the module-level network state owned by `miniquake.net_main`.

View source

pollProcedureList

pollProcedureList

Tracks the module-level poll procedure list state owned by `miniquake.net_main`.

View source

PrintSlist

function PrintSlist()

Format and emit slist.

View source

PrintSlistHeader

function PrintSlistHeader()

Format and emit slist header.

View source

PrintSlistTrailer

function PrintSlistTrailer()

Format and emit slist trailer.

View source

resetQSocket

function resetQSocket(socket)

Update module state for qsocket.

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

SchedulePollProcedure

function SchedulePollProcedure(procedureName, timeOffset, argument)

Implements the `SchedulePollProcedure` operation for `miniquake.net_main` (schedule poll procedure).

ParameterTypeDefaultDescription
procedureNamedynamic—Name that identifies the requested value or resource.
timeOffsetdynamic—Zero-based offset of the requested data.
argumentdynamic—The argument input consumed by `SchedulePollProcedure`.

View source

SetNetTime

function SetNetTime()

Update module state for net time.

View source

Slist_Poll

function Slist_Poll()

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

View source

Slist_Send

function Slist_Send()

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

View source

slistInProgress

slistInProgress

Tracks the module-level slist in progress state owned by `miniquake.net_main`.

View source

slistLastShown

slistLastShown

Tracks the module-level slist last shown state owned by `miniquake.net_main`.

View source

slistLocal

slistLocal

Tracks the module-level slist local state owned by `miniquake.net_main`.

View source

slistPort

slistPort

Tracks the module-level slist port state owned by `miniquake.net_main`.

View source

slistSilent

slistSilent

Tracks the module-level slist silent state owned by `miniquake.net_main`.

View source

slistStartTime

slistStartTime

Tracks the module-level slist start time state owned by `miniquake.net_main`.

View source

socketArrayContains

function socketArrayContains(values, wanted)

Report whether the requested socket identity is present in an array.

ParameterTypeDefaultDescription
valuesdynamic—The values input consumed by `socketArrayContains`.
wanteddynamic—The wanted input consumed by `socketArrayContains`.

View source

socketArrayWithout

function socketArrayWithout(values, unwanted)

Return a socket array with every occurrence of one identity removed.

ParameterTypeDefaultDescription
valuesdynamic—The values input consumed by `socketArrayWithout`.
unwanteddynamic—The unwanted input consumed by `socketArrayWithout`.

View source

socketQueuedState

function socketQueuedState(socket)

Return socket queued state derived from the active module state.

ParameterTypeDefaultDescription
socketdynamic—Network socket used for communication.

View source

synchronizeCounters

function synchronizeCounters()

Update module state for counters.

View source

unreliableMessagesReceived

unreliableMessagesReceived

Tracks the module-level unreliable messages received state owned by `miniquake.net_main`.

View source

unreliableMessagesSent

unreliableMessagesSent

Tracks the module-level unreliable messages sent state owned by `miniquake.net_main`.

View source