commit 3c2364790c5a1cf836c15227a9f28b948918d8d3
parent 5435b814f3fead79773b01c2fc64154b466f3ee8
Author: Nick Mathewson <nickm@torproject.org>
Date: Thu, 17 Apr 2025 09:39:06 -0400
prop359: Introduce an enum for cell format.
(Using u8 everywhere makes me nervous.)
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/core/or/or.h b/src/core/or/or.h
@@ -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)
{
diff --git a/src/core/or/relay_msg_st.h b/src/core/or/relay_msg_st.h
@@ -20,10 +20,10 @@
* 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;