Skip to main content

Module frame

Module frame 

Source
Expand description

Binary framing for all vsock communication.

Frame format: [u32 BE length][u8 type][payload...] Length = size of type byte + payload (excludes the 4-byte length prefix). Max frame size: 1 MB.

Constants§

ATTEST_REQ
ATTEST_RESP
CHMOD_REQ
COPY_REQ
DISCARD_REQ
DISCARD_RESP
DOWNLOAD_PROGRESS
DOWNLOAD_REQ
ERROR
EXEC_REQ
EXIT
FS_OK_RESP
FWD_REQ
FWD_RESP
KILL
MKDIR_REQ
MOUNT_REQ
MOUNT_RESP
READ_DIR_REQ
READ_DIR_RESP
READ_FILE_REQ
READ_FILE_RESP
REMOVE_REQ
RENAME_REQ
RESIZE
STAT_REQ
STAT_RESP
STDERR
STDIN
STDOUT
WATCH_EVENT
WATCH_REQ
WRITE_FILE_DATA
WRITE_FILE_REQ
WRITE_FILE_RESP

Functions§

exit_payload
Build an EXIT payload: [i32 BE code].
parse_exit_code
Parse an EXIT payload into an i32 exit code.
parse_resize
Parse a RESIZE payload into (rows, cols).
read_frame
Read a binary frame. Returns None on clean EOF, Err on protocol violations or I/O errors.
resize_payload
Build a RESIZE payload: [u16 BE rows][u16 BE cols].
send_json
Serialize msg as JSON and send it as a typed frame.
try_parse
Try to parse a complete frame from the front of buf. Returns Some((msg_type, payload_start, total_len)) if a full frame is available, None if more data is needed.
write_frame
Write a binary frame: [u32 BE length][u8 type][payload].