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

    'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' is the client-side subclass of
    'GI.Gio.Interfaces.DtlsConnection.DtlsConnection', representing a client-side DTLS connection.

    /Since: 2.48/
    -}

    #define ENABLE_OVERLOADING \
           (!defined(__HADDOCK_VERSION__))

    module GI.Gio.Interfaces.DtlsClientConnection
        (

    -- * Exported types
        DtlsClientConnection(..)                ,
        noDtlsClientConnection                  ,
        IsDtlsClientConnection                  ,
        toDtlsClientConnection                  ,

     -- * Methods
    -- ** getAcceptedCas #method:getAcceptedCas#

    #if ENABLE_OVERLOADING
        DtlsClientConnectionGetAcceptedCasMethodInfo,
    #endif
        dtlsClientConnectionGetAcceptedCas      ,

    -- ** getServerIdentity #method:getServerIdentity#

    #if ENABLE_OVERLOADING
        DtlsClientConnectionGetServerIdentityMethodInfo,
    #endif
        dtlsClientConnectionGetServerIdentity   ,

    -- ** getValidationFlags #method:getValidationFlags#

    #if ENABLE_OVERLOADING
        DtlsClientConnectionGetValidationFlagsMethodInfo,
    #endif
        dtlsClientConnectionGetValidationFlags  ,

    -- ** new #method:new#

        dtlsClientConnectionNew                 ,

    -- ** setServerIdentity #method:setServerIdentity#

    #if ENABLE_OVERLOADING
        DtlsClientConnectionSetServerIdentityMethodInfo,
    #endif
        dtlsClientConnectionSetServerIdentity   ,

    -- ** setValidationFlags #method:setValidationFlags#

    #if ENABLE_OVERLOADING
        DtlsClientConnectionSetValidationFlagsMethodInfo,
    #endif
        dtlsClientConnectionSetValidationFlags  ,

     -- * Properties
    -- ** acceptedCas #attr:acceptedCas#
    {- | A list of the distinguished names of the Certificate Authorities
    that the server will accept client certificates signed by. If the
    server requests a client certificate during the handshake, then
    this property will be set after the handshake completes.

    Each item in the list is a 'GI.GLib.Structs.ByteArray.ByteArray' which contains the complete
    subject DN of the certificate authority.

    /Since: 2.48/
    -}
    #if ENABLE_OVERLOADING
        DtlsClientConnectionAcceptedCasPropertyInfo,
    #endif
    #if ENABLE_OVERLOADING
        dtlsClientConnectionAcceptedCas         ,
    #endif
        getDtlsClientConnectionAcceptedCas      ,

    -- ** serverIdentity #attr:serverIdentity#
    {- | A 'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' describing the identity of the server that
    is expected on the other end of the connection.

    If the 'GI.Gio.Flags.TlsCertificateFlagsBadIdentity' flag is set in
    'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection':@/validation-flags/@, this object will be used
    to determine the expected identify of the remote end of the
    connection; if 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection':@/server-identity/@ is not set,
    or does not match the identity presented by the server, then the
    'GI.Gio.Flags.TlsCertificateFlagsBadIdentity' validation will fail.

    In addition to its use in verifying the server certificate,
    this is also used to give a hint to the server about what
    certificate we expect, which is useful for servers that serve
    virtual hosts.

    /Since: 2.48/
    -}
    #if ENABLE_OVERLOADING
        DtlsClientConnectionServerIdentityPropertyInfo,
    #endif
        constructDtlsClientConnectionServerIdentity,
    #if ENABLE_OVERLOADING
        dtlsClientConnectionServerIdentity      ,
    #endif
        getDtlsClientConnectionServerIdentity   ,
        setDtlsClientConnectionServerIdentity   ,

    -- ** validationFlags #attr:validationFlags#
    {- | What steps to perform when validating a certificate received from
    a server. Server certificates that fail to validate in all of the
    ways indicated here will be rejected unless the application
    overrides the default via 'GI.Gio.Interfaces.DtlsConnection.DtlsConnection'::@/accept-certificate/@.

    /Since: 2.48/
    -}
    #if ENABLE_OVERLOADING
        DtlsClientConnectionValidationFlagsPropertyInfo,
    #endif
        constructDtlsClientConnectionValidationFlags,
    #if ENABLE_OVERLOADING
        dtlsClientConnectionValidationFlags     ,
    #endif
        getDtlsClientConnectionValidationFlags  ,
        setDtlsClientConnectionValidationFlags  ,

        ) 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.Flags as Gio.Flags
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.DatagramBased as Gio.DatagramBased
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.DtlsConnection as Gio.DtlsConnection
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable

    -- interface DtlsClientConnection
    -- | Memory-managed wrapper type.
    newtype DtlsClientConnection = DtlsClientConnection (ManagedPtr DtlsClientConnection)
    -- | A convenience alias for `Nothing` :: `Maybe` `DtlsClientConnection`.
    noDtlsClientConnection :: Maybe DtlsClientConnection
    noDtlsClientConnection = Nothing

    #if ENABLE_OVERLOADING
    type instance O.SignalList DtlsClientConnection = DtlsClientConnectionSignalList
    type DtlsClientConnectionSignalList = ('[ '("acceptCertificate", Gio.DtlsConnection.DtlsConnectionAcceptCertificateSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

    #endif

    foreign import ccall "g_dtls_client_connection_get_type"
        c_g_dtls_client_connection_get_type :: IO GType

    instance GObject DtlsClientConnection where
        gobjectType _ = c_g_dtls_client_connection_get_type

    -- | Type class for types which can be safely cast to `DtlsClientConnection`, for instance with `toDtlsClientConnection`.
    class GObject o => IsDtlsClientConnection o
    #if MIN_VERSION_base(4,9,0)
    instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DtlsClientConnection a) =>
        IsDtlsClientConnection a
    #endif
    instance IsDtlsClientConnection DtlsClientConnection
    instance Gio.DatagramBased.IsDatagramBased DtlsClientConnection
    instance Gio.DtlsConnection.IsDtlsConnection DtlsClientConnection
    instance GObject.Object.IsObject DtlsClientConnection

    -- | Cast to `DtlsClientConnection`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
    toDtlsClientConnection :: (MonadIO m, IsDtlsClientConnection o) => o -> m DtlsClientConnection
    toDtlsClientConnection = liftIO . unsafeCastTo DtlsClientConnection

    -- VVV Prop "accepted-cas"
       -- Type: TGList (TBasicType TPtr)
       -- Flags: [PropertyReadable]
       -- Nullable: (Nothing,Nothing)

    {- |
    Get the value of the “@accepted-cas@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.get' dtlsClientConnection #acceptedCas
    @
    -}
    getDtlsClientConnectionAcceptedCas :: (MonadIO m, IsDtlsClientConnection o) => o -> m ([Ptr ()])
    getDtlsClientConnectionAcceptedCas obj = liftIO $ getObjectPropertyPtrGList obj "accepted-cas"

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionAcceptedCasPropertyInfo
    instance AttrInfo DtlsClientConnectionAcceptedCasPropertyInfo where
        type AttrAllowedOps DtlsClientConnectionAcceptedCasPropertyInfo = '[ 'AttrGet]
        type AttrSetTypeConstraint DtlsClientConnectionAcceptedCasPropertyInfo = (~) ()
        type AttrBaseTypeConstraint DtlsClientConnectionAcceptedCasPropertyInfo = IsDtlsClientConnection
        type AttrGetType DtlsClientConnectionAcceptedCasPropertyInfo = ([Ptr ()])
        type AttrLabel DtlsClientConnectionAcceptedCasPropertyInfo = "accepted-cas"
        type AttrOrigin DtlsClientConnectionAcceptedCasPropertyInfo = DtlsClientConnection
        attrGet _ = getDtlsClientConnectionAcceptedCas
        attrSet _ = undefined
        attrConstruct _ = undefined
        attrClear _ = undefined
    #endif

    -- VVV Prop "server-identity"
       -- Type: TInterface (Name {namespace = "Gio", name = "SocketConnectable"})
       -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
       -- Nullable: (Just False,Just False)

    {- |
    Get the value of the “@server-identity@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.get' dtlsClientConnection #serverIdentity
    @
    -}
    getDtlsClientConnectionServerIdentity :: (MonadIO m, IsDtlsClientConnection o) => o -> m Gio.SocketConnectable.SocketConnectable
    getDtlsClientConnectionServerIdentity obj = liftIO $ checkUnexpectedNothing "getDtlsClientConnectionServerIdentity" $ getObjectPropertyObject obj "server-identity" Gio.SocketConnectable.SocketConnectable

    {- |
    Set the value of the “@server-identity@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.set' dtlsClientConnection [ #serverIdentity 'Data.GI.Base.Attributes.:=' value ]
    @
    -}
    setDtlsClientConnectionServerIdentity :: (MonadIO m, IsDtlsClientConnection o, Gio.SocketConnectable.IsSocketConnectable a) => o -> a -> m ()
    setDtlsClientConnectionServerIdentity obj val = liftIO $ setObjectPropertyObject obj "server-identity" (Just val)

    {- |
    Construct a `GValueConstruct` with valid value for the “@server-identity@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    -}
    constructDtlsClientConnectionServerIdentity :: (IsDtlsClientConnection o, Gio.SocketConnectable.IsSocketConnectable a) => a -> IO (GValueConstruct o)
    constructDtlsClientConnectionServerIdentity val = constructObjectPropertyObject "server-identity" (Just val)

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionServerIdentityPropertyInfo
    instance AttrInfo DtlsClientConnectionServerIdentityPropertyInfo where
        type AttrAllowedOps DtlsClientConnectionServerIdentityPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
        type AttrSetTypeConstraint DtlsClientConnectionServerIdentityPropertyInfo = Gio.SocketConnectable.IsSocketConnectable
        type AttrBaseTypeConstraint DtlsClientConnectionServerIdentityPropertyInfo = IsDtlsClientConnection
        type AttrGetType DtlsClientConnectionServerIdentityPropertyInfo = Gio.SocketConnectable.SocketConnectable
        type AttrLabel DtlsClientConnectionServerIdentityPropertyInfo = "server-identity"
        type AttrOrigin DtlsClientConnectionServerIdentityPropertyInfo = DtlsClientConnection
        attrGet _ = getDtlsClientConnectionServerIdentity
        attrSet _ = setDtlsClientConnectionServerIdentity
        attrConstruct _ = constructDtlsClientConnectionServerIdentity
        attrClear _ = undefined
    #endif

    -- VVV Prop "validation-flags"
       -- Type: TInterface (Name {namespace = "Gio", name = "TlsCertificateFlags"})
       -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
       -- Nullable: (Just False,Just False)

    {- |
    Get the value of the “@validation-flags@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.get' dtlsClientConnection #validationFlags
    @
    -}
    getDtlsClientConnectionValidationFlags :: (MonadIO m, IsDtlsClientConnection o) => o -> m [Gio.Flags.TlsCertificateFlags]
    getDtlsClientConnectionValidationFlags obj = liftIO $ getObjectPropertyFlags obj "validation-flags"

    {- |
    Set the value of the “@validation-flags@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.set' dtlsClientConnection [ #validationFlags 'Data.GI.Base.Attributes.:=' value ]
    @
    -}
    setDtlsClientConnectionValidationFlags :: (MonadIO m, IsDtlsClientConnection o) => o -> [Gio.Flags.TlsCertificateFlags] -> m ()
    setDtlsClientConnectionValidationFlags obj val = liftIO $ setObjectPropertyFlags obj "validation-flags" val

    {- |
    Construct a `GValueConstruct` with valid value for the “@validation-flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    -}
    constructDtlsClientConnectionValidationFlags :: (IsDtlsClientConnection o) => [Gio.Flags.TlsCertificateFlags] -> IO (GValueConstruct o)
    constructDtlsClientConnectionValidationFlags val = constructObjectPropertyFlags "validation-flags" val

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionValidationFlagsPropertyInfo
    instance AttrInfo DtlsClientConnectionValidationFlagsPropertyInfo where
        type AttrAllowedOps DtlsClientConnectionValidationFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
        type AttrSetTypeConstraint DtlsClientConnectionValidationFlagsPropertyInfo = (~) [Gio.Flags.TlsCertificateFlags]
        type AttrBaseTypeConstraint DtlsClientConnectionValidationFlagsPropertyInfo = IsDtlsClientConnection
        type AttrGetType DtlsClientConnectionValidationFlagsPropertyInfo = [Gio.Flags.TlsCertificateFlags]
        type AttrLabel DtlsClientConnectionValidationFlagsPropertyInfo = "validation-flags"
        type AttrOrigin DtlsClientConnectionValidationFlagsPropertyInfo = DtlsClientConnection
        attrGet _ = getDtlsClientConnectionValidationFlags
        attrSet _ = setDtlsClientConnectionValidationFlags
        attrConstruct _ = constructDtlsClientConnectionValidationFlags
        attrClear _ = undefined
    #endif

    #if ENABLE_OVERLOADING
    instance O.HasAttributeList DtlsClientConnection
    type instance O.AttributeList DtlsClientConnection = DtlsClientConnectionAttributeList
    type DtlsClientConnectionAttributeList = ('[ '("acceptedCas", DtlsClientConnectionAcceptedCasPropertyInfo), '("advertisedProtocols", Gio.DtlsConnection.DtlsConnectionAdvertisedProtocolsPropertyInfo), '("baseSocket", Gio.DtlsConnection.DtlsConnectionBaseSocketPropertyInfo), '("certificate", Gio.DtlsConnection.DtlsConnectionCertificatePropertyInfo), '("database", Gio.DtlsConnection.DtlsConnectionDatabasePropertyInfo), '("interaction", Gio.DtlsConnection.DtlsConnectionInteractionPropertyInfo), '("negotiatedProtocol", Gio.DtlsConnection.DtlsConnectionNegotiatedProtocolPropertyInfo), '("peerCertificate", Gio.DtlsConnection.DtlsConnectionPeerCertificatePropertyInfo), '("peerCertificateErrors", Gio.DtlsConnection.DtlsConnectionPeerCertificateErrorsPropertyInfo), '("rehandshakeMode", Gio.DtlsConnection.DtlsConnectionRehandshakeModePropertyInfo), '("requireCloseNotify", Gio.DtlsConnection.DtlsConnectionRequireCloseNotifyPropertyInfo), '("serverIdentity", DtlsClientConnectionServerIdentityPropertyInfo), '("validationFlags", DtlsClientConnectionValidationFlagsPropertyInfo)] :: [(Symbol, *)])
    #endif

    #if ENABLE_OVERLOADING
    dtlsClientConnectionAcceptedCas :: AttrLabelProxy "acceptedCas"
    dtlsClientConnectionAcceptedCas = AttrLabelProxy

    dtlsClientConnectionServerIdentity :: AttrLabelProxy "serverIdentity"
    dtlsClientConnectionServerIdentity = AttrLabelProxy

    dtlsClientConnectionValidationFlags :: AttrLabelProxy "validationFlags"
    dtlsClientConnectionValidationFlags = AttrLabelProxy

    #endif

    #if ENABLE_OVERLOADING
    type family ResolveDtlsClientConnectionMethod (t :: Symbol) (o :: *) :: * where
        ResolveDtlsClientConnectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveDtlsClientConnectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveDtlsClientConnectionMethod "close" o = Gio.DtlsConnection.DtlsConnectionCloseMethodInfo
        ResolveDtlsClientConnectionMethod "closeAsync" o = Gio.DtlsConnection.DtlsConnectionCloseAsyncMethodInfo
        ResolveDtlsClientConnectionMethod "closeFinish" o = Gio.DtlsConnection.DtlsConnectionCloseFinishMethodInfo
        ResolveDtlsClientConnectionMethod "conditionCheck" o = Gio.DatagramBased.DatagramBasedConditionCheckMethodInfo
        ResolveDtlsClientConnectionMethod "conditionWait" o = Gio.DatagramBased.DatagramBasedConditionWaitMethodInfo
        ResolveDtlsClientConnectionMethod "createSource" o = Gio.DatagramBased.DatagramBasedCreateSourceMethodInfo
        ResolveDtlsClientConnectionMethod "emitAcceptCertificate" o = Gio.DtlsConnection.DtlsConnectionEmitAcceptCertificateMethodInfo
        ResolveDtlsClientConnectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveDtlsClientConnectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveDtlsClientConnectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveDtlsClientConnectionMethod "handshake" o = Gio.DtlsConnection.DtlsConnectionHandshakeMethodInfo
        ResolveDtlsClientConnectionMethod "handshakeAsync" o = Gio.DtlsConnection.DtlsConnectionHandshakeAsyncMethodInfo
        ResolveDtlsClientConnectionMethod "handshakeFinish" o = Gio.DtlsConnection.DtlsConnectionHandshakeFinishMethodInfo
        ResolveDtlsClientConnectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveDtlsClientConnectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveDtlsClientConnectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveDtlsClientConnectionMethod "receiveMessages" o = Gio.DatagramBased.DatagramBasedReceiveMessagesMethodInfo
        ResolveDtlsClientConnectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveDtlsClientConnectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveDtlsClientConnectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveDtlsClientConnectionMethod "sendMessages" o = Gio.DatagramBased.DatagramBasedSendMessagesMethodInfo
        ResolveDtlsClientConnectionMethod "shutdown" o = Gio.DtlsConnection.DtlsConnectionShutdownMethodInfo
        ResolveDtlsClientConnectionMethod "shutdownAsync" o = Gio.DtlsConnection.DtlsConnectionShutdownAsyncMethodInfo
        ResolveDtlsClientConnectionMethod "shutdownFinish" o = Gio.DtlsConnection.DtlsConnectionShutdownFinishMethodInfo
        ResolveDtlsClientConnectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveDtlsClientConnectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveDtlsClientConnectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveDtlsClientConnectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveDtlsClientConnectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveDtlsClientConnectionMethod "getAcceptedCas" o = DtlsClientConnectionGetAcceptedCasMethodInfo
        ResolveDtlsClientConnectionMethod "getCertificate" o = Gio.DtlsConnection.DtlsConnectionGetCertificateMethodInfo
        ResolveDtlsClientConnectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveDtlsClientConnectionMethod "getDatabase" o = Gio.DtlsConnection.DtlsConnectionGetDatabaseMethodInfo
        ResolveDtlsClientConnectionMethod "getInteraction" o = Gio.DtlsConnection.DtlsConnectionGetInteractionMethodInfo
        ResolveDtlsClientConnectionMethod "getNegotiatedProtocol" o = Gio.DtlsConnection.DtlsConnectionGetNegotiatedProtocolMethodInfo
        ResolveDtlsClientConnectionMethod "getPeerCertificate" o = Gio.DtlsConnection.DtlsConnectionGetPeerCertificateMethodInfo
        ResolveDtlsClientConnectionMethod "getPeerCertificateErrors" o = Gio.DtlsConnection.DtlsConnectionGetPeerCertificateErrorsMethodInfo
        ResolveDtlsClientConnectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveDtlsClientConnectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveDtlsClientConnectionMethod "getRehandshakeMode" o = Gio.DtlsConnection.DtlsConnectionGetRehandshakeModeMethodInfo
        ResolveDtlsClientConnectionMethod "getRequireCloseNotify" o = Gio.DtlsConnection.DtlsConnectionGetRequireCloseNotifyMethodInfo
        ResolveDtlsClientConnectionMethod "getServerIdentity" o = DtlsClientConnectionGetServerIdentityMethodInfo
        ResolveDtlsClientConnectionMethod "getValidationFlags" o = DtlsClientConnectionGetValidationFlagsMethodInfo
        ResolveDtlsClientConnectionMethod "setAdvertisedProtocols" o = Gio.DtlsConnection.DtlsConnectionSetAdvertisedProtocolsMethodInfo
        ResolveDtlsClientConnectionMethod "setCertificate" o = Gio.DtlsConnection.DtlsConnectionSetCertificateMethodInfo
        ResolveDtlsClientConnectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveDtlsClientConnectionMethod "setDatabase" o = Gio.DtlsConnection.DtlsConnectionSetDatabaseMethodInfo
        ResolveDtlsClientConnectionMethod "setInteraction" o = Gio.DtlsConnection.DtlsConnectionSetInteractionMethodInfo
        ResolveDtlsClientConnectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveDtlsClientConnectionMethod "setRehandshakeMode" o = Gio.DtlsConnection.DtlsConnectionSetRehandshakeModeMethodInfo
        ResolveDtlsClientConnectionMethod "setRequireCloseNotify" o = Gio.DtlsConnection.DtlsConnectionSetRequireCloseNotifyMethodInfo
        ResolveDtlsClientConnectionMethod "setServerIdentity" o = DtlsClientConnectionSetServerIdentityMethodInfo
        ResolveDtlsClientConnectionMethod "setValidationFlags" o = DtlsClientConnectionSetValidationFlagsMethodInfo
        ResolveDtlsClientConnectionMethod l o = O.MethodResolutionFailed l o

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

    #if MIN_VERSION_base(4,9,0)
    instance (info ~ ResolveDtlsClientConnectionMethod t DtlsClientConnection, O.MethodInfo info DtlsClientConnection p) => O.IsLabel t (DtlsClientConnection -> 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 DtlsClientConnection::get_accepted_cas
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "conn", argType = TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GDtlsClientConnection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TGList TByteArray)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_dtls_client_connection_get_accepted_cas" g_dtls_client_connection_get_accepted_cas ::
        Ptr DtlsClientConnection ->             -- conn : TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"})
        IO (Ptr (GList (Ptr GByteArray)))

    {- |
    Gets the list of distinguished names of the Certificate Authorities
    that the server will accept certificates from. This will be set
    during the TLS handshake if the server requests a certificate.
    Otherwise, it will be 'Nothing'.

    Each item in the list is a 'GI.GLib.Structs.ByteArray.ByteArray' which contains the complete
    subject DN of the certificate authority.

    /Since: 2.48/
    -}
    dtlsClientConnectionGetAcceptedCas ::
        (B.CallStack.HasCallStack, MonadIO m, IsDtlsClientConnection a) =>
        a
        {- ^ /@conn@/: the 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' -}
        -> m [ByteString]
        {- ^ __Returns:__ the list of
    CA DNs. You should unref each element with 'GI.GLib.Functions.byteArrayUnref' and then
    the free the list with @/g_list_free()/@. -}
    dtlsClientConnectionGetAcceptedCas conn = liftIO $ do
        conn' <- unsafeManagedPtrCastPtr conn
        result <- g_dtls_client_connection_get_accepted_cas conn'
        result' <- unpackGList result
        result'' <- mapM unpackGByteArray result'
        mapGList unrefGByteArray result
        g_list_free result
        touchManagedPtr conn
        return result''

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionGetAcceptedCasMethodInfo
    instance (signature ~ (m [ByteString]), MonadIO m, IsDtlsClientConnection a) => O.MethodInfo DtlsClientConnectionGetAcceptedCasMethodInfo a signature where
        overloadedMethod _ = dtlsClientConnectionGetAcceptedCas

    #endif

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

    foreign import ccall "g_dtls_client_connection_get_server_identity" g_dtls_client_connection_get_server_identity ::
        Ptr DtlsClientConnection ->             -- conn : TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"})
        IO (Ptr Gio.SocketConnectable.SocketConnectable)

    {- |
    Gets /@conn@/\'s expected server identity

    /Since: 2.48/
    -}
    dtlsClientConnectionGetServerIdentity ::
        (B.CallStack.HasCallStack, MonadIO m, IsDtlsClientConnection a) =>
        a
        {- ^ /@conn@/: the 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' -}
        -> m Gio.SocketConnectable.SocketConnectable
        {- ^ __Returns:__ a 'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' describing the
    expected server identity, or 'Nothing' if the expected identity is not
    known. -}
    dtlsClientConnectionGetServerIdentity conn = liftIO $ do
        conn' <- unsafeManagedPtrCastPtr conn
        result <- g_dtls_client_connection_get_server_identity conn'
        checkUnexpectedReturnNULL "dtlsClientConnectionGetServerIdentity" result
        result' <- (newObject Gio.SocketConnectable.SocketConnectable) result
        touchManagedPtr conn
        return result'

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionGetServerIdentityMethodInfo
    instance (signature ~ (m Gio.SocketConnectable.SocketConnectable), MonadIO m, IsDtlsClientConnection a) => O.MethodInfo DtlsClientConnectionGetServerIdentityMethodInfo a signature where
        overloadedMethod _ = dtlsClientConnectionGetServerIdentity

    #endif

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

    foreign import ccall "g_dtls_client_connection_get_validation_flags" g_dtls_client_connection_get_validation_flags ::
        Ptr DtlsClientConnection ->             -- conn : TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"})
        IO CUInt

    {- |
    Gets /@conn@/\'s validation flags

    /Since: 2.48/
    -}
    dtlsClientConnectionGetValidationFlags ::
        (B.CallStack.HasCallStack, MonadIO m, IsDtlsClientConnection a) =>
        a
        {- ^ /@conn@/: the 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' -}
        -> m [Gio.Flags.TlsCertificateFlags]
        {- ^ __Returns:__ the validation flags -}
    dtlsClientConnectionGetValidationFlags conn = liftIO $ do
        conn' <- unsafeManagedPtrCastPtr conn
        result <- g_dtls_client_connection_get_validation_flags conn'
        let result' = wordToGFlags result
        touchManagedPtr conn
        return result'

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionGetValidationFlagsMethodInfo
    instance (signature ~ (m [Gio.Flags.TlsCertificateFlags]), MonadIO m, IsDtlsClientConnection a) => O.MethodInfo DtlsClientConnectionGetValidationFlagsMethodInfo a signature where
        overloadedMethod _ = dtlsClientConnectionGetValidationFlags

    #endif

    -- method DtlsClientConnection::set_server_identity
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "conn", argType = TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GDtlsClientConnection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "identity", argType = TInterface (Name {namespace = "Gio", name = "SocketConnectable"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSocketConnectable describing the expected server identity", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_dtls_client_connection_set_server_identity" g_dtls_client_connection_set_server_identity ::
        Ptr DtlsClientConnection ->             -- conn : TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"})
        Ptr Gio.SocketConnectable.SocketConnectable -> -- identity : TInterface (Name {namespace = "Gio", name = "SocketConnectable"})
        IO ()

    {- |
    Sets /@conn@/\'s expected server identity, which is used both to tell
    servers on virtual hosts which certificate to present, and also
    to let /@conn@/ know what name to look for in the certificate when
    performing 'GI.Gio.Flags.TlsCertificateFlagsBadIdentity' validation, if enabled.

    /Since: 2.48/
    -}
    dtlsClientConnectionSetServerIdentity ::
        (B.CallStack.HasCallStack, MonadIO m, IsDtlsClientConnection a, Gio.SocketConnectable.IsSocketConnectable b) =>
        a
        {- ^ /@conn@/: the 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' -}
        -> b
        {- ^ /@identity@/: a 'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' describing the expected server identity -}
        -> m ()
    dtlsClientConnectionSetServerIdentity conn identity = liftIO $ do
        conn' <- unsafeManagedPtrCastPtr conn
        identity' <- unsafeManagedPtrCastPtr identity
        g_dtls_client_connection_set_server_identity conn' identity'
        touchManagedPtr conn
        touchManagedPtr identity
        return ()

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionSetServerIdentityMethodInfo
    instance (signature ~ (b -> m ()), MonadIO m, IsDtlsClientConnection a, Gio.SocketConnectable.IsSocketConnectable b) => O.MethodInfo DtlsClientConnectionSetServerIdentityMethodInfo a signature where
        overloadedMethod _ = dtlsClientConnectionSetServerIdentity

    #endif

    -- method DtlsClientConnection::set_validation_flags
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "conn", argType = TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GDtlsClientConnection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "TlsCertificateFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GTlsCertificateFlags to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_dtls_client_connection_set_validation_flags" g_dtls_client_connection_set_validation_flags ::
        Ptr DtlsClientConnection ->             -- conn : TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"})
        CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "TlsCertificateFlags"})
        IO ()

    {- |
    Sets /@conn@/\'s validation flags, to override the default set of
    checks performed when validating a server certificate. By default,
    'GI.Gio.Flags.TlsCertificateFlagsValidateAll' is used.

    /Since: 2.48/
    -}
    dtlsClientConnectionSetValidationFlags ::
        (B.CallStack.HasCallStack, MonadIO m, IsDtlsClientConnection a) =>
        a
        {- ^ /@conn@/: the 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' -}
        -> [Gio.Flags.TlsCertificateFlags]
        {- ^ /@flags@/: the 'GI.Gio.Flags.TlsCertificateFlags' to use -}
        -> m ()
    dtlsClientConnectionSetValidationFlags conn flags = liftIO $ do
        conn' <- unsafeManagedPtrCastPtr conn
        let flags' = gflagsToWord flags
        g_dtls_client_connection_set_validation_flags conn' flags'
        touchManagedPtr conn
        return ()

    #if ENABLE_OVERLOADING
    data DtlsClientConnectionSetValidationFlagsMethodInfo
    instance (signature ~ ([Gio.Flags.TlsCertificateFlags] -> m ()), MonadIO m, IsDtlsClientConnection a) => O.MethodInfo DtlsClientConnectionSetValidationFlagsMethodInfo a signature where
        overloadedMethod _ = dtlsClientConnectionSetValidationFlags

    #endif

    -- method DtlsClientConnection::new
    -- method type : MemberFunction
    -- Args : [Arg {argCName = "base_socket", argType = TInterface (Name {namespace = "Gio", name = "DatagramBased"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GDatagramBased to wrap", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "server_identity", argType = TInterface (Name {namespace = "Gio", name = "SocketConnectable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the expected identity of the server", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Gio", name = "DtlsClientConnection"}))
    -- throws : True
    -- Skip return : False

    foreign import ccall "g_dtls_client_connection_new" g_dtls_client_connection_new ::
        Ptr Gio.DatagramBased.DatagramBased ->  -- base_socket : TInterface (Name {namespace = "Gio", name = "DatagramBased"})
        Ptr Gio.SocketConnectable.SocketConnectable -> -- server_identity : TInterface (Name {namespace = "Gio", name = "SocketConnectable"})
        Ptr (Ptr GError) ->                     -- error
        IO (Ptr DtlsClientConnection)

    {- |
    Creates a new 'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection' wrapping /@baseSocket@/ which is
    assumed to communicate with the server identified by /@serverIdentity@/.

    /Since: 2.48/
    -}
    dtlsClientConnectionNew ::
        (B.CallStack.HasCallStack, MonadIO m, Gio.DatagramBased.IsDatagramBased a, Gio.SocketConnectable.IsSocketConnectable b) =>
        a
        {- ^ /@baseSocket@/: the 'GI.Gio.Interfaces.DatagramBased.DatagramBased' to wrap -}
        -> Maybe (b)
        {- ^ /@serverIdentity@/: the expected identity of the server -}
        -> m DtlsClientConnection
        {- ^ __Returns:__ the new
      'GI.Gio.Interfaces.DtlsClientConnection.DtlsClientConnection', or 'Nothing' on error /(Can throw 'Data.GI.Base.GError.GError')/ -}
    dtlsClientConnectionNew baseSocket serverIdentity = liftIO $ do
        baseSocket' <- unsafeManagedPtrCastPtr baseSocket
        maybeServerIdentity <- case serverIdentity of
            Nothing -> return nullPtr
            Just jServerIdentity -> do
                jServerIdentity' <- unsafeManagedPtrCastPtr jServerIdentity
                return jServerIdentity'
        onException (do
            result <- propagateGError $ g_dtls_client_connection_new baseSocket' maybeServerIdentity
            checkUnexpectedReturnNULL "dtlsClientConnectionNew" result
            result' <- (wrapObject DtlsClientConnection) result
            touchManagedPtr baseSocket
            whenJust serverIdentity touchManagedPtr
            return result'
         ) (do
            return ()
         )

    #if ENABLE_OVERLOADING
    #endif