network-anonymous-tor-0.11.0: Haskell API for Tor anonymous networking

Safe HaskellSafe
LanguageHaskell2010

Network.Anonymous.Tor.Protocol.Parser.Ast

Description

Abstract syntax tree used by the Parser, including helper functions for traversing the tree.

Warning: This function is used internally by Tor and using these functions directly is unsupported. The interface of these functions might change at any time without prior notice.

Synopsis

Documentation

data Token Source

A token is a key and can maybe have an associated value

Constructors

Token 

data Line Source

A line is just a sequence of tokens -- the Parser ends the chain when a newline is received.

Constructors

Line 

key Source

Arguments

:: ByteString

The key to look for

-> [Token]

Tokens to consider

-> Bool

Result

Returns true if the key was found

value Source

Arguments

:: ByteString

Key to look for

-> [Token]

Tokens to consider

-> Maybe ByteString

The value if the key was found

Looks up a key and returns the value if found

valueAs :: Parser a -> ByteString -> [Token] -> Maybe a Source

Retrieves value, and applies it to an Attoparsec parser

line Source

Arguments

:: ByteString

Token key to look for

-> [Line]

Lines to consider

-> Maybe Line

The line that starts with this key, if found

Retrieves first line that starts with a certain token

statusCode :: [Line] -> Integer Source

Returns status code of a reply.