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
impl CellType
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns the protocol name for this cell type.
Names match the Tor specification (e.g., “PADDING”, “VERSIONS”, “RELAY”).
Sourcepub fn value(&self) -> u8
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.
Sourcepub fn is_fixed_size(&self) -> bool
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.