Skip to content

Latest commit

 

History

History
606 lines (385 loc) · 25.2 KB

File metadata and controls

606 lines (385 loc) · 25.2 KB

src/minisql/protocol/connection.ml

Home · Files

Provides minisql protocol connection facilities for this project.

Package: minisql.protocol.connection

Reachable from entry: yes

Imports

Declarations

abort

function abort(connection)

Aborts a potentially desynchronized transport without sending TLS or protocol shutdown data.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

appendReceiveBytes

function appendReceiveBytes(connection, incoming)

Appends plaintext obtained from Schannel while preserving the frame memory bound.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
incoming dynamic incoming value consumed by this operation.

View source

appendReceiveScratch

function appendReceiveScratch(connection, count)

Appends receive scratch using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
count dynamic Number of items or units to process.

View source

close

function close(connection)

Closes close owned by the minisql protocol connection module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

CLOSED_HANDLE

const CLOSED_HANDLE = 9008

Defines the closed handle constant used by the minisql protocol connection module.

View source

componentName

function componentName()

Performs the componentName operation for the minisql protocol connection module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

connectAddress

function connectAddress(address, port)

Connects address using the supplied inputs. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
address dynamic address value consumed by this operation.
port dynamic port value consumed by this operation.

View source

connectLoopback

function connectLoopback(port)

Connects loopback using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
port dynamic port value consumed by this operation.

View source

connectTlsAddress

function connectTlsAddress(address, port, serverName)

Connects a TCP socket and completes native TLS with Windows root-store trust.

Parameter Type Default Description
address dynamic address value consumed by this operation.
port dynamic port value consumed by this operation.
serverName dynamic serverName value consumed by this operation.

View source

connectTlsPinnedAddress

function connectTlsPinnedAddress(address, port, serverName, pinText)

Connects native TLS using an exact SHA-256 leaf pin for private certificates.

Parameter Type Default Description
address dynamic address value consumed by this operation.
port dynamic port value consumed by this operation.
serverName dynamic serverName value consumed by this operation.
pinText dynamic pinText value consumed by this operation.

View source

copyRange

function copyRange(source, offset, count, operation)

Implements copy range for this module. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.

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.

View source

CORRUPT_DATA

const CORRUPT_DATA = 9004

Defines the corrupt data constant used by the minisql protocol connection module.

View source

create

function create(socketHandle)

Creates create for the minisql protocol connection module. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
socketHandle dynamic socketHandle value consumed by this operation.

View source

decodeInbound

function decodeInbound(connection, frame)

Decodes inbound using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
frame dynamic frame value consumed by this operation.

View source

enableSecure

function enableSecure(connection, sendKey, receiveKey)

Implements enable secure for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
sendKey dynamic sendKey value consumed by this operation.
receiveKey dynamic receiveKey value consumed by this operation.

View source

enableTls

function enableTls(connection, tlsContext)

Attaches a completed Schannel context below the MiniSQL framed protocol.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
tlsContext dynamic tlsContext value consumed by this operation.

View source

extractBufferedMessage

function extractBufferedMessage(connection)

Implements extract buffered message for this module. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

fail

function fail(code, operation, message)

Performs the fail operation for the minisql protocol connection module. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
code dynamic code value consumed by this operation.
operation dynamic operation value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

Defines the invalid argument constant used by the minisql protocol connection module.

View source

isConnection

function isConnection(value)

Returns whether the supplied value satisfies the connection condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isImplemented

function isImplemented()

Returns whether implemented satisfies the condition required by the minisql protocol connection module. Returns the computed value or operation status. Does not modify its inputs.

View source

isPollResult

function isPollResult(value)

Returns whether the supplied value satisfies the poll result condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

makeNonBlocking

function makeNonBlocking(connection)

Creates non blocking using the supplied inputs. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

POLL_RECEIVE_BYTES

const POLL_RECEIVE_BYTES = 65536

Defines the poll receive bytes constant used by the minisql protocol connection module.

View source

pollMessage

function pollMessage(connection)

Attempts one nonblocking framed receive. Returns PollResult when a complete frame or clean EOF is available, void when more bytes are needed, or an error for malformed/truncated/transport input.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

protectMessage

function protectMessage(connection, message)

Implements protect message for this module. Returns the computed value or operation status. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

protocolBytesReceived

function protocolBytesReceived(connection)

Returns framed protocol bytes read by this connection.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

protocolBytesSent

function protocolBytesSent(connection)

Returns framed protocol bytes written by this connection. TLS record overhead is deliberately excluded so plain and protected protocol workloads compare.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

receiveMessage

function receiveMessage(connection)

Receives message using the supplied inputs. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

SECURE_TRANSPORT

const SECURE_TRANSPORT = 9030

Defines the secure transport constant used by the minisql protocol connection module.

View source

secureActive

function secureActive(connection)

Implements secure active for this module. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

sendMessage

function sendMessage(connection, message)

Sends message using the supplied inputs. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

setTimeouts

function setTimeouts(connection, receiveMs, sendMs)

Applies bounded socket I/O while a caller performs a protocol phase such as the initial HELLO exchange. Passing zero restores normal unbounded query I/O.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
receiveMs dynamic receiveMs value consumed by this operation.
sendMs dynamic sendMs value consumed by this operation.

View source

targetMilestone

function targetMilestone()

Performs the targetMilestone operation for the minisql protocol connection module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

tlsActive

function tlsActive(connection)

Reports whether native TLS record protection is active.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.

View source

unprotectMessage

function unprotectMessage(connection, message)

Implements unprotect message for this module. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. May mutate supplied state and perform I/O through its dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

validateOpen

function validateOpen(connection, operation)

Validates open for the minisql protocol connection workflow. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Performs I/O through its file, transport, or storage dependencies.

Parameter Type Default Description
connection dynamic connection value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source