(Using u8 everywhere makes me nervous.)
/** 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)
{
* 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;