Merge branch 'maint-0.4.8'
[tor.git] / src / core / or / conflux_cell.h
blob60fff42241cc476fee1abd34f108e5454506f972
1 /* Copyright (c) 2023, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file conflux_cell.h
6 * \brief Header file for conflux_cell.c.
7 **/
9 #ifndef TOR_CONFLUX_CELL_H
10 #define TOR_CONFLUX_CELL_H
12 #include "core/or/or.h"
14 typedef struct conflux_cell_link_t {
15 uint8_t version;
16 uint8_t desired_ux;
17 uint8_t nonce[DIGEST256_LEN];
19 uint64_t last_seqno_sent;
20 uint64_t last_seqno_recv;
21 } conflux_cell_link_t;
23 conflux_cell_link_t *conflux_cell_new_link(const uint8_t *nonce,
24 uint64_t last_sent,
25 uint64_t last_recv,
26 uint8_t ux);
28 conflux_cell_link_t *conflux_cell_parse_link(const cell_t *cell,
29 const uint16_t cell_len);
30 conflux_cell_link_t *conflux_cell_parse_linked(const cell_t *cell,
31 const uint16_t cell_le);
32 uint32_t conflux_cell_parse_switch(const cell_t *cell,
33 const uint16_t rh_len);
35 bool conflux_cell_send_link(const conflux_cell_link_t *link,
36 origin_circuit_t *circ);
37 bool conflux_cell_send_linked(const conflux_cell_link_t *link,
38 or_circuit_t *circ);
39 bool conflux_cell_send_linked_ack(origin_circuit_t *circ);
40 bool conflux_send_switch_command(circuit_t *send_circ, uint64_t relative_seq);
42 #ifdef TOR_UNIT_TESTS
44 STATIC ssize_t
45 build_link_cell(const conflux_cell_link_t *link, uint8_t *cell_out);
47 #endif /* TOR_UNIT_TESTS */
49 #endif /* TOR_CONFLUX_CELL_H */