pub(crate) trait BackwardHandler: ControlHandler {
type CircChanMsg: TryFrom<AnyChanMsg, Error = Error> + Send;
// Required methods
fn encrypt_relay_cell(
&mut self,
cmd: ChanCmd,
body: &mut RelayCellBody,
hop: Option<HopNum>,
) -> SendmeTag;
fn handle_backward_cell(
&mut self,
circ_id: UniqId,
cell: Self::CircChanMsg,
) -> StdResult<BackwardCellDisposition, ReactorError>;
}Expand description
Trait for customizing the behavior of the backward reactor.
Used for plugging in the implementation-dependent (client vs relay) parts of the implementation into the generic one.
Required Associated Types§
Sourcetype CircChanMsg: TryFrom<AnyChanMsg, Error = Error> + Send
type CircChanMsg: TryFrom<AnyChanMsg, Error = Error> + Send
The subclass of ChanMsg that can arrive on this type of circuit.
Required Methods§
Sourcefn encrypt_relay_cell(
&mut self,
cmd: ChanCmd,
body: &mut RelayCellBody,
hop: Option<HopNum>,
) -> SendmeTag
fn encrypt_relay_cell( &mut self, cmd: ChanCmd, body: &mut RelayCellBody, hop: Option<HopNum>, ) -> SendmeTag
Encrypt a RelayCellBody that is moving in the backward direction.
Sourcefn handle_backward_cell(
&mut self,
circ_id: UniqId,
cell: Self::CircChanMsg,
) -> StdResult<BackwardCellDisposition, ReactorError>
fn handle_backward_cell( &mut self, circ_id: UniqId, cell: Self::CircChanMsg, ) -> StdResult<BackwardCellDisposition, ReactorError>
Handle a cell that was read from the Tor outbound channel.
Returns an error if the cell should cause the reactor to shut down,
or a BackwardCellDisposition specifying how it should be handled.