]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add some TODOs for CGO msg format
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2025 13:23:49 +0000 (09:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 5 May 2025 17:05:45 +0000 (13:05 -0400)
src/core/or/cell_st.h
src/core/or/or.h
src/core/or/relay_cell.h

index b6ffff94374a7ac21a318c27e77e3e3e54ecde12..230b4f84327e5459a6963ed12ef48ec21e56e580 100644 (file)
@@ -20,6 +20,8 @@ struct cell_t {
                     * CELL_DESTROY, etc */
   /* Relay cell protocol version. This tells us which format to use when
    * parsing the payload. */
+  /* TODO #41051: Use an enum. */
+  /* TODO #41051: Reconsider whether this field belongs here. */
   uint8_t relay_cell_proto;
   uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
 };
index 536b2ecdb959609eefa66bf910cfdf3744432d9c..9c6f690a710e3f2eac317fcc2d5b8946b00eceb5 100644 (file)
@@ -489,6 +489,7 @@ static inline int get_circ_id_size(int wide_circ_ids)
   return wide_circ_ids ? 4 : 2;
 }
 
+/* TODO #41051: It would be better if these went away. */
 /** Number of bytes in a relay cell's header (not including general cell
  * header). */
 #define RELAY_HEADER_SIZE (1+2+2+4+2)
index 9ae628c5bb8ab139c0f1ba5f8ab0565c8eeee2c6..05f0e9f10da3f1f362d375fb51dd087eaf1daa37 100644 (file)
@@ -18,6 +18,9 @@
  * payload for the future of our C-tor maze and protocol. */
 #define RELAY_CELL_PADDING_GAP 4
 
+/* TODO #41051: Most of these functions no longer make sense under CGO,
+ * and we are only going to use the new proto format with CGO. */
+
 /* Getters. */
 bool relay_cell_is_recognized(const cell_t *cell);
 uint8_t *relay_cell_get_digest(cell_t *cell);
@@ -42,6 +45,12 @@ relay_cell_get_header_size(uint8_t relay_cell_proto)
   /* Specified in tor-spec.txt. */
   switch (relay_cell_proto) {
   case 0: return (1 + 2 + 2 + 4 + 2); // 11
+  // TODO #41051: This doesn't really make sense, for two reasons.
+  // First, we're not going to do this protocol without CGO,
+  // so we no longer have separate "recognized" and "digest" fields.
+  // Second, the 16-byte tag under CGO does not include
+  // the length and command fields,
+  // which are counted above.
   case 1: return (2 + 14); // 16
   default:
     tor_fragile_assert();
@@ -51,6 +60,9 @@ relay_cell_get_header_size(uint8_t relay_cell_proto)
 
 /** Return the size of the relay cell payload for the given relay cell
  * protocol version. */
+/* TODO #41051: This depends on the command too, since the stream ID is
+   conditional */
+/* TODO #41051: This is a _maximum_. */
 static inline size_t
 relay_cell_get_payload_size(uint8_t relay_cell_proto)
 {
@@ -65,4 +77,3 @@ STATIC size_t get_pad_cell_offset(size_t payload_len,
 #endif /* RELAY_CELL_PRIVATE */
 
 #endif /* TOR_RELAY_CELL_H */
-