1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# 9P protocol definitions
<!--
Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
SPDX-Licence-Identifier: AGPL-3.0-or-later
-->
This directory contains several `*.9p` files, each of which describes
a 9P protocol variant.
In the 9P protocol, each message has a type, and message types come
in pairs (except "Rerror"); "T" and "R"; T-messages are
client->server requests, and R-messages are server->client responses
(the client "Transmits" T-messages and "Receives" R-messages). The
type of a message is represented by a u8 ID; T-messages are even and
R-messages are odd.
Messages are made up of the primitives; unsigned little-endian
integers, identified with the following single-character mnemonics:
- 1 = u8
- 2 = u16le
- 4 = u32le
- 8 = u16le
Out of these primitives, we can make other numeric types,
num NUMNAME = PRIMITIVE_TYPE
bitfields,
bitfield BFNAME = PRIMITIVE_TYPE "NBIT=NAME... ALIAS=VAL..."
structures,
struct STRUCTNAME = "FILENAME[FIELDTYPE]..."
and messages (which are a special-case of structures).
msg Tname = "size[4,val=end-&size] typ[1,val=TYP] tag[tag] REST..."
Struct fields that have numeric types (either primitives or `num`
types) can add to their type `,val=` and/or `,max=` to specify what
the exact value must be and/or what the maximum (inclusive) value is.
`,val=` and `,max` take a string of `+`/`-` tokens and values; a value
can either be a decimal numeric constant (eg: `107`), the `&fieldname`
to refer to the offset of a field name in that struct, or the special
value `end` to refer to the offset of the end of the struct.
|