Tor 0.4.9.1-alpha-dev
Data Structures | Macros | Functions
conflux.h File Reference

Public APIs for conflux multipath support. More...

#include "core/or/circuit_st.h"
#include "core/or/conflux_st.h"

Go to the source code of this file.

Data Structures

struct  conflux_cell_t
 

Macros

#define CONFLUX_FOR_EACH_LEG_BEGIN(cfx, var)    SMARTLIST_FOREACH_BEGIN(cfx->legs, conflux_leg_t *, var)
 
#define CONFLUX_FOR_EACH_LEG_END(var)    SMARTLIST_FOREACH_END(var)
 
#define CONFLUX_NUM_LEGS(cfx)   (smartlist_len(cfx->legs))
 

Functions

size_t conflux_handle_oom (size_t bytes_to_remove)
 
uint64_t conflux_get_total_bytes_allocation (void)
 
uint64_t conflux_get_circ_bytes_allocation (const circuit_t *circ)
 
void conflux_update_rtt (conflux_t *cfx, circuit_t *circ, uint64_t rtt_usec)
 
circuit_tconflux_decide_circ_for_send (conflux_t *cfx, circuit_t *orig_circ, uint8_t relay_command)
 
circuit_tconflux_decide_next_circ (conflux_t *cfx)
 
int conflux_process_switch_command (circuit_t *in_circ, crypt_path_t *layer_hint, cell_t *cell, relay_header_t *rh)
 
bool conflux_should_multiplex (int relay_command)
 
bool conflux_process_cell (conflux_t *cfx, circuit_t *in_circ, crypt_path_t *layer_hint, cell_t *cell)
 
conflux_cell_tconflux_dequeue_cell (conflux_t *cfx)
 
void conflux_note_cell_sent (conflux_t *cfx, circuit_t *circ, uint8_t relay_command)
 

Detailed Description

Public APIs for conflux multipath support.

Definition in file conflux.h.

Macro Definition Documentation

◆ CONFLUX_FOR_EACH_LEG_BEGIN

#define CONFLUX_FOR_EACH_LEG_BEGIN (   cfx,
  var 
)     SMARTLIST_FOREACH_BEGIN(cfx->legs, conflux_leg_t *, var)

Helpers to iterate over legs with better semantic.

Definition at line 19 of file conflux.h.

◆ CONFLUX_FOR_EACH_LEG_END

#define CONFLUX_FOR_EACH_LEG_END (   var)     SMARTLIST_FOREACH_END(var)

Definition at line 21 of file conflux.h.

◆ CONFLUX_NUM_LEGS

#define CONFLUX_NUM_LEGS (   cfx)    (smartlist_len(cfx->legs))

Helper: Return the number of legs a conflux object has.

Definition at line 25 of file conflux.h.

Function Documentation

◆ conflux_decide_circ_for_send()

circuit_t * conflux_decide_circ_for_send ( conflux_t cfx,
circuit_t orig_circ,
uint8_t  relay_command 
)

This function is called when we want to send a relay cell on a conflux, as well as when we want to compute available space in to package from streams.

It determines the circuit that relay command should be sent on, and sends a SWITCH cell if necessary.

It returns the circuit we should send on. If no circuits are ready to send, it returns NULL.

Definition at line 454 of file conflux.c.

Referenced by relay_send_command_from_edge_().

◆ conflux_decide_next_circ()

circuit_t * conflux_decide_next_circ ( conflux_t cfx)

Returns the circuit that conflux would send on next, if conflux_decide_circ_for_send were called. This is used to compute available space in the package window.

Definition at line 606 of file conflux.c.

Referenced by conflux_can_send(), and conflux_decide_circ_for_send().

◆ conflux_dequeue_cell()

conflux_cell_t * conflux_dequeue_cell ( conflux_t cfx)

Dequeue the top cell from our queue.

Returns the cell as a conflux_cell_t, or NULL if the queue is empty or has a hole.

Definition at line 892 of file conflux.c.

◆ conflux_get_circ_bytes_allocation()

uint64_t conflux_get_circ_bytes_allocation ( const circuit_t circ)

Return the total memory allocation the circuit is using by conflux. If this circuit is not a Conflux circuit, 0 is returned.

Definition at line 169 of file conflux.c.

◆ conflux_get_total_bytes_allocation()

uint64_t conflux_get_total_bytes_allocation ( void  )

Return the total memory allocation in bytes by the subsystem.

At the moment, only out of order queues are consiered.

Definition at line 181 of file conflux.c.

◆ conflux_handle_oom()

size_t conflux_handle_oom ( size_t  bytes_to_remove)

The OOM handler is asking us to try to free at least bytes_to_remove.

Definition at line 188 of file conflux.c.

◆ conflux_note_cell_sent()

void conflux_note_cell_sent ( conflux_t cfx,
circuit_t circ,
uint8_t  relay_command 
)

Called after conflux actually sent a cell on a circuit. This function updates sequence number counters, and switch counters.

Definition at line 525 of file conflux.c.

◆ conflux_process_cell()

bool conflux_process_cell ( conflux_t cfx,
circuit_t in_circ,
crypt_path_t layer_hint,
cell_t cell 
)

Process an incoming relay cell for conflux. Called from connection_edge_process_relay_cell().

Returns true if the conflux system now has well-ordered cells to deliver to streams, false otherwise.

Definition at line 833 of file conflux.c.

◆ conflux_process_switch_command()

int conflux_process_switch_command ( circuit_t in_circ,
crypt_path_t layer_hint,
cell_t cell,
relay_header_t rh 
)

Validate and handle RELAY_COMMAND_CONFLUX_SWITCH.

Definition at line 734 of file conflux.c.

◆ conflux_should_multiplex()

bool conflux_should_multiplex ( int  relay_command)

Determine if we should multiplex a specific relay command or not.

TODO: Version of this that is the set of forbidden commands on linked circuits

Definition at line 47 of file conflux.c.

Referenced by conflux_decide_circ_for_send(), conflux_note_cell_sent(), and relay_send_command_from_edge_().

◆ conflux_update_rtt()

void conflux_update_rtt ( conflux_t cfx,
circuit_t circ,
uint64_t  rtt_usec 
)

Called when we have a new RTT estimate for a circuit.

Definition at line 655 of file conflux.c.