- Tor
- ControlProtocolParser
Enumeration
ControlProtocolParser
Namespace enum holding all stateless control-protocol parsing routines.
enum ControlProtocolParser
Overview
Every method is static โ the enum exists only as a namespace, never instantiated. Callers invoke parseReply(_:) to turn the raw lines from readReply() into a ControlReply, then route through type-specific helpers like parseAddOnionResponse(_:) or parseGetInfoResponse(_:) for semantic decoding.
The reply formats swift-tor decodes follow control-spec.txt ยง2.3: single-line (250 OK\r\n), multi-line continuation (250-line1\r\n250-line2\r\n250 OK\r\n), data block (250+key=\r\nbody-line-1\r\n.\r\n250 OK\r\n), and async event (650 EVENT_TYPE payload\r\n).
Note
The parser is allocation-light but not zero-allocation โ it slices String views of the input lines. For tight loops over thousands of events per second, prefer direct attribute access on the raw lines.
Important
All parse* methods are safe to call concurrently and deterministic: same input, same output.
Topics
Replies
Structured decoders
Async events
Primitives