-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Bindings for GNU libgsasl
--   
--   Bindings for GNU libgsasl
@package gsasl
@version 0.3.7

module Network.Protocol.SASL.GNU

-- | Which version of gsasl.h this module was compiled against
headerVersion :: (Integer, Integer, Integer)

-- | Which version of libgsasl.so is loaded
libraryVersion :: IO (Integer, Integer, Integer)

-- | Whether the header and library versions are compatible
checkVersion :: IO Bool
data SASL a
runSASL :: SASL a -> IO a

-- | Set the current SASL callback. The callback will be used by mechanisms
--   to discover various parameters, such as usernames and passwords.
setCallback :: (Property -> Session Progress) -> SASL ()

-- | Run the current callback; the property indicates what action the
--   callback is expected to perform.
runCallback :: Property -> Session Progress
newtype Mechanism
Mechanism :: ByteString -> Mechanism

-- | A list of Mechanisms supported by the libgsasl client.
clientMechanisms :: SASL [Mechanism]

-- | Whether there is client-side support for a specified Mechanism.
clientSupports :: Mechanism -> SASL Bool

-- | Given a list of Mechanisms, suggest which to use (or
--   Nothing if no supported Mechanism is found).
clientSuggestMechanism :: [Mechanism] -> SASL (Maybe Mechanism)

-- | A list of Mechanisms supported by the libgsasl server.
serverMechanisms :: SASL [Mechanism]

-- | Whether there is server-side support for a specified Mechanism.
serverSupports :: Mechanism -> SASL Bool
data Session a

-- | Run a session using the libgsasl client.
runClient :: Mechanism -> Session a -> SASL (Either Error a)

-- | Run a session using the libgsasl server.
runServer :: Mechanism -> Session a -> SASL (Either Error a)

-- | The name of the session's SASL mechanism.
mechanismName :: Session Mechanism
data Property
PropertyAuthID :: Property
PropertyAuthzID :: Property
PropertyPassword :: Property
PropertyAnonymousToken :: Property
PropertyService :: Property
PropertyHostname :: Property
PropertyGSSAPIDisplayName :: Property
PropertyPasscode :: Property
PropertySuggestedPIN :: Property
PropertyPIN :: Property
PropertyRealm :: Property
PropertyDigestMD5HashedPassword :: Property
PropertyQOPS :: Property
PropertyQOP :: Property
PropertyScramIter :: Property
PropertyScramSalt :: Property
PropertyScramSaltedPassword :: Property
ValidateSimple :: Property
ValidateExternal :: Property
ValidateAnonymous :: Property
ValidateGSSAPI :: Property
ValidateSecurID :: Property

-- | Store some data in the session for the given property. The data must
--   be NULL-terminated.
setProperty :: Property -> ByteString -> Session ()

-- | Retrieve the data stored in the session for the given property,
--   possibly invoking the current callback to get the value.
getProperty :: Property -> Session (Maybe ByteString)

-- | Retrieve the data stored in the session for the given property,
--   without invoking the current callback.
getPropertyFast :: Property -> Session (Maybe ByteString)
data Progress
Complete :: Progress
NeedsMore :: Progress

-- | Perform one step of SASL authentication. This reads data from the
--   other end, processes it (potentially running the callback), and
--   returns data to be sent back.
--   
--   Also returns NeedsMore if authentication is not yet complete.
step :: ByteString -> Session (ByteString, Progress)

-- | A simple wrapper around step which uses base64 to decode the
--   input and encode the output.
step64 :: ByteString -> Session (ByteString, Progress)

-- | Encode data according to the negotiated SASL mechanism. This might
--   mean the data is integrity or privacy protected.
encode :: ByteString -> Session ByteString

-- | Decode data according to the negotiated SASL mechanism. This might
--   mean the data is integrity or privacy protected.
decode :: ByteString -> Session ByteString
data Error
UnknownMechanism :: Error
MechanismCalledTooManyTimes :: Error
MallocError :: Error
Base64Error :: Error
CryptoError :: Error
SASLPrepError :: Error
MechanismParseError :: Error
AuthenticationError :: Error
IntegrityError :: Error
NoClientCode :: Error
NoServerCode :: Error
NoCallback :: Error
NoAnonymousToken :: Error
NoAuthID :: Error
NoAuthzID :: Error
NoPassword :: Error
NoPasscode :: Error
NoPIN :: Error
NoService :: Error
NoHostname :: Error
GSSAPI_ReleaseBufferError :: Error
GSSAPI_ImportNameError :: Error
GSSAPI_InitSecContextError :: Error
GSSAPI_AcceptSecContextError :: Error
GSSAPI_UnwrapError :: Error
GSSAPI_WrapError :: Error
GSSAPI_AquireCredError :: Error
GSSAPI_DisplayNameError :: Error
GSSAPI_UnsupportedProtectionError :: Error
GSSAPI_EncapsulateTokenError :: Error
GSSAPI_DecapsulateTokenError :: Error
GSSAPI_InquireMechForSASLNameError :: Error
GSSAPI_TestOIDSetMemberError :: Error
GSSAPI_ReleaseOIDSetError :: Error
KerberosV5_InitError :: Error
KerberosV5_InternalError :: Error
SecurID_ServerNeedAdditionalPasscode :: Error
SecurID_ServerNeedNewPIN :: Error
catch :: Session a -> (Error -> Session a) -> Session a
handle :: (Error -> Session a) -> Session a -> Session a
try :: Session a -> Session (Either Error a)
throw :: Error -> Session a
toBase64 :: ByteString -> ByteString
fromBase64 :: ByteString -> ByteString
md5 :: ByteString -> ByteString
sha1 :: ByteString -> ByteString
hmacMD5 :: ByteString -> ByteString -> ByteString
hmacSHA1 :: ByteString -> ByteString -> ByteString

-- | Returns unpredictable data of a given size
nonce :: Integer -> IO ByteString

-- | Returns cryptographically strong random data of a given size
random :: Integer -> IO ByteString
instance GHC.Classes.Eq Network.Protocol.SASL.GNU.Mechanism
instance GHC.Show.Show Network.Protocol.SASL.GNU.Mechanism
instance GHC.Show.Show Network.Protocol.SASL.GNU.SASLException
instance GHC.Classes.Eq Network.Protocol.SASL.GNU.Property
instance GHC.Show.Show Network.Protocol.SASL.GNU.Property
instance GHC.Classes.Eq Network.Protocol.SASL.GNU.Progress
instance GHC.Show.Show Network.Protocol.SASL.GNU.Progress
instance GHC.Exception.Type.Exception Network.Protocol.SASL.GNU.SASLException
instance GHC.Show.Show Network.Protocol.SASL.GNU.Error
instance GHC.Base.Functor Network.Protocol.SASL.GNU.Session
instance GHC.Base.Applicative Network.Protocol.SASL.GNU.Session
instance GHC.Base.Monad Network.Protocol.SASL.GNU.Session
instance Control.Monad.IO.Class.MonadIO Network.Protocol.SASL.GNU.Session
instance Data.String.IsString Network.Protocol.SASL.GNU.Mechanism
instance GHC.Base.Functor Network.Protocol.SASL.GNU.SASL
instance GHC.Base.Applicative Network.Protocol.SASL.GNU.SASL
instance GHC.Base.Monad Network.Protocol.SASL.GNU.SASL
instance Control.Monad.IO.Class.MonadIO Network.Protocol.SASL.GNU.SASL
