aboutsummaryrefslogtreecommitdiff
path: root/spec/tor-spec/cell-packet-format.md
diff options
context:
space:
mode:
authorJim Newsome <jnewsome@torproject.org>2023-11-06 10:28:08 -0600
committerJim Newsome <jnewsome@torproject.org>2023-11-06 10:31:17 -0600
commitc3670373cb7c4b5893169dc813800b4b86c28a36 (patch)
tree1c5cf04af529213decfe4e6065a1fa5b07347f37 /spec/tor-spec/cell-packet-format.md
parent8a37a5e8b1b823f789043ed171f5164d3d31466a (diff)
downloadtorspec-c3670373cb7c4b5893169dc813800b4b86c28a36.tar.gz
torspec-c3670373cb7c4b5893169dc813800b4b86c28a36.zip
cell-packet-format: reformat code blocks
Diffstat (limited to 'spec/tor-spec/cell-packet-format.md')
-rw-r--r--spec/tor-spec/cell-packet-format.md109
1 files changed, 53 insertions, 56 deletions
diff --git a/spec/tor-spec/cell-packet-format.md b/spec/tor-spec/cell-packet-format.md
index 2550da3..f3f8d66 100644
--- a/spec/tor-spec/cell-packet-format.md
+++ b/spec/tor-spec/cell-packet-format.md
@@ -8,21 +8,21 @@ proxies is a fixed-width "cell".
On a version 1 connection, each cell contains the following
fields:
-```text
- CircID [CIRCID_LEN bytes]
- Command [1 byte]
- Payload (padded with padding bytes) [PAYLOAD_LEN bytes]
-```
+| Field | Notes | Size |
+------------------------------------------------------
+| CircID | | CIRCID_LEN bytes |
+| Command | | 1 byte |
+| Payload | padded with padding bytes | PAYLOAD_LEN |
On a version 2 or higher connection, all cells are as in version 1
connections, except for variable-length cells, whose format is:
-```text
- CircID [CIRCID_LEN octets]
- Command [1 octet]
- Length [2 octets; big-endian integer]
- Payload (some commands MAY pad) [Length bytes]
-```
+| Field | Notes | Size |
+---------------------------------------------------
+| CircID | | CIRCID_LEN octets |
+| Command | | 1 octet |
+| Length | | 2 octets; big-endian integer |
+| Payload | some commands MAY pad | Length bytes |
Most variable-length cells MAY be padded with padding bytes, except
for VERSIONS cells, which MUST NOT contain any additional bytes.
@@ -44,39 +44,39 @@ associated with.
The 'Command' field of a fixed-length cell holds one of the following
values:
-```text
- 0 -- PADDING (Padding) (See Sec 7.2)
- 1 -- CREATE (Create a circuit) (See Sec 5.1)
- 2 -- CREATED (Acknowledge create) (See Sec 5.1)
- 3 -- RELAY (End-to-end data) (See Sec 5.5 and 6)
- 4 -- DESTROY (Stop using a circuit) (See Sec 5.4)
- 5 -- CREATE_FAST (Create a circuit, no KP) (See Sec 5.1)
- 6 -- CREATED_FAST (Circuit created, no KP) (See Sec 5.1)
- 8 -- NETINFO (Time and address info) (See Sec 4.5)
- 9 -- RELAY_EARLY (End-to-end data; limited)(See Sec 5.6)
- 10 -- CREATE2 (Extended CREATE cell) (See Sec 5.1)
- 11 -- CREATED2 (Extended CREATED cell) (See Sec 5.1)
- 12 -- PADDING_NEGOTIATE (Padding negotiation) (See Sec 7.2)
-
- Variable-length command values are:
-
- 7 -- VERSIONS (Negotiate proto version) (See Sec 4)
- 128 -- VPADDING (Variable-length padding) (See Sec 7.2)
- 129 -- CERTS (Certificates) (See Sec 4.2)
- 130 -- AUTH_CHALLENGE (Challenge value) (See Sec 4.3)
- 131 -- AUTHENTICATE (Client authentication)(See Sec 4.5)
- 132 -- AUTHORIZE (Client authorization) (Not yet used)
-
- The interpretation of 'Payload' depends on the type of the cell.
-
- VPADDING/PADDING:
- Payload contains padding bytes.
- CREATE/CREATE2: Payload contains the handshake challenge.
- CREATED/CREATED2: Payload contains the handshake response.
- RELAY/RELAY_EARLY: Payload contains the relay header and relay body.
- DESTROY: Payload contains a reason for closing the circuit.
- (see 5.4)
-```
+| Value | Identifier | Description |
+----------------------------------------------------------------------
+| 0 | PADDING | Padding (See Sec 7.2) |
+| 1 | CREATE | Create a circuit (See Sec 5.1) |
+| 2 | CREATED | Acknowledge create (See Sec 5.1) |
+| 3 | RELAY | End-to-end data (See Sec 5.5 and 6) |
+| 4 | DESTROY | Stop using a circuit (See Sec 5.4) |
+| 5 | CREATE_FAST | Create a circuit, no KP (See Sec 5.1) |
+| 6 | CREATED_FAST | Circuit created, no KP (See Sec 5.1) |
+| 8 | NETINFO | Time and address info (See Sec 4.5) |
+| 9 | RELAY_EARLY | End-to-end data; limited (See Sec 5.6) |
+| 10 | CREATE2 | Extended CREATE cell (See Sec 5.1) |
+| 11 | CREATED2 | Extended CREATED cell (See Sec 5.1) |
+| 12 | PADDING_NEGOTIATE | Padding negotiation (See Sec 7.2) |
+
+Variable-length command values are:
+
+| Value | Identifier | Description |
+------------------------------------------------------------------
+| 7 | VERSIONS | Negotiate proto version (See Sec 4) |
+| 128 | VPADDING | Variable-length padding (See Sec 7.2) |
+| 129 | CERTS | Certificates (See Sec 4.2) |
+| 130 | AUTH_CHALLENGE | Challenge value (See Sec 4.3) |
+| 131 | AUTHENTICATE | Client authentication (See Sec 4.5) |
+| 132 | AUTHORIZE | Client authorization (Not yet used) |
+
+The interpretation of 'Payload' depends on the type of the cell.
+
+* VPADDING/PADDING: Payload contains padding bytes.
+* CREATE/CREATE2: Payload contains the handshake challenge.
+* CREATED/CREATED2: Payload contains the handshake response.
+* RELAY/RELAY_EARLY: Payload contains the relay header and relay body.
+* DESTROY: Payload contains a reason for closing the circuit. (see 5.4)
Upon receiving any other value for the command field, an OR must
drop the cell. Since more cell types may be added in the future, ORs
@@ -86,18 +86,15 @@ The cell is padded up to the cell length with padding bytes.
Senders set padding bytes depending on the cell's command:
-```text
- VERSIONS: Payload MUST NOT contain padding bytes.
- AUTHORIZE: Payload is unspecified and reserved for future use.
- Other variable-length cells:
- Payload MAY contain padding bytes at the end of the cell.
- Padding bytes SHOULD be set to NUL.
- RELAY/RELAY_EARLY: Payload MUST be padded to PAYLOAD_LEN with padding
- bytes. Padding bytes SHOULD be set to random values.
- Other fixed-length cells:
- Payload MUST be padded to PAYLOAD_LEN with padding bytes.
- Padding bytes SHOULD be set to NUL.
-```
+* VERSIONS: Payload MUST NOT contain padding bytes.
+* AUTHORIZE: Payload is unspecified and reserved for future use.
+* Other variable-length cells:
+ * Payload MAY contain padding bytes at the end of the cell.
+ * Padding bytes SHOULD be set to NUL.
+* RELAY/RELAY_EARLY: Payload MUST be padded to PAYLOAD_LEN with padding bytes. Padding bytes SHOULD be set to random values.
+* Other fixed-length cells:
+ * Payload MUST be padded to PAYLOAD_LEN with padding bytes.
+ * Padding bytes SHOULD be set to NUL.
We recommend random padding in RELAY/RELAY_EARLY cells, so that the cell
content is unpredictable. See the format of relay cells in section 6.1