Skip to main content

Module msg

Module msg 

Source
Expand description

Encoding and decoding for relay messages

Relay messages are sent along circuits, inside RELAY or RELAY_EARLY cells.

Re-exportsΒ§

use super::flow_ctrl::Xoff; πŸ”’
use super::flow_ctrl::Xon; πŸ”’
use super::RelayCellFormat; πŸ”’
use super::RelayCmd; πŸ”’
use crate::chancell::CELL_DATA_LEN; πŸ”’
use crate::chancell::msg::DestroyReason; πŸ”’
use crate::chancell::msg::HandshakeType; πŸ”’
use crate::chancell::msg::TAP_C_HANDSHAKE_LEN; πŸ”’
use crate::chancell::msg::TAP_S_HANDSHAKE_LEN; πŸ”’
use caret::caret_int; πŸ”’
use derive_deftly::Deftly; πŸ”’
use std::fmt::Write; πŸ”’
use std::net::IpAddr; πŸ”’
use std::net::Ipv4Addr; πŸ”’
use std::num::NonZeroU8; πŸ”’
use tor_bytes::EncodeError; πŸ”’
use tor_bytes::EncodeResult; πŸ”’
use tor_bytes::Error; πŸ”’
use tor_bytes::Result; πŸ”’
use tor_bytes::Readable; πŸ”’
use tor_bytes::Reader; πŸ”’
use tor_bytes::Writeable; πŸ”’
use tor_bytes::Writer; πŸ”’
use tor_linkspec::EncodedLinkSpec; πŸ”’
use tor_llcrypto::pk::rsa::RsaIdentity; πŸ”’
use tor_llcrypto::util::ct::CtByteArray; πŸ”’
use tor_memquota::derive_deftly_template_HasMemoryCost; πŸ”’
use tor_memquota::memory_cost_structural_copy; πŸ”’
use bitflags::bitflags; πŸ”’
pub use super::conflux::ConfluxLinked;
pub use super::conflux::ConfluxLinkedAck;
pub use super::conflux::ConfluxSwitch;
pub use super::hs::EstablishRendezvous;
pub use super::hs::IntroEstablished;
pub use super::hs::Introduce1;
pub use super::hs::Introduce2;
pub use super::hs::IntroduceAck;
pub use super::hs::Rendezvous1;
pub use super::hs::Rendezvous2;
pub use super::hs::RendezvousEstablished;
pub use super::hs::est_intro::EstablishIntro;
pub use super::udp::ConnectUdp;
pub use super::udp::ConnectedUdp;
pub use super::udp::Datagram;
pub(crate) use empty_body; πŸ”’

MacrosΒ§

empty_body πŸ”’
Declare a message type for a message with an empty body.
msg_impl_relaymsg πŸ”’
Helper: declare a RelayMsg implementation for a message type that has a fixed command.

StructsΒ§

Begin
A Begin message creates a new data stream.
BeginDir
Opens a new stream on a directory cache.
BeginFlags
A set of recognized flags that can be attached to a begin cell.
Connected
A Connected message is a successful response to a Begin message
Data
A Data message represents data sent along a stream.
Drop
A padding message, which is always ignored.
End
An End message tells the other end of the circuit to close a stream.
EndReason
A declared reason for closing a stream
Extend
Extend was an obsolete circuit extension message format.
Extend2
An Extend2 message tells the last relay in a circuit to extend to a new hop.
Extended
Extended was an obsolete circuit extension message, sent in reply to an Extend message.
Extended2
Extended2 is a successful reply to an Extend2 message.
InvalidSendmeTag
An error from attempting to decode a SENDME tag.
Resolve
A Resolve message launches a DNS lookup stream.
Resolved
A Resolved message is a successful reply to a Resolve message.
Sendme
A Sendme message is used to increase flow-control windows.
SendmeTag
An authentication tag to use for circuit-level SENDME messages.
Truncate
Tells a circuit to close all downstream hops on the circuit.
Truncated
A Truncated message is sent to the client when the remaining hops of a circuit have gone away.
Unrecognized
A relay message that we didn’t recognize

EnumsΒ§

AnyRelayMsg
A single parsed relay message, sent or received along a circuit
IpVersionPreference
A preference for IPv4 vs IPv6 addresses; usable as a nicer frontend for BeginFlags.
ResolvedVal
Possible response to a DNS lookup

ConstantsΒ§

RES_ERR_NONTRANSIENT πŸ”’
Non-transient error (don’t try again)
RES_ERR_TRANSIENT πŸ”’
Transient error (okay to try again)
RES_HOSTNAME πŸ”’
Indicates a hostname response
RES_IPV4 πŸ”’
Indicates an IPv4 response
RES_IPV6 πŸ”’
Indicates an IPv6 response

TraitsΒ§

Body
Internal: traits in common different cell bodies.