CellType

Enum CellType 

Source
pub enum CellType {
Show 18 variants Padding, Create, Created, Relay, Destroy, CreateFast, CreatedFast, Versions, Netinfo, RelayEarly, Create2, Created2, PaddingNegotiate, VPadding, Certs, AuthChallenge, Authenticate, Authorize,
}
Expand description

Cell command types in the Tor relay protocol.

Each cell type has a unique command value that identifies its purpose. Cell types are divided into fixed-size (values 0-127) and variable-size (values 128+) categories.

§Fixed-Size Cells

These cells always have a 509-byte payload, padded with zeros if needed:

  • Padding (0), Create (1), Created (2), Relay (3), Destroy (4)
  • CreateFast (5), CreatedFast (6), Netinfo (8), RelayEarly (9)
  • Create2 (10), Created2 (11), PaddingNegotiate (12)

§Variable-Size Cells

These cells have a 2-byte length field followed by variable payload:

  • Versions (7), VPadding (128), Certs (129)
  • AuthChallenge (130), Authenticate (131), Authorize (132)

§Example

use stem_rs::client::cell::{CellType, cell_by_name, cell_by_value};

let cell_type = cell_by_name("NETINFO").unwrap();
assert_eq!(cell_type.value(), 8);
assert!(cell_type.is_fixed_size());

let cell_type = cell_by_value(7).unwrap();
assert_eq!(cell_type.name(), "VERSIONS");
assert!(!cell_type.is_fixed_size());

Variants§

§

Padding

Keep-alive padding cell (command 0).

§

Create

Create a circuit using public key crypto (command 1).

§

Created

Acknowledge circuit creation (command 2).

§

Relay

End-to-end encrypted relay data (command 3).

§

Destroy

Tear down a circuit (command 4).

§

CreateFast

Create circuit without public key (command 5).

§

CreatedFast

Acknowledge fast circuit creation (command 6).

§

Versions

Link protocol version negotiation (command 7).

§

Netinfo

Time and address information (command 8).

§

RelayEarly

Relay data with hop limit (command 9).

§

Create2

Extended circuit creation (command 10).

§

Created2

Acknowledge extended creation (command 11).

§

PaddingNegotiate

Padding negotiation (command 12).

§

VPadding

Variable-length padding (command 128).

§

Certs

Relay certificates (command 129).

§

AuthChallenge

Authentication challenge (command 130).

§

Authenticate

Client authentication (command 131).

§

Authorize

Client authorization (command 132).

Implementations§

Source§

impl CellType

Source

pub fn name(&self) -> &'static str

Returns the protocol name for this cell type.

Names match the Tor specification (e.g., “PADDING”, “VERSIONS”, “RELAY”).

Source

pub fn value(&self) -> u8

Returns the numeric command value for this cell type.

Values 0-127 are fixed-size cells, 128+ are variable-size.

Source

pub fn is_fixed_size(&self) -> bool

Returns whether this cell type has a fixed-size payload.

Fixed-size cells have exactly 509 bytes of payload. Variable-size cells have a 2-byte length field.

Trait Implementations§

Source§

impl Clone for CellType

Source§

fn clone(&self) -> CellType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CellType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CellType

Source§

fn eq(&self, other: &CellType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for CellType

Source§

impl Eq for CellType

Source§

impl StructuralPartialEq for CellType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.