Tor 0.4.9.2-alpha-dev
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sendme.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 sendme.h
6 * \brief Header file for sendme.c.
7 **/
8
9#ifndef TOR_SENDME_H
10#define TOR_SENDME_H
11
14#include "core/or/circuit_st.h"
15
16/* Sending SENDME cell. */
19 crypt_path_t *layer_hint);
20
21/* Processing SENDME cell. */
22int sendme_process_circuit_level(crypt_path_t *layer_hint,
23 circuit_t *circ, const uint8_t *cell_payload,
24 uint16_t cell_payload_len);
26int sendme_process_stream_level(edge_connection_t *conn, circuit_t *circ,
27 uint16_t cell_body_len);
28
29/* Update deliver window functions. */
30int sendme_stream_data_received(edge_connection_t *conn);
31int sendme_circuit_data_received(circuit_t *circ, crypt_path_t *layer_hint);
32
33/* Update package window functions. */
34int sendme_note_circuit_data_packaged(circuit_t *circ,
35 crypt_path_t *layer_hint);
36int sendme_note_stream_data_packaged(edge_connection_t *conn, size_t len);
37
38/* Record cell digest on circuit. */
39void sendme_record_cell_digest_on_circ(circuit_t *circ, crypt_path_t *cpath);
40
41/* Private section starts. */
42#ifdef SENDME_PRIVATE
43
44/* The maximum supported version. Above that value, the cell can't be
45 * recognized as a valid SENDME. */
46#define SENDME_MAX_SUPPORTED_VERSION 1
47
48/* The cell version constants for when emitting a cell. */
49#define SENDME_EMIT_MIN_VERSION_DEFAULT 1
50#define SENDME_EMIT_MIN_VERSION_MIN 0
51#define SENDME_EMIT_MIN_VERSION_MAX UINT8_MAX
52
53/* The cell version constants for when accepting a cell. */
54#define SENDME_ACCEPT_MIN_VERSION_DEFAULT 0
55#define SENDME_ACCEPT_MIN_VERSION_MIN 0
56#define SENDME_ACCEPT_MIN_VERSION_MAX UINT8_MAX
57
58/*
59 * Unit tests declaractions.
60 */
61#ifdef TOR_UNIT_TESTS
62
63STATIC int get_emit_min_version(void);
64STATIC int get_accept_min_version(void);
65
66STATIC bool cell_version_can_be_handled(uint8_t cell_version);
67
68STATIC ssize_t build_cell_payload_v1(const uint8_t *cell_tag,
69 size_t tag_len,
70 uint8_t *payload);
71STATIC bool sendme_is_valid(const circuit_t *circ,
72 const crypt_path_t *layer_hint,
73 const uint8_t *cell_payload,
74 size_t cell_payload_len);
75
76#endif /* defined(TOR_UNIT_TESTS) */
77
78#endif /* defined(SENDME_PRIVATE) */
79
80#endif /* !defined(TOR_SENDME_H) */
Base circuit structure.
Path structures for origin circuits.
Edge-connection structure.
void sendme_circuit_consider_sending(circuit_t *circ, crypt_path_t *layer_hint)
Definition: sendme.c:440
int sendme_process_circuit_level_impl(crypt_path_t *, circuit_t *)
Definition: sendme.c:527
void sendme_connection_edge_consider_sending(edge_connection_t *edge_conn)
Definition: sendme.c:393
#define STATIC
Definition: testsupport.h:32