Tor 0.4.9.8
Loading...
Searching...
No Matches
sendme.c File Reference

Code that is related to SENDME cells both in terms of creating/parsing cells and handling the content. More...

#include "core/or/or.h"
#include "app/config/config.h"
#include "core/crypto/relay_crypto.h"
#include "core/mainloop/connection.h"
#include "core/or/cell_st.h"
#include "core/or/crypt_path.h"
#include "core/or/circuitlist.h"
#include "core/or/circuituse.h"
#include "core/or/or_circuit_st.h"
#include "core/or/relay.h"
#include "core/or/sendme.h"
#include "core/or/congestion_control_common.h"
#include "core/or/congestion_control_flow.h"
#include "feature/nodelist/networkstatus.h"
#include "lib/ctime/di_ops.h"
#include "trunnel/sendme_cell.h"

Go to the source code of this file.

Functions

static bool tag_len_ok (size_t tag_len)
 
STATIC int get_emit_min_version (void)
 
STATIC int get_accept_min_version (void)
 
static uint8_t * pop_first_cell_digest (const circuit_t *circ)
 
static bool v1_tag_matches (const uint8_t *circ_digest, const uint8_t *cell_tag, size_t tag_len)
 
static bool cell_v1_is_valid (const sendme_cell_t *cell, const uint8_t *circ_digest, size_t circ_digest_len)
 
STATIC bool cell_version_can_be_handled (uint8_t cell_version)
 
STATIC bool sendme_is_valid (circuit_t *circ, const crypt_path_t *layer_hint, const uint8_t *cell_payload, size_t cell_payload_len)
 
STATIC ssize_t build_cell_payload_v1 (const uint8_t *cell_tag, const size_t tag_len, uint8_t *payload)
 
static int send_circuit_level_sendme (circuit_t *circ, crypt_path_t *layer_hint, const uint8_t *cell_tag, size_t tag_len)
 
static void record_cell_digest_on_circ (circuit_t *circ, const uint8_t *sendme_tag, size_t tag_len)
 
void sendme_connection_edge_consider_sending (edge_connection_t *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, const uint8_t *cell_payload, uint16_t cell_payload_len)
 
int sendme_process_circuit_level_impl (crypt_path_t *layer_hint, circuit_t *circ)
 
int sendme_process_stream_level (edge_connection_t *conn, circuit_t *circ, uint16_t cell_body_len)
 
int sendme_circuit_data_received (circuit_t *circ, crypt_path_t *layer_hint)
 
int sendme_stream_data_received (edge_connection_t *conn)
 
int sendme_note_circuit_data_packaged (circuit_t *circ, crypt_path_t *layer_hint)
 
int sendme_note_stream_data_packaged (edge_connection_t *conn, size_t len)
 
void sendme_record_cell_digest_on_circ (circuit_t *circ, crypt_path_t *cpath)
 

Detailed Description

Code that is related to SENDME cells both in terms of creating/parsing cells and handling the content.

Definition in file sendme.c.

Macro Definition Documentation

◆ CRYPT_PATH_PRIVATE

#define CRYPT_PATH_PRIVATE

Definition at line 12 of file sendme.c.

◆ SENDME_PRIVATE

#define SENDME_PRIVATE

Definition at line 11 of file sendme.c.

Function Documentation

◆ build_cell_payload_v1()

STATIC ssize_t build_cell_payload_v1 ( const uint8_t * cell_tag,
const size_t tag_len,
uint8_t * payload )

Definition at line 285 of file sendme.c.

◆ cell_v1_is_valid()

static bool cell_v1_is_valid ( const sendme_cell_t * cell,
const uint8_t * circ_digest,
size_t circ_digest_len )
static

Definition at line 113 of file sendme.c.

◆ cell_version_can_be_handled()

STATIC bool cell_version_can_be_handled ( uint8_t cell_version)

Definition at line 134 of file sendme.c.

◆ get_accept_min_version()

STATIC int get_accept_min_version ( void )

Definition at line 55 of file sendme.c.

◆ get_emit_min_version()

STATIC int get_emit_min_version ( void )

Definition at line 44 of file sendme.c.

◆ pop_first_cell_digest()

static uint8_t * pop_first_cell_digest ( const circuit_t * circ)
static

Definition at line 69 of file sendme.c.

◆ record_cell_digest_on_circ()

static void record_cell_digest_on_circ ( circuit_t * circ,
const uint8_t * sendme_tag,
size_t tag_len )
static

Definition at line 362 of file sendme.c.

◆ send_circuit_level_sendme()

static int send_circuit_level_sendme ( circuit_t * circ,
crypt_path_t * layer_hint,
const uint8_t * cell_tag,
size_t tag_len )
static

Definition at line 319 of file sendme.c.

◆ sendme_circuit_consider_sending()

void sendme_circuit_consider_sending ( circuit_t * circ,
crypt_path_t * layer_hint )

Check if the deliver_window for circuit circ (at hop layer_hint if it's defined) is low enough that we should send a circuit-level sendme back down the circuit. If so, send enough sendmes that the window would be overfull if we sent any more.

Definition at line 448 of file sendme.c.

Referenced by connection_edge_process_relay_cell().

◆ sendme_circuit_data_received()

int sendme_circuit_data_received ( circuit_t * circ,
crypt_path_t * layer_hint )

Definition at line 628 of file sendme.c.

◆ sendme_connection_edge_consider_sending()

void sendme_connection_edge_consider_sending ( edge_connection_t * conn)

Called when we've just received a relay data cell, when we've just finished flushing all bytes to stream conn, or when we've flushed some bytes to the stream conn.

If conn->outbuf is not too full, and our deliver window is low, send back a suitable number of stream-level sendme cells.

Definition at line 401 of file sendme.c.

Referenced by connection_edge_finished_flushing(), connection_edge_flushed_some(), and handle_relay_msg().

◆ sendme_is_valid()

STATIC bool sendme_is_valid ( circuit_t * circ,
const crypt_path_t * layer_hint,
const uint8_t * cell_payload,
size_t cell_payload_len )

Definition at line 187 of file sendme.c.

◆ sendme_note_circuit_data_packaged()

int sendme_note_circuit_data_packaged ( circuit_t * circ,
crypt_path_t * layer_hint )

Definition at line 666 of file sendme.c.

◆ sendme_note_stream_data_packaged()

int sendme_note_stream_data_packaged ( edge_connection_t * conn,
size_t len )

Definition at line 707 of file sendme.c.

◆ sendme_process_circuit_level()

int sendme_process_circuit_level ( crypt_path_t * layer_hint,
circuit_t * circ,
const uint8_t * cell_payload,
uint16_t cell_payload_len )

Definition at line 493 of file sendme.c.

◆ sendme_process_circuit_level_impl()

int sendme_process_circuit_level_impl ( crypt_path_t * layer_hint,
circuit_t * circ )

Process a SENDME for Tor's original fixed window circuit-level flow control. Updates the package_window and ensures that it does not exceed the max.

Returns -END_CIRC_REASON_TORPROTOCOL if the max is exceeded, otherwise returns 0.

Definition at line 535 of file sendme.c.

◆ sendme_process_stream_level()

int sendme_process_stream_level ( edge_connection_t * conn,
circuit_t * circ,
uint16_t cell_body_len )

Definition at line 585 of file sendme.c.

◆ sendme_record_cell_digest_on_circ()

void sendme_record_cell_digest_on_circ ( circuit_t * circ,
crypt_path_t * cpath )

Definition at line 728 of file sendme.c.

◆ sendme_stream_data_received()

int sendme_stream_data_received ( edge_connection_t * conn)

Definition at line 651 of file sendme.c.

◆ tag_len_ok()

static bool tag_len_ok ( size_t tag_len)
inlinestatic

Return true iff tag_len is some length we recognize.

Definition at line 36 of file sendme.c.

◆ v1_tag_matches()

static bool v1_tag_matches ( const uint8_t * circ_digest,
const uint8_t * cell_tag,
size_t tag_len )
static

Definition at line 88 of file sendme.c.