-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

module GI.Soup.Callbacks
    ( 

 -- * Signals


-- ** AddressCallback #signal:AddressCallback#

    AddressCallback                         ,
    AddressCallback_WithClosures            ,
    C_AddressCallback                       ,
    drop_closures_AddressCallback           ,
    dynamic_AddressCallback                 ,
    genClosure_AddressCallback              ,
    mk_AddressCallback                      ,
    noAddressCallback                       ,
    noAddressCallback_WithClosures          ,
    wrap_AddressCallback                    ,


-- ** AuthDomainBasicAuthCallback #signal:AuthDomainBasicAuthCallback#

    AuthDomainBasicAuthCallback             ,
    AuthDomainBasicAuthCallback_WithClosures,
    C_AuthDomainBasicAuthCallback           ,
    drop_closures_AuthDomainBasicAuthCallback,
    dynamic_AuthDomainBasicAuthCallback     ,
    genClosure_AuthDomainBasicAuthCallback  ,
    mk_AuthDomainBasicAuthCallback          ,
    noAuthDomainBasicAuthCallback           ,
    noAuthDomainBasicAuthCallback_WithClosures,
    wrap_AuthDomainBasicAuthCallback        ,


-- ** AuthDomainDigestAuthCallback #signal:AuthDomainDigestAuthCallback#

    AuthDomainDigestAuthCallback            ,
    AuthDomainDigestAuthCallback_WithClosures,
    C_AuthDomainDigestAuthCallback          ,
    drop_closures_AuthDomainDigestAuthCallback,
    dynamic_AuthDomainDigestAuthCallback    ,
    genClosure_AuthDomainDigestAuthCallback ,
    mk_AuthDomainDigestAuthCallback         ,
    noAuthDomainDigestAuthCallback          ,
    noAuthDomainDigestAuthCallback_WithClosures,
    wrap_AuthDomainDigestAuthCallback       ,


-- ** AuthDomainFilter #signal:AuthDomainFilter#

    AuthDomainFilter                        ,
    AuthDomainFilter_WithClosures           ,
    C_AuthDomainFilter                      ,
    drop_closures_AuthDomainFilter          ,
    dynamic_AuthDomainFilter                ,
    genClosure_AuthDomainFilter             ,
    mk_AuthDomainFilter                     ,
    noAuthDomainFilter                      ,
    noAuthDomainFilter_WithClosures         ,
    wrap_AuthDomainFilter                   ,


-- ** AuthDomainGenericAuthCallback #signal:AuthDomainGenericAuthCallback#

    AuthDomainGenericAuthCallback           ,
    AuthDomainGenericAuthCallback_WithClosures,
    C_AuthDomainGenericAuthCallback         ,
    drop_closures_AuthDomainGenericAuthCallback,
    dynamic_AuthDomainGenericAuthCallback   ,
    genClosure_AuthDomainGenericAuthCallback,
    mk_AuthDomainGenericAuthCallback        ,
    noAuthDomainGenericAuthCallback         ,
    noAuthDomainGenericAuthCallback_WithClosures,
    wrap_AuthDomainGenericAuthCallback      ,


-- ** ChunkAllocator #signal:ChunkAllocator#

    C_ChunkAllocator                        ,
    ChunkAllocator                          ,
    ChunkAllocator_WithClosures             ,
    drop_closures_ChunkAllocator            ,
    dynamic_ChunkAllocator                  ,
    genClosure_ChunkAllocator               ,
    mk_ChunkAllocator                       ,
    noChunkAllocator                        ,
    noChunkAllocator_WithClosures           ,
    wrap_ChunkAllocator                     ,


-- ** LoggerFilter #signal:LoggerFilter#

    C_LoggerFilter                          ,
    LoggerFilter                            ,
    LoggerFilter_WithClosures               ,
    drop_closures_LoggerFilter              ,
    dynamic_LoggerFilter                    ,
    genClosure_LoggerFilter                 ,
    mk_LoggerFilter                         ,
    noLoggerFilter                          ,
    noLoggerFilter_WithClosures             ,
    wrap_LoggerFilter                       ,


-- ** LoggerPrinter #signal:LoggerPrinter#

    C_LoggerPrinter                         ,
    LoggerPrinter                           ,
    LoggerPrinter_WithClosures              ,
    drop_closures_LoggerPrinter             ,
    dynamic_LoggerPrinter                   ,
    genClosure_LoggerPrinter                ,
    mk_LoggerPrinter                        ,
    noLoggerPrinter                         ,
    noLoggerPrinter_WithClosures            ,
    wrap_LoggerPrinter                      ,


-- ** MessageHeadersForeachFunc #signal:MessageHeadersForeachFunc#

    C_MessageHeadersForeachFunc             ,
    MessageHeadersForeachFunc               ,
    MessageHeadersForeachFunc_WithClosures  ,
    drop_closures_MessageHeadersForeachFunc ,
    dynamic_MessageHeadersForeachFunc       ,
    genClosure_MessageHeadersForeachFunc    ,
    mk_MessageHeadersForeachFunc            ,
    noMessageHeadersForeachFunc             ,
    noMessageHeadersForeachFunc_WithClosures,
    wrap_MessageHeadersForeachFunc          ,


-- ** PasswordManagerCallback #signal:PasswordManagerCallback#

    C_PasswordManagerCallback               ,
    PasswordManagerCallback                 ,
    PasswordManagerCallback_WithClosures    ,
    drop_closures_PasswordManagerCallback   ,
    dynamic_PasswordManagerCallback         ,
    genClosure_PasswordManagerCallback      ,
    mk_PasswordManagerCallback              ,
    noPasswordManagerCallback               ,
    noPasswordManagerCallback_WithClosures  ,
    wrap_PasswordManagerCallback            ,


-- ** ProxyResolverCallback #signal:ProxyResolverCallback#

    C_ProxyResolverCallback                 ,
    ProxyResolverCallback                   ,
    ProxyResolverCallback_WithClosures      ,
    drop_closures_ProxyResolverCallback     ,
    dynamic_ProxyResolverCallback           ,
    genClosure_ProxyResolverCallback        ,
    mk_ProxyResolverCallback                ,
    noProxyResolverCallback                 ,
    noProxyResolverCallback_WithClosures    ,
    wrap_ProxyResolverCallback              ,


-- ** ProxyURIResolverCallback #signal:ProxyURIResolverCallback#

    C_ProxyURIResolverCallback              ,
    ProxyURIResolverCallback                ,
    ProxyURIResolverCallback_WithClosures   ,
    drop_closures_ProxyURIResolverCallback  ,
    dynamic_ProxyURIResolverCallback        ,
    genClosure_ProxyURIResolverCallback     ,
    mk_ProxyURIResolverCallback             ,
    noProxyURIResolverCallback              ,
    noProxyURIResolverCallback_WithClosures ,
    wrap_ProxyURIResolverCallback           ,


-- ** ServerCallback #signal:ServerCallback#

    C_ServerCallback                        ,
    ServerCallback                          ,
    ServerCallback_WithClosures             ,
    drop_closures_ServerCallback            ,
    dynamic_ServerCallback                  ,
    genClosure_ServerCallback               ,
    mk_ServerCallback                       ,
    noServerCallback                        ,
    noServerCallback_WithClosures           ,
    wrap_ServerCallback                     ,


-- ** ServerWebsocketCallback #signal:ServerWebsocketCallback#

    C_ServerWebsocketCallback               ,
    ServerWebsocketCallback                 ,
    ServerWebsocketCallback_WithClosures    ,
    drop_closures_ServerWebsocketCallback   ,
    dynamic_ServerWebsocketCallback         ,
    genClosure_ServerWebsocketCallback      ,
    mk_ServerWebsocketCallback              ,
    noServerWebsocketCallback               ,
    noServerWebsocketCallback_WithClosures  ,
    wrap_ServerWebsocketCallback            ,


-- ** SessionCallback #signal:SessionCallback#

    C_SessionCallback                       ,
    SessionCallback                         ,
    SessionCallback_WithClosures            ,
    drop_closures_SessionCallback           ,
    dynamic_SessionCallback                 ,
    genClosure_SessionCallback              ,
    mk_SessionCallback                      ,
    noSessionCallback                       ,
    noSessionCallback_WithClosures          ,
    wrap_SessionCallback                    ,


-- ** SessionConnectProgressCallback #signal:SessionConnectProgressCallback#

    C_SessionConnectProgressCallback        ,
    SessionConnectProgressCallback          ,
    SessionConnectProgressCallback_WithClosures,
    drop_closures_SessionConnectProgressCallback,
    dynamic_SessionConnectProgressCallback  ,
    genClosure_SessionConnectProgressCallback,
    mk_SessionConnectProgressCallback       ,
    noSessionConnectProgressCallback        ,
    noSessionConnectProgressCallback_WithClosures,
    wrap_SessionConnectProgressCallback     ,


-- ** SocketCallback #signal:SocketCallback#

    C_SocketCallback                        ,
    SocketCallback                          ,
    SocketCallback_WithClosures             ,
    drop_closures_SocketCallback            ,
    dynamic_SocketCallback                  ,
    genClosure_SocketCallback               ,
    mk_SocketCallback                       ,
    noSocketCallback                        ,
    noSocketCallback_WithClosures           ,
    wrap_SocketCallback                     ,




    ) 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.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.Text as T
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.Gio.Enums as Gio.Enums
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Interfaces.PasswordManager as Soup.PasswordManager
import {-# SOURCE #-} qualified GI.Soup.Interfaces.ProxyResolver as Soup.ProxyResolver
import {-# SOURCE #-} qualified GI.Soup.Interfaces.ProxyURIResolver as Soup.ProxyURIResolver
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.Auth as Soup.Auth
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomain as Soup.AuthDomain
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomainBasic as Soup.AuthDomainBasic
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomainDigest as Soup.AuthDomainDigest
import {-# SOURCE #-} qualified GI.Soup.Objects.Logger as Soup.Logger
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Objects.Server as Soup.Server
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session
import {-# SOURCE #-} qualified GI.Soup.Objects.Socket as Soup.Socket
import {-# SOURCE #-} qualified GI.Soup.Objects.WebsocketConnection as Soup.WebsocketConnection
import {-# SOURCE #-} qualified GI.Soup.Structs.Buffer as Soup.Buffer
import {-# SOURCE #-} qualified GI.Soup.Structs.ClientContext as Soup.ClientContext
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

-- callback SocketCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "sock"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Socket" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupSocket" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "status"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "an HTTP status code indicating success or failure"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the data passed to soup_socket_connect_async()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "The callback function passed to soup_socket_connect_async()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SocketCallback =
    Ptr Soup.Socket.Socket ->
    Word32 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "sock"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Socket" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupSocket" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "status"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an HTTP status code indicating success or failure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the data passed to soup_socket_connect_async()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SocketCallback :: FunPtr C_SocketCallback -> C_SocketCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SocketCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Socket.IsSocket a) =>
    FunPtr C_SocketCallback
    -> a
    -- ^ /@sock@/: the t'GI.Soup.Objects.Socket.Socket'
    -> Word32
    -- ^ /@status@/: an HTTP status code indicating success or failure
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Socket.socketConnectAsync'
    -> m ()
dynamic_SocketCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
FunPtr C_SocketCallback -> a -> Word32 -> Ptr () -> m ()
dynamic_SocketCallback FunPtr C_SocketCallback
__funPtr a
sock Word32
status Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Socket
sock' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
sock
    (FunPtr C_SocketCallback -> C_SocketCallback
__dynamic_C_SocketCallback FunPtr C_SocketCallback
__funPtr) Ptr Socket
sock' Word32
status Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
sock
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The callback function passed to 'GI.Soup.Objects.Socket.socketConnectAsync'.
type SocketCallback =
    Soup.Socket.Socket
    -- ^ /@sock@/: the t'GI.Soup.Objects.Socket.Socket'
    -> Word32
    -- ^ /@status@/: an HTTP status code indicating success or failure
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SocketCallback`@.
noSocketCallback :: Maybe SocketCallback
noSocketCallback :: Maybe SocketCallback
noSocketCallback = Maybe SocketCallback
forall a. Maybe a
Nothing

-- | The callback function passed to 'GI.Soup.Objects.Socket.socketConnectAsync'.
type SocketCallback_WithClosures =
    Soup.Socket.Socket
    -- ^ /@sock@/: the t'GI.Soup.Objects.Socket.Socket'
    -> Word32
    -- ^ /@status@/: an HTTP status code indicating success or failure
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Socket.socketConnectAsync'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SocketCallback_WithClosures`@.
noSocketCallback_WithClosures :: Maybe SocketCallback_WithClosures
noSocketCallback_WithClosures :: Maybe SocketCallback_WithClosures
noSocketCallback_WithClosures = Maybe SocketCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SocketCallback :: SocketCallback -> SocketCallback_WithClosures
drop_closures_SocketCallback :: SocketCallback -> SocketCallback_WithClosures
drop_closures_SocketCallback SocketCallback
_f Socket
sock Word32
status Ptr ()
_ = SocketCallback
_f Socket
sock Word32
status

-- | Wrap the callback into a `GClosure`.
genClosure_SocketCallback :: MonadIO m => SocketCallback -> m (GClosure C_SocketCallback)
genClosure_SocketCallback :: forall (m :: * -> *).
MonadIO m =>
SocketCallback -> m (GClosure C_SocketCallback)
genClosure_SocketCallback SocketCallback
cb = IO (GClosure C_SocketCallback) -> m (GClosure C_SocketCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SocketCallback) -> m (GClosure C_SocketCallback))
-> IO (GClosure C_SocketCallback) -> m (GClosure C_SocketCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SocketCallback_WithClosures
cb' = SocketCallback -> SocketCallback_WithClosures
drop_closures_SocketCallback SocketCallback
cb
    let cb'' :: C_SocketCallback
cb'' = Maybe (Ptr (FunPtr C_SocketCallback))
-> SocketCallback_WithClosures -> C_SocketCallback
wrap_SocketCallback Maybe (Ptr (FunPtr C_SocketCallback))
forall a. Maybe a
Nothing SocketCallback_WithClosures
cb'
    C_SocketCallback -> IO (FunPtr C_SocketCallback)
mk_SocketCallback C_SocketCallback
cb'' IO (FunPtr C_SocketCallback)
-> (FunPtr C_SocketCallback -> IO (GClosure C_SocketCallback))
-> IO (GClosure C_SocketCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SocketCallback -> IO (GClosure C_SocketCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SocketCallback` into a `C_SocketCallback`.
wrap_SocketCallback ::
    Maybe (Ptr (FunPtr C_SocketCallback)) ->
    SocketCallback_WithClosures ->
    C_SocketCallback
wrap_SocketCallback :: Maybe (Ptr (FunPtr C_SocketCallback))
-> SocketCallback_WithClosures -> C_SocketCallback
wrap_SocketCallback Maybe (Ptr (FunPtr C_SocketCallback))
funptrptr SocketCallback_WithClosures
_cb Ptr Socket
sock Word32
status Ptr ()
userData = do
    Socket
sock' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Socket -> Socket
Soup.Socket.Socket) Ptr Socket
sock
    SocketCallback_WithClosures
_cb  Socket
sock' Word32
status Ptr ()
userData
    Maybe (Ptr (FunPtr C_SocketCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SocketCallback))
funptrptr


-- callback SessionConnectProgressCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "session"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Session" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupSession" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "event"
          , argType =
              TInterface Name { namespace = "Gio" , name = "SocketClientEvent" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GSocketClientEvent"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "connection"
          , argType =
              TInterface Name { namespace = "Gio" , name = "IOStream" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current state of the network connection"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the data passed to soup_session_connect_async()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype for the progress callback passed to soup_session_connect_async()."
        , sinceVersion = Just "2.62"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SessionConnectProgressCallback =
    Ptr Soup.Session.Session ->
    CUInt ->
    Ptr Gio.IOStream.IOStream ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "session"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Session" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupSession" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "event"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketClientEvent" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSocketClientEvent"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IOStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current state of the network connection"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the data passed to soup_session_connect_async()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SessionConnectProgressCallback :: FunPtr C_SessionConnectProgressCallback -> C_SessionConnectProgressCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SessionConnectProgressCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Session.IsSession a, Gio.IOStream.IsIOStream b) =>
    FunPtr C_SessionConnectProgressCallback
    -> a
    -- ^ /@session@/: the t'GI.Soup.Objects.Session.Session'
    -> Gio.Enums.SocketClientEvent
    -- ^ /@event@/: a t'GI.Gio.Enums.SocketClientEvent'
    -> b
    -- ^ /@connection@/: the current state of the network connection
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Session.sessionConnectAsync'.
    -> m ()
dynamic_SessionConnectProgressCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSession a, IsIOStream b) =>
FunPtr C_SessionConnectProgressCallback
-> a -> SocketClientEvent -> b -> Ptr () -> m ()
dynamic_SessionConnectProgressCallback FunPtr C_SessionConnectProgressCallback
__funPtr a
session SocketClientEvent
event b
connection Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Session
session' <- a -> IO (Ptr Session)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
session
    let event' :: CUInt
event' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (SocketClientEvent -> Int) -> SocketClientEvent -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketClientEvent -> Int
forall a. Enum a => a -> Int
fromEnum) SocketClientEvent
event
    Ptr IOStream
connection' <- b -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connection
    (FunPtr C_SessionConnectProgressCallback
-> C_SessionConnectProgressCallback
__dynamic_C_SessionConnectProgressCallback FunPtr C_SessionConnectProgressCallback
__funPtr) Ptr Session
session' CUInt
event' Ptr IOStream
connection' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
session
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connection
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Prototype for the progress callback passed to 'GI.Soup.Objects.Session.sessionConnectAsync'.
-- 
-- /Since: 2.62/
type SessionConnectProgressCallback =
    Soup.Session.Session
    -- ^ /@session@/: the t'GI.Soup.Objects.Session.Session'
    -> Gio.Enums.SocketClientEvent
    -- ^ /@event@/: a t'GI.Gio.Enums.SocketClientEvent'
    -> Gio.IOStream.IOStream
    -- ^ /@connection@/: the current state of the network connection
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionConnectProgressCallback`@.
noSessionConnectProgressCallback :: Maybe SessionConnectProgressCallback
noSessionConnectProgressCallback :: Maybe SessionConnectProgressCallback
noSessionConnectProgressCallback = Maybe SessionConnectProgressCallback
forall a. Maybe a
Nothing

-- | Prototype for the progress callback passed to 'GI.Soup.Objects.Session.sessionConnectAsync'.
-- 
-- /Since: 2.62/
type SessionConnectProgressCallback_WithClosures =
    Soup.Session.Session
    -- ^ /@session@/: the t'GI.Soup.Objects.Session.Session'
    -> Gio.Enums.SocketClientEvent
    -- ^ /@event@/: a t'GI.Gio.Enums.SocketClientEvent'
    -> Gio.IOStream.IOStream
    -- ^ /@connection@/: the current state of the network connection
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Session.sessionConnectAsync'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionConnectProgressCallback_WithClosures`@.
noSessionConnectProgressCallback_WithClosures :: Maybe SessionConnectProgressCallback_WithClosures
noSessionConnectProgressCallback_WithClosures :: Maybe SessionConnectProgressCallback_WithClosures
noSessionConnectProgressCallback_WithClosures = Maybe SessionConnectProgressCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SessionConnectProgressCallback :: SessionConnectProgressCallback -> SessionConnectProgressCallback_WithClosures
drop_closures_SessionConnectProgressCallback :: SessionConnectProgressCallback
-> SessionConnectProgressCallback_WithClosures
drop_closures_SessionConnectProgressCallback SessionConnectProgressCallback
_f Session
session SocketClientEvent
event IOStream
connection Ptr ()
_ = SessionConnectProgressCallback
_f Session
session SocketClientEvent
event IOStream
connection

-- | Wrap the callback into a `GClosure`.
genClosure_SessionConnectProgressCallback :: MonadIO m => SessionConnectProgressCallback -> m (GClosure C_SessionConnectProgressCallback)
genClosure_SessionConnectProgressCallback :: forall (m :: * -> *).
MonadIO m =>
SessionConnectProgressCallback
-> m (GClosure C_SessionConnectProgressCallback)
genClosure_SessionConnectProgressCallback SessionConnectProgressCallback
cb = IO (GClosure C_SessionConnectProgressCallback)
-> m (GClosure C_SessionConnectProgressCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SessionConnectProgressCallback)
 -> m (GClosure C_SessionConnectProgressCallback))
-> IO (GClosure C_SessionConnectProgressCallback)
-> m (GClosure C_SessionConnectProgressCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SessionConnectProgressCallback_WithClosures
cb' = SessionConnectProgressCallback
-> SessionConnectProgressCallback_WithClosures
drop_closures_SessionConnectProgressCallback SessionConnectProgressCallback
cb
    let cb'' :: C_SessionConnectProgressCallback
cb'' = Maybe (Ptr (FunPtr C_SessionConnectProgressCallback))
-> SessionConnectProgressCallback_WithClosures
-> C_SessionConnectProgressCallback
wrap_SessionConnectProgressCallback Maybe (Ptr (FunPtr C_SessionConnectProgressCallback))
forall a. Maybe a
Nothing SessionConnectProgressCallback_WithClosures
cb'
    C_SessionConnectProgressCallback
-> IO (FunPtr C_SessionConnectProgressCallback)
mk_SessionConnectProgressCallback C_SessionConnectProgressCallback
cb'' IO (FunPtr C_SessionConnectProgressCallback)
-> (FunPtr C_SessionConnectProgressCallback
    -> IO (GClosure C_SessionConnectProgressCallback))
-> IO (GClosure C_SessionConnectProgressCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SessionConnectProgressCallback
-> IO (GClosure C_SessionConnectProgressCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SessionConnectProgressCallback` into a `C_SessionConnectProgressCallback`.
wrap_SessionConnectProgressCallback ::
    Maybe (Ptr (FunPtr C_SessionConnectProgressCallback)) ->
    SessionConnectProgressCallback_WithClosures ->
    C_SessionConnectProgressCallback
wrap_SessionConnectProgressCallback :: Maybe (Ptr (FunPtr C_SessionConnectProgressCallback))
-> SessionConnectProgressCallback_WithClosures
-> C_SessionConnectProgressCallback
wrap_SessionConnectProgressCallback Maybe (Ptr (FunPtr C_SessionConnectProgressCallback))
funptrptr SessionConnectProgressCallback_WithClosures
_cb Ptr Session
session CUInt
event Ptr IOStream
connection Ptr ()
userData = do
    Session
session' <- ((ManagedPtr Session -> Session) -> Ptr Session -> IO Session
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Session -> Session
Soup.Session.Session) Ptr Session
session
    let event' :: SocketClientEvent
event' = (Int -> SocketClientEvent
forall a. Enum a => Int -> a
toEnum (Int -> SocketClientEvent)
-> (CUInt -> Int) -> CUInt -> SocketClientEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
event
    IOStream
connection' <- ((ManagedPtr IOStream -> IOStream) -> Ptr IOStream -> IO IOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr IOStream -> IOStream
Gio.IOStream.IOStream) Ptr IOStream
connection
    SessionConnectProgressCallback_WithClosures
_cb  Session
session' SocketClientEvent
event' IOStream
connection' Ptr ()
userData
    Maybe (Ptr (FunPtr C_SessionConnectProgressCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SessionConnectProgressCallback))
funptrptr


-- callback SessionCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "session"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Session" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the session" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the message that has finished"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the data passed to soup_session_queue_message"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype for the callback passed to soup_session_queue_message(),\nqv."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SessionCallback =
    Ptr Soup.Session.Session ->
    Ptr Soup.Message.Message ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "session"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Session" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the message that has finished"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data passed to soup_session_queue_message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SessionCallback :: FunPtr C_SessionCallback -> C_SessionCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SessionCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Session.IsSession a, Soup.Message.IsMessage b) =>
    FunPtr C_SessionCallback
    -> a
    -- ^ /@session@/: the session
    -> b
    -- ^ /@msg@/: the message that has finished
    -> Ptr ()
    -- ^ /@userData@/: the data passed to soup_session_queue_message
    -> m ()
dynamic_SessionCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSession a, IsMessage b) =>
FunPtr C_SessionCallback -> a -> b -> Ptr () -> m ()
dynamic_SessionCallback FunPtr C_SessionCallback
__funPtr a
session b
msg Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Session
session' <- a -> IO (Ptr Session)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
session
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    (FunPtr C_SessionCallback -> C_SessionCallback
__dynamic_C_SessionCallback FunPtr C_SessionCallback
__funPtr) Ptr Session
session' Ptr Message
msg' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
session
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Prototype for the callback passed to 'GI.Soup.Objects.Session.sessionQueueMessage',
-- qv.
type SessionCallback =
    Soup.Session.Session
    -- ^ /@session@/: the session
    -> Soup.Message.Message
    -- ^ /@msg@/: the message that has finished
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionCallback`@.
noSessionCallback :: Maybe SessionCallback
noSessionCallback :: Maybe SessionCallback
noSessionCallback = Maybe SessionCallback
forall a. Maybe a
Nothing

-- | Prototype for the callback passed to 'GI.Soup.Objects.Session.sessionQueueMessage',
-- qv.
type SessionCallback_WithClosures =
    Soup.Session.Session
    -- ^ /@session@/: the session
    -> Soup.Message.Message
    -- ^ /@msg@/: the message that has finished
    -> Ptr ()
    -- ^ /@userData@/: the data passed to soup_session_queue_message
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SessionCallback_WithClosures`@.
noSessionCallback_WithClosures :: Maybe SessionCallback_WithClosures
noSessionCallback_WithClosures :: Maybe SessionCallback_WithClosures
noSessionCallback_WithClosures = Maybe SessionCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SessionCallback :: SessionCallback -> SessionCallback_WithClosures
drop_closures_SessionCallback :: SessionCallback -> SessionCallback_WithClosures
drop_closures_SessionCallback SessionCallback
_f Session
session Message
msg Ptr ()
_ = SessionCallback
_f Session
session Message
msg

-- | Wrap the callback into a `GClosure`.
genClosure_SessionCallback :: MonadIO m => SessionCallback -> m (GClosure C_SessionCallback)
genClosure_SessionCallback :: forall (m :: * -> *).
MonadIO m =>
SessionCallback -> m (GClosure C_SessionCallback)
genClosure_SessionCallback SessionCallback
cb = IO (GClosure C_SessionCallback) -> m (GClosure C_SessionCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SessionCallback) -> m (GClosure C_SessionCallback))
-> IO (GClosure C_SessionCallback)
-> m (GClosure C_SessionCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SessionCallback_WithClosures
cb' = SessionCallback -> SessionCallback_WithClosures
drop_closures_SessionCallback SessionCallback
cb
    let cb'' :: C_SessionCallback
cb'' = Maybe (Ptr (FunPtr C_SessionCallback))
-> SessionCallback_WithClosures -> C_SessionCallback
wrap_SessionCallback Maybe (Ptr (FunPtr C_SessionCallback))
forall a. Maybe a
Nothing SessionCallback_WithClosures
cb'
    C_SessionCallback -> IO (FunPtr C_SessionCallback)
mk_SessionCallback C_SessionCallback
cb'' IO (FunPtr C_SessionCallback)
-> (FunPtr C_SessionCallback -> IO (GClosure C_SessionCallback))
-> IO (GClosure C_SessionCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SessionCallback -> IO (GClosure C_SessionCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SessionCallback` into a `C_SessionCallback`.
wrap_SessionCallback ::
    Maybe (Ptr (FunPtr C_SessionCallback)) ->
    SessionCallback_WithClosures ->
    C_SessionCallback
wrap_SessionCallback :: Maybe (Ptr (FunPtr C_SessionCallback))
-> SessionCallback_WithClosures -> C_SessionCallback
wrap_SessionCallback Maybe (Ptr (FunPtr C_SessionCallback))
funptrptr SessionCallback_WithClosures
_cb Ptr Session
session Ptr Message
msg Ptr ()
userData = do
    Session
session' <- ((ManagedPtr Session -> Session) -> Ptr Session -> IO Session
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Session -> Session
Soup.Session.Session) Ptr Session
session
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    SessionCallback_WithClosures
_cb  Session
session' Message
msg' Ptr ()
userData
    Maybe (Ptr (FunPtr C_SessionCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SessionCallback))
funptrptr


-- callback ServerWebsocketCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "server"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Server" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupServer" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "connection"
          , argType =
              TInterface
                Name { namespace = "Soup" , name = "WebsocketConnection" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the newly created WebSocket connection"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the path component of @msg's Request-URI"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "client"
          , argType =
              TInterface Name { namespace = "Soup" , name = "ClientContext" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "additional contextual information about the client"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the data passed to @soup_server_add_handler"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A callback used to handle WebSocket requests to a #SoupServer. The\ncallback will be invoked after sending the handshake response back\nto the client (and is only invoked if the handshake was\nsuccessful).\n\n@path contains the path of the Request-URI, subject to the same\nrules as #SoupServerCallback (qv)."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ServerWebsocketCallback =
    Ptr Soup.Server.Server ->
    Ptr Soup.WebsocketConnection.WebsocketConnection ->
    CString ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connection"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "WebsocketConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the newly created WebSocket connection"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the path component of @msg's Request-URI"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "client"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ClientContext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "additional contextual information about the client"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data passed to @soup_server_add_handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ServerWebsocketCallback :: FunPtr C_ServerWebsocketCallback -> C_ServerWebsocketCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ServerWebsocketCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Server.IsServer a, Soup.WebsocketConnection.IsWebsocketConnection b) =>
    FunPtr C_ServerWebsocketCallback
    -> a
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@connection@/: the newly created WebSocket connection
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to /@soupServerAddHandler@/
    -> m ()
dynamic_ServerWebsocketCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsWebsocketConnection b) =>
FunPtr C_ServerWebsocketCallback
-> a -> b -> Text -> ClientContext -> Ptr () -> m ()
dynamic_ServerWebsocketCallback FunPtr C_ServerWebsocketCallback
__funPtr a
server b
connection Text
path ClientContext
client Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Server
server' <- a -> IO (Ptr Server)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
server
    Ptr WebsocketConnection
connection' <- b -> IO (Ptr WebsocketConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connection
    CString
path' <- Text -> IO CString
textToCString Text
path
    Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
    (FunPtr C_ServerWebsocketCallback -> C_ServerWebsocketCallback
__dynamic_C_ServerWebsocketCallback FunPtr C_ServerWebsocketCallback
__funPtr) Ptr Server
server' Ptr WebsocketConnection
connection' CString
path' Ptr ClientContext
client' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connection
    ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | A callback used to handle WebSocket requests to a t'GI.Soup.Objects.Server.Server'. The
-- callback will be invoked after sending the handshake response back
-- to the client (and is only invoked if the handshake was
-- successful).
-- 
-- /@path@/ contains the path of the Request-URI, subject to the same
-- rules as t'GI.Soup.Callbacks.ServerCallback' (qv).
type ServerWebsocketCallback =
    Soup.Server.Server
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> Soup.WebsocketConnection.WebsocketConnection
    -- ^ /@connection@/: the newly created WebSocket connection
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerWebsocketCallback`@.
noServerWebsocketCallback :: Maybe ServerWebsocketCallback
noServerWebsocketCallback :: Maybe ServerWebsocketCallback
noServerWebsocketCallback = Maybe ServerWebsocketCallback
forall a. Maybe a
Nothing

-- | A callback used to handle WebSocket requests to a t'GI.Soup.Objects.Server.Server'. The
-- callback will be invoked after sending the handshake response back
-- to the client (and is only invoked if the handshake was
-- successful).
-- 
-- /@path@/ contains the path of the Request-URI, subject to the same
-- rules as t'GI.Soup.Callbacks.ServerCallback' (qv).
type ServerWebsocketCallback_WithClosures =
    Soup.Server.Server
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> Soup.WebsocketConnection.WebsocketConnection
    -- ^ /@connection@/: the newly created WebSocket connection
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to /@soupServerAddHandler@/
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerWebsocketCallback_WithClosures`@.
noServerWebsocketCallback_WithClosures :: Maybe ServerWebsocketCallback_WithClosures
noServerWebsocketCallback_WithClosures :: Maybe ServerWebsocketCallback_WithClosures
noServerWebsocketCallback_WithClosures = Maybe ServerWebsocketCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ServerWebsocketCallback :: ServerWebsocketCallback -> ServerWebsocketCallback_WithClosures
drop_closures_ServerWebsocketCallback :: ServerWebsocketCallback -> ServerWebsocketCallback_WithClosures
drop_closures_ServerWebsocketCallback ServerWebsocketCallback
_f Server
server WebsocketConnection
connection Text
path ClientContext
client Ptr ()
_ = ServerWebsocketCallback
_f Server
server WebsocketConnection
connection Text
path ClientContext
client

-- | Wrap the callback into a `GClosure`.
genClosure_ServerWebsocketCallback :: MonadIO m => ServerWebsocketCallback -> m (GClosure C_ServerWebsocketCallback)
genClosure_ServerWebsocketCallback :: forall (m :: * -> *).
MonadIO m =>
ServerWebsocketCallback -> m (GClosure C_ServerWebsocketCallback)
genClosure_ServerWebsocketCallback ServerWebsocketCallback
cb = IO (GClosure C_ServerWebsocketCallback)
-> m (GClosure C_ServerWebsocketCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerWebsocketCallback)
 -> m (GClosure C_ServerWebsocketCallback))
-> IO (GClosure C_ServerWebsocketCallback)
-> m (GClosure C_ServerWebsocketCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ServerWebsocketCallback_WithClosures
cb' = ServerWebsocketCallback -> ServerWebsocketCallback_WithClosures
drop_closures_ServerWebsocketCallback ServerWebsocketCallback
cb
    let cb'' :: C_ServerWebsocketCallback
cb'' = Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
-> ServerWebsocketCallback_WithClosures
-> C_ServerWebsocketCallback
wrap_ServerWebsocketCallback Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
forall a. Maybe a
Nothing ServerWebsocketCallback_WithClosures
cb'
    C_ServerWebsocketCallback -> IO (FunPtr C_ServerWebsocketCallback)
mk_ServerWebsocketCallback C_ServerWebsocketCallback
cb'' IO (FunPtr C_ServerWebsocketCallback)
-> (FunPtr C_ServerWebsocketCallback
    -> IO (GClosure C_ServerWebsocketCallback))
-> IO (GClosure C_ServerWebsocketCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerWebsocketCallback
-> IO (GClosure C_ServerWebsocketCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerWebsocketCallback` into a `C_ServerWebsocketCallback`.
wrap_ServerWebsocketCallback ::
    Maybe (Ptr (FunPtr C_ServerWebsocketCallback)) ->
    ServerWebsocketCallback_WithClosures ->
    C_ServerWebsocketCallback
wrap_ServerWebsocketCallback :: Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
-> ServerWebsocketCallback_WithClosures
-> C_ServerWebsocketCallback
wrap_ServerWebsocketCallback Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
funptrptr ServerWebsocketCallback_WithClosures
_cb Ptr Server
server Ptr WebsocketConnection
connection CString
path Ptr ClientContext
client Ptr ()
userData = do
    Server
server' <- ((ManagedPtr Server -> Server) -> Ptr Server -> IO Server
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Server -> Server
Soup.Server.Server) Ptr Server
server
    WebsocketConnection
connection' <- ((ManagedPtr WebsocketConnection -> WebsocketConnection)
-> Ptr WebsocketConnection -> IO WebsocketConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr WebsocketConnection -> WebsocketConnection
Soup.WebsocketConnection.WebsocketConnection) Ptr WebsocketConnection
connection
    Text
path' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
path
    (ManagedPtr ClientContext -> ClientContext)
-> Ptr ClientContext -> (ClientContext -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr ClientContext -> ClientContext
Soup.ClientContext.ClientContext Ptr ClientContext
client ((ClientContext -> IO ()) -> IO ())
-> (ClientContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ClientContext
client' -> do
        ServerWebsocketCallback_WithClosures
_cb  Server
server' WebsocketConnection
connection' Text
path' ClientContext
client' Ptr ()
userData
        Maybe (Ptr (FunPtr C_ServerWebsocketCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
funptrptr


-- callback ServerCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "server"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Server" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupServer" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the message being processed"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the path component of @msg's Request-URI"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "query"
          , argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8)
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the parsed query\n  component of @msg's Request-URI"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "client"
          , argType =
              TInterface Name { namespace = "Soup" , name = "ClientContext" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "additional contextual information about the client"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the data passed to soup_server_add_handler() or\n  soup_server_add_early_handler()."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 5
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A callback used to handle requests to a #SoupServer.\n\n@path and @query contain the likewise-named components of the\nRequest-URI, subject to certain assumptions. By default,\n#SoupServer decodes all percent-encoding in the URI path, such that\n\"/foo%<!-- -->2Fbar\" is treated the same as \"/foo/bar\". If your\nserver is serving resources in some non-POSIX-filesystem namespace,\nyou may want to distinguish those as two distinct paths. In that\ncase, you can set the %SOUP_SERVER_RAW_PATHS property when creating\nthe #SoupServer, and it will leave those characters undecoded. (You\nmay want to call soup_uri_normalize() to decode any percent-encoded\ncharacters that you aren't handling specially.)\n\n@query contains the query component of the Request-URI parsed\naccording to the rules for HTML form handling. Although this is the\nonly commonly-used query string format in HTTP, there is nothing\nthat actually requires that HTTP URIs use that format; if your\nserver needs to use some other format, you can just ignore @query,\nand call soup_message_get_uri() and parse the URI's query field\nyourself.\n\nSee soup_server_add_handler() and soup_server_add_early_handler()\nfor details of what handlers can/should do."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ServerCallback =
    Ptr Soup.Server.Server ->
    Ptr Soup.Message.Message ->
    CString ->
    Ptr (GHashTable CString CString) ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the message being processed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the path component of @msg's Request-URI"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "query"
--           , argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the parsed query\n  component of @msg's Request-URI"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "client"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ClientContext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "additional contextual information about the client"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the data passed to soup_server_add_handler() or\n  soup_server_add_early_handler()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ServerCallback :: FunPtr C_ServerCallback -> C_ServerCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ServerCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Server.IsServer a, Soup.Message.IsMessage b) =>
    FunPtr C_ServerCallback
    -> a
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@msg@/: the message being processed
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Maybe (Map.Map T.Text T.Text)
    -- ^ /@query@/: the parsed query
    --   component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Server.serverAddHandler' or
    --   'GI.Soup.Objects.Server.serverAddEarlyHandler'.
    -> m ()
dynamic_ServerCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsMessage b) =>
FunPtr C_ServerCallback
-> a
-> b
-> Text
-> Maybe (Map Text Text)
-> ClientContext
-> Ptr ()
-> m ()
dynamic_ServerCallback FunPtr C_ServerCallback
__funPtr a
server b
msg Text
path Maybe (Map Text Text)
query ClientContext
client Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Server
server' <- a -> IO (Ptr Server)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
server
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CString
path' <- Text -> IO CString
textToCString Text
path
    Ptr (GHashTable CString CString)
maybeQuery <- case Maybe (Map Text Text)
query of
        Maybe (Map Text Text)
Nothing -> Ptr (GHashTable CString CString)
-> IO (Ptr (GHashTable CString CString))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GHashTable CString CString)
forall a. Ptr a
nullPtr
        Just Map Text Text
jQuery -> do
            let jQuery' :: [(Text, Text)]
jQuery' = Map Text Text -> [(Text, Text)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Text Text
jQuery
            [(CString, Text)]
jQuery'' <- (Text -> IO CString) -> [(Text, Text)] -> IO [(CString, Text)]
forall (f :: * -> *) a c b.
Applicative f =>
(a -> f c) -> [(a, b)] -> f [(c, b)]
mapFirstA Text -> IO CString
textToCString [(Text, Text)]
jQuery'
            [(CString, CString)]
jQuery''' <- (Text -> IO CString)
-> [(CString, Text)] -> IO [(CString, CString)]
forall (f :: * -> *) b c a.
Applicative f =>
(b -> f c) -> [(a, b)] -> f [(a, c)]
mapSecondA Text -> IO CString
textToCString [(CString, Text)]
jQuery''
            let jQuery'''' :: [(PtrWrapped CString, CString)]
jQuery'''' = (CString -> PtrWrapped CString)
-> [(CString, CString)] -> [(PtrWrapped CString, CString)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst CString -> PtrWrapped CString
cstringPackPtr [(CString, CString)]
jQuery'''
            let jQuery''''' :: [(PtrWrapped CString, PtrWrapped CString)]
jQuery''''' = (CString -> PtrWrapped CString)
-> [(PtrWrapped CString, CString)]
-> [(PtrWrapped CString, PtrWrapped CString)]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond CString -> PtrWrapped CString
cstringPackPtr [(PtrWrapped CString, CString)]
jQuery''''
            Ptr (GHashTable CString CString)
jQuery'''''' <- GHashFunc CString
-> GEqualFunc CString
-> Maybe (GDestroyNotify CString)
-> Maybe (GDestroyNotify CString)
-> [(PtrWrapped CString, PtrWrapped CString)]
-> IO (Ptr (GHashTable CString CString))
forall a b.
GHashFunc a
-> GEqualFunc a
-> Maybe (GDestroyNotify a)
-> Maybe (GDestroyNotify b)
-> [(PtrWrapped a, PtrWrapped b)]
-> IO (Ptr (GHashTable a b))
packGHashTable GHashFunc CString
gStrHash GEqualFunc CString
gStrEqual (GDestroyNotify CString -> Maybe (GDestroyNotify CString)
forall a. a -> Maybe a
Just GDestroyNotify CString
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free) (GDestroyNotify CString -> Maybe (GDestroyNotify CString)
forall a. a -> Maybe a
Just GDestroyNotify CString
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free) [(PtrWrapped CString, PtrWrapped CString)]
jQuery'''''
            Ptr (GHashTable CString CString)
-> IO (Ptr (GHashTable CString CString))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GHashTable CString CString)
jQuery''''''
    Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
    (FunPtr C_ServerCallback -> C_ServerCallback
__dynamic_C_ServerCallback FunPtr C_ServerCallback
__funPtr) Ptr Server
server' Ptr Message
msg' CString
path' Ptr (GHashTable CString CString)
maybeQuery Ptr ClientContext
client' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    Ptr (GHashTable CString CString) -> IO ()
forall a b. Ptr (GHashTable a b) -> IO ()
unrefGHashTable Ptr (GHashTable CString CString)
maybeQuery
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | A callback used to handle requests to a t'GI.Soup.Objects.Server.Server'.
-- 
-- /@path@/ and /@query@/ contain the likewise-named components of the
-- Request-URI, subject to certain assumptions. By default,
-- t'GI.Soup.Objects.Server.Server' decodes all percent-encoding in the URI path, such that
-- \"\/foo%\<!-- -->2Fbar\" is treated the same as \"\/foo\/bar\". If your
-- server is serving resources in some non-POSIX-filesystem namespace,
-- you may want to distinguish those as two distinct paths. In that
-- case, you can set the 'GI.Soup.Constants.SERVER_RAW_PATHS' property when creating
-- the t'GI.Soup.Objects.Server.Server', and it will leave those characters undecoded. (You
-- may want to call 'GI.Soup.Functions.uriNormalize' to decode any percent-encoded
-- characters that you aren\'t handling specially.)
-- 
-- /@query@/ contains the query component of the Request-URI parsed
-- according to the rules for HTML form handling. Although this is the
-- only commonly-used query string format in HTTP, there is nothing
-- that actually requires that HTTP URIs use that format; if your
-- server needs to use some other format, you can just ignore /@query@/,
-- and call 'GI.Soup.Objects.Message.messageGetUri' and parse the URI\'s query field
-- yourself.
-- 
-- See 'GI.Soup.Objects.Server.serverAddHandler' and 'GI.Soup.Objects.Server.serverAddEarlyHandler'
-- for details of what handlers can\/should do.
type ServerCallback =
    Soup.Server.Server
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being processed
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Maybe (Map.Map T.Text T.Text)
    -- ^ /@query@/: the parsed query
    --   component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerCallback`@.
noServerCallback :: Maybe ServerCallback
noServerCallback :: Maybe ServerCallback
noServerCallback = Maybe ServerCallback
forall a. Maybe a
Nothing

-- | A callback used to handle requests to a t'GI.Soup.Objects.Server.Server'.
-- 
-- /@path@/ and /@query@/ contain the likewise-named components of the
-- Request-URI, subject to certain assumptions. By default,
-- t'GI.Soup.Objects.Server.Server' decodes all percent-encoding in the URI path, such that
-- \"\/foo%\<!-- -->2Fbar\" is treated the same as \"\/foo\/bar\". If your
-- server is serving resources in some non-POSIX-filesystem namespace,
-- you may want to distinguish those as two distinct paths. In that
-- case, you can set the 'GI.Soup.Constants.SERVER_RAW_PATHS' property when creating
-- the t'GI.Soup.Objects.Server.Server', and it will leave those characters undecoded. (You
-- may want to call 'GI.Soup.Functions.uriNormalize' to decode any percent-encoded
-- characters that you aren\'t handling specially.)
-- 
-- /@query@/ contains the query component of the Request-URI parsed
-- according to the rules for HTML form handling. Although this is the
-- only commonly-used query string format in HTTP, there is nothing
-- that actually requires that HTTP URIs use that format; if your
-- server needs to use some other format, you can just ignore /@query@/,
-- and call 'GI.Soup.Objects.Message.messageGetUri' and parse the URI\'s query field
-- yourself.
-- 
-- See 'GI.Soup.Objects.Server.serverAddHandler' and 'GI.Soup.Objects.Server.serverAddEarlyHandler'
-- for details of what handlers can\/should do.
type ServerCallback_WithClosures =
    Soup.Server.Server
    -- ^ /@server@/: the t'GI.Soup.Objects.Server.Server'
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being processed
    -> T.Text
    -- ^ /@path@/: the path component of /@msg@/\'s Request-URI
    -> Maybe (Map.Map T.Text T.Text)
    -- ^ /@query@/: the parsed query
    --   component of /@msg@/\'s Request-URI
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: additional contextual information about the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Server.serverAddHandler' or
    --   'GI.Soup.Objects.Server.serverAddEarlyHandler'.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerCallback_WithClosures`@.
noServerCallback_WithClosures :: Maybe ServerCallback_WithClosures
noServerCallback_WithClosures :: Maybe ServerCallback_WithClosures
noServerCallback_WithClosures = Maybe ServerCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ServerCallback :: ServerCallback -> ServerCallback_WithClosures
drop_closures_ServerCallback :: ServerCallback -> ServerCallback_WithClosures
drop_closures_ServerCallback ServerCallback
_f Server
server Message
msg Text
path Maybe (Map Text Text)
query ClientContext
client Ptr ()
_ = ServerCallback
_f Server
server Message
msg Text
path Maybe (Map Text Text)
query ClientContext
client

-- | Wrap the callback into a `GClosure`.
genClosure_ServerCallback :: MonadIO m => ServerCallback -> m (GClosure C_ServerCallback)
genClosure_ServerCallback :: forall (m :: * -> *).
MonadIO m =>
ServerCallback -> m (GClosure C_ServerCallback)
genClosure_ServerCallback ServerCallback
cb = IO (GClosure C_ServerCallback) -> m (GClosure C_ServerCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerCallback) -> m (GClosure C_ServerCallback))
-> IO (GClosure C_ServerCallback) -> m (GClosure C_ServerCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ServerCallback_WithClosures
cb' = ServerCallback -> ServerCallback_WithClosures
drop_closures_ServerCallback ServerCallback
cb
    let cb'' :: C_ServerCallback
cb'' = Maybe (Ptr (FunPtr C_ServerCallback))
-> ServerCallback_WithClosures -> C_ServerCallback
wrap_ServerCallback Maybe (Ptr (FunPtr C_ServerCallback))
forall a. Maybe a
Nothing ServerCallback_WithClosures
cb'
    C_ServerCallback -> IO (FunPtr C_ServerCallback)
mk_ServerCallback C_ServerCallback
cb'' IO (FunPtr C_ServerCallback)
-> (FunPtr C_ServerCallback -> IO (GClosure C_ServerCallback))
-> IO (GClosure C_ServerCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerCallback -> IO (GClosure C_ServerCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerCallback` into a `C_ServerCallback`.
wrap_ServerCallback ::
    Maybe (Ptr (FunPtr C_ServerCallback)) ->
    ServerCallback_WithClosures ->
    C_ServerCallback
wrap_ServerCallback :: Maybe (Ptr (FunPtr C_ServerCallback))
-> ServerCallback_WithClosures -> C_ServerCallback
wrap_ServerCallback Maybe (Ptr (FunPtr C_ServerCallback))
funptrptr ServerCallback_WithClosures
_cb Ptr Server
server Ptr Message
msg CString
path Ptr (GHashTable CString CString)
query Ptr ClientContext
client Ptr ()
userData = do
    Server
server' <- ((ManagedPtr Server -> Server) -> Ptr Server -> IO Server
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Server -> Server
Soup.Server.Server) Ptr Server
server
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Text
path' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
path
    Maybe (Map Text Text)
maybeQuery <-
        if Ptr (GHashTable CString CString)
query Ptr (GHashTable CString CString)
-> Ptr (GHashTable CString CString) -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr (GHashTable CString CString)
forall a. Ptr a
nullPtr
        then Maybe (Map Text Text) -> IO (Maybe (Map Text Text))
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (Map Text Text)
forall a. Maybe a
Nothing
        else do
            [(PtrWrapped CString, PtrWrapped CString)]
query' <- Ptr (GHashTable CString CString)
-> IO [(PtrWrapped CString, PtrWrapped CString)]
forall a b.
Ptr (GHashTable a b) -> IO [(PtrWrapped a, PtrWrapped b)]
unpackGHashTable Ptr (GHashTable CString CString)
query
            let query'' :: [(CString, PtrWrapped CString)]
query'' = (PtrWrapped CString -> CString)
-> [(PtrWrapped CString, PtrWrapped CString)]
-> [(CString, PtrWrapped CString)]
forall a c b. (a -> c) -> [(a, b)] -> [(c, b)]
mapFirst PtrWrapped CString -> CString
cstringUnpackPtr [(PtrWrapped CString, PtrWrapped CString)]
query'
            [(Text, PtrWrapped CString)]
query''' <- (CString -> IO Text)
-> [(CString, PtrWrapped CString)]
-> IO [(Text, PtrWrapped CString)]
forall (f :: * -> *) a c b.
Applicative f =>
(a -> f c) -> [(a, b)] -> f [(c, b)]
mapFirstA HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [(CString, PtrWrapped CString)]
query''
            let query'''' :: [(Text, CString)]
query'''' = (PtrWrapped CString -> CString)
-> [(Text, PtrWrapped CString)] -> [(Text, CString)]
forall b c a. (b -> c) -> [(a, b)] -> [(a, c)]
mapSecond PtrWrapped CString -> CString
cstringUnpackPtr [(Text, PtrWrapped CString)]
query'''
            [(Text, Text)]
query''''' <- (CString -> IO Text) -> [(Text, CString)] -> IO [(Text, Text)]
forall (f :: * -> *) b c a.
Applicative f =>
(b -> f c) -> [(a, b)] -> f [(a, c)]
mapSecondA HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [(Text, CString)]
query''''
            let query'''''' :: Map Text Text
query'''''' = [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Text, Text)]
query'''''
            Maybe (Map Text Text) -> IO (Maybe (Map Text Text))
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe (Map Text Text) -> IO (Maybe (Map Text Text)))
-> Maybe (Map Text Text) -> IO (Maybe (Map Text Text))
forall a b. (a -> b) -> a -> b
$ Map Text Text -> Maybe (Map Text Text)
forall a. a -> Maybe a
Just Map Text Text
query''''''
    (ManagedPtr ClientContext -> ClientContext)
-> Ptr ClientContext -> (ClientContext -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr ClientContext -> ClientContext
Soup.ClientContext.ClientContext Ptr ClientContext
client ((ClientContext -> IO ()) -> IO ())
-> (ClientContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ClientContext
client' -> do
        ServerCallback_WithClosures
_cb  Server
server' Message
msg' Text
path' Maybe (Map Text Text)
maybeQuery ClientContext
client' Ptr ()
userData
        Maybe (Ptr (FunPtr C_ServerCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ServerCallback))
funptrptr


-- callback ProxyURIResolverCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "resolver"
          , argType =
              TInterface Name { namespace = "Soup" , name = "ProxyURIResolver" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupProxyURIResolver"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "status"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #SoupStatus" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "proxy_uri"
          , argType = TInterface Name { namespace = "Soup" , name = "URI" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the resolved proxy URI, or %NULL"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "data passed to soup_proxy_uri_resolver_get_proxy_uri_async()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "Callback for soup_proxy_uri_resolver_get_proxy_uri_async()"
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ProxyURIResolverCallback =
    Ptr Soup.ProxyURIResolver.ProxyURIResolver ->
    Word32 ->
    Ptr Soup.URI.URI ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "resolver"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ProxyURIResolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupProxyURIResolver"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "status"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupStatus" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "proxy_uri"
--           , argType = TInterface Name { namespace = "Soup" , name = "URI" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the resolved proxy URI, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "data passed to soup_proxy_uri_resolver_get_proxy_uri_async()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ProxyURIResolverCallback :: FunPtr C_ProxyURIResolverCallback -> C_ProxyURIResolverCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ProxyURIResolverCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.ProxyURIResolver.IsProxyURIResolver a) =>
    FunPtr C_ProxyURIResolverCallback
    -> a
    -- ^ /@resolver@/: the t'GI.Soup.Interfaces.ProxyURIResolver.ProxyURIResolver'
    -> Word32
    -- ^ /@status@/: a t'GI.Soup.Enums.Status'
    -> Soup.URI.URI
    -- ^ /@proxyUri@/: the resolved proxy URI, or 'P.Nothing'
    -> Ptr ()
    -- ^ /@userData@/: data passed to 'GI.Soup.Interfaces.ProxyURIResolver.proxyURIResolverGetProxyUriAsync'
    -> m ()
dynamic_ProxyURIResolverCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsProxyURIResolver a) =>
FunPtr C_ProxyURIResolverCallback
-> a -> Word32 -> URI -> Ptr () -> m ()
dynamic_ProxyURIResolverCallback FunPtr C_ProxyURIResolverCallback
__funPtr a
resolver Word32
status URI
proxyUri Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr ProxyURIResolver
resolver' <- a -> IO (Ptr ProxyURIResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
resolver
    Ptr URI
proxyUri' <- URI -> IO (Ptr URI)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr URI
proxyUri
    (FunPtr C_ProxyURIResolverCallback -> C_ProxyURIResolverCallback
__dynamic_C_ProxyURIResolverCallback FunPtr C_ProxyURIResolverCallback
__funPtr) Ptr ProxyURIResolver
resolver' Word32
status Ptr URI
proxyUri' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
resolver
    URI -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr URI
proxyUri
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | Callback for 'GI.Soup.Interfaces.ProxyURIResolver.proxyURIResolverGetProxyUriAsync'
type ProxyURIResolverCallback =
    Soup.ProxyURIResolver.ProxyURIResolver
    -- ^ /@resolver@/: the t'GI.Soup.Interfaces.ProxyURIResolver.ProxyURIResolver'
    -> Word32
    -- ^ /@status@/: a t'GI.Soup.Enums.Status'
    -> Soup.URI.URI
    -- ^ /@proxyUri@/: the resolved proxy URI, or 'P.Nothing'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ProxyURIResolverCallback`@.
noProxyURIResolverCallback :: Maybe ProxyURIResolverCallback
noProxyURIResolverCallback :: Maybe ProxyURIResolverCallback
noProxyURIResolverCallback = Maybe ProxyURIResolverCallback
forall a. Maybe a
Nothing

-- | Callback for 'GI.Soup.Interfaces.ProxyURIResolver.proxyURIResolverGetProxyUriAsync'
type ProxyURIResolverCallback_WithClosures =
    Soup.ProxyURIResolver.ProxyURIResolver
    -- ^ /@resolver@/: the t'GI.Soup.Interfaces.ProxyURIResolver.ProxyURIResolver'
    -> Word32
    -- ^ /@status@/: a t'GI.Soup.Enums.Status'
    -> Soup.URI.URI
    -- ^ /@proxyUri@/: the resolved proxy URI, or 'P.Nothing'
    -> Ptr ()
    -- ^ /@userData@/: data passed to 'GI.Soup.Interfaces.ProxyURIResolver.proxyURIResolverGetProxyUriAsync'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ProxyURIResolverCallback_WithClosures`@.
noProxyURIResolverCallback_WithClosures :: Maybe ProxyURIResolverCallback_WithClosures
noProxyURIResolverCallback_WithClosures :: Maybe ProxyURIResolverCallback_WithClosures
noProxyURIResolverCallback_WithClosures = Maybe ProxyURIResolverCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ProxyURIResolverCallback :: ProxyURIResolverCallback -> ProxyURIResolverCallback_WithClosures
drop_closures_ProxyURIResolverCallback :: ProxyURIResolverCallback -> ProxyURIResolverCallback_WithClosures
drop_closures_ProxyURIResolverCallback ProxyURIResolverCallback
_f ProxyURIResolver
resolver Word32
status URI
proxyUri Ptr ()
_ = ProxyURIResolverCallback
_f ProxyURIResolver
resolver Word32
status URI
proxyUri

-- | Wrap the callback into a `GClosure`.
genClosure_ProxyURIResolverCallback :: MonadIO m => ProxyURIResolverCallback -> m (GClosure C_ProxyURIResolverCallback)
genClosure_ProxyURIResolverCallback :: forall (m :: * -> *).
MonadIO m =>
ProxyURIResolverCallback -> m (GClosure C_ProxyURIResolverCallback)
genClosure_ProxyURIResolverCallback ProxyURIResolverCallback
cb = IO (GClosure C_ProxyURIResolverCallback)
-> m (GClosure C_ProxyURIResolverCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ProxyURIResolverCallback)
 -> m (GClosure C_ProxyURIResolverCallback))
-> IO (GClosure C_ProxyURIResolverCallback)
-> m (GClosure C_ProxyURIResolverCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ProxyURIResolverCallback_WithClosures
cb' = ProxyURIResolverCallback -> ProxyURIResolverCallback_WithClosures
drop_closures_ProxyURIResolverCallback ProxyURIResolverCallback
cb
    let cb'' :: C_ProxyURIResolverCallback
cb'' = Maybe (Ptr (FunPtr C_ProxyURIResolverCallback))
-> ProxyURIResolverCallback_WithClosures
-> C_ProxyURIResolverCallback
wrap_ProxyURIResolverCallback Maybe (Ptr (FunPtr C_ProxyURIResolverCallback))
forall a. Maybe a
Nothing ProxyURIResolverCallback_WithClosures
cb'
    C_ProxyURIResolverCallback
-> IO (FunPtr C_ProxyURIResolverCallback)
mk_ProxyURIResolverCallback C_ProxyURIResolverCallback
cb'' IO (FunPtr C_ProxyURIResolverCallback)
-> (FunPtr C_ProxyURIResolverCallback
    -> IO (GClosure C_ProxyURIResolverCallback))
-> IO (GClosure C_ProxyURIResolverCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ProxyURIResolverCallback
-> IO (GClosure C_ProxyURIResolverCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ProxyURIResolverCallback` into a `C_ProxyURIResolverCallback`.
wrap_ProxyURIResolverCallback ::
    Maybe (Ptr (FunPtr C_ProxyURIResolverCallback)) ->
    ProxyURIResolverCallback_WithClosures ->
    C_ProxyURIResolverCallback
wrap_ProxyURIResolverCallback :: Maybe (Ptr (FunPtr C_ProxyURIResolverCallback))
-> ProxyURIResolverCallback_WithClosures
-> C_ProxyURIResolverCallback
wrap_ProxyURIResolverCallback Maybe (Ptr (FunPtr C_ProxyURIResolverCallback))
funptrptr ProxyURIResolverCallback_WithClosures
_cb Ptr ProxyURIResolver
resolver Word32
status Ptr URI
proxyUri Ptr ()
userData = do
    ProxyURIResolver
resolver' <- ((ManagedPtr ProxyURIResolver -> ProxyURIResolver)
-> Ptr ProxyURIResolver -> IO ProxyURIResolver
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ProxyURIResolver -> ProxyURIResolver
Soup.ProxyURIResolver.ProxyURIResolver) Ptr ProxyURIResolver
resolver
    (ManagedPtr URI -> URI) -> Ptr URI -> (URI -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr URI -> URI
Soup.URI.URI Ptr URI
proxyUri ((URI -> IO ()) -> IO ()) -> (URI -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \URI
proxyUri' -> do
        ProxyURIResolverCallback_WithClosures
_cb  ProxyURIResolver
resolver' Word32
status URI
proxyUri' Ptr ()
userData
        Maybe (Ptr (FunPtr C_ProxyURIResolverCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ProxyURIResolverCallback))
funptrptr


-- callback ProxyResolverCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "proxy_resolver"
          , argType =
              TInterface Name { namespace = "Soup" , name = "ProxyResolver" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "arg"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "addr"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Address" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated =
      Just
        DeprecationInfo
          { deprecatedSinceVersion = Just "2.28"
          , deprecationMessage = Just "Use SoupProxyURIResolver instead"
          }
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ProxyResolverCallback =
    Ptr Soup.ProxyResolver.ProxyResolver ->
    Ptr Soup.Message.Message ->
    Word32 ->
    Ptr Soup.Address.Address ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "proxy_resolver"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ProxyResolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "arg"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "addr"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Address" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ProxyResolverCallback :: FunPtr C_ProxyResolverCallback -> C_ProxyResolverCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ProxyResolverCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.ProxyResolver.IsProxyResolver a, Soup.Message.IsMessage b, Soup.Address.IsAddress c) =>
    FunPtr C_ProxyResolverCallback
    -> a
    -> b
    -> Word32
    -> c
    -> Ptr ()
    -> m ()
dynamic_ProxyResolverCallback :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsProxyResolver a, IsMessage b,
 IsAddress c) =>
FunPtr C_ProxyResolverCallback
-> a -> b -> Word32 -> c -> Ptr () -> m ()
dynamic_ProxyResolverCallback FunPtr C_ProxyResolverCallback
__funPtr a
proxyResolver b
msg Word32
arg c
addr Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr ProxyResolver
proxyResolver' <- a -> IO (Ptr ProxyResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
proxyResolver
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    Ptr Address
addr' <- c -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
addr
    (FunPtr C_ProxyResolverCallback -> C_ProxyResolverCallback
__dynamic_C_ProxyResolverCallback FunPtr C_ProxyResolverCallback
__funPtr) Ptr ProxyResolver
proxyResolver' Ptr Message
msg' Word32
arg Ptr Address
addr' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
proxyResolver
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr c
addr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

{-# DEPRECATED ProxyResolverCallback ["(Since version 2.28)","Use SoupProxyURIResolver instead"] #-}
-- | /No description available in the introspection data./
type ProxyResolverCallback =
    Soup.ProxyResolver.ProxyResolver
    -> Soup.Message.Message
    -> Word32
    -> Soup.Address.Address
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ProxyResolverCallback`@.
noProxyResolverCallback :: Maybe ProxyResolverCallback
noProxyResolverCallback :: Maybe ProxyResolverCallback
noProxyResolverCallback = Maybe ProxyResolverCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type ProxyResolverCallback_WithClosures =
    Soup.ProxyResolver.ProxyResolver
    -> Soup.Message.Message
    -> Word32
    -> Soup.Address.Address
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ProxyResolverCallback_WithClosures`@.
noProxyResolverCallback_WithClosures :: Maybe ProxyResolverCallback_WithClosures
noProxyResolverCallback_WithClosures :: Maybe ProxyResolverCallback_WithClosures
noProxyResolverCallback_WithClosures = Maybe ProxyResolverCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ProxyResolverCallback :: ProxyResolverCallback -> ProxyResolverCallback_WithClosures
drop_closures_ProxyResolverCallback :: ProxyResolverCallback -> ProxyResolverCallback_WithClosures
drop_closures_ProxyResolverCallback ProxyResolverCallback
_f ProxyResolver
proxyResolver Message
msg Word32
arg Address
addr Ptr ()
_ = ProxyResolverCallback
_f ProxyResolver
proxyResolver Message
msg Word32
arg Address
addr

-- | Wrap the callback into a `GClosure`.
genClosure_ProxyResolverCallback :: MonadIO m => ProxyResolverCallback -> m (GClosure C_ProxyResolverCallback)
genClosure_ProxyResolverCallback :: forall (m :: * -> *).
MonadIO m =>
ProxyResolverCallback -> m (GClosure C_ProxyResolverCallback)
genClosure_ProxyResolverCallback ProxyResolverCallback
cb = IO (GClosure C_ProxyResolverCallback)
-> m (GClosure C_ProxyResolverCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ProxyResolverCallback)
 -> m (GClosure C_ProxyResolverCallback))
-> IO (GClosure C_ProxyResolverCallback)
-> m (GClosure C_ProxyResolverCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ProxyResolverCallback_WithClosures
cb' = ProxyResolverCallback -> ProxyResolverCallback_WithClosures
drop_closures_ProxyResolverCallback ProxyResolverCallback
cb
    let cb'' :: C_ProxyResolverCallback
cb'' = Maybe (Ptr (FunPtr C_ProxyResolverCallback))
-> ProxyResolverCallback_WithClosures -> C_ProxyResolverCallback
wrap_ProxyResolverCallback Maybe (Ptr (FunPtr C_ProxyResolverCallback))
forall a. Maybe a
Nothing ProxyResolverCallback_WithClosures
cb'
    C_ProxyResolverCallback -> IO (FunPtr C_ProxyResolverCallback)
mk_ProxyResolverCallback C_ProxyResolverCallback
cb'' IO (FunPtr C_ProxyResolverCallback)
-> (FunPtr C_ProxyResolverCallback
    -> IO (GClosure C_ProxyResolverCallback))
-> IO (GClosure C_ProxyResolverCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ProxyResolverCallback
-> IO (GClosure C_ProxyResolverCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ProxyResolverCallback` into a `C_ProxyResolverCallback`.
wrap_ProxyResolverCallback ::
    Maybe (Ptr (FunPtr C_ProxyResolverCallback)) ->
    ProxyResolverCallback_WithClosures ->
    C_ProxyResolverCallback
wrap_ProxyResolverCallback :: Maybe (Ptr (FunPtr C_ProxyResolverCallback))
-> ProxyResolverCallback_WithClosures -> C_ProxyResolverCallback
wrap_ProxyResolverCallback Maybe (Ptr (FunPtr C_ProxyResolverCallback))
funptrptr ProxyResolverCallback_WithClosures
_cb Ptr ProxyResolver
proxyResolver Ptr Message
msg Word32
arg Ptr Address
addr Ptr ()
userData = do
    ProxyResolver
proxyResolver' <- ((ManagedPtr ProxyResolver -> ProxyResolver)
-> Ptr ProxyResolver -> IO ProxyResolver
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ProxyResolver -> ProxyResolver
Soup.ProxyResolver.ProxyResolver) Ptr ProxyResolver
proxyResolver
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Address
addr' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Address -> Address
Soup.Address.Address) Ptr Address
addr
    ProxyResolverCallback_WithClosures
_cb  ProxyResolver
proxyResolver' Message
msg' Word32
arg Address
addr' Ptr ()
userData
    Maybe (Ptr (FunPtr C_ProxyResolverCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ProxyResolverCallback))
funptrptr


-- callback PasswordManagerCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "password_manager"
          , argType =
              TInterface Name { namespace = "Soup" , name = "PasswordManager" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "auth"
          , argType = TInterface Name { namespace = "Soup" , name = "Auth" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "retrying"
          , argType = TBasicType TBoolean
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PasswordManagerCallback =
    Ptr Soup.PasswordManager.PasswordManager ->
    Ptr Soup.Message.Message ->
    Ptr Soup.Auth.Auth ->
    CInt ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "password_manager"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "PasswordManager" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "auth"
--           , argType = TInterface Name { namespace = "Soup" , name = "Auth" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "retrying"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PasswordManagerCallback :: FunPtr C_PasswordManagerCallback -> C_PasswordManagerCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PasswordManagerCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.PasswordManager.IsPasswordManager a, Soup.Message.IsMessage b, Soup.Auth.IsAuth c) =>
    FunPtr C_PasswordManagerCallback
    -> a
    -> b
    -> c
    -> Bool
    -> Ptr ()
    -> m ()
dynamic_PasswordManagerCallback :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsPasswordManager a, IsMessage b,
 IsAuth c) =>
FunPtr C_PasswordManagerCallback
-> a -> b -> c -> Bool -> Ptr () -> m ()
dynamic_PasswordManagerCallback FunPtr C_PasswordManagerCallback
__funPtr a
passwordManager b
msg c
auth Bool
retrying Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr PasswordManager
passwordManager' <- a -> IO (Ptr PasswordManager)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
passwordManager
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    Ptr Auth
auth' <- c -> IO (Ptr Auth)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
auth
    let retrying' :: CInt
retrying' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
retrying
    (FunPtr C_PasswordManagerCallback -> C_PasswordManagerCallback
__dynamic_C_PasswordManagerCallback FunPtr C_PasswordManagerCallback
__funPtr) Ptr PasswordManager
passwordManager' Ptr Message
msg' Ptr Auth
auth' CInt
retrying' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
passwordManager
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr c
auth
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | /No description available in the introspection data./
type PasswordManagerCallback =
    Soup.PasswordManager.PasswordManager
    -> Soup.Message.Message
    -> Soup.Auth.Auth
    -> Bool
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PasswordManagerCallback`@.
noPasswordManagerCallback :: Maybe PasswordManagerCallback
noPasswordManagerCallback :: Maybe PasswordManagerCallback
noPasswordManagerCallback = Maybe PasswordManagerCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type PasswordManagerCallback_WithClosures =
    Soup.PasswordManager.PasswordManager
    -> Soup.Message.Message
    -> Soup.Auth.Auth
    -> Bool
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PasswordManagerCallback_WithClosures`@.
noPasswordManagerCallback_WithClosures :: Maybe PasswordManagerCallback_WithClosures
noPasswordManagerCallback_WithClosures :: Maybe PasswordManagerCallback_WithClosures
noPasswordManagerCallback_WithClosures = Maybe PasswordManagerCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PasswordManagerCallback :: PasswordManagerCallback -> PasswordManagerCallback_WithClosures
drop_closures_PasswordManagerCallback :: PasswordManagerCallback -> PasswordManagerCallback_WithClosures
drop_closures_PasswordManagerCallback PasswordManagerCallback
_f PasswordManager
passwordManager Message
msg Auth
auth Bool
retrying Ptr ()
_ = PasswordManagerCallback
_f PasswordManager
passwordManager Message
msg Auth
auth Bool
retrying

-- | Wrap the callback into a `GClosure`.
genClosure_PasswordManagerCallback :: MonadIO m => PasswordManagerCallback -> m (GClosure C_PasswordManagerCallback)
genClosure_PasswordManagerCallback :: forall (m :: * -> *).
MonadIO m =>
PasswordManagerCallback -> m (GClosure C_PasswordManagerCallback)
genClosure_PasswordManagerCallback PasswordManagerCallback
cb = IO (GClosure C_PasswordManagerCallback)
-> m (GClosure C_PasswordManagerCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PasswordManagerCallback)
 -> m (GClosure C_PasswordManagerCallback))
-> IO (GClosure C_PasswordManagerCallback)
-> m (GClosure C_PasswordManagerCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PasswordManagerCallback_WithClosures
cb' = PasswordManagerCallback -> PasswordManagerCallback_WithClosures
drop_closures_PasswordManagerCallback PasswordManagerCallback
cb
    let cb'' :: C_PasswordManagerCallback
cb'' = Maybe (Ptr (FunPtr C_PasswordManagerCallback))
-> PasswordManagerCallback_WithClosures
-> C_PasswordManagerCallback
wrap_PasswordManagerCallback Maybe (Ptr (FunPtr C_PasswordManagerCallback))
forall a. Maybe a
Nothing PasswordManagerCallback_WithClosures
cb'
    C_PasswordManagerCallback -> IO (FunPtr C_PasswordManagerCallback)
mk_PasswordManagerCallback C_PasswordManagerCallback
cb'' IO (FunPtr C_PasswordManagerCallback)
-> (FunPtr C_PasswordManagerCallback
    -> IO (GClosure C_PasswordManagerCallback))
-> IO (GClosure C_PasswordManagerCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PasswordManagerCallback
-> IO (GClosure C_PasswordManagerCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PasswordManagerCallback` into a `C_PasswordManagerCallback`.
wrap_PasswordManagerCallback ::
    Maybe (Ptr (FunPtr C_PasswordManagerCallback)) ->
    PasswordManagerCallback_WithClosures ->
    C_PasswordManagerCallback
wrap_PasswordManagerCallback :: Maybe (Ptr (FunPtr C_PasswordManagerCallback))
-> PasswordManagerCallback_WithClosures
-> C_PasswordManagerCallback
wrap_PasswordManagerCallback Maybe (Ptr (FunPtr C_PasswordManagerCallback))
funptrptr PasswordManagerCallback_WithClosures
_cb Ptr PasswordManager
passwordManager Ptr Message
msg Ptr Auth
auth CInt
retrying Ptr ()
userData = do
    PasswordManager
passwordManager' <- ((ManagedPtr PasswordManager -> PasswordManager)
-> Ptr PasswordManager -> IO PasswordManager
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr PasswordManager -> PasswordManager
Soup.PasswordManager.PasswordManager) Ptr PasswordManager
passwordManager
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Auth
auth' <- ((ManagedPtr Auth -> Auth) -> Ptr Auth -> IO Auth
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Auth -> Auth
Soup.Auth.Auth) Ptr Auth
auth
    let retrying' :: Bool
retrying' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
retrying
    PasswordManagerCallback_WithClosures
_cb  PasswordManager
passwordManager' Message
msg' Auth
auth' Bool
retrying' Ptr ()
userData
    Maybe (Ptr (FunPtr C_PasswordManagerCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PasswordManagerCallback))
funptrptr


-- callback MessageHeadersForeachFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the header name" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the header value" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the data passed to soup_message_headers_foreach()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "The callback passed to soup_message_headers_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_MessageHeadersForeachFunc =
    CString ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the header name" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the header value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the data passed to soup_message_headers_foreach()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_MessageHeadersForeachFunc :: FunPtr C_MessageHeadersForeachFunc -> C_MessageHeadersForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_MessageHeadersForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_MessageHeadersForeachFunc
    -> T.Text
    -- ^ /@name@/: the header name
    -> T.Text
    -- ^ /@value@/: the header value
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Structs.MessageHeaders.messageHeadersForeach'
    -> m ()
dynamic_MessageHeadersForeachFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_MessageHeadersForeachFunc
-> Text -> Text -> Ptr () -> m ()
dynamic_MessageHeadersForeachFunc FunPtr C_MessageHeadersForeachFunc
__funPtr Text
name Text
value Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    CString
value' <- Text -> IO CString
textToCString Text
value
    (FunPtr C_MessageHeadersForeachFunc -> C_MessageHeadersForeachFunc
__dynamic_C_MessageHeadersForeachFunc FunPtr C_MessageHeadersForeachFunc
__funPtr) CString
name' CString
value' Ptr ()
userData
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The callback passed to 'GI.Soup.Structs.MessageHeaders.messageHeadersForeach'.
type MessageHeadersForeachFunc =
    T.Text
    -- ^ /@name@/: the header name
    -> T.Text
    -- ^ /@value@/: the header value
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MessageHeadersForeachFunc`@.
noMessageHeadersForeachFunc :: Maybe MessageHeadersForeachFunc
noMessageHeadersForeachFunc :: Maybe MessageHeadersForeachFunc
noMessageHeadersForeachFunc = Maybe MessageHeadersForeachFunc
forall a. Maybe a
Nothing

-- | The callback passed to 'GI.Soup.Structs.MessageHeaders.messageHeadersForeach'.
type MessageHeadersForeachFunc_WithClosures =
    T.Text
    -- ^ /@name@/: the header name
    -> T.Text
    -- ^ /@value@/: the header value
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Structs.MessageHeaders.messageHeadersForeach'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MessageHeadersForeachFunc_WithClosures`@.
noMessageHeadersForeachFunc_WithClosures :: Maybe MessageHeadersForeachFunc_WithClosures
noMessageHeadersForeachFunc_WithClosures :: Maybe MessageHeadersForeachFunc_WithClosures
noMessageHeadersForeachFunc_WithClosures = Maybe MessageHeadersForeachFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_MessageHeadersForeachFunc :: MessageHeadersForeachFunc -> MessageHeadersForeachFunc_WithClosures
drop_closures_MessageHeadersForeachFunc :: MessageHeadersForeachFunc -> MessageHeadersForeachFunc_WithClosures
drop_closures_MessageHeadersForeachFunc MessageHeadersForeachFunc
_f Text
name Text
value Ptr ()
_ = MessageHeadersForeachFunc
_f Text
name Text
value

-- | Wrap the callback into a `GClosure`.
genClosure_MessageHeadersForeachFunc :: MonadIO m => MessageHeadersForeachFunc -> m (GClosure C_MessageHeadersForeachFunc)
genClosure_MessageHeadersForeachFunc :: forall (m :: * -> *).
MonadIO m =>
MessageHeadersForeachFunc
-> m (GClosure C_MessageHeadersForeachFunc)
genClosure_MessageHeadersForeachFunc MessageHeadersForeachFunc
cb = IO (GClosure C_MessageHeadersForeachFunc)
-> m (GClosure C_MessageHeadersForeachFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_MessageHeadersForeachFunc)
 -> m (GClosure C_MessageHeadersForeachFunc))
-> IO (GClosure C_MessageHeadersForeachFunc)
-> m (GClosure C_MessageHeadersForeachFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: MessageHeadersForeachFunc_WithClosures
cb' = MessageHeadersForeachFunc -> MessageHeadersForeachFunc_WithClosures
drop_closures_MessageHeadersForeachFunc MessageHeadersForeachFunc
cb
    let cb'' :: C_MessageHeadersForeachFunc
cb'' = Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc))
-> MessageHeadersForeachFunc_WithClosures
-> C_MessageHeadersForeachFunc
wrap_MessageHeadersForeachFunc Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc))
forall a. Maybe a
Nothing MessageHeadersForeachFunc_WithClosures
cb'
    C_MessageHeadersForeachFunc
-> IO (FunPtr C_MessageHeadersForeachFunc)
mk_MessageHeadersForeachFunc C_MessageHeadersForeachFunc
cb'' IO (FunPtr C_MessageHeadersForeachFunc)
-> (FunPtr C_MessageHeadersForeachFunc
    -> IO (GClosure C_MessageHeadersForeachFunc))
-> IO (GClosure C_MessageHeadersForeachFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_MessageHeadersForeachFunc
-> IO (GClosure C_MessageHeadersForeachFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `MessageHeadersForeachFunc` into a `C_MessageHeadersForeachFunc`.
wrap_MessageHeadersForeachFunc ::
    Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc)) ->
    MessageHeadersForeachFunc_WithClosures ->
    C_MessageHeadersForeachFunc
wrap_MessageHeadersForeachFunc :: Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc))
-> MessageHeadersForeachFunc_WithClosures
-> C_MessageHeadersForeachFunc
wrap_MessageHeadersForeachFunc Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc))
funptrptr MessageHeadersForeachFunc_WithClosures
_cb CString
name CString
value Ptr ()
userData = do
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    Text
value' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
value
    MessageHeadersForeachFunc_WithClosures
_cb  Text
name' Text
value' Ptr ()
userData
    Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_MessageHeadersForeachFunc))
funptrptr


-- callback LoggerPrinter
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "logger"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Logger" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupLogger" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "level"
          , argType =
              TInterface Name { namespace = "Soup" , name = "LoggerLogLevel" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the level of the information being printed."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "direction"
          , argType = TBasicType TInt8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a single-character prefix to @data"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "data"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "data to print" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "the data passed to soup_logger_set_printer()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a custom printing callback.\n\n@level indicates what kind of information is being printed. Eg, it\nwill be %SOUP_LOGGER_LOG_HEADERS if @data is header data.\n\n@direction is either '<', '>', or ' ', and @data is the single line\nto print; the printer is expected to add a terminating newline.\n\nTo get the effect of the default printer, you would do:\n\n<informalexample><programlisting>\nprintf (\"%c %s\\n\", direction, data);\n</programlisting></informalexample>"
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_LoggerPrinter =
    Ptr Soup.Logger.Logger ->
    CUInt ->
    Int8 ->
    CString ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "logger"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Logger" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupLogger" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "level"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "LoggerLogLevel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the level of the information being printed."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType = TBasicType TInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a single-character prefix to @data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to print" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data passed to soup_logger_set_printer()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_LoggerPrinter :: FunPtr C_LoggerPrinter -> C_LoggerPrinter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_LoggerPrinter ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Logger.IsLogger a) =>
    FunPtr C_LoggerPrinter
    -> a
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> Soup.Enums.LoggerLogLevel
    -- ^ /@level@/: the level of the information being printed.
    -> Int8
    -- ^ /@direction@/: a single-character prefix to /@data@/
    -> T.Text
    -- ^ /@data@/: data to print
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Logger.loggerSetPrinter'
    -> m ()
dynamic_LoggerPrinter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsLogger a) =>
FunPtr C_LoggerPrinter
-> a -> LoggerLogLevel -> Int8 -> Text -> Ptr () -> m ()
dynamic_LoggerPrinter FunPtr C_LoggerPrinter
__funPtr a
logger LoggerLogLevel
level Int8
direction Text
data_ Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Logger
logger' <- a -> IO (Ptr Logger)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
logger
    let level' :: CUInt
level' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (LoggerLogLevel -> Int) -> LoggerLogLevel -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LoggerLogLevel -> Int
forall a. Enum a => a -> Int
fromEnum) LoggerLogLevel
level
    CString
data_' <- Text -> IO CString
textToCString Text
data_
    (FunPtr C_LoggerPrinter -> C_LoggerPrinter
__dynamic_C_LoggerPrinter FunPtr C_LoggerPrinter
__funPtr) Ptr Logger
logger' CUInt
level' Int8
direction CString
data_' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
logger
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
data_'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The prototype for a custom printing callback.
-- 
-- /@level@/ indicates what kind of information is being printed. Eg, it
-- will be 'GI.Soup.Enums.LoggerLogLevelHeaders' if /@data@/ is header data.
-- 
-- /@direction@/ is either \'\<\', \'>\', or \' \', and /@data@/ is the single line
-- to print; the printer is expected to add a terminating newline.
-- 
-- To get the effect of the default printer, you would do:
-- 
-- \<informalexample>\<programlisting>
-- printf (\"@/c/@ @/s/@\\n\", direction, data);
-- \<\/programlisting>\<\/informalexample>
type LoggerPrinter =
    Soup.Logger.Logger
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> Soup.Enums.LoggerLogLevel
    -- ^ /@level@/: the level of the information being printed.
    -> Int8
    -- ^ /@direction@/: a single-character prefix to /@data@/
    -> T.Text
    -- ^ /@data@/: data to print
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `LoggerPrinter`@.
noLoggerPrinter :: Maybe LoggerPrinter
noLoggerPrinter :: Maybe LoggerPrinter
noLoggerPrinter = Maybe LoggerPrinter
forall a. Maybe a
Nothing

-- | The prototype for a custom printing callback.
-- 
-- /@level@/ indicates what kind of information is being printed. Eg, it
-- will be 'GI.Soup.Enums.LoggerLogLevelHeaders' if /@data@/ is header data.
-- 
-- /@direction@/ is either \'\<\', \'>\', or \' \', and /@data@/ is the single line
-- to print; the printer is expected to add a terminating newline.
-- 
-- To get the effect of the default printer, you would do:
-- 
-- \<informalexample>\<programlisting>
-- printf (\"@/c/@ @/s/@\\n\", direction, data);
-- \<\/programlisting>\<\/informalexample>
type LoggerPrinter_WithClosures =
    Soup.Logger.Logger
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> Soup.Enums.LoggerLogLevel
    -- ^ /@level@/: the level of the information being printed.
    -> Int8
    -- ^ /@direction@/: a single-character prefix to /@data@/
    -> T.Text
    -- ^ /@data@/: data to print
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Logger.loggerSetPrinter'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `LoggerPrinter_WithClosures`@.
noLoggerPrinter_WithClosures :: Maybe LoggerPrinter_WithClosures
noLoggerPrinter_WithClosures :: Maybe LoggerPrinter_WithClosures
noLoggerPrinter_WithClosures = Maybe LoggerPrinter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_LoggerPrinter :: LoggerPrinter -> LoggerPrinter_WithClosures
drop_closures_LoggerPrinter :: LoggerPrinter -> LoggerPrinter_WithClosures
drop_closures_LoggerPrinter LoggerPrinter
_f Logger
logger LoggerLogLevel
level Int8
direction Text
data_ Ptr ()
_ = LoggerPrinter
_f Logger
logger LoggerLogLevel
level Int8
direction Text
data_

-- | Wrap the callback into a `GClosure`.
genClosure_LoggerPrinter :: MonadIO m => LoggerPrinter -> m (GClosure C_LoggerPrinter)
genClosure_LoggerPrinter :: forall (m :: * -> *).
MonadIO m =>
LoggerPrinter -> m (GClosure C_LoggerPrinter)
genClosure_LoggerPrinter LoggerPrinter
cb = IO (GClosure C_LoggerPrinter) -> m (GClosure C_LoggerPrinter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_LoggerPrinter) -> m (GClosure C_LoggerPrinter))
-> IO (GClosure C_LoggerPrinter) -> m (GClosure C_LoggerPrinter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: LoggerPrinter_WithClosures
cb' = LoggerPrinter -> LoggerPrinter_WithClosures
drop_closures_LoggerPrinter LoggerPrinter
cb
    let cb'' :: C_LoggerPrinter
cb'' = Maybe (Ptr (FunPtr C_LoggerPrinter))
-> LoggerPrinter_WithClosures -> C_LoggerPrinter
wrap_LoggerPrinter Maybe (Ptr (FunPtr C_LoggerPrinter))
forall a. Maybe a
Nothing LoggerPrinter_WithClosures
cb'
    C_LoggerPrinter -> IO (FunPtr C_LoggerPrinter)
mk_LoggerPrinter C_LoggerPrinter
cb'' IO (FunPtr C_LoggerPrinter)
-> (FunPtr C_LoggerPrinter -> IO (GClosure C_LoggerPrinter))
-> IO (GClosure C_LoggerPrinter)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_LoggerPrinter -> IO (GClosure C_LoggerPrinter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `LoggerPrinter` into a `C_LoggerPrinter`.
wrap_LoggerPrinter ::
    Maybe (Ptr (FunPtr C_LoggerPrinter)) ->
    LoggerPrinter_WithClosures ->
    C_LoggerPrinter
wrap_LoggerPrinter :: Maybe (Ptr (FunPtr C_LoggerPrinter))
-> LoggerPrinter_WithClosures -> C_LoggerPrinter
wrap_LoggerPrinter Maybe (Ptr (FunPtr C_LoggerPrinter))
funptrptr LoggerPrinter_WithClosures
_cb Ptr Logger
logger CUInt
level Int8
direction CString
data_ Ptr ()
userData = do
    Logger
logger' <- ((ManagedPtr Logger -> Logger) -> Ptr Logger -> IO Logger
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Logger -> Logger
Soup.Logger.Logger) Ptr Logger
logger
    let level' :: LoggerLogLevel
level' = (Int -> LoggerLogLevel
forall a. Enum a => Int -> a
toEnum (Int -> LoggerLogLevel)
-> (CUInt -> Int) -> CUInt -> LoggerLogLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
level
    Text
data_' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
data_
    LoggerPrinter_WithClosures
_cb  Logger
logger' LoggerLogLevel
level' Int8
direction Text
data_' Ptr ()
userData
    Maybe (Ptr (FunPtr C_LoggerPrinter)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_LoggerPrinter))
funptrptr


-- callback LoggerFilter
{- Callable
  { returnType =
      Just
        (TInterface Name { namespace = "Soup" , name = "LoggerLogLevel" })
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "a #SoupLoggerLogLevel value indicating how much of\nthe message to log"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "logger"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Logger" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupLogger" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the message being logged"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the data passed to soup_logger_set_request_filter()\nor soup_logger_set_response_filter()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a logging filter. The filter callback will be\ninvoked for each request or response, and should analyze it and\nreturn a #SoupLoggerLogLevel value indicating how much of the\nmessage to log. Eg, it might choose between %SOUP_LOGGER_LOG_BODY\nand %SOUP_LOGGER_LOG_HEADERS depending on the Content-Type."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_LoggerFilter =
    Ptr Soup.Logger.Logger ->
    Ptr Soup.Message.Message ->
    Ptr () ->
    IO CUInt

-- Args: [ Arg
--           { argCName = "logger"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Logger" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupLogger" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the message being logged"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the data passed to soup_logger_set_request_filter()\nor soup_logger_set_response_filter()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Soup" , name = "LoggerLogLevel" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_LoggerFilter :: FunPtr C_LoggerFilter -> C_LoggerFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_LoggerFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Logger.IsLogger a, Soup.Message.IsMessage b) =>
    FunPtr C_LoggerFilter
    -> a
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> b
    -- ^ /@msg@/: the message being logged
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Logger.loggerSetRequestFilter'
    -- or 'GI.Soup.Objects.Logger.loggerSetResponseFilter'
    -> m Soup.Enums.LoggerLogLevel
    -- ^ __Returns:__ a t'GI.Soup.Enums.LoggerLogLevel' value indicating how much of
    -- the message to log
dynamic_LoggerFilter :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsLogger a, IsMessage b) =>
FunPtr C_LoggerFilter -> a -> b -> Ptr () -> m LoggerLogLevel
dynamic_LoggerFilter FunPtr C_LoggerFilter
__funPtr a
logger b
msg Ptr ()
userData = IO LoggerLogLevel -> m LoggerLogLevel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO LoggerLogLevel -> m LoggerLogLevel)
-> IO LoggerLogLevel -> m LoggerLogLevel
forall a b. (a -> b) -> a -> b
$ do
    Ptr Logger
logger' <- a -> IO (Ptr Logger)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
logger
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CUInt
result <- (FunPtr C_LoggerFilter -> C_LoggerFilter
__dynamic_C_LoggerFilter FunPtr C_LoggerFilter
__funPtr) Ptr Logger
logger' Ptr Message
msg' Ptr ()
userData
    let result' :: LoggerLogLevel
result' = (Int -> LoggerLogLevel
forall a. Enum a => Int -> a
toEnum (Int -> LoggerLogLevel)
-> (CUInt -> Int) -> CUInt -> LoggerLogLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
logger
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    LoggerLogLevel -> IO LoggerLogLevel
forall (m :: * -> *) a. Monad m => a -> m a
return LoggerLogLevel
result'

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

-- | The prototype for a logging filter. The filter callback will be
-- invoked for each request or response, and should analyze it and
-- return a t'GI.Soup.Enums.LoggerLogLevel' value indicating how much of the
-- message to log. Eg, it might choose between 'GI.Soup.Enums.LoggerLogLevelBody'
-- and 'GI.Soup.Enums.LoggerLogLevelHeaders' depending on the Content-Type.
type LoggerFilter =
    Soup.Logger.Logger
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being logged
    -> IO Soup.Enums.LoggerLogLevel
    -- ^ __Returns:__ a t'GI.Soup.Enums.LoggerLogLevel' value indicating how much of
    -- the message to log

-- | A convenience synonym for @`Nothing` :: `Maybe` `LoggerFilter`@.
noLoggerFilter :: Maybe LoggerFilter
noLoggerFilter :: Maybe LoggerFilter
noLoggerFilter = Maybe LoggerFilter
forall a. Maybe a
Nothing

-- | The prototype for a logging filter. The filter callback will be
-- invoked for each request or response, and should analyze it and
-- return a t'GI.Soup.Enums.LoggerLogLevel' value indicating how much of the
-- message to log. Eg, it might choose between 'GI.Soup.Enums.LoggerLogLevelBody'
-- and 'GI.Soup.Enums.LoggerLogLevelHeaders' depending on the Content-Type.
type LoggerFilter_WithClosures =
    Soup.Logger.Logger
    -- ^ /@logger@/: the t'GI.Soup.Objects.Logger.Logger'
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being logged
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Logger.loggerSetRequestFilter'
    -- or 'GI.Soup.Objects.Logger.loggerSetResponseFilter'
    -> IO Soup.Enums.LoggerLogLevel
    -- ^ __Returns:__ a t'GI.Soup.Enums.LoggerLogLevel' value indicating how much of
    -- the message to log

-- | A convenience synonym for @`Nothing` :: `Maybe` `LoggerFilter_WithClosures`@.
noLoggerFilter_WithClosures :: Maybe LoggerFilter_WithClosures
noLoggerFilter_WithClosures :: Maybe LoggerFilter_WithClosures
noLoggerFilter_WithClosures = Maybe LoggerFilter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_LoggerFilter :: LoggerFilter -> LoggerFilter_WithClosures
drop_closures_LoggerFilter :: LoggerFilter -> LoggerFilter_WithClosures
drop_closures_LoggerFilter LoggerFilter
_f Logger
logger Message
msg Ptr ()
_ = LoggerFilter
_f Logger
logger Message
msg

-- | Wrap the callback into a `GClosure`.
genClosure_LoggerFilter :: MonadIO m => LoggerFilter -> m (GClosure C_LoggerFilter)
genClosure_LoggerFilter :: forall (m :: * -> *).
MonadIO m =>
LoggerFilter -> m (GClosure C_LoggerFilter)
genClosure_LoggerFilter LoggerFilter
cb = IO (GClosure C_LoggerFilter) -> m (GClosure C_LoggerFilter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_LoggerFilter) -> m (GClosure C_LoggerFilter))
-> IO (GClosure C_LoggerFilter) -> m (GClosure C_LoggerFilter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: LoggerFilter_WithClosures
cb' = LoggerFilter -> LoggerFilter_WithClosures
drop_closures_LoggerFilter LoggerFilter
cb
    let cb'' :: C_LoggerFilter
cb'' = Maybe (Ptr (FunPtr C_LoggerFilter))
-> LoggerFilter_WithClosures -> C_LoggerFilter
wrap_LoggerFilter Maybe (Ptr (FunPtr C_LoggerFilter))
forall a. Maybe a
Nothing LoggerFilter_WithClosures
cb'
    C_LoggerFilter -> IO (FunPtr C_LoggerFilter)
mk_LoggerFilter C_LoggerFilter
cb'' IO (FunPtr C_LoggerFilter)
-> (FunPtr C_LoggerFilter -> IO (GClosure C_LoggerFilter))
-> IO (GClosure C_LoggerFilter)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_LoggerFilter -> IO (GClosure C_LoggerFilter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `LoggerFilter` into a `C_LoggerFilter`.
wrap_LoggerFilter ::
    Maybe (Ptr (FunPtr C_LoggerFilter)) ->
    LoggerFilter_WithClosures ->
    C_LoggerFilter
wrap_LoggerFilter :: Maybe (Ptr (FunPtr C_LoggerFilter))
-> LoggerFilter_WithClosures -> C_LoggerFilter
wrap_LoggerFilter Maybe (Ptr (FunPtr C_LoggerFilter))
funptrptr LoggerFilter_WithClosures
_cb Ptr Logger
logger Ptr Message
msg Ptr ()
userData = do
    Logger
logger' <- ((ManagedPtr Logger -> Logger) -> Ptr Logger -> IO Logger
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Logger -> Logger
Soup.Logger.Logger) Ptr Logger
logger
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    LoggerLogLevel
result <- LoggerFilter_WithClosures
_cb  Logger
logger' Message
msg' Ptr ()
userData
    Maybe (Ptr (FunPtr C_LoggerFilter)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_LoggerFilter))
funptrptr
    let result' :: CUInt
result' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (LoggerLogLevel -> Int) -> LoggerLogLevel -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LoggerLogLevel -> Int
forall a. Enum a => a -> Int
fromEnum) LoggerLogLevel
result
    CUInt -> IO CUInt
forall (m :: * -> *) a. Monad m => a -> m a
return CUInt
result'


-- callback ChunkAllocator
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Soup" , name = "Buffer" })
  , returnMayBeNull = True
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "the new buffer (or %NULL)"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the #SoupMessage the chunk is being allocated for"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "max_len"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the maximum length that will be read, or 0."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the data passed to soup_message_set_chunk_allocator()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated =
      Just
        DeprecationInfo
          { deprecatedSinceVersion = Nothing
          , deprecationMessage =
              Just "Use #SoupRequest if you want to read into your\nown buffers."
          }
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a chunk allocation callback. This should allocate\na new #SoupBuffer and return it for the I/O layer to read message\nbody data off the network into.\n\nIf @max_len is non-0, it indicates the maximum number of bytes that\ncould be read, based on what is known about the message size. Note\nthat this might be a very large number, and you should not simply\ntry to allocate that many bytes blindly. If @max_len is 0, that\nmeans that libsoup does not know how many bytes remain to be read,\nand the allocator should return a buffer of a size that it finds\nconvenient.\n\nIf the allocator returns %NULL, the message will be paused. It is\nup to the application to make sure that it gets unpaused when it\nbecomes possible to allocate a new buffer."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ChunkAllocator =
    Ptr Soup.Message.Message ->
    Word64 ->
    Ptr () ->
    IO (Ptr Soup.Buffer.Buffer)

-- Args: [ Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #SoupMessage the chunk is being allocated for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "max_len"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the maximum length that will be read, or 0."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the data passed to soup_message_set_chunk_allocator()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Soup" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ChunkAllocator :: FunPtr C_ChunkAllocator -> C_ChunkAllocator

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ChunkAllocator ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) =>
    FunPtr C_ChunkAllocator
    -> a
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' the chunk is being allocated for
    -> Word64
    -- ^ /@maxLen@/: the maximum length that will be read, or 0.
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Message.messageSetChunkAllocator'
    -> m (Maybe Soup.Buffer.Buffer)
    -- ^ __Returns:__ the new buffer (or 'P.Nothing')
dynamic_ChunkAllocator :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsMessage a) =>
FunPtr C_ChunkAllocator
-> a -> Word64 -> Ptr () -> m (Maybe Buffer)
dynamic_ChunkAllocator FunPtr C_ChunkAllocator
__funPtr a
msg Word64
maxLen Ptr ()
userData = IO (Maybe Buffer) -> m (Maybe Buffer)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Buffer) -> m (Maybe Buffer))
-> IO (Maybe Buffer) -> m (Maybe Buffer)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Message
msg' <- a -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
msg
    Ptr Buffer
result <- (FunPtr C_ChunkAllocator -> C_ChunkAllocator
__dynamic_C_ChunkAllocator FunPtr C_ChunkAllocator
__funPtr) Ptr Message
msg' Word64
maxLen Ptr ()
userData
    Maybe Buffer
maybeResult <- Ptr Buffer -> (Ptr Buffer -> IO Buffer) -> IO (Maybe Buffer)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Buffer
result ((Ptr Buffer -> IO Buffer) -> IO (Maybe Buffer))
-> (Ptr Buffer -> IO Buffer) -> IO (Maybe Buffer)
forall a b. (a -> b) -> a -> b
$ \Ptr Buffer
result' -> do
        Buffer
result'' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Soup.Buffer.Buffer) Ptr Buffer
result'
        Buffer -> IO Buffer
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
msg
    Maybe Buffer -> IO (Maybe Buffer)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Buffer
maybeResult

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

{-# DEPRECATED ChunkAllocator ["Use t'GI.Soup.Objects.Request.Request' if you want to read into your","own buffers."] #-}
-- | The prototype for a chunk allocation callback. This should allocate
-- a new t'GI.Soup.Structs.Buffer.Buffer' and return it for the I\/O layer to read message
-- body data off the network into.
-- 
-- If /@maxLen@/ is non-0, it indicates the maximum number of bytes that
-- could be read, based on what is known about the message size. Note
-- that this might be a very large number, and you should not simply
-- try to allocate that many bytes blindly. If /@maxLen@/ is 0, that
-- means that libsoup does not know how many bytes remain to be read,
-- and the allocator should return a buffer of a size that it finds
-- convenient.
-- 
-- If the allocator returns 'P.Nothing', the message will be paused. It is
-- up to the application to make sure that it gets unpaused when it
-- becomes possible to allocate a new buffer.
type ChunkAllocator =
    Soup.Message.Message
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' the chunk is being allocated for
    -> Word64
    -- ^ /@maxLen@/: the maximum length that will be read, or 0.
    -> IO (Maybe Soup.Buffer.Buffer)
    -- ^ __Returns:__ the new buffer (or 'P.Nothing')

-- | A convenience synonym for @`Nothing` :: `Maybe` `ChunkAllocator`@.
noChunkAllocator :: Maybe ChunkAllocator
noChunkAllocator :: Maybe ChunkAllocator
noChunkAllocator = Maybe ChunkAllocator
forall a. Maybe a
Nothing

-- | The prototype for a chunk allocation callback. This should allocate
-- a new t'GI.Soup.Structs.Buffer.Buffer' and return it for the I\/O layer to read message
-- body data off the network into.
-- 
-- If /@maxLen@/ is non-0, it indicates the maximum number of bytes that
-- could be read, based on what is known about the message size. Note
-- that this might be a very large number, and you should not simply
-- try to allocate that many bytes blindly. If /@maxLen@/ is 0, that
-- means that libsoup does not know how many bytes remain to be read,
-- and the allocator should return a buffer of a size that it finds
-- convenient.
-- 
-- If the allocator returns 'P.Nothing', the message will be paused. It is
-- up to the application to make sure that it gets unpaused when it
-- becomes possible to allocate a new buffer.
type ChunkAllocator_WithClosures =
    Soup.Message.Message
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' the chunk is being allocated for
    -> Word64
    -- ^ /@maxLen@/: the maximum length that will be read, or 0.
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.Message.messageSetChunkAllocator'
    -> IO (Maybe Soup.Buffer.Buffer)
    -- ^ __Returns:__ the new buffer (or 'P.Nothing')

-- | A convenience synonym for @`Nothing` :: `Maybe` `ChunkAllocator_WithClosures`@.
noChunkAllocator_WithClosures :: Maybe ChunkAllocator_WithClosures
noChunkAllocator_WithClosures :: Maybe ChunkAllocator_WithClosures
noChunkAllocator_WithClosures = Maybe ChunkAllocator_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ChunkAllocator :: ChunkAllocator -> ChunkAllocator_WithClosures
drop_closures_ChunkAllocator :: ChunkAllocator -> ChunkAllocator_WithClosures
drop_closures_ChunkAllocator ChunkAllocator
_f Message
msg Word64
maxLen Ptr ()
_ = ChunkAllocator
_f Message
msg Word64
maxLen

-- | Wrap the callback into a `GClosure`.
genClosure_ChunkAllocator :: MonadIO m => ChunkAllocator -> m (GClosure C_ChunkAllocator)
genClosure_ChunkAllocator :: forall (m :: * -> *).
MonadIO m =>
ChunkAllocator -> m (GClosure C_ChunkAllocator)
genClosure_ChunkAllocator ChunkAllocator
cb = IO (GClosure C_ChunkAllocator) -> m (GClosure C_ChunkAllocator)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ChunkAllocator) -> m (GClosure C_ChunkAllocator))
-> IO (GClosure C_ChunkAllocator) -> m (GClosure C_ChunkAllocator)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ChunkAllocator_WithClosures
cb' = ChunkAllocator -> ChunkAllocator_WithClosures
drop_closures_ChunkAllocator ChunkAllocator
cb
    let cb'' :: C_ChunkAllocator
cb'' = Maybe (Ptr (FunPtr C_ChunkAllocator))
-> ChunkAllocator_WithClosures -> C_ChunkAllocator
wrap_ChunkAllocator Maybe (Ptr (FunPtr C_ChunkAllocator))
forall a. Maybe a
Nothing ChunkAllocator_WithClosures
cb'
    C_ChunkAllocator -> IO (FunPtr C_ChunkAllocator)
mk_ChunkAllocator C_ChunkAllocator
cb'' IO (FunPtr C_ChunkAllocator)
-> (FunPtr C_ChunkAllocator -> IO (GClosure C_ChunkAllocator))
-> IO (GClosure C_ChunkAllocator)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ChunkAllocator -> IO (GClosure C_ChunkAllocator)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ChunkAllocator` into a `C_ChunkAllocator`.
wrap_ChunkAllocator ::
    Maybe (Ptr (FunPtr C_ChunkAllocator)) ->
    ChunkAllocator_WithClosures ->
    C_ChunkAllocator
wrap_ChunkAllocator :: Maybe (Ptr (FunPtr C_ChunkAllocator))
-> ChunkAllocator_WithClosures -> C_ChunkAllocator
wrap_ChunkAllocator Maybe (Ptr (FunPtr C_ChunkAllocator))
funptrptr ChunkAllocator_WithClosures
_cb Ptr Message
msg Word64
maxLen Ptr ()
userData = do
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Maybe Buffer
result <- ChunkAllocator_WithClosures
_cb  Message
msg' Word64
maxLen Ptr ()
userData
    Maybe (Ptr (FunPtr C_ChunkAllocator)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ChunkAllocator))
funptrptr
    Ptr Buffer
-> Maybe Buffer -> (Buffer -> IO (Ptr Buffer)) -> IO (Ptr Buffer)
forall (m :: * -> *) b a.
Monad m =>
b -> Maybe a -> (a -> m b) -> m b
maybeM Ptr Buffer
forall a. Ptr a
nullPtr Maybe Buffer
result ((Buffer -> IO (Ptr Buffer)) -> IO (Ptr Buffer))
-> (Buffer -> IO (Ptr Buffer)) -> IO (Ptr Buffer)
forall a b. (a -> b) -> a -> b
$ \Buffer
result' -> do
        Ptr Buffer
result'' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Buffer
result'
        Ptr Buffer -> IO (Ptr Buffer)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Buffer
result''


-- callback AuthDomainGenericAuthCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "%TRUE if @msg is authenticated, %FALSE if not."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "domain"
          , argType =
              TInterface Name { namespace = "Soup" , name = "AuthDomain" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #SoupAuthDomain" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupMessage being authenticated"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "username"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the username from @msg"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the data passed to\nsoup_auth_domain_set_generic_auth_callback()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a #SoupAuthDomain generic authentication callback.\n\nThe callback should look up the user's password, call\nsoup_auth_domain_check_password(), and use the return value from\nthat method as its own return value.\n\nIn general, for security reasons, it is preferable to use the\nauth-domain-specific auth callbacks (eg,\n#SoupAuthDomainBasicAuthCallback and\n#SoupAuthDomainDigestAuthCallback), because they don't require\nkeeping a cleartext password database. Most users will use the same\npassword for many different sites, meaning if any site with a\ncleartext password database is compromised, accounts on other\nservers might be compromised as well. For many of the cases where\n#SoupServer is used, this is not really relevant, but it may still\nbe worth considering."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AuthDomainGenericAuthCallback =
    Ptr Soup.AuthDomain.AuthDomain ->
    Ptr Soup.Message.Message ->
    CString ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "domain"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "AuthDomain" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupAuthDomain" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupMessage being authenticated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "username"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the username from @msg"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the data passed to\nsoup_auth_domain_set_generic_auth_callback()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AuthDomainGenericAuthCallback :: FunPtr C_AuthDomainGenericAuthCallback -> C_AuthDomainGenericAuthCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AuthDomainGenericAuthCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.AuthDomain.IsAuthDomain a, Soup.Message.IsMessage b) =>
    FunPtr C_AuthDomainGenericAuthCallback
    -> a
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> b
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' being authenticated
    -> T.Text
    -- ^ /@username@/: the username from /@msg@/
    -> Ptr ()
    -- ^ /@userData@/: the data passed to
    -- 'GI.Soup.Objects.AuthDomain.authDomainSetGenericAuthCallback'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ is authenticated, 'P.False' if not.
dynamic_AuthDomainGenericAuthCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAuthDomain a, IsMessage b) =>
FunPtr C_AuthDomainGenericAuthCallback
-> a -> b -> Text -> Ptr () -> m Bool
dynamic_AuthDomainGenericAuthCallback FunPtr C_AuthDomainGenericAuthCallback
__funPtr a
domain b
msg Text
username Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr AuthDomain
domain' <- a -> IO (Ptr AuthDomain)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
domain
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CString
username' <- Text -> IO CString
textToCString Text
username
    CInt
result <- (FunPtr C_AuthDomainGenericAuthCallback
-> C_AuthDomainGenericAuthCallback
__dynamic_C_AuthDomainGenericAuthCallback FunPtr C_AuthDomainGenericAuthCallback
__funPtr) Ptr AuthDomain
domain' Ptr Message
msg' CString
username' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
domain
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
username'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | The prototype for a t'GI.Soup.Objects.AuthDomain.AuthDomain' generic authentication callback.
-- 
-- The callback should look up the user\'s password, call
-- 'GI.Soup.Objects.AuthDomain.authDomainCheckPassword', and use the return value from
-- that method as its own return value.
-- 
-- In general, for security reasons, it is preferable to use the
-- auth-domain-specific auth callbacks (eg,
-- t'GI.Soup.Callbacks.AuthDomainBasicAuthCallback' and
-- t'GI.Soup.Callbacks.AuthDomainDigestAuthCallback'), because they don\'t require
-- keeping a cleartext password database. Most users will use the same
-- password for many different sites, meaning if any site with a
-- cleartext password database is compromised, accounts on other
-- servers might be compromised as well. For many of the cases where
-- t'GI.Soup.Objects.Server.Server' is used, this is not really relevant, but it may still
-- be worth considering.
type AuthDomainGenericAuthCallback =
    Soup.AuthDomain.AuthDomain
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> Soup.Message.Message
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' being authenticated
    -> T.Text
    -- ^ /@username@/: the username from /@msg@/
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ is authenticated, 'P.False' if not.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainGenericAuthCallback`@.
noAuthDomainGenericAuthCallback :: Maybe AuthDomainGenericAuthCallback
noAuthDomainGenericAuthCallback :: Maybe AuthDomainGenericAuthCallback
noAuthDomainGenericAuthCallback = Maybe AuthDomainGenericAuthCallback
forall a. Maybe a
Nothing

-- | The prototype for a t'GI.Soup.Objects.AuthDomain.AuthDomain' generic authentication callback.
-- 
-- The callback should look up the user\'s password, call
-- 'GI.Soup.Objects.AuthDomain.authDomainCheckPassword', and use the return value from
-- that method as its own return value.
-- 
-- In general, for security reasons, it is preferable to use the
-- auth-domain-specific auth callbacks (eg,
-- t'GI.Soup.Callbacks.AuthDomainBasicAuthCallback' and
-- t'GI.Soup.Callbacks.AuthDomainDigestAuthCallback'), because they don\'t require
-- keeping a cleartext password database. Most users will use the same
-- password for many different sites, meaning if any site with a
-- cleartext password database is compromised, accounts on other
-- servers might be compromised as well. For many of the cases where
-- t'GI.Soup.Objects.Server.Server' is used, this is not really relevant, but it may still
-- be worth considering.
type AuthDomainGenericAuthCallback_WithClosures =
    Soup.AuthDomain.AuthDomain
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> Soup.Message.Message
    -- ^ /@msg@/: the t'GI.Soup.Objects.Message.Message' being authenticated
    -> T.Text
    -- ^ /@username@/: the username from /@msg@/
    -> Ptr ()
    -- ^ /@userData@/: the data passed to
    -- 'GI.Soup.Objects.AuthDomain.authDomainSetGenericAuthCallback'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ is authenticated, 'P.False' if not.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainGenericAuthCallback_WithClosures`@.
noAuthDomainGenericAuthCallback_WithClosures :: Maybe AuthDomainGenericAuthCallback_WithClosures
noAuthDomainGenericAuthCallback_WithClosures :: Maybe AuthDomainGenericAuthCallback_WithClosures
noAuthDomainGenericAuthCallback_WithClosures = Maybe AuthDomainGenericAuthCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AuthDomainGenericAuthCallback :: AuthDomainGenericAuthCallback -> AuthDomainGenericAuthCallback_WithClosures
drop_closures_AuthDomainGenericAuthCallback :: AuthDomainGenericAuthCallback
-> AuthDomainGenericAuthCallback_WithClosures
drop_closures_AuthDomainGenericAuthCallback AuthDomainGenericAuthCallback
_f AuthDomain
domain Message
msg Text
username Ptr ()
_ = AuthDomainGenericAuthCallback
_f AuthDomain
domain Message
msg Text
username

-- | Wrap the callback into a `GClosure`.
genClosure_AuthDomainGenericAuthCallback :: MonadIO m => AuthDomainGenericAuthCallback -> m (GClosure C_AuthDomainGenericAuthCallback)
genClosure_AuthDomainGenericAuthCallback :: forall (m :: * -> *).
MonadIO m =>
AuthDomainGenericAuthCallback
-> m (GClosure C_AuthDomainGenericAuthCallback)
genClosure_AuthDomainGenericAuthCallback AuthDomainGenericAuthCallback
cb = IO (GClosure C_AuthDomainGenericAuthCallback)
-> m (GClosure C_AuthDomainGenericAuthCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AuthDomainGenericAuthCallback)
 -> m (GClosure C_AuthDomainGenericAuthCallback))
-> IO (GClosure C_AuthDomainGenericAuthCallback)
-> m (GClosure C_AuthDomainGenericAuthCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AuthDomainGenericAuthCallback_WithClosures
cb' = AuthDomainGenericAuthCallback
-> AuthDomainGenericAuthCallback_WithClosures
drop_closures_AuthDomainGenericAuthCallback AuthDomainGenericAuthCallback
cb
    let cb'' :: C_AuthDomainGenericAuthCallback
cb'' = Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback))
-> AuthDomainGenericAuthCallback_WithClosures
-> C_AuthDomainGenericAuthCallback
wrap_AuthDomainGenericAuthCallback Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback))
forall a. Maybe a
Nothing AuthDomainGenericAuthCallback_WithClosures
cb'
    C_AuthDomainGenericAuthCallback
-> IO (FunPtr C_AuthDomainGenericAuthCallback)
mk_AuthDomainGenericAuthCallback C_AuthDomainGenericAuthCallback
cb'' IO (FunPtr C_AuthDomainGenericAuthCallback)
-> (FunPtr C_AuthDomainGenericAuthCallback
    -> IO (GClosure C_AuthDomainGenericAuthCallback))
-> IO (GClosure C_AuthDomainGenericAuthCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AuthDomainGenericAuthCallback
-> IO (GClosure C_AuthDomainGenericAuthCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AuthDomainGenericAuthCallback` into a `C_AuthDomainGenericAuthCallback`.
wrap_AuthDomainGenericAuthCallback ::
    Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback)) ->
    AuthDomainGenericAuthCallback_WithClosures ->
    C_AuthDomainGenericAuthCallback
wrap_AuthDomainGenericAuthCallback :: Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback))
-> AuthDomainGenericAuthCallback_WithClosures
-> C_AuthDomainGenericAuthCallback
wrap_AuthDomainGenericAuthCallback Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback))
funptrptr AuthDomainGenericAuthCallback_WithClosures
_cb Ptr AuthDomain
domain Ptr Message
msg CString
username Ptr ()
userData = do
    AuthDomain
domain' <- ((ManagedPtr AuthDomain -> AuthDomain)
-> Ptr AuthDomain -> IO AuthDomain
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AuthDomain -> AuthDomain
Soup.AuthDomain.AuthDomain) Ptr AuthDomain
domain
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Text
username' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
username
    Bool
result <- AuthDomainGenericAuthCallback_WithClosures
_cb  AuthDomain
domain' Message
msg' Text
username' Ptr ()
userData
    Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AuthDomainGenericAuthCallback))
funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
    CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback AuthDomainFilter
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "%TRUE if @msg requires authentication, %FALSE if not."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "domain"
          , argType =
              TInterface Name { namespace = "Soup" , name = "AuthDomain" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #SoupAuthDomain" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #SoupMessage" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the data passed to soup_auth_domain_set_filter()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The prototype for a #SoupAuthDomain filter; see\nsoup_auth_domain_set_filter() for details."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AuthDomainFilter =
    Ptr Soup.AuthDomain.AuthDomain ->
    Ptr Soup.Message.Message ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "domain"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "AuthDomain" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupAuthDomain" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupMessage" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the data passed to soup_auth_domain_set_filter()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AuthDomainFilter :: FunPtr C_AuthDomainFilter -> C_AuthDomainFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AuthDomainFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.AuthDomain.IsAuthDomain a, Soup.Message.IsMessage b) =>
    FunPtr C_AuthDomainFilter
    -> a
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> b
    -- ^ /@msg@/: a t'GI.Soup.Objects.Message.Message'
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomain.authDomainSetFilter'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ requires authentication, 'P.False' if not.
dynamic_AuthDomainFilter :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAuthDomain a, IsMessage b) =>
FunPtr C_AuthDomainFilter -> a -> b -> Ptr () -> m Bool
dynamic_AuthDomainFilter FunPtr C_AuthDomainFilter
__funPtr a
domain b
msg Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr AuthDomain
domain' <- a -> IO (Ptr AuthDomain)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
domain
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CInt
result <- (FunPtr C_AuthDomainFilter -> C_AuthDomainFilter
__dynamic_C_AuthDomainFilter FunPtr C_AuthDomainFilter
__funPtr) Ptr AuthDomain
domain' Ptr Message
msg' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
domain
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | The prototype for a t'GI.Soup.Objects.AuthDomain.AuthDomain' filter; see
-- 'GI.Soup.Objects.AuthDomain.authDomainSetFilter' for details.
type AuthDomainFilter =
    Soup.AuthDomain.AuthDomain
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> Soup.Message.Message
    -- ^ /@msg@/: a t'GI.Soup.Objects.Message.Message'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ requires authentication, 'P.False' if not.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainFilter`@.
noAuthDomainFilter :: Maybe AuthDomainFilter
noAuthDomainFilter :: Maybe AuthDomainFilter
noAuthDomainFilter = Maybe AuthDomainFilter
forall a. Maybe a
Nothing

-- | The prototype for a t'GI.Soup.Objects.AuthDomain.AuthDomain' filter; see
-- 'GI.Soup.Objects.AuthDomain.authDomainSetFilter' for details.
type AuthDomainFilter_WithClosures =
    Soup.AuthDomain.AuthDomain
    -- ^ /@domain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> Soup.Message.Message
    -- ^ /@msg@/: a t'GI.Soup.Objects.Message.Message'
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomain.authDomainSetFilter'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ requires authentication, 'P.False' if not.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainFilter_WithClosures`@.
noAuthDomainFilter_WithClosures :: Maybe AuthDomainFilter_WithClosures
noAuthDomainFilter_WithClosures :: Maybe AuthDomainFilter_WithClosures
noAuthDomainFilter_WithClosures = Maybe AuthDomainFilter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AuthDomainFilter :: AuthDomainFilter -> AuthDomainFilter_WithClosures
drop_closures_AuthDomainFilter :: AuthDomainFilter -> AuthDomainFilter_WithClosures
drop_closures_AuthDomainFilter AuthDomainFilter
_f AuthDomain
domain Message
msg Ptr ()
_ = AuthDomainFilter
_f AuthDomain
domain Message
msg

-- | Wrap the callback into a `GClosure`.
genClosure_AuthDomainFilter :: MonadIO m => AuthDomainFilter -> m (GClosure C_AuthDomainFilter)
genClosure_AuthDomainFilter :: forall (m :: * -> *).
MonadIO m =>
AuthDomainFilter -> m (GClosure C_AuthDomainFilter)
genClosure_AuthDomainFilter AuthDomainFilter
cb = IO (GClosure C_AuthDomainFilter) -> m (GClosure C_AuthDomainFilter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AuthDomainFilter)
 -> m (GClosure C_AuthDomainFilter))
-> IO (GClosure C_AuthDomainFilter)
-> m (GClosure C_AuthDomainFilter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AuthDomainFilter_WithClosures
cb' = AuthDomainFilter -> AuthDomainFilter_WithClosures
drop_closures_AuthDomainFilter AuthDomainFilter
cb
    let cb'' :: C_AuthDomainFilter
cb'' = Maybe (Ptr (FunPtr C_AuthDomainFilter))
-> AuthDomainFilter_WithClosures -> C_AuthDomainFilter
wrap_AuthDomainFilter Maybe (Ptr (FunPtr C_AuthDomainFilter))
forall a. Maybe a
Nothing AuthDomainFilter_WithClosures
cb'
    C_AuthDomainFilter -> IO (FunPtr C_AuthDomainFilter)
mk_AuthDomainFilter C_AuthDomainFilter
cb'' IO (FunPtr C_AuthDomainFilter)
-> (FunPtr C_AuthDomainFilter -> IO (GClosure C_AuthDomainFilter))
-> IO (GClosure C_AuthDomainFilter)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AuthDomainFilter -> IO (GClosure C_AuthDomainFilter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AuthDomainFilter` into a `C_AuthDomainFilter`.
wrap_AuthDomainFilter ::
    Maybe (Ptr (FunPtr C_AuthDomainFilter)) ->
    AuthDomainFilter_WithClosures ->
    C_AuthDomainFilter
wrap_AuthDomainFilter :: Maybe (Ptr (FunPtr C_AuthDomainFilter))
-> AuthDomainFilter_WithClosures -> C_AuthDomainFilter
wrap_AuthDomainFilter Maybe (Ptr (FunPtr C_AuthDomainFilter))
funptrptr AuthDomainFilter_WithClosures
_cb Ptr AuthDomain
domain Ptr Message
msg Ptr ()
userData = do
    AuthDomain
domain' <- ((ManagedPtr AuthDomain -> AuthDomain)
-> Ptr AuthDomain -> IO AuthDomain
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AuthDomain -> AuthDomain
Soup.AuthDomain.AuthDomain) Ptr AuthDomain
domain
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Bool
result <- AuthDomainFilter_WithClosures
_cb  AuthDomain
domain' Message
msg' Ptr ()
userData
    Maybe (Ptr (FunPtr C_AuthDomainFilter)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AuthDomainFilter))
funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
    CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback AuthDomainDigestAuthCallback
{- Callable
  { returnType = Just (TBasicType TUTF8)
  , returnMayBeNull = True
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "the encoded password, or %NULL if\n@username is not a valid user. @domain will free the password when\nit is done with it."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "domain"
          , argType =
              TInterface Name { namespace = "Soup" , name = "AuthDomainDigest" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the domain" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the message being authenticated"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "username"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the username provided by the client"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the data passed to soup_auth_domain_digest_set_auth_callback()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Callback used by #SoupAuthDomainDigest for authentication purposes.\nThe application should look up @username in its password database,\nand return the corresponding encoded password (see\nsoup_auth_domain_digest_encode_password())."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AuthDomainDigestAuthCallback =
    Ptr Soup.AuthDomainDigest.AuthDomainDigest ->
    Ptr Soup.Message.Message ->
    CString ->
    Ptr () ->
    IO CString

-- Args: [ Arg
--           { argCName = "domain"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "AuthDomainDigest" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the domain" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the message being authenticated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "username"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the username provided by the client"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the data passed to soup_auth_domain_digest_set_auth_callback()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AuthDomainDigestAuthCallback :: FunPtr C_AuthDomainDigestAuthCallback -> C_AuthDomainDigestAuthCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AuthDomainDigestAuthCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.AuthDomainDigest.IsAuthDomainDigest a, Soup.Message.IsMessage b) =>
    FunPtr C_AuthDomainDigestAuthCallback
    -> a
    -- ^ /@domain@/: the domain
    -> b
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomainDigest.authDomainDigestSetAuthCallback'
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the encoded password, or 'P.Nothing' if
    -- /@username@/ is not a valid user. /@domain@/ will free the password when
    -- it is done with it.
dynamic_AuthDomainDigestAuthCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAuthDomainDigest a, IsMessage b) =>
FunPtr C_AuthDomainDigestAuthCallback
-> a -> b -> Text -> Ptr () -> m (Maybe Text)
dynamic_AuthDomainDigestAuthCallback FunPtr C_AuthDomainDigestAuthCallback
__funPtr a
domain b
msg Text
username Ptr ()
userData = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr AuthDomainDigest
domain' <- a -> IO (Ptr AuthDomainDigest)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
domain
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CString
username' <- Text -> IO CString
textToCString Text
username
    CString
result <- (FunPtr C_AuthDomainDigestAuthCallback
-> C_AuthDomainDigestAuthCallback
__dynamic_C_AuthDomainDigestAuthCallback FunPtr C_AuthDomainDigestAuthCallback
__funPtr) Ptr AuthDomainDigest
domain' Ptr Message
msg' CString
username' Ptr ()
userData
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
domain
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
username'
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

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

-- | Callback used by t'GI.Soup.Objects.AuthDomainDigest.AuthDomainDigest' for authentication purposes.
-- The application should look up /@username@/ in its password database,
-- and return the corresponding encoded password (see
-- 'GI.Soup.Objects.AuthDomainDigest.authDomainDigestEncodePassword').
type AuthDomainDigestAuthCallback =
    Soup.AuthDomainDigest.AuthDomainDigest
    -- ^ /@domain@/: the domain
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> IO (Maybe T.Text)
    -- ^ __Returns:__ the encoded password, or 'P.Nothing' if
    -- /@username@/ is not a valid user. /@domain@/ will free the password when
    -- it is done with it.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainDigestAuthCallback`@.
noAuthDomainDigestAuthCallback :: Maybe AuthDomainDigestAuthCallback
noAuthDomainDigestAuthCallback :: Maybe AuthDomainDigestAuthCallback
noAuthDomainDigestAuthCallback = Maybe AuthDomainDigestAuthCallback
forall a. Maybe a
Nothing

-- | Callback used by t'GI.Soup.Objects.AuthDomainDigest.AuthDomainDigest' for authentication purposes.
-- The application should look up /@username@/ in its password database,
-- and return the corresponding encoded password (see
-- 'GI.Soup.Objects.AuthDomainDigest.authDomainDigestEncodePassword').
type AuthDomainDigestAuthCallback_WithClosures =
    Soup.AuthDomainDigest.AuthDomainDigest
    -- ^ /@domain@/: the domain
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomainDigest.authDomainDigestSetAuthCallback'
    -> IO (Maybe T.Text)
    -- ^ __Returns:__ the encoded password, or 'P.Nothing' if
    -- /@username@/ is not a valid user. /@domain@/ will free the password when
    -- it is done with it.

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainDigestAuthCallback_WithClosures`@.
noAuthDomainDigestAuthCallback_WithClosures :: Maybe AuthDomainDigestAuthCallback_WithClosures
noAuthDomainDigestAuthCallback_WithClosures :: Maybe AuthDomainDigestAuthCallback_WithClosures
noAuthDomainDigestAuthCallback_WithClosures = Maybe AuthDomainDigestAuthCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AuthDomainDigestAuthCallback :: AuthDomainDigestAuthCallback -> AuthDomainDigestAuthCallback_WithClosures
drop_closures_AuthDomainDigestAuthCallback :: AuthDomainDigestAuthCallback
-> AuthDomainDigestAuthCallback_WithClosures
drop_closures_AuthDomainDigestAuthCallback AuthDomainDigestAuthCallback
_f AuthDomainDigest
domain Message
msg Text
username Ptr ()
_ = AuthDomainDigestAuthCallback
_f AuthDomainDigest
domain Message
msg Text
username

-- | Wrap the callback into a `GClosure`.
genClosure_AuthDomainDigestAuthCallback :: MonadIO m => AuthDomainDigestAuthCallback -> m (GClosure C_AuthDomainDigestAuthCallback)
genClosure_AuthDomainDigestAuthCallback :: forall (m :: * -> *).
MonadIO m =>
AuthDomainDigestAuthCallback
-> m (GClosure C_AuthDomainDigestAuthCallback)
genClosure_AuthDomainDigestAuthCallback AuthDomainDigestAuthCallback
cb = IO (GClosure C_AuthDomainDigestAuthCallback)
-> m (GClosure C_AuthDomainDigestAuthCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AuthDomainDigestAuthCallback)
 -> m (GClosure C_AuthDomainDigestAuthCallback))
-> IO (GClosure C_AuthDomainDigestAuthCallback)
-> m (GClosure C_AuthDomainDigestAuthCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AuthDomainDigestAuthCallback_WithClosures
cb' = AuthDomainDigestAuthCallback
-> AuthDomainDigestAuthCallback_WithClosures
drop_closures_AuthDomainDigestAuthCallback AuthDomainDigestAuthCallback
cb
    let cb'' :: C_AuthDomainDigestAuthCallback
cb'' = Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback))
-> AuthDomainDigestAuthCallback_WithClosures
-> C_AuthDomainDigestAuthCallback
wrap_AuthDomainDigestAuthCallback Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback))
forall a. Maybe a
Nothing AuthDomainDigestAuthCallback_WithClosures
cb'
    C_AuthDomainDigestAuthCallback
-> IO (FunPtr C_AuthDomainDigestAuthCallback)
mk_AuthDomainDigestAuthCallback C_AuthDomainDigestAuthCallback
cb'' IO (FunPtr C_AuthDomainDigestAuthCallback)
-> (FunPtr C_AuthDomainDigestAuthCallback
    -> IO (GClosure C_AuthDomainDigestAuthCallback))
-> IO (GClosure C_AuthDomainDigestAuthCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AuthDomainDigestAuthCallback
-> IO (GClosure C_AuthDomainDigestAuthCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AuthDomainDigestAuthCallback` into a `C_AuthDomainDigestAuthCallback`.
wrap_AuthDomainDigestAuthCallback ::
    Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback)) ->
    AuthDomainDigestAuthCallback_WithClosures ->
    C_AuthDomainDigestAuthCallback
wrap_AuthDomainDigestAuthCallback :: Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback))
-> AuthDomainDigestAuthCallback_WithClosures
-> C_AuthDomainDigestAuthCallback
wrap_AuthDomainDigestAuthCallback Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback))
funptrptr AuthDomainDigestAuthCallback_WithClosures
_cb Ptr AuthDomainDigest
domain Ptr Message
msg CString
username Ptr ()
userData = do
    AuthDomainDigest
domain' <- ((ManagedPtr AuthDomainDigest -> AuthDomainDigest)
-> Ptr AuthDomainDigest -> IO AuthDomainDigest
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AuthDomainDigest -> AuthDomainDigest
Soup.AuthDomainDigest.AuthDomainDigest) Ptr AuthDomainDigest
domain
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Text
username' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
username
    Maybe Text
result <- AuthDomainDigestAuthCallback_WithClosures
_cb  AuthDomainDigest
domain' Message
msg' Text
username' Ptr ()
userData
    Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AuthDomainDigestAuthCallback))
funptrptr
    CString -> Maybe Text -> (Text -> IO CString) -> IO CString
forall (m :: * -> *) b a.
Monad m =>
b -> Maybe a -> (a -> m b) -> m b
maybeM CString
forall a. Ptr a
nullPtr Maybe Text
result ((Text -> IO CString) -> IO CString)
-> (Text -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \Text
result' -> do
        CString
result'' <- Text -> IO CString
textToCString Text
result'
        CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
result''


-- callback AuthDomainBasicAuthCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText = Just "%TRUE if @username and @password are valid"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "domain"
          , argType =
              TInterface Name { namespace = "Soup" , name = "AuthDomainBasic" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the domain" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "msg"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Message" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the message being authenticated"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "username"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the username provided by the client"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "password"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the password provided by the client"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the data passed to soup_auth_domain_basic_set_auth_callback()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Callback used by #SoupAuthDomainBasic for authentication purposes.\nThe application should verify that @username and @password and valid\nand return %TRUE or %FALSE.\n\nIf you are maintaining your own password database (rather than\nusing the password to authenticate against some other system like\nPAM or a remote server), you should make sure you know what you are\ndoing. In particular, don't store cleartext passwords, or\neasily-computed hashes of cleartext passwords, even if you don't\ncare that much about the security of your server, because users\nwill frequently use the same password for multiple sites, and so\ncompromising any site with a cleartext (or easily-cracked) password\ndatabase may give attackers access to other more-interesting sites\nas well."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AuthDomainBasicAuthCallback =
    Ptr Soup.AuthDomainBasic.AuthDomainBasic ->
    Ptr Soup.Message.Message ->
    CString ->
    CString ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "domain"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "AuthDomainBasic" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the domain" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the message being authenticated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "username"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the username provided by the client"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "password"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the password provided by the client"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the data passed to soup_auth_domain_basic_set_auth_callback()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AuthDomainBasicAuthCallback :: FunPtr C_AuthDomainBasicAuthCallback -> C_AuthDomainBasicAuthCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AuthDomainBasicAuthCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.AuthDomainBasic.IsAuthDomainBasic a, Soup.Message.IsMessage b) =>
    FunPtr C_AuthDomainBasicAuthCallback
    -> a
    -- ^ /@domain@/: the domain
    -> b
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> T.Text
    -- ^ /@password@/: the password provided by the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomainBasic.authDomainBasicSetAuthCallback'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@username@/ and /@password@/ are valid
dynamic_AuthDomainBasicAuthCallback :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAuthDomainBasic a, IsMessage b) =>
FunPtr C_AuthDomainBasicAuthCallback
-> a -> b -> Text -> Text -> Ptr () -> m Bool
dynamic_AuthDomainBasicAuthCallback FunPtr C_AuthDomainBasicAuthCallback
__funPtr a
domain b
msg Text
username Text
password Ptr ()
userData = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr AuthDomainBasic
domain' <- a -> IO (Ptr AuthDomainBasic)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
domain
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    CString
username' <- Text -> IO CString
textToCString Text
username
    CString
password' <- Text -> IO CString
textToCString Text
password
    CInt
result <- (FunPtr C_AuthDomainBasicAuthCallback
-> C_AuthDomainBasicAuthCallback
__dynamic_C_AuthDomainBasicAuthCallback FunPtr C_AuthDomainBasicAuthCallback
__funPtr) Ptr AuthDomainBasic
domain' Ptr Message
msg' CString
username' CString
password' Ptr ()
userData
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
domain
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
username'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
password'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

-- | Callback used by t'GI.Soup.Objects.AuthDomainBasic.AuthDomainBasic' for authentication purposes.
-- The application should verify that /@username@/ and /@password@/ and valid
-- and return 'P.True' or 'P.False'.
-- 
-- If you are maintaining your own password database (rather than
-- using the password to authenticate against some other system like
-- PAM or a remote server), you should make sure you know what you are
-- doing. In particular, don\'t store cleartext passwords, or
-- easily-computed hashes of cleartext passwords, even if you don\'t
-- care that much about the security of your server, because users
-- will frequently use the same password for multiple sites, and so
-- compromising any site with a cleartext (or easily-cracked) password
-- database may give attackers access to other more-interesting sites
-- as well.
type AuthDomainBasicAuthCallback =
    Soup.AuthDomainBasic.AuthDomainBasic
    -- ^ /@domain@/: the domain
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> T.Text
    -- ^ /@password@/: the password provided by the client
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@username@/ and /@password@/ are valid

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainBasicAuthCallback`@.
noAuthDomainBasicAuthCallback :: Maybe AuthDomainBasicAuthCallback
noAuthDomainBasicAuthCallback :: Maybe AuthDomainBasicAuthCallback
noAuthDomainBasicAuthCallback = Maybe AuthDomainBasicAuthCallback
forall a. Maybe a
Nothing

-- | Callback used by t'GI.Soup.Objects.AuthDomainBasic.AuthDomainBasic' for authentication purposes.
-- The application should verify that /@username@/ and /@password@/ and valid
-- and return 'P.True' or 'P.False'.
-- 
-- If you are maintaining your own password database (rather than
-- using the password to authenticate against some other system like
-- PAM or a remote server), you should make sure you know what you are
-- doing. In particular, don\'t store cleartext passwords, or
-- easily-computed hashes of cleartext passwords, even if you don\'t
-- care that much about the security of your server, because users
-- will frequently use the same password for multiple sites, and so
-- compromising any site with a cleartext (or easily-cracked) password
-- database may give attackers access to other more-interesting sites
-- as well.
type AuthDomainBasicAuthCallback_WithClosures =
    Soup.AuthDomainBasic.AuthDomainBasic
    -- ^ /@domain@/: the domain
    -> Soup.Message.Message
    -- ^ /@msg@/: the message being authenticated
    -> T.Text
    -- ^ /@username@/: the username provided by the client
    -> T.Text
    -- ^ /@password@/: the password provided by the client
    -> Ptr ()
    -- ^ /@userData@/: the data passed to 'GI.Soup.Objects.AuthDomainBasic.authDomainBasicSetAuthCallback'
    -> IO Bool
    -- ^ __Returns:__ 'P.True' if /@username@/ and /@password@/ are valid

-- | A convenience synonym for @`Nothing` :: `Maybe` `AuthDomainBasicAuthCallback_WithClosures`@.
noAuthDomainBasicAuthCallback_WithClosures :: Maybe AuthDomainBasicAuthCallback_WithClosures
noAuthDomainBasicAuthCallback_WithClosures :: Maybe AuthDomainBasicAuthCallback_WithClosures
noAuthDomainBasicAuthCallback_WithClosures = Maybe AuthDomainBasicAuthCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AuthDomainBasicAuthCallback :: AuthDomainBasicAuthCallback -> AuthDomainBasicAuthCallback_WithClosures
drop_closures_AuthDomainBasicAuthCallback :: AuthDomainBasicAuthCallback
-> AuthDomainBasicAuthCallback_WithClosures
drop_closures_AuthDomainBasicAuthCallback AuthDomainBasicAuthCallback
_f AuthDomainBasic
domain Message
msg Text
username Text
password Ptr ()
_ = AuthDomainBasicAuthCallback
_f AuthDomainBasic
domain Message
msg Text
username Text
password

-- | Wrap the callback into a `GClosure`.
genClosure_AuthDomainBasicAuthCallback :: MonadIO m => AuthDomainBasicAuthCallback -> m (GClosure C_AuthDomainBasicAuthCallback)
genClosure_AuthDomainBasicAuthCallback :: forall (m :: * -> *).
MonadIO m =>
AuthDomainBasicAuthCallback
-> m (GClosure C_AuthDomainBasicAuthCallback)
genClosure_AuthDomainBasicAuthCallback AuthDomainBasicAuthCallback
cb = IO (GClosure C_AuthDomainBasicAuthCallback)
-> m (GClosure C_AuthDomainBasicAuthCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AuthDomainBasicAuthCallback)
 -> m (GClosure C_AuthDomainBasicAuthCallback))
-> IO (GClosure C_AuthDomainBasicAuthCallback)
-> m (GClosure C_AuthDomainBasicAuthCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AuthDomainBasicAuthCallback_WithClosures
cb' = AuthDomainBasicAuthCallback
-> AuthDomainBasicAuthCallback_WithClosures
drop_closures_AuthDomainBasicAuthCallback AuthDomainBasicAuthCallback
cb
    let cb'' :: C_AuthDomainBasicAuthCallback
cb'' = Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback))
-> AuthDomainBasicAuthCallback_WithClosures
-> C_AuthDomainBasicAuthCallback
wrap_AuthDomainBasicAuthCallback Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback))
forall a. Maybe a
Nothing AuthDomainBasicAuthCallback_WithClosures
cb'
    C_AuthDomainBasicAuthCallback
-> IO (FunPtr C_AuthDomainBasicAuthCallback)
mk_AuthDomainBasicAuthCallback C_AuthDomainBasicAuthCallback
cb'' IO (FunPtr C_AuthDomainBasicAuthCallback)
-> (FunPtr C_AuthDomainBasicAuthCallback
    -> IO (GClosure C_AuthDomainBasicAuthCallback))
-> IO (GClosure C_AuthDomainBasicAuthCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AuthDomainBasicAuthCallback
-> IO (GClosure C_AuthDomainBasicAuthCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AuthDomainBasicAuthCallback` into a `C_AuthDomainBasicAuthCallback`.
wrap_AuthDomainBasicAuthCallback ::
    Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback)) ->
    AuthDomainBasicAuthCallback_WithClosures ->
    C_AuthDomainBasicAuthCallback
wrap_AuthDomainBasicAuthCallback :: Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback))
-> AuthDomainBasicAuthCallback_WithClosures
-> C_AuthDomainBasicAuthCallback
wrap_AuthDomainBasicAuthCallback Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback))
funptrptr AuthDomainBasicAuthCallback_WithClosures
_cb Ptr AuthDomainBasic
domain Ptr Message
msg CString
username CString
password Ptr ()
userData = do
    AuthDomainBasic
domain' <- ((ManagedPtr AuthDomainBasic -> AuthDomainBasic)
-> Ptr AuthDomainBasic -> IO AuthDomainBasic
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AuthDomainBasic -> AuthDomainBasic
Soup.AuthDomainBasic.AuthDomainBasic) Ptr AuthDomainBasic
domain
    Message
msg' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Message -> Message
Soup.Message.Message) Ptr Message
msg
    Text
username' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
username
    Text
password' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
password
    Bool
result <- AuthDomainBasicAuthCallback_WithClosures
_cb  AuthDomainBasic
domain' Message
msg' Text
username' Text
password' Ptr ()
userData
    Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AuthDomainBasicAuthCallback))
funptrptr
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
    CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- callback AddressCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "addr"
          , argType =
              TInterface Name { namespace = "Soup" , name = "Address" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the #SoupAddress that was resolved"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "status"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "%SOUP_STATUS_OK, %SOUP_STATUS_CANT_RESOLVE, or\n%SOUP_STATUS_CANCELLED"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the user data that was passed to\nsoup_address_resolve_async()"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The callback function passed to soup_address_resolve_async()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_AddressCallback =
    Ptr Soup.Address.Address ->
    Word32 ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "addr"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Address" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #SoupAddress that was resolved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "status"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%SOUP_STATUS_OK, %SOUP_STATUS_CANT_RESOLVE, or\n%SOUP_STATUS_CANCELLED"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the user data that was passed to\nsoup_address_resolve_async()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AddressCallback :: FunPtr C_AddressCallback -> C_AddressCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AddressCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Soup.Address.IsAddress a) =>
    FunPtr C_AddressCallback
    -> a
    -- ^ /@addr@/: the t'GI.Soup.Objects.Address.Address' that was resolved
    -> Word32
    -- ^ /@status@/: 'GI.Soup.Enums.StatusOk', 'GI.Soup.Enums.StatusCantResolve', or
    -- 'GI.Soup.Enums.StatusCancelled'
    -> Ptr ()
    -- ^ /@userData@/: the user data that was passed to
    -- 'GI.Soup.Objects.Address.addressResolveAsync'
    -> m ()
dynamic_AddressCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
FunPtr C_AddressCallback -> a -> Word32 -> Ptr () -> m ()
dynamic_AddressCallback FunPtr C_AddressCallback
__funPtr a
addr Word32
status Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
    (FunPtr C_AddressCallback -> C_AddressCallback
__dynamic_C_AddressCallback FunPtr C_AddressCallback
__funPtr) Ptr Address
addr' Word32
status Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

-- | The callback function passed to 'GI.Soup.Objects.Address.addressResolveAsync'.
type AddressCallback =
    Soup.Address.Address
    -- ^ /@addr@/: the t'GI.Soup.Objects.Address.Address' that was resolved
    -> Word32
    -- ^ /@status@/: 'GI.Soup.Enums.StatusOk', 'GI.Soup.Enums.StatusCantResolve', or
    -- 'GI.Soup.Enums.StatusCancelled'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AddressCallback`@.
noAddressCallback :: Maybe AddressCallback
noAddressCallback :: Maybe AddressCallback
noAddressCallback = Maybe AddressCallback
forall a. Maybe a
Nothing

-- | The callback function passed to 'GI.Soup.Objects.Address.addressResolveAsync'.
type AddressCallback_WithClosures =
    Soup.Address.Address
    -- ^ /@addr@/: the t'GI.Soup.Objects.Address.Address' that was resolved
    -> Word32
    -- ^ /@status@/: 'GI.Soup.Enums.StatusOk', 'GI.Soup.Enums.StatusCantResolve', or
    -- 'GI.Soup.Enums.StatusCancelled'
    -> Ptr ()
    -- ^ /@userData@/: the user data that was passed to
    -- 'GI.Soup.Objects.Address.addressResolveAsync'
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AddressCallback_WithClosures`@.
noAddressCallback_WithClosures :: Maybe AddressCallback_WithClosures
noAddressCallback_WithClosures :: Maybe AddressCallback_WithClosures
noAddressCallback_WithClosures = Maybe AddressCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AddressCallback :: AddressCallback -> AddressCallback_WithClosures
drop_closures_AddressCallback :: AddressCallback -> AddressCallback_WithClosures
drop_closures_AddressCallback AddressCallback
_f Address
addr Word32
status Ptr ()
_ = AddressCallback
_f Address
addr Word32
status

-- | Wrap the callback into a `GClosure`.
genClosure_AddressCallback :: MonadIO m => AddressCallback -> m (GClosure C_AddressCallback)
genClosure_AddressCallback :: forall (m :: * -> *).
MonadIO m =>
AddressCallback -> m (GClosure C_AddressCallback)
genClosure_AddressCallback AddressCallback
cb = IO (GClosure C_AddressCallback) -> m (GClosure C_AddressCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AddressCallback) -> m (GClosure C_AddressCallback))
-> IO (GClosure C_AddressCallback)
-> m (GClosure C_AddressCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: AddressCallback_WithClosures
cb' = AddressCallback -> AddressCallback_WithClosures
drop_closures_AddressCallback AddressCallback
cb
    let cb'' :: C_AddressCallback
cb'' = Maybe (Ptr (FunPtr C_AddressCallback))
-> AddressCallback_WithClosures -> C_AddressCallback
wrap_AddressCallback Maybe (Ptr (FunPtr C_AddressCallback))
forall a. Maybe a
Nothing AddressCallback_WithClosures
cb'
    C_AddressCallback -> IO (FunPtr C_AddressCallback)
mk_AddressCallback C_AddressCallback
cb'' IO (FunPtr C_AddressCallback)
-> (FunPtr C_AddressCallback -> IO (GClosure C_AddressCallback))
-> IO (GClosure C_AddressCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AddressCallback -> IO (GClosure C_AddressCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AddressCallback` into a `C_AddressCallback`.
wrap_AddressCallback ::
    Maybe (Ptr (FunPtr C_AddressCallback)) ->
    AddressCallback_WithClosures ->
    C_AddressCallback
wrap_AddressCallback :: Maybe (Ptr (FunPtr C_AddressCallback))
-> AddressCallback_WithClosures -> C_AddressCallback
wrap_AddressCallback Maybe (Ptr (FunPtr C_AddressCallback))
funptrptr AddressCallback_WithClosures
_cb Ptr Address
addr Word32
status Ptr ()
userData = do
    Address
addr' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Address -> Address
Soup.Address.Address) Ptr Address
addr
    AddressCallback_WithClosures
_cb  Address
addr' Word32
status Ptr ()
userData
    Maybe (Ptr (FunPtr C_AddressCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_AddressCallback))
funptrptr