diff options
author | David Goulet <dgoulet@torproject.org> | 2019-01-08 15:03:04 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-04-29 12:17:57 -0400 |
commit | 9c42cc1eb22da8125ec9596920dfb9113912eac0 (patch) | |
tree | 548f60c420955dc8cab545074905f7b294388a1a /src/core/or/sendme.h | |
parent | ed8593b9e0838f694eeb6315db38f6fadbc5ab71 (diff) | |
download | tor-9c42cc1eb22da8125ec9596920dfb9113912eac0.tar.gz tor-9c42cc1eb22da8125ec9596920dfb9113912eac0.zip |
sendme: Refactor SENDME cell processing
This is a bit of a complicated commit. It moves code but also refactors part
of it. No behavior change, the idea is to split things up so we can better
handle and understand how SENDME cells are processed where ultimately it will
be easier to handle authenticated SENDMEs (prop289) using the intermediate
functions added in this commit.
The entry point for the cell arriving at the edge (Client or Exit), is
connection_edge_process_relay_cell() for which we look if it is a circuit or
stream level SENDME. This commit refactors that part where two new functions
are introduced to process each of the SENDME types.
The sendme_process_circuit_level() has basically two code paths. If we are a
Client (the circuit is origin) or we are an Exit. Depending on which, the
package window is updated accordingly. Then finally, we resume the reading on
every edge streams on the circuit.
The sendme_process_stream_level() applies on the edge connection which will
update the package window if needed and then will try to empty the inbuf if
need be because we can now deliver more cells.
Again, no behavior change but in order to split that code properly into their
own functions and outside the relay.c file, code modification was needed.
Part of #26840.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/sendme.h')
-rw-r--r-- | src/core/or/sendme.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/or/sendme.h b/src/core/or/sendme.h index 3ff1d98e64..97748cf65e 100644 --- a/src/core/or/sendme.h +++ b/src/core/or/sendme.h @@ -17,4 +17,9 @@ void sendme_connection_edge_consider_sending(edge_connection_t *edge_conn); void sendme_circuit_consider_sending(circuit_t *circ, crypt_path_t *layer_hint); +int sendme_process_circuit_level(crypt_path_t *layer_hint, + circuit_t *circ, uint16_t cell_body_len); +int sendme_process_stream_level(edge_connection_t *conn, circuit_t *circ, + uint16_t cell_body_len); + #endif /* !defined(TOR_SENDME_H) */ |