{- |
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.
-}

module GI.Gio.Interfaces.TlsBackend
    ( 

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


 -- * Methods
-- ** getCertificateType #method:getCertificateType#
    TlsBackendGetCertificateTypeMethodInfo  ,
    tlsBackendGetCertificateType            ,


-- ** getClientConnectionType #method:getClientConnectionType#
    TlsBackendGetClientConnectionTypeMethodInfo,
    tlsBackendGetClientConnectionType       ,


-- ** getDefault #method:getDefault#
    tlsBackendGetDefault                    ,


-- ** getDefaultDatabase #method:getDefaultDatabase#
    TlsBackendGetDefaultDatabaseMethodInfo  ,
    tlsBackendGetDefaultDatabase            ,


-- ** getDtlsClientConnectionType #method:getDtlsClientConnectionType#
    TlsBackendGetDtlsClientConnectionTypeMethodInfo,
    tlsBackendGetDtlsClientConnectionType   ,


-- ** getDtlsServerConnectionType #method:getDtlsServerConnectionType#
    TlsBackendGetDtlsServerConnectionTypeMethodInfo,
    tlsBackendGetDtlsServerConnectionType   ,


-- ** getFileDatabaseType #method:getFileDatabaseType#
    TlsBackendGetFileDatabaseTypeMethodInfo ,
    tlsBackendGetFileDatabaseType           ,


-- ** getServerConnectionType #method:getServerConnectionType#
    TlsBackendGetServerConnectionTypeMethodInfo,
    tlsBackendGetServerConnectionType       ,


-- ** supportsDtls #method:supportsDtls#
    TlsBackendSupportsDtlsMethodInfo        ,
    tlsBackendSupportsDtls                  ,


-- ** supportsTls #method:supportsTls#
    TlsBackendSupportsTlsMethodInfo         ,
    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.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 
newtype TlsBackend = TlsBackend (ManagedPtr TlsBackend)
noTlsBackend :: Maybe TlsBackend
noTlsBackend = Nothing

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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveTlsBackendMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    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 "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
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

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

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

foreign import ccall "g_tls_backend_get_type"
    c_g_tls_backend_get_type :: IO GType

instance GObject TlsBackend where
    gobjectType _ = c_g_tls_backend_get_type
    

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

toTlsBackend :: IsTlsBackend o => o -> IO TlsBackend
toTlsBackend = unsafeCastTo TlsBackend

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_certificate_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_client_connection_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_default_database backend'
    checkUnexpectedReturnNULL "tlsBackendGetDefaultDatabase" result
    result' <- (wrapObject Gio.TlsDatabase.TlsDatabase) result
    touchManagedPtr backend
    return result'

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

-- 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. -}
tlsBackendGetDtlsClientConnectionType backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_dtls_client_connection_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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. -}
tlsBackendGetDtlsServerConnectionType backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_dtls_server_connection_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_file_database_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_get_server_connection_type backend'
    let result' = GType result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_supports_dtls backend'
    let result' = (/= 0) result
    touchManagedPtr backend
    return result'

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

-- 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 backend = liftIO $ do
    backend' <- unsafeManagedPtrCastPtr backend
    result <- g_tls_backend_supports_tls backend'
    let result' = (/= 0) result
    touchManagedPtr backend
    return result'

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

-- 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  = liftIO $ do
    result <- g_tls_backend_get_default
    checkUnexpectedReturnNULL "tlsBackendGetDefault" result
    result' <- (newObject TlsBackend) result
    return result'