{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Soup.Objects.Server.Server' implements a simple HTTP server.
-- 
-- (The following documentation describes the current t'GI.Soup.Objects.Server.Server' API,
-- available in \<application>libsoup\<\/application> 2.48 and later. See
-- the section \"\<link linkend=\"soup-server-old-api\">The Old SoupServer
-- Listening API\<\/link>\" in the server how-to documentation for
-- details on the older t'GI.Soup.Objects.Server.Server' API.)
-- 
-- To begin, create a server using @/soup_server_new()/@. Add at least one
-- handler by calling 'GI.Soup.Objects.Server.serverAddHandler' or
-- 'GI.Soup.Objects.Server.serverAddEarlyHandler'; the handler will be called to
-- process any requests underneath the path you pass. (If you want all
-- requests to go to the same handler, just pass \"\/\" (or 'P.Nothing') for
-- the path.)
-- 
-- When a new connection is accepted (or a new request is started on
-- an existing persistent connection), the t'GI.Soup.Objects.Server.Server' will emit
-- [requestStarted]("GI.Soup.Objects.Server#g:signal:requestStarted") and then begin processing the request
-- as described below, but note that once the message is assigned a
-- t'GI.Soup.Objects.Message.Message':@/status-code/@, then callbacks after that point will be
-- skipped. Note also that it is not defined when the callbacks happen
-- relative to various t'GI.Soup.Objects.Message.Message' signals.
-- 
-- Once the headers have been read, t'GI.Soup.Objects.Server.Server' will check if there is
-- a t'GI.Soup.Objects.AuthDomain.AuthDomain' (qv) covering the Request-URI; if so, and if the
-- message does not contain suitable authorization, then the
-- t'GI.Soup.Objects.AuthDomain.AuthDomain' will set a status of 'GI.Soup.Enums.StatusUnauthorized' on
-- the message.
-- 
-- After checking for authorization, t'GI.Soup.Objects.Server.Server' will look for \"early\"
-- handlers (added with 'GI.Soup.Objects.Server.serverAddEarlyHandler') matching the
-- Request-URI. If one is found, it will be run; in particular, this
-- can be used to connect to signals to do a streaming read of the
-- request body.
-- 
-- (At this point, if the request headers contain \"\<literal>Expect:
-- 100-continue\<\/literal>\", and a status code has been set, then
-- t'GI.Soup.Objects.Server.Server' will skip the remaining steps and return the response.
-- If the request headers contain \"\<literal>Expect:
-- 100-continue\<\/literal>\" and no status code has been set,
-- t'GI.Soup.Objects.Server.Server' will return a 'GI.Soup.Enums.StatusContinue' status before
-- continuing.)
-- 
-- The server will then read in the response body (if present). At
-- this point, if there are no handlers at all defined for the
-- Request-URI, then the server will return 'GI.Soup.Enums.StatusNotFound' to
-- the client.
-- 
-- Otherwise (assuming no previous step assigned a status to the
-- message) any \"normal\" handlers (added with
-- 'GI.Soup.Objects.Server.serverAddHandler') for the message\'s Request-URI will be
-- run.
-- 
-- Then, if the path has a WebSocket handler registered (and has
-- not yet been assigned a status), t'GI.Soup.Objects.Server.Server' will attempt to
-- validate the WebSocket handshake, filling in the response and
-- setting a status of 'GI.Soup.Enums.StatusSwitchingProtocols' or
-- 'GI.Soup.Enums.StatusBadRequest' accordingly.
-- 
-- If the message still has no status code at this point (and has not
-- been paused with 'GI.Soup.Objects.Server.serverPauseMessage'), then it will be
-- given a status of 'GI.Soup.Enums.StatusInternalServerError' (because at
-- least one handler ran, but returned without assigning a status).
-- 
-- Finally, the server will emit [requestFinished]("GI.Soup.Objects.Server#g:signal:requestFinished") (or
-- [requestAborted]("GI.Soup.Objects.Server#g:signal:requestAborted") if an I\/O error occurred before
-- handling was completed).
-- 
-- If you want to handle the special \"*\" URI (eg, \"OPTIONS *\"), you
-- must explicitly register a handler for \"*\"; the default handler
-- will not be used for that case.
-- 
-- If you want to process https connections in addition to (or instead
-- of) http connections, you can either set the
-- 'GI.Soup.Constants.SERVER_TLS_CERTIFICATE' property when creating the server, or
-- else call @/soup_server_set_ssl_certificate()/@ after creating it.
-- 
-- Once the server is set up, make one or more calls to
-- 'GI.Soup.Objects.Server.serverListen', 'GI.Soup.Objects.Server.serverListenLocal', or
-- 'GI.Soup.Objects.Server.serverListenAll' to tell it where to listen for
-- connections. (All ports on a t'GI.Soup.Objects.Server.Server' use the same handlers; if
-- you need to handle some ports differently, such as returning
-- different data for http and https, you\'ll need to create multiple
-- @/SoupServers/@, or else check the passed-in URI in the handler
-- function.).
-- 
-- t'GI.Soup.Objects.Server.Server' will begin processing connections as soon as you return
-- to (or start) the main loop for the current thread-default
-- t'GI.GLib.Structs.MainContext.MainContext'.

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

module GI.Soup.Objects.Server
    ( 

-- * Exported types
    Server(..)                              ,
    IsServer                                ,
    toServer                                ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [acceptIostream]("GI.Soup.Objects.Server#g:method:acceptIostream"), [addAuthDomain]("GI.Soup.Objects.Server#g:method:addAuthDomain"), [addEarlyHandler]("GI.Soup.Objects.Server#g:method:addEarlyHandler"), [addHandler]("GI.Soup.Objects.Server#g:method:addHandler"), [addWebsocketExtension]("GI.Soup.Objects.Server#g:method:addWebsocketExtension"), [addWebsocketHandler]("GI.Soup.Objects.Server#g:method:addWebsocketHandler"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [disconnect]("GI.Soup.Objects.Server#g:method:disconnect"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [isHttps]("GI.Soup.Objects.Server#g:method:isHttps"), [listen]("GI.Soup.Objects.Server#g:method:listen"), [listenAll]("GI.Soup.Objects.Server#g:method:listenAll"), [listenFd]("GI.Soup.Objects.Server#g:method:listenFd"), [listenLocal]("GI.Soup.Objects.Server#g:method:listenLocal"), [listenSocket]("GI.Soup.Objects.Server#g:method:listenSocket"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [pauseMessage]("GI.Soup.Objects.Server#g:method:pauseMessage"), [quit]("GI.Soup.Objects.Server#g:method:quit"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [removeAuthDomain]("GI.Soup.Objects.Server#g:method:removeAuthDomain"), [removeHandler]("GI.Soup.Objects.Server#g:method:removeHandler"), [removeWebsocketExtension]("GI.Soup.Objects.Server#g:method:removeWebsocketExtension"), [run]("GI.Soup.Objects.Server#g:method:run"), [runAsync]("GI.Soup.Objects.Server#g:method:runAsync"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unpauseMessage]("GI.Soup.Objects.Server#g:method:unpauseMessage"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getAsyncContext]("GI.Soup.Objects.Server#g:method:getAsyncContext"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getListener]("GI.Soup.Objects.Server#g:method:getListener"), [getListeners]("GI.Soup.Objects.Server#g:method:getListeners"), [getPort]("GI.Soup.Objects.Server#g:method:getPort"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getUris]("GI.Soup.Objects.Server#g:method:getUris").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSslCertFile]("GI.Soup.Objects.Server#g:method:setSslCertFile").

#if defined(ENABLE_OVERLOADING)
    ResolveServerMethod                     ,
#endif

-- ** acceptIostream #method:acceptIostream#

#if defined(ENABLE_OVERLOADING)
    ServerAcceptIostreamMethodInfo          ,
#endif
    serverAcceptIostream                    ,


-- ** addAuthDomain #method:addAuthDomain#

#if defined(ENABLE_OVERLOADING)
    ServerAddAuthDomainMethodInfo           ,
#endif
    serverAddAuthDomain                     ,


-- ** addEarlyHandler #method:addEarlyHandler#

#if defined(ENABLE_OVERLOADING)
    ServerAddEarlyHandlerMethodInfo         ,
#endif
    serverAddEarlyHandler                   ,


-- ** addHandler #method:addHandler#

#if defined(ENABLE_OVERLOADING)
    ServerAddHandlerMethodInfo              ,
#endif
    serverAddHandler                        ,


-- ** addWebsocketExtension #method:addWebsocketExtension#

#if defined(ENABLE_OVERLOADING)
    ServerAddWebsocketExtensionMethodInfo   ,
#endif
    serverAddWebsocketExtension             ,


-- ** addWebsocketHandler #method:addWebsocketHandler#

#if defined(ENABLE_OVERLOADING)
    ServerAddWebsocketHandlerMethodInfo     ,
#endif
    serverAddWebsocketHandler               ,


-- ** disconnect #method:disconnect#

#if defined(ENABLE_OVERLOADING)
    ServerDisconnectMethodInfo              ,
#endif
    serverDisconnect                        ,


-- ** getAsyncContext #method:getAsyncContext#

#if defined(ENABLE_OVERLOADING)
    ServerGetAsyncContextMethodInfo         ,
#endif
    serverGetAsyncContext                   ,


-- ** getListener #method:getListener#

#if defined(ENABLE_OVERLOADING)
    ServerGetListenerMethodInfo             ,
#endif
    serverGetListener                       ,


-- ** getListeners #method:getListeners#

#if defined(ENABLE_OVERLOADING)
    ServerGetListenersMethodInfo            ,
#endif
    serverGetListeners                      ,


-- ** getPort #method:getPort#

#if defined(ENABLE_OVERLOADING)
    ServerGetPortMethodInfo                 ,
#endif
    serverGetPort                           ,


-- ** getUris #method:getUris#

#if defined(ENABLE_OVERLOADING)
    ServerGetUrisMethodInfo                 ,
#endif
    serverGetUris                           ,


-- ** isHttps #method:isHttps#

#if defined(ENABLE_OVERLOADING)
    ServerIsHttpsMethodInfo                 ,
#endif
    serverIsHttps                           ,


-- ** listen #method:listen#

#if defined(ENABLE_OVERLOADING)
    ServerListenMethodInfo                  ,
#endif
    serverListen                            ,


-- ** listenAll #method:listenAll#

#if defined(ENABLE_OVERLOADING)
    ServerListenAllMethodInfo               ,
#endif
    serverListenAll                         ,


-- ** listenFd #method:listenFd#

#if defined(ENABLE_OVERLOADING)
    ServerListenFdMethodInfo                ,
#endif
    serverListenFd                          ,


-- ** listenLocal #method:listenLocal#

#if defined(ENABLE_OVERLOADING)
    ServerListenLocalMethodInfo             ,
#endif
    serverListenLocal                       ,


-- ** listenSocket #method:listenSocket#

#if defined(ENABLE_OVERLOADING)
    ServerListenSocketMethodInfo            ,
#endif
    serverListenSocket                      ,


-- ** pauseMessage #method:pauseMessage#

#if defined(ENABLE_OVERLOADING)
    ServerPauseMessageMethodInfo            ,
#endif
    serverPauseMessage                      ,


-- ** quit #method:quit#

#if defined(ENABLE_OVERLOADING)
    ServerQuitMethodInfo                    ,
#endif
    serverQuit                              ,


-- ** removeAuthDomain #method:removeAuthDomain#

#if defined(ENABLE_OVERLOADING)
    ServerRemoveAuthDomainMethodInfo        ,
#endif
    serverRemoveAuthDomain                  ,


-- ** removeHandler #method:removeHandler#

#if defined(ENABLE_OVERLOADING)
    ServerRemoveHandlerMethodInfo           ,
#endif
    serverRemoveHandler                     ,


-- ** removeWebsocketExtension #method:removeWebsocketExtension#

#if defined(ENABLE_OVERLOADING)
    ServerRemoveWebsocketExtensionMethodInfo,
#endif
    serverRemoveWebsocketExtension          ,


-- ** run #method:run#

#if defined(ENABLE_OVERLOADING)
    ServerRunMethodInfo                     ,
#endif
    serverRun                               ,


-- ** runAsync #method:runAsync#

#if defined(ENABLE_OVERLOADING)
    ServerRunAsyncMethodInfo                ,
#endif
    serverRunAsync                          ,


-- ** setSslCertFile #method:setSslCertFile#

#if defined(ENABLE_OVERLOADING)
    ServerSetSslCertFileMethodInfo          ,
#endif
    serverSetSslCertFile                    ,


-- ** unpauseMessage #method:unpauseMessage#

#if defined(ENABLE_OVERLOADING)
    ServerUnpauseMessageMethodInfo          ,
#endif
    serverUnpauseMessage                    ,




 -- * Properties


-- ** asyncContext #attr:asyncContext#
-- | The server\'s t'GI.GLib.Structs.MainContext.MainContext', if you are using the old API.
-- Servers created using 'GI.Soup.Objects.Server.serverListen' will listen on
-- the t'GI.GLib.Structs.MainContext.MainContext' that was the thread-default context at
-- the time 'GI.Soup.Objects.Server.serverListen' was called.

#if defined(ENABLE_OVERLOADING)
    ServerAsyncContextPropertyInfo          ,
#endif
    constructServerAsyncContext             ,
    getServerAsyncContext                   ,
#if defined(ENABLE_OVERLOADING)
    serverAsyncContext                      ,
#endif


-- ** httpAliases #attr:httpAliases#
-- | A 'P.Nothing'-terminated array of URI schemes that should be
-- considered to be aliases for \"http\". Eg, if this included
-- \<literal>\"dav\"\<\/literal>, than a URI of
-- \<literal>dav:\/\/example.com\/path\<\/literal> would be treated
-- identically to \<literal>http:\/\/example.com\/path\<\/literal>.
-- In particular, this is needed in cases where a client
-- sends requests with absolute URIs, where those URIs do
-- not use \"http:\".
-- 
-- The default value is an array containing the single element
-- \<literal>\"*\"\<\/literal>, a special value which means that
-- any scheme except \"https\" is considered to be an alias for
-- \"http\".
-- 
-- See also t'GI.Soup.Objects.Server.Server':@/https-aliases/@.
-- 
-- /Since: 2.44/

#if defined(ENABLE_OVERLOADING)
    ServerHttpAliasesPropertyInfo           ,
#endif
    clearServerHttpAliases                  ,
    constructServerHttpAliases              ,
    getServerHttpAliases                    ,
#if defined(ENABLE_OVERLOADING)
    serverHttpAliases                       ,
#endif
    setServerHttpAliases                    ,


-- ** httpsAliases #attr:httpsAliases#
-- | A comma-delimited list of URI schemes that should be
-- considered to be aliases for \"https\". See
-- t'GI.Soup.Objects.Server.Server':@/http-aliases/@ for more information.
-- 
-- The default value is 'P.Nothing', meaning that no URI schemes
-- are considered aliases for \"https\".
-- 
-- /Since: 2.44/

#if defined(ENABLE_OVERLOADING)
    ServerHttpsAliasesPropertyInfo          ,
#endif
    clearServerHttpsAliases                 ,
    constructServerHttpsAliases             ,
    getServerHttpsAliases                   ,
#if defined(ENABLE_OVERLOADING)
    serverHttpsAliases                      ,
#endif
    setServerHttpsAliases                   ,


-- ** interface #attr:interface#
-- | The address of the network interface the server is
-- listening on, if you are using the old t'GI.Soup.Objects.Server.Server' API.
-- (This will not be set if you use 'GI.Soup.Objects.Server.serverListen',
-- etc.)

#if defined(ENABLE_OVERLOADING)
    ServerInterfacePropertyInfo             ,
#endif
    constructServerInterface                ,
    getServerInterface                      ,
#if defined(ENABLE_OVERLOADING)
    serverInterface                         ,
#endif


-- ** port #attr:port#
-- | The port the server is listening on, if you are using the
-- old t'GI.Soup.Objects.Server.Server' API. (This will not be set if you use
-- 'GI.Soup.Objects.Server.serverListen', etc.)

#if defined(ENABLE_OVERLOADING)
    ServerPortPropertyInfo                  ,
#endif
    constructServerPort                     ,
    getServerPort                           ,
#if defined(ENABLE_OVERLOADING)
    serverPort                              ,
#endif


-- ** rawPaths #attr:rawPaths#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    ServerRawPathsPropertyInfo              ,
#endif
    constructServerRawPaths                 ,
    getServerRawPaths                       ,
#if defined(ENABLE_OVERLOADING)
    serverRawPaths                          ,
#endif


-- ** serverHeader #attr:serverHeader#
-- | If non-'P.Nothing', the value to use for the \"Server\" header on
-- t'GI.Soup.Objects.Message.Message's processed by this server.
-- 
-- The Server header is the server equivalent of the
-- User-Agent header, and provides information about the
-- server and its components. It contains a list of one or
-- more product tokens, separated by whitespace, with the most
-- significant product token coming first. The tokens must be
-- brief, ASCII, and mostly alphanumeric (although \"-\", \"_\",
-- and \".\" are also allowed), and may optionally include a \"\/\"
-- followed by a version string. You may also put comments,
-- enclosed in parentheses, between or after the tokens.
-- 
-- Some HTTP server implementations intentionally do not use
-- version numbers in their Server header, so that
-- installations running older versions of the server don\'t
-- end up advertising their vulnerability to specific security
-- holes.
-- 
-- As with t'GI.Soup.Objects.Session.Session':@/user_agent/@, if you set a
-- t'GI.Soup.Objects.Server.Server':@/server_header/@ property that has trailing whitespace,
-- t'GI.Soup.Objects.Server.Server' will append its own product token (eg,
-- \"\<literal>libsoup\/2.3.2\<\/literal>\") to the end of the
-- header for you.

#if defined(ENABLE_OVERLOADING)
    ServerServerHeaderPropertyInfo          ,
#endif
    clearServerServerHeader                 ,
    constructServerServerHeader             ,
    getServerServerHeader                   ,
#if defined(ENABLE_OVERLOADING)
    serverServerHeader                      ,
#endif
    setServerServerHeader                   ,


-- ** sslCertFile #attr:sslCertFile#
-- | Path to a file containing a PEM-encoded certificate.
-- 
-- If you set this property and t'GI.Soup.Objects.Server.Server':@/ssl-key-file/@ at
-- construct time, then @/soup_server_new()/@ will try to read the
-- files; if it cannot, it will return 'P.Nothing', with no explicit
-- indication of what went wrong (and logging a warning with
-- newer versions of glib, since returning 'P.Nothing' from a
-- constructor is illegal).

#if defined(ENABLE_OVERLOADING)
    ServerSslCertFilePropertyInfo           ,
#endif
    constructServerSslCertFile              ,
    getServerSslCertFile                    ,
#if defined(ENABLE_OVERLOADING)
    serverSslCertFile                       ,
#endif


-- ** sslKeyFile #attr:sslKeyFile#
-- | Path to a file containing a PEM-encoded private key. See
-- t'GI.Soup.Objects.Server.Server':@/ssl-cert-file/@ for more information about how this
-- is used.

#if defined(ENABLE_OVERLOADING)
    ServerSslKeyFilePropertyInfo            ,
#endif
    constructServerSslKeyFile               ,
    getServerSslKeyFile                     ,
#if defined(ENABLE_OVERLOADING)
    serverSslKeyFile                        ,
#endif


-- ** tlsCertificate #attr:tlsCertificate#
-- | A t'GI.Gio.Objects.TlsCertificate.TlsCertificate' that has a t'GI.Gio.Objects.TlsCertificate.TlsCertificate':@/private-key/@
-- set. If this is set, then the server will be able to speak
-- https in addition to (or instead of) plain http.
-- 
-- Alternatively, you can call 'GI.Soup.Objects.Server.serverSetSslCertFile'
-- to have t'GI.Soup.Objects.Server.Server' read in a a certificate from a file.
-- 
-- /Since: 2.38/

#if defined(ENABLE_OVERLOADING)
    ServerTlsCertificatePropertyInfo        ,
#endif
    constructServerTlsCertificate           ,
    getServerTlsCertificate                 ,
#if defined(ENABLE_OVERLOADING)
    serverTlsCertificate                    ,
#endif




 -- * Signals


-- ** requestAborted #signal:requestAborted#

    C_ServerRequestAbortedCallback          ,
    ServerRequestAbortedCallback            ,
#if defined(ENABLE_OVERLOADING)
    ServerRequestAbortedSignalInfo          ,
#endif
    afterServerRequestAborted               ,
    genClosure_ServerRequestAborted         ,
    mk_ServerRequestAbortedCallback         ,
    noServerRequestAbortedCallback          ,
    onServerRequestAborted                  ,
    wrap_ServerRequestAbortedCallback       ,


-- ** requestFinished #signal:requestFinished#

    C_ServerRequestFinishedCallback         ,
    ServerRequestFinishedCallback           ,
#if defined(ENABLE_OVERLOADING)
    ServerRequestFinishedSignalInfo         ,
#endif
    afterServerRequestFinished              ,
    genClosure_ServerRequestFinished        ,
    mk_ServerRequestFinishedCallback        ,
    noServerRequestFinishedCallback         ,
    onServerRequestFinished                 ,
    wrap_ServerRequestFinishedCallback      ,


-- ** requestRead #signal:requestRead#

    C_ServerRequestReadCallback             ,
    ServerRequestReadCallback               ,
#if defined(ENABLE_OVERLOADING)
    ServerRequestReadSignalInfo             ,
#endif
    afterServerRequestRead                  ,
    genClosure_ServerRequestRead            ,
    mk_ServerRequestReadCallback            ,
    noServerRequestReadCallback             ,
    onServerRequestRead                     ,
    wrap_ServerRequestReadCallback          ,


-- ** requestStarted #signal:requestStarted#

    C_ServerRequestStartedCallback          ,
    ServerRequestStartedCallback            ,
#if defined(ENABLE_OVERLOADING)
    ServerRequestStartedSignalInfo          ,
#endif
    afterServerRequestStarted               ,
    genClosure_ServerRequestStarted         ,
    mk_ServerRequestStartedCallback         ,
    noServerRequestStartedCallback          ,
    onServerRequestStarted                  ,
    wrap_ServerRequestStartedCallback       ,




    ) 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.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import qualified GI.Gio.Objects.Socket as Gio.Socket
import qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import qualified GI.Gio.Objects.TlsCertificate as Gio.TlsCertificate
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Flags as Soup.Flags
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomain as Soup.AuthDomain
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Objects.Socket as Soup.Socket
import {-# SOURCE #-} qualified GI.Soup.Structs.ClientContext as Soup.ClientContext
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

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

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

foreign import ccall "soup_server_get_type"
    c_soup_server_get_type :: IO B.Types.GType

instance B.Types.TypedObject Server where
    glibType :: IO GType
glibType = IO GType
c_soup_server_get_type

instance B.Types.GObject Server

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

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

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveServerMethod (t :: Symbol) (o :: *) :: * where
    ResolveServerMethod "acceptIostream" o = ServerAcceptIostreamMethodInfo
    ResolveServerMethod "addAuthDomain" o = ServerAddAuthDomainMethodInfo
    ResolveServerMethod "addEarlyHandler" o = ServerAddEarlyHandlerMethodInfo
    ResolveServerMethod "addHandler" o = ServerAddHandlerMethodInfo
    ResolveServerMethod "addWebsocketExtension" o = ServerAddWebsocketExtensionMethodInfo
    ResolveServerMethod "addWebsocketHandler" o = ServerAddWebsocketHandlerMethodInfo
    ResolveServerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveServerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveServerMethod "disconnect" o = ServerDisconnectMethodInfo
    ResolveServerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveServerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveServerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveServerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveServerMethod "isHttps" o = ServerIsHttpsMethodInfo
    ResolveServerMethod "listen" o = ServerListenMethodInfo
    ResolveServerMethod "listenAll" o = ServerListenAllMethodInfo
    ResolveServerMethod "listenFd" o = ServerListenFdMethodInfo
    ResolveServerMethod "listenLocal" o = ServerListenLocalMethodInfo
    ResolveServerMethod "listenSocket" o = ServerListenSocketMethodInfo
    ResolveServerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveServerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveServerMethod "pauseMessage" o = ServerPauseMessageMethodInfo
    ResolveServerMethod "quit" o = ServerQuitMethodInfo
    ResolveServerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveServerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveServerMethod "removeAuthDomain" o = ServerRemoveAuthDomainMethodInfo
    ResolveServerMethod "removeHandler" o = ServerRemoveHandlerMethodInfo
    ResolveServerMethod "removeWebsocketExtension" o = ServerRemoveWebsocketExtensionMethodInfo
    ResolveServerMethod "run" o = ServerRunMethodInfo
    ResolveServerMethod "runAsync" o = ServerRunAsyncMethodInfo
    ResolveServerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveServerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveServerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveServerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveServerMethod "unpauseMessage" o = ServerUnpauseMessageMethodInfo
    ResolveServerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveServerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveServerMethod "getAsyncContext" o = ServerGetAsyncContextMethodInfo
    ResolveServerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveServerMethod "getListener" o = ServerGetListenerMethodInfo
    ResolveServerMethod "getListeners" o = ServerGetListenersMethodInfo
    ResolveServerMethod "getPort" o = ServerGetPortMethodInfo
    ResolveServerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveServerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveServerMethod "getUris" o = ServerGetUrisMethodInfo
    ResolveServerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveServerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveServerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveServerMethod "setSslCertFile" o = ServerSetSslCertFileMethodInfo
    ResolveServerMethod l o = O.MethodResolutionFailed l o

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

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

#endif

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

#endif

-- signal Server::request-aborted
-- | Emitted when processing has failed for a message; this
-- could mean either that it could not be read (if
-- t'GI.Soup.Objects.Server.Server'::@/request_read/@ has not been emitted for it yet),
-- or that the response could not be written back (if
-- t'GI.Soup.Objects.Server.Server'::@/request_read/@ has been emitted but
-- t'GI.Soup.Objects.Server.Server'::@/request_finished/@ has not been).
-- 
-- /@message@/ is in an undefined state when this signal is
-- emitted; the signal exists primarily to allow the server to
-- free any state that it may have allocated in
-- t'GI.Soup.Objects.Server.Server'::@/request_started/@.
type ServerRequestAbortedCallback =
    Soup.Message.Message
    -- ^ /@message@/: the message
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: the client context
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerRequestAbortedCallback`@.
noServerRequestAbortedCallback :: Maybe ServerRequestAbortedCallback
noServerRequestAbortedCallback :: Maybe ServerRequestAbortedCallback
noServerRequestAbortedCallback = Maybe ServerRequestAbortedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_ServerRequestAbortedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_ServerRequestAborted :: MonadIO m => ServerRequestAbortedCallback -> m (GClosure C_ServerRequestAbortedCallback)
genClosure_ServerRequestAborted :: forall (m :: * -> *).
MonadIO m =>
ServerRequestAbortedCallback
-> m (GClosure C_ServerRequestAbortedCallback)
genClosure_ServerRequestAborted ServerRequestAbortedCallback
cb = IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerRequestAbortedCallback)
 -> m (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestAbortedCallback ServerRequestAbortedCallback
cb
    C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestAbortedCallback C_ServerRequestAbortedCallback
cb' IO (FunPtr C_ServerRequestAbortedCallback)
-> (FunPtr C_ServerRequestAbortedCallback
    -> IO (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerRequestAbortedCallback
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerRequestAbortedCallback` into a `C_ServerRequestAbortedCallback`.
wrap_ServerRequestAbortedCallback ::
    ServerRequestAbortedCallback ->
    C_ServerRequestAbortedCallback
wrap_ServerRequestAbortedCallback :: ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestAbortedCallback ServerRequestAbortedCallback
_cb Ptr ()
_ Ptr Message
message Ptr ClientContext
client Ptr ()
_ = do
    Message
message' <- ((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
message
    (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
        ServerRequestAbortedCallback
_cb  Message
message' ClientContext
client'


-- | Connect a signal handler for the [requestAborted](#signal:requestAborted) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' server #requestAborted callback
-- @
-- 
-- 
onServerRequestAborted :: (IsServer a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId
onServerRequestAborted :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
onServerRequestAborted a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestAbortedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestAbortedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-aborted" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [requestAborted](#signal:requestAborted) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' server #requestAborted callback
-- @
-- 
-- 
afterServerRequestAborted :: (IsServer a, MonadIO m) => a -> ServerRequestAbortedCallback -> m SignalHandlerId
afterServerRequestAborted :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
afterServerRequestAborted a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestAbortedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestAbortedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-aborted" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ServerRequestAbortedSignalInfo
instance SignalInfo ServerRequestAbortedSignalInfo where
    type HaskellCallbackType ServerRequestAbortedSignalInfo = ServerRequestAbortedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ServerRequestAbortedCallback cb
        cb'' <- mk_ServerRequestAbortedCallback cb'
        connectSignalFunPtr obj "request-aborted" cb'' connectMode detail

#endif

-- signal Server::request-finished
-- | Emitted when the server has finished writing a response to
-- a request.
type ServerRequestFinishedCallback =
    Soup.Message.Message
    -- ^ /@message@/: the message
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: the client context
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerRequestFinishedCallback`@.
noServerRequestFinishedCallback :: Maybe ServerRequestFinishedCallback
noServerRequestFinishedCallback :: Maybe ServerRequestAbortedCallback
noServerRequestFinishedCallback = Maybe ServerRequestAbortedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_ServerRequestFinishedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_ServerRequestFinished :: MonadIO m => ServerRequestFinishedCallback -> m (GClosure C_ServerRequestFinishedCallback)
genClosure_ServerRequestFinished :: forall (m :: * -> *).
MonadIO m =>
ServerRequestAbortedCallback
-> m (GClosure C_ServerRequestAbortedCallback)
genClosure_ServerRequestFinished ServerRequestAbortedCallback
cb = IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerRequestAbortedCallback)
 -> m (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestFinishedCallback ServerRequestAbortedCallback
cb
    C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestFinishedCallback C_ServerRequestAbortedCallback
cb' IO (FunPtr C_ServerRequestAbortedCallback)
-> (FunPtr C_ServerRequestAbortedCallback
    -> IO (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerRequestAbortedCallback
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerRequestFinishedCallback` into a `C_ServerRequestFinishedCallback`.
wrap_ServerRequestFinishedCallback ::
    ServerRequestFinishedCallback ->
    C_ServerRequestFinishedCallback
wrap_ServerRequestFinishedCallback :: ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestFinishedCallback ServerRequestAbortedCallback
_cb Ptr ()
_ Ptr Message
message Ptr ClientContext
client Ptr ()
_ = do
    Message
message' <- ((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
message
    (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
        ServerRequestAbortedCallback
_cb  Message
message' ClientContext
client'


-- | Connect a signal handler for the [requestFinished](#signal:requestFinished) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' server #requestFinished callback
-- @
-- 
-- 
onServerRequestFinished :: (IsServer a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId
onServerRequestFinished :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
onServerRequestFinished a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestFinishedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestFinishedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-finished" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [requestFinished](#signal:requestFinished) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' server #requestFinished callback
-- @
-- 
-- 
afterServerRequestFinished :: (IsServer a, MonadIO m) => a -> ServerRequestFinishedCallback -> m SignalHandlerId
afterServerRequestFinished :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
afterServerRequestFinished a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestFinishedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestFinishedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-finished" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ServerRequestFinishedSignalInfo
instance SignalInfo ServerRequestFinishedSignalInfo where
    type HaskellCallbackType ServerRequestFinishedSignalInfo = ServerRequestFinishedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ServerRequestFinishedCallback cb
        cb'' <- mk_ServerRequestFinishedCallback cb'
        connectSignalFunPtr obj "request-finished" cb'' connectMode detail

#endif

-- signal Server::request-read
-- | Emitted when the server has successfully read a request.
-- /@message@/ will have all of its request-side information
-- filled in, and if the message was authenticated, /@client@/
-- will have information about that. This signal is emitted
-- before any (non-early) handlers are called for the message,
-- and if it sets the message\'s @/status_code/@, then normal
-- handler processing will be skipped.
type ServerRequestReadCallback =
    Soup.Message.Message
    -- ^ /@message@/: the message
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: the client context
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerRequestReadCallback`@.
noServerRequestReadCallback :: Maybe ServerRequestReadCallback
noServerRequestReadCallback :: Maybe ServerRequestAbortedCallback
noServerRequestReadCallback = Maybe ServerRequestAbortedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_ServerRequestReadCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_ServerRequestRead :: MonadIO m => ServerRequestReadCallback -> m (GClosure C_ServerRequestReadCallback)
genClosure_ServerRequestRead :: forall (m :: * -> *).
MonadIO m =>
ServerRequestAbortedCallback
-> m (GClosure C_ServerRequestAbortedCallback)
genClosure_ServerRequestRead ServerRequestAbortedCallback
cb = IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerRequestAbortedCallback)
 -> m (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestReadCallback ServerRequestAbortedCallback
cb
    C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestReadCallback C_ServerRequestAbortedCallback
cb' IO (FunPtr C_ServerRequestAbortedCallback)
-> (FunPtr C_ServerRequestAbortedCallback
    -> IO (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerRequestAbortedCallback
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerRequestReadCallback` into a `C_ServerRequestReadCallback`.
wrap_ServerRequestReadCallback ::
    ServerRequestReadCallback ->
    C_ServerRequestReadCallback
wrap_ServerRequestReadCallback :: ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestReadCallback ServerRequestAbortedCallback
_cb Ptr ()
_ Ptr Message
message Ptr ClientContext
client Ptr ()
_ = do
    Message
message' <- ((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
message
    (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
        ServerRequestAbortedCallback
_cb  Message
message' ClientContext
client'


-- | Connect a signal handler for the [requestRead](#signal:requestRead) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' server #requestRead callback
-- @
-- 
-- 
onServerRequestRead :: (IsServer a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId
onServerRequestRead :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
onServerRequestRead a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestReadCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestReadCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-read" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [requestRead](#signal:requestRead) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' server #requestRead callback
-- @
-- 
-- 
afterServerRequestRead :: (IsServer a, MonadIO m) => a -> ServerRequestReadCallback -> m SignalHandlerId
afterServerRequestRead :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
afterServerRequestRead a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestReadCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestReadCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-read" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ServerRequestReadSignalInfo
instance SignalInfo ServerRequestReadSignalInfo where
    type HaskellCallbackType ServerRequestReadSignalInfo = ServerRequestReadCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ServerRequestReadCallback cb
        cb'' <- mk_ServerRequestReadCallback cb'
        connectSignalFunPtr obj "request-read" cb'' connectMode detail

#endif

-- signal Server::request-started
-- | Emitted when the server has started reading a new request.
-- /@message@/ will be completely blank; not even the
-- Request-Line will have been read yet. About the only thing
-- you can usefully do with it is connect to its signals.
-- 
-- If the request is read successfully, this will eventually
-- be followed by a t'GI.Soup.Objects.Server.Server'::@/request_read/@ signal. If a
-- response is then sent, the request processing will end with
-- a t'GI.Soup.Objects.Server.Server'::@/request_finished/@ signal. If a network error
-- occurs, the processing will instead end with
-- t'GI.Soup.Objects.Server.Server'::@/request_aborted/@.
type ServerRequestStartedCallback =
    Soup.Message.Message
    -- ^ /@message@/: the new message
    -> Soup.ClientContext.ClientContext
    -- ^ /@client@/: the client context
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ServerRequestStartedCallback`@.
noServerRequestStartedCallback :: Maybe ServerRequestStartedCallback
noServerRequestStartedCallback :: Maybe ServerRequestAbortedCallback
noServerRequestStartedCallback = Maybe ServerRequestAbortedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_ServerRequestStartedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Message.Message ->
    Ptr Soup.ClientContext.ClientContext ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_ServerRequestStarted :: MonadIO m => ServerRequestStartedCallback -> m (GClosure C_ServerRequestStartedCallback)
genClosure_ServerRequestStarted :: forall (m :: * -> *).
MonadIO m =>
ServerRequestAbortedCallback
-> m (GClosure C_ServerRequestAbortedCallback)
genClosure_ServerRequestStarted ServerRequestAbortedCallback
cb = IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ServerRequestAbortedCallback)
 -> m (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
-> m (GClosure C_ServerRequestAbortedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestStartedCallback ServerRequestAbortedCallback
cb
    C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestStartedCallback C_ServerRequestAbortedCallback
cb' IO (FunPtr C_ServerRequestAbortedCallback)
-> (FunPtr C_ServerRequestAbortedCallback
    -> IO (GClosure C_ServerRequestAbortedCallback))
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ServerRequestAbortedCallback
-> IO (GClosure C_ServerRequestAbortedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ServerRequestStartedCallback` into a `C_ServerRequestStartedCallback`.
wrap_ServerRequestStartedCallback ::
    ServerRequestStartedCallback ->
    C_ServerRequestStartedCallback
wrap_ServerRequestStartedCallback :: ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestStartedCallback ServerRequestAbortedCallback
_cb Ptr ()
_ Ptr Message
message Ptr ClientContext
client Ptr ()
_ = do
    Message
message' <- ((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
message
    (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
        ServerRequestAbortedCallback
_cb  Message
message' ClientContext
client'


-- | Connect a signal handler for the [requestStarted](#signal:requestStarted) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' server #requestStarted callback
-- @
-- 
-- 
onServerRequestStarted :: (IsServer a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId
onServerRequestStarted :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
onServerRequestStarted a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestStartedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestStartedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-started" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [requestStarted](#signal:requestStarted) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' server #requestStarted callback
-- @
-- 
-- 
afterServerRequestStarted :: (IsServer a, MonadIO m) => a -> ServerRequestStartedCallback -> m SignalHandlerId
afterServerRequestStarted :: forall a (m :: * -> *).
(IsServer a, MonadIO m) =>
a -> ServerRequestAbortedCallback -> m SignalHandlerId
afterServerRequestStarted a
obj ServerRequestAbortedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_ServerRequestAbortedCallback
cb' = ServerRequestAbortedCallback -> C_ServerRequestAbortedCallback
wrap_ServerRequestStartedCallback ServerRequestAbortedCallback
cb
    FunPtr C_ServerRequestAbortedCallback
cb'' <- C_ServerRequestAbortedCallback
-> IO (FunPtr C_ServerRequestAbortedCallback)
mk_ServerRequestStartedCallback C_ServerRequestAbortedCallback
cb'
    a
-> Text
-> FunPtr C_ServerRequestAbortedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"request-started" FunPtr C_ServerRequestAbortedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data ServerRequestStartedSignalInfo
instance SignalInfo ServerRequestStartedSignalInfo where
    type HaskellCallbackType ServerRequestStartedSignalInfo = ServerRequestStartedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ServerRequestStartedCallback cb
        cb'' <- mk_ServerRequestStartedCallback cb'
        connectSignalFunPtr obj "request-started" cb'' connectMode detail

#endif

-- VVV Prop "async-context"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@async-context@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #asyncContext
-- @
getServerAsyncContext :: (MonadIO m, IsServer o) => o -> m (Ptr ())
getServerAsyncContext :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m (Ptr ())
getServerAsyncContext o
obj = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Ptr ())
forall a b. GObject a => a -> String -> IO (Ptr b)
B.Properties.getObjectPropertyPtr o
obj String
"async-context"

-- | Construct a `GValueConstruct` with valid value for the “@async-context@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerAsyncContext :: (IsServer o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
constructServerAsyncContext :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Ptr () -> m (GValueConstruct o)
constructServerAsyncContext Ptr ()
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Ptr () -> IO (GValueConstruct o)
forall b o. String -> Ptr b -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyPtr String
"async-context" Ptr ()
val

#if defined(ENABLE_OVERLOADING)
data ServerAsyncContextPropertyInfo
instance AttrInfo ServerAsyncContextPropertyInfo where
    type AttrAllowedOps ServerAsyncContextPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint ServerAsyncContextPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerAsyncContextPropertyInfo = (~) (Ptr ())
    type AttrTransferTypeConstraint ServerAsyncContextPropertyInfo = (~) (Ptr ())
    type AttrTransferType ServerAsyncContextPropertyInfo = Ptr ()
    type AttrGetType ServerAsyncContextPropertyInfo = (Ptr ())
    type AttrLabel ServerAsyncContextPropertyInfo = "async-context"
    type AttrOrigin ServerAsyncContextPropertyInfo = Server
    attrGet = getServerAsyncContext
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerAsyncContext
    attrClear = undefined
#endif

-- VVV Prop "http-aliases"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@http-aliases@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #httpAliases
-- @
getServerHttpAliases :: (MonadIO m, IsServer o) => o -> m (Maybe [T.Text])
getServerHttpAliases :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe [Text])
getServerHttpAliases o
obj = IO (Maybe [Text]) -> m (Maybe [Text])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe [Text]) -> m (Maybe [Text]))
-> IO (Maybe [Text]) -> m (Maybe [Text])
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe [Text])
forall a. GObject a => a -> String -> IO (Maybe [Text])
B.Properties.getObjectPropertyStringArray o
obj String
"http-aliases"

-- | Set the value of the “@http-aliases@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' server [ #httpAliases 'Data.GI.Base.Attributes.:=' value ]
-- @
setServerHttpAliases :: (MonadIO m, IsServer o) => o -> [T.Text] -> m ()
setServerHttpAliases :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> [Text] -> m ()
setServerHttpAliases o
obj [Text]
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe [Text] -> IO ()
forall a. GObject a => a -> String -> Maybe [Text] -> IO ()
B.Properties.setObjectPropertyStringArray o
obj String
"http-aliases" ([Text] -> Maybe [Text]
forall a. a -> Maybe a
Just [Text]
val)

-- | Construct a `GValueConstruct` with valid value for the “@http-aliases@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerHttpAliases :: (IsServer o, MIO.MonadIO m) => [T.Text] -> m (GValueConstruct o)
constructServerHttpAliases :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
[Text] -> m (GValueConstruct o)
constructServerHttpAliases [Text]
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe [Text] -> IO (GValueConstruct o)
forall o. String -> Maybe [Text] -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyStringArray String
"http-aliases" ([Text] -> Maybe [Text]
forall a. a -> Maybe a
P.Just [Text]
val)

-- | Set the value of the “@http-aliases@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #httpAliases
-- @
clearServerHttpAliases :: (MonadIO m, IsServer o) => o -> m ()
clearServerHttpAliases :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m ()
clearServerHttpAliases o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe [Text] -> IO ()
forall a. GObject a => a -> String -> Maybe [Text] -> IO ()
B.Properties.setObjectPropertyStringArray o
obj String
"http-aliases" (Maybe [Text]
forall a. Maybe a
Nothing :: Maybe [T.Text])

#if defined(ENABLE_OVERLOADING)
data ServerHttpAliasesPropertyInfo
instance AttrInfo ServerHttpAliasesPropertyInfo where
    type AttrAllowedOps ServerHttpAliasesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerHttpAliasesPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerHttpAliasesPropertyInfo = (~) [T.Text]
    type AttrTransferTypeConstraint ServerHttpAliasesPropertyInfo = (~) [T.Text]
    type AttrTransferType ServerHttpAliasesPropertyInfo = [T.Text]
    type AttrGetType ServerHttpAliasesPropertyInfo = (Maybe [T.Text])
    type AttrLabel ServerHttpAliasesPropertyInfo = "http-aliases"
    type AttrOrigin ServerHttpAliasesPropertyInfo = Server
    attrGet = getServerHttpAliases
    attrSet = setServerHttpAliases
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerHttpAliases
    attrClear = clearServerHttpAliases
#endif

-- VVV Prop "https-aliases"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@https-aliases@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #httpsAliases
-- @
getServerHttpsAliases :: (MonadIO m, IsServer o) => o -> m (Maybe [T.Text])
getServerHttpsAliases :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe [Text])
getServerHttpsAliases o
obj = IO (Maybe [Text]) -> m (Maybe [Text])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe [Text]) -> m (Maybe [Text]))
-> IO (Maybe [Text]) -> m (Maybe [Text])
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe [Text])
forall a. GObject a => a -> String -> IO (Maybe [Text])
B.Properties.getObjectPropertyStringArray o
obj String
"https-aliases"

-- | Set the value of the “@https-aliases@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' server [ #httpsAliases 'Data.GI.Base.Attributes.:=' value ]
-- @
setServerHttpsAliases :: (MonadIO m, IsServer o) => o -> [T.Text] -> m ()
setServerHttpsAliases :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> [Text] -> m ()
setServerHttpsAliases o
obj [Text]
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe [Text] -> IO ()
forall a. GObject a => a -> String -> Maybe [Text] -> IO ()
B.Properties.setObjectPropertyStringArray o
obj String
"https-aliases" ([Text] -> Maybe [Text]
forall a. a -> Maybe a
Just [Text]
val)

-- | Construct a `GValueConstruct` with valid value for the “@https-aliases@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerHttpsAliases :: (IsServer o, MIO.MonadIO m) => [T.Text] -> m (GValueConstruct o)
constructServerHttpsAliases :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
[Text] -> m (GValueConstruct o)
constructServerHttpsAliases [Text]
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe [Text] -> IO (GValueConstruct o)
forall o. String -> Maybe [Text] -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyStringArray String
"https-aliases" ([Text] -> Maybe [Text]
forall a. a -> Maybe a
P.Just [Text]
val)

-- | Set the value of the “@https-aliases@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #httpsAliases
-- @
clearServerHttpsAliases :: (MonadIO m, IsServer o) => o -> m ()
clearServerHttpsAliases :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m ()
clearServerHttpsAliases o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe [Text] -> IO ()
forall a. GObject a => a -> String -> Maybe [Text] -> IO ()
B.Properties.setObjectPropertyStringArray o
obj String
"https-aliases" (Maybe [Text]
forall a. Maybe a
Nothing :: Maybe [T.Text])

#if defined(ENABLE_OVERLOADING)
data ServerHttpsAliasesPropertyInfo
instance AttrInfo ServerHttpsAliasesPropertyInfo where
    type AttrAllowedOps ServerHttpsAliasesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerHttpsAliasesPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerHttpsAliasesPropertyInfo = (~) [T.Text]
    type AttrTransferTypeConstraint ServerHttpsAliasesPropertyInfo = (~) [T.Text]
    type AttrTransferType ServerHttpsAliasesPropertyInfo = [T.Text]
    type AttrGetType ServerHttpsAliasesPropertyInfo = (Maybe [T.Text])
    type AttrLabel ServerHttpsAliasesPropertyInfo = "https-aliases"
    type AttrOrigin ServerHttpsAliasesPropertyInfo = Server
    attrGet = getServerHttpsAliases
    attrSet = setServerHttpsAliases
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerHttpsAliases
    attrClear = clearServerHttpsAliases
#endif

-- VVV Prop "interface"
   -- Type: TInterface (Name {namespace = "Soup", name = "Address"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@interface@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #interface
-- @
getServerInterface :: (MonadIO m, IsServer o) => o -> m (Maybe Soup.Address.Address)
getServerInterface :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe Address)
getServerInterface o
obj = IO (Maybe Address) -> m (Maybe Address)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Address) -> m (Maybe Address))
-> IO (Maybe Address) -> m (Maybe Address)
forall a b. (a -> b) -> a -> b
$ o
-> String -> (ManagedPtr Address -> Address) -> IO (Maybe Address)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"interface" ManagedPtr Address -> Address
Soup.Address.Address

-- | Construct a `GValueConstruct` with valid value for the “@interface@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerInterface :: (IsServer o, MIO.MonadIO m, Soup.Address.IsAddress a) => a -> m (GValueConstruct o)
constructServerInterface :: forall o (m :: * -> *) a.
(IsServer o, MonadIO m, IsAddress a) =>
a -> m (GValueConstruct o)
constructServerInterface a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"interface" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

#if defined(ENABLE_OVERLOADING)
data ServerInterfacePropertyInfo
instance AttrInfo ServerInterfacePropertyInfo where
    type AttrAllowedOps ServerInterfacePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerInterfacePropertyInfo = IsServer
    type AttrSetTypeConstraint ServerInterfacePropertyInfo = Soup.Address.IsAddress
    type AttrTransferTypeConstraint ServerInterfacePropertyInfo = Soup.Address.IsAddress
    type AttrTransferType ServerInterfacePropertyInfo = Soup.Address.Address
    type AttrGetType ServerInterfacePropertyInfo = (Maybe Soup.Address.Address)
    type AttrLabel ServerInterfacePropertyInfo = "interface"
    type AttrOrigin ServerInterfacePropertyInfo = Server
    attrGet = getServerInterface
    attrSet = undefined
    attrTransfer _ v = do
        unsafeCastTo Soup.Address.Address v
    attrConstruct = constructServerInterface
    attrClear = undefined
#endif

-- VVV Prop "port"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@port@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #port
-- @
getServerPort :: (MonadIO m, IsServer o) => o -> m Word32
getServerPort :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m Word32
getServerPort o
obj = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
B.Properties.getObjectPropertyUInt32 o
obj String
"port"

-- | Construct a `GValueConstruct` with valid value for the “@port@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerPort :: (IsServer o, MIO.MonadIO m) => Word32 -> m (GValueConstruct o)
constructServerPort :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Word32 -> m (GValueConstruct o)
constructServerPort Word32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 String
"port" Word32
val

#if defined(ENABLE_OVERLOADING)
data ServerPortPropertyInfo
instance AttrInfo ServerPortPropertyInfo where
    type AttrAllowedOps ServerPortPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint ServerPortPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerPortPropertyInfo = (~) Word32
    type AttrTransferTypeConstraint ServerPortPropertyInfo = (~) Word32
    type AttrTransferType ServerPortPropertyInfo = Word32
    type AttrGetType ServerPortPropertyInfo = Word32
    type AttrLabel ServerPortPropertyInfo = "port"
    type AttrOrigin ServerPortPropertyInfo = Server
    attrGet = getServerPort
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerPort
    attrClear = undefined
#endif

-- VVV Prop "raw-paths"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@raw-paths@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #rawPaths
-- @
getServerRawPaths :: (MonadIO m, IsServer o) => o -> m Bool
getServerRawPaths :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m Bool
getServerRawPaths o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj String
"raw-paths"

-- | Construct a `GValueConstruct` with valid value for the “@raw-paths@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerRawPaths :: (IsServer o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructServerRawPaths :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructServerRawPaths Bool
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"raw-paths" Bool
val

#if defined(ENABLE_OVERLOADING)
data ServerRawPathsPropertyInfo
instance AttrInfo ServerRawPathsPropertyInfo where
    type AttrAllowedOps ServerRawPathsPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint ServerRawPathsPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerRawPathsPropertyInfo = (~) Bool
    type AttrTransferTypeConstraint ServerRawPathsPropertyInfo = (~) Bool
    type AttrTransferType ServerRawPathsPropertyInfo = Bool
    type AttrGetType ServerRawPathsPropertyInfo = Bool
    type AttrLabel ServerRawPathsPropertyInfo = "raw-paths"
    type AttrOrigin ServerRawPathsPropertyInfo = Server
    attrGet = getServerRawPaths
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerRawPaths
    attrClear = undefined
#endif

-- VVV Prop "server-header"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@server-header@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #serverHeader
-- @
getServerServerHeader :: (MonadIO m, IsServer o) => o -> m (Maybe T.Text)
getServerServerHeader :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe Text)
getServerServerHeader o
obj = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"server-header"

-- | Set the value of the “@server-header@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' server [ #serverHeader 'Data.GI.Base.Attributes.:=' value ]
-- @
setServerServerHeader :: (MonadIO m, IsServer o) => o -> T.Text -> m ()
setServerServerHeader :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> Text -> m ()
setServerServerHeader o
obj Text
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
B.Properties.setObjectPropertyString o
obj String
"server-header" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

-- | Construct a `GValueConstruct` with valid value for the “@server-header@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerServerHeader :: (IsServer o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructServerServerHeader :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructServerServerHeader Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"server-header" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)

-- | Set the value of the “@server-header@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #serverHeader
-- @
clearServerServerHeader :: (MonadIO m, IsServer o) => o -> m ()
clearServerServerHeader :: forall (m :: * -> *) o. (MonadIO m, IsServer o) => o -> m ()
clearServerServerHeader o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
B.Properties.setObjectPropertyString o
obj String
"server-header" (Maybe Text
forall a. Maybe a
Nothing :: Maybe T.Text)

#if defined(ENABLE_OVERLOADING)
data ServerServerHeaderPropertyInfo
instance AttrInfo ServerServerHeaderPropertyInfo where
    type AttrAllowedOps ServerServerHeaderPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerServerHeaderPropertyInfo = IsServer
    type AttrSetTypeConstraint ServerServerHeaderPropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint ServerServerHeaderPropertyInfo = (~) T.Text
    type AttrTransferType ServerServerHeaderPropertyInfo = T.Text
    type AttrGetType ServerServerHeaderPropertyInfo = (Maybe T.Text)
    type AttrLabel ServerServerHeaderPropertyInfo = "server-header"
    type AttrOrigin ServerServerHeaderPropertyInfo = Server
    attrGet = getServerServerHeader
    attrSet = setServerServerHeader
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerServerHeader
    attrClear = clearServerServerHeader
#endif

-- VVV Prop "ssl-cert-file"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@ssl-cert-file@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #sslCertFile
-- @
getServerSslCertFile :: (MonadIO m, IsServer o) => o -> m (Maybe T.Text)
getServerSslCertFile :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe Text)
getServerSslCertFile o
obj = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"ssl-cert-file"

-- | Construct a `GValueConstruct` with valid value for the “@ssl-cert-file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerSslCertFile :: (IsServer o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructServerSslCertFile :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructServerSslCertFile Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"ssl-cert-file" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)

#if defined(ENABLE_OVERLOADING)
data ServerSslCertFilePropertyInfo
instance AttrInfo ServerSslCertFilePropertyInfo where
    type AttrAllowedOps ServerSslCertFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerSslCertFilePropertyInfo = IsServer
    type AttrSetTypeConstraint ServerSslCertFilePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint ServerSslCertFilePropertyInfo = (~) T.Text
    type AttrTransferType ServerSslCertFilePropertyInfo = T.Text
    type AttrGetType ServerSslCertFilePropertyInfo = (Maybe T.Text)
    type AttrLabel ServerSslCertFilePropertyInfo = "ssl-cert-file"
    type AttrOrigin ServerSslCertFilePropertyInfo = Server
    attrGet = getServerSslCertFile
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerSslCertFile
    attrClear = undefined
#endif

-- VVV Prop "ssl-key-file"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@ssl-key-file@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #sslKeyFile
-- @
getServerSslKeyFile :: (MonadIO m, IsServer o) => o -> m (Maybe T.Text)
getServerSslKeyFile :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe Text)
getServerSslKeyFile o
obj = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"ssl-key-file"

-- | Construct a `GValueConstruct` with valid value for the “@ssl-key-file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerSslKeyFile :: (IsServer o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructServerSslKeyFile :: forall o (m :: * -> *).
(IsServer o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructServerSslKeyFile Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"ssl-key-file" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)

#if defined(ENABLE_OVERLOADING)
data ServerSslKeyFilePropertyInfo
instance AttrInfo ServerSslKeyFilePropertyInfo where
    type AttrAllowedOps ServerSslKeyFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerSslKeyFilePropertyInfo = IsServer
    type AttrSetTypeConstraint ServerSslKeyFilePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint ServerSslKeyFilePropertyInfo = (~) T.Text
    type AttrTransferType ServerSslKeyFilePropertyInfo = T.Text
    type AttrGetType ServerSslKeyFilePropertyInfo = (Maybe T.Text)
    type AttrLabel ServerSslKeyFilePropertyInfo = "ssl-key-file"
    type AttrOrigin ServerSslKeyFilePropertyInfo = Server
    attrGet = getServerSslKeyFile
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructServerSslKeyFile
    attrClear = undefined
#endif

-- VVV Prop "tls-certificate"
   -- Type: TInterface (Name {namespace = "Gio", name = "TlsCertificate"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@tls-certificate@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' server #tlsCertificate
-- @
getServerTlsCertificate :: (MonadIO m, IsServer o) => o -> m (Maybe Gio.TlsCertificate.TlsCertificate)
getServerTlsCertificate :: forall (m :: * -> *) o.
(MonadIO m, IsServer o) =>
o -> m (Maybe TlsCertificate)
getServerTlsCertificate o
obj = IO (Maybe TlsCertificate) -> m (Maybe TlsCertificate)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe TlsCertificate) -> m (Maybe TlsCertificate))
-> IO (Maybe TlsCertificate) -> m (Maybe TlsCertificate)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr TlsCertificate -> TlsCertificate)
-> IO (Maybe TlsCertificate)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"tls-certificate" ManagedPtr TlsCertificate -> TlsCertificate
Gio.TlsCertificate.TlsCertificate

-- | Construct a `GValueConstruct` with valid value for the “@tls-certificate@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructServerTlsCertificate :: (IsServer o, MIO.MonadIO m, Gio.TlsCertificate.IsTlsCertificate a) => a -> m (GValueConstruct o)
constructServerTlsCertificate :: forall o (m :: * -> *) a.
(IsServer o, MonadIO m, IsTlsCertificate a) =>
a -> m (GValueConstruct o)
constructServerTlsCertificate a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"tls-certificate" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

#if defined(ENABLE_OVERLOADING)
data ServerTlsCertificatePropertyInfo
instance AttrInfo ServerTlsCertificatePropertyInfo where
    type AttrAllowedOps ServerTlsCertificatePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ServerTlsCertificatePropertyInfo = IsServer
    type AttrSetTypeConstraint ServerTlsCertificatePropertyInfo = Gio.TlsCertificate.IsTlsCertificate
    type AttrTransferTypeConstraint ServerTlsCertificatePropertyInfo = Gio.TlsCertificate.IsTlsCertificate
    type AttrTransferType ServerTlsCertificatePropertyInfo = Gio.TlsCertificate.TlsCertificate
    type AttrGetType ServerTlsCertificatePropertyInfo = (Maybe Gio.TlsCertificate.TlsCertificate)
    type AttrLabel ServerTlsCertificatePropertyInfo = "tls-certificate"
    type AttrOrigin ServerTlsCertificatePropertyInfo = Server
    attrGet = getServerTlsCertificate
    attrSet = undefined
    attrTransfer _ v = do
        unsafeCastTo Gio.TlsCertificate.TlsCertificate v
    attrConstruct = constructServerTlsCertificate
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Server
type instance O.AttributeList Server = ServerAttributeList
type ServerAttributeList = ('[ '("asyncContext", ServerAsyncContextPropertyInfo), '("httpAliases", ServerHttpAliasesPropertyInfo), '("httpsAliases", ServerHttpsAliasesPropertyInfo), '("interface", ServerInterfacePropertyInfo), '("port", ServerPortPropertyInfo), '("rawPaths", ServerRawPathsPropertyInfo), '("serverHeader", ServerServerHeaderPropertyInfo), '("sslCertFile", ServerSslCertFilePropertyInfo), '("sslKeyFile", ServerSslKeyFilePropertyInfo), '("tlsCertificate", ServerTlsCertificatePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
serverAsyncContext :: AttrLabelProxy "asyncContext"
serverAsyncContext = AttrLabelProxy

serverHttpAliases :: AttrLabelProxy "httpAliases"
serverHttpAliases = AttrLabelProxy

serverHttpsAliases :: AttrLabelProxy "httpsAliases"
serverHttpsAliases = AttrLabelProxy

serverInterface :: AttrLabelProxy "interface"
serverInterface = AttrLabelProxy

serverPort :: AttrLabelProxy "port"
serverPort = AttrLabelProxy

serverRawPaths :: AttrLabelProxy "rawPaths"
serverRawPaths = AttrLabelProxy

serverServerHeader :: AttrLabelProxy "serverHeader"
serverServerHeader = AttrLabelProxy

serverSslCertFile :: AttrLabelProxy "sslCertFile"
serverSslCertFile = AttrLabelProxy

serverSslKeyFile :: AttrLabelProxy "sslKeyFile"
serverSslKeyFile = AttrLabelProxy

serverTlsCertificate :: AttrLabelProxy "tlsCertificate"
serverTlsCertificate = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Server = ServerSignalList
type ServerSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("requestAborted", ServerRequestAbortedSignalInfo), '("requestFinished", ServerRequestFinishedSignalInfo), '("requestRead", ServerRequestReadSignalInfo), '("requestStarted", ServerRequestStartedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Server::accept_iostream
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IOStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GIOStream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "local_addr"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketAddress" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the local #GSocketAddress associated with the @stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "remote_addr"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketAddress" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the remote #GSocketAddress associated with the @stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_accept_iostream" soup_server_accept_iostream :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Gio.IOStream.IOStream ->            -- stream : TInterface (Name {namespace = "Gio", name = "IOStream"})
    Ptr Gio.SocketAddress.SocketAddress ->  -- local_addr : TInterface (Name {namespace = "Gio", name = "SocketAddress"})
    Ptr Gio.SocketAddress.SocketAddress ->  -- remote_addr : TInterface (Name {namespace = "Gio", name = "SocketAddress"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Add a new client stream to the /@server@/.
-- 
-- /Since: 2.50/
serverAcceptIostream ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Gio.IOStream.IsIOStream b, Gio.SocketAddress.IsSocketAddress c, Gio.SocketAddress.IsSocketAddress d) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@stream@/: a t'GI.Gio.Objects.IOStream.IOStream'
    -> Maybe (c)
    -- ^ /@localAddr@/: the local t'GI.Gio.Objects.SocketAddress.SocketAddress' associated with the /@stream@/
    -> Maybe (d)
    -- ^ /@remoteAddr@/: the remote t'GI.Gio.Objects.SocketAddress.SocketAddress' associated with the /@stream@/
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverAcceptIostream :: forall (m :: * -> *) a b c d.
(HasCallStack, MonadIO m, IsServer a, IsIOStream b,
 IsSocketAddress c, IsSocketAddress d) =>
a -> b -> Maybe c -> Maybe d -> m ()
serverAcceptIostream a
server b
stream Maybe c
localAddr Maybe d
remoteAddr = 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 IOStream
stream' <- b -> IO (Ptr IOStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
stream
    Ptr SocketAddress
maybeLocalAddr <- case Maybe c
localAddr of
        Maybe c
Nothing -> Ptr SocketAddress -> IO (Ptr SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
forall a. Ptr a
nullPtr
        Just c
jLocalAddr -> do
            Ptr SocketAddress
jLocalAddr' <- c -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jLocalAddr
            Ptr SocketAddress -> IO (Ptr SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
jLocalAddr'
    Ptr SocketAddress
maybeRemoteAddr <- case Maybe d
remoteAddr of
        Maybe d
Nothing -> Ptr SocketAddress -> IO (Ptr SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
forall a. Ptr a
nullPtr
        Just d
jRemoteAddr -> do
            Ptr SocketAddress
jRemoteAddr' <- d -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr d
jRemoteAddr
            Ptr SocketAddress -> IO (Ptr SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
jRemoteAddr'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server
-> Ptr IOStream
-> Ptr SocketAddress
-> Ptr SocketAddress
-> Ptr (Ptr GError)
-> IO CInt
soup_server_accept_iostream Ptr Server
server' Ptr IOStream
stream' Ptr SocketAddress
maybeLocalAddr Ptr SocketAddress
maybeRemoteAddr
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
stream
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
localAddr c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe d -> (d -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe d
remoteAddr d -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerAcceptIostreamMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (d) -> m ()), MonadIO m, IsServer a, Gio.IOStream.IsIOStream b, Gio.SocketAddress.IsSocketAddress c, Gio.SocketAddress.IsSocketAddress d) => O.OverloadedMethod ServerAcceptIostreamMethodInfo a signature where
    overloadedMethod = serverAcceptIostream

instance O.OverloadedMethodInfo ServerAcceptIostreamMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAcceptIostream",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAcceptIostream"
        }


#endif

-- method Server::add_auth_domain
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "auth_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
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_add_auth_domain" soup_server_add_auth_domain :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Soup.AuthDomain.AuthDomain ->       -- auth_domain : TInterface (Name {namespace = "Soup", name = "AuthDomain"})
    IO ()

-- | Adds an authentication domain to /@server@/. Each auth domain will
-- have the chance to require authentication for each request that
-- comes in; normally auth domains will require authentication for
-- requests on certain paths that they have been set up to watch, or
-- that meet other criteria set by the caller. If an auth domain
-- determines that a request requires authentication (and the request
-- doesn\'t contain authentication), /@server@/ will automatically reject
-- the request with an appropriate status (401 Unauthorized or 407
-- Proxy Authentication Required). If the request used the
-- \"100-continue\" Expectation, /@server@/ will reject it before the
-- request body is sent.
serverAddAuthDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Soup.AuthDomain.IsAuthDomain b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@authDomain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> m ()
serverAddAuthDomain :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) =>
a -> b -> m ()
serverAddAuthDomain a
server b
authDomain = 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 AuthDomain
authDomain' <- b -> IO (Ptr AuthDomain)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
authDomain
    Ptr Server -> Ptr AuthDomain -> IO ()
soup_server_add_auth_domain Ptr Server
server' Ptr AuthDomain
authDomain'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
authDomain
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerAddAuthDomainMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsServer a, Soup.AuthDomain.IsAuthDomain b) => O.OverloadedMethod ServerAddAuthDomainMethodInfo a signature where
    overloadedMethod = serverAddAuthDomain

instance O.OverloadedMethodInfo ServerAddAuthDomainMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAddAuthDomain",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAddAuthDomain"
        }


#endif

-- method Server::add_early_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the toplevel path for the handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ServerCallback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to invoke for requests under @path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 3
--           , argDestroy = 4
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "destroy notifier to free @user_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_add_early_handler" soup_server_add_early_handler :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CString ->                              -- path : TBasicType TUTF8
    FunPtr Soup.Callbacks.C_ServerCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "ServerCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

-- | Adds an \"early\" handler to /@server@/ for requests under /@path@/. Note
-- that \"normal\" and \"early\" handlers are matched up together, so if
-- you add a normal handler for \"\/foo\" and an early handler for
-- \"\/foo\/bar\", then a request to \"\/foo\/bar\" (or any path below it)
-- will run only the early handler. (But if you add both handlers at
-- the same path, then both will get run.)
-- 
-- For requests under /@path@/ (that have not already been assigned a
-- status code by a t'GI.Soup.Objects.AuthDomain.AuthDomain' or a signal handler), /@callback@/
-- will be invoked after receiving the request headers, but before
-- receiving the request body; the message\'s t'GI.Soup.Objects.Message.Message':@/method/@ and
-- t'GI.Soup.Objects.Message.Message':@/request-headers/@ fields will be filled in.
-- 
-- Early handlers are generally used for processing requests with
-- request bodies in a streaming fashion. If you determine that the
-- request will contain a message body, normally you would call
-- 'GI.Soup.Structs.MessageBody.messageBodySetAccumulate' on the message\'s
-- t'GI.Soup.Objects.Message.Message':@/request-body/@ to turn off request-body accumulation,
-- and connect to the message\'s [gotChunk]("GI.Soup.Objects.Message#g:signal:gotChunk") signal to
-- process each chunk as it comes in.
-- 
-- To complete the message processing after the full message body has
-- been read, you can either also connect to [gotBody]("GI.Soup.Objects.Message#g:signal:gotBody"),
-- or else you can register a non-early handler for /@path@/ as well. As
-- long as you have not set the t'GI.Soup.Objects.Message.Message':@/status-code/@ by the time
-- [gotBody]("GI.Soup.Objects.Message#g:signal:gotBody") is emitted, the non-early handler will be
-- run as well.
-- 
-- /Since: 2.50/
serverAddEarlyHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Maybe (T.Text)
    -- ^ /@path@/: the toplevel path for the handler
    -> Soup.Callbacks.ServerCallback
    -- ^ /@callback@/: callback to invoke for requests under /@path@/
    -> m ()
serverAddEarlyHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Maybe Text -> ServerCallback -> m ()
serverAddEarlyHandler a
server Maybe Text
path ServerCallback
callback = 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 CChar
maybePath <- case Maybe Text
path of
        Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
        Just Text
jPath -> do
            Ptr CChar
jPath' <- Text -> IO (Ptr CChar)
textToCString Text
jPath
            Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jPath'
    FunPtr C_ServerCallback
callback' <- C_ServerCallback -> IO (FunPtr C_ServerCallback)
Soup.Callbacks.mk_ServerCallback (Maybe (Ptr (FunPtr C_ServerCallback))
-> ServerCallback_WithClosures -> C_ServerCallback
Soup.Callbacks.wrap_ServerCallback Maybe (Ptr (FunPtr C_ServerCallback))
forall a. Maybe a
Nothing (ServerCallback -> ServerCallback_WithClosures
Soup.Callbacks.drop_closures_ServerCallback ServerCallback
callback))
    let userData :: Ptr ()
userData = FunPtr C_ServerCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_ServerCallback
callback'
    let destroy :: FunPtr (Ptr a -> IO ())
destroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    Ptr Server
-> Ptr CChar
-> FunPtr C_ServerCallback
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO ()
soup_server_add_early_handler Ptr Server
server' Ptr CChar
maybePath FunPtr C_ServerCallback
callback' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
destroy
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybePath
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerAddEarlyHandlerMethodInfo
instance (signature ~ (Maybe (T.Text) -> Soup.Callbacks.ServerCallback -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerAddEarlyHandlerMethodInfo a signature where
    overloadedMethod = serverAddEarlyHandler

instance O.OverloadedMethodInfo ServerAddEarlyHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAddEarlyHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAddEarlyHandler"
        }


#endif

-- method Server::add_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the toplevel path for the handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ServerCallback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to invoke for requests under @path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 3
--           , argDestroy = 4
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "destroy notifier to free @user_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_add_handler" soup_server_add_handler :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CString ->                              -- path : TBasicType TUTF8
    FunPtr Soup.Callbacks.C_ServerCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "ServerCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

-- | Adds a handler to /@server@/ for requests under /@path@/. If /@path@/ is
-- 'P.Nothing' or \"\/\", then this will be the default handler for all
-- requests that don\'t have a more specific handler. (Note though that
-- if you want to handle requests to the special \"*\" URI, you must
-- explicitly register a handler for \"*\"; the default handler will not
-- be used for that case.)
-- 
-- For requests under /@path@/ (that have not already been assigned a
-- status code by a t'GI.Soup.Objects.AuthDomain.AuthDomain', an early @/SoupServerHandler/@, or a
-- signal handler), /@callback@/ will be invoked after receiving the
-- request body; the message\'s t'GI.Soup.Objects.Message.Message':@/method/@,
-- t'GI.Soup.Objects.Message.Message':@/request-headers/@, and t'GI.Soup.Objects.Message.Message':@/request-body/@ fields
-- will be filled in.
-- 
-- After determining what to do with the request, the callback must at
-- a minimum call 'GI.Soup.Objects.Message.messageSetStatus' (or
-- 'GI.Soup.Objects.Message.messageSetStatusFull') on the message to set the response
-- status code. Additionally, it may set response headers and\/or fill
-- in the response body.
-- 
-- If the callback cannot fully fill in the response before returning
-- (eg, if it needs to wait for information from a database, or
-- another network server), it should call 'GI.Soup.Objects.Server.serverPauseMessage'
-- to tell /@server@/ to not send the response right away. When the
-- response is ready, call 'GI.Soup.Objects.Server.serverUnpauseMessage' to cause it
-- to be sent.
-- 
-- To send the response body a bit at a time using \"chunked\" encoding,
-- first call 'GI.Soup.Structs.MessageHeaders.messageHeadersSetEncoding' to set
-- 'GI.Soup.Enums.EncodingChunked' on the t'GI.Soup.Objects.Message.Message':@/response-headers/@. Then call
-- @/soup_message_body_append()/@ (or 'GI.Soup.Structs.MessageBody.messageBodyAppendBuffer')
-- to append each chunk as it becomes ready, and
-- 'GI.Soup.Objects.Server.serverUnpauseMessage' to make sure it\'s running. (The
-- server will automatically pause the message if it is using chunked
-- encoding but no more chunks are available.) When you are done, call
-- 'GI.Soup.Structs.MessageBody.messageBodyComplete' to indicate that no more chunks are
-- coming.
serverAddHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Maybe (T.Text)
    -- ^ /@path@/: the toplevel path for the handler
    -> Soup.Callbacks.ServerCallback
    -- ^ /@callback@/: callback to invoke for requests under /@path@/
    -> m ()
serverAddHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Maybe Text -> ServerCallback -> m ()
serverAddHandler a
server Maybe Text
path ServerCallback
callback = 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 CChar
maybePath <- case Maybe Text
path of
        Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
        Just Text
jPath -> do
            Ptr CChar
jPath' <- Text -> IO (Ptr CChar)
textToCString Text
jPath
            Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jPath'
    FunPtr C_ServerCallback
callback' <- C_ServerCallback -> IO (FunPtr C_ServerCallback)
Soup.Callbacks.mk_ServerCallback (Maybe (Ptr (FunPtr C_ServerCallback))
-> ServerCallback_WithClosures -> C_ServerCallback
Soup.Callbacks.wrap_ServerCallback Maybe (Ptr (FunPtr C_ServerCallback))
forall a. Maybe a
Nothing (ServerCallback -> ServerCallback_WithClosures
Soup.Callbacks.drop_closures_ServerCallback ServerCallback
callback))
    let userData :: Ptr ()
userData = FunPtr C_ServerCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_ServerCallback
callback'
    let destroy :: FunPtr (Ptr a -> IO ())
destroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    Ptr Server
-> Ptr CChar
-> FunPtr C_ServerCallback
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO ()
soup_server_add_handler Ptr Server
server' Ptr CChar
maybePath FunPtr C_ServerCallback
callback' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
destroy
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybePath
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerAddHandlerMethodInfo
instance (signature ~ (Maybe (T.Text) -> Soup.Callbacks.ServerCallback -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerAddHandlerMethodInfo a signature where
    overloadedMethod = serverAddHandler

instance O.OverloadedMethodInfo ServerAddHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAddHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAddHandler"
        }


#endif

-- method Server::add_websocket_extension
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extension_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_add_websocket_extension" soup_server_add_websocket_extension :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CGType ->                               -- extension_type : TBasicType TGType
    IO ()

-- | Add support for a WebSocket extension of the given /@extensionType@/.
-- When a WebSocket client requests an extension of /@extensionType@/,
-- a new t'GI.Soup.Objects.WebsocketExtension.WebsocketExtension' of type /@extensionType@/ will be created
-- to handle the request.
-- 
-- You can also add support for a WebSocket extension to the server at
-- construct time by using the @/SOUP_SERVER_ADD_WEBSOCKET_EXTENSION/@ property.
-- Note that t'GI.Soup.Objects.WebsocketExtensionDeflate.WebsocketExtensionDeflate' is supported by default, use
-- 'GI.Soup.Objects.Server.serverRemoveWebsocketExtension' if you want to disable it.
-- 
-- /Since: 2.68/
serverAddWebsocketExtension ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> GType
    -- ^ /@extensionType@/: a t'GType'
    -> m ()
serverAddWebsocketExtension :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> GType -> m ()
serverAddWebsocketExtension a
server GType
extensionType = 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
    let extensionType' :: CGType
extensionType' = GType -> CGType
gtypeToCGType GType
extensionType
    Ptr Server -> CGType -> IO ()
soup_server_add_websocket_extension Ptr Server
server' CGType
extensionType'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerAddWebsocketExtensionMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerAddWebsocketExtensionMethodInfo a signature where
    overloadedMethod = serverAddWebsocketExtension

instance O.OverloadedMethodInfo ServerAddWebsocketExtensionMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAddWebsocketExtension",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAddWebsocketExtension"
        }


#endif

-- method Server::add_websocket_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the toplevel path for the handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "origin"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the origin of the connection"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "protocols"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the protocols\n  supported by this handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerWebsocketCallback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "callback to invoke for successful WebSocket requests under @path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 5
--           , argDestroy = 6
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "destroy notifier to free @user_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_add_websocket_handler" soup_server_add_websocket_handler :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CString ->                              -- path : TBasicType TUTF8
    CString ->                              -- origin : TBasicType TUTF8
    Ptr CString ->                          -- protocols : TCArray True (-1) (-1) (TBasicType TUTF8)
    FunPtr Soup.Callbacks.C_ServerWebsocketCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "ServerWebsocketCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

-- | Adds a WebSocket handler to /@server@/ for requests under /@path@/. (If
-- /@path@/ is 'P.Nothing' or \"\/\", then this will be the default handler for
-- all requests that don\'t have a more specific handler.)
-- 
-- When a path has a WebSocket handler registered, /@server@/ will check
-- incoming requests for WebSocket handshakes after all other handlers
-- have run (unless some earlier handler has already set a status code
-- on the message), and update the request\'s status, response headers,
-- and response body accordingly.
-- 
-- If /@origin@/ is non-'P.Nothing', then only requests containing a matching
-- \"Origin\" header will be accepted. If /@protocols@/ is non-'P.Nothing', then
-- only requests containing a compatible \"Sec-WebSocket-Protocols\"
-- header will be accepted. More complicated requirements can be
-- handled by adding a normal handler to /@path@/, and having it perform
-- whatever checks are needed (possibly calling
-- @/soup_server_check_websocket_handshake()/@ one or more times), and
-- setting a failure status code if the handshake should be rejected.
serverAddWebsocketHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Maybe (T.Text)
    -- ^ /@path@/: the toplevel path for the handler
    -> Maybe (T.Text)
    -- ^ /@origin@/: the origin of the connection
    -> Maybe ([T.Text])
    -- ^ /@protocols@/: the protocols
    --   supported by this handler
    -> Soup.Callbacks.ServerWebsocketCallback
    -- ^ /@callback@/: callback to invoke for successful WebSocket requests under /@path@/
    -> m ()
serverAddWebsocketHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> ServerWebsocketCallback
-> m ()
serverAddWebsocketHandler a
server Maybe Text
path Maybe Text
origin Maybe [Text]
protocols ServerWebsocketCallback
callback = 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 CChar
maybePath <- case Maybe Text
path of
        Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
        Just Text
jPath -> do
            Ptr CChar
jPath' <- Text -> IO (Ptr CChar)
textToCString Text
jPath
            Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jPath'
    Ptr CChar
maybeOrigin <- case Maybe Text
origin of
        Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
        Just Text
jOrigin -> do
            Ptr CChar
jOrigin' <- Text -> IO (Ptr CChar)
textToCString Text
jOrigin
            Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jOrigin'
    Ptr (Ptr CChar)
maybeProtocols <- case Maybe [Text]
protocols of
        Maybe [Text]
Nothing -> Ptr (Ptr CChar) -> IO (Ptr (Ptr CChar))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr CChar)
forall a. Ptr a
nullPtr
        Just [Text]
jProtocols -> do
            Ptr (Ptr CChar)
jProtocols' <- [Text] -> IO (Ptr (Ptr CChar))
packZeroTerminatedUTF8CArray [Text]
jProtocols
            Ptr (Ptr CChar) -> IO (Ptr (Ptr CChar))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr CChar)
jProtocols'
    FunPtr C_ServerWebsocketCallback
callback' <- C_ServerWebsocketCallback -> IO (FunPtr C_ServerWebsocketCallback)
Soup.Callbacks.mk_ServerWebsocketCallback (Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
-> ServerWebsocketCallback_WithClosures
-> C_ServerWebsocketCallback
Soup.Callbacks.wrap_ServerWebsocketCallback Maybe (Ptr (FunPtr C_ServerWebsocketCallback))
forall a. Maybe a
Nothing (ServerWebsocketCallback -> ServerWebsocketCallback_WithClosures
Soup.Callbacks.drop_closures_ServerWebsocketCallback ServerWebsocketCallback
callback))
    let userData :: Ptr ()
userData = FunPtr C_ServerWebsocketCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_ServerWebsocketCallback
callback'
    let destroy :: FunPtr (Ptr a -> IO ())
destroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    Ptr Server
-> Ptr CChar
-> Ptr CChar
-> Ptr (Ptr CChar)
-> FunPtr C_ServerWebsocketCallback
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO ()
soup_server_add_websocket_handler Ptr Server
server' Ptr CChar
maybePath Ptr CChar
maybeOrigin Ptr (Ptr CChar)
maybeProtocols FunPtr C_ServerWebsocketCallback
callback' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
destroy
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybePath
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeOrigin
    (Ptr CChar -> IO ()) -> Ptr (Ptr CChar) -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CChar)
maybeProtocols
    Ptr (Ptr CChar) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CChar)
maybeProtocols
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerAddWebsocketHandlerMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> Maybe ([T.Text]) -> Soup.Callbacks.ServerWebsocketCallback -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerAddWebsocketHandlerMethodInfo a signature where
    overloadedMethod = serverAddWebsocketHandler

instance O.OverloadedMethodInfo ServerAddWebsocketHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverAddWebsocketHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverAddWebsocketHandler"
        }


#endif

-- method Server::disconnect
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_disconnect" soup_server_disconnect :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO ()

-- | Closes and frees /@server@/\'s listening sockets. If you are using the
-- old t'GI.Soup.Objects.Server.Server' APIs, this also includes the effect of
-- 'GI.Soup.Objects.Server.serverQuit'.
-- 
-- Note that if there are currently requests in progress on /@server@/,
-- that they will continue to be processed if /@server@/\'s t'GI.GLib.Structs.MainContext.MainContext'
-- is still running.
-- 
-- You can call 'GI.Soup.Objects.Server.serverListen', etc, after calling this function
-- if you want to start listening again.
serverDisconnect ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m ()
serverDisconnect :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m ()
serverDisconnect a
server = 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 Server -> IO ()
soup_server_disconnect Ptr Server
server'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerDisconnectMethodInfo
instance (signature ~ (m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerDisconnectMethodInfo a signature where
    overloadedMethod = serverDisconnect

instance O.OverloadedMethodInfo ServerDisconnectMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverDisconnect",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverDisconnect"
        }


#endif

-- method Server::get_async_context
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "MainContext" })
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_get_async_context" soup_server_get_async_context :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO (Ptr GLib.MainContext.MainContext)

{-# DEPRECATED serverGetAsyncContext ["If you are using 'GI.Soup.Objects.Server.serverListen', etc, then","the server listens on the thread-default t'GI.GLib.Structs.MainContext.MainContext', and this","property is ignored."] #-}
-- | Gets /@server@/\'s async_context, if you are using the old API. (With
-- the new API, the server runs in the thread\'s thread-default
-- t'GI.GLib.Structs.MainContext.MainContext', regardless of what this method returns.)
-- 
-- This does not add a ref to the context, so you will need to ref it
-- yourself if you want it to outlive its server.
serverGetAsyncContext ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m (Maybe GLib.MainContext.MainContext)
    -- ^ __Returns:__ /@server@/\'s t'GI.GLib.Structs.MainContext.MainContext',
    -- which may be 'P.Nothing'
serverGetAsyncContext :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m (Maybe MainContext)
serverGetAsyncContext a
server = IO (Maybe MainContext) -> m (Maybe MainContext)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe MainContext) -> m (Maybe MainContext))
-> IO (Maybe MainContext) -> m (Maybe MainContext)
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 MainContext
result <- Ptr Server -> IO (Ptr MainContext)
soup_server_get_async_context Ptr Server
server'
    Maybe MainContext
maybeResult <- Ptr MainContext
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr MainContext
result ((Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext))
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. (a -> b) -> a -> b
$ \Ptr MainContext
result' -> do
        MainContext
result'' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MainContext -> MainContext
GLib.MainContext.MainContext) Ptr MainContext
result'
        MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Maybe MainContext -> IO (Maybe MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe MainContext
maybeResult

#if defined(ENABLE_OVERLOADING)
data ServerGetAsyncContextMethodInfo
instance (signature ~ (m (Maybe GLib.MainContext.MainContext)), MonadIO m, IsServer a) => O.OverloadedMethod ServerGetAsyncContextMethodInfo a signature where
    overloadedMethod = serverGetAsyncContext

instance O.OverloadedMethodInfo ServerGetAsyncContextMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverGetAsyncContext",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverGetAsyncContext"
        }


#endif

-- method Server::get_listener
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Soup" , name = "Socket" })
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_get_listener" soup_server_get_listener :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO (Ptr Soup.Socket.Socket)

{-# DEPRECATED serverGetListener ["If you are using 'GI.Soup.Objects.Server.serverListen', etc, then use","'GI.Soup.Objects.Server.serverGetListeners' to get a list of all listening sockets,","but note that that function returns @/GSockets/@, not @/SoupSockets/@."] #-}
-- | Gets /@server@/\'s listening socket, if you are using the old API.
-- 
-- You should treat this socket as read-only; writing to it or
-- modifiying it may cause /@server@/ to malfunction.
serverGetListener ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m Soup.Socket.Socket
    -- ^ __Returns:__ the listening socket.
serverGetListener :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m Socket
serverGetListener a
server = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Socket -> m Socket) -> IO Socket -> m Socket
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 Socket
result <- Ptr Server -> IO (Ptr Socket)
soup_server_get_listener Ptr Server
server'
    Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"serverGetListener" Ptr Socket
result
    Socket
result' <- ((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
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result'

#if defined(ENABLE_OVERLOADING)
data ServerGetListenerMethodInfo
instance (signature ~ (m Soup.Socket.Socket), MonadIO m, IsServer a) => O.OverloadedMethod ServerGetListenerMethodInfo a signature where
    overloadedMethod = serverGetListener

instance O.OverloadedMethodInfo ServerGetListenerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverGetListener",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverGetListener"
        }


#endif

-- method Server::get_listeners
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGSList (TInterface Name { namespace = "Gio" , name = "Socket" }))
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_get_listeners" soup_server_get_listeners :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO (Ptr (GSList (Ptr Gio.Socket.Socket)))

-- | Gets /@server@/\'s list of listening sockets.
-- 
-- You should treat these sockets as read-only; writing to or
-- modifiying any of these sockets may cause /@server@/ to malfunction.
-- 
-- (Beware that in contrast to the old 'GI.Soup.Objects.Server.serverGetListener', this
-- function returns @/GSockets/@, not @/SoupSockets/@.)
serverGetListeners ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m [Gio.Socket.Socket]
    -- ^ __Returns:__ a
    -- list of listening sockets.
serverGetListeners :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m [Socket]
serverGetListeners a
server = IO [Socket] -> m [Socket]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Socket] -> m [Socket]) -> IO [Socket] -> m [Socket]
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 (GSList (Ptr Socket))
result <- Ptr Server -> IO (Ptr (GSList (Ptr Socket)))
soup_server_get_listeners Ptr Server
server'
    [Ptr Socket]
result' <- Ptr (GSList (Ptr Socket)) -> IO [Ptr Socket]
forall a. Ptr (GSList (Ptr a)) -> IO [Ptr a]
unpackGSList Ptr (GSList (Ptr Socket))
result
    [Socket]
result'' <- (Ptr Socket -> IO Socket) -> [Ptr Socket] -> IO [Socket]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((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
Gio.Socket.Socket) [Ptr Socket]
result'
    Ptr (GSList (Ptr Socket)) -> IO ()
forall a. Ptr (GSList a) -> IO ()
g_slist_free Ptr (GSList (Ptr Socket))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    [Socket] -> IO [Socket]
forall (m :: * -> *) a. Monad m => a -> m a
return [Socket]
result''

#if defined(ENABLE_OVERLOADING)
data ServerGetListenersMethodInfo
instance (signature ~ (m [Gio.Socket.Socket]), MonadIO m, IsServer a) => O.OverloadedMethod ServerGetListenersMethodInfo a signature where
    overloadedMethod = serverGetListeners

instance O.OverloadedMethodInfo ServerGetListenersMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverGetListeners",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverGetListeners"
        }


#endif

-- method Server::get_port
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_get_port" soup_server_get_port :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO Word32

{-# DEPRECATED serverGetPort ["If you are using 'GI.Soup.Objects.Server.serverListen', etc, then use","'GI.Soup.Objects.Server.serverGetUris' to get a list of all listening addresses."] #-}
-- | Gets the TCP port that /@server@/ is listening on, if you are using
-- the old API.
serverGetPort ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m Word32
    -- ^ __Returns:__ the port /@server@/ is listening on.
serverGetPort :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m Word32
serverGetPort a
server = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
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
    Word32
result <- Ptr Server -> IO Word32
soup_server_get_port Ptr Server
server'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result

#if defined(ENABLE_OVERLOADING)
data ServerGetPortMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsServer a) => O.OverloadedMethod ServerGetPortMethodInfo a signature where
    overloadedMethod = serverGetPort

instance O.OverloadedMethodInfo ServerGetPortMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverGetPort",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverGetPort"
        }


#endif

-- method Server::get_uris
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGSList (TInterface Name { namespace = "Soup" , name = "URI" }))
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_get_uris" soup_server_get_uris :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO (Ptr (GSList (Ptr Soup.URI.URI)))

-- | Gets a list of URIs corresponding to the interfaces /@server@/ is
-- listening on. These will contain IP addresses, not hostnames, and
-- will also indicate whether the given listener is http or https.
-- 
-- Note that if you used 'GI.Soup.Objects.Server.serverListenAll', the returned URIs
-- will use the addresses \<literal>0.0.0.0\<\/literal> and
-- \<literal>::\<\/literal>, rather than actually returning separate URIs
-- for each interface on the system.
-- 
-- /Since: 2.48/
serverGetUris ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m [Soup.URI.URI]
    -- ^ __Returns:__ a list of
    -- @/SoupURIs/@, which you must free when you are done with it.
serverGetUris :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m [URI]
serverGetUris a
server = IO [URI] -> m [URI]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [URI] -> m [URI]) -> IO [URI] -> m [URI]
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 (GSList (Ptr URI))
result <- Ptr Server -> IO (Ptr (GSList (Ptr URI)))
soup_server_get_uris Ptr Server
server'
    [Ptr URI]
result' <- Ptr (GSList (Ptr URI)) -> IO [Ptr URI]
forall a. Ptr (GSList (Ptr a)) -> IO [Ptr a]
unpackGSList Ptr (GSList (Ptr URI))
result
    [URI]
result'' <- (Ptr URI -> IO URI) -> [Ptr URI] -> IO [URI]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr URI -> URI) -> Ptr URI -> IO URI
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr URI -> URI
Soup.URI.URI) [Ptr URI]
result'
    Ptr (GSList (Ptr URI)) -> IO ()
forall a. Ptr (GSList a) -> IO ()
g_slist_free Ptr (GSList (Ptr URI))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    [URI] -> IO [URI]
forall (m :: * -> *) a. Monad m => a -> m a
return [URI]
result''

#if defined(ENABLE_OVERLOADING)
data ServerGetUrisMethodInfo
instance (signature ~ (m [Soup.URI.URI]), MonadIO m, IsServer a) => O.OverloadedMethod ServerGetUrisMethodInfo a signature where
    overloadedMethod = serverGetUris

instance O.OverloadedMethodInfo ServerGetUrisMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverGetUris",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverGetUris"
        }


#endif

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

foreign import ccall "soup_server_is_https" soup_server_is_https :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO CInt

-- | Checks whether /@server@/ is capable of https.
-- 
-- In order for a server to run https, you must call
-- 'GI.Soup.Objects.Server.serverSetSslCertFile', or set the
-- t'GI.Soup.Objects.Server.Server':@/tls-certificate/@ property, to provide it with a
-- certificate to use.
-- 
-- If you are using the deprecated single-listener APIs, then a return
-- value of 'P.True' indicates that the t'GI.Soup.Objects.Server.Server' serves https
-- exclusively. If you are using 'GI.Soup.Objects.Server.serverListen', etc, then a
-- 'P.True' return value merely indicates that the server is
-- \<emphasis>able\<\/emphasis> to do https, regardless of whether it
-- actually currently is or not. Use 'GI.Soup.Objects.Server.serverGetUris' to see if
-- it currently has any https listeners.
serverIsHttps ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@server@/ is configured to serve https.
serverIsHttps :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m Bool
serverIsHttps a
server = 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 Server
server' <- a -> IO (Ptr Server)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
server
    CInt
result <- Ptr Server -> IO CInt
soup_server_is_https Ptr Server
server'
    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
server
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ServerIsHttpsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsServer a) => O.OverloadedMethod ServerIsHttpsMethodInfo a signature where
    overloadedMethod = serverIsHttps

instance O.OverloadedMethodInfo ServerIsHttpsMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverIsHttps",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverIsHttps"
        }


#endif

-- method Server::listen
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "address"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketAddress" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the address of the interface to listen on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerListenOptions" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "listening options for this server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_listen" soup_server_listen :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Gio.SocketAddress.SocketAddress ->  -- address : TInterface (Name {namespace = "Gio", name = "SocketAddress"})
    CUInt ->                                -- options : TInterface (Name {namespace = "Soup", name = "ServerListenOptions"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This attempts to set up /@server@/ to listen for connections on
-- /@address@/.
-- 
-- If /@options@/ includes 'GI.Soup.Flags.ServerListenOptionsHttps', and /@server@/ has
-- been configured for TLS, then /@server@/ will listen for https
-- connections on this port. Otherwise it will listen for plain http.
-- 
-- You may call this method (along with the other \"listen\" methods)
-- any number of times on a server, if you want to listen on multiple
-- ports, or set up both http and https service.
-- 
-- After calling this method, /@server@/ will begin accepting and
-- processing connections as soon as the appropriate t'GI.GLib.Structs.MainContext.MainContext' is
-- run.
-- 
-- Note that t'GI.Soup.Objects.Server.Server' never makes use of dual IPv4\/IPv6 sockets; if
-- /@address@/ is an IPv6 address, it will only accept IPv6 connections.
-- You must configure IPv4 listening separately.
-- 
-- /Since: 2.48/
serverListen ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Gio.SocketAddress.IsSocketAddress b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@address@/: the address of the interface to listen on
    -> [Soup.Flags.ServerListenOptions]
    -- ^ /@options@/: listening options for this server
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverListen :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsSocketAddress b) =>
a -> b -> [ServerListenOptions] -> m ()
serverListen a
server b
address [ServerListenOptions]
options = 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 SocketAddress
address' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
    let options' :: CUInt
options' = [ServerListenOptions] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ServerListenOptions]
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server
-> Ptr SocketAddress -> CUInt -> Ptr (Ptr GError) -> IO CInt
soup_server_listen Ptr Server
server' Ptr SocketAddress
address' CUInt
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerListenMethodInfo
instance (signature ~ (b -> [Soup.Flags.ServerListenOptions] -> m ()), MonadIO m, IsServer a, Gio.SocketAddress.IsSocketAddress b) => O.OverloadedMethod ServerListenMethodInfo a signature where
    overloadedMethod = serverListen

instance O.OverloadedMethodInfo ServerListenMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverListen",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverListen"
        }


#endif

-- method Server::listen_all
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "port"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the port to listen on, or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerListenOptions" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "listening options for this server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_listen_all" soup_server_listen_all :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Word32 ->                               -- port : TBasicType TUInt
    CUInt ->                                -- options : TInterface (Name {namespace = "Soup", name = "ServerListenOptions"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This attempts to set up /@server@/ to listen for connections on all
-- interfaces on the system. (That is, it listens on the addresses
-- \<literal>0.0.0.0\<\/literal> and\/or \<literal>::\<\/literal>, depending
-- on whether /@options@/ includes 'GI.Soup.Flags.ServerListenOptionsIpv4Only',
-- 'GI.Soup.Flags.ServerListenOptionsIpv6Only', or neither.) If /@port@/ is specified,
-- /@server@/ will listen on that port. If it is 0, /@server@/ will find an
-- unused port to listen on. (In that case, you can use
-- 'GI.Soup.Objects.Server.serverGetUris' to find out what port it ended up choosing.)
-- 
-- See 'GI.Soup.Objects.Server.serverListen' for more details.
-- 
-- /Since: 2.48/
serverListenAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Word32
    -- ^ /@port@/: the port to listen on, or 0
    -> [Soup.Flags.ServerListenOptions]
    -- ^ /@options@/: listening options for this server
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverListenAll :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Word32 -> [ServerListenOptions] -> m ()
serverListenAll a
server Word32
port [ServerListenOptions]
options = 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
    let options' :: CUInt
options' = [ServerListenOptions] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ServerListenOptions]
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server -> Word32 -> CUInt -> Ptr (Ptr GError) -> IO CInt
soup_server_listen_all Ptr Server
server' Word32
port CUInt
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerListenAllMethodInfo
instance (signature ~ (Word32 -> [Soup.Flags.ServerListenOptions] -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerListenAllMethodInfo a signature where
    overloadedMethod = serverListenAll

instance O.OverloadedMethodInfo ServerListenAllMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverListenAll",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverListenAll"
        }


#endif

-- method Server::listen_fd
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "fd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the file descriptor of a listening socket"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerListenOptions" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "listening options for this server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_listen_fd" soup_server_listen_fd :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Int32 ->                                -- fd : TBasicType TInt
    CUInt ->                                -- options : TInterface (Name {namespace = "Soup", name = "ServerListenOptions"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This attempts to set up /@server@/ to listen for connections on
-- /@fd@/.
-- 
-- See 'GI.Soup.Objects.Server.serverListen' for more details.
-- 
-- Note that /@server@/ will close /@fd@/ when you free it or call
-- 'GI.Soup.Objects.Server.serverDisconnect'.
-- 
-- /Since: 2.48/
serverListenFd ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Int32
    -- ^ /@fd@/: the file descriptor of a listening socket
    -> [Soup.Flags.ServerListenOptions]
    -- ^ /@options@/: listening options for this server
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverListenFd :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Int32 -> [ServerListenOptions] -> m ()
serverListenFd a
server Int32
fd [ServerListenOptions]
options = 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
    let options' :: CUInt
options' = [ServerListenOptions] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ServerListenOptions]
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server -> Int32 -> CUInt -> Ptr (Ptr GError) -> IO CInt
soup_server_listen_fd Ptr Server
server' Int32
fd CUInt
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerListenFdMethodInfo
instance (signature ~ (Int32 -> [Soup.Flags.ServerListenOptions] -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerListenFdMethodInfo a signature where
    overloadedMethod = serverListenFd

instance O.OverloadedMethodInfo ServerListenFdMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverListenFd",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverListenFd"
        }


#endif

-- method Server::listen_local
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "port"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the port to listen on, or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerListenOptions" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "listening options for this server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_listen_local" soup_server_listen_local :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Word32 ->                               -- port : TBasicType TUInt
    CUInt ->                                -- options : TInterface (Name {namespace = "Soup", name = "ServerListenOptions"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This attempts to set up /@server@/ to listen for connections on
-- \"localhost\" (that is, \<literal>127.0.0.1\<\/literal> and\/or
-- \<literal>[1](#g:signal:1)\<\/literal>, depending on whether /@options@/ includes
-- 'GI.Soup.Flags.ServerListenOptionsIpv4Only', 'GI.Soup.Flags.ServerListenOptionsIpv6Only', or
-- neither). If /@port@/ is specified, /@server@/ will listen on that port.
-- If it is 0, /@server@/ will find an unused port to listen on. (In that
-- case, you can use 'GI.Soup.Objects.Server.serverGetUris' to find out what port it
-- ended up choosing.)
-- 
-- See 'GI.Soup.Objects.Server.serverListen' for more details.
-- 
-- /Since: 2.48/
serverListenLocal ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> Word32
    -- ^ /@port@/: the port to listen on, or 0
    -> [Soup.Flags.ServerListenOptions]
    -- ^ /@options@/: listening options for this server
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverListenLocal :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Word32 -> [ServerListenOptions] -> m ()
serverListenLocal a
server Word32
port [ServerListenOptions]
options = 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
    let options' :: CUInt
options' = [ServerListenOptions] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ServerListenOptions]
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server -> Word32 -> CUInt -> Ptr (Ptr GError) -> IO CInt
soup_server_listen_local Ptr Server
server' Word32
port CUInt
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerListenLocalMethodInfo
instance (signature ~ (Word32 -> [Soup.Flags.ServerListenOptions] -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerListenLocalMethodInfo a signature where
    overloadedMethod = serverListenLocal

instance O.OverloadedMethodInfo ServerListenLocalMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverListenLocal",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverListenLocal"
        }


#endif

-- method Server::listen_socket
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "socket"
--           , argType = TInterface Name { namespace = "Gio" , name = "Socket" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a listening #GSocket"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ServerListenOptions" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "listening options for this server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_listen_socket" soup_server_listen_socket :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Gio.Socket.Socket ->                -- socket : TInterface (Name {namespace = "Gio", name = "Socket"})
    CUInt ->                                -- options : TInterface (Name {namespace = "Soup", name = "ServerListenOptions"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This attempts to set up /@server@/ to listen for connections on
-- /@socket@/.
-- 
-- See 'GI.Soup.Objects.Server.serverListen' for more details.
-- 
-- /Since: 2.48/
serverListenSocket ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Gio.Socket.IsSocket b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@socket@/: a listening t'GI.Gio.Objects.Socket.Socket'
    -> [Soup.Flags.ServerListenOptions]
    -- ^ /@options@/: listening options for this server
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverListenSocket :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsSocket b) =>
a -> b -> [ServerListenOptions] -> m ()
serverListenSocket a
server b
socket [ServerListenOptions]
options = 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 Socket
socket' <- b -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
socket
    let options' :: CUInt
options' = [ServerListenOptions] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ServerListenOptions]
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server -> Ptr Socket -> CUInt -> Ptr (Ptr GError) -> IO CInt
soup_server_listen_socket Ptr Server
server' Ptr Socket
socket' CUInt
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
socket
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data ServerListenSocketMethodInfo
instance (signature ~ (b -> [Soup.Flags.ServerListenOptions] -> m ()), MonadIO m, IsServer a, Gio.Socket.IsSocket b) => O.OverloadedMethod ServerListenSocketMethodInfo a signature where
    overloadedMethod = serverListenSocket

instance O.OverloadedMethodInfo ServerListenSocketMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverListenSocket",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverListenSocket"
        }


#endif

-- method Server::pause_message
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #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 "a #SoupMessage associated with @server."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_pause_message" soup_server_pause_message :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO ()

-- | Pauses I\/O on /@msg@/. This can be used when you need to return from
-- the server handler without having the full response ready yet. Use
-- 'GI.Soup.Objects.Server.serverUnpauseMessage' to resume I\/O.
-- 
-- This must only be called on @/SoupMessages/@ which were created by the
-- t'GI.Soup.Objects.Server.Server' and are currently doing I\/O, such as those passed into a
-- t'GI.Soup.Callbacks.ServerCallback' or emitted in a [requestRead]("GI.Soup.Objects.Server#g:signal:requestRead") signal.
serverPauseMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Soup.Message.IsMessage b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@msg@/: a t'GI.Soup.Objects.Message.Message' associated with /@server@/.
    -> m ()
serverPauseMessage :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsMessage b) =>
a -> b -> m ()
serverPauseMessage a
server b
msg = 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
    Ptr Server -> Ptr Message -> IO ()
soup_server_pause_message Ptr Server
server' Ptr Message
msg'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerPauseMessageMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsServer a, Soup.Message.IsMessage b) => O.OverloadedMethod ServerPauseMessageMethodInfo a signature where
    overloadedMethod = serverPauseMessage

instance O.OverloadedMethodInfo ServerPauseMessageMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverPauseMessage",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverPauseMessage"
        }


#endif

-- method Server::quit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_quit" soup_server_quit :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO ()

{-# DEPRECATED serverQuit ["When using 'GI.Soup.Objects.Server.serverListen', etc, the server will","always listen for connections, and will process them whenever the","thread-default t'GI.GLib.Structs.MainContext.MainContext' is running."] #-}
-- | Stops processing for /@server@/, if you are using the old API. Call
-- this to clean up after 'GI.Soup.Objects.Server.serverRunAsync', or to terminate a
-- call to 'GI.Soup.Objects.Server.serverRun'.
-- 
-- Note that messages currently in progress will continue to be
-- handled, if the main loop associated with the server is resumed or
-- kept running.
-- 
-- /@server@/ is still in a working state after this call; you can start
-- and stop a server as many times as you want.
serverQuit ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m ()
serverQuit :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m ()
serverQuit a
server = 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 Server -> IO ()
soup_server_quit Ptr Server
server'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerQuitMethodInfo
instance (signature ~ (m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerQuitMethodInfo a signature where
    overloadedMethod = serverQuit

instance O.OverloadedMethodInfo ServerQuitMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverQuit",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverQuit"
        }


#endif

-- method Server::remove_auth_domain
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "auth_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
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_remove_auth_domain" soup_server_remove_auth_domain :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Soup.AuthDomain.AuthDomain ->       -- auth_domain : TInterface (Name {namespace = "Soup", name = "AuthDomain"})
    IO ()

-- | Removes /@authDomain@/ from /@server@/.
serverRemoveAuthDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Soup.AuthDomain.IsAuthDomain b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@authDomain@/: a t'GI.Soup.Objects.AuthDomain.AuthDomain'
    -> m ()
serverRemoveAuthDomain :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsAuthDomain b) =>
a -> b -> m ()
serverRemoveAuthDomain a
server b
authDomain = 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 AuthDomain
authDomain' <- b -> IO (Ptr AuthDomain)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
authDomain
    Ptr Server -> Ptr AuthDomain -> IO ()
soup_server_remove_auth_domain Ptr Server
server' Ptr AuthDomain
authDomain'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
authDomain
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerRemoveAuthDomainMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsServer a, Soup.AuthDomain.IsAuthDomain b) => O.OverloadedMethod ServerRemoveAuthDomainMethodInfo a signature where
    overloadedMethod = serverRemoveAuthDomain

instance O.OverloadedMethodInfo ServerRemoveAuthDomainMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverRemoveAuthDomain",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverRemoveAuthDomain"
        }


#endif

-- method Server::remove_handler
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , 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 toplevel path for the handler"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_remove_handler" soup_server_remove_handler :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CString ->                              -- path : TBasicType TUTF8
    IO ()

-- | Removes all handlers (early and normal) registered at /@path@/.
serverRemoveHandler ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> T.Text
    -- ^ /@path@/: the toplevel path for the handler
    -> m ()
serverRemoveHandler :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Text -> m ()
serverRemoveHandler a
server Text
path = 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 CChar
path' <- Text -> IO (Ptr CChar)
textToCString Text
path
    Ptr Server -> Ptr CChar -> IO ()
soup_server_remove_handler Ptr Server
server' Ptr CChar
path'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
path'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerRemoveHandlerMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerRemoveHandlerMethodInfo a signature where
    overloadedMethod = serverRemoveHandler

instance O.OverloadedMethodInfo ServerRemoveHandlerMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverRemoveHandler",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverRemoveHandler"
        }


#endif

-- method Server::remove_websocket_extension
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extension_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_remove_websocket_extension" soup_server_remove_websocket_extension :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CGType ->                               -- extension_type : TBasicType TGType
    IO ()

-- | Removes support for WebSocket extension of type /@extensionType@/ (or any subclass of
-- /@extensionType@/) from /@server@/. You can also remove extensions enabled by default
-- from the server at construct time by using the @/SOUP_SERVER_REMOVE_WEBSOCKET_EXTENSION/@
-- property.
-- 
-- /Since: 2.68/
serverRemoveWebsocketExtension ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> GType
    -- ^ /@extensionType@/: a t'GType'
    -> m ()
serverRemoveWebsocketExtension :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> GType -> m ()
serverRemoveWebsocketExtension a
server GType
extensionType = 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
    let extensionType' :: CGType
extensionType' = GType -> CGType
gtypeToCGType GType
extensionType
    Ptr Server -> CGType -> IO ()
soup_server_remove_websocket_extension Ptr Server
server' CGType
extensionType'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerRemoveWebsocketExtensionMethodInfo
instance (signature ~ (GType -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerRemoveWebsocketExtensionMethodInfo a signature where
    overloadedMethod = serverRemoveWebsocketExtension

instance O.OverloadedMethodInfo ServerRemoveWebsocketExtensionMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverRemoveWebsocketExtension",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverRemoveWebsocketExtension"
        }


#endif

-- method Server::run
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_run" soup_server_run :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO ()

{-# DEPRECATED serverRun ["When using 'GI.Soup.Objects.Server.serverListen', etc, the server will","always listen for connections, and will process them whenever the","thread-default t'GI.GLib.Structs.MainContext.MainContext' is running."] #-}
-- | Starts /@server@/, if you are using the old API, causing it to listen
-- for and process incoming connections. Unlike
-- 'GI.Soup.Objects.Server.serverRunAsync', this creates a t'GI.GLib.Structs.MainLoop.MainLoop' and runs it, and
-- it will not return until someone calls 'GI.Soup.Objects.Server.serverQuit' to stop
-- the server.
serverRun ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m ()
serverRun :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m ()
serverRun a
server = 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 Server -> IO ()
soup_server_run Ptr Server
server'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerRunMethodInfo
instance (signature ~ (m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerRunMethodInfo a signature where
    overloadedMethod = serverRun

instance O.OverloadedMethodInfo ServerRunMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverRun",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverRun"
        }


#endif

-- method Server::run_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_run_async" soup_server_run_async :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    IO ()

{-# DEPRECATED serverRunAsync ["When using 'GI.Soup.Objects.Server.serverListen', etc, the server will","always listen for connections, and will process them whenever the","thread-default t'GI.GLib.Structs.MainContext.MainContext' is running."] #-}
-- | Starts /@server@/, if you are using the old API, causing it to listen
-- for and process incoming connections.
-- 
-- The server runs in /@server@/\'s t'GI.GLib.Structs.MainContext.MainContext'. It will not actually
-- perform any processing unless the appropriate main loop is running.
-- In the simple case where you did not set the server\'s
-- 'GI.Soup.Constants.SERVER_ASYNC_CONTEXT' property, this means the server will run
-- whenever the glib main loop is running.
serverRunAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> m ()
serverRunAsync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> m ()
serverRunAsync a
server = 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 Server -> IO ()
soup_server_run_async Ptr Server
server'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerRunAsyncMethodInfo
instance (signature ~ (m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerRunAsyncMethodInfo a signature where
    overloadedMethod = serverRunAsync

instance O.OverloadedMethodInfo ServerRunAsyncMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverRunAsync",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverRunAsync"
        }


#endif

-- method Server::set_ssl_cert_file
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #SoupServer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ssl_cert_file"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "path to a file containing a PEM-encoded SSL/TLS\n  certificate."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ssl_key_file"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "path to a file containing a PEM-encoded private key."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "soup_server_set_ssl_cert_file" soup_server_set_ssl_cert_file :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    CString ->                              -- ssl_cert_file : TBasicType TUTF8
    CString ->                              -- ssl_key_file : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Sets /@server@/ up to do https, using the SSL\/TLS certificate
-- specified by /@sslCertFile@/ and /@sslKeyFile@/ (which may point to
-- the same file).
-- 
-- Alternatively, you can set the t'GI.Soup.Objects.Server.Server':@/tls-certificate/@ property
-- at construction time, if you already have a t'GI.Gio.Objects.TlsCertificate.TlsCertificate'.
-- 
-- /Since: 2.48/
serverSetSslCertFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> T.Text
    -- ^ /@sslCertFile@/: path to a file containing a PEM-encoded SSL\/TLS
    --   certificate.
    -> T.Text
    -- ^ /@sslKeyFile@/: path to a file containing a PEM-encoded private key.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
serverSetSslCertFile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsServer a) =>
a -> Text -> Text -> m ()
serverSetSslCertFile a
server Text
sslCertFile Text
sslKeyFile = 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 CChar
sslCertFile' <- Text -> IO (Ptr CChar)
textToCString Text
sslCertFile
    Ptr CChar
sslKeyFile' <- Text -> IO (Ptr CChar)
textToCString Text
sslKeyFile
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Server -> Ptr CChar -> Ptr CChar -> Ptr (Ptr GError) -> IO CInt
soup_server_set_ssl_cert_file Ptr Server
server' Ptr CChar
sslCertFile' Ptr CChar
sslKeyFile'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
        Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
sslCertFile'
        Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
sslKeyFile'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
sslCertFile'
        Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
sslKeyFile'
     )

#if defined(ENABLE_OVERLOADING)
data ServerSetSslCertFileMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsServer a) => O.OverloadedMethod ServerSetSslCertFileMethodInfo a signature where
    overloadedMethod = serverSetSslCertFile

instance O.OverloadedMethodInfo ServerSetSslCertFileMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverSetSslCertFile",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverSetSslCertFile"
        }


#endif

-- method Server::unpause_message
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "server"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Server" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #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 "a #SoupMessage associated with @server."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_server_unpause_message" soup_server_unpause_message :: 
    Ptr Server ->                           -- server : TInterface (Name {namespace = "Soup", name = "Server"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    IO ()

-- | Resumes I\/O on /@msg@/. Use this to resume after calling
-- 'GI.Soup.Objects.Server.serverPauseMessage', or after adding a new chunk to a
-- chunked response.
-- 
-- I\/O won\'t actually resume until you return to the main loop.
-- 
-- This must only be called on @/SoupMessages/@ which were created by the
-- t'GI.Soup.Objects.Server.Server' and are currently doing I\/O, such as those passed into a
-- t'GI.Soup.Callbacks.ServerCallback' or emitted in a [requestRead]("GI.Soup.Objects.Server#g:signal:requestRead") signal.
serverUnpauseMessage ::
    (B.CallStack.HasCallStack, MonadIO m, IsServer a, Soup.Message.IsMessage b) =>
    a
    -- ^ /@server@/: a t'GI.Soup.Objects.Server.Server'
    -> b
    -- ^ /@msg@/: a t'GI.Soup.Objects.Message.Message' associated with /@server@/.
    -> m ()
serverUnpauseMessage :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsServer a, IsMessage b) =>
a -> b -> m ()
serverUnpauseMessage a
server b
msg = 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
    Ptr Server -> Ptr Message -> IO ()
soup_server_unpause_message Ptr Server
server' Ptr Message
msg'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
server
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ServerUnpauseMessageMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsServer a, Soup.Message.IsMessage b) => O.OverloadedMethod ServerUnpauseMessageMethodInfo a signature where
    overloadedMethod = serverUnpauseMessage

instance O.OverloadedMethodInfo ServerUnpauseMessageMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Soup.Objects.Server.serverUnpauseMessage",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-soup-2.4.24/docs/GI-Soup-Objects-Server.html#v:serverUnpauseMessage"
        }


#endif