Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
conflux_util.h
Go to the documentation of this file.
1/* Copyright (c) 2023, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * \file conflux_util.h
6 * \brief Header file for conflux_util.c.
7 **/
8
9#ifndef TOR_CONFLUX_UTIL_H
10#define TOR_CONFLUX_UTIL_H
11
12/* Forward decls */
14typedef struct crypt_path_t crypt_path_t;
16typedef struct conflux_t conflux_t;
17
18/* True iff the given circuit_t circ is conflux related. */
19static inline bool
20CIRCUIT_IS_CONFLUX(const circuit_t *circ)
21{
22 if (circ->conflux_pending_nonce) {
23 if (CIRCUIT_IS_ORIGIN(circ))
24 tor_assert_nonfatal(circ->purpose == CIRCUIT_PURPOSE_CONFLUX_UNLINKED);
25 return true;
26 } else if (circ->conflux) {
27 if (CIRCUIT_IS_ORIGIN(circ))
28 tor_assert_nonfatal(circ->purpose == CIRCUIT_PURPOSE_CONFLUX_LINKED);
29 return true;
30 } else {
31 /* We don't assert on purposes here because we can end up in this branch
32 * with circ->conflux being NULL but for a conflux purpose. This happens in
33 * the about_to_free() code path. */
34 return false;
35 }
36}
37
38const uint8_t *conflux_get_nonce(const circuit_t *circ);
39uint64_t conflux_get_circ_rtt(const circuit_t *circ);
40
42 const crypt_path_t *cpath);
44
45bool edge_uses_cpath(const edge_connection_t *conn,
46 const crypt_path_t *cpath);
49 crypt_path_t *layer_hint);
50uint64_t edge_get_max_rtt(const edge_connection_t *stream);
52 const crypt_path_t *layer_hint);
53
60void conflux_validate_legs(const conflux_t *cfx);
61
62#endif /* TOR_CONFLUX_UTIL_H */
63
#define CIRCUIT_IS_ORIGIN(c)
#define CIRCUIT_PURPOSE_CONFLUX_UNLINKED
void conflux_validate_stream_lists(const conflux_t *cfx)
void conflux_update_half_streams(origin_circuit_t *, smartlist_t *)
uint64_t edge_get_max_rtt(const edge_connection_t *stream)
const uint8_t * conflux_get_nonce(const circuit_t *circ)
void conflux_update_resolving_streams(or_circuit_t *, edge_connection_t *)
void conflux_update_p_streams(origin_circuit_t *, edge_connection_t *)
uint64_t conflux_get_circ_rtt(const circuit_t *circ)
crypt_path_t * conflux_get_destination_hop(circuit_t *circ)
void conflux_validate_legs(const conflux_t *cfx)
bool conflux_validate_source_hop(circuit_t *in_circ, crypt_path_t *layer_hint)
void conflux_sync_circ_fields(conflux_t *cfx, origin_circuit_t *ref_circ)
void conflux_update_n_streams(or_circuit_t *, edge_connection_t *)
int circuit_get_package_window(circuit_t *circ, const crypt_path_t *cpath)
bool conflux_can_send(conflux_t *cfx)
bool relay_crypt_from_last_hop(const origin_circuit_t *circ, const crypt_path_t *layer_hint)
bool edge_uses_cpath(const edge_connection_t *conn, const crypt_path_t *cpath)
struct conflux_t * conflux
Definition circuit_st.h:273
uint8_t purpose
Definition circuit_st.h:112
uint8_t * conflux_pending_nonce
Definition circuit_st.h:281