{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

TLS (Transport Layer Security, aka SSL) and DTLS backend.

/Since: 2.28/
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Interfaces.TlsBackend
    ( 

-- * Exported types
    TlsBackend(..)                          ,
    noTlsBackend                            ,
    IsTlsBackend                            ,
    toTlsBackend                            ,


 -- * Methods
-- ** getCertificateType #method:getCertificateType#

#if ENABLE_OVERLOADING
    TlsBackendGetCertificateTypeMethodInfo  ,
#endif
    tlsBackendGetCertificateType            ,


-- ** getClientConnectionType #method:getClientConnectionType#

#if ENABLE_OVERLOADING
    TlsBackendGetClientConnectionTypeMethodInfo,
#endif
    tlsBackendGetClientConnectionType       ,


-- ** getDefault #method:getDefault#

    tlsBackendGetDefault                    ,


-- ** getDefaultDatabase #method:getDefaultDatabase#

#if ENABLE_OVERLOADING
    TlsBackendGetDefaultDatabaseMethodInfo  ,
#endif
    tlsBackendGetDefaultDatabase            ,


-- ** getDtlsClientConnectionType #method:getDtlsClientConnectionType#

#if ENABLE_OVERLOADING
    TlsBackendGetDtlsClientConnectionTypeMethodInfo,
#endif
    tlsBackendGetDtlsClientConnectionType   ,


-- ** getDtlsServerConnectionType #method:getDtlsServerConnectionType#

#if ENABLE_OVERLOADING
    TlsBackendGetDtlsServerConnectionTypeMethodInfo,
#endif
    tlsBackendGetDtlsServerConnectionType   ,


-- ** getFileDatabaseType #method:getFileDatabaseType#

#if ENABLE_OVERLOADING
    TlsBackendGetFileDatabaseTypeMethodInfo ,
#endif
    tlsBackendGetFileDatabaseType           ,


-- ** getServerConnectionType #method:getServerConnectionType#

#if ENABLE_OVERLOADING
    TlsBackendGetServerConnectionTypeMethodInfo,
#endif
    tlsBackendGetServerConnectionType       ,


-- ** setDefaultDatabase #method:setDefaultDatabase#

#if ENABLE_OVERLOADING
    TlsBackendSetDefaultDatabaseMethodInfo  ,
#endif
    tlsBackendSetDefaultDatabase            ,


-- ** supportsDtls #method:supportsDtls#

#if ENABLE_OVERLOADING
    TlsBackendSupportsDtlsMethodInfo        ,
#endif
    tlsBackendSupportsDtls                  ,


-- ** supportsTls #method:supportsTls#

#if ENABLE_OVERLOADING
    TlsBackendSupportsTlsMethodInfo         ,
#endif
    tlsBackendSupportsTls                   ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Objects.TlsDatabase as Gio.TlsDatabase

-- interface TlsBackend 
-- | Memory-managed wrapper type.
newtype TlsBackend = TlsBackend (ManagedPtr TlsBackend)
-- | A convenience alias for `Nothing` :: `Maybe` `TlsBackend`.
noTlsBackend :: Maybe TlsBackend
noTlsBackend :: Maybe TlsBackend
noTlsBackend = Maybe TlsBackend
forall a. Maybe a
Nothing

#if ENABLE_OVERLOADING
type instance O.SignalList TlsBackend = TlsBackendSignalList
type TlsBackendSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "g_tls_backend_get_type"
    c_g_tls_backend_get_type :: IO GType

instance GObject TlsBackend where
    gobjectType :: TlsBackend -> IO GType
gobjectType _ = IO GType
c_g_tls_backend_get_type
    

-- | Type class for types which can be safely cast to `TlsBackend`, for instance with `toTlsBackend`.
class GObject o => IsTlsBackend o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError TlsBackend a) =>
    IsTlsBackend a
#endif
instance IsTlsBackend TlsBackend
instance GObject.Object.IsObject TlsBackend

-- | Cast to `TlsBackend`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toTlsBackend :: (MonadIO m, IsTlsBackend o) => o -> m TlsBackend
toTlsBackend :: o -> m TlsBackend
toTlsBackend = IO TlsBackend -> m TlsBackend
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TlsBackend -> m TlsBackend)
-> (o -> IO TlsBackend) -> o -> m TlsBackend
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TlsBackend -> TlsBackend) -> o -> IO TlsBackend
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr TlsBackend -> TlsBackend
TlsBackend

#if ENABLE_OVERLOADING
instance O.HasAttributeList TlsBackend
type instance O.AttributeList TlsBackend = TlsBackendAttributeList
type TlsBackendAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveTlsBackendMethod (t :: Symbol) (o :: *) :: * where
    ResolveTlsBackendMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveTlsBackendMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveTlsBackendMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveTlsBackendMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveTlsBackendMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveTlsBackendMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveTlsBackendMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveTlsBackendMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveTlsBackendMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveTlsBackendMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveTlsBackendMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveTlsBackendMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveTlsBackendMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveTlsBackendMethod "supportsDtls" o = TlsBackendSupportsDtlsMethodInfo
    ResolveTlsBackendMethod "supportsTls" o = TlsBackendSupportsTlsMethodInfo
    ResolveTlsBackendMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveTlsBackendMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveTlsBackendMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveTlsBackendMethod "getCertificateType" o = TlsBackendGetCertificateTypeMethodInfo
    ResolveTlsBackendMethod "getClientConnectionType" o = TlsBackendGetClientConnectionTypeMethodInfo
    ResolveTlsBackendMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveTlsBackendMethod "getDefaultDatabase" o = TlsBackendGetDefaultDatabaseMethodInfo
    ResolveTlsBackendMethod "getDtlsClientConnectionType" o = TlsBackendGetDtlsClientConnectionTypeMethodInfo
    ResolveTlsBackendMethod "getDtlsServerConnectionType" o = TlsBackendGetDtlsServerConnectionTypeMethodInfo
    ResolveTlsBackendMethod "getFileDatabaseType" o = TlsBackendGetFileDatabaseTypeMethodInfo
    ResolveTlsBackendMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveTlsBackendMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveTlsBackendMethod "getServerConnectionType" o = TlsBackendGetServerConnectionTypeMethodInfo
    ResolveTlsBackendMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveTlsBackendMethod "setDefaultDatabase" o = TlsBackendSetDefaultDatabaseMethodInfo
    ResolveTlsBackendMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveTlsBackendMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveTlsBackendMethod t TlsBackend, O.MethodInfo info TlsBackend p) => O.IsLabelProxy t (TlsBackend -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTlsBackendMethod t TlsBackend, O.MethodInfo info TlsBackend p) => O.IsLabel t (TlsBackend -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- method TlsBackend::get_certificate_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_certificate_type" g_tls_backend_get_certificate_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/\'s 'GI.Gio.Objects.TlsCertificate.TlsCertificate' implementation.

/Since: 2.28/
-}
tlsBackendGetCertificateType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of /@backend@/\'s 'GI.Gio.Objects.TlsCertificate.TlsCertificate'
  implementation. -}
tlsBackendGetCertificateType :: a -> m GType
tlsBackendGetCertificateType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_certificate_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetCertificateTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetCertificateTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetCertificateType

#endif

-- method TlsBackend::get_client_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_client_connection_type" g_tls_backend_get_client_connection_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/\'s 'GI.Gio.Interfaces.TlsClientConnection.TlsClientConnection' implementation.

/Since: 2.28/
-}
tlsBackendGetClientConnectionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of /@backend@/\'s 'GI.Gio.Interfaces.TlsClientConnection.TlsClientConnection'
  implementation. -}
tlsBackendGetClientConnectionType :: a -> m GType
tlsBackendGetClientConnectionType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_client_connection_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetClientConnectionTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetClientConnectionTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetClientConnectionType

#endif

-- method TlsBackend::get_default_database
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "TlsDatabase"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_default_database" g_tls_backend_get_default_database :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO (Ptr Gio.TlsDatabase.TlsDatabase)

{- |
Gets the default 'GI.Gio.Objects.TlsDatabase.TlsDatabase' used to verify TLS connections.

/Since: 2.30/
-}
tlsBackendGetDefaultDatabase ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m Gio.TlsDatabase.TlsDatabase
    {- ^ __Returns:__ the default database, which should be
              unreffed when done. -}
tlsBackendGetDefaultDatabase :: a -> m TlsDatabase
tlsBackendGetDefaultDatabase backend :: a
backend = IO TlsDatabase -> m TlsDatabase
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TlsDatabase -> m TlsDatabase)
-> IO TlsDatabase -> m TlsDatabase
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    Ptr TlsDatabase
result <- Ptr TlsBackend -> IO (Ptr TlsDatabase)
g_tls_backend_get_default_database Ptr TlsBackend
backend'
    Text -> Ptr TlsDatabase -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tlsBackendGetDefaultDatabase" Ptr TlsDatabase
result
    TlsDatabase
result' <- ((ManagedPtr TlsDatabase -> TlsDatabase)
-> Ptr TlsDatabase -> IO TlsDatabase
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr TlsDatabase -> TlsDatabase
Gio.TlsDatabase.TlsDatabase) Ptr TlsDatabase
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    TlsDatabase -> IO TlsDatabase
forall (m :: * -> *) a. Monad m => a -> m a
return TlsDatabase
result'

#if ENABLE_OVERLOADING
data TlsBackendGetDefaultDatabaseMethodInfo
instance (signature ~ (m Gio.TlsDatabase.TlsDatabase), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetDefaultDatabaseMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetDefaultDatabase

#endif

-- method TlsBackend::get_dtls_client_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_dtls_client_connection_type" g_tls_backend_get_dtls_client_connection_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/’s 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' implementation.

/Since: 2.48/
-}
tlsBackendGetDtlsClientConnectionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of /@backend@/’s 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection'
  implementation, or @/G_TYPE_INVALID/@ if this backend doesn’t support DTLS. -}
tlsBackendGetDtlsClientConnectionType :: a -> m GType
tlsBackendGetDtlsClientConnectionType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_dtls_client_connection_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetDtlsClientConnectionTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetDtlsClientConnectionTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetDtlsClientConnectionType

#endif

-- method TlsBackend::get_dtls_server_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_dtls_server_connection_type" g_tls_backend_get_dtls_server_connection_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/’s 'GI.Gio.Interfaces.DtlsServerConnection.DtlsServerConnection' implementation.

/Since: 2.48/
-}
tlsBackendGetDtlsServerConnectionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of /@backend@/’s 'GI.Gio.Interfaces.DtlsServerConnection.DtlsServerConnection'
  implementation, or @/G_TYPE_INVALID/@ if this backend doesn’t support DTLS. -}
tlsBackendGetDtlsServerConnectionType :: a -> m GType
tlsBackendGetDtlsServerConnectionType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_dtls_server_connection_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetDtlsServerConnectionTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetDtlsServerConnectionTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetDtlsServerConnectionType

#endif

-- method TlsBackend::get_file_database_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_file_database_type" g_tls_backend_get_file_database_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/\'s 'GI.Gio.Interfaces.TlsFileDatabase.TlsFileDatabase' implementation.

/Since: 2.30/
-}
tlsBackendGetFileDatabaseType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of backend\'s 'GI.Gio.Interfaces.TlsFileDatabase.TlsFileDatabase' implementation. -}
tlsBackendGetFileDatabaseType :: a -> m GType
tlsBackendGetFileDatabaseType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_file_database_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetFileDatabaseTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetFileDatabaseTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetFileDatabaseType

#endif

-- method TlsBackend::get_server_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_server_connection_type" g_tls_backend_get_server_connection_type :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CGType

{- |
Gets the 'GType' of /@backend@/\'s 'GI.Gio.Interfaces.TlsServerConnection.TlsServerConnection' implementation.

/Since: 2.28/
-}
tlsBackendGetServerConnectionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of /@backend@/\'s 'GI.Gio.Interfaces.TlsServerConnection.TlsServerConnection'
  implementation. -}
tlsBackendGetServerConnectionType :: a -> m GType
tlsBackendGetServerConnectionType backend :: a
backend = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CGType
result <- Ptr TlsBackend -> IO CGType
g_tls_backend_get_server_connection_type Ptr TlsBackend
backend'
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if ENABLE_OVERLOADING
data TlsBackendGetServerConnectionTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendGetServerConnectionTypeMethodInfo a signature where
    overloadedMethod _ = tlsBackendGetServerConnectionType

#endif

-- method TlsBackend::set_default_database
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "database", argType = TInterface (Name {namespace = "Gio", name = "TlsDatabase"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GTlsDatabase", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_set_default_database" g_tls_backend_set_default_database :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    Ptr Gio.TlsDatabase.TlsDatabase ->      -- database : TInterface (Name {namespace = "Gio", name = "TlsDatabase"})
    IO ()

{- |
Set the default 'GI.Gio.Objects.TlsDatabase.TlsDatabase' used to verify TLS connections

Any subsequent call to 'GI.Gio.Interfaces.TlsBackend.tlsBackendGetDefaultDatabase' will return
the database set in this call.  Existing databases and connections are not
modified.

Setting a 'Nothing' default database will reset to using the system default
database as if 'GI.Gio.Interfaces.TlsBackend.tlsBackendSetDefaultDatabase' had never been called.

/Since: 2.60/
-}
tlsBackendSetDefaultDatabase ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a, Gio.TlsDatabase.IsTlsDatabase b) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> Maybe (b)
    {- ^ /@database@/: the 'GI.Gio.Objects.TlsDatabase.TlsDatabase' -}
    -> m ()
tlsBackendSetDefaultDatabase :: a -> Maybe b -> m ()
tlsBackendSetDefaultDatabase backend :: a
backend database :: Maybe b
database = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    Ptr TlsDatabase
maybeDatabase <- case Maybe b
database of
        Nothing -> Ptr TlsDatabase -> IO (Ptr TlsDatabase)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr TlsDatabase
forall a. Ptr a
nullPtr
        Just jDatabase :: b
jDatabase -> do
            Ptr TlsDatabase
jDatabase' <- b -> IO (Ptr TlsDatabase)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jDatabase
            Ptr TlsDatabase -> IO (Ptr TlsDatabase)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr TlsDatabase
jDatabase'
    Ptr TlsBackend -> Ptr TlsDatabase -> IO ()
g_tls_backend_set_default_database Ptr TlsBackend
backend' Ptr TlsDatabase
maybeDatabase
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
database b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data TlsBackendSetDefaultDatabaseMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsTlsBackend a, Gio.TlsDatabase.IsTlsDatabase b) => O.MethodInfo TlsBackendSetDefaultDatabaseMethodInfo a signature where
    overloadedMethod _ = tlsBackendSetDefaultDatabase

#endif

-- method TlsBackend::supports_dtls
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_supports_dtls" g_tls_backend_supports_dtls :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CInt

{- |
Checks if DTLS is supported. DTLS support may not be available even if TLS
support is available, and vice-versa.

/Since: 2.48/
-}
tlsBackendSupportsDtls ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m Bool
    {- ^ __Returns:__ whether DTLS is supported -}
tlsBackendSupportsDtls :: a -> m Bool
tlsBackendSupportsDtls backend :: a
backend = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CInt
result <- Ptr TlsBackend -> IO CInt
g_tls_backend_supports_dtls Ptr TlsBackend
backend'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
data TlsBackendSupportsDtlsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendSupportsDtlsMethodInfo a signature where
    overloadedMethod _ = tlsBackendSupportsDtls

#endif

-- method TlsBackend::supports_tls
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "backend", argType = TInterface (Name {namespace = "Gio", name = "TlsBackend"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsBackend", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_supports_tls" g_tls_backend_supports_tls :: 
    Ptr TlsBackend ->                       -- backend : TInterface (Name {namespace = "Gio", name = "TlsBackend"})
    IO CInt

{- |
Checks if TLS is supported; if this returns 'False' for the default
'GI.Gio.Interfaces.TlsBackend.TlsBackend', it means no \"real\" TLS backend is available.

/Since: 2.28/
-}
tlsBackendSupportsTls ::
    (B.CallStack.HasCallStack, MonadIO m, IsTlsBackend a) =>
    a
    {- ^ /@backend@/: the 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
    -> m Bool
    {- ^ __Returns:__ whether or not TLS is supported -}
tlsBackendSupportsTls :: a -> m Bool
tlsBackendSupportsTls backend :: a
backend = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
backend' <- a -> IO (Ptr TlsBackend)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
backend
    CInt
result <- Ptr TlsBackend -> IO CInt
g_tls_backend_supports_tls Ptr TlsBackend
backend'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
backend
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if ENABLE_OVERLOADING
data TlsBackendSupportsTlsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTlsBackend a) => O.MethodInfo TlsBackendSupportsTlsMethodInfo a signature where
    overloadedMethod _ = tlsBackendSupportsTls

#endif

-- method TlsBackend::get_default
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "TlsBackend"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_default" g_tls_backend_get_default :: 
    IO (Ptr TlsBackend)

{- |
Gets the default 'GI.Gio.Interfaces.TlsBackend.TlsBackend' for the system.

/Since: 2.28/
-}
tlsBackendGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m TlsBackend
    {- ^ __Returns:__ a 'GI.Gio.Interfaces.TlsBackend.TlsBackend' -}
tlsBackendGetDefault :: m TlsBackend
tlsBackendGetDefault  = IO TlsBackend -> m TlsBackend
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TlsBackend -> m TlsBackend) -> IO TlsBackend -> m TlsBackend
forall a b. (a -> b) -> a -> b
$ do
    Ptr TlsBackend
result <- IO (Ptr TlsBackend)
g_tls_backend_get_default
    Text -> Ptr TlsBackend -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tlsBackendGetDefault" Ptr TlsBackend
result
    TlsBackend
result' <- ((ManagedPtr TlsBackend -> TlsBackend)
-> Ptr TlsBackend -> IO TlsBackend
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr TlsBackend -> TlsBackend
TlsBackend) Ptr TlsBackend
result
    TlsBackend -> IO TlsBackend
forall (m :: * -> *) a. Monad m => a -> m a
return TlsBackend
result'

#if ENABLE_OVERLOADING
#endif