pfq-lang (Spec 0.1)

Safe HaskellNone

Network.PFQ.Lang

Contents

Synopsis

Basic types

newtype IPv4 #

IPv4 data type

Constructors

IPv4 

Fields

Instances

Show IPv4 # 

Methods

showsPrec :: Int -> IPv4 -> ShowS

show :: IPv4 -> String

showList :: [IPv4] -> ShowS

IsString IPv4 # 

Methods

fromString :: String -> IPv4

Generic IPv4 # 

Associated Types

type Rep IPv4 :: * -> *

Methods

from :: IPv4 -> Rep IPv4 x

to :: Rep IPv4 x -> IPv4

ToJSON IPv4 # 

Methods

toJSON :: IPv4 -> Value

toEncoding :: IPv4 -> Encoding

toJSONList :: [IPv4] -> Value

toEncodingList :: [IPv4] -> Encoding

FromJSON IPv4 # 

Methods

parseJSON :: Value -> Parser IPv4

parseJSONList :: Value -> Parser [IPv4]

Storable IPv4 # 

Methods

sizeOf :: IPv4 -> Int

alignment :: IPv4 -> Int

peekElemOff :: Ptr IPv4 -> Int -> IO IPv4

pokeElemOff :: Ptr IPv4 -> Int -> IPv4 -> IO ()

peekByteOff :: Ptr b -> Int -> IO IPv4

pokeByteOff :: Ptr b -> Int -> IPv4 -> IO ()

peek :: Ptr IPv4 -> IO IPv4

poke :: Ptr IPv4 -> IPv4 -> IO ()

type Rep IPv4 # 
type Rep IPv4 = D1 (MetaData "IPv4" "Network.PFQ.Types" "main" True) (C1 (MetaCons "IPv4" PrefixI True) (S1 (MetaSel (Just Symbol "getHostAddress") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 HostAddress)))

newtype CIDR #

CIDR data-type

Constructors

CIDR 

Fields

Instances

Show CIDR # 

Methods

showsPrec :: Int -> CIDR -> ShowS

show :: CIDR -> String

showList :: [CIDR] -> ShowS

IsString CIDR # 

Methods

fromString :: String -> CIDR

Generic CIDR # 

Associated Types

type Rep CIDR :: * -> *

Methods

from :: CIDR -> Rep CIDR x

to :: Rep CIDR x -> CIDR

ToJSON CIDR # 

Methods

toJSON :: CIDR -> Value

toEncoding :: CIDR -> Encoding

toJSONList :: [CIDR] -> Value

toEncodingList :: [CIDR] -> Encoding

FromJSON CIDR # 

Methods

parseJSON :: Value -> Parser CIDR

parseJSONList :: Value -> Parser [CIDR]

Storable CIDR # 

Methods

sizeOf :: CIDR -> Int

alignment :: CIDR -> Int

peekElemOff :: Ptr CIDR -> Int -> IO CIDR

pokeElemOff :: Ptr CIDR -> Int -> CIDR -> IO ()

peekByteOff :: Ptr b -> Int -> IO CIDR

pokeByteOff :: Ptr b -> Int -> CIDR -> IO ()

peek :: Ptr CIDR -> IO CIDR

poke :: Ptr CIDR -> CIDR -> IO ()

type Rep CIDR # 
type Rep CIDR = D1 (MetaData "CIDR" "Network.PFQ.Types" "main" True) (C1 (MetaCons "CIDR" PrefixI True) (S1 (MetaSel (Just Symbol "getNetworkPair") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (IPv4, Int))))

data Argument #

Argument data type. Any pfq-lang function can take up to 8 Arguments.

Constructors

(Show a, Storable a, Typeable a, ToJSON a, FromJSON a) => ArgData a 
(Show a, Storable a, Typeable a, ToJSON a, FromJSON a) => ArgVector [a] 
ArgString String 
ArgStrings [String] 
ArgFunPtr Int 
ArgNull 

Instances

Show Argument # 

Methods

showsPrec :: Int -> Argument -> ShowS

show :: Argument -> String

showList :: [Argument] -> ShowS

ToJSON Argument # 

Methods

toJSON :: Argument -> Value

toEncoding :: Argument -> Encoding

toJSONList :: [Argument] -> Value

toEncodingList :: [Argument] -> Encoding

FromJSON Argument # 

Methods

parseJSON :: Value -> Parser Argument

parseJSONList :: Value -> Parser [Argument]

Pretty Argument # 

Methods

pretty :: Argument -> String #

class Pretty x where #

Pretty class, typeclass used to print a pfq-lang computation.

Minimal complete definition

pretty

Methods

pretty :: x -> String #

Instances

Pretty () # 

Methods

pretty :: () -> String #

Show a => Pretty a # 

Methods

pretty :: a -> String #

Pretty String # 

Methods

pretty :: String -> String #

Pretty Argument # 

Methods

pretty :: Argument -> String #

Pretty a => Pretty [a] # 

Methods

pretty :: [a] -> String #

Pretty [String] # 

Methods

pretty :: [String] -> String #

Pretty (Function f) # 

Methods

pretty :: Function f -> String #

data Function fun where #

Parametric Function data type.

Constructors

Function :: forall a b c d e f g h. (ArgumentClass a, ArgumentClass b, ArgumentClass c, ArgumentClass d, ArgumentClass e, ArgumentClass f, ArgumentClass g, ArgumentClass h) => Symbol -> a -> b -> c -> d -> e -> f -> g -> h -> NetFunction 
Predicate :: forall a b c d e f g h. (ArgumentClass a, ArgumentClass b, ArgumentClass c, ArgumentClass d, ArgumentClass e, ArgumentClass f, ArgumentClass g, ArgumentClass h) => Symbol -> a -> b -> c -> d -> e -> f -> g -> h -> NetPredicate 
Property :: forall a b c d e f g h. (ArgumentClass a, ArgumentClass b, ArgumentClass c, ArgumentClass d, ArgumentClass e, ArgumentClass f, ArgumentClass g, ArgumentClass h) => Symbol -> a -> b -> c -> d -> e -> f -> g -> h -> NetProperty 
Combinator1 :: Symbol -> NetPredicate -> NetPredicate 
Combinator2 :: Symbol -> NetPredicate -> NetPredicate -> NetPredicate 
Kleisli :: NetFunction -> NetFunction -> NetFunction 

Instances

Storable NetProperty # 

Methods

sizeOf :: NetProperty -> Int

alignment :: NetProperty -> Int

peekElemOff :: Ptr NetProperty -> Int -> IO NetProperty

pokeElemOff :: Ptr NetProperty -> Int -> NetProperty -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetProperty

pokeByteOff :: Ptr b -> Int -> NetProperty -> IO ()

peek :: Ptr NetProperty -> IO NetProperty

poke :: Ptr NetProperty -> NetProperty -> IO ()

Storable NetPredicate # 

Methods

sizeOf :: NetPredicate -> Int

alignment :: NetPredicate -> Int

peekElemOff :: Ptr NetPredicate -> Int -> IO NetPredicate

pokeElemOff :: Ptr NetPredicate -> Int -> NetPredicate -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetPredicate

pokeByteOff :: Ptr b -> Int -> NetPredicate -> IO ()

peek :: Ptr NetPredicate -> IO NetPredicate

poke :: Ptr NetPredicate -> NetPredicate -> IO ()

Storable NetFunction # 

Methods

sizeOf :: NetFunction -> Int

alignment :: NetFunction -> Int

peekElemOff :: Ptr NetFunction -> Int -> IO NetFunction

pokeElemOff :: Ptr NetFunction -> Int -> NetFunction -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetFunction

pokeByteOff :: Ptr b -> Int -> NetFunction -> IO ()

peek :: Ptr NetFunction -> IO NetFunction

poke :: Ptr NetFunction -> NetFunction -> IO ()

Show (Function f) # 

Methods

showsPrec :: Int -> Function f -> ShowS

show :: Function f -> String

showList :: [Function f] -> ShowS

ToJSON (Function f) # 

Methods

toJSON :: Function f -> Value

toEncoding :: Function f -> Encoding

toJSONList :: [Function f] -> Value

toEncodingList :: [Function f] -> Encoding

FromJSON (Function f) # 

Methods

parseJSON :: Value -> Parser (Function f)

parseJSONList :: Value -> Parser [Function f]

Serializable (Function f) # 

Methods

serialize :: Function f -> Int -> ([FunctionDescr], Int) #

Pretty (Function f) # 

Methods

pretty :: Function f -> String #

class Show a => Serializable a where #

Serializable class, a typeclass used to serialize computations. Transform a Function into a list of FunctionDescr.

Minimal complete definition

serialize

Methods

serialize :: a -> Int -> ([FunctionDescr], Int) #

Instances

Serializable () # 

Methods

serialize :: () -> Int -> ([FunctionDescr], Int) #

Show a => Serializable a # 

Methods

serialize :: a -> Int -> ([FunctionDescr], Int) #

Serializable (Function f) # 

Methods

serialize :: Function f -> Int -> ([FunctionDescr], Int) #

data FunctionDescr #

Function descriptor.

Constructors

FunctionDescr 

Fields

Instances

Show FunctionDescr # 

Methods

showsPrec :: Int -> FunctionDescr -> ShowS

show :: FunctionDescr -> String

showList :: [FunctionDescr] -> ShowS

Generic FunctionDescr # 

Associated Types

type Rep FunctionDescr :: * -> *

ToJSON FunctionDescr # 

Methods

toJSON :: FunctionDescr -> Value

toEncoding :: FunctionDescr -> Encoding

toJSONList :: [FunctionDescr] -> Value

toEncodingList :: [FunctionDescr] -> Encoding

FromJSON FunctionDescr # 

Methods

parseJSON :: Value -> Parser FunctionDescr

parseJSONList :: Value -> Parser [FunctionDescr]

type Rep FunctionDescr # 
type Rep FunctionDescr

newtype Qbuff #

Qbuff placeholder type is used to model the kernel sk_buff data structure.

Constructors

Qbuff () 

Instances

Storable NetProperty # 

Methods

sizeOf :: NetProperty -> Int

alignment :: NetProperty -> Int

peekElemOff :: Ptr NetProperty -> Int -> IO NetProperty

pokeElemOff :: Ptr NetProperty -> Int -> NetProperty -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetProperty

pokeByteOff :: Ptr b -> Int -> NetProperty -> IO ()

peek :: Ptr NetProperty -> IO NetProperty

poke :: Ptr NetProperty -> NetProperty -> IO ()

Storable NetPredicate # 

Methods

sizeOf :: NetPredicate -> Int

alignment :: NetPredicate -> Int

peekElemOff :: Ptr NetPredicate -> Int -> IO NetPredicate

pokeElemOff :: Ptr NetPredicate -> Int -> NetPredicate -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetPredicate

pokeByteOff :: Ptr b -> Int -> NetPredicate -> IO ()

peek :: Ptr NetPredicate -> IO NetPredicate

poke :: Ptr NetPredicate -> NetPredicate -> IO ()

Storable NetFunction # 

Methods

sizeOf :: NetFunction -> Int

alignment :: NetFunction -> Int

peekElemOff :: Ptr NetFunction -> Int -> IO NetFunction

pokeElemOff :: Ptr NetFunction -> Int -> NetFunction -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetFunction

pokeByteOff :: Ptr b -> Int -> NetFunction -> IO ()

peek :: Ptr NetFunction -> IO NetFunction

poke :: Ptr NetFunction -> NetFunction -> IO ()

data Action a #

Action is a monad modelled after the Identity as it is implemented at kernel level.

Instances

Monad Action # 

Methods

(>>=) :: Action a -> (a -> Action b) -> Action b

(>>) :: Action a -> Action b -> Action b

return :: a -> Action a

fail :: String -> Action a

Functor Action # 

Methods

fmap :: (a -> b) -> Action a -> Action b

(<$) :: a -> Action b -> Action a

Applicative Action # 

Methods

pure :: a -> Action a

(<*>) :: Action (a -> b) -> Action a -> Action b

(*>) :: Action a -> Action b -> Action b

(<*) :: Action a -> Action b -> Action a

Storable NetFunction # 

Methods

sizeOf :: NetFunction -> Int

alignment :: NetFunction -> Int

peekElemOff :: Ptr NetFunction -> Int -> IO NetFunction

pokeElemOff :: Ptr NetFunction -> Int -> NetFunction -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetFunction

pokeByteOff :: Ptr b -> Int -> NetFunction -> IO ()

peek :: Ptr NetFunction -> IO NetFunction

poke :: Ptr NetFunction -> NetFunction -> IO ()

Function types

type NetFunction = Function (Qbuff -> Action Qbuff) #

Simple monadic in-kernel pfq-lang function.

type NetPredicate = Function (Qbuff -> Bool) #

Simple in-kernel pfq-lang predicate.

type NetProperty = Function (Qbuff -> Word64) #

Simple in-kernel pfq-lang property function.

(>->) :: NetFunction -> NetFunction -> NetFunction #

Kleisli left-to-right operator