{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gio.Objects.Resolver.Resolver' provides cancellable synchronous and asynchronous DNS
-- resolution, for hostnames ('GI.Gio.Objects.Resolver.resolverLookupByAddress',
-- 'GI.Gio.Objects.Resolver.resolverLookupByName' and their async variants) and SRV
-- (service) records ('GI.Gio.Objects.Resolver.resolverLookupService').
-- 
-- t'GI.Gio.Objects.NetworkAddress.NetworkAddress' and t'GI.Gio.Objects.NetworkService.NetworkService' provide wrappers around
-- t'GI.Gio.Objects.Resolver.Resolver' functionality that also implement t'GI.Gio.Interfaces.SocketConnectable.SocketConnectable',
-- making it easy to connect to a remote host\/service.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Objects.Resolver
    ( 

-- * Exported types
    Resolver(..)                            ,
    IsResolver                              ,
    toResolver                              ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [lookupByAddress]("GI.Gio.Objects.Resolver#g:method:lookupByAddress"), [lookupByAddressAsync]("GI.Gio.Objects.Resolver#g:method:lookupByAddressAsync"), [lookupByAddressFinish]("GI.Gio.Objects.Resolver#g:method:lookupByAddressFinish"), [lookupByName]("GI.Gio.Objects.Resolver#g:method:lookupByName"), [lookupByNameAsync]("GI.Gio.Objects.Resolver#g:method:lookupByNameAsync"), [lookupByNameFinish]("GI.Gio.Objects.Resolver#g:method:lookupByNameFinish"), [lookupByNameWithFlags]("GI.Gio.Objects.Resolver#g:method:lookupByNameWithFlags"), [lookupByNameWithFlagsAsync]("GI.Gio.Objects.Resolver#g:method:lookupByNameWithFlagsAsync"), [lookupByNameWithFlagsFinish]("GI.Gio.Objects.Resolver#g:method:lookupByNameWithFlagsFinish"), [lookupRecords]("GI.Gio.Objects.Resolver#g:method:lookupRecords"), [lookupRecordsAsync]("GI.Gio.Objects.Resolver#g:method:lookupRecordsAsync"), [lookupRecordsFinish]("GI.Gio.Objects.Resolver#g:method:lookupRecordsFinish"), [lookupService]("GI.Gio.Objects.Resolver#g:method:lookupService"), [lookupServiceAsync]("GI.Gio.Objects.Resolver#g:method:lookupServiceAsync"), [lookupServiceFinish]("GI.Gio.Objects.Resolver#g:method:lookupServiceFinish"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setDefault]("GI.Gio.Objects.Resolver#g:method:setDefault"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveResolverMethod                   ,
#endif

-- ** getDefault #method:getDefault#

    resolverGetDefault                      ,


-- ** lookupByAddress #method:lookupByAddress#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByAddressMethodInfo       ,
#endif
    resolverLookupByAddress                 ,


-- ** lookupByAddressAsync #method:lookupByAddressAsync#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByAddressAsyncMethodInfo  ,
#endif
    resolverLookupByAddressAsync            ,


-- ** lookupByAddressFinish #method:lookupByAddressFinish#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByAddressFinishMethodInfo ,
#endif
    resolverLookupByAddressFinish           ,


-- ** lookupByName #method:lookupByName#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameMethodInfo          ,
#endif
    resolverLookupByName                    ,


-- ** lookupByNameAsync #method:lookupByNameAsync#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameAsyncMethodInfo     ,
#endif
    resolverLookupByNameAsync               ,


-- ** lookupByNameFinish #method:lookupByNameFinish#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameFinishMethodInfo    ,
#endif
    resolverLookupByNameFinish              ,


-- ** lookupByNameWithFlags #method:lookupByNameWithFlags#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameWithFlagsMethodInfo ,
#endif
    resolverLookupByNameWithFlags           ,


-- ** lookupByNameWithFlagsAsync #method:lookupByNameWithFlagsAsync#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameWithFlagsAsyncMethodInfo,
#endif
    resolverLookupByNameWithFlagsAsync      ,


-- ** lookupByNameWithFlagsFinish #method:lookupByNameWithFlagsFinish#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupByNameWithFlagsFinishMethodInfo,
#endif
    resolverLookupByNameWithFlagsFinish     ,


-- ** lookupRecords #method:lookupRecords#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupRecordsMethodInfo         ,
#endif
    resolverLookupRecords                   ,


-- ** lookupRecordsAsync #method:lookupRecordsAsync#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupRecordsAsyncMethodInfo    ,
#endif
    resolverLookupRecordsAsync              ,


-- ** lookupRecordsFinish #method:lookupRecordsFinish#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupRecordsFinishMethodInfo   ,
#endif
    resolverLookupRecordsFinish             ,


-- ** lookupService #method:lookupService#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupServiceMethodInfo         ,
#endif
    resolverLookupService                   ,


-- ** lookupServiceAsync #method:lookupServiceAsync#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupServiceAsyncMethodInfo    ,
#endif
    resolverLookupServiceAsync              ,


-- ** lookupServiceFinish #method:lookupServiceFinish#

#if defined(ENABLE_OVERLOADING)
    ResolverLookupServiceFinishMethodInfo   ,
#endif
    resolverLookupServiceFinish             ,


-- ** setDefault #method:setDefault#

#if defined(ENABLE_OVERLOADING)
    ResolverSetDefaultMethodInfo            ,
#endif
    resolverSetDefault                      ,




 -- * Signals


-- ** reload #signal:reload#

    ResolverReloadCallback                  ,
#if defined(ENABLE_OVERLOADING)
    ResolverReloadSignalInfo                ,
#endif
    afterResolverReload                     ,
    onResolverReload                        ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InetAddress as Gio.InetAddress
import {-# SOURCE #-} qualified GI.Gio.Structs.SrvTarget as Gio.SrvTarget

-- | Memory-managed wrapper type.
newtype Resolver = Resolver (SP.ManagedPtr Resolver)
    deriving (Resolver -> Resolver -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resolver -> Resolver -> Bool
$c/= :: Resolver -> Resolver -> Bool
== :: Resolver -> Resolver -> Bool
$c== :: Resolver -> Resolver -> Bool
Eq)

instance SP.ManagedPtrNewtype Resolver where
    toManagedPtr :: Resolver -> ManagedPtr Resolver
toManagedPtr (Resolver ManagedPtr Resolver
p) = ManagedPtr Resolver
p

foreign import ccall "g_resolver_get_type"
    c_g_resolver_get_type :: IO B.Types.GType

instance B.Types.TypedObject Resolver where
    glibType :: IO GType
glibType = IO GType
c_g_resolver_get_type

instance B.Types.GObject Resolver

-- | Type class for types which can be safely cast to `Resolver`, for instance with `toResolver`.
class (SP.GObject o, O.IsDescendantOf Resolver o) => IsResolver o
instance (SP.GObject o, O.IsDescendantOf Resolver o) => IsResolver o

instance O.HasParentTypes Resolver
type instance O.ParentTypes Resolver = '[GObject.Object.Object]

-- | Cast to `Resolver`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toResolver :: (MIO.MonadIO m, IsResolver o) => o -> m Resolver
toResolver :: forall (m :: * -> *) o.
(MonadIO m, IsResolver o) =>
o -> m Resolver
toResolver = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Resolver -> Resolver
Resolver

-- | Convert 'Resolver' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Resolver) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_resolver_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Resolver -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Resolver
P.Nothing = forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr Resolver)
    gvalueSet_ Ptr GValue
gv (P.Just Resolver
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Resolver
obj (forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Resolver)
gvalueGet_ Ptr GValue
gv = do
        Ptr Resolver
ptr <- forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Resolver)
        if Ptr Resolver
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
        then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Resolver -> Resolver
Resolver Ptr Resolver
ptr
        else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveResolverMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveResolverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveResolverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveResolverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveResolverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveResolverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveResolverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveResolverMethod "lookupByAddress" o = ResolverLookupByAddressMethodInfo
    ResolveResolverMethod "lookupByAddressAsync" o = ResolverLookupByAddressAsyncMethodInfo
    ResolveResolverMethod "lookupByAddressFinish" o = ResolverLookupByAddressFinishMethodInfo
    ResolveResolverMethod "lookupByName" o = ResolverLookupByNameMethodInfo
    ResolveResolverMethod "lookupByNameAsync" o = ResolverLookupByNameAsyncMethodInfo
    ResolveResolverMethod "lookupByNameFinish" o = ResolverLookupByNameFinishMethodInfo
    ResolveResolverMethod "lookupByNameWithFlags" o = ResolverLookupByNameWithFlagsMethodInfo
    ResolveResolverMethod "lookupByNameWithFlagsAsync" o = ResolverLookupByNameWithFlagsAsyncMethodInfo
    ResolveResolverMethod "lookupByNameWithFlagsFinish" o = ResolverLookupByNameWithFlagsFinishMethodInfo
    ResolveResolverMethod "lookupRecords" o = ResolverLookupRecordsMethodInfo
    ResolveResolverMethod "lookupRecordsAsync" o = ResolverLookupRecordsAsyncMethodInfo
    ResolveResolverMethod "lookupRecordsFinish" o = ResolverLookupRecordsFinishMethodInfo
    ResolveResolverMethod "lookupService" o = ResolverLookupServiceMethodInfo
    ResolveResolverMethod "lookupServiceAsync" o = ResolverLookupServiceAsyncMethodInfo
    ResolveResolverMethod "lookupServiceFinish" o = ResolverLookupServiceFinishMethodInfo
    ResolveResolverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveResolverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveResolverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveResolverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveResolverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveResolverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveResolverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveResolverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveResolverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveResolverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveResolverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveResolverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveResolverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveResolverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveResolverMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveResolverMethod "setDefault" o = ResolverSetDefaultMethodInfo
    ResolveResolverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveResolverMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveResolverMethod t Resolver, O.OverloadedMethod info Resolver p) => OL.IsLabel t (Resolver -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveResolverMethod t Resolver, O.OverloadedMethod info Resolver p, R.HasField t Resolver p) => R.HasField t Resolver p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveResolverMethod t Resolver, O.OverloadedMethodInfo info Resolver) => OL.IsLabel t (O.MethodProxy info Resolver) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- signal Resolver::reload
-- | Emitted when the resolver notices that the system resolver
-- configuration has changed.
type ResolverReloadCallback =
    IO ()

type C_ResolverReloadCallback =
    Ptr Resolver ->                         -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_ResolverReloadCallback`.
foreign import ccall "wrapper"
    mk_ResolverReloadCallback :: C_ResolverReloadCallback -> IO (FunPtr C_ResolverReloadCallback)

wrap_ResolverReloadCallback :: 
    GObject a => (a -> ResolverReloadCallback) ->
    C_ResolverReloadCallback
wrap_ResolverReloadCallback :: forall a. GObject a => (a -> IO ()) -> C_ResolverReloadCallback
wrap_ResolverReloadCallback a -> IO ()
gi'cb Ptr Resolver
gi'selfPtr Ptr ()
_ = do
    forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Resolver
gi'selfPtr forall a b. (a -> b) -> a -> b
$ \Resolver
gi'self -> a -> IO ()
gi'cb (coerce :: forall a b. Coercible a b => a -> b
Coerce.coerce Resolver
gi'self) 


-- | Connect a signal handler for the [reload](#signal:reload) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' resolver #reload callback
-- @
-- 
-- 
onResolverReload :: (IsResolver a, MonadIO m) => a -> ((?self :: a) => ResolverReloadCallback) -> m SignalHandlerId
onResolverReload :: forall a (m :: * -> *).
(IsResolver a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
onResolverReload a
obj (?self::a) => IO ()
cb = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let wrapped :: a -> IO ()
wrapped a
self = let ?self = a
self in (?self::a) => IO ()
cb
    let wrapped' :: C_ResolverReloadCallback
wrapped' = forall a. GObject a => (a -> IO ()) -> C_ResolverReloadCallback
wrap_ResolverReloadCallback a -> IO ()
wrapped
    FunPtr C_ResolverReloadCallback
wrapped'' <- C_ResolverReloadCallback -> IO (FunPtr C_ResolverReloadCallback)
mk_ResolverReloadCallback C_ResolverReloadCallback
wrapped'
    forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"reload" FunPtr C_ResolverReloadCallback
wrapped'' SignalConnectMode
SignalConnectBefore forall a. Maybe a
Nothing

-- | Connect a signal handler for the [reload](#signal:reload) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' resolver #reload callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterResolverReload :: (IsResolver a, MonadIO m) => a -> ((?self :: a) => ResolverReloadCallback) -> m SignalHandlerId
afterResolverReload :: forall a (m :: * -> *).
(IsResolver a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
afterResolverReload a
obj (?self::a) => IO ()
cb = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let wrapped :: a -> IO ()
wrapped a
self = let ?self = a
self in (?self::a) => IO ()
cb
    let wrapped' :: C_ResolverReloadCallback
wrapped' = forall a. GObject a => (a -> IO ()) -> C_ResolverReloadCallback
wrap_ResolverReloadCallback a -> IO ()
wrapped
    FunPtr C_ResolverReloadCallback
wrapped'' <- C_ResolverReloadCallback -> IO (FunPtr C_ResolverReloadCallback)
mk_ResolverReloadCallback C_ResolverReloadCallback
wrapped'
    forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"reload" FunPtr C_ResolverReloadCallback
wrapped'' SignalConnectMode
SignalConnectAfter forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ResolverReloadSignalInfo
instance SignalInfo ResolverReloadSignalInfo where
    type HaskellCallbackType ResolverReloadSignalInfo = ResolverReloadCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ResolverReloadCallback cb
        cb'' <- mk_ResolverReloadCallback cb'
        connectSignalFunPtr obj "reload" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver::reload"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#g:signal:reload"})

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Resolver
type instance O.AttributeList Resolver = ResolverAttributeList
type ResolverAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Resolver = ResolverSignalList
type ResolverSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("reload", ResolverReloadSignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method Resolver::lookup_by_address
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "address"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InetAddress" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the address to reverse-resolve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_address" g_resolver_lookup_by_address :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.InetAddress.InetAddress ->      -- address : TInterface (Name {namespace = "Gio", name = "InetAddress"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CString

-- | Synchronously reverse-resolves /@address@/ to determine its
-- associated hostname.
-- 
-- If the DNS resolution fails, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'.
-- 
-- If /@cancellable@/ is non-'P.Nothing', it can be used to cancel the
-- operation, in which case /@error@/ (if non-'P.Nothing') will be set to
-- 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.22/
resolverLookupByAddress ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.InetAddress.IsInetAddress b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@address@/: the address to reverse-resolve
    -> Maybe (c)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m T.Text
    -- ^ __Returns:__ a hostname (either ASCII-only, or in ASCII-encoded
    --     form), or 'P.Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByAddress :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsResolver a, IsInetAddress b,
 IsCancellable c) =>
a -> b -> Maybe c -> m Text
resolverLookupByAddress a
resolver b
address Maybe c
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr InetAddress
address' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        CString
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> Ptr InetAddress
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CString
g_resolver_lookup_by_address Ptr Resolver
resolver' Ptr InetAddress
address' Ptr Cancellable
maybeCancellable
        forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resolverLookupByAddress" CString
result
        Text
result' <- HasCallStack => CString -> IO Text
cstringToText CString
result
        forall a. Ptr a -> IO ()
freeMem CString
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByAddressMethodInfo
instance (signature ~ (b -> Maybe (c) -> m T.Text), MonadIO m, IsResolver a, Gio.InetAddress.IsInetAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod ResolverLookupByAddressMethodInfo a signature where
    overloadedMethod = resolverLookupByAddress

instance O.OverloadedMethodInfo ResolverLookupByAddressMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByAddress",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByAddress"
        })


#endif

-- method Resolver::lookup_by_address_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "address"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InetAddress" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the address to reverse-resolve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to call after resolution completes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_address_async" g_resolver_lookup_by_address_async :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.InetAddress.InetAddress ->      -- address : TInterface (Name {namespace = "Gio", name = "InetAddress"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Begins asynchronously reverse-resolving /@address@/ to determine its
-- associated hostname, and eventually calls /@callback@/, which must
-- call 'GI.Gio.Objects.Resolver.resolverLookupByAddressFinish' to get the final result.
-- 
-- /Since: 2.22/
resolverLookupByAddressAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.InetAddress.IsInetAddress b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@address@/: the address to reverse-resolve
    -> Maybe (c)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call after resolution completes
    -> m ()
resolverLookupByAddressAsync :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsResolver a, IsInetAddress b,
 IsCancellable c) =>
a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
resolverLookupByAddressAsync a
resolver b
address Maybe c
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr InetAddress
address' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) AsyncReadyCallback
jCallback)
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr Resolver
-> Ptr InetAddress
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_resolver_lookup_by_address_async Ptr Resolver
resolver' Ptr InetAddress
address' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByAddressAsyncMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsResolver a, Gio.InetAddress.IsInetAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod ResolverLookupByAddressAsyncMethodInfo a signature where
    overloadedMethod = resolverLookupByAddressAsync

instance O.OverloadedMethodInfo ResolverLookupByAddressAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByAddressAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByAddressAsync"
        })


#endif

-- method Resolver::lookup_by_address_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the result passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_address_finish" g_resolver_lookup_by_address_finish :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CString

-- | Retrieves the result of a previous call to
-- 'GI.Gio.Objects.Resolver.resolverLookupByAddressAsync'.
-- 
-- If the DNS resolution failed, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'. If the operation was cancelled,
-- /@error@/ will be set to 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.22/
resolverLookupByAddressFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@result@/: the result passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m T.Text
    -- ^ __Returns:__ a hostname (either ASCII-only, or in ASCII-encoded
    -- form), or 'P.Nothing' on error. /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByAddressFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) =>
a -> b -> m Text
resolverLookupByAddressFinish a
resolver b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        CString
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CString
g_resolver_lookup_by_address_finish Ptr Resolver
resolver' Ptr AsyncResult
result_'
        forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resolverLookupByAddressFinish" CString
result
        Text
result' <- HasCallStack => CString -> IO Text
cstringToText CString
result
        forall a. Ptr a -> IO ()
freeMem CString
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByAddressFinishMethodInfo
instance (signature ~ (b -> m T.Text), MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ResolverLookupByAddressFinishMethodInfo a signature where
    overloadedMethod = resolverLookupByAddressFinish

instance O.OverloadedMethodInfo ResolverLookupByAddressFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByAddressFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByAddressFinish"
        })


#endif

-- method Resolver::lookup_by_name
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hostname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the hostname to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "InetAddress" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name" g_resolver_lookup_by_name :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- hostname : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.InetAddress.InetAddress)))

-- | Synchronously resolves /@hostname@/ to determine its associated IP
-- address(es). /@hostname@/ may be an ASCII-only or UTF-8 hostname, or
-- the textual form of an IP address (in which case this just becomes
-- a wrapper around 'GI.Gio.Objects.InetAddress.inetAddressNewFromString').
-- 
-- On success, 'GI.Gio.Objects.Resolver.resolverLookupByName' will return a non-empty t'GI.GLib.Structs.List.List' of
-- t'GI.Gio.Objects.InetAddress.InetAddress', sorted in order of preference and guaranteed to not
-- contain duplicates. That is, if using the result to connect to
-- /@hostname@/, you should attempt to connect to the first address
-- first, then the second if the first fails, etc. If you are using
-- the result to listen on a socket, it is appropriate to add each
-- result using e.g. 'GI.Gio.Objects.SocketListener.socketListenerAddAddress'.
-- 
-- If the DNS resolution fails, /@error@/ (if non-'P.Nothing') will be set to a
-- value from t'GI.Gio.Enums.ResolverError' and 'P.Nothing' will be returned.
-- 
-- If /@cancellable@/ is non-'P.Nothing', it can be used to cancel the
-- operation, in which case /@error@/ (if non-'P.Nothing') will be set to
-- 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- If you are planning to connect to a socket on the resolved IP
-- address, it may be easier to create a t'GI.Gio.Objects.NetworkAddress.NetworkAddress' and use its
-- t'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' interface.
-- 
-- /Since: 2.22/
resolverLookupByName ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@hostname@/: the hostname to look up
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m [Gio.InetAddress.InetAddress]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List'
    -- of t'GI.Gio.Objects.InetAddress.InetAddress', or 'P.Nothing' on error. You
    -- must unref each of the addresses and free the list when you are
    -- done with it. (You can use @/g_resolver_free_addresses()/@ to do this.) /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByName :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a -> Text -> Maybe b -> m [InetAddress]
resolverLookupByName a
resolver Text
hostname Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
hostname' <- Text -> IO CString
textToCString Text
hostname
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr InetAddress))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr InetAddress)))
g_resolver_lookup_by_name Ptr Resolver
resolver' CString
hostname' Ptr Cancellable
maybeCancellable
        [Ptr InetAddress]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr InetAddress))
result
        [InetAddress]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InetAddress -> InetAddress
Gio.InetAddress.InetAddress) [Ptr InetAddress]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr InetAddress))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall a. Ptr a -> IO ()
freeMem CString
hostname'
        forall (m :: * -> *) a. Monad m => a -> m a
return [InetAddress]
result''
     ) (do
        forall a. Ptr a -> IO ()
freeMem CString
hostname'
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m [Gio.InetAddress.InetAddress]), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupByNameMethodInfo a signature where
    overloadedMethod = resolverLookupByName

instance O.OverloadedMethodInfo ResolverLookupByNameMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByName",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByName"
        })


#endif

-- method Resolver::lookup_by_name_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hostname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the hostname to look up the address of"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to call after resolution completes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name_async" g_resolver_lookup_by_name_async :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- hostname : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Begins asynchronously resolving /@hostname@/ to determine its
-- associated IP address(es), and eventually calls /@callback@/, which
-- must call 'GI.Gio.Objects.Resolver.resolverLookupByNameFinish' to get the result.
-- See 'GI.Gio.Objects.Resolver.resolverLookupByName' for more details.
-- 
-- /Since: 2.22/
resolverLookupByNameAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@hostname@/: the hostname to look up the address of
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call after resolution completes
    -> m ()
resolverLookupByNameAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a -> Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
resolverLookupByNameAsync a
resolver Text
hostname Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
hostname' <- Text -> IO CString
textToCString Text
hostname
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) AsyncReadyCallback
jCallback)
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr Resolver
-> CString
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_resolver_lookup_by_name_async Ptr Resolver
resolver' CString
hostname' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall a. Ptr a -> IO ()
freeMem CString
hostname'
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameAsyncMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupByNameAsyncMethodInfo a signature where
    overloadedMethod = resolverLookupByNameAsync

instance O.OverloadedMethodInfo ResolverLookupByNameAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByNameAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByNameAsync"
        })


#endif

-- method Resolver::lookup_by_name_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the result passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "InetAddress" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name_finish" g_resolver_lookup_by_name_finish :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.InetAddress.InetAddress)))

-- | Retrieves the result of a call to
-- 'GI.Gio.Objects.Resolver.resolverLookupByNameAsync'.
-- 
-- If the DNS resolution failed, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'. If the operation was cancelled,
-- /@error@/ will be set to 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.22/
resolverLookupByNameFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@result@/: the result passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m [Gio.InetAddress.InetAddress]
    -- ^ __Returns:__ a t'GI.GLib.Structs.List.List'
    -- of t'GI.Gio.Objects.InetAddress.InetAddress', or 'P.Nothing' on error. See 'GI.Gio.Objects.Resolver.resolverLookupByName'
    -- for more details. /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByNameFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) =>
a -> b -> m [InetAddress]
resolverLookupByNameFinish a
resolver b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr InetAddress))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> Ptr AsyncResult
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr InetAddress)))
g_resolver_lookup_by_name_finish Ptr Resolver
resolver' Ptr AsyncResult
result_'
        [Ptr InetAddress]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr InetAddress))
result
        [InetAddress]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InetAddress -> InetAddress
Gio.InetAddress.InetAddress) [Ptr InetAddress]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr InetAddress))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return [InetAddress]
result''
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameFinishMethodInfo
instance (signature ~ (b -> m [Gio.InetAddress.InetAddress]), MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ResolverLookupByNameFinishMethodInfo a signature where
    overloadedMethod = resolverLookupByNameFinish

instance O.OverloadedMethodInfo ResolverLookupByNameFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByNameFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByNameFinish"
        })


#endif

-- method Resolver::lookup_by_name_with_flags
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hostname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the hostname to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResolverNameLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "extra #GResolverNameLookupFlags for the lookup"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "InetAddress" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name_with_flags" g_resolver_lookup_by_name_with_flags :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- hostname : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "ResolverNameLookupFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.InetAddress.InetAddress)))

-- | This differs from 'GI.Gio.Objects.Resolver.resolverLookupByName' in that you can modify
-- the lookup behavior with /@flags@/. For example this can be used to limit
-- results with 'GI.Gio.Flags.ResolverNameLookupFlagsIpv4Only'.
-- 
-- /Since: 2.60/
resolverLookupByNameWithFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@hostname@/: the hostname to look up
    -> [Gio.Flags.ResolverNameLookupFlags]
    -- ^ /@flags@/: extra t'GI.Gio.Flags.ResolverNameLookupFlags' for the lookup
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m [Gio.InetAddress.InetAddress]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List'
    -- of t'GI.Gio.Objects.InetAddress.InetAddress', or 'P.Nothing' on error. You
    -- must unref each of the addresses and free the list when you are
    -- done with it. (You can use @/g_resolver_free_addresses()/@ to do this.) /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByNameWithFlags :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a
-> Text -> [ResolverNameLookupFlags] -> Maybe b -> m [InetAddress]
resolverLookupByNameWithFlags a
resolver Text
hostname [ResolverNameLookupFlags]
flags Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
hostname' <- Text -> IO CString
textToCString Text
hostname
    let flags' :: CUInt
flags' = forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResolverNameLookupFlags]
flags
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr InetAddress))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr InetAddress)))
g_resolver_lookup_by_name_with_flags Ptr Resolver
resolver' CString
hostname' CUInt
flags' Ptr Cancellable
maybeCancellable
        [Ptr InetAddress]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr InetAddress))
result
        [InetAddress]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InetAddress -> InetAddress
Gio.InetAddress.InetAddress) [Ptr InetAddress]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr InetAddress))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall a. Ptr a -> IO ()
freeMem CString
hostname'
        forall (m :: * -> *) a. Monad m => a -> m a
return [InetAddress]
result''
     ) (do
        forall a. Ptr a -> IO ()
freeMem CString
hostname'
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameWithFlagsMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.ResolverNameLookupFlags] -> Maybe (b) -> m [Gio.InetAddress.InetAddress]), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupByNameWithFlagsMethodInfo a signature where
    overloadedMethod = resolverLookupByNameWithFlags

instance O.OverloadedMethodInfo ResolverLookupByNameWithFlagsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByNameWithFlags",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByNameWithFlags"
        })


#endif

-- method Resolver::lookup_by_name_with_flags_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hostname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the hostname to look up the address of"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResolverNameLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "extra #GResolverNameLookupFlags for the lookup"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to call after resolution completes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name_with_flags_async" g_resolver_lookup_by_name_with_flags_async :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- hostname : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "ResolverNameLookupFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Begins asynchronously resolving /@hostname@/ to determine its
-- associated IP address(es), and eventually calls /@callback@/, which
-- must call 'GI.Gio.Objects.Resolver.resolverLookupByNameWithFlagsFinish' to get the result.
-- See 'GI.Gio.Objects.Resolver.resolverLookupByName' for more details.
-- 
-- /Since: 2.60/
resolverLookupByNameWithFlagsAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@hostname@/: the hostname to look up the address of
    -> [Gio.Flags.ResolverNameLookupFlags]
    -- ^ /@flags@/: extra t'GI.Gio.Flags.ResolverNameLookupFlags' for the lookup
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call after resolution completes
    -> m ()
resolverLookupByNameWithFlagsAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a
-> Text
-> [ResolverNameLookupFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
resolverLookupByNameWithFlagsAsync a
resolver Text
hostname [ResolverNameLookupFlags]
flags Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
hostname' <- Text -> IO CString
textToCString Text
hostname
    let flags' :: CUInt
flags' = forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResolverNameLookupFlags]
flags
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) AsyncReadyCallback
jCallback)
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr Resolver
-> CString
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_resolver_lookup_by_name_with_flags_async Ptr Resolver
resolver' CString
hostname' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall a. Ptr a -> IO ()
freeMem CString
hostname'
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameWithFlagsAsyncMethodInfo
instance (signature ~ (T.Text -> [Gio.Flags.ResolverNameLookupFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupByNameWithFlagsAsyncMethodInfo a signature where
    overloadedMethod = resolverLookupByNameWithFlagsAsync

instance O.OverloadedMethodInfo ResolverLookupByNameWithFlagsAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByNameWithFlagsAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByNameWithFlagsAsync"
        })


#endif

-- method Resolver::lookup_by_name_with_flags_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the result passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "InetAddress" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_by_name_with_flags_finish" g_resolver_lookup_by_name_with_flags_finish :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.InetAddress.InetAddress)))

-- | Retrieves the result of a call to
-- 'GI.Gio.Objects.Resolver.resolverLookupByNameWithFlagsAsync'.
-- 
-- If the DNS resolution failed, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'. If the operation was cancelled,
-- /@error@/ will be set to 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.60/
resolverLookupByNameWithFlagsFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@result@/: the result passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m [Gio.InetAddress.InetAddress]
    -- ^ __Returns:__ a t'GI.GLib.Structs.List.List'
    -- of t'GI.Gio.Objects.InetAddress.InetAddress', or 'P.Nothing' on error. See 'GI.Gio.Objects.Resolver.resolverLookupByName'
    -- for more details. /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupByNameWithFlagsFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) =>
a -> b -> m [InetAddress]
resolverLookupByNameWithFlagsFinish a
resolver b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr InetAddress))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> Ptr AsyncResult
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr InetAddress)))
g_resolver_lookup_by_name_with_flags_finish Ptr Resolver
resolver' Ptr AsyncResult
result_'
        [Ptr InetAddress]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr InetAddress))
result
        [InetAddress]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InetAddress -> InetAddress
Gio.InetAddress.InetAddress) [Ptr InetAddress]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr InetAddress))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return [InetAddress]
result''
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupByNameWithFlagsFinishMethodInfo
instance (signature ~ (b -> m [Gio.InetAddress.InetAddress]), MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ResolverLookupByNameWithFlagsFinishMethodInfo a signature where
    overloadedMethod = resolverLookupByNameWithFlagsFinish

instance O.OverloadedMethodInfo ResolverLookupByNameWithFlagsFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupByNameWithFlagsFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupByNameWithFlagsFinish"
        })


#endif

-- method Resolver::lookup_records
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "rrname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the DNS name to look up the record for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "record_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "ResolverRecordType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type of DNS record to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGList TVariant)
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_records" g_resolver_lookup_records :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- rrname : TBasicType TUTF8
    CUInt ->                                -- record_type : TInterface (Name {namespace = "Gio", name = "ResolverRecordType"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr GVariant)))

-- | Synchronously performs a DNS record lookup for the given /@rrname@/ and returns
-- a list of records as t'GVariant' tuples. See t'GI.Gio.Enums.ResolverRecordType' for
-- information on what the records contain for each /@recordType@/.
-- 
-- If the DNS resolution fails, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError' and 'P.Nothing' will be returned.
-- 
-- If /@cancellable@/ is non-'P.Nothing', it can be used to cancel the
-- operation, in which case /@error@/ (if non-'P.Nothing') will be set to
-- 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.34/
resolverLookupRecords ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@rrname@/: the DNS name to look up the record for
    -> Gio.Enums.ResolverRecordType
    -- ^ /@recordType@/: the type of DNS record to look up
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m [GVariant]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List' of
    -- t'GVariant', or 'P.Nothing' on error. You must free each of the records and the list
    -- when you are done with it. (You can use @/g_list_free_full()/@ with
    -- 'GI.GLib.Structs.Variant.variantUnref' to do this.) /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupRecords :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a -> Text -> ResolverRecordType -> Maybe b -> m [GVariant]
resolverLookupRecords a
resolver Text
rrname ResolverRecordType
recordType Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
rrname' <- Text -> IO CString
textToCString Text
rrname
    let recordType' :: CUInt
recordType' = (forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
fromEnum) ResolverRecordType
recordType
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr GVariant))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> CString
-> CUInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr GVariant)))
g_resolver_lookup_records Ptr Resolver
resolver' CString
rrname' CUInt
recordType' Ptr Cancellable
maybeCancellable
        [Ptr GVariant]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr GVariant))
result
        [GVariant]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr [Ptr GVariant]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr GVariant))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall a. Ptr a -> IO ()
freeMem CString
rrname'
        forall (m :: * -> *) a. Monad m => a -> m a
return [GVariant]
result''
     ) (do
        forall a. Ptr a -> IO ()
freeMem CString
rrname'
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupRecordsMethodInfo
instance (signature ~ (T.Text -> Gio.Enums.ResolverRecordType -> Maybe (b) -> m [GVariant]), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupRecordsMethodInfo a signature where
    overloadedMethod = resolverLookupRecords

instance O.OverloadedMethodInfo ResolverLookupRecordsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupRecords",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupRecords"
        })


#endif

-- method Resolver::lookup_records_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "rrname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the DNS name to look up the record for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "record_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "ResolverRecordType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type of DNS record to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to call after resolution completes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_lookup_records_async" g_resolver_lookup_records_async :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- rrname : TBasicType TUTF8
    CUInt ->                                -- record_type : TInterface (Name {namespace = "Gio", name = "ResolverRecordType"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Begins asynchronously performing a DNS lookup for the given
-- /@rrname@/, and eventually calls /@callback@/, which must call
-- 'GI.Gio.Objects.Resolver.resolverLookupRecordsFinish' to get the final result. See
-- 'GI.Gio.Objects.Resolver.resolverLookupRecords' for more details.
-- 
-- /Since: 2.34/
resolverLookupRecordsAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@rrname@/: the DNS name to look up the record for
    -> Gio.Enums.ResolverRecordType
    -- ^ /@recordType@/: the type of DNS record to look up
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call after resolution completes
    -> m ()
resolverLookupRecordsAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a
-> Text
-> ResolverRecordType
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
resolverLookupRecordsAsync a
resolver Text
rrname ResolverRecordType
recordType Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
rrname' <- Text -> IO CString
textToCString Text
rrname
    let recordType' :: CUInt
recordType' = (forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
fromEnum) ResolverRecordType
recordType
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) AsyncReadyCallback
jCallback)
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr Resolver
-> CString
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_resolver_lookup_records_async Ptr Resolver
resolver' CString
rrname' CUInt
recordType' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall a. Ptr a -> IO ()
freeMem CString
rrname'
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverLookupRecordsAsyncMethodInfo
instance (signature ~ (T.Text -> Gio.Enums.ResolverRecordType -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupRecordsAsyncMethodInfo a signature where
    overloadedMethod = resolverLookupRecordsAsync

instance O.OverloadedMethodInfo ResolverLookupRecordsAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupRecordsAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupRecordsAsync"
        })


#endif

-- method Resolver::lookup_records_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the result passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGList TVariant)
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_records_finish" g_resolver_lookup_records_finish :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr GVariant)))

-- | Retrieves the result of a previous call to
-- 'GI.Gio.Objects.Resolver.resolverLookupRecordsAsync'. Returns a non-empty list of records as
-- t'GVariant' tuples. See t'GI.Gio.Enums.ResolverRecordType' for information on what the
-- records contain.
-- 
-- If the DNS resolution failed, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'. If the operation was cancelled,
-- /@error@/ will be set to 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.34/
resolverLookupRecordsFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@result@/: the result passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m [GVariant]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List' of
    -- t'GVariant', or 'P.Nothing' on error. You must free each of the records and the list
    -- when you are done with it. (You can use @/g_list_free_full()/@ with
    -- 'GI.GLib.Structs.Variant.variantUnref' to do this.) /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupRecordsFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) =>
a -> b -> m [GVariant]
resolverLookupRecordsFinish a
resolver b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr GVariant))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> Ptr AsyncResult
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr GVariant)))
g_resolver_lookup_records_finish Ptr Resolver
resolver' Ptr AsyncResult
result_'
        [Ptr GVariant]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr GVariant))
result
        [GVariant]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr [Ptr GVariant]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr GVariant))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return [GVariant]
result''
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupRecordsFinishMethodInfo
instance (signature ~ (b -> m [GVariant]), MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ResolverLookupRecordsFinishMethodInfo a signature where
    overloadedMethod = resolverLookupRecordsFinish

instance O.OverloadedMethodInfo ResolverLookupRecordsFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupRecordsFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupRecordsFinish"
        })


#endif

-- method Resolver::lookup_service
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "service"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the service type to look up (eg, \"ldap\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the networking protocol to use for @service (eg, \"tcp\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the DNS domain to look up the service in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "SrvTarget" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_service" g_resolver_lookup_service :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- service : TBasicType TUTF8
    CString ->                              -- protocol : TBasicType TUTF8
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.SrvTarget.SrvTarget)))

-- | Synchronously performs a DNS SRV lookup for the given /@service@/ and
-- /@protocol@/ in the given /@domain@/ and returns an array of t'GI.Gio.Structs.SrvTarget.SrvTarget'.
-- /@domain@/ may be an ASCII-only or UTF-8 hostname. Note also that the
-- /@service@/ and /@protocol@/ arguments do not include the leading underscore
-- that appears in the actual DNS entry.
-- 
-- On success, 'GI.Gio.Objects.Resolver.resolverLookupService' will return a non-empty t'GI.GLib.Structs.List.List' of
-- t'GI.Gio.Structs.SrvTarget.SrvTarget', sorted in order of preference. (That is, you should
-- attempt to connect to the first target first, then the second if
-- the first fails, etc.)
-- 
-- If the DNS resolution fails, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError' and 'P.Nothing' will be returned.
-- 
-- If /@cancellable@/ is non-'P.Nothing', it can be used to cancel the
-- operation, in which case /@error@/ (if non-'P.Nothing') will be set to
-- 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- If you are planning to connect to the service, it is usually easier
-- to create a t'GI.Gio.Objects.NetworkService.NetworkService' and use its t'GI.Gio.Interfaces.SocketConnectable.SocketConnectable'
-- interface.
-- 
-- /Since: 2.22/
resolverLookupService ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@service@/: the service type to look up (eg, \"ldap\")
    -> T.Text
    -- ^ /@protocol@/: the networking protocol to use for /@service@/ (eg, \"tcp\")
    -> T.Text
    -- ^ /@domain@/: the DNS domain to look up the service in
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m [Gio.SrvTarget.SrvTarget]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List' of
    -- t'GI.Gio.Structs.SrvTarget.SrvTarget', or 'P.Nothing' on error. You must free each of the targets and the
    -- list when you are done with it. (You can use @/g_resolver_free_targets()/@ to do
    -- this.) /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupService :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a -> Text -> Text -> Text -> Maybe b -> m [SrvTarget]
resolverLookupService a
resolver Text
service Text
protocol Text
domain Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
service' <- Text -> IO CString
textToCString Text
service
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr SrvTarget))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> CString
-> CString
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr SrvTarget)))
g_resolver_lookup_service Ptr Resolver
resolver' CString
service' CString
protocol' CString
domain' Ptr Cancellable
maybeCancellable
        [Ptr SrvTarget]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr SrvTarget))
result
        [SrvTarget]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SrvTarget -> SrvTarget
Gio.SrvTarget.SrvTarget) [Ptr SrvTarget]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr SrvTarget))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        forall a. Ptr a -> IO ()
freeMem CString
service'
        forall a. Ptr a -> IO ()
freeMem CString
protocol'
        forall a. Ptr a -> IO ()
freeMem CString
domain'
        forall (m :: * -> *) a. Monad m => a -> m a
return [SrvTarget]
result''
     ) (do
        forall a. Ptr a -> IO ()
freeMem CString
service'
        forall a. Ptr a -> IO ()
freeMem CString
protocol'
        forall a. Ptr a -> IO ()
freeMem CString
domain'
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupServiceMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> Maybe (b) -> m [Gio.SrvTarget.SrvTarget]), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupServiceMethodInfo a signature where
    overloadedMethod = resolverLookupService

instance O.OverloadedMethodInfo ResolverLookupServiceMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupService",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupService"
        })


#endif

-- method Resolver::lookup_service_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "service"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the service type to look up (eg, \"ldap\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the networking protocol to use for @service (eg, \"tcp\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the DNS domain to look up the service in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to call after resolution completes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_lookup_service_async" g_resolver_lookup_service_async :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    CString ->                              -- service : TBasicType TUTF8
    CString ->                              -- protocol : TBasicType TUTF8
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Begins asynchronously performing a DNS SRV lookup for the given
-- /@service@/ and /@protocol@/ in the given /@domain@/, and eventually calls
-- /@callback@/, which must call 'GI.Gio.Objects.Resolver.resolverLookupServiceFinish' to
-- get the final result. See 'GI.Gio.Objects.Resolver.resolverLookupService' for more
-- details.
-- 
-- /Since: 2.22/
resolverLookupServiceAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> T.Text
    -- ^ /@service@/: the service type to look up (eg, \"ldap\")
    -> T.Text
    -- ^ /@protocol@/: the networking protocol to use for /@service@/ (eg, \"tcp\")
    -> T.Text
    -- ^ /@domain@/: the DNS domain to look up the service in
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: callback to call after resolution completes
    -> m ()
resolverLookupServiceAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsCancellable b) =>
a
-> Text
-> Text
-> Text
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
resolverLookupServiceAsync a
resolver Text
service Text
protocol Text
domain Maybe b
cancellable Maybe AsyncReadyCallback
callback = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    CString
service' <- Text -> IO CString
textToCString Text
service
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. Ptr a -> FunPtr b
castPtrToFunPtr forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) AsyncReadyCallback
jCallback)
            forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = forall a. Ptr a
nullPtr
    Ptr Resolver
-> CString
-> CString
-> CString
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_resolver_lookup_service_async Ptr Resolver
resolver' CString
service' CString
protocol' CString
domain' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback forall a. Ptr a
userData
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    forall a. Ptr a -> IO ()
freeMem CString
service'
    forall a. Ptr a -> IO ()
freeMem CString
protocol'
    forall a. Ptr a -> IO ()
freeMem CString
domain'
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverLookupServiceAsyncMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsResolver a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod ResolverLookupServiceAsyncMethodInfo a signature where
    overloadedMethod = resolverLookupServiceAsync

instance O.OverloadedMethodInfo ResolverLookupServiceAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupServiceAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupServiceAsync"
        })


#endif

-- method Resolver::lookup_service_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResolver" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the result passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "SrvTarget" }))
-- throws : True
-- Skip return : False

foreign import ccall "g_resolver_lookup_service_finish" g_resolver_lookup_service_finish :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Gio.SrvTarget.SrvTarget)))

-- | Retrieves the result of a previous call to
-- 'GI.Gio.Objects.Resolver.resolverLookupServiceAsync'.
-- 
-- If the DNS resolution failed, /@error@/ (if non-'P.Nothing') will be set to
-- a value from t'GI.Gio.Enums.ResolverError'. If the operation was cancelled,
-- /@error@/ will be set to 'GI.Gio.Enums.IOErrorEnumCancelled'.
-- 
-- /Since: 2.22/
resolverLookupServiceFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@resolver@/: a t'GI.Gio.Objects.Resolver.Resolver'
    -> b
    -- ^ /@result@/: the result passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m [Gio.SrvTarget.SrvTarget]
    -- ^ __Returns:__ a non-empty t'GI.GLib.Structs.List.List' of
    -- t'GI.Gio.Structs.SrvTarget.SrvTarget', or 'P.Nothing' on error. See 'GI.Gio.Objects.Resolver.resolverLookupService' for more
    -- details. /(Can throw 'Data.GI.Base.GError.GError')/
resolverLookupServiceFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsResolver a, IsAsyncResult b) =>
a -> b -> m [SrvTarget]
resolverLookupServiceFinish a
resolver b
result_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr AsyncResult
result_' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GList (Ptr SrvTarget))
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Resolver
-> Ptr AsyncResult
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr SrvTarget)))
g_resolver_lookup_service_finish Ptr Resolver
resolver' Ptr AsyncResult
result_'
        [Ptr SrvTarget]
result' <- forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr SrvTarget))
result
        [SrvTarget]
result'' <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SrvTarget -> SrvTarget
Gio.SrvTarget.SrvTarget) [Ptr SrvTarget]
result'
        forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr SrvTarget))
result
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
        forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        forall (m :: * -> *) a. Monad m => a -> m a
return [SrvTarget]
result''
     ) (do
        forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ResolverLookupServiceFinishMethodInfo
instance (signature ~ (b -> m [Gio.SrvTarget.SrvTarget]), MonadIO m, IsResolver a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod ResolverLookupServiceFinishMethodInfo a signature where
    overloadedMethod = resolverLookupServiceFinish

instance O.OverloadedMethodInfo ResolverLookupServiceFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverLookupServiceFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverLookupServiceFinish"
        })


#endif

-- method Resolver::set_default
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new default #GResolver"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resolver_set_default" g_resolver_set_default :: 
    Ptr Resolver ->                         -- resolver : TInterface (Name {namespace = "Gio", name = "Resolver"})
    IO ()

-- | Sets /@resolver@/ to be the application\'s default resolver (reffing
-- /@resolver@/, and unreffing the previous default resolver, if any).
-- Future calls to 'GI.Gio.Objects.Resolver.resolverGetDefault' will return this resolver.
-- 
-- This can be used if an application wants to perform any sort of DNS
-- caching or \"pinning\"; it can implement its own t'GI.Gio.Objects.Resolver.Resolver' that
-- calls the original default resolver for DNS operations, and
-- implements its own cache policies on top of that, and then set
-- itself as the default resolver for all later code to use.
-- 
-- /Since: 2.22/
resolverSetDefault ::
    (B.CallStack.HasCallStack, MonadIO m, IsResolver a) =>
    a
    -- ^ /@resolver@/: the new default t'GI.Gio.Objects.Resolver.Resolver'
    -> m ()
resolverSetDefault :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsResolver a) =>
a -> m ()
resolverSetDefault a
resolver = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
resolver' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr Resolver -> IO ()
g_resolver_set_default Ptr Resolver
resolver'
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ResolverSetDefaultMethodInfo
instance (signature ~ (m ()), MonadIO m, IsResolver a) => O.OverloadedMethod ResolverSetDefaultMethodInfo a signature where
    overloadedMethod = resolverSetDefault

instance O.OverloadedMethodInfo ResolverSetDefaultMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Resolver.resolverSetDefault",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Resolver.html#v:resolverSetDefault"
        })


#endif

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

foreign import ccall "g_resolver_get_default" g_resolver_get_default :: 
    IO (Ptr Resolver)

-- | Gets the default t'GI.Gio.Objects.Resolver.Resolver'. You should unref it when you are done
-- with it. t'GI.Gio.Objects.Resolver.Resolver' may use its reference count as a hint about how
-- many threads it should allocate for concurrent DNS resolutions.
-- 
-- /Since: 2.22/
resolverGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Resolver
    -- ^ __Returns:__ the default t'GI.Gio.Objects.Resolver.Resolver'.
resolverGetDefault :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Resolver
resolverGetDefault  = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Resolver
result <- IO (Ptr Resolver)
g_resolver_get_default
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resolverGetDefault" Ptr Resolver
result
    Resolver
result' <- (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Resolver -> Resolver
Resolver) Ptr Resolver
result
    forall (m :: * -> *) a. Monad m => a -> m a
return Resolver
result'

#if defined(ENABLE_OVERLOADING)
#endif