{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Socket
(
Socket(..) ,
IsSocket ,
toSocket ,
#if defined(ENABLE_OVERLOADING)
ResolveSocketMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketAcceptMethodInfo ,
#endif
socketAccept ,
#if defined(ENABLE_OVERLOADING)
SocketBindMethodInfo ,
#endif
socketBind ,
#if defined(ENABLE_OVERLOADING)
SocketCheckConnectResultMethodInfo ,
#endif
socketCheckConnectResult ,
#if defined(ENABLE_OVERLOADING)
SocketCloseMethodInfo ,
#endif
socketClose ,
#if defined(ENABLE_OVERLOADING)
SocketConditionCheckMethodInfo ,
#endif
socketConditionCheck ,
#if defined(ENABLE_OVERLOADING)
SocketConditionTimedWaitMethodInfo ,
#endif
socketConditionTimedWait ,
#if defined(ENABLE_OVERLOADING)
SocketConditionWaitMethodInfo ,
#endif
socketConditionWait ,
#if defined(ENABLE_OVERLOADING)
SocketConnectMethodInfo ,
#endif
socketConnect ,
#if defined(ENABLE_OVERLOADING)
SocketConnectionFactoryCreateConnectionMethodInfo,
#endif
socketConnectionFactoryCreateConnection ,
#if defined(ENABLE_OVERLOADING)
SocketGetAvailableBytesMethodInfo ,
#endif
socketGetAvailableBytes ,
#if defined(ENABLE_OVERLOADING)
SocketGetBlockingMethodInfo ,
#endif
socketGetBlocking ,
#if defined(ENABLE_OVERLOADING)
SocketGetBroadcastMethodInfo ,
#endif
socketGetBroadcast ,
#if defined(ENABLE_OVERLOADING)
SocketGetCredentialsMethodInfo ,
#endif
socketGetCredentials ,
#if defined(ENABLE_OVERLOADING)
SocketGetFamilyMethodInfo ,
#endif
socketGetFamily ,
#if defined(ENABLE_OVERLOADING)
SocketGetFdMethodInfo ,
#endif
socketGetFd ,
#if defined(ENABLE_OVERLOADING)
SocketGetKeepaliveMethodInfo ,
#endif
socketGetKeepalive ,
#if defined(ENABLE_OVERLOADING)
SocketGetListenBacklogMethodInfo ,
#endif
socketGetListenBacklog ,
#if defined(ENABLE_OVERLOADING)
SocketGetLocalAddressMethodInfo ,
#endif
socketGetLocalAddress ,
#if defined(ENABLE_OVERLOADING)
SocketGetMulticastLoopbackMethodInfo ,
#endif
socketGetMulticastLoopback ,
#if defined(ENABLE_OVERLOADING)
SocketGetMulticastTtlMethodInfo ,
#endif
socketGetMulticastTtl ,
#if defined(ENABLE_OVERLOADING)
SocketGetOptionMethodInfo ,
#endif
socketGetOption ,
#if defined(ENABLE_OVERLOADING)
SocketGetProtocolMethodInfo ,
#endif
socketGetProtocol ,
#if defined(ENABLE_OVERLOADING)
SocketGetRemoteAddressMethodInfo ,
#endif
socketGetRemoteAddress ,
#if defined(ENABLE_OVERLOADING)
SocketGetSocketTypeMethodInfo ,
#endif
socketGetSocketType ,
#if defined(ENABLE_OVERLOADING)
SocketGetTimeoutMethodInfo ,
#endif
socketGetTimeout ,
#if defined(ENABLE_OVERLOADING)
SocketGetTtlMethodInfo ,
#endif
socketGetTtl ,
#if defined(ENABLE_OVERLOADING)
SocketIsClosedMethodInfo ,
#endif
socketIsClosed ,
#if defined(ENABLE_OVERLOADING)
SocketIsConnectedMethodInfo ,
#endif
socketIsConnected ,
#if defined(ENABLE_OVERLOADING)
SocketJoinMulticastGroupMethodInfo ,
#endif
socketJoinMulticastGroup ,
#if defined(ENABLE_OVERLOADING)
SocketJoinMulticastGroupSsmMethodInfo ,
#endif
socketJoinMulticastGroupSsm ,
#if defined(ENABLE_OVERLOADING)
SocketLeaveMulticastGroupMethodInfo ,
#endif
socketLeaveMulticastGroup ,
#if defined(ENABLE_OVERLOADING)
SocketLeaveMulticastGroupSsmMethodInfo ,
#endif
socketLeaveMulticastGroupSsm ,
#if defined(ENABLE_OVERLOADING)
SocketListenMethodInfo ,
#endif
socketListen ,
socketNew ,
socketNewFromFd ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveMethodInfo ,
#endif
socketReceive ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveBytesMethodInfo ,
#endif
socketReceiveBytes ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveBytesFromMethodInfo ,
#endif
socketReceiveBytesFrom ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveFromMethodInfo ,
#endif
socketReceiveFrom ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveMessageMethodInfo ,
#endif
socketReceiveMessage ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveMessagesMethodInfo ,
#endif
socketReceiveMessages ,
#if defined(ENABLE_OVERLOADING)
SocketReceiveWithBlockingMethodInfo ,
#endif
socketReceiveWithBlocking ,
#if defined(ENABLE_OVERLOADING)
SocketSendMethodInfo ,
#endif
socketSend ,
#if defined(ENABLE_OVERLOADING)
SocketSendMessageMethodInfo ,
#endif
socketSendMessage ,
#if defined(ENABLE_OVERLOADING)
SocketSendMessageWithTimeoutMethodInfo ,
#endif
socketSendMessageWithTimeout ,
#if defined(ENABLE_OVERLOADING)
SocketSendMessagesMethodInfo ,
#endif
socketSendMessages ,
#if defined(ENABLE_OVERLOADING)
SocketSendToMethodInfo ,
#endif
socketSendTo ,
#if defined(ENABLE_OVERLOADING)
SocketSendWithBlockingMethodInfo ,
#endif
socketSendWithBlocking ,
#if defined(ENABLE_OVERLOADING)
SocketSetBlockingMethodInfo ,
#endif
socketSetBlocking ,
#if defined(ENABLE_OVERLOADING)
SocketSetBroadcastMethodInfo ,
#endif
socketSetBroadcast ,
#if defined(ENABLE_OVERLOADING)
SocketSetKeepaliveMethodInfo ,
#endif
socketSetKeepalive ,
#if defined(ENABLE_OVERLOADING)
SocketSetListenBacklogMethodInfo ,
#endif
socketSetListenBacklog ,
#if defined(ENABLE_OVERLOADING)
SocketSetMulticastLoopbackMethodInfo ,
#endif
socketSetMulticastLoopback ,
#if defined(ENABLE_OVERLOADING)
SocketSetMulticastTtlMethodInfo ,
#endif
socketSetMulticastTtl ,
#if defined(ENABLE_OVERLOADING)
SocketSetOptionMethodInfo ,
#endif
socketSetOption ,
#if defined(ENABLE_OVERLOADING)
SocketSetTimeoutMethodInfo ,
#endif
socketSetTimeout ,
#if defined(ENABLE_OVERLOADING)
SocketSetTtlMethodInfo ,
#endif
socketSetTtl ,
#if defined(ENABLE_OVERLOADING)
SocketShutdownMethodInfo ,
#endif
socketShutdown ,
#if defined(ENABLE_OVERLOADING)
SocketSpeaksIpv4MethodInfo ,
#endif
socketSpeaksIpv4 ,
#if defined(ENABLE_OVERLOADING)
SocketBlockingPropertyInfo ,
#endif
constructSocketBlocking ,
getSocketBlocking ,
setSocketBlocking ,
#if defined(ENABLE_OVERLOADING)
socketBlocking ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketBroadcastPropertyInfo ,
#endif
constructSocketBroadcast ,
getSocketBroadcast ,
setSocketBroadcast ,
#if defined(ENABLE_OVERLOADING)
socketBroadcast ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketFamilyPropertyInfo ,
#endif
constructSocketFamily ,
getSocketFamily ,
#if defined(ENABLE_OVERLOADING)
socketFamily ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketFdPropertyInfo ,
#endif
constructSocketFd ,
getSocketFd ,
#if defined(ENABLE_OVERLOADING)
socketFd ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketKeepalivePropertyInfo ,
#endif
constructSocketKeepalive ,
getSocketKeepalive ,
setSocketKeepalive ,
#if defined(ENABLE_OVERLOADING)
socketKeepalive ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketListenBacklogPropertyInfo ,
#endif
constructSocketListenBacklog ,
getSocketListenBacklog ,
setSocketListenBacklog ,
#if defined(ENABLE_OVERLOADING)
socketListenBacklog ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketLocalAddressPropertyInfo ,
#endif
getSocketLocalAddress ,
#if defined(ENABLE_OVERLOADING)
socketLocalAddress ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketMulticastLoopbackPropertyInfo ,
#endif
constructSocketMulticastLoopback ,
getSocketMulticastLoopback ,
setSocketMulticastLoopback ,
#if defined(ENABLE_OVERLOADING)
socketMulticastLoopback ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketMulticastTtlPropertyInfo ,
#endif
constructSocketMulticastTtl ,
getSocketMulticastTtl ,
setSocketMulticastTtl ,
#if defined(ENABLE_OVERLOADING)
socketMulticastTtl ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketProtocolPropertyInfo ,
#endif
constructSocketProtocol ,
getSocketProtocol ,
#if defined(ENABLE_OVERLOADING)
socketProtocol ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketRemoteAddressPropertyInfo ,
#endif
getSocketRemoteAddress ,
#if defined(ENABLE_OVERLOADING)
socketRemoteAddress ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketTimeoutPropertyInfo ,
#endif
constructSocketTimeout ,
getSocketTimeout ,
setSocketTimeout ,
#if defined(ENABLE_OVERLOADING)
socketTimeout ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketTtlPropertyInfo ,
#endif
constructSocketTtl ,
getSocketTtl ,
setSocketTtl ,
#if defined(ENABLE_OVERLOADING)
socketTtl ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketTypePropertyInfo ,
#endif
constructSocketType ,
getSocketType ,
#if defined(ENABLE_OVERLOADING)
socketType ,
#endif
) 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.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.GLib.Flags as GLib.Flags
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
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.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.InetAddress as Gio.InetAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
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
#endif
newtype Socket = Socket (SP.ManagedPtr Socket)
deriving (Socket -> Socket -> Bool
(Socket -> Socket -> Bool)
-> (Socket -> Socket -> Bool) -> Eq Socket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Socket -> Socket -> Bool
== :: Socket -> Socket -> Bool
$c/= :: Socket -> Socket -> Bool
/= :: Socket -> Socket -> Bool
Eq)
instance SP.ManagedPtrNewtype Socket where
toManagedPtr :: Socket -> ManagedPtr Socket
toManagedPtr (Socket ManagedPtr Socket
p) = ManagedPtr Socket
p
foreign import ccall "g_socket_get_type"
c_g_socket_get_type :: IO B.Types.GType
instance B.Types.TypedObject Socket where
glibType :: IO GType
glibType = IO GType
c_g_socket_get_type
instance B.Types.GObject Socket
class (SP.GObject o, O.IsDescendantOf Socket o) => IsSocket o
instance (SP.GObject o, O.IsDescendantOf Socket o) => IsSocket o
instance O.HasParentTypes Socket
type instance O.ParentTypes Socket = '[GObject.Object.Object, Gio.DatagramBased.DatagramBased, Gio.Initable.Initable]
toSocket :: (MIO.MonadIO m, IsSocket o) => o -> m Socket
toSocket :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Socket
toSocket = IO Socket -> m Socket
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Socket -> m Socket) -> (o -> IO Socket) -> o -> m Socket
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Socket -> Socket) -> o -> IO Socket
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Socket -> Socket
Socket
instance B.GValue.IsGValue (Maybe Socket) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_socket_get_type
gvalueSet_ :: Ptr GValue -> Maybe Socket -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Socket
P.Nothing = Ptr GValue -> Ptr Socket -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Socket
forall a. Ptr a
FP.nullPtr :: FP.Ptr Socket)
gvalueSet_ Ptr GValue
gv (P.Just Socket
obj) = Socket -> (Ptr Socket -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Socket
obj (Ptr GValue -> Ptr Socket -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Socket)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Socket)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Socket)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Socket ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSocketMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSocketMethod "accept" o = SocketAcceptMethodInfo
ResolveSocketMethod "bind" o = SocketBindMethodInfo
ResolveSocketMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSocketMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSocketMethod "checkConnectResult" o = SocketCheckConnectResultMethodInfo
ResolveSocketMethod "close" o = SocketCloseMethodInfo
ResolveSocketMethod "conditionCheck" o = SocketConditionCheckMethodInfo
ResolveSocketMethod "conditionTimedWait" o = SocketConditionTimedWaitMethodInfo
ResolveSocketMethod "conditionWait" o = SocketConditionWaitMethodInfo
ResolveSocketMethod "connect" o = SocketConnectMethodInfo
ResolveSocketMethod "connectionFactoryCreateConnection" o = SocketConnectionFactoryCreateConnectionMethodInfo
ResolveSocketMethod "createSource" o = Gio.DatagramBased.DatagramBasedCreateSourceMethodInfo
ResolveSocketMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSocketMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSocketMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSocketMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolveSocketMethod "isClosed" o = SocketIsClosedMethodInfo
ResolveSocketMethod "isConnected" o = SocketIsConnectedMethodInfo
ResolveSocketMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSocketMethod "joinMulticastGroup" o = SocketJoinMulticastGroupMethodInfo
ResolveSocketMethod "joinMulticastGroupSsm" o = SocketJoinMulticastGroupSsmMethodInfo
ResolveSocketMethod "leaveMulticastGroup" o = SocketLeaveMulticastGroupMethodInfo
ResolveSocketMethod "leaveMulticastGroupSsm" o = SocketLeaveMulticastGroupSsmMethodInfo
ResolveSocketMethod "listen" o = SocketListenMethodInfo
ResolveSocketMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSocketMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSocketMethod "receive" o = SocketReceiveMethodInfo
ResolveSocketMethod "receiveBytes" o = SocketReceiveBytesMethodInfo
ResolveSocketMethod "receiveBytesFrom" o = SocketReceiveBytesFromMethodInfo
ResolveSocketMethod "receiveFrom" o = SocketReceiveFromMethodInfo
ResolveSocketMethod "receiveMessage" o = SocketReceiveMessageMethodInfo
ResolveSocketMethod "receiveMessages" o = SocketReceiveMessagesMethodInfo
ResolveSocketMethod "receiveWithBlocking" o = SocketReceiveWithBlockingMethodInfo
ResolveSocketMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSocketMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSocketMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSocketMethod "send" o = SocketSendMethodInfo
ResolveSocketMethod "sendMessage" o = SocketSendMessageMethodInfo
ResolveSocketMethod "sendMessageWithTimeout" o = SocketSendMessageWithTimeoutMethodInfo
ResolveSocketMethod "sendMessages" o = SocketSendMessagesMethodInfo
ResolveSocketMethod "sendTo" o = SocketSendToMethodInfo
ResolveSocketMethod "sendWithBlocking" o = SocketSendWithBlockingMethodInfo
ResolveSocketMethod "shutdown" o = SocketShutdownMethodInfo
ResolveSocketMethod "speaksIpv4" o = SocketSpeaksIpv4MethodInfo
ResolveSocketMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSocketMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSocketMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSocketMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSocketMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSocketMethod "getAvailableBytes" o = SocketGetAvailableBytesMethodInfo
ResolveSocketMethod "getBlocking" o = SocketGetBlockingMethodInfo
ResolveSocketMethod "getBroadcast" o = SocketGetBroadcastMethodInfo
ResolveSocketMethod "getCredentials" o = SocketGetCredentialsMethodInfo
ResolveSocketMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSocketMethod "getFamily" o = SocketGetFamilyMethodInfo
ResolveSocketMethod "getFd" o = SocketGetFdMethodInfo
ResolveSocketMethod "getKeepalive" o = SocketGetKeepaliveMethodInfo
ResolveSocketMethod "getListenBacklog" o = SocketGetListenBacklogMethodInfo
ResolveSocketMethod "getLocalAddress" o = SocketGetLocalAddressMethodInfo
ResolveSocketMethod "getMulticastLoopback" o = SocketGetMulticastLoopbackMethodInfo
ResolveSocketMethod "getMulticastTtl" o = SocketGetMulticastTtlMethodInfo
ResolveSocketMethod "getOption" o = SocketGetOptionMethodInfo
ResolveSocketMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSocketMethod "getProtocol" o = SocketGetProtocolMethodInfo
ResolveSocketMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSocketMethod "getRemoteAddress" o = SocketGetRemoteAddressMethodInfo
ResolveSocketMethod "getSocketType" o = SocketGetSocketTypeMethodInfo
ResolveSocketMethod "getTimeout" o = SocketGetTimeoutMethodInfo
ResolveSocketMethod "getTtl" o = SocketGetTtlMethodInfo
ResolveSocketMethod "setBlocking" o = SocketSetBlockingMethodInfo
ResolveSocketMethod "setBroadcast" o = SocketSetBroadcastMethodInfo
ResolveSocketMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSocketMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSocketMethod "setKeepalive" o = SocketSetKeepaliveMethodInfo
ResolveSocketMethod "setListenBacklog" o = SocketSetListenBacklogMethodInfo
ResolveSocketMethod "setMulticastLoopback" o = SocketSetMulticastLoopbackMethodInfo
ResolveSocketMethod "setMulticastTtl" o = SocketSetMulticastTtlMethodInfo
ResolveSocketMethod "setOption" o = SocketSetOptionMethodInfo
ResolveSocketMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSocketMethod "setTimeout" o = SocketSetTimeoutMethodInfo
ResolveSocketMethod "setTtl" o = SocketSetTtlMethodInfo
ResolveSocketMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSocketMethod t Socket, O.OverloadedMethod info Socket p) => OL.IsLabel t (Socket -> 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 ~ ResolveSocketMethod t Socket, O.OverloadedMethod info Socket p, R.HasField t Socket p) => R.HasField t Socket p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSocketMethod t Socket, O.OverloadedMethodInfo info Socket) => OL.IsLabel t (O.MethodProxy info Socket) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getSocketBlocking :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketBlocking :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Bool
getSocketBlocking o
obj = IO Bool -> m Bool
forall a. IO a -> m a
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
"blocking"
setSocketBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketBlocking :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Bool -> m ()
setSocketBlocking o
obj Bool
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 -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"blocking" Bool
val
constructSocketBlocking :: (IsSocket o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructSocketBlocking :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructSocketBlocking Bool
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 -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"blocking" Bool
val
#if defined(ENABLE_OVERLOADING)
data SocketBlockingPropertyInfo
instance AttrInfo SocketBlockingPropertyInfo where
type AttrAllowedOps SocketBlockingPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketBlockingPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketBlockingPropertyInfo = (~) Bool
type AttrTransferTypeConstraint SocketBlockingPropertyInfo = (~) Bool
type AttrTransferType SocketBlockingPropertyInfo = Bool
type AttrGetType SocketBlockingPropertyInfo = Bool
type AttrLabel SocketBlockingPropertyInfo = "blocking"
type AttrOrigin SocketBlockingPropertyInfo = Socket
attrGet = getSocketBlocking
attrSet = setSocketBlocking
attrTransfer _ v = do
return v
attrConstruct = constructSocketBlocking
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.blocking"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:blocking"
})
#endif
getSocketBroadcast :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketBroadcast :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Bool
getSocketBroadcast o
obj = IO Bool -> m Bool
forall a. IO a -> m a
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
"broadcast"
setSocketBroadcast :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketBroadcast :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Bool -> m ()
setSocketBroadcast o
obj Bool
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 -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"broadcast" Bool
val
constructSocketBroadcast :: (IsSocket o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructSocketBroadcast :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructSocketBroadcast Bool
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 -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"broadcast" Bool
val
#if defined(ENABLE_OVERLOADING)
data SocketBroadcastPropertyInfo
instance AttrInfo SocketBroadcastPropertyInfo where
type AttrAllowedOps SocketBroadcastPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketBroadcastPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketBroadcastPropertyInfo = (~) Bool
type AttrTransferTypeConstraint SocketBroadcastPropertyInfo = (~) Bool
type AttrTransferType SocketBroadcastPropertyInfo = Bool
type AttrGetType SocketBroadcastPropertyInfo = Bool
type AttrLabel SocketBroadcastPropertyInfo = "broadcast"
type AttrOrigin SocketBroadcastPropertyInfo = Socket
attrGet = getSocketBroadcast
attrSet = setSocketBroadcast
attrTransfer _ v = do
return v
attrConstruct = constructSocketBroadcast
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.broadcast"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:broadcast"
})
#endif
getSocketFamily :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketFamily
getSocketFamily :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> m SocketFamily
getSocketFamily o
obj = IO SocketFamily -> m SocketFamily
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SocketFamily -> m SocketFamily)
-> IO SocketFamily -> m SocketFamily
forall a b. (a -> b) -> a -> b
$ o -> String -> IO SocketFamily
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"family"
constructSocketFamily :: (IsSocket o, MIO.MonadIO m) => Gio.Enums.SocketFamily -> m (GValueConstruct o)
constructSocketFamily :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
SocketFamily -> m (GValueConstruct o)
constructSocketFamily SocketFamily
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 -> SocketFamily -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"family" SocketFamily
val
#if defined(ENABLE_OVERLOADING)
data SocketFamilyPropertyInfo
instance AttrInfo SocketFamilyPropertyInfo where
type AttrAllowedOps SocketFamilyPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketFamilyPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketFamilyPropertyInfo = (~) Gio.Enums.SocketFamily
type AttrTransferTypeConstraint SocketFamilyPropertyInfo = (~) Gio.Enums.SocketFamily
type AttrTransferType SocketFamilyPropertyInfo = Gio.Enums.SocketFamily
type AttrGetType SocketFamilyPropertyInfo = Gio.Enums.SocketFamily
type AttrLabel SocketFamilyPropertyInfo = "family"
type AttrOrigin SocketFamilyPropertyInfo = Socket
attrGet = getSocketFamily
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSocketFamily
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.family"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:family"
})
#endif
getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32
getSocketFd :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Int32
getSocketFd 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
"fd"
constructSocketFd :: (IsSocket o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructSocketFd :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructSocketFd 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
"fd" Int32
val
#if defined(ENABLE_OVERLOADING)
data SocketFdPropertyInfo
instance AttrInfo SocketFdPropertyInfo where
type AttrAllowedOps SocketFdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketFdPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketFdPropertyInfo = (~) Int32
type AttrTransferTypeConstraint SocketFdPropertyInfo = (~) Int32
type AttrTransferType SocketFdPropertyInfo = Int32
type AttrGetType SocketFdPropertyInfo = Int32
type AttrLabel SocketFdPropertyInfo = "fd"
type AttrOrigin SocketFdPropertyInfo = Socket
attrGet = getSocketFd
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSocketFd
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.fd"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:fd"
})
#endif
getSocketKeepalive :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketKeepalive :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Bool
getSocketKeepalive o
obj = IO Bool -> m Bool
forall a. IO a -> m a
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
"keepalive"
setSocketKeepalive :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketKeepalive :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Bool -> m ()
setSocketKeepalive o
obj Bool
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 -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"keepalive" Bool
val
constructSocketKeepalive :: (IsSocket o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructSocketKeepalive :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructSocketKeepalive Bool
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 -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"keepalive" Bool
val
#if defined(ENABLE_OVERLOADING)
data SocketKeepalivePropertyInfo
instance AttrInfo SocketKeepalivePropertyInfo where
type AttrAllowedOps SocketKeepalivePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketKeepalivePropertyInfo = IsSocket
type AttrSetTypeConstraint SocketKeepalivePropertyInfo = (~) Bool
type AttrTransferTypeConstraint SocketKeepalivePropertyInfo = (~) Bool
type AttrTransferType SocketKeepalivePropertyInfo = Bool
type AttrGetType SocketKeepalivePropertyInfo = Bool
type AttrLabel SocketKeepalivePropertyInfo = "keepalive"
type AttrOrigin SocketKeepalivePropertyInfo = Socket
attrGet = getSocketKeepalive
attrSet = setSocketKeepalive
attrTransfer _ v = do
return v
attrConstruct = constructSocketKeepalive
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.keepalive"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:keepalive"
})
#endif
getSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> m Int32
getSocketListenBacklog :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Int32
getSocketListenBacklog 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"
setSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> Int32 -> m ()
setSocketListenBacklog :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Int32 -> m ()
setSocketListenBacklog 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
constructSocketListenBacklog :: (IsSocket o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructSocketListenBacklog :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructSocketListenBacklog 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 SocketListenBacklogPropertyInfo
instance AttrInfo SocketListenBacklogPropertyInfo where
type AttrAllowedOps SocketListenBacklogPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketListenBacklogPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketListenBacklogPropertyInfo = (~) Int32
type AttrTransferTypeConstraint SocketListenBacklogPropertyInfo = (~) Int32
type AttrTransferType SocketListenBacklogPropertyInfo = Int32
type AttrGetType SocketListenBacklogPropertyInfo = Int32
type AttrLabel SocketListenBacklogPropertyInfo = "listen-backlog"
type AttrOrigin SocketListenBacklogPropertyInfo = Socket
attrGet = getSocketListenBacklog
attrSet = setSocketListenBacklog
attrTransfer _ v = do
return v
attrConstruct = constructSocketListenBacklog
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.listenBacklog"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:listenBacklog"
})
#endif
getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe Gio.SocketAddress.SocketAddress)
getSocketLocalAddress :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> m (Maybe SocketAddress)
getSocketLocalAddress o
obj = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe SocketAddress) -> m (Maybe SocketAddress))
-> IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr SocketAddress -> SocketAddress)
-> IO (Maybe SocketAddress)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"local-address" ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress
#if defined(ENABLE_OVERLOADING)
data SocketLocalAddressPropertyInfo
instance AttrInfo SocketLocalAddressPropertyInfo where
type AttrAllowedOps SocketLocalAddressPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint SocketLocalAddressPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketLocalAddressPropertyInfo = (~) ()
type AttrTransferTypeConstraint SocketLocalAddressPropertyInfo = (~) ()
type AttrTransferType SocketLocalAddressPropertyInfo = ()
type AttrGetType SocketLocalAddressPropertyInfo = (Maybe Gio.SocketAddress.SocketAddress)
type AttrLabel SocketLocalAddressPropertyInfo = "local-address"
type AttrOrigin SocketLocalAddressPropertyInfo = Socket
attrGet = getSocketLocalAddress
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.localAddress"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:localAddress"
})
#endif
getSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketMulticastLoopback :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Bool
getSocketMulticastLoopback o
obj = IO Bool -> m Bool
forall a. IO a -> m a
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
"multicast-loopback"
setSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketMulticastLoopback :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Bool -> m ()
setSocketMulticastLoopback o
obj Bool
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 -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"multicast-loopback" Bool
val
constructSocketMulticastLoopback :: (IsSocket o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructSocketMulticastLoopback :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructSocketMulticastLoopback Bool
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 -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"multicast-loopback" Bool
val
#if defined(ENABLE_OVERLOADING)
data SocketMulticastLoopbackPropertyInfo
instance AttrInfo SocketMulticastLoopbackPropertyInfo where
type AttrAllowedOps SocketMulticastLoopbackPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketMulticastLoopbackPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketMulticastLoopbackPropertyInfo = (~) Bool
type AttrTransferTypeConstraint SocketMulticastLoopbackPropertyInfo = (~) Bool
type AttrTransferType SocketMulticastLoopbackPropertyInfo = Bool
type AttrGetType SocketMulticastLoopbackPropertyInfo = Bool
type AttrLabel SocketMulticastLoopbackPropertyInfo = "multicast-loopback"
type AttrOrigin SocketMulticastLoopbackPropertyInfo = Socket
attrGet = getSocketMulticastLoopback
attrSet = setSocketMulticastLoopback
attrTransfer _ v = do
return v
attrConstruct = constructSocketMulticastLoopback
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.multicastLoopback"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:multicastLoopback"
})
#endif
getSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketMulticastTtl :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Word32
getSocketMulticastTtl o
obj = IO Word32 -> m Word32
forall a. IO a -> m a
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
"multicast-ttl"
setSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketMulticastTtl :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Word32 -> m ()
setSocketMulticastTtl o
obj Word32
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 -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj String
"multicast-ttl" Word32
val
constructSocketMulticastTtl :: (IsSocket o, MIO.MonadIO m) => Word32 -> m (GValueConstruct o)
constructSocketMulticastTtl :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Word32 -> m (GValueConstruct o)
constructSocketMulticastTtl Word32
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 -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 String
"multicast-ttl" Word32
val
#if defined(ENABLE_OVERLOADING)
data SocketMulticastTtlPropertyInfo
instance AttrInfo SocketMulticastTtlPropertyInfo where
type AttrAllowedOps SocketMulticastTtlPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketMulticastTtlPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketMulticastTtlPropertyInfo = (~) Word32
type AttrTransferTypeConstraint SocketMulticastTtlPropertyInfo = (~) Word32
type AttrTransferType SocketMulticastTtlPropertyInfo = Word32
type AttrGetType SocketMulticastTtlPropertyInfo = Word32
type AttrLabel SocketMulticastTtlPropertyInfo = "multicast-ttl"
type AttrOrigin SocketMulticastTtlPropertyInfo = Socket
attrGet = getSocketMulticastTtl
attrSet = setSocketMulticastTtl
attrTransfer _ v = do
return v
attrConstruct = constructSocketMulticastTtl
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.multicastTtl"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:multicastTtl"
})
#endif
getSocketProtocol :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketProtocol
getSocketProtocol :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> m SocketProtocol
getSocketProtocol o
obj = IO SocketProtocol -> m SocketProtocol
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SocketProtocol -> m SocketProtocol)
-> IO SocketProtocol -> m SocketProtocol
forall a b. (a -> b) -> a -> b
$ o -> String -> IO SocketProtocol
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"protocol"
constructSocketProtocol :: (IsSocket o, MIO.MonadIO m) => Gio.Enums.SocketProtocol -> m (GValueConstruct o)
constructSocketProtocol :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
SocketProtocol -> m (GValueConstruct o)
constructSocketProtocol SocketProtocol
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 -> SocketProtocol -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"protocol" SocketProtocol
val
#if defined(ENABLE_OVERLOADING)
data SocketProtocolPropertyInfo
instance AttrInfo SocketProtocolPropertyInfo where
type AttrAllowedOps SocketProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketProtocolPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketProtocolPropertyInfo = (~) Gio.Enums.SocketProtocol
type AttrTransferTypeConstraint SocketProtocolPropertyInfo = (~) Gio.Enums.SocketProtocol
type AttrTransferType SocketProtocolPropertyInfo = Gio.Enums.SocketProtocol
type AttrGetType SocketProtocolPropertyInfo = Gio.Enums.SocketProtocol
type AttrLabel SocketProtocolPropertyInfo = "protocol"
type AttrOrigin SocketProtocolPropertyInfo = Socket
attrGet = getSocketProtocol
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSocketProtocol
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.protocol"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:protocol"
})
#endif
getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe Gio.SocketAddress.SocketAddress)
getSocketRemoteAddress :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> m (Maybe SocketAddress)
getSocketRemoteAddress o
obj = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe SocketAddress) -> m (Maybe SocketAddress))
-> IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr SocketAddress -> SocketAddress)
-> IO (Maybe SocketAddress)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"remote-address" ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress
#if defined(ENABLE_OVERLOADING)
data SocketRemoteAddressPropertyInfo
instance AttrInfo SocketRemoteAddressPropertyInfo where
type AttrAllowedOps SocketRemoteAddressPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint SocketRemoteAddressPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketRemoteAddressPropertyInfo = (~) ()
type AttrTransferTypeConstraint SocketRemoteAddressPropertyInfo = (~) ()
type AttrTransferType SocketRemoteAddressPropertyInfo = ()
type AttrGetType SocketRemoteAddressPropertyInfo = (Maybe Gio.SocketAddress.SocketAddress)
type AttrLabel SocketRemoteAddressPropertyInfo = "remote-address"
type AttrOrigin SocketRemoteAddressPropertyInfo = Socket
attrGet = getSocketRemoteAddress
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.remoteAddress"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:remoteAddress"
})
#endif
getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketTimeout :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Word32
getSocketTimeout o
obj = IO Word32 -> m Word32
forall a. IO a -> m a
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
"timeout"
setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketTimeout :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Word32 -> m ()
setSocketTimeout o
obj Word32
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 -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj String
"timeout" Word32
val
constructSocketTimeout :: (IsSocket o, MIO.MonadIO m) => Word32 -> m (GValueConstruct o)
constructSocketTimeout :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Word32 -> m (GValueConstruct o)
constructSocketTimeout Word32
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 -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 String
"timeout" Word32
val
#if defined(ENABLE_OVERLOADING)
data SocketTimeoutPropertyInfo
instance AttrInfo SocketTimeoutPropertyInfo where
type AttrAllowedOps SocketTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketTimeoutPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketTimeoutPropertyInfo = (~) Word32
type AttrTransferTypeConstraint SocketTimeoutPropertyInfo = (~) Word32
type AttrTransferType SocketTimeoutPropertyInfo = Word32
type AttrGetType SocketTimeoutPropertyInfo = Word32
type AttrLabel SocketTimeoutPropertyInfo = "timeout"
type AttrOrigin SocketTimeoutPropertyInfo = Socket
attrGet = getSocketTimeout
attrSet = setSocketTimeout
attrTransfer _ v = do
return v
attrConstruct = constructSocketTimeout
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.timeout"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:timeout"
})
#endif
getSocketTtl :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketTtl :: forall (m :: * -> *) o. (MonadIO m, IsSocket o) => o -> m Word32
getSocketTtl o
obj = IO Word32 -> m Word32
forall a. IO a -> m a
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
"ttl"
setSocketTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketTtl :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> Word32 -> m ()
setSocketTtl o
obj Word32
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 -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj String
"ttl" Word32
val
constructSocketTtl :: (IsSocket o, MIO.MonadIO m) => Word32 -> m (GValueConstruct o)
constructSocketTtl :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
Word32 -> m (GValueConstruct o)
constructSocketTtl Word32
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 -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 String
"ttl" Word32
val
#if defined(ENABLE_OVERLOADING)
data SocketTtlPropertyInfo
instance AttrInfo SocketTtlPropertyInfo where
type AttrAllowedOps SocketTtlPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketTtlPropertyInfo = IsSocket
type AttrSetTypeConstraint SocketTtlPropertyInfo = (~) Word32
type AttrTransferTypeConstraint SocketTtlPropertyInfo = (~) Word32
type AttrTransferType SocketTtlPropertyInfo = Word32
type AttrGetType SocketTtlPropertyInfo = Word32
type AttrLabel SocketTtlPropertyInfo = "ttl"
type AttrOrigin SocketTtlPropertyInfo = Socket
attrGet = getSocketTtl
attrSet = setSocketTtl
attrTransfer _ v = do
return v
attrConstruct = constructSocketTtl
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.ttl"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:ttl"
})
#endif
getSocketType :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketType
getSocketType :: forall (m :: * -> *) o.
(MonadIO m, IsSocket o) =>
o -> m SocketType
getSocketType o
obj = IO SocketType -> m SocketType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SocketType -> m SocketType) -> IO SocketType -> m SocketType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO SocketType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"type"
constructSocketType :: (IsSocket o, MIO.MonadIO m) => Gio.Enums.SocketType -> m (GValueConstruct o)
constructSocketType :: forall o (m :: * -> *).
(IsSocket o, MonadIO m) =>
SocketType -> m (GValueConstruct o)
constructSocketType SocketType
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 -> SocketType -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"type" SocketType
val
#if defined(ENABLE_OVERLOADING)
data SocketTypePropertyInfo
instance AttrInfo SocketTypePropertyInfo where
type AttrAllowedOps SocketTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketTypePropertyInfo = IsSocket
type AttrSetTypeConstraint SocketTypePropertyInfo = (~) Gio.Enums.SocketType
type AttrTransferTypeConstraint SocketTypePropertyInfo = (~) Gio.Enums.SocketType
type AttrTransferType SocketTypePropertyInfo = Gio.Enums.SocketType
type AttrGetType SocketTypePropertyInfo = Gio.Enums.SocketType
type AttrLabel SocketTypePropertyInfo = "type"
type AttrOrigin SocketTypePropertyInfo = Socket
attrGet = getSocketType
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSocketType
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.type"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#g:attr:type"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Socket
type instance O.AttributeList Socket = SocketAttributeList
type SocketAttributeList = ('[ '("blocking", SocketBlockingPropertyInfo), '("broadcast", SocketBroadcastPropertyInfo), '("family", SocketFamilyPropertyInfo), '("fd", SocketFdPropertyInfo), '("keepalive", SocketKeepalivePropertyInfo), '("listenBacklog", SocketListenBacklogPropertyInfo), '("localAddress", SocketLocalAddressPropertyInfo), '("multicastLoopback", SocketMulticastLoopbackPropertyInfo), '("multicastTtl", SocketMulticastTtlPropertyInfo), '("protocol", SocketProtocolPropertyInfo), '("remoteAddress", SocketRemoteAddressPropertyInfo), '("timeout", SocketTimeoutPropertyInfo), '("ttl", SocketTtlPropertyInfo), '("type", SocketTypePropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
socketBlocking :: AttrLabelProxy "blocking"
socketBlocking = AttrLabelProxy
socketBroadcast :: AttrLabelProxy "broadcast"
socketBroadcast = AttrLabelProxy
socketFamily :: AttrLabelProxy "family"
socketFamily = AttrLabelProxy
socketFd :: AttrLabelProxy "fd"
socketFd = AttrLabelProxy
socketKeepalive :: AttrLabelProxy "keepalive"
socketKeepalive = AttrLabelProxy
socketListenBacklog :: AttrLabelProxy "listenBacklog"
socketListenBacklog = AttrLabelProxy
socketLocalAddress :: AttrLabelProxy "localAddress"
socketLocalAddress = AttrLabelProxy
socketMulticastLoopback :: AttrLabelProxy "multicastLoopback"
socketMulticastLoopback = AttrLabelProxy
socketMulticastTtl :: AttrLabelProxy "multicastTtl"
socketMulticastTtl = AttrLabelProxy
socketProtocol :: AttrLabelProxy "protocol"
socketProtocol = AttrLabelProxy
socketRemoteAddress :: AttrLabelProxy "remoteAddress"
socketRemoteAddress = AttrLabelProxy
socketTimeout :: AttrLabelProxy "timeout"
socketTimeout = AttrLabelProxy
socketTtl :: AttrLabelProxy "ttl"
socketTtl = AttrLabelProxy
socketType :: AttrLabelProxy "type"
socketType = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Socket = SocketSignalList
type SocketSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_socket_new" g_socket_new ::
CUInt ->
CUInt ->
CInt ->
Ptr (Ptr GError) ->
IO (Ptr Socket)
socketNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.Enums.SocketFamily
-> Gio.Enums.SocketType
-> Gio.Enums.SocketProtocol
-> m Socket
socketNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SocketFamily -> SocketType -> SocketProtocol -> m Socket
socketNew SocketFamily
family SocketType
type_ SocketProtocol
protocol = IO Socket -> m Socket
forall a. IO a -> m a
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
let family' :: CUInt
family' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SocketFamily -> Int) -> SocketFamily -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketFamily -> Int
forall a. Enum a => a -> Int
fromEnum) SocketFamily
family
let type_' :: CUInt
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' :: CInt
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
IO Socket -> IO () -> IO Socket
forall a b. IO a -> IO b -> IO a
onException (do
result <- (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket))
-> (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a b. (a -> b) -> a -> b
$ CUInt -> CUInt -> CInt -> Ptr (Ptr GError) -> IO (Ptr Socket)
g_socket_new CUInt
family' CUInt
type_' CInt
protocol'
checkUnexpectedReturnNULL "socketNew" result
result' <- (wrapObject Socket) result
return result'
) (do
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_socket_new_from_fd" g_socket_new_from_fd ::
Int32 ->
Ptr (Ptr GError) ->
IO (Ptr Socket)
socketNewFromFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m Socket
socketNewFromFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m Socket
socketNewFromFd Int32
fd = IO Socket -> m Socket
forall a. IO a -> m a
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
IO Socket -> IO () -> IO Socket
forall a b. IO a -> IO b -> IO a
onException (do
result <- (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket))
-> (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a b. (a -> b) -> a -> b
$ Int32 -> Ptr (Ptr GError) -> IO (Ptr Socket)
g_socket_new_from_fd Int32
fd
checkUnexpectedReturnNULL "socketNewFromFd" result
result' <- (wrapObject Socket) result
return result'
) (do
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_socket_accept" g_socket_accept ::
Ptr Socket ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Socket)
socketAccept ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Socket
socketAccept :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> Maybe b -> m Socket
socketAccept a
socket Maybe b
cancellable = IO Socket -> m Socket
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
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_accept socket' maybeCancellable
checkUnexpectedReturnNULL "socketAccept" result
result' <- (wrapObject Socket) result
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketAcceptMethodInfo
instance (signature ~ (Maybe (b) -> m Socket), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketAcceptMethodInfo a signature where
overloadedMethod = socketAccept
instance O.OverloadedMethodInfo SocketAcceptMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketAccept",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketAccept"
})
#endif
foreign import ccall "g_socket_bind" g_socket_bind ::
Ptr Socket ->
Ptr Gio.SocketAddress.SocketAddress ->
CInt ->
Ptr (Ptr GError) ->
IO CInt
socketBind ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b) =>
a
-> b
-> Bool
-> m ()
socketBind :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b) =>
a -> b -> Bool -> m ()
socketBind a
socket b
address Bool
allowReuse = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
address' <- unsafeManagedPtrCastPtr address
let allowReuse' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
allowReuse
onException (do
_ <- propagateGError $ g_socket_bind socket' address' allowReuse'
touchManagedPtr socket
touchManagedPtr address
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketBindMethodInfo
instance (signature ~ (b -> Bool -> m ()), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b) => O.OverloadedMethod SocketBindMethodInfo a signature where
overloadedMethod = socketBind
instance O.OverloadedMethodInfo SocketBindMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketBind",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketBind"
})
#endif
foreign import ccall "g_socket_check_connect_result" g_socket_check_connect_result ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO CInt
socketCheckConnectResult ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m ()
socketCheckConnectResult :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m ()
socketCheckConnectResult a
socket = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
_ <- propagateGError $ g_socket_check_connect_result socket'
touchManagedPtr socket
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketCheckConnectResultMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketCheckConnectResultMethodInfo a signature where
overloadedMethod = socketCheckConnectResult
instance O.OverloadedMethodInfo SocketCheckConnectResultMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketCheckConnectResult",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketCheckConnectResult"
})
#endif
foreign import ccall "g_socket_close" g_socket_close ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO CInt
socketClose ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m ()
socketClose :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m ()
socketClose a
socket = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
_ <- propagateGError $ g_socket_close socket'
touchManagedPtr socket
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketCloseMethodInfo a signature where
overloadedMethod = socketClose
instance O.OverloadedMethodInfo SocketCloseMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketClose",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketClose"
})
#endif
foreign import ccall "g_socket_condition_check" g_socket_condition_check ::
Ptr Socket ->
CUInt ->
IO CUInt
socketConditionCheck ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> [GLib.Flags.IOCondition]
-> m [GLib.Flags.IOCondition]
socketConditionCheck :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> [IOCondition] -> m [IOCondition]
socketConditionCheck a
socket [IOCondition]
condition = IO [IOCondition] -> m [IOCondition]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [IOCondition] -> m [IOCondition])
-> IO [IOCondition] -> m [IOCondition]
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
result <- g_socket_condition_check socket' condition'
let result' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketConditionCheckMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> m [GLib.Flags.IOCondition]), MonadIO m, IsSocket a) => O.OverloadedMethod SocketConditionCheckMethodInfo a signature where
overloadedMethod = socketConditionCheck
instance O.OverloadedMethodInfo SocketConditionCheckMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketConditionCheck",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketConditionCheck"
})
#endif
foreign import ccall "g_socket_condition_timed_wait" g_socket_condition_timed_wait ::
Ptr Socket ->
CUInt ->
Int64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
socketConditionTimedWait ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> [GLib.Flags.IOCondition]
-> Int64
-> Maybe (b)
-> m ()
socketConditionTimedWait :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> [IOCondition] -> Int64 -> Maybe b -> m ()
socketConditionTimedWait a
socket [IOCondition]
condition Int64
timeoutUs Maybe b
cancellable = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
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
_ <- propagateGError $ g_socket_condition_timed_wait socket' condition' timeoutUs maybeCancellable
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConditionTimedWaitMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> Int64 -> Maybe (b) -> m ()), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketConditionTimedWaitMethodInfo a signature where
overloadedMethod = socketConditionTimedWait
instance O.OverloadedMethodInfo SocketConditionTimedWaitMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketConditionTimedWait",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketConditionTimedWait"
})
#endif
foreign import ccall "g_socket_condition_wait" g_socket_condition_wait ::
Ptr Socket ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
socketConditionWait ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> [GLib.Flags.IOCondition]
-> Maybe (b)
-> m ()
socketConditionWait :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> [IOCondition] -> Maybe b -> m ()
socketConditionWait a
socket [IOCondition]
condition Maybe b
cancellable = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
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
_ <- propagateGError $ g_socket_condition_wait socket' condition' maybeCancellable
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConditionWaitMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> Maybe (b) -> m ()), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketConditionWaitMethodInfo a signature where
overloadedMethod = socketConditionWait
instance O.OverloadedMethodInfo SocketConditionWaitMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketConditionWait",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketConditionWait"
})
#endif
foreign import ccall "g_socket_connect" g_socket_connect ::
Ptr Socket ->
Ptr Gio.SocketAddress.SocketAddress ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
socketConnect ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> Maybe (c)
-> m ()
socketConnect :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b,
IsCancellable c) =>
a -> b -> Maybe c -> m ()
socketConnect a
socket b
address Maybe c
cancellable = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
address' <- unsafeManagedPtrCastPtr address
maybeCancellable <- case cancellable of
Maybe c
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 c
jCancellable -> do
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_socket_connect socket' address' maybeCancellable
touchManagedPtr socket
touchManagedPtr address
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConnectMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod SocketConnectMethodInfo a signature where
overloadedMethod = socketConnect
instance O.OverloadedMethodInfo SocketConnectMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketConnect",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketConnect"
})
#endif
foreign import ccall "g_socket_connection_factory_create_connection" g_socket_connection_factory_create_connection ::
Ptr Socket ->
IO (Ptr Gio.SocketConnection.SocketConnection)
socketConnectionFactoryCreateConnection ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.SocketConnection.SocketConnection
socketConnectionFactoryCreateConnection :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketConnection
socketConnectionFactoryCreateConnection a
socket = IO SocketConnection -> m SocketConnection
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketConnection -> m SocketConnection)
-> IO SocketConnection -> m SocketConnection
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_connection_factory_create_connection socket'
checkUnexpectedReturnNULL "socketConnectionFactoryCreateConnection" result
result' <- (wrapObject Gio.SocketConnection.SocketConnection) result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketConnectionFactoryCreateConnectionMethodInfo
instance (signature ~ (m Gio.SocketConnection.SocketConnection), MonadIO m, IsSocket a) => O.OverloadedMethod SocketConnectionFactoryCreateConnectionMethodInfo a signature where
overloadedMethod = socketConnectionFactoryCreateConnection
instance O.OverloadedMethodInfo SocketConnectionFactoryCreateConnectionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketConnectionFactoryCreateConnection",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketConnectionFactoryCreateConnection"
})
#endif
foreign import ccall "g_socket_get_available_bytes" g_socket_get_available_bytes ::
Ptr Socket ->
IO DI.Int64
socketGetAvailableBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m DI.Int64
socketGetAvailableBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Int64
socketGetAvailableBytes a
socket = IO Int64 -> m Int64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_available_bytes socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetAvailableBytesMethodInfo
instance (signature ~ (m DI.Int64), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetAvailableBytesMethodInfo a signature where
overloadedMethod = socketGetAvailableBytes
instance O.OverloadedMethodInfo SocketGetAvailableBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetAvailableBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetAvailableBytes"
})
#endif
foreign import ccall "g_socket_get_blocking" g_socket_get_blocking ::
Ptr Socket ->
IO CInt
socketGetBlocking ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketGetBlocking :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketGetBlocking a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_blocking socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetBlockingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetBlockingMethodInfo a signature where
overloadedMethod = socketGetBlocking
instance O.OverloadedMethodInfo SocketGetBlockingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetBlocking",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetBlocking"
})
#endif
foreign import ccall "g_socket_get_broadcast" g_socket_get_broadcast ::
Ptr Socket ->
IO CInt
socketGetBroadcast ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketGetBroadcast :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketGetBroadcast a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_broadcast socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetBroadcastMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetBroadcastMethodInfo a signature where
overloadedMethod = socketGetBroadcast
instance O.OverloadedMethodInfo SocketGetBroadcastMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetBroadcast",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetBroadcast"
})
#endif
foreign import ccall "g_socket_get_credentials" g_socket_get_credentials ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Credentials.Credentials)
socketGetCredentials ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.Credentials.Credentials
socketGetCredentials :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Credentials
socketGetCredentials a
socket = IO Credentials -> m Credentials
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credentials -> m Credentials)
-> IO Credentials -> m Credentials
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
result <- propagateGError $ g_socket_get_credentials socket'
checkUnexpectedReturnNULL "socketGetCredentials" result
result' <- (wrapObject Gio.Credentials.Credentials) result
touchManagedPtr socket
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetCredentialsMethodInfo
instance (signature ~ (m Gio.Credentials.Credentials), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetCredentialsMethodInfo a signature where
overloadedMethod = socketGetCredentials
instance O.OverloadedMethodInfo SocketGetCredentialsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetCredentials",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetCredentials"
})
#endif
foreign import ccall "g_socket_get_family" g_socket_get_family ::
Ptr Socket ->
IO CUInt
socketGetFamily ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.Enums.SocketFamily
socketGetFamily :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketFamily
socketGetFamily a
socket = IO SocketFamily -> m SocketFamily
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketFamily -> m SocketFamily)
-> IO SocketFamily -> m SocketFamily
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_family socket'
let result' = (Int -> SocketFamily
forall a. Enum a => Int -> a
toEnum (Int -> SocketFamily) -> (CUInt -> Int) -> CUInt -> SocketFamily
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetFamilyMethodInfo
instance (signature ~ (m Gio.Enums.SocketFamily), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetFamilyMethodInfo a signature where
overloadedMethod = socketGetFamily
instance O.OverloadedMethodInfo SocketGetFamilyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetFamily",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetFamily"
})
#endif
foreign import ccall "g_socket_get_fd" g_socket_get_fd ::
Ptr Socket ->
IO Int32
socketGetFd ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Int32
socketGetFd :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Int32
socketGetFd a
socket = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_fd socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetFdMethodInfo a signature where
overloadedMethod = socketGetFd
instance O.OverloadedMethodInfo SocketGetFdMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetFd"
})
#endif
foreign import ccall "g_socket_get_keepalive" g_socket_get_keepalive ::
Ptr Socket ->
IO CInt
socketGetKeepalive ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketGetKeepalive :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketGetKeepalive a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_keepalive socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetKeepaliveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetKeepaliveMethodInfo a signature where
overloadedMethod = socketGetKeepalive
instance O.OverloadedMethodInfo SocketGetKeepaliveMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetKeepalive",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetKeepalive"
})
#endif
foreign import ccall "g_socket_get_listen_backlog" g_socket_get_listen_backlog ::
Ptr Socket ->
IO Int32
socketGetListenBacklog ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Int32
socketGetListenBacklog :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Int32
socketGetListenBacklog a
socket = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_listen_backlog socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetListenBacklogMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetListenBacklogMethodInfo a signature where
overloadedMethod = socketGetListenBacklog
instance O.OverloadedMethodInfo SocketGetListenBacklogMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetListenBacklog",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetListenBacklog"
})
#endif
foreign import ccall "g_socket_get_local_address" g_socket_get_local_address ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketAddress.SocketAddress)
socketGetLocalAddress ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.SocketAddress.SocketAddress
socketGetLocalAddress :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketAddress
socketGetLocalAddress a
socket = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
result <- propagateGError $ g_socket_get_local_address socket'
checkUnexpectedReturnNULL "socketGetLocalAddress" result
result' <- (wrapObject Gio.SocketAddress.SocketAddress) result
touchManagedPtr socket
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetLocalAddressMethodInfo
instance (signature ~ (m Gio.SocketAddress.SocketAddress), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetLocalAddressMethodInfo a signature where
overloadedMethod = socketGetLocalAddress
instance O.OverloadedMethodInfo SocketGetLocalAddressMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetLocalAddress",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetLocalAddress"
})
#endif
foreign import ccall "g_socket_get_multicast_loopback" g_socket_get_multicast_loopback ::
Ptr Socket ->
IO CInt
socketGetMulticastLoopback ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketGetMulticastLoopback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketGetMulticastLoopback a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_multicast_loopback socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetMulticastLoopbackMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetMulticastLoopbackMethodInfo a signature where
overloadedMethod = socketGetMulticastLoopback
instance O.OverloadedMethodInfo SocketGetMulticastLoopbackMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetMulticastLoopback",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetMulticastLoopback"
})
#endif
foreign import ccall "g_socket_get_multicast_ttl" g_socket_get_multicast_ttl ::
Ptr Socket ->
IO Word32
socketGetMulticastTtl ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Word32
socketGetMulticastTtl :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Word32
socketGetMulticastTtl a
socket = IO Word32 -> m Word32
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_multicast_ttl socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetMulticastTtlMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetMulticastTtlMethodInfo a signature where
overloadedMethod = socketGetMulticastTtl
instance O.OverloadedMethodInfo SocketGetMulticastTtlMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetMulticastTtl",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetMulticastTtl"
})
#endif
foreign import ccall "g_socket_get_option" g_socket_get_option ::
Ptr Socket ->
Int32 ->
Int32 ->
Ptr Int32 ->
Ptr (Ptr GError) ->
IO CInt
socketGetOption ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Int32
-> Int32
-> m (Int32)
socketGetOption :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Int32 -> Int32 -> m Int32
socketGetOption a
socket Int32
level Int32
optname = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
value <- allocMem :: IO (Ptr Int32)
onException (do
_ <- propagateGError $ g_socket_get_option socket' level optname value
value' <- peek value
touchManagedPtr socket
freeMem value
return value'
) (do
freeMem value
)
#if defined(ENABLE_OVERLOADING)
data SocketGetOptionMethodInfo
instance (signature ~ (Int32 -> Int32 -> m (Int32)), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetOptionMethodInfo a signature where
overloadedMethod = socketGetOption
instance O.OverloadedMethodInfo SocketGetOptionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetOption",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetOption"
})
#endif
foreign import ccall "g_socket_get_protocol" g_socket_get_protocol ::
Ptr Socket ->
IO CInt
socketGetProtocol ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.Enums.SocketProtocol
socketGetProtocol :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketProtocol
socketGetProtocol a
socket = IO SocketProtocol -> m SocketProtocol
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketProtocol -> m SocketProtocol)
-> IO SocketProtocol -> m SocketProtocol
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_protocol socket'
let result' = (Int -> SocketProtocol
forall a. Enum a => Int -> a
toEnum (Int -> SocketProtocol) -> (CInt -> Int) -> CInt -> SocketProtocol
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetProtocolMethodInfo
instance (signature ~ (m Gio.Enums.SocketProtocol), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetProtocolMethodInfo a signature where
overloadedMethod = socketGetProtocol
instance O.OverloadedMethodInfo SocketGetProtocolMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetProtocol",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetProtocol"
})
#endif
foreign import ccall "g_socket_get_remote_address" g_socket_get_remote_address ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketAddress.SocketAddress)
socketGetRemoteAddress ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.SocketAddress.SocketAddress
socketGetRemoteAddress :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketAddress
socketGetRemoteAddress a
socket = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
result <- propagateGError $ g_socket_get_remote_address socket'
checkUnexpectedReturnNULL "socketGetRemoteAddress" result
result' <- (wrapObject Gio.SocketAddress.SocketAddress) result
touchManagedPtr socket
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetRemoteAddressMethodInfo
instance (signature ~ (m Gio.SocketAddress.SocketAddress), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetRemoteAddressMethodInfo a signature where
overloadedMethod = socketGetRemoteAddress
instance O.OverloadedMethodInfo SocketGetRemoteAddressMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetRemoteAddress",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetRemoteAddress"
})
#endif
foreign import ccall "g_socket_get_socket_type" g_socket_get_socket_type ::
Ptr Socket ->
IO CUInt
socketGetSocketType ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Gio.Enums.SocketType
socketGetSocketType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m SocketType
socketGetSocketType a
socket = IO SocketType -> m SocketType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketType -> m SocketType) -> IO SocketType -> m SocketType
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_socket_type socket'
let result' = (Int -> SocketType
forall a. Enum a => Int -> a
toEnum (Int -> SocketType) -> (CUInt -> Int) -> CUInt -> SocketType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketGetSocketTypeMethodInfo
instance (signature ~ (m Gio.Enums.SocketType), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetSocketTypeMethodInfo a signature where
overloadedMethod = socketGetSocketType
instance O.OverloadedMethodInfo SocketGetSocketTypeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetSocketType",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetSocketType"
})
#endif
foreign import ccall "g_socket_get_timeout" g_socket_get_timeout ::
Ptr Socket ->
IO Word32
socketGetTimeout ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Word32
socketGetTimeout :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Word32
socketGetTimeout a
socket = IO Word32 -> m Word32
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_timeout socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetTimeoutMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetTimeoutMethodInfo a signature where
overloadedMethod = socketGetTimeout
instance O.OverloadedMethodInfo SocketGetTimeoutMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetTimeout",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetTimeout"
})
#endif
foreign import ccall "g_socket_get_ttl" g_socket_get_ttl ::
Ptr Socket ->
IO Word32
socketGetTtl ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Word32
socketGetTtl :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Word32
socketGetTtl a
socket = IO Word32 -> m Word32
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_get_ttl socket'
touchManagedPtr socket
return result
#if defined(ENABLE_OVERLOADING)
data SocketGetTtlMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.OverloadedMethod SocketGetTtlMethodInfo a signature where
overloadedMethod = socketGetTtl
instance O.OverloadedMethodInfo SocketGetTtlMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketGetTtl",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketGetTtl"
})
#endif
foreign import ccall "g_socket_is_closed" g_socket_is_closed ::
Ptr Socket ->
IO CInt
socketIsClosed ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketIsClosed :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketIsClosed a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_is_closed socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketIsClosedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketIsClosedMethodInfo a signature where
overloadedMethod = socketIsClosed
instance O.OverloadedMethodInfo SocketIsClosedMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketIsClosed",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketIsClosed"
})
#endif
foreign import ccall "g_socket_is_connected" g_socket_is_connected ::
Ptr Socket ->
IO CInt
socketIsConnected ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketIsConnected :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketIsConnected a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_is_connected socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketIsConnectedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketIsConnectedMethodInfo a signature where
overloadedMethod = socketIsConnected
instance O.OverloadedMethodInfo SocketIsConnectedMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketIsConnected",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketIsConnected"
})
#endif
foreign import ccall "g_socket_join_multicast_group" g_socket_join_multicast_group ::
Ptr Socket ->
Ptr Gio.InetAddress.InetAddress ->
CInt ->
CString ->
Ptr (Ptr GError) ->
IO CInt
socketJoinMulticastGroup ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) =>
a
-> b
-> Bool
-> Maybe (T.Text)
-> m ()
socketJoinMulticastGroup :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) =>
a -> b -> Bool -> Maybe Text -> m ()
socketJoinMulticastGroup a
socket b
group Bool
sourceSpecific Maybe Text
iface = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
group' <- unsafeManagedPtrCastPtr group
let sourceSpecific' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
sourceSpecific
maybeIface <- case iface of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jIface -> do
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
return jIface'
onException (do
_ <- propagateGError $ g_socket_join_multicast_group socket' group' sourceSpecific' maybeIface
touchManagedPtr socket
touchManagedPtr group
freeMem maybeIface
return ()
) (do
freeMem maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketJoinMulticastGroupMethodInfo
instance (signature ~ (b -> Bool -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) => O.OverloadedMethod SocketJoinMulticastGroupMethodInfo a signature where
overloadedMethod = socketJoinMulticastGroup
instance O.OverloadedMethodInfo SocketJoinMulticastGroupMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketJoinMulticastGroup",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketJoinMulticastGroup"
})
#endif
foreign import ccall "g_socket_join_multicast_group_ssm" g_socket_join_multicast_group_ssm ::
Ptr Socket ->
Ptr Gio.InetAddress.InetAddress ->
Ptr Gio.InetAddress.InetAddress ->
CString ->
Ptr (Ptr GError) ->
IO CInt
socketJoinMulticastGroupSsm ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b, Gio.InetAddress.IsInetAddress c) =>
a
-> b
-> Maybe (c)
-> Maybe (T.Text)
-> m ()
socketJoinMulticastGroupSsm :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsInetAddress b,
IsInetAddress c) =>
a -> b -> Maybe c -> Maybe Text -> m ()
socketJoinMulticastGroupSsm a
socket b
group Maybe c
sourceSpecific Maybe Text
iface = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
group' <- unsafeManagedPtrCastPtr group
maybeSourceSpecific <- case sourceSpecific of
Maybe c
Nothing -> Ptr InetAddress -> IO (Ptr InetAddress)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
forall a. Ptr a
FP.nullPtr
Just c
jSourceSpecific -> do
jSourceSpecific' <- c -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceSpecific
return jSourceSpecific'
maybeIface <- case iface of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jIface -> do
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
return jIface'
onException (do
_ <- propagateGError $ g_socket_join_multicast_group_ssm socket' group' maybeSourceSpecific maybeIface
touchManagedPtr socket
touchManagedPtr group
whenJust sourceSpecific touchManagedPtr
freeMem maybeIface
return ()
) (do
freeMem maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketJoinMulticastGroupSsmMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b, Gio.InetAddress.IsInetAddress c) => O.OverloadedMethod SocketJoinMulticastGroupSsmMethodInfo a signature where
overloadedMethod = socketJoinMulticastGroupSsm
instance O.OverloadedMethodInfo SocketJoinMulticastGroupSsmMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketJoinMulticastGroupSsm",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketJoinMulticastGroupSsm"
})
#endif
foreign import ccall "g_socket_leave_multicast_group" g_socket_leave_multicast_group ::
Ptr Socket ->
Ptr Gio.InetAddress.InetAddress ->
CInt ->
CString ->
Ptr (Ptr GError) ->
IO CInt
socketLeaveMulticastGroup ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) =>
a
-> b
-> Bool
-> Maybe (T.Text)
-> m ()
socketLeaveMulticastGroup :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsInetAddress b) =>
a -> b -> Bool -> Maybe Text -> m ()
socketLeaveMulticastGroup a
socket b
group Bool
sourceSpecific Maybe Text
iface = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
group' <- unsafeManagedPtrCastPtr group
let sourceSpecific' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
sourceSpecific
maybeIface <- case iface of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jIface -> do
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
return jIface'
onException (do
_ <- propagateGError $ g_socket_leave_multicast_group socket' group' sourceSpecific' maybeIface
touchManagedPtr socket
touchManagedPtr group
freeMem maybeIface
return ()
) (do
freeMem maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketLeaveMulticastGroupMethodInfo
instance (signature ~ (b -> Bool -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) => O.OverloadedMethod SocketLeaveMulticastGroupMethodInfo a signature where
overloadedMethod = socketLeaveMulticastGroup
instance O.OverloadedMethodInfo SocketLeaveMulticastGroupMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketLeaveMulticastGroup",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketLeaveMulticastGroup"
})
#endif
foreign import ccall "g_socket_leave_multicast_group_ssm" g_socket_leave_multicast_group_ssm ::
Ptr Socket ->
Ptr Gio.InetAddress.InetAddress ->
Ptr Gio.InetAddress.InetAddress ->
CString ->
Ptr (Ptr GError) ->
IO CInt
socketLeaveMulticastGroupSsm ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b, Gio.InetAddress.IsInetAddress c) =>
a
-> b
-> Maybe (c)
-> Maybe (T.Text)
-> m ()
socketLeaveMulticastGroupSsm :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsInetAddress b,
IsInetAddress c) =>
a -> b -> Maybe c -> Maybe Text -> m ()
socketLeaveMulticastGroupSsm a
socket b
group Maybe c
sourceSpecific Maybe Text
iface = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
group' <- unsafeManagedPtrCastPtr group
maybeSourceSpecific <- case sourceSpecific of
Maybe c
Nothing -> Ptr InetAddress -> IO (Ptr InetAddress)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
forall a. Ptr a
FP.nullPtr
Just c
jSourceSpecific -> do
jSourceSpecific' <- c -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceSpecific
return jSourceSpecific'
maybeIface <- case iface of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
FP.nullPtr
Just Text
jIface -> do
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
return jIface'
onException (do
_ <- propagateGError $ g_socket_leave_multicast_group_ssm socket' group' maybeSourceSpecific maybeIface
touchManagedPtr socket
touchManagedPtr group
whenJust sourceSpecific touchManagedPtr
freeMem maybeIface
return ()
) (do
freeMem maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketLeaveMulticastGroupSsmMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b, Gio.InetAddress.IsInetAddress c) => O.OverloadedMethod SocketLeaveMulticastGroupSsmMethodInfo a signature where
overloadedMethod = socketLeaveMulticastGroupSsm
instance O.OverloadedMethodInfo SocketLeaveMulticastGroupSsmMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketLeaveMulticastGroupSsm",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketLeaveMulticastGroupSsm"
})
#endif
foreign import ccall "g_socket_listen" g_socket_listen ::
Ptr Socket ->
Ptr (Ptr GError) ->
IO CInt
socketListen ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m ()
socketListen :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m ()
socketListen a
socket = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
_ <- propagateGError $ g_socket_listen socket'
touchManagedPtr socket
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketListenMethodInfo a signature where
overloadedMethod = socketListen
instance O.OverloadedMethodInfo SocketListenMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketListen",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketListen"
})
#endif
foreign import ccall "g_socket_receive" g_socket_receive ::
Ptr Socket ->
Ptr Word8 ->
FCT.CSize ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketReceive ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (b)
-> m ((DI.Int64, ByteString))
socketReceive :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> ByteString -> Maybe b -> m (Int64, ByteString)
socketReceive a
socket ByteString
buffer Maybe b
cancellable = IO (Int64, ByteString) -> m (Int64, ByteString)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int64, ByteString) -> m (Int64, ByteString))
-> IO (Int64, ByteString) -> m (Int64, ByteString)
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
buffer' <- packByteString buffer
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_receive socket' buffer' size maybeCancellable
buffer'' <- (unpackByteStringWithLength size) buffer'
freeMem buffer'
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return (result, buffer'')
) (do
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m ((DI.Int64, ByteString))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveMethodInfo a signature where
overloadedMethod = socketReceive
instance O.OverloadedMethodInfo SocketReceiveMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceive",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceive"
})
#endif
foreign import ccall "g_socket_receive_bytes" g_socket_receive_bytes ::
Ptr Socket ->
FCT.CSize ->
Int64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
socketReceiveBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> FCT.CSize
-> Int64
-> Maybe (b)
-> m GLib.Bytes.Bytes
socketReceiveBytes :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> CSize -> Int64 -> Maybe b -> m Bytes
socketReceiveBytes a
socket CSize
size Int64
timeoutUs Maybe b
cancellable = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
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_receive_bytes socket' size timeoutUs maybeCancellable
checkUnexpectedReturnNULL "socketReceiveBytes" result
result' <- (wrapBoxed GLib.Bytes.Bytes) result
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveBytesMethodInfo
instance (signature ~ (FCT.CSize -> Int64 -> Maybe (b) -> m GLib.Bytes.Bytes), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveBytesMethodInfo a signature where
overloadedMethod = socketReceiveBytes
instance O.OverloadedMethodInfo SocketReceiveBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveBytes"
})
#endif
foreign import ccall "g_socket_receive_bytes_from" g_socket_receive_bytes_from ::
Ptr Socket ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
FCT.CSize ->
Int64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
socketReceiveBytesFrom ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> FCT.CSize
-> Int64
-> Maybe (b)
-> m ((GLib.Bytes.Bytes, Gio.SocketAddress.SocketAddress))
socketReceiveBytesFrom :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> CSize -> Int64 -> Maybe b -> m (Bytes, SocketAddress)
socketReceiveBytesFrom a
socket CSize
size Int64
timeoutUs Maybe b
cancellable = IO (Bytes, SocketAddress) -> m (Bytes, SocketAddress)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bytes, SocketAddress) -> m (Bytes, SocketAddress))
-> IO (Bytes, SocketAddress) -> m (Bytes, SocketAddress)
forall a b. (a -> b) -> a -> b
$ do
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
address <- callocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
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_receive_bytes_from socket' address size timeoutUs maybeCancellable
checkUnexpectedReturnNULL "socketReceiveBytesFrom" result
result' <- (wrapBoxed GLib.Bytes.Bytes) result
address' <- peek address
address'' <- (wrapObject Gio.SocketAddress.SocketAddress) address'
touchManagedPtr socket
whenJust cancellable touchManagedPtr
freeMem address
return (result', address'')
) (do
freeMem address
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveBytesFromMethodInfo
instance (signature ~ (FCT.CSize -> Int64 -> Maybe (b) -> m ((GLib.Bytes.Bytes, Gio.SocketAddress.SocketAddress))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveBytesFromMethodInfo a signature where
overloadedMethod = socketReceiveBytesFrom
instance O.OverloadedMethodInfo SocketReceiveBytesFromMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveBytesFrom",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveBytesFrom"
})
#endif
foreign import ccall "g_socket_receive_from" g_socket_receive_from ::
Ptr Socket ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
Ptr Word8 ->
FCT.CSize ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketReceiveFrom ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (b)
-> m ((DI.Int64, Gio.SocketAddress.SocketAddress, ByteString))
socketReceiveFrom :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> ByteString -> Maybe b -> m (Int64, SocketAddress, ByteString)
socketReceiveFrom a
socket ByteString
buffer Maybe b
cancellable = IO (Int64, SocketAddress, ByteString)
-> m (Int64, SocketAddress, ByteString)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int64, SocketAddress, ByteString)
-> m (Int64, SocketAddress, ByteString))
-> IO (Int64, SocketAddress, ByteString)
-> m (Int64, SocketAddress, ByteString)
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
address <- callocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
buffer' <- packByteString buffer
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_receive_from socket' address buffer' size maybeCancellable
address' <- peek address
address'' <- (wrapObject Gio.SocketAddress.SocketAddress) address'
buffer'' <- (unpackByteStringWithLength size) buffer'
freeMem buffer'
touchManagedPtr socket
whenJust cancellable touchManagedPtr
freeMem address
return (result, address'', buffer'')
) (do
freeMem address
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveFromMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m ((DI.Int64, Gio.SocketAddress.SocketAddress, ByteString))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveFromMethodInfo a signature where
overloadedMethod = socketReceiveFrom
instance O.OverloadedMethodInfo SocketReceiveFromMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveFrom",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveFrom"
})
#endif
foreign import ccall "g_socket_receive_message" g_socket_receive_message ::
Ptr Socket ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
Ptr Gio.InputVector.InputVector ->
Int32 ->
Ptr (Ptr (Ptr Gio.SocketControlMessage.SocketControlMessage)) ->
Ptr Int32 ->
Ptr Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketReceiveMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.InputVector.InputVector]
-> Int32
-> Maybe (b)
-> m ((DI.Int64, Maybe Gio.SocketAddress.SocketAddress, Maybe [Gio.SocketControlMessage.SocketControlMessage], Int32))
socketReceiveMessage :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a
-> [InputVector]
-> Int32
-> Maybe b
-> m (Int64, Maybe SocketAddress, Maybe [SocketControlMessage],
Int32)
socketReceiveMessage a
socket [InputVector]
vectors Int32
flags Maybe b
cancellable = IO
(Int64, Maybe SocketAddress, Maybe [SocketControlMessage], Int32)
-> m (Int64, Maybe SocketAddress, Maybe [SocketControlMessage],
Int32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
(Int64, Maybe SocketAddress, Maybe [SocketControlMessage], Int32)
-> m (Int64, Maybe SocketAddress, Maybe [SocketControlMessage],
Int32))
-> IO
(Int64, Maybe SocketAddress, Maybe [SocketControlMessage], Int32)
-> m (Int64, Maybe SocketAddress, Maybe [SocketControlMessage],
Int32)
forall a b. (a -> b) -> a -> b
$ do
let numVectors :: Int32
numVectors = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [InputVector] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [InputVector]
vectors
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
address <- callocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
vectors' <- mapM unsafeManagedPtrGetPtr vectors
vectors'' <- packBlockArray 16 vectors'
messages <- callocMem :: IO (Ptr (Ptr (Ptr Gio.SocketControlMessage.SocketControlMessage)))
numMessages <- allocMem :: IO (Ptr Int32)
flags' <- allocMem :: IO (Ptr Int32)
poke flags' flags
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_receive_message socket' address vectors'' numVectors messages numMessages flags' maybeCancellable
numMessages' <- peek numMessages
address' <- peek address
maybeAddress' <- convertIfNonNull address' $ \Ptr SocketAddress
address'' -> do
address''' <- ((ManagedPtr SocketAddress -> SocketAddress)
-> Ptr SocketAddress -> IO SocketAddress
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress) Ptr SocketAddress
address''
return address'''
messages' <- peek messages
maybeMessages' <- convertIfNonNull messages' $ \Ptr (Ptr SocketControlMessage)
messages'' -> do
messages''' <- (Int32
-> Ptr (Ptr SocketControlMessage) -> IO [Ptr SocketControlMessage]
forall a b. Integral a => a -> Ptr (Ptr b) -> IO [Ptr b]
unpackPtrArrayWithLength Int32
numMessages') Ptr (Ptr SocketControlMessage)
messages''
messages'''' <- mapM (wrapObject Gio.SocketControlMessage.SocketControlMessage) messages'''
freeMem messages''
return messages''''
flags'' <- peek flags'
touchManagedPtr socket
mapM_ touchManagedPtr vectors
whenJust cancellable touchManagedPtr
freeMem address
freeMem vectors''
freeMem messages
freeMem numMessages
freeMem flags'
return (result, maybeAddress', maybeMessages', flags'')
) (do
freeMem address
freeMem vectors''
freeMem messages
freeMem numMessages
freeMem flags'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveMessageMethodInfo
instance (signature ~ ([Gio.InputVector.InputVector] -> Int32 -> Maybe (b) -> m ((DI.Int64, Maybe Gio.SocketAddress.SocketAddress, Maybe [Gio.SocketControlMessage.SocketControlMessage], Int32))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveMessageMethodInfo a signature where
overloadedMethod = socketReceiveMessage
instance O.OverloadedMethodInfo SocketReceiveMessageMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveMessage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveMessage"
})
#endif
foreign import ccall "g_socket_receive_messages" g_socket_receive_messages ::
Ptr Socket ->
Ptr Gio.InputMessage.InputMessage ->
Word32 ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int32
socketReceiveMessages ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.InputMessage.InputMessage]
-> Int32
-> Maybe (b)
-> m Int32
socketReceiveMessages :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> [InputMessage] -> Int32 -> Maybe b -> m Int32
socketReceiveMessages a
socket [InputMessage]
messages Int32
flags Maybe b
cancellable = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
let numMessages :: Word32
numMessages = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [InputMessage] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [InputMessage]
messages
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
messages' <- mapM unsafeManagedPtrGetPtr messages
messages'' <- packBlockArray 56 messages'
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_receive_messages socket' messages'' numMessages flags maybeCancellable
touchManagedPtr socket
mapM_ touchManagedPtr messages
whenJust cancellable touchManagedPtr
freeMem messages''
return result
) (do
freeMem messages''
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveMessagesMethodInfo
instance (signature ~ ([Gio.InputMessage.InputMessage] -> Int32 -> Maybe (b) -> m Int32), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveMessagesMethodInfo a signature where
overloadedMethod = socketReceiveMessages
instance O.OverloadedMethodInfo SocketReceiveMessagesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveMessages",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveMessages"
})
#endif
foreign import ccall "g_socket_receive_with_blocking" g_socket_receive_with_blocking ::
Ptr Socket ->
Ptr Word8 ->
FCT.CSize ->
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketReceiveWithBlocking ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Bool
-> Maybe (b)
-> m ((DI.Int64, ByteString))
socketReceiveWithBlocking :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> ByteString -> Bool -> Maybe b -> m (Int64, ByteString)
socketReceiveWithBlocking a
socket ByteString
buffer Bool
blocking Maybe b
cancellable = IO (Int64, ByteString) -> m (Int64, ByteString)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int64, ByteString) -> m (Int64, ByteString))
-> IO (Int64, ByteString) -> m (Int64, ByteString)
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
buffer' <- packByteString buffer
let blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
blocking
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_receive_with_blocking socket' buffer' size blocking' maybeCancellable
buffer'' <- (unpackByteStringWithLength size) buffer'
freeMem buffer'
touchManagedPtr socket
whenJust cancellable touchManagedPtr
return (result, buffer'')
) (do
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveWithBlockingMethodInfo
instance (signature ~ (ByteString -> Bool -> Maybe (b) -> m ((DI.Int64, ByteString))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketReceiveWithBlockingMethodInfo a signature where
overloadedMethod = socketReceiveWithBlocking
instance O.OverloadedMethodInfo SocketReceiveWithBlockingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketReceiveWithBlocking",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketReceiveWithBlocking"
})
#endif
foreign import ccall "g_socket_send" g_socket_send ::
Ptr Socket ->
Ptr Word8 ->
FCT.CSize ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketSend ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (b)
-> m DI.Int64
socketSend :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> ByteString -> Maybe b -> m Int64
socketSend a
socket ByteString
buffer Maybe b
cancellable = IO Int64 -> m Int64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
buffer' <- packByteString buffer
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_send socket' buffer' size maybeCancellable
touchManagedPtr socket
whenJust cancellable touchManagedPtr
freeMem buffer'
return result
) (do
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketSendMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m DI.Int64), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketSendMethodInfo a signature where
overloadedMethod = socketSend
instance O.OverloadedMethodInfo SocketSendMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSend",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSend"
})
#endif
foreign import ccall "g_socket_send_message" g_socket_send_message ::
Ptr Socket ->
Ptr Gio.SocketAddress.SocketAddress ->
Ptr Gio.OutputVector.OutputVector ->
Int32 ->
Ptr (Ptr Gio.SocketControlMessage.SocketControlMessage) ->
Int32 ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketSendMessage ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) =>
a
-> Maybe (b)
-> [Gio.OutputVector.OutputVector]
-> Maybe ([Gio.SocketControlMessage.SocketControlMessage])
-> Int32
-> Maybe (c)
-> m DI.Int64
socketSendMessage :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b,
IsCancellable c) =>
a
-> Maybe b
-> [OutputVector]
-> Maybe [SocketControlMessage]
-> Int32
-> Maybe c
-> m Int64
socketSendMessage a
socket Maybe b
address [OutputVector]
vectors Maybe [SocketControlMessage]
messages Int32
flags Maybe c
cancellable = IO Int64 -> m Int64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
let numMessages :: Int32
numMessages = case Maybe [SocketControlMessage]
messages of
Maybe [SocketControlMessage]
Nothing -> Int32
0
Just [SocketControlMessage]
jMessages -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [SocketControlMessage] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [SocketControlMessage]
jMessages
let numVectors :: Int32
numVectors = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [OutputVector] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [OutputVector]
vectors
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
maybeAddress <- case address of
Maybe b
Nothing -> Ptr SocketAddress -> IO (Ptr SocketAddress)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
forall a. Ptr a
FP.nullPtr
Just b
jAddress -> do
jAddress' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jAddress
return jAddress'
vectors' <- mapM unsafeManagedPtrGetPtr vectors
vectors'' <- packBlockArray 16 vectors'
maybeMessages <- case messages of
Maybe [SocketControlMessage]
Nothing -> Ptr (Ptr SocketControlMessage)
-> IO (Ptr (Ptr SocketControlMessage))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr SocketControlMessage)
forall a. Ptr a
FP.nullPtr
Just [SocketControlMessage]
jMessages -> do
jMessages' <- (SocketControlMessage -> IO (Ptr SocketControlMessage))
-> [SocketControlMessage] -> IO [Ptr SocketControlMessage]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM SocketControlMessage -> IO (Ptr SocketControlMessage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [SocketControlMessage]
jMessages
jMessages'' <- packPtrArray jMessages'
return jMessages''
maybeCancellable <- case cancellable of
Maybe c
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 c
jCancellable -> do
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_send_message socket' maybeAddress vectors'' numVectors maybeMessages numMessages flags maybeCancellable
touchManagedPtr socket
whenJust address touchManagedPtr
mapM_ touchManagedPtr vectors
whenJust messages (mapM_ touchManagedPtr)
whenJust cancellable touchManagedPtr
freeMem vectors''
freeMem maybeMessages
return result
) (do
freeMem vectors''
freeMem maybeMessages
)
#if defined(ENABLE_OVERLOADING)
data SocketSendMessageMethodInfo
instance (signature ~ (Maybe (b) -> [Gio.OutputVector.OutputVector] -> Maybe ([Gio.SocketControlMessage.SocketControlMessage]) -> Int32 -> Maybe (c) -> m DI.Int64), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod SocketSendMessageMethodInfo a signature where
overloadedMethod = socketSendMessage
instance O.OverloadedMethodInfo SocketSendMessageMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSendMessage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSendMessage"
})
#endif
foreign import ccall "g_socket_send_message_with_timeout" g_socket_send_message_with_timeout ::
Ptr Socket ->
Ptr Gio.SocketAddress.SocketAddress ->
Ptr Gio.OutputVector.OutputVector ->
Int32 ->
Ptr (Ptr Gio.SocketControlMessage.SocketControlMessage) ->
Int32 ->
Int32 ->
Int64 ->
Ptr FCT.CSize ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
socketSendMessageWithTimeout ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) =>
a
-> Maybe (b)
-> [Gio.OutputVector.OutputVector]
-> Maybe ([Gio.SocketControlMessage.SocketControlMessage])
-> Int32
-> Int64
-> Maybe (c)
-> m ((Gio.Enums.PollableReturn, FCT.CSize))
socketSendMessageWithTimeout :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b,
IsCancellable c) =>
a
-> Maybe b
-> [OutputVector]
-> Maybe [SocketControlMessage]
-> Int32
-> Int64
-> Maybe c
-> m (PollableReturn, CSize)
socketSendMessageWithTimeout a
socket Maybe b
address [OutputVector]
vectors Maybe [SocketControlMessage]
messages Int32
flags Int64
timeoutUs Maybe c
cancellable = IO (PollableReturn, CSize) -> m (PollableReturn, CSize)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (PollableReturn, CSize) -> m (PollableReturn, CSize))
-> IO (PollableReturn, CSize) -> m (PollableReturn, CSize)
forall a b. (a -> b) -> a -> b
$ do
let numMessages :: Int32
numMessages = case Maybe [SocketControlMessage]
messages of
Maybe [SocketControlMessage]
Nothing -> Int32
0
Just [SocketControlMessage]
jMessages -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [SocketControlMessage] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [SocketControlMessage]
jMessages
let numVectors :: Int32
numVectors = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [OutputVector] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [OutputVector]
vectors
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
maybeAddress <- case address of
Maybe b
Nothing -> Ptr SocketAddress -> IO (Ptr SocketAddress)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
forall a. Ptr a
FP.nullPtr
Just b
jAddress -> do
jAddress' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jAddress
return jAddress'
vectors' <- mapM unsafeManagedPtrGetPtr vectors
vectors'' <- packBlockArray 16 vectors'
maybeMessages <- case messages of
Maybe [SocketControlMessage]
Nothing -> Ptr (Ptr SocketControlMessage)
-> IO (Ptr (Ptr SocketControlMessage))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr SocketControlMessage)
forall a. Ptr a
FP.nullPtr
Just [SocketControlMessage]
jMessages -> do
jMessages' <- (SocketControlMessage -> IO (Ptr SocketControlMessage))
-> [SocketControlMessage] -> IO [Ptr SocketControlMessage]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM SocketControlMessage -> IO (Ptr SocketControlMessage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [SocketControlMessage]
jMessages
jMessages'' <- packPtrArray jMessages'
return jMessages''
bytesWritten <- allocMem :: IO (Ptr FCT.CSize)
maybeCancellable <- case cancellable of
Maybe c
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 c
jCancellable -> do
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_send_message_with_timeout socket' maybeAddress vectors'' numVectors maybeMessages numMessages flags timeoutUs bytesWritten maybeCancellable
let result' = (Int -> PollableReturn
forall a. Enum a => Int -> a
toEnum (Int -> PollableReturn) -> (CInt -> Int) -> CInt -> PollableReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
result
bytesWritten' <- peek bytesWritten
touchManagedPtr socket
whenJust address touchManagedPtr
mapM_ touchManagedPtr vectors
whenJust messages (mapM_ touchManagedPtr)
whenJust cancellable touchManagedPtr
freeMem vectors''
freeMem maybeMessages
freeMem bytesWritten
return (result', bytesWritten')
) (do
freeMem vectors''
freeMem maybeMessages
freeMem bytesWritten
)
#if defined(ENABLE_OVERLOADING)
data SocketSendMessageWithTimeoutMethodInfo
instance (signature ~ (Maybe (b) -> [Gio.OutputVector.OutputVector] -> Maybe ([Gio.SocketControlMessage.SocketControlMessage]) -> Int32 -> Int64 -> Maybe (c) -> m ((Gio.Enums.PollableReturn, FCT.CSize))), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod SocketSendMessageWithTimeoutMethodInfo a signature where
overloadedMethod = socketSendMessageWithTimeout
instance O.OverloadedMethodInfo SocketSendMessageWithTimeoutMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSendMessageWithTimeout",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSendMessageWithTimeout"
})
#endif
foreign import ccall "g_socket_send_messages" g_socket_send_messages ::
Ptr Socket ->
Ptr Gio.OutputMessage.OutputMessage ->
Word32 ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int32
socketSendMessages ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.OutputMessage.OutputMessage]
-> Int32
-> Maybe (b)
-> m Int32
socketSendMessages :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> [OutputMessage] -> Int32 -> Maybe b -> m Int32
socketSendMessages a
socket [OutputMessage]
messages Int32
flags Maybe b
cancellable = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
let numMessages :: Word32
numMessages = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [OutputMessage] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [OutputMessage]
messages
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
messages' <- mapM unsafeManagedPtrGetPtr messages
messages'' <- packBlockArray 40 messages'
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_send_messages socket' messages'' numMessages flags maybeCancellable
touchManagedPtr socket
mapM_ touchManagedPtr messages
whenJust cancellable touchManagedPtr
freeMem messages''
return result
) (do
freeMem messages''
)
#if defined(ENABLE_OVERLOADING)
data SocketSendMessagesMethodInfo
instance (signature ~ ([Gio.OutputMessage.OutputMessage] -> Int32 -> Maybe (b) -> m Int32), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketSendMessagesMethodInfo a signature where
overloadedMethod = socketSendMessages
instance O.OverloadedMethodInfo SocketSendMessagesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSendMessages",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSendMessages"
})
#endif
foreign import ccall "g_socket_send_to" g_socket_send_to ::
Ptr Socket ->
Ptr Gio.SocketAddress.SocketAddress ->
Ptr Word8 ->
FCT.CSize ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketSendTo ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) =>
a
-> Maybe (b)
-> ByteString
-> Maybe (c)
-> m DI.Int64
socketSendTo :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsSocket a, IsSocketAddress b,
IsCancellable c) =>
a -> Maybe b -> ByteString -> Maybe c -> m Int64
socketSendTo a
socket Maybe b
address ByteString
buffer Maybe c
cancellable = IO Int64 -> m Int64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
maybeAddress <- case address of
Maybe b
Nothing -> Ptr SocketAddress -> IO (Ptr SocketAddress)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr SocketAddress
forall a. Ptr a
FP.nullPtr
Just b
jAddress -> do
jAddress' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jAddress
return jAddress'
buffer' <- packByteString buffer
maybeCancellable <- case cancellable of
Maybe c
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 c
jCancellable -> do
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_socket_send_to socket' maybeAddress buffer' size maybeCancellable
touchManagedPtr socket
whenJust address touchManagedPtr
whenJust cancellable touchManagedPtr
freeMem buffer'
return result
) (do
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketSendToMethodInfo
instance (signature ~ (Maybe (b) -> ByteString -> Maybe (c) -> m DI.Int64), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod SocketSendToMethodInfo a signature where
overloadedMethod = socketSendTo
instance O.OverloadedMethodInfo SocketSendToMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSendTo",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSendTo"
})
#endif
foreign import ccall "g_socket_send_with_blocking" g_socket_send_with_blocking ::
Ptr Socket ->
Ptr Word8 ->
FCT.CSize ->
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO DI.Int64
socketSendWithBlocking ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Bool
-> Maybe (b)
-> m DI.Int64
socketSendWithBlocking :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSocket a, IsCancellable b) =>
a -> ByteString -> Bool -> Maybe b -> m Int64
socketSendWithBlocking a
socket ByteString
buffer Bool
blocking Maybe b
cancellable = IO Int64 -> m Int64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
let size :: CSize
size = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
buffer' <- packByteString buffer
let blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
blocking
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_send_with_blocking socket' buffer' size blocking' maybeCancellable
touchManagedPtr socket
whenJust cancellable touchManagedPtr
freeMem buffer'
return result
) (do
freeMem buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketSendWithBlockingMethodInfo
instance (signature ~ (ByteString -> Bool -> Maybe (b) -> m DI.Int64), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SocketSendWithBlockingMethodInfo a signature where
overloadedMethod = socketSendWithBlocking
instance O.OverloadedMethodInfo SocketSendWithBlockingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSendWithBlocking",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSendWithBlocking"
})
#endif
foreign import ccall "g_socket_set_blocking" g_socket_set_blocking ::
Ptr Socket ->
CInt ->
IO ()
socketSetBlocking ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Bool
-> m ()
socketSetBlocking :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Bool -> m ()
socketSetBlocking a
socket Bool
blocking = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
blocking
g_socket_set_blocking socket' blocking'
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetBlockingMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetBlockingMethodInfo a signature where
overloadedMethod = socketSetBlocking
instance O.OverloadedMethodInfo SocketSetBlockingMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetBlocking",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetBlocking"
})
#endif
foreign import ccall "g_socket_set_broadcast" g_socket_set_broadcast ::
Ptr Socket ->
CInt ->
IO ()
socketSetBroadcast ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Bool
-> m ()
socketSetBroadcast :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Bool -> m ()
socketSetBroadcast a
socket Bool
broadcast = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let broadcast' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
broadcast
g_socket_set_broadcast socket' broadcast'
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetBroadcastMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetBroadcastMethodInfo a signature where
overloadedMethod = socketSetBroadcast
instance O.OverloadedMethodInfo SocketSetBroadcastMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetBroadcast",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetBroadcast"
})
#endif
foreign import ccall "g_socket_set_keepalive" g_socket_set_keepalive ::
Ptr Socket ->
CInt ->
IO ()
socketSetKeepalive ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Bool
-> m ()
socketSetKeepalive :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Bool -> m ()
socketSetKeepalive a
socket Bool
keepalive = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let keepalive' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
keepalive
g_socket_set_keepalive socket' keepalive'
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetKeepaliveMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetKeepaliveMethodInfo a signature where
overloadedMethod = socketSetKeepalive
instance O.OverloadedMethodInfo SocketSetKeepaliveMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetKeepalive",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetKeepalive"
})
#endif
foreign import ccall "g_socket_set_listen_backlog" g_socket_set_listen_backlog ::
Ptr Socket ->
Int32 ->
IO ()
socketSetListenBacklog ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Int32
-> m ()
socketSetListenBacklog :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Int32 -> m ()
socketSetListenBacklog a
socket Int32
backlog = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
g_socket_set_listen_backlog socket' backlog
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetListenBacklogMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetListenBacklogMethodInfo a signature where
overloadedMethod = socketSetListenBacklog
instance O.OverloadedMethodInfo SocketSetListenBacklogMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetListenBacklog",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetListenBacklog"
})
#endif
foreign import ccall "g_socket_set_multicast_loopback" g_socket_set_multicast_loopback ::
Ptr Socket ->
CInt ->
IO ()
socketSetMulticastLoopback ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Bool
-> m ()
socketSetMulticastLoopback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Bool -> m ()
socketSetMulticastLoopback a
socket Bool
loopback = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let loopback' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
loopback
g_socket_set_multicast_loopback socket' loopback'
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetMulticastLoopbackMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetMulticastLoopbackMethodInfo a signature where
overloadedMethod = socketSetMulticastLoopback
instance O.OverloadedMethodInfo SocketSetMulticastLoopbackMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetMulticastLoopback",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetMulticastLoopback"
})
#endif
foreign import ccall "g_socket_set_multicast_ttl" g_socket_set_multicast_ttl ::
Ptr Socket ->
Word32 ->
IO ()
socketSetMulticastTtl ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Word32
-> m ()
socketSetMulticastTtl :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Word32 -> m ()
socketSetMulticastTtl a
socket Word32
ttl = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
g_socket_set_multicast_ttl socket' ttl
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetMulticastTtlMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetMulticastTtlMethodInfo a signature where
overloadedMethod = socketSetMulticastTtl
instance O.OverloadedMethodInfo SocketSetMulticastTtlMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetMulticastTtl",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetMulticastTtl"
})
#endif
foreign import ccall "g_socket_set_option" g_socket_set_option ::
Ptr Socket ->
Int32 ->
Int32 ->
Int32 ->
Ptr (Ptr GError) ->
IO CInt
socketSetOption ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Int32
-> Int32
-> Int32
-> m ()
socketSetOption :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Int32 -> Int32 -> Int32 -> m ()
socketSetOption a
socket Int32
level Int32
optname Int32
value = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
onException (do
_ <- propagateGError $ g_socket_set_option socket' level optname value
touchManagedPtr socket
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketSetOptionMethodInfo
instance (signature ~ (Int32 -> Int32 -> Int32 -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetOptionMethodInfo a signature where
overloadedMethod = socketSetOption
instance O.OverloadedMethodInfo SocketSetOptionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetOption",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetOption"
})
#endif
foreign import ccall "g_socket_set_timeout" g_socket_set_timeout ::
Ptr Socket ->
Word32 ->
IO ()
socketSetTimeout ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Word32
-> m ()
socketSetTimeout :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Word32 -> m ()
socketSetTimeout a
socket Word32
timeout = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
g_socket_set_timeout socket' timeout
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetTimeoutMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetTimeoutMethodInfo a signature where
overloadedMethod = socketSetTimeout
instance O.OverloadedMethodInfo SocketSetTimeoutMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetTimeout",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetTimeout"
})
#endif
foreign import ccall "g_socket_set_ttl" g_socket_set_ttl ::
Ptr Socket ->
Word32 ->
IO ()
socketSetTtl ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Word32
-> m ()
socketSetTtl :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Word32 -> m ()
socketSetTtl a
socket Word32
ttl = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
g_socket_set_ttl socket' ttl
touchManagedPtr socket
return ()
#if defined(ENABLE_OVERLOADING)
data SocketSetTtlMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSetTtlMethodInfo a signature where
overloadedMethod = socketSetTtl
instance O.OverloadedMethodInfo SocketSetTtlMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSetTtl",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSetTtl"
})
#endif
foreign import ccall "g_socket_shutdown" g_socket_shutdown ::
Ptr Socket ->
CInt ->
CInt ->
Ptr (Ptr GError) ->
IO CInt
socketShutdown ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> Bool
-> Bool
-> m ()
socketShutdown :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> Bool -> Bool -> m ()
socketShutdown a
socket Bool
shutdownRead Bool
shutdownWrite = 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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let shutdownRead' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
shutdownRead
let shutdownWrite' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
shutdownWrite
onException (do
_ <- propagateGError $ g_socket_shutdown socket' shutdownRead' shutdownWrite'
touchManagedPtr socket
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketShutdownMethodInfo
instance (signature ~ (Bool -> Bool -> m ()), MonadIO m, IsSocket a) => O.OverloadedMethod SocketShutdownMethodInfo a signature where
overloadedMethod = socketShutdown
instance O.OverloadedMethodInfo SocketShutdownMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketShutdown",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketShutdown"
})
#endif
foreign import ccall "g_socket_speaks_ipv4" g_socket_speaks_ipv4 ::
Ptr Socket ->
IO CInt
socketSpeaksIpv4 ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Bool
socketSpeaksIpv4 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSocket a) =>
a -> m Bool
socketSpeaksIpv4 a
socket = IO Bool -> m Bool
forall a. IO a -> m a
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
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
result <- g_socket_speaks_ipv4 socket'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr socket
return result'
#if defined(ENABLE_OVERLOADING)
data SocketSpeaksIpv4MethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.OverloadedMethod SocketSpeaksIpv4MethodInfo a signature where
overloadedMethod = socketSpeaksIpv4
instance O.OverloadedMethodInfo SocketSpeaksIpv4MethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.Socket.socketSpeaksIpv4",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-Socket.html#v:socketSpeaksIpv4"
})
#endif