Previous: ONC RPC Message Types, Up: Implementation of ONC RPC


4.3.4 Record Marking Standard

The ONC RPC standard defines a record-marking protocol for stream-oriented transport layers such as TCP whereby (1) each RPC message is sent out as a single record and (2) where records may be split into several fragments. This allows implementations to “delimit one message from another in order to detect and possibly recover from protocol errors” (see RFC 1831, Section 10).

This protocol is implemented by the (rpc rpc transports) module. It is automatically used by the high-level client and server facilities, namely make-synchronous-rpc-call and run-stream-rpc-server. The available facilities are described below.

— Scheme Procedure: send-rpc-record port bv offset len

Send the RPC message of len octets encoded at offset offset in bv (a bytevector) to port. This procedure sends the len octets of the record without fragmenting them.

— Scheme Procedure: make-rpc-record-sender fragment-len

This procedure is a generalization of send-rpc-record.

Return a procedure that sends data according to the record marking standard, chopping its input bytevector into fragments of size fragment-len octets.

— Scheme Procedure: rpc-record-marking-input-port port

Return a binary input port that proxies port in order to implement decoding of the record marking standard (RFC 1831, Section 10).