Provides minisql platform network facilities for this project.
Package: minisql.platform.network
Reachable from entry: yes
minisql/common/endian.mlasendian→ src/minisql/common/endian.mlstd/time.mlastime_api→../MiniLangCompilerML/std/time.ml— external dependency
_wsaReadyStores module-wide wsa ready state for the minisql platform network module.
extern function accept(s as ptr, addr as ptr, addrlen as ptr) from "ws2_32.dll" returns ptrAccepts one pending connection and returns its socket or INVALID_SOCKET.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
addr |
ptr |
— | addr value consumed by this operation. |
addrlen |
ptr |
— | addrlen value consumed by this operation. |
Returns: Native ptr result produced by the call.
function acceptTcp(listener)Performs the accept tcp operation for this module. Inputs: listener. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
listener |
dynamic |
— | listener value consumed by this operation. |
const AF_INET = 2Defines the af inet constant used by the minisql platform network module.
extern function bind(s as ptr, addr as bytes, addrlen as i32) from "ws2_32.dll" returns i32Binds socket s to the encoded local address and returns the raw status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
addr |
bytes |
— | addr value consumed by this operation. |
addrlen |
i32 |
— | addrlen value consumed by this operation. |
Returns: Native i32 result produced by the call.
function bytePointer(source, offset, count, operation)Performs the byte pointer operation for this module. Inputs: source, offset, count, operation. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
dynamic |
— | source value consumed by this operation. |
offset |
dynamic |
— | Zero-based offset at which processing starts. |
count |
dynamic |
— | Number of items or units to process. |
operation |
dynamic |
— | operation value consumed by this operation. |
function cleanup()Performs the cleanup operation for this module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
function close(handle)Closes close owned by the minisql platform network module. Inputs: handle. Returns the operation result and propagates validation, storage, or platform errors unchanged.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
extern function closesocket(s as ptr) from "ws2_32.dll" returns i32Closes socket s and returns the raw WinSock status code.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
Returns: Native i32 result produced by the call.
function componentName()Performs the componentName operation for the minisql platform network module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
extern function connect(s as ptr, addr as bytes, addrlen as i32) from "ws2_32.dll" returns i32Connects socket s to the encoded address and returns the raw WinSock status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
addr |
bytes |
— | addr value consumed by this operation. |
addrlen |
i32 |
— | addrlen value consumed by this operation. |
Returns: Native i32 result produced by the call.
function connectTcp(host, port)Performs the connect tcp operation for this module. Inputs: host, port. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
host |
dynamic |
— | host value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
function copyByteRange(source, offset, count, operation)Copies the byte range. Inputs: source, offset, count, operation. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
dynamic |
— | source value consumed by this operation. |
offset |
dynamic |
— | Zero-based offset at which processing starts. |
count |
dynamic |
— | Number of items or units to process. |
operation |
dynamic |
— | operation value consumed by this operation. |
function fail(operation, message)Performs the fail operation for the minisql platform network module. Inputs: operation, message. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
operation |
dynamic |
— | operation value consumed by this operation. |
message |
dynamic |
— | Human-readable message associated with the operation. |
const FIONBIO = 2147772030Defines the fionbio constant used by the minisql platform network module.
extern function getpeername(s as ptr, address as bytes, addressLength as bytes) from "ws2_32.dll" returns i32Reads the connected peer's socket address into a caller-owned sockaddr buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
address |
bytes |
— | address value consumed by this operation. |
addressLength |
bytes |
— | addressLength value consumed by this operation. |
Returns: Native i32 result produced by the call.
extern function inet_addr(address as cstr) from "ws2_32.dll" returns u32Converts a dotted-decimal IPv4 C string to its network-order numeric address.
| Parameter | Type | Default | Description |
|---|---|---|---|
address |
cstr |
— | address value consumed by this operation. |
Returns: Native u32 result produced by the call.
function initialize()Initializes the requested value. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
const INVALID_ARGUMENT = 9001Defines the invalid argument constant used by the minisql platform network module.
const INVALID_SOCKET = -1Defines the invalid socket constant used by the minisql platform network module.
extern function ioctlsocket(s as ptr, command as u32, value as bytes) from "ws2_32.dll" returns i32Applies a socket control command using the mutable value buffer and returns raw status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
command |
u32 |
— | command value consumed by this operation. |
value |
bytes |
— | Value consumed or transformed by the operation. |
Returns: Native i32 result produced by the call.
const IPPROTO_TCP = 6Defines the ipproto tcp constant used by the minisql platform network module.
function isHandle(value)Evaluates whether the supplied input satisfies the handle predicate. Inputs: value. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
function isImplemented()Returns whether implemented satisfies the condition required by the minisql platform network module. Takes no caller-supplied inputs. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
function isLoopbackAddress(address)Evaluates whether the supplied input satisfies the loopback address predicate. Inputs: address. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
address |
dynamic |
— | address value consumed by this operation. |
function isSocketErrorResult(value)WinSock C APIs return a signed 32-bit int. The native ABI writes EAX, so a declaration as a 64-bit MiniLang int can expose SOCKET_ERROR as 0xFFFFFFFF instead of -1. Correct i32 declarations are the primary contract; the dual sentinel check keeps the failure path closed even with an older compiler. Evaluates whether the supplied input satisfies the socket error result predicate. Inputs: value. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
extern function listen(s as ptr, backlog as i32) from "ws2_32.dll" returns i32Enables connection acceptance with the requested backlog and returns raw status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
backlog |
i32 |
— | backlog value consumed by this operation. |
Returns: Native i32 result produced by the call.
function listenAddress(addressText, port, backlog, allowRemote)Performs the listen address operation for this module. Inputs: addressText, port, backlog, allowRemote. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
addressText |
dynamic |
— | addressText value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
backlog |
dynamic |
— | backlog value consumed by this operation. |
allowRemote |
dynamic |
— | allowRemote value consumed by this operation. |
function listenLoopback(port, backlog)Performs the listen loopback operation for this module. Inputs: port, backlog. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
port |
dynamic |
— | port value consumed by this operation. |
backlog |
dynamic |
— | backlog value consumed by this operation. |
const MAX_RECEIVE_BYTES = 16777216Matches the protocol's exceptional-frame guard. Ordinary polling remains
function nativeError()Returns the current platform socket error using one stable MiniSQL call site.
const NETWORK_ERROR = 9026Native IPv4/TCP wrapper used by MiniSQL clients and servers. M27 adds bounded
function parseIPv4(host)Parses the ipv4. Inputs: host. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
host |
dynamic |
— | host value consumed by this operation. |
function peerName(handle)Formats the connected IPv4 peer as address:port for operational logging. Inputs: handle. Returns the peer endpoint or unknown when WinSock cannot expose it.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
const POLLNVAL = 4Defines the pollnval constant used by the minisql platform network module.
const POLLRDNORM = 256Defines the pollrdnorm constant used by the minisql platform network module.
const POLLWRNORM = 16Defines the pollwrnorm constant used by the minisql platform network module.
function receive(handle, maximum)Performs the receive operation for this module. Inputs: handle, maximum. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
maximum |
dynamic |
— | maximum value consumed by this operation. |
function receiveAvailable(handle, maximum)Performs the receive available operation for this module. Inputs: handle, maximum. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
maximum |
dynamic |
— | maximum value consumed by this operation. |
function receiveAvailableInto(handle, target, offset, maximum)Performs the receive available into operation for this module. Inputs: handle, target, offset, maximum. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
target |
dynamic |
— | target value consumed by this operation. |
offset |
dynamic |
— | Zero-based offset at which processing starts. |
maximum |
dynamic |
— | maximum value consumed by this operation. |
function receiveExact(handle, count)Performs the receive exact operation for this module. Inputs: handle, count. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
count |
dynamic |
— | Number of items or units to process. |
extern function recv(s as ptr, buffer as ptr, count as i32, flags as i32) from "ws2_32.dll" returns i32Receives up to count bytes into buffer and returns count, EOF, or error.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
buffer |
ptr |
— | Buffer that receives or supplies the operation data. |
count |
i32 |
— | Number of items or units to process. |
flags |
i32 |
— | Bit flags controlling the operation. |
Returns: Native i32 result produced by the call.
const SD_BOTH = 2Defines the sd both constant used by the minisql platform network module.
extern function send(s as ptr, buffer as ptr, count as i32, flags as i32) from "ws2_32.dll" returns i32Sends up to count bytes from buffer and returns the transferred count or error.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
buffer |
ptr |
— | Buffer that receives or supplies the operation data. |
count |
i32 |
— | Number of items or units to process. |
flags |
i32 |
— | Bit flags controlling the operation. |
Returns: Native i32 result produced by the call.
function sendAll(handle, data)Performs the send all operation for this module. Inputs: handle, data. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
data |
dynamic |
— | Input data consumed by the operation. |
function setNoDelay(handle, enabled)Controls Nagle coalescing on an established TCP stream. MiniSQL exchanges request/response frames synchronously, so delaying a small TLS record until a later packet arrives can add an entire delayed-ACK interval to every query.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
enabled |
dynamic |
— | enabled value consumed by this operation. |
function setNonBlocking(handle, enabled)Updates the non blocking. Inputs: handle, enabled. Returns the operation result and propagates validation, storage, or platform errors unchanged.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
enabled |
dynamic |
— | enabled value consumed by this operation. |
extern function setsockopt(s as ptr, level as i32, option as i32, value as bytes, count as i32) from "ws2_32.dll" returns i32Sets one socket option from the supplied byte representation and returns raw status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
level |
i32 |
— | level value consumed by this operation. |
option |
i32 |
— | option value consumed by this operation. |
value |
bytes |
— | Value consumed or transformed by the operation. |
count |
i32 |
— | Number of items or units to process. |
Returns: Native i32 result produced by the call.
function setTimeouts(handle, receiveMs, sendMs)Updates the timeouts. Inputs: handle, receiveMs, sendMs. Returns the operation result and propagates validation, storage, or platform errors unchanged.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
receiveMs |
dynamic |
— | receiveMs value consumed by this operation. |
sendMs |
dynamic |
— | sendMs value consumed by this operation. |
extern function shutdown(s as ptr, how as i32) from "ws2_32.dll" returns i32Disables the selected socket direction and returns the raw WinSock status.
| Parameter | Type | Default | Description |
|---|---|---|---|
s |
ptr |
— | s value consumed by this operation. |
how |
i32 |
— | how value consumed by this operation. |
Returns: Native i32 result produced by the call.
function sleepMilliseconds(milliseconds)Performs the sleep milliseconds operation for this module. Inputs: milliseconds. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
milliseconds |
dynamic |
— | milliseconds value consumed by this operation. |
const SO_RCVTIMEO = 4102Defines the so rcvtimeo constant used by the minisql platform network module.
const SO_REUSEADDR = 4Defines the so reuseaddr constant used by the minisql platform network module.
const SO_SNDTIMEO = 4101Defines the so sndtimeo constant used by the minisql platform network module.
const SOCK_STREAM = 1Defines the sock stream constant used by the minisql platform network module.
function sockaddr(ip, port)Performs the sockaddr operation for this module. Inputs: ip, port. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
ip |
dynamic |
— | ip value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
const SOCKADDR_IN_SIZE = 16Defines the sockaddr in size constant used by the minisql platform network module.
extern function socket(af as int, type as int, protocol as int) from "ws2_32.dll" returns ptrCreates a socket for the requested address family, type, and protocol.
| Parameter | Type | Default | Description |
|---|---|---|---|
af |
int |
— | af value consumed by this operation. |
type |
int |
— | type value consumed by this operation. |
protocol |
int |
— | protocol value consumed by this operation. |
Returns: Native ptr result produced by the call.
const SOCKET_ERROR = -1Defines the socket error constant used by the minisql platform network module.
const SOCKET_ERROR_U32 = 4294967295Defines the socket error u32 constant used by the minisql platform network module.
const SOL_SOCKET = 65535Defines the sol socket constant used by the minisql platform network module.
function targetMilestone()Performs the targetMilestone operation for the minisql platform network module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
const TCP_NODELAY = 1Defines the tcp nodelay constant used by the minisql platform network module.
function tryAccept(listener)Performs the try accept operation for this module. Inputs: listener. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
listener |
dynamic |
— | listener value consumed by this operation. |
function validatePort(port, operation)Validates the port. Inputs: port, operation. Returns success after all invariants hold; violations are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
port |
dynamic |
— | port value consumed by this operation. |
operation |
dynamic |
— | operation value consumed by this operation. |
function waitReadable(handle, timeoutMs)Blocks for at most timeoutMs until recv or accept can make progress.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
timeoutMs |
dynamic |
— | timeoutMs value consumed by this operation. |
function waitSocket(handle, events, timeoutMs, operation)Waits for one socket event using WinSock's readiness primitive. A timeout is reported as false; readiness, hangup, and socket errors are reported as true so the caller can perform the operation and receive its precise outcome.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
events |
dynamic |
— | events value consumed by this operation. |
timeoutMs |
dynamic |
— | timeoutMs value consumed by this operation. |
operation |
dynamic |
— | operation value consumed by this operation. |
function waitWritable(handle, timeoutMs)Blocks for at most timeoutMs until send can make progress.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
dynamic |
— | Native or runtime handle used by the operation. |
timeoutMs |
dynamic |
— | timeoutMs value consumed by this operation. |
const WSA_VERSION_2_2 = 514Defines the wsa version 2 2 constant used by the minisql platform network module.
extern function WSACleanup() from "ws2_32.dll" returns i32Releases one process-wide WinSock initialization reference and returns its status.
Returns: Native i32 result produced by the call.
const WSAEINTR = 10004Defines the wsaeintr constant used by the minisql platform network module.
const WSAETIMEDOUT = 10060Defines the wsaetimedout constant used by the minisql platform network module.
const WSAEWOULDBLOCK = 10035Defines the wsaewouldblock constant used by the minisql platform network module.
extern function WSAGetLastError() from "ws2_32.dll" returns i32Returns the calling thread's most recent WinSock error code.
Returns: Native i32 result produced by the call.
extern function WSAPoll(descriptors as bytes, descriptorCount as u32, timeoutMs as i32) from "ws2_32.dll" returns i32Waits until one or more sockets become ready without relying on the Windows timer quantum.
| Parameter | Type | Default | Description |
|---|---|---|---|
descriptors |
bytes |
— | descriptors value consumed by this operation. |
descriptorCount |
u32 |
— | Number of descriptor to process. |
timeoutMs |
i32 |
— | timeoutMs value consumed by this operation. |
Returns: Native i32 result produced by the call.
const WSAPOLLFD_EVENTS_OFFSET = 8Defines the wsapollfd events offset constant used by the minisql platform network module.
const WSAPOLLFD_REVENTS_OFFSET = 10Defines the wsapollfd revents offset constant used by the minisql platform network module.
const WSAPOLLFD_SIZE = 16Defines the wsapollfd size constant used by the minisql platform network module.
extern function WSAStartup(version as int, wsaData as bytes) from "ws2_32.dll" returns i32Initializes WinSock for version, filling wsaData and returning its status code.
| Parameter | Type | Default | Description |
|---|---|---|---|
version |
int |
— | version value consumed by this operation. |
wsaData |
bytes |
— | wsaData value consumed by this operation. |
Returns: Native i32 result produced by the call.