#include <circuit_service.h>
Public Member Functions | |
| virtual | ~CircuitService ()=default |
| virtual std::optional< PeerRoute > | adopt_circuit (const PeerId &carrier, std::unique_ptr< Link > link, ConnRole role, bool connected)=0 |
| Adopt link as a connection carried by the peer carrier, on the reactor that owns the carrier's own connection. | |
| virtual void | wake_circuit (PeerRoute route, uint32_t events)=0 |
| Deliver poll-equivalent events (PollIn / PollOut / PollErr, see core/io_poller.h) to a circuit connection — the events a socket-backed link would have got from the poller. | |
| virtual void | close_circuit (PeerRoute route, CloseReason reason)=0 |
| Tear a circuit connection down. | |
| virtual std::optional< PeerRoute > | dial_relayed (const PeerId &carrier, uint64_t cid, ForwardedCircuit circuit)=0 |
| Dial the far end through carrier, the relay. The connection is Outbound. | |
| virtual std::optional< PeerRoute > | expect_relayed (const PeerId &carrier, uint64_t cid, ForwardedCircuit circuit)=0 |
| Accept the dial that will come through carrier, the relay, as an Inbound connection — under the same admission gate as adopt_circuit. | |
| virtual bool | forward_datagrams (const PeerId &dialer, const PeerId &responder, uint64_t cid, std::shared_ptr< std::atomic< uint64_t > > bytes, uint64_t rate, uint64_t burst)=0 |
| As the relay: forward the packets of cid between dialer and responder, counting their bytes into bytes, at most rate bytes a second each way with bursts of burst (0: no rate; how it is held is UdpMux's, "Relayed connections"). | |
| virtual void | stop_forwarding (uint64_t cid)=0 |
Definition at line 62 of file circuit_service.h.
|
virtualdefault |
|
pure virtual |
Adopt link as a connection carried by the peer carrier, on the reactor that owns the carrier's own connection.
| role | Outbound for a circuit we opened, Inbound for one opened to us. It is what the secure handshake and the peer table's duplicate resolution read, so it must say who asked. |
| connected | whether the far end is already there. An inbound circuit is (the opener would not have sent it otherwise); an outbound one is not until its acceptance arrives, and until then the connection waits in Connecting for a PollOut. |
Implemented in librats::Node.
|
pure virtual |
Tear a circuit connection down.
Thread-safe; a no-op for a route that is already gone.
Implemented in librats::Node.
|
pure virtual |
Dial the far end through carrier, the relay. The connection is Outbound.
Implemented in librats::Node.
|
pure virtual |
Accept the dial that will come through carrier, the relay, as an Inbound connection — under the same admission gate as adopt_circuit.
Implemented in librats::Node.
|
pure virtual |
As the relay: forward the packets of cid between dialer and responder, counting their bytes into bytes, at most rate bytes a second each way with bursts of burst (0: no rate; how it is held is UdpMux's, "Relayed connections").
False when the two are not both datagram peers on one socket — the circuit must then be a byte stream.
Implemented in librats::Node.
|
pure virtual |
Implemented in librats::Node.
|
pure virtual |
Deliver poll-equivalent events (PollIn / PollOut / PollErr, see core/io_poller.h) to a circuit connection — the events a socket-backed link would have got from the poller.
Thread-safe, and a no-op for a route that is already gone.
Implemented in librats::Node.