Tor 0.4.9.0-alpha-dev
conflux_st.h
Go to the documentation of this file.
1/* Copyright (c) 2019-2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * \file conflux_st.h
6 * \brief Structure definitions for conflux multipath
7 **/
8
9#ifndef CONFLUX_ST_H
10#define CONFLUX_ST_H
11
12#include "core/or/circuit_st.h"
13#include "core/or/cell_st.h"
15
16/**
17* Specifies which conflux alg is in use.
18*/
19typedef enum {
20 CONFLUX_ALG_MINRTT = 0,
21 CONFLUX_ALG_LOWRTT = 1,
22 CONFLUX_ALG_CWNDRTT = 2,
24
25/** XXX: Cached consensus params+scheduling alg */
27 conflux_alg_t alg;
28};
29
31 /**
32 * For computing ooo_q insertion sequence numbers: Highest absolute
33 * sequence number received on each leg, before delivery.
34 *
35 * As a receiver, this allows us to compute the absolute sequence number
36 * of a cell for delivery or insertion into the ooo_q. When a SWITCH cell
37 * is received on a leg, the absolute sequence number of that cell is
38 * the relative sequence number in that cell, plus the absolute sequence
39 * number of that leg from this array. The leg's sequence number
40 * is then updated to this value immediately.
41 *
42 * In this way, we are able to assign absolute sequence numbers to cells
43 * immediately, regardless of how many legs or leg switches have occurred,
44 * and regardless of the delivery status of each cell versus if it must be
45 * queued.
46 */
47 uint64_t last_seq_recv;
48
49 /**
50 * For relative sequencing: Highest absolute sequence number sent on each
51 * circuit. The overall absolute current sent sequence number is the highest
52 * of these values.
53 *
54 * As a sender, this allows us to compute a relative sequence number when
55 * switching legs. When switching legs, the sender looks up its current
56 * absolute sequence number as the maximum of all legs. The sender then
57 * compares that to the current sequence number on the leg it is about to
58 * send on, and then computes the relative sequence number as the difference
59 * between the overall absolute sequence number and the sequence number
60 * from the sending leg.
61 *
62 * In this way, we can use much smaller relative sequence numbers on the
63 * wire, as opposed to larger absolute values, at the expense of this
64 * bookkeeping overhead on each end.
65 */
66 uint64_t last_seq_sent;
67
68 /**
69 * Current round-trip of the circuit, in usec.
70 *
71 * XXX: In theory, we could use the congestion control RTTs directly off the
72 * circs, but congestion control code has assumptions about the RTT being 0
73 * at the start of the circuit, which will *not* be the case here, because we
74 * get an RTT off the link circuit. */
76
77 /** Exit side only: When was the LINKED cell sent? Used for RTT measurement
78 * that sets circ_rtts_usec when the LINKED_ACK is received. */
80
81 /** Circuit of this leg. */
83};
84
85/** Fields for conflux multipath support */
86struct conflux_t {
87 /** Cached parameters for this circuit */
89
90 /**
91 * List of all linked conflux_leg_t for this set. Once a leg is in that list,
92 * it can be used to transmit data. */
94
95 /**
96 * Out-of-order priority queue of conflux_cell_t *, heapified
97 * on conflux_cell_t.seq number (lowest at top of heap).
98 *
99 * XXX: We are most likely to insert cells at either the head or the tail.
100 * Verify that is fast-path wrt smartlist priority queues, and not a memmove
101 * nightmare. If so, we may need a real linked list, or a packed_cell_t list.
102 */
104
105 /**
106 * Absolute sequence number of cells delivered to streams since start.
107 * (ie: this is updated *after* dequeue from the ooo_q priority queue). */
109
110 /**
111 * The estimated remaining number of cells we can send on this circuit
112 * before we are allowed to switch legs. */
114
115 /** Current circuit leg. Only use this with conflux_get_circ_for_leg() for
116 * bounds checking. */
118
119 /** Previous circuit leg. Only use this with conflux_get_circ_for_leg() for
120 * bounds checking. */
122
123 /** The nonce that joins these */
125
126 /** Indicate if this conflux set is in full teardown. We mark it at the first
127 * close in case of a total teardown so we avoid recursive calls of circuit
128 * mark for close. */
130
131 /** Number of leg launch that we've done for this set. We keep this value
132 * because there is a maximum allowed in order to avoid side channel(s). */
133 unsigned int num_leg_launch;
134
135 /**
136 * PolicyHint: Predicted ports/protocol shorthand..
137 *
138 * XXX: This might be redundant to the circuit's exitpolicy.
139 */
140};
141
142#endif /* !defined(CONFLUX_ST_H) */
Fixed-size cell structure.
Base circuit structure.
conflux_alg_t
Definition: conflux_st.h:19
Definitions for common sizes of cryptographic digests.
#define DIGEST256_LEN
Definition: digest_sizes.h:23
uint64_t last_seq_sent
Definition: conflux_st.h:66
uint64_t last_seq_recv
Definition: conflux_st.h:47
uint64_t circ_rtts_usec
Definition: conflux_st.h:75
uint64_t linked_sent_usec
Definition: conflux_st.h:79
circuit_t * circ
Definition: conflux_st.h:82
smartlist_t * ooo_q
Definition: conflux_st.h:103
struct conflux_leg_t * curr_leg
Definition: conflux_st.h:117
struct conflux_params_t params
Definition: conflux_st.h:88
struct conflux_leg_t * prev_leg
Definition: conflux_st.h:121
uint8_t nonce[DIGEST256_LEN]
Definition: conflux_st.h:124
uint64_t cells_until_switch
Definition: conflux_st.h:113
uint64_t last_seq_delivered
Definition: conflux_st.h:108
smartlist_t * legs
Definition: conflux_st.h:93
bool in_full_teardown
Definition: conflux_st.h:129
unsigned int num_leg_launch
Definition: conflux_st.h:133