Skip to main content

Module msg

Module msg 

Source
Expand description

9P2000.L message types and wire format serialization.

Minimal implementation — only the message types needed for a 9P client to walk, open, read, write, readdir, stat, and clunk.

Wire format: all little-endian, length-prefixed.

[4 bytes: total size including this field]
[1 byte: message type]
[2 bytes: tag]
[... type-specific fields ...]

Structs§

DirEntryP9
A parsed directory entry from Rreaddir data.
Qid
ReaddirEntry
One directory entry to encode into an Rreaddir payload.

Enums§

Request
Parsed T-message from a client.
Response
Parsed R-message from server.

Constants§

RATTACH
RCLUNK
RFLUSH
RGETATTR
RLERROR
RLOPEN
RREAD
RREADDIR
RVERSION
RWALK
RWRITE
TATTACH
TCLUNK
TFLUSH
9P2000.L Tflush — not exercised by the client codec but defined for symmetry.
TGETATTR
TLOPEN
TREAD
TREADDIR
TVERSION
TWALK
TWRITE

Functions§

encode_readdir_page
Encode a directory listing as a page of standard 9P2000.L Rreaddir dirent records with cookie-based paging.
encode_response
Serialize an R-message (including length prefix) from a Response.
encode_tmessage
Serialize a T-message to wire format (including length prefix).
parse_readdir_entries
Parse Rreaddir data into directory entries.
parse_request
Parse a T-message from wire bytes (including length prefix).
parse_response
Parse an R-message from wire bytes (including length prefix).
rattach
rclunk
rflush
rgetattr
Encode an Rgetattr. Only the fields carried by Response::Getattr are populated; the rest are zero (matches the subset the client decoder reads).
rlerror
rlopen
rread
rreaddir
Encode an Rreaddir. Body is count[4] · data[count] (identical framing to rread) but the message type is RREADDIR (41). data must already be a packed run of standard dirent records — build it with encode_readdir_page.
rversion
rwalk
rwrite
tattach
tclunk
tgetattr
tlopen
tread
treaddir
tversion
twalk
twrite