ntorfsm

Details

An NTorFSM steps through each state of a circuit handshake. At each step an NTorFSM expects to receive a certain kind of cell. Either this cell is received, processed, and a response cell is returned or an exception is raised (and the circuit is destroyed).

NTorFSM’s also derive key material and add RelayCrypto objects to the associated circuit’s crypt_path.

class circuit.handshake.ntorfsm.NTorFSM(circuit_id, path, crypt_path)[source]

Bases: object

Finite state machine to step through an ntor handshake with relays on a circuit’s path.

recvCell(cell)[source]

Call a handler function to process cell based on this ntor fsm’s current state.

Parameters:cell (cell) – cell received from this ntor fsm’s circuit
Returns:cell, None may return either the next cell to send to step through handshakes with relays on this path or None if no response is required
getInitiatingCell()[source]

Build and return the initiating cell for this ntor fsm - a Create2Cell.

Advance this ntor fsm’s state.

Returns:oppy.cell.fixedlen.Create2Cell
isDone()[source]

Return True iff this ntor fsm’s state is State.DONE

Returns:bool True if state is State.DONE

Previous topic

circuit

Next topic

exceptions

This Page