-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | parser and printer for radius protocol packet -- -- This package provides parser and printer for radius protocol packet. @package protocol-radius @version 0.0.1.0 module Data.Radius.Scalar newtype AtText AtText :: String -> AtText [unAtText] :: AtText -> String newtype AtString AtString :: ByteString -> AtString [unAtString] :: AtString -> ByteString newtype AtInteger AtInteger :: Word32 -> AtInteger [unAtInteger] :: AtInteger -> Word32 newtype AtIpV4 AtIpV4 :: Word32 -> AtIpV4 [unAtIpV4] :: AtIpV4 -> Word32 data Bin128 fromBin128 :: Bin128 -> ByteString mayBin128 :: ByteString -> Maybe Bin128 word64Bin128 :: Word64 -> Word64 -> Bin128 bin128Zero :: Bin128 instance GHC.Show.Show Data.Radius.Scalar.Bin128 instance GHC.Classes.Ord Data.Radius.Scalar.Bin128 instance GHC.Classes.Eq Data.Radius.Scalar.Bin128 instance GHC.Show.Show Data.Radius.Scalar.AtIpV4 instance GHC.Classes.Ord Data.Radius.Scalar.AtIpV4 instance GHC.Classes.Eq Data.Radius.Scalar.AtIpV4 instance GHC.Show.Show Data.Radius.Scalar.AtInteger instance GHC.Classes.Ord Data.Radius.Scalar.AtInteger instance GHC.Classes.Eq Data.Radius.Scalar.AtInteger instance GHC.Show.Show Data.Radius.Scalar.AtString instance GHC.Classes.Ord Data.Radius.Scalar.AtString instance GHC.Classes.Eq Data.Radius.Scalar.AtString instance GHC.Show.Show Data.Radius.Scalar.AtText instance GHC.Classes.Ord Data.Radius.Scalar.AtText instance GHC.Classes.Eq Data.Radius.Scalar.AtText module Data.Radius.Packet codeToWord :: Code -> Word8 codeFromWord :: Word8 -> Code data Code AccessRequest :: Code AccessAccept :: Code AccessReject :: Code AccessChallenge :: Code Other :: Word8 -> Code data Header Header :: !Code -> !Word8 -> !Word16 -> !Bin128 -> Header [code] :: Header -> !Code [pktId] :: Header -> !Word8 [pktLength] :: Header -> !Word16 [authenticator] :: Header -> !Bin128 data Packet a Packet :: !Header -> !a -> Packet a [header] :: Packet a -> !Header [attributes] :: Packet a -> !a instance Data.Traversable.Traversable Data.Radius.Packet.Packet instance Data.Foldable.Foldable Data.Radius.Packet.Packet instance GHC.Base.Functor Data.Radius.Packet.Packet instance GHC.Show.Show a => GHC.Show.Show (Data.Radius.Packet.Packet a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Radius.Packet.Packet a) instance GHC.Show.Show Data.Radius.Packet.Header instance GHC.Classes.Eq Data.Radius.Packet.Header instance GHC.Show.Show Data.Radius.Packet.Code instance GHC.Classes.Ord Data.Radius.Packet.Code instance GHC.Classes.Eq Data.Radius.Packet.Code module Data.Radius.Attribute.Number data Number UserName :: Number ProxyState :: Number State :: Number MessageAuthenticator :: Number ReplyMessage :: Number VendorSpecific :: Number Other :: !Word8 -> Number toWord :: Number -> Word8 fromWord :: Word8 -> Number instance GHC.Read.Read Data.Radius.Attribute.Number.Number instance GHC.Show.Show Data.Radius.Attribute.Number.Number instance GHC.Classes.Ord Data.Radius.Attribute.Number.Number instance GHC.Classes.Eq Data.Radius.Attribute.Number.Number module Data.Radius.Attribute.Pair data NumberAbstract a Standard :: Number -> NumberAbstract a Vendors :: a -> NumberAbstract a data TypedNumber v a unsafeTypedNumber :: NumberAbstract v -> TypedNumber v a untypeNumber :: TypedNumber v a -> NumberAbstract v data Attribute' v Attribute' :: !(NumberAbstract v) -> !ByteString -> Attribute' v data Attribute v a Attribute :: !(TypedNumber v a) -> !a -> Attribute v a value :: Attribute v a -> a type TypedNumberSet v a = Set (TypedNumber v a) -- | Retryable error context with anthor attirbute value type MaybeT -- m, and parse error context m. typed :: (Monad m, Functor m, Ord v) => TypedNumberSet v a -> (ByteString -> m b) -> Attribute' v -> MaybeT m (Attribute v b) class TypedNumberSets v attributeNumbersText :: TypedNumberSets v => TypedNumberSet v AtText attributeNumbersString :: TypedNumberSets v => TypedNumberSet v AtString attributeNumbersInteger :: TypedNumberSets v => TypedNumberSet v AtInteger attributeNumbersIpV4 :: TypedNumberSets v => TypedNumberSet v AtIpV4 instance (GHC.Show.Show a, GHC.Show.Show v) => GHC.Show.Show (Data.Radius.Attribute.Pair.Attribute v a) instance (GHC.Classes.Ord a, GHC.Classes.Ord v) => GHC.Classes.Ord (Data.Radius.Attribute.Pair.Attribute v a) instance (GHC.Classes.Eq a, GHC.Classes.Eq v) => GHC.Classes.Eq (Data.Radius.Attribute.Pair.Attribute v a) instance GHC.Show.Show v => GHC.Show.Show (Data.Radius.Attribute.Pair.Attribute' v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Data.Radius.Attribute.Pair.Attribute' v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Radius.Attribute.Pair.Attribute' v) instance GHC.Show.Show v => GHC.Show.Show (Data.Radius.Attribute.Pair.TypedNumber v a) instance GHC.Classes.Ord v => GHC.Classes.Ord (Data.Radius.Attribute.Pair.TypedNumber v a) instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Radius.Attribute.Pair.TypedNumber v a) instance GHC.Show.Show a => GHC.Show.Show (Data.Radius.Attribute.Pair.NumberAbstract a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Radius.Attribute.Pair.NumberAbstract a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Radius.Attribute.Pair.NumberAbstract a) module Data.Radius.Attribute.TH unsafeTypedNumberSetTemplate :: String -> Maybe (Q Type) -> Q Type -> [(Q Exp, [Name])] -> Q [Dec] module Data.Radius.Attribute.Instances replyMessage :: forall a_akS1. Ord a_akS1 => TypedNumber a_akS1 AtText numbersText :: forall a_akS2. Ord a_akS2 => TypedNumberSet a_akS2 AtText messageAuthenticator :: forall a_akTn. Ord a_akTn => TypedNumber a_akTn AtString state :: forall a_akTm. Ord a_akTm => TypedNumber a_akTm AtString proxyState :: forall a_akTl. Ord a_akTl => TypedNumber a_akTl AtString userName :: forall a_akTk. Ord a_akTk => TypedNumber a_akTk AtString numbersString :: forall a_akTo. Ord a_akTo => TypedNumberSet a_akTo AtString numbersInteger :: forall a_akVi. Ord a_akVi => TypedNumberSet a_akVi AtInteger numbersIpV4 :: forall a_akVM. Ord a_akVM => TypedNumberSet a_akVM AtIpV4 module Data.Radius.Attribute module Data.Radius.StreamGet.Base upacket :: Get (Attribute' v) -> Get (Packet [Attribute' v]) packet :: Get a -> Get (Packet a) header :: Get Header attribute' :: Get (Attribute' v) -> Get (Attribute' v) vendorID :: Get Word32 simpleVendorAttribute :: Get (Word8, ByteString) code :: Get Code bin128 :: Get Bin128 atText :: Int -> Get AtText atString :: Int -> Get AtString atInteger :: Get AtInteger atIpV4 :: Get AtIpV4 eof :: Get () module Data.Radius.StreamGet.Monadic -- | Type class to generalize typed attribute param class TypedAttributes a -- | Get typed attribute from attribute set. takeTyped' :: (MonadPlus m, TypedAttributes a, Eq v) => Attributes v -> TypedNumber v a -> m (Attribute v a) -- | Get typed attribute value from attribute set. takeTyped :: (MonadPlus m, TypedAttributes a, Eq v) => Attributes v -> TypedNumber v a -> m a -- | Type to express typed attribute set data Attributes v -- | Extract typed attributes. For example, use like this: -- extractAttributes . mapM tellT extractAttributes :: Monad m => AttributeGetWT v m a -> m (Attributes v) -- | Decode untyped attribute into monadic context. When typed-value decode -- error found, either typed context makes sense. tellT :: (TypedNumberSets v, Ord v) => Attribute' v -> AttributeGetWT v (Either String) () type AttributeGetWT v m = AttributeGetWT' v (WriterT (DList (Attribute' v)) m) attributeGetWT :: m (((((a, AtList v AtIpV4), AtList v AtText), AtList v AtInteger), AtList v AtString), DList (Attribute' v)) -> AttributeGetWT v m a runAttributeGetWT :: AttributeGetWT v m a -> m (((((a, AtList v AtIpV4), AtList v AtText), AtList v AtInteger), AtList v AtString), DList (Attribute' v)) decodeAsText :: (TypedNumberSets v, Ord v) => Attribute' v -> MaybeT (Either String) (Attribute v AtText) decodeAsString :: (TypedNumberSets v, Ord v) => Attribute' v -> MaybeT (Either String) (Attribute v AtString) decodeAsInteger :: (TypedNumberSets v, Ord v) => Attribute' v -> MaybeT (Either String) (Attribute v AtInteger) decodeAsIpV4 :: (TypedNumberSets v, Ord v) => Attribute' v -> MaybeT (Either String) (Attribute v AtIpV4) instance Data.Radius.StreamGet.Monadic.TypedAttributes Data.Radius.Scalar.AtText instance Data.Radius.StreamGet.Monadic.TypedAttributes Data.Radius.Scalar.AtString instance Data.Radius.StreamGet.Monadic.TypedAttributes Data.Radius.Scalar.AtInteger instance Data.Radius.StreamGet.Monadic.TypedAttributes Data.Radius.Scalar.AtIpV4 module Data.Radius.StreamGet module Data.Radius.StreamPut.Base upacket :: (a -> ByteString -> Put) -> Packet [Attribute' a] -> Put packet :: (a -> Put) -> Packet a -> Put header :: Header -> Put attribute' :: (a -> ByteString -> Put) -> (Attribute' a) -> Put vendorID :: Word32 -> Put simpleVendorAttribute :: Word8 -> ByteString -> Put code :: Code -> Put bin128 :: Bin128 -> Put atText :: AtText -> Put atString :: AtString -> Put atInteger :: AtInteger -> Put atIpV4 :: AtIpV4 -> Put module Data.Radius.StreamPut.Monadic -- | Context monad type to build attribute list of packet type AttributePutM v = Writer (DList (Attribute' v)) -- | Extract attribute list from context extractAttributes :: AttributePutM v a -> [Attribute' v] -- | Add attribute key and value into monadic context tellA :: AtValueEncode a => TypedNumber v a -> a -> AttributePutM v () class AtValueEncode a exAttribute :: (a -> Put) -> Attribute v a -> AttributePutM v () attribute :: AtValueEncode a => Attribute v a -> AttributePutM v () instance Data.Radius.StreamPut.Monadic.AtValueEncode Data.Radius.Scalar.AtText instance Data.Radius.StreamPut.Monadic.AtValueEncode Data.Radius.Scalar.AtString instance Data.Radius.StreamPut.Monadic.AtValueEncode Data.Radius.Scalar.AtInteger instance Data.Radius.StreamPut.Monadic.AtValueEncode Data.Radius.Scalar.AtIpV4 module Data.Radius.StreamPut module Data.Radius.Implements -- | Make signatures for response packet. When you don't want to use -- message authenticator attribute, pass a function to make attributes -- which doesn't use message authenticator argument. signPacket :: (a -> ByteString -> Put) -> ByteString -> Bin128 -> (Word16 -> Bin128 -> Header) -> (Bin128 -> [Attribute' a]) -> (Word16, Bin128, Bin128) signedPacket :: (a -> ByteString -> Put) -> ByteString -> Bin128 -> (Word16 -> Bin128 -> Header) -> (Bin128 -> [Attribute' a]) -> Packet [Attribute' a] data AuthenticatorError v -- | No Message-Authenticator attribute NoMessageAuthenticator :: (Attributes v) -> AuthenticatorError v -- | Message-Authenticator attribute is not matched BadMessageAuthenticator :: AuthenticatorError v -- | More than one Message-Authenticator attribute pairs found MoreThanOneMessageAuthenticator :: AuthenticatorError v -- | Radius packet authenticator is not matched BadAuthenticator :: AuthenticatorError v -- | Fail to decode attributes, attribute type error etc. AttributesDecodeError :: String -> AuthenticatorError v -- | Not request packet is passed to function to check request packet NotRequestPacket :: Code -> AuthenticatorError v -- | Not response packet is passed to function to check response packet NotResponsePacket :: Code -> AuthenticatorError v checkSignedRequest :: (TypedNumberSets a, Ord a) => (a -> ByteString -> Put) -> ByteString -> Packet [Attribute' a] -> Either (AuthenticatorError a) (Attributes a) checkSignedResponse :: (TypedNumberSets a, Ord a) => (a -> ByteString -> Put) -> ByteString -> Bin128 -> Packet [Attribute' a] -> Either (AuthenticatorError a) (Attributes a) instance GHC.Show.Show (Data.Radius.Implements.AuthenticatorError v)