Tor 0.4.9.0-alpha-dev
conflux.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.h
6 * \brief Public APIs for conflux multipath support
7 **/
8
9#ifndef TOR_CONFLUX_H
10#define TOR_CONFLUX_H
11
12#include "core/or/circuit_st.h"
13#include "core/or/conflux_st.h"
14
15typedef struct conflux_t conflux_t;
16typedef struct conflux_leg_t conflux_leg_t;
17
18/** Helpers to iterate over legs with better semantic. */
19#define CONFLUX_FOR_EACH_LEG_BEGIN(cfx, var) \
20 SMARTLIST_FOREACH_BEGIN(cfx->legs, conflux_leg_t *, var)
21#define CONFLUX_FOR_EACH_LEG_END(var) \
22 SMARTLIST_FOREACH_END(var)
23
24/** Helper: Return the number of legs a conflux object has. */
25#define CONFLUX_NUM_LEGS(cfx) (smartlist_len(cfx->legs))
26
27/** A cell for the out-of-order queue.
28 * XXX: Consider trying to use packed_cell_t instead here? */
29typedef struct {
30 /**
31 * Absolute sequence number of this cell, computed from the
32 * relative sequence number of the conflux cell. */
33 uint64_t seq;
34
35 /**
36 * Heap index of this cell, for use in in the conflux_t ooo_q heap.
37 */
39
40 /** The cell here is always guaranteed to have removed its
41 * extra conflux sequence number, for ease of processing */
44
45size_t conflux_handle_oom(size_t bytes_to_remove);
48
49void conflux_update_rtt(conflux_t *cfx, circuit_t *circ, uint64_t rtt_usec);
50
52 circuit_t *orig_circ,
53 uint8_t relay_command);
55
57 crypt_path_t *layer_hint, cell_t *cell,
58 relay_header_t *rh);
59bool conflux_should_multiplex(int relay_command);
60bool conflux_process_cell(conflux_t *cfx, circuit_t *in_circ,
61 crypt_path_t *layer_hint,
62 cell_t *cell);
65 uint8_t relay_command);
66
67/* Private section starts. */
68#ifdef TOR_CONFLUX_PRIVATE
69
72uint64_t conflux_get_max_seq_recv(const conflux_t *cfx);
73uint64_t conflux_get_max_seq_sent(const conflux_t *cfx);
74
75/*
76 * Unit tests declaractions.
77 */
78#ifdef TOR_UNIT_TESTS
79
80#endif /* defined(TOR_UNIT_TESTS) */
81
82#endif /* defined(TOR_CONFLUX_PRIVATE) */
83
84#endif /* !defined(TOR_CONFLUX_H) */
Base circuit structure.
const congestion_control_t * circuit_ccontrol(const circuit_t *circ)
Definition: conflux.c:707
uint64_t conflux_get_max_seq_recv(const conflux_t *cfx)
Definition: conflux.c:153
uint64_t conflux_get_max_seq_sent(const conflux_t *cfx)
Definition: conflux.c:136
conflux_leg_t * conflux_get_leg(conflux_t *cfx, const circuit_t *circ)
Definition: conflux.c:115
void conflux_note_cell_sent(conflux_t *cfx, circuit_t *circ, uint8_t relay_command)
Definition: conflux.c:525
void conflux_update_rtt(conflux_t *cfx, circuit_t *circ, uint64_t rtt_usec)
Definition: conflux.c:655
bool conflux_process_cell(conflux_t *cfx, circuit_t *in_circ, crypt_path_t *layer_hint, cell_t *cell)
Definition: conflux.c:833
int conflux_process_switch_command(circuit_t *in_circ, crypt_path_t *layer_hint, cell_t *cell, relay_header_t *rh)
Definition: conflux.c:734
bool conflux_should_multiplex(int relay_command)
Definition: conflux.c:47
circuit_t * conflux_decide_next_circ(conflux_t *cfx)
Definition: conflux.c:606
uint64_t conflux_get_circ_bytes_allocation(const circuit_t *circ)
Definition: conflux.c:169
conflux_cell_t * conflux_dequeue_cell(conflux_t *cfx)
Definition: conflux.c:892
circuit_t * conflux_decide_circ_for_send(conflux_t *cfx, circuit_t *orig_circ, uint8_t relay_command)
Definition: conflux.c:454
size_t conflux_handle_oom(size_t bytes_to_remove)
Definition: conflux.c:188
uint64_t conflux_get_total_bytes_allocation(void)
Definition: conflux.c:181
Structure definitions for conflux multipath.
Definition: cell_st.h:17
uint64_t seq
Definition: conflux.h:33
int heap_idx
Definition: conflux.h:38
cell_t cell
Definition: conflux.h:42