]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
prop359: Introduce an enum for cell format.
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2025 13:39:06 +0000 (09:39 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 5 May 2025 17:06:38 +0000 (13:06 -0400)
(Using u8 everywhere makes me nervous.)

src/core/or/or.h
src/core/or/relay_msg_st.h

index 9c6f690a710e3f2eac317fcc2d5b8946b00eceb5..88954be32c8233eb7790010e819048eb87d5d94b 100644 (file)
@@ -472,6 +472,14 @@ typedef enum {
 /** Maximum length of a header on a variable-length cell. */
 #define VAR_CELL_MAX_HEADER_SIZE 7
 
+/** Which format should we use for relay cells? */
+typedef enum relay_cell_fmt_t {
+  /** Our original format, with 2 byte recognized field and a 4-byte digest */
+  RELAY_CELL_FORMAT_V0,
+  /** New format introduced for CGO, with 16 byte tag. */
+  RELAY_CELL_FORMAT_V1,
+} relay_cell_fmt_t;
+
 static int get_cell_network_size(int wide_circ_ids);
 static inline int get_cell_network_size(int wide_circ_ids)
 {
index 4cdaa75d6dab0469d2d0607afeb843d8c4b8cc32..75292b7f89147401cf58db795a61cb028b6f712e 100644 (file)
  * This CAN NOT be made opaque so to avoid heap allocation in the fast path. */
 typedef struct relay_msg_t {
   /* Relay cell protocol version of this message. */
-  uint8_t relay_cell_proto;
+  relay_cell_fmt_t relay_cell_proto;
   /* Relay command of a message. */
   uint8_t command;
-  /* Length of payload. */
+  /* Length of the message body. */
   uint16_t length;
   /* Optional routing header: stream ID of a message or 0. */
   streamid_t stream_id;