{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.SocketListener
(
SocketListener(..) ,
IsSocketListener ,
toSocketListener ,
#if defined(ENABLE_OVERLOADING)
ResolveSocketListenerMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptMethodInfo ,
#endif
socketListenerAccept ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptAsyncMethodInfo ,
#endif
socketListenerAcceptAsync ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptFinishMethodInfo ,
#endif
socketListenerAcceptFinish ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketMethodInfo ,
#endif
socketListenerAcceptSocket ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketAsyncMethodInfo,
#endif
socketListenerAcceptSocketAsync ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketFinishMethodInfo,
#endif
socketListenerAcceptSocketFinish ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddAddressMethodInfo ,
#endif
socketListenerAddAddress ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddAnyInetPortMethodInfo ,
#endif
socketListenerAddAnyInetPort ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddInetPortMethodInfo ,
#endif
socketListenerAddInetPort ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddSocketMethodInfo ,
#endif
socketListenerAddSocket ,
#if defined(ENABLE_OVERLOADING)
SocketListenerCloseMethodInfo ,
#endif
socketListenerClose ,
socketListenerNew ,
#if defined(ENABLE_OVERLOADING)
SocketListenerSetBacklogMethodInfo ,
#endif
socketListenerSetBacklog ,
#if defined(ENABLE_OVERLOADING)
SocketListenerListenBacklogPropertyInfo ,
#endif
constructSocketListenerListenBacklog ,
getSocketListenerListenBacklog ,
setSocketListenerListenBacklog ,
#if defined(ENABLE_OVERLOADING)
socketListenerListenBacklog ,
#endif
SocketListenerEventCallback ,
#if defined(ENABLE_OVERLOADING)
SocketListenerEventSignalInfo ,
#endif
afterSocketListenerEvent ,
onSocketListenerEvent ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Flags as GLib.Flags
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.Parameter as GObject.Parameter
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.DatagramBased as Gio.DatagramBased
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InetAddress as Gio.InetAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.Socket as Gio.Socket
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddressEnumerator as Gio.SocketAddressEnumerator
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketControlMessage as Gio.SocketControlMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.InputMessage as Gio.InputMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.InputVector as Gio.InputVector
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputMessage as Gio.OutputMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Socket as Gio.Socket
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
#endif
newtype SocketListener = SocketListener (SP.ManagedPtr SocketListener)
deriving (SocketListener -> SocketListener -> Bool
(SocketListener -> SocketListener -> Bool)
-> (SocketListener -> SocketListener -> Bool) -> Eq SocketListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SocketListener -> SocketListener -> Bool
== :: SocketListener -> SocketListener -> Bool
$c/= :: SocketListener -> SocketListener -> Bool
/= :: SocketListener -> SocketListener -> Bool
Eq)
instance SP.ManagedPtrNewtype SocketListener where
toManagedPtr :: SocketListener -> ManagedPtr SocketListener
toManagedPtr (SocketListener ManagedPtr SocketListener
p) = ManagedPtr SocketListener
p
foreign import ccall "g_socket_listener_get_type"
c_g_socket_listener_get_type :: IO B.Types.GType
instance B.Types.TypedObject SocketListener where
glibType :: IO GType
glibType = IO GType
c_g_socket_listener_get_type
instance B.Types.GObject SocketListener
class (SP.GObject o, O.IsDescendantOf SocketListener o) => IsSocketListener o
instance (SP.GObject o, O.IsDescendantOf SocketListener o) => IsSocketListener o
instance O.HasParentTypes SocketListener
type instance O.ParentTypes SocketListener = '[GObject.Object.Object]
toSocketListener :: (MIO.MonadIO m, IsSocketListener o) => o -> m SocketListener
toSocketListener :: forall (m :: * -> *) o.
(MonadIO m, IsSocketListener o) =>
o -> m SocketListener
toSocketListener = IO SocketListener -> m SocketListener
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SocketListener -> m SocketListener)
-> (o -> IO SocketListener) -> o -> m SocketListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SocketListener -> SocketListener)
-> o -> IO SocketListener
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr SocketListener -> SocketListener
SocketListener
instance B.GValue.IsGValue (Maybe SocketListener) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_socket_listener_get_type
gvalueSet_ :: Ptr GValue -> Maybe SocketListener -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SocketListener
P.Nothing = Ptr GValue -> Ptr SocketListener -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr SocketListener
forall a. Ptr a
FP.nullPtr :: FP.Ptr SocketListener)
gvalueSet_ Ptr GValue
gv (P.Just SocketListener
obj) = SocketListener -> (Ptr SocketListener -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SocketListener
obj (Ptr GValue -> Ptr SocketListener -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe SocketListener)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr SocketListener)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr SocketListener)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject SocketListener ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSocketListenerMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSocketListenerMethod "accept" o = SocketListenerAcceptMethodInfo
ResolveSocketListenerMethod "acceptAsync" o = SocketListenerAcceptAsyncMethodInfo
ResolveSocketListenerMethod "acceptFinish" o = SocketListenerAcceptFinishMethodInfo
ResolveSocketListenerMethod "acceptSocket" o = SocketListenerAcceptSocketMethodInfo
ResolveSocketListenerMethod "acceptSocketAsync" o = SocketListenerAcceptSocketAsyncMethodInfo
ResolveSocketListenerMethod "acceptSocketFinish" o = SocketListenerAcceptSocketFinishMethodInfo
ResolveSocketListenerMethod "addAddress" o = SocketListenerAddAddressMethodInfo
ResolveSocketListenerMethod "addAnyInetPort" o = SocketListenerAddAnyInetPortMethodInfo
ResolveSocketListenerMethod "addInetPort" o = SocketListenerAddInetPortMethodInfo
ResolveSocketListenerMethod "addSocket" o = SocketListenerAddSocketMethodInfo
ResolveSocketListenerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSocketListenerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSocketListenerMethod "close" o = SocketListenerCloseMethodInfo
ResolveSocketListenerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSocketListenerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSocketListenerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSocketListenerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSocketListenerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSocketListenerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSocketListenerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSocketListenerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSocketListenerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSocketListenerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSocketListenerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSocketListenerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSocketListenerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSocketListenerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSocketListenerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSocketListenerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSocketListenerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSocketListenerMethod "setBacklog" o = SocketListenerSetBacklogMethodInfo
ResolveSocketListenerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSocketListenerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSocketListenerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSocketListenerMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSocketListenerMethod t SocketListener, O.OverloadedMethod info SocketListener p) => OL.IsLabel t (SocketListener -> 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 ~ ResolveSocketListenerMethod t SocketListener, O.OverloadedMethod info SocketListener p, R.HasField t SocketListener p) => R.HasField t SocketListener p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSocketListenerMethod t SocketListener, O.OverloadedMethodInfo info SocketListener) => OL.IsLabel t (O.MethodProxy info SocketListener) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
type SocketListenerEventCallback =
Gio.Enums.SocketListenerEvent
-> Gio.Socket.Socket
-> IO ()
type C_SocketListenerEventCallback =
Ptr SocketListener ->
CUInt ->
Ptr Gio.Socket.Socket ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_SocketListenerEventCallback :: C_SocketListenerEventCallback -> IO (FunPtr C_SocketListenerEventCallback)
wrap_SocketListenerEventCallback ::
GObject a => (a -> SocketListenerEventCallback) ->
C_SocketListenerEventCallback
wrap_SocketListenerEventCallback :: forall a.
GObject a =>
(a -> SocketListenerEventCallback) -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback a -> SocketListenerEventCallback
gi'cb Ptr SocketListener
gi'selfPtr CUInt
event Ptr Socket
socket Ptr ()
_ = do
let event' :: SocketListenerEvent
event' = (Int -> SocketListenerEvent
forall a. Enum a => Int -> a
toEnum (Int -> SocketListenerEvent)
-> (CUInt -> Int) -> CUInt -> SocketListenerEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
event
socket' <- ((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
socket
B.ManagedPtr.withNewObject gi'selfPtr $ \SocketListener
gi'self -> a -> SocketListenerEventCallback
gi'cb (SocketListener -> a
forall a b. Coercible a b => a -> b
Coerce.coerce SocketListener
gi'self) SocketListenerEvent
event' Socket
socket'
onSocketListenerEvent :: (IsSocketListener a, MonadIO m) => a -> ((?self :: a) => SocketListenerEventCallback) -> m SignalHandlerId
onSocketListenerEvent :: forall a (m :: * -> *).
(IsSocketListener a, MonadIO m) =>
a
-> ((?self::a) => SocketListenerEventCallback) -> m SignalHandlerId
onSocketListenerEvent a
obj (?self::a) => SocketListenerEventCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
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 wrapped :: a -> SocketListenerEventCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => SocketListenerEventCallback
SocketListenerEventCallback
cb
let wrapped' :: C_SocketListenerEventCallback
wrapped' = (a -> SocketListenerEventCallback) -> C_SocketListenerEventCallback
forall a.
GObject a =>
(a -> SocketListenerEventCallback) -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback a -> SocketListenerEventCallback
wrapped
wrapped'' <- C_SocketListenerEventCallback
-> IO (FunPtr C_SocketListenerEventCallback)
mk_SocketListenerEventCallback C_SocketListenerEventCallback
wrapped'
connectSignalFunPtr obj "event" wrapped'' SignalConnectBefore Nothing
afterSocketListenerEvent :: (IsSocketListener a, MonadIO m) => a -> ((?self :: a) => SocketListenerEventCallback) -> m SignalHandlerId
afterSocketListenerEvent :: forall a (m :: * -> *).
(IsSocketListener a, MonadIO m) =>
a
-> ((?self::a) => SocketListenerEventCallback) -> m SignalHandlerId
afterSocketListenerEvent a
obj (?self::a) => SocketListenerEventCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
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 wrapped :: a -> SocketListenerEventCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => SocketListenerEventCallback
SocketListenerEventCallback
cb
let wrapped' :: C_SocketListenerEventCallback
wrapped' = (a -> SocketListenerEventCallback) -> C_SocketListenerEventCallback
forall a.
GObject a =>
(a -> SocketListenerEventCallback) -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback a -> SocketListenerEventCallback
wrapped
wrapped'' <- C_SocketListenerEventCallback
-> IO (FunPtr C_SocketListenerEventCallback)
mk_SocketListenerEventCallback C_SocketListenerEventCallback
wrapped'
connectSignalFunPtr obj "event" wrapped'' SignalConnectAfter Nothing
#if defined(ENABLE_OVERLOADING)
data SocketListenerEventSignalInfo
instance SignalInfo SocketListenerEventSignalInfo where
type HaskellCallbackType SocketListenerEventSignalInfo = SocketListenerEventCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_SocketListenerEventCallback cb
cb'' <- mk_SocketListenerEventCallback cb'
connectSignalFunPtr obj "event" cb'' connectMode detail
dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener::event"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#g:signal:event"})
#endif
getSocketListenerListenBacklog :: (MonadIO m, IsSocketListener o) => o -> m Int32
getSocketListenerListenBacklog :: forall (m :: * -> *) o.
(MonadIO m, IsSocketListener o) =>
o -> m Int32
getSocketListenerListenBacklog o
obj = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"listen-backlog"
setSocketListenerListenBacklog :: (MonadIO m, IsSocketListener o) => o -> Int32 -> m ()
setSocketListenerListenBacklog :: forall (m :: * -> *) o.
(MonadIO m, IsSocketListener o) =>
o -> Int32 -> m ()
setSocketListenerListenBacklog o
obj Int32
val = IO () -> m ()
forall a. IO a -> m a
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 -> Int32 -> IO ()
forall a. GObject a => a -> String -> Int32 -> IO ()
B.Properties.setObjectPropertyInt32 o
obj String
"listen-backlog" Int32
val
constructSocketListenerListenBacklog :: (IsSocketListener o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructSocketListenerListenBacklog :: forall o (m :: * -> *).
(IsSocketListener o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructSocketListenerListenBacklog Int32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
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 a. IO a -> IO a
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 -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"listen-backlog" Int32
val
#if defined(ENABLE_OVERLOADING)
data SocketListenerListenBacklogPropertyInfo
instance AttrInfo SocketListenerListenBacklogPropertyInfo where
type AttrAllowedOps SocketListenerListenBacklogPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketListenerListenBacklogPropertyInfo = IsSocketListener
type AttrSetTypeConstraint SocketListenerListenBacklogPropertyInfo = (~) Int32
type AttrTransferTypeConstraint SocketListenerListenBacklogPropertyInfo = (~) Int32
type AttrTransferType SocketListenerListenBacklogPropertyInfo = Int32
type AttrGetType SocketListenerListenBacklogPropertyInfo = Int32
type AttrLabel SocketListenerListenBacklogPropertyInfo = "listen-backlog"
type AttrOrigin SocketListenerListenBacklogPropertyInfo = SocketListener
attrGet = getSocketListenerListenBacklog
attrSet = setSocketListenerListenBacklog
attrTransfer _ v = do
return v
attrConstruct = constructSocketListenerListenBacklog
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.listenBacklog"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#g:attr:listenBacklog"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SocketListener
type instance O.AttributeList SocketListener = SocketListenerAttributeList
type SocketListenerAttributeList = ('[ '("listenBacklog", SocketListenerListenBacklogPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
socketListenerListenBacklog :: AttrLabelProxy "listenBacklog"
socketListenerListenBacklog = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SocketListener = SocketListenerSignalList
type SocketListenerSignalList = ('[ '("event", SocketListenerEventSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_socket_listener_new" g_socket_listener_new ::
IO (Ptr SocketListener)
socketListenerNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m SocketListener
socketListenerNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m SocketListener
socketListenerNew = IO SocketListener -> m SocketListener
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketListener -> m SocketListener)
-> IO SocketListener -> m SocketListener
forall a b. (a -> b) -> a -> b
$ do
result <- IO (Ptr SocketListener)
g_socket_listener_new
checkUnexpectedReturnNULL "socketListenerNew" result
result' <- (wrapObject SocketListener) result
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_socket_listener_accept" g_socket_listener_accept ::
Ptr SocketListener ->
Ptr (Ptr GObject.Object.Object) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketConnection.SocketConnection)
socketListenerAccept ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))
socketListenerAccept :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsCancellable b) =>
a -> Maybe b -> m (SocketConnection, Maybe Object)
socketListenerAccept a
listener Maybe b
cancellable = IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object))
-> IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
sourceObject <- callocMem :: IO (Ptr (Ptr GObject.Object.Object))
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_listener_accept listener' sourceObject maybeCancellable
checkUnexpectedReturnNULL "socketListenerAccept" result
result' <- (wrapObject Gio.SocketConnection.SocketConnection) result
sourceObject' <- peek sourceObject
maybeSourceObject' <- convertIfNonNull sourceObject' $ \Ptr Object
sourceObject'' -> do
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
return sourceObject'''
touchManagedPtr listener
whenJust cancellable touchManagedPtr
freeMem sourceObject
return (result', maybeSourceObject')
) (do
freeMem sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptMethodInfo
instance (signature ~ (Maybe (b) -> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketListenerAcceptMethodInfo a signature where
overloadedMethod = socketListenerAccept
instance O.OverloadedMethodInfo SocketListenerAcceptMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAccept",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAccept"
})
#endif
foreign import ccall "g_socket_listener_accept_async" g_socket_listener_accept_async ::
Ptr SocketListener ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
socketListenerAcceptAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
socketListenerAcceptAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
socketListenerAcceptAsync a
listener Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_socket_listener_accept_async listener' maybeCancellable maybeCallback userData
touchManagedPtr listener
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketListenerAcceptAsyncMethodInfo a signature where
overloadedMethod = socketListenerAcceptAsync
instance O.OverloadedMethodInfo SocketListenerAcceptAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAcceptAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAcceptAsync"
})
#endif
foreign import ccall "g_socket_listener_accept_finish" g_socket_listener_accept_finish ::
Ptr SocketListener ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GObject.Object.Object) ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketConnection.SocketConnection)
socketListenerAcceptFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))
socketListenerAcceptFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsAsyncResult b) =>
a -> b -> m (SocketConnection, Maybe Object)
socketListenerAcceptFinish a
listener b
result_ = IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object))
-> IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
result_' <- unsafeManagedPtrCastPtr result_
sourceObject <- callocMem :: IO (Ptr (Ptr GObject.Object.Object))
onException (do
result <- propagateGError $ g_socket_listener_accept_finish listener' result_' sourceObject
checkUnexpectedReturnNULL "socketListenerAcceptFinish" result
result' <- (wrapObject Gio.SocketConnection.SocketConnection) result
sourceObject' <- peek sourceObject
maybeSourceObject' <- convertIfNonNull sourceObject' $ \Ptr Object
sourceObject'' -> do
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
return sourceObject'''
touchManagedPtr listener
touchManagedPtr result_
freeMem sourceObject
return (result', maybeSourceObject')
) (do
freeMem sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptFinishMethodInfo
instance (signature ~ (b -> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SocketListenerAcceptFinishMethodInfo a signature where
overloadedMethod = socketListenerAcceptFinish
instance O.OverloadedMethodInfo SocketListenerAcceptFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAcceptFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAcceptFinish"
})
#endif
foreign import ccall "g_socket_listener_accept_socket" g_socket_listener_accept_socket ::
Ptr SocketListener ->
Ptr (Ptr GObject.Object.Object) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Socket.Socket)
socketListenerAcceptSocket ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))
socketListenerAcceptSocket :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsCancellable b) =>
a -> Maybe b -> m (Socket, Maybe Object)
socketListenerAcceptSocket a
listener Maybe b
cancellable = IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Socket, Maybe Object) -> m (Socket, Maybe Object))
-> IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
sourceObject <- callocMem :: IO (Ptr (Ptr GObject.Object.Object))
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_listener_accept_socket listener' sourceObject maybeCancellable
checkUnexpectedReturnNULL "socketListenerAcceptSocket" result
result' <- (wrapObject Gio.Socket.Socket) result
sourceObject' <- peek sourceObject
maybeSourceObject' <- convertIfNonNull sourceObject' $ \Ptr Object
sourceObject'' -> do
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
return sourceObject'''
touchManagedPtr listener
whenJust cancellable touchManagedPtr
freeMem sourceObject
return (result', maybeSourceObject')
) (do
freeMem sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketMethodInfo
instance (signature ~ (Maybe (b) -> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketListenerAcceptSocketMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocket
instance O.OverloadedMethodInfo SocketListenerAcceptSocketMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAcceptSocket",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAcceptSocket"
})
#endif
foreign import ccall "g_socket_listener_accept_socket_async" g_socket_listener_accept_socket_async ::
Ptr SocketListener ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
socketListenerAcceptSocketAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
socketListenerAcceptSocketAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
socketListenerAcceptSocketAsync a
listener Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_socket_listener_accept_socket_async listener' maybeCancellable maybeCallback userData
touchManagedPtr listener
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketListenerAcceptSocketAsyncMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocketAsync
instance O.OverloadedMethodInfo SocketListenerAcceptSocketAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAcceptSocketAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAcceptSocketAsync"
})
#endif
foreign import ccall "g_socket_listener_accept_socket_finish" g_socket_listener_accept_socket_finish ::
Ptr SocketListener ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GObject.Object.Object) ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Socket.Socket)
socketListenerAcceptSocketFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))
socketListenerAcceptSocketFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsAsyncResult b) =>
a -> b -> m (Socket, Maybe Object)
socketListenerAcceptSocketFinish a
listener b
result_ = IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Socket, Maybe Object) -> m (Socket, Maybe Object))
-> IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
result_' <- unsafeManagedPtrCastPtr result_
sourceObject <- callocMem :: IO (Ptr (Ptr GObject.Object.Object))
onException (do
result <- propagateGError $ g_socket_listener_accept_socket_finish listener' result_' sourceObject
checkUnexpectedReturnNULL "socketListenerAcceptSocketFinish" result
result' <- (wrapObject Gio.Socket.Socket) result
sourceObject' <- peek sourceObject
maybeSourceObject' <- convertIfNonNull sourceObject' $ \Ptr Object
sourceObject'' -> do
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
return sourceObject'''
touchManagedPtr listener
touchManagedPtr result_
freeMem sourceObject
return (result', maybeSourceObject')
) (do
freeMem sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketFinishMethodInfo
instance (signature ~ (b -> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SocketListenerAcceptSocketFinishMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocketFinish
instance O.OverloadedMethodInfo SocketListenerAcceptSocketFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAcceptSocketFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAcceptSocketFinish"
})
#endif
foreign import ccall "g_socket_listener_add_address" g_socket_listener_add_address ::
Ptr SocketListener ->
Ptr Gio.SocketAddress.SocketAddress ->
CUInt ->
CInt ->
Ptr GObject.Object.Object ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddAddress ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.SocketAddress.IsSocketAddress b, GObject.Object.IsObject c) =>
a
-> b
-> Gio.Enums.SocketType
-> Gio.Enums.SocketProtocol
-> Maybe (c)
-> m (Gio.SocketAddress.SocketAddress)
socketListenerAddAddress :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocketListener a, IsSocketAddress b,
IsObject c) =>
a
-> b -> SocketType -> SocketProtocol -> Maybe c -> m SocketAddress
socketListenerAddAddress a
listener b
address SocketType
type_ SocketProtocol
protocol Maybe c
sourceObject = IO SocketAddress -> m SocketAddress
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketAddress -> m SocketAddress)
-> IO SocketAddress -> m SocketAddress
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
address' <- unsafeManagedPtrCastPtr address
let type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SocketType -> Int) -> SocketType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketType -> Int
forall a. Enum a => a -> Int
fromEnum) SocketType
type_
let protocol' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (SocketProtocol -> Int) -> SocketProtocol -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketProtocol -> Int
forall a. Enum a => a -> Int
fromEnum) SocketProtocol
protocol
maybeSourceObject <- case sourceObject of
Maybe c
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
FP.nullPtr
Just c
jSourceObject -> do
jSourceObject' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceObject
return jSourceObject'
effectiveAddress <- callocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
onException (do
_ <- propagateGError $ g_socket_listener_add_address listener' address' type_' protocol' maybeSourceObject effectiveAddress
effectiveAddress' <- peek effectiveAddress
effectiveAddress'' <- (wrapObject Gio.SocketAddress.SocketAddress) effectiveAddress'
touchManagedPtr listener
touchManagedPtr address
whenJust sourceObject touchManagedPtr
freeMem effectiveAddress
return effectiveAddress''
) (do
freeMem effectiveAddress
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddAddressMethodInfo
instance (signature ~ (b -> Gio.Enums.SocketType -> Gio.Enums.SocketProtocol -> Maybe (c) -> m (Gio.SocketAddress.SocketAddress)), MonadIO m, IsSocketListener a, Gio.SocketAddress.IsSocketAddress b, GObject.Object.IsObject c) => O.OverloadedMethod SocketListenerAddAddressMethodInfo a signature where
overloadedMethod = socketListenerAddAddress
instance O.OverloadedMethodInfo SocketListenerAddAddressMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAddAddress",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAddAddress"
})
#endif
foreign import ccall "g_socket_listener_add_any_inet_port" g_socket_listener_add_any_inet_port ::
Ptr SocketListener ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO Word16
socketListenerAddAnyInetPort ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, GObject.Object.IsObject b) =>
a
-> Maybe (b)
-> m Word16
socketListenerAddAnyInetPort :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsObject b) =>
a -> Maybe b -> m Word16
socketListenerAddAnyInetPort a
listener Maybe b
sourceObject = IO Word16 -> m Word16
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
maybeSourceObject <- case sourceObject of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
FP.nullPtr
Just b
jSourceObject -> do
jSourceObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSourceObject
return jSourceObject'
onException (do
result <- propagateGError $ g_socket_listener_add_any_inet_port listener' maybeSourceObject
touchManagedPtr listener
whenJust sourceObject touchManagedPtr
return result
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddAnyInetPortMethodInfo
instance (signature ~ (Maybe (b) -> m Word16), MonadIO m, IsSocketListener a, GObject.Object.IsObject b) => O.OverloadedMethod SocketListenerAddAnyInetPortMethodInfo a signature where
overloadedMethod = socketListenerAddAnyInetPort
instance O.OverloadedMethodInfo SocketListenerAddAnyInetPortMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAddAnyInetPort",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAddAnyInetPort"
})
#endif
foreign import ccall "g_socket_listener_add_inet_port" g_socket_listener_add_inet_port ::
Ptr SocketListener ->
Word16 ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddInetPort ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, GObject.Object.IsObject b) =>
a
-> Word16
-> Maybe (b)
-> m ()
socketListenerAddInetPort :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocketListener a, IsObject b) =>
a -> Word16 -> Maybe b -> m ()
socketListenerAddInetPort a
listener Word16
port Maybe b
sourceObject = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
maybeSourceObject <- case sourceObject of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
FP.nullPtr
Just b
jSourceObject -> do
jSourceObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSourceObject
return jSourceObject'
onException (do
_ <- propagateGError $ g_socket_listener_add_inet_port listener' port maybeSourceObject
touchManagedPtr listener
whenJust sourceObject touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddInetPortMethodInfo
instance (signature ~ (Word16 -> Maybe (b) -> m ()), MonadIO m, IsSocketListener a, GObject.Object.IsObject b) => O.OverloadedMethod SocketListenerAddInetPortMethodInfo a signature where
overloadedMethod = socketListenerAddInetPort
instance O.OverloadedMethodInfo SocketListenerAddInetPortMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAddInetPort",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAddInetPort"
})
#endif
foreign import ccall "g_socket_listener_add_socket" g_socket_listener_add_socket ::
Ptr SocketListener ->
Ptr Gio.Socket.Socket ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddSocket ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Socket.IsSocket b, GObject.Object.IsObject c) =>
a
-> b
-> Maybe (c)
-> m ()
socketListenerAddSocket :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocketListener a, IsSocket b,
IsObject c) =>
a -> b -> Maybe c -> m ()
socketListenerAddSocket a
listener b
socket Maybe c
sourceObject = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
socket' <- unsafeManagedPtrCastPtr socket
maybeSourceObject <- case sourceObject of
Maybe c
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
FP.nullPtr
Just c
jSourceObject -> do
jSourceObject' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceObject
return jSourceObject'
onException (do
_ <- propagateGError $ g_socket_listener_add_socket listener' socket' maybeSourceObject
touchManagedPtr listener
touchManagedPtr socket
whenJust sourceObject touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddSocketMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsSocketListener a, Gio.Socket.IsSocket b, GObject.Object.IsObject c) => O.OverloadedMethod SocketListenerAddSocketMethodInfo a signature where
overloadedMethod = socketListenerAddSocket
instance O.OverloadedMethodInfo SocketListenerAddSocketMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerAddSocket",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerAddSocket"
})
#endif
foreign import ccall "g_socket_listener_close" g_socket_listener_close ::
Ptr SocketListener ->
IO ()
socketListenerClose ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a) =>
a
-> m ()
socketListenerClose :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocketListener a) =>
a -> m ()
socketListenerClose a
listener = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
g_socket_listener_close listener'
touchManagedPtr listener
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocketListener a) => O.OverloadedMethod SocketListenerCloseMethodInfo a signature where
overloadedMethod = socketListenerClose
instance O.OverloadedMethodInfo SocketListenerCloseMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerClose",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerClose"
})
#endif
foreign import ccall "g_socket_listener_set_backlog" g_socket_listener_set_backlog ::
Ptr SocketListener ->
Int32 ->
IO ()
socketListenerSetBacklog ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a) =>
a
-> Int32
-> m ()
socketListenerSetBacklog :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocketListener a) =>
a -> Int32 -> m ()
socketListenerSetBacklog a
listener Int32
listenBacklog = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
g_socket_listener_set_backlog listener' listenBacklog
touchManagedPtr listener
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerSetBacklogMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsSocketListener a) => O.OverloadedMethod SocketListenerSetBacklogMethodInfo a signature where
overloadedMethod = socketListenerSetBacklog
instance O.OverloadedMethodInfo SocketListenerSetBacklogMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.SocketListener.socketListenerSetBacklog",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-SocketListener.html#v:socketListenerSetBacklog"
})
#endif