pub struct Sendme { /* private fields */ }
Expand description
A Sendme message is used to increase flow-control windows.
To avoid congestion, each Tor circuit and stream keeps track of a number of data cells that it is willing to send. It decrements these numbers every time it sends a cell. If these numbers reach zero, then no more cells can be sent on the stream or circuit.
The only way to re-increment these numbers is by receiving a Sendme cell from the other end of the circuit or stream.
For security, current circuit-level Sendme cells include an authentication tag that proves knowledge of the cells that they are acking.
See tor-spec.txt for more
information; also see the source for tor_proto::circuit::sendme
.
Implementations§
Source§impl Sendme
impl Sendme
Sourcepub fn new_empty() -> Self
pub fn new_empty() -> Self
Return a new empty sendme cell
This format is used on streams, and on circuits without sendme authentication.
Sourcepub fn new_tag(x: [u8; 20]) -> Self
pub fn new_tag(x: [u8; 20]) -> Self
This format is used on circuits with sendme authentication.
Sourcepub fn into_sendme_tag(self) -> Option<SendmeTag>
pub fn into_sendme_tag(self) -> Option<SendmeTag>
Consume this cell and return its authentication tag, if any
Trait Implementations§
Source§impl Body for Sendme
impl Body for Sendme
Source§fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
Source§fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
Source§impl From<Sendme> for AnyRelayMsg
impl From<Sendme> for AnyRelayMsg
Source§fn from(m: Sendme) -> AnyRelayMsg
fn from(m: Sendme) -> AnyRelayMsg
Source§impl HasMemoryCostStructural for Sendme
impl HasMemoryCostStructural for Sendme
Source§fn indirect_memory_cost(&self, et: EnabledToken) -> usize
fn indirect_memory_cost(&self, et: EnabledToken) -> usize
Auto Trait Implementations§
impl Freeze for Sendme
impl RefUnwindSafe for Sendme
impl Send for Sendme
impl Sync for Sendme
impl Unpin for Sendme
impl UnwindSafe for Sendme
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
Source§fn memory_cost(&self, et: EnabledToken) -> usize
fn memory_cost(&self, et: EnabledToken) -> usize
self
, in bytes Read moreSource§impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
Source§fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
TypedMemoryCost<T>
rather than a raw usize
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more