Bug 29085: Refactor non-padding accounting out of token removal.
[tor.git] / src / core / or / sendme.h
blobac18bbdd31939db2f3c0ec5821a8480571babb3c
1 /* Copyright (c) 2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file sendme.h
6 * \brief Header file for sendme.c.
7 **/
9 #ifndef TOR_SENDME_H
10 #define TOR_SENDME_H
12 #include "core/or/edge_connection_st.h"
13 #include "core/or/crypt_path_st.h"
14 #include "core/or/circuit_st.h"
16 /* Sending SENDME cell. */
17 void sendme_connection_edge_consider_sending(edge_connection_t *edge_conn);
18 void sendme_circuit_consider_sending(circuit_t *circ,
19 crypt_path_t *layer_hint);
21 /* Processing SENDME cell. */
22 int sendme_process_circuit_level(crypt_path_t *layer_hint,
23 circuit_t *circ, const uint8_t *cell_payload,
24 uint16_t cell_payload_len);
25 int sendme_process_stream_level(edge_connection_t *conn, circuit_t *circ,
26 uint16_t cell_body_len);
28 /* Update deliver window functions. */
29 int sendme_stream_data_received(edge_connection_t *conn);
30 int sendme_circuit_data_received(circuit_t *circ, crypt_path_t *layer_hint);
32 /* Update package window functions. */
33 int sendme_note_circuit_data_packaged(circuit_t *circ,
34 crypt_path_t *layer_hint);
35 int sendme_note_stream_data_packaged(edge_connection_t *conn);
37 /* Track cell digest. */
38 void sendme_record_cell_digest(circuit_t *circ);
39 void sendme_circuit_record_outbound_cell(or_circuit_t *or_circ);
41 /* Circuit level information. */
42 bool sendme_circuit_cell_is_next(int window);
44 /* Private section starts. */
45 #ifdef SENDME_PRIVATE
48 * Unit tests declaractions.
50 #ifdef TOR_UNIT_TESTS
52 STATIC int get_emit_min_version(void);
53 STATIC int get_accept_min_version(void);
55 STATIC bool cell_version_is_valid(uint8_t cell_version);
57 STATIC ssize_t build_cell_payload_v1(const uint8_t *cell_digest,
58 uint8_t *payload);
59 STATIC bool sendme_is_valid(const circuit_t *circ,
60 const uint8_t *cell_payload,
61 size_t cell_payload_len);
63 #endif /* TOR_UNIT_TESTS */
65 #endif /* SENDME_PRIVATE */
67 #endif /* !defined(TOR_SENDME_H) */