haskell-tor-0.1.1: A Haskell Tor Node

Safe HaskellNone
LanguageHaskell2010

Tor.DataFormat.RelayCell

Description

Parsing and rendering routines for relay cells.

Synopsis

Documentation

data RelayCell Source

The format of a Relay cell in a Tor stream.

Constructors

RelayBegin 
RelayData 
RelayEnd 
RelayConnected 
RelaySendMe 
RelayExtend 
RelayExtended 
RelayTruncate 
RelayTruncated 
RelayDrop 
RelayResolve 
RelayResolved 
RelayBeginDir 
RelayExtend2 
RelayExtended2 
RelayEstablishIntro 
RelayEstablishRendezvous 
RelayIntroduce1 
RelayIntroduce2 
RelayRendezvous1 
RelayRendezvous2 
RelayIntroEstablished 
RelayRendezvousEstablished 
RelayIntroduceAck 

putRelayCell :: ByteString -> RelayCell -> Put Source

Perform a raw relay cell render, with 0 for the hash mark.

getRelayCell :: Get (ByteString, RelayCell) Source

Parse a relay cell off the wire, returning the shortened digest and the parsed relay cell.

parseRelayCell :: Context SHA1 -> Get (RelayCell, Context SHA1) Source

Parse a relay cell, verifying that the digest matches appropriately, returning the parsed cell and new hash context.

renderRelayCell :: Context SHA1 -> RelayCell -> (ByteString, Context SHA1) Source

Render a relay cell using the given hash context, returning the rendered cell and the new hash context.

data ExtendSpec Source

The format for extension request.

putExtendSpec :: ExtendSpec -> Put Source

Render an ExtendSpec.

getExtendSpec :: Get ExtendSpec Source

Parse an ExtendSpec

putRelayEndReason :: RelayEndReason -> Put Source

Render a RelayEndReason.

getRelayEndReason :: Word16 -> Get RelayEndReason Source

Parse a RelayEndReason.

putRelayCellGuts :: RelayCell -> PutM Word8 Source

Render the internals of a relay cell (basically everything but the header).