Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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"
15
16typedef struct conflux_t conflux_t;
17typedef struct conflux_leg_t conflux_leg_t;
18
19/** Helpers to iterate over legs with better semantic. */
20#define CONFLUX_FOR_EACH_LEG_BEGIN(cfx, var) \
21 SMARTLIST_FOREACH_BEGIN(cfx->legs, conflux_leg_t *, var)
22#define CONFLUX_FOR_EACH_LEG_END(var) \
23 SMARTLIST_FOREACH_END(var)
24
25/** Helper: Return the number of legs a conflux object has. */
26#define CONFLUX_NUM_LEGS(cfx) (smartlist_len(cfx->legs))
27
28/** A relay message for the out-of-order queue. */
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 relay message 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,
58 const relay_msg_t *msg);
59bool conflux_should_multiplex(int relay_command);
61 crypt_path_t *layer_hint,
62 const relay_msg_t *msg);
65 uint8_t relay_command);
67#define conflux_relay_msg_free(msg) \
68 FREE_AND_NULL(conflux_msg_t, conflux_relay_msg_free_, (msg))
69
70/* Private section starts. */
71#ifdef TOR_CONFLUX_PRIVATE
72
75uint64_t conflux_get_max_seq_recv(const conflux_t *cfx);
76uint64_t conflux_get_max_seq_sent(const conflux_t *cfx);
77
78/*
79 * Unit tests declaractions.
80 */
81#ifdef TOR_UNIT_TESTS
82
83#endif /* defined(TOR_UNIT_TESTS) */
84
85#endif /* defined(TOR_CONFLUX_PRIVATE) */
86
87#endif /* !defined(TOR_CONFLUX_H) */
Base circuit structure.
const congestion_control_t * circuit_ccontrol(const circuit_t *circ)
Definition: conflux.c:708
uint64_t conflux_get_max_seq_recv(const conflux_t *cfx)
Definition: conflux.c:154
uint64_t conflux_get_max_seq_sent(const conflux_t *cfx)
Definition: conflux.c:137
conflux_leg_t * conflux_get_leg(conflux_t *cfx, const circuit_t *circ)
Definition: conflux.c:116
void conflux_note_cell_sent(conflux_t *cfx, circuit_t *circ, uint8_t relay_command)
Definition: conflux.c:526
void conflux_update_rtt(conflux_t *cfx, circuit_t *circ, uint64_t rtt_usec)
Definition: conflux.c:656
bool conflux_should_multiplex(int relay_command)
Definition: conflux.c:48
circuit_t * conflux_decide_next_circ(conflux_t *cfx)
Definition: conflux.c:607
uint64_t conflux_get_circ_bytes_allocation(const circuit_t *circ)
Definition: conflux.c:170
void conflux_relay_msg_free_(conflux_msg_t *msg)
Definition: conflux.c:920
circuit_t * conflux_decide_circ_for_send(conflux_t *cfx, circuit_t *orig_circ, uint8_t relay_command)
Definition: conflux.c:455
conflux_msg_t * conflux_dequeue_relay_msg(conflux_t *cfx)
Definition: conflux.c:897
bool conflux_process_relay_msg(conflux_t *cfx, circuit_t *in_circ, crypt_path_t *layer_hint, const relay_msg_t *msg)
Definition: conflux.c:833
int conflux_process_switch_command(circuit_t *in_circ, crypt_path_t *layer_hint, const relay_msg_t *msg)
Definition: conflux.c:735
size_t conflux_handle_oom(size_t bytes_to_remove)
Definition: conflux.c:189
uint64_t conflux_get_total_bytes_allocation(void)
Definition: conflux.c:182
Structure definitions for conflux multipath.
A relay message which contains a relay command and parameters, if any, that is from a relay cell.
uint64_t seq
Definition: conflux.h:33
relay_msg_t * msg
Definition: conflux.h:42
int heap_idx
Definition: conflux.h:38