{-# 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 ,
noSocket ,
#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)
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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GLib.Flags as GLib.Flags
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
newtype Socket = Socket (ManagedPtr Socket)
deriving (Socket -> Socket -> Bool
(Socket -> Socket -> Bool)
-> (Socket -> Socket -> Bool) -> Eq Socket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Socket -> Socket -> Bool
$c/= :: Socket -> Socket -> Bool
== :: Socket -> Socket -> Bool
$c== :: Socket -> Socket -> Bool
Eq)
foreign import ccall "g_socket_get_type"
c_g_socket_get_type :: IO GType
instance GObject Socket where
gobjectType :: IO GType
gobjectType = IO GType
c_g_socket_get_type
instance B.GValue.IsGValue Socket where
toGValue :: Socket -> IO GValue
toGValue o :: Socket
o = do
GType
gtype <- IO GType
c_g_socket_get_type
Socket -> (Ptr Socket -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Socket
o (GType -> (GValue -> Ptr Socket -> IO ()) -> Ptr Socket -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Socket -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Socket
fromGValue gv :: GValue
gv = do
Ptr Socket
ptr <- GValue -> IO (Ptr Socket)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Socket)
(ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Socket -> Socket
Socket Ptr Socket
ptr
class (GObject o, O.IsDescendantOf Socket o) => IsSocket o
instance (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 :: (MonadIO m, IsSocket o) => o -> m Socket
toSocket :: o -> m Socket
toSocket = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Socket -> Socket
Socket
noSocket :: Maybe Socket
noSocket :: Maybe Socket
noSocket = Maybe Socket
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSocketMethod (t :: Symbol) (o :: *) :: * 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 "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.MethodInfo 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
#endif
getSocketBlocking :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketBlocking :: o -> m Bool
getSocketBlocking obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj "blocking"
setSocketBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketBlocking :: o -> Bool -> m ()
setSocketBlocking obj :: o
obj val :: Bool
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj "blocking" Bool
val
constructSocketBlocking :: (IsSocket o) => Bool -> IO (GValueConstruct o)
constructSocketBlocking :: Bool -> IO (GValueConstruct o)
constructSocketBlocking val :: Bool
val = String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool "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
#endif
getSocketBroadcast :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketBroadcast :: o -> m Bool
getSocketBroadcast obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj "broadcast"
setSocketBroadcast :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketBroadcast :: o -> Bool -> m ()
setSocketBroadcast obj :: o
obj val :: Bool
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj "broadcast" Bool
val
constructSocketBroadcast :: (IsSocket o) => Bool -> IO (GValueConstruct o)
constructSocketBroadcast :: Bool -> IO (GValueConstruct o)
constructSocketBroadcast val :: Bool
val = String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool "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
#endif
getSocketFamily :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketFamily
getSocketFamily :: o -> m SocketFamily
getSocketFamily obj :: o
obj = IO SocketFamily -> m SocketFamily
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
$ o -> String -> IO SocketFamily
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj "family"
constructSocketFamily :: (IsSocket o) => Gio.Enums.SocketFamily -> IO (GValueConstruct o)
constructSocketFamily :: SocketFamily -> IO (GValueConstruct o)
constructSocketFamily val :: SocketFamily
val = String -> SocketFamily -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum "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
#endif
getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32
getSocketFd :: o -> m Int32
getSocketFd obj :: o
obj = IO Int32 -> m Int32
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
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj "fd"
constructSocketFd :: (IsSocket o) => Int32 -> IO (GValueConstruct o)
constructSocketFd :: Int32 -> IO (GValueConstruct o)
constructSocketFd val :: Int32
val = String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 "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
#endif
getSocketKeepalive :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketKeepalive :: o -> m Bool
getSocketKeepalive obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj "keepalive"
setSocketKeepalive :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketKeepalive :: o -> Bool -> m ()
setSocketKeepalive obj :: o
obj val :: Bool
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj "keepalive" Bool
val
constructSocketKeepalive :: (IsSocket o) => Bool -> IO (GValueConstruct o)
constructSocketKeepalive :: Bool -> IO (GValueConstruct o)
constructSocketKeepalive val :: Bool
val = String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool "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
#endif
getSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> m Int32
getSocketListenBacklog :: o -> m Int32
getSocketListenBacklog obj :: o
obj = IO Int32 -> m Int32
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
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj "listen-backlog"
setSocketListenBacklog :: (MonadIO m, IsSocket o) => o -> Int32 -> m ()
setSocketListenBacklog :: o -> Int32 -> m ()
setSocketListenBacklog obj :: o
obj val :: Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Int32 -> IO ()
forall a. GObject a => a -> String -> Int32 -> IO ()
B.Properties.setObjectPropertyInt32 o
obj "listen-backlog" Int32
val
constructSocketListenBacklog :: (IsSocket o) => Int32 -> IO (GValueConstruct o)
constructSocketListenBacklog :: Int32 -> IO (GValueConstruct o)
constructSocketListenBacklog val :: Int32
val = String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 "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
#endif
getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe Gio.SocketAddress.SocketAddress)
getSocketLocalAddress :: o -> m (Maybe SocketAddress)
getSocketLocalAddress obj :: o
obj = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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 "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
#endif
getSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> m Bool
getSocketMulticastLoopback :: o -> m Bool
getSocketMulticastLoopback obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj "multicast-loopback"
setSocketMulticastLoopback :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
setSocketMulticastLoopback :: o -> Bool -> m ()
setSocketMulticastLoopback obj :: o
obj val :: Bool
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj "multicast-loopback" Bool
val
constructSocketMulticastLoopback :: (IsSocket o) => Bool -> IO (GValueConstruct o)
constructSocketMulticastLoopback :: Bool -> IO (GValueConstruct o)
constructSocketMulticastLoopback val :: Bool
val = String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool "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
#endif
getSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketMulticastTtl :: o -> m Word32
getSocketMulticastTtl obj :: o
obj = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
B.Properties.getObjectPropertyUInt32 o
obj "multicast-ttl"
setSocketMulticastTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketMulticastTtl :: o -> Word32 -> m ()
setSocketMulticastTtl obj :: o
obj val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj "multicast-ttl" Word32
val
constructSocketMulticastTtl :: (IsSocket o) => Word32 -> IO (GValueConstruct o)
constructSocketMulticastTtl :: Word32 -> IO (GValueConstruct o)
constructSocketMulticastTtl val :: Word32
val = String -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 "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
#endif
getSocketProtocol :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketProtocol
getSocketProtocol :: o -> m SocketProtocol
getSocketProtocol obj :: o
obj = IO SocketProtocol -> m SocketProtocol
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
$ o -> String -> IO SocketProtocol
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj "protocol"
constructSocketProtocol :: (IsSocket o) => Gio.Enums.SocketProtocol -> IO (GValueConstruct o)
constructSocketProtocol :: SocketProtocol -> IO (GValueConstruct o)
constructSocketProtocol val :: SocketProtocol
val = String -> SocketProtocol -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum "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
#endif
getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m (Maybe Gio.SocketAddress.SocketAddress)
getSocketRemoteAddress :: o -> m (Maybe SocketAddress)
getSocketRemoteAddress obj :: o
obj = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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 "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
#endif
getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketTimeout :: o -> m Word32
getSocketTimeout obj :: o
obj = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
B.Properties.getObjectPropertyUInt32 o
obj "timeout"
setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketTimeout :: o -> Word32 -> m ()
setSocketTimeout obj :: o
obj val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj "timeout" Word32
val
constructSocketTimeout :: (IsSocket o) => Word32 -> IO (GValueConstruct o)
constructSocketTimeout :: Word32 -> IO (GValueConstruct o)
constructSocketTimeout val :: Word32
val = String -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 "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
#endif
getSocketTtl :: (MonadIO m, IsSocket o) => o -> m Word32
getSocketTtl :: o -> m Word32
getSocketTtl obj :: o
obj = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
B.Properties.getObjectPropertyUInt32 o
obj "ttl"
setSocketTtl :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
setSocketTtl :: o -> Word32 -> m ()
setSocketTtl obj :: o
obj val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Word32 -> IO ()
forall a. GObject a => a -> String -> Word32 -> IO ()
B.Properties.setObjectPropertyUInt32 o
obj "ttl" Word32
val
constructSocketTtl :: (IsSocket o) => Word32 -> IO (GValueConstruct o)
constructSocketTtl :: Word32 -> IO (GValueConstruct o)
constructSocketTtl val :: Word32
val = String -> Word32 -> IO (GValueConstruct o)
forall o. String -> Word32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyUInt32 "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
#endif
getSocketType :: (MonadIO m, IsSocket o) => o -> m Gio.Enums.SocketType
getSocketType :: o -> m SocketType
getSocketType obj :: o
obj = IO SocketType -> m SocketType
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
$ o -> String -> IO SocketType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj "type"
constructSocketType :: (IsSocket o) => Gio.Enums.SocketType -> IO (GValueConstruct o)
constructSocketType :: SocketType -> IO (GValueConstruct o)
constructSocketType val :: SocketType
val = String -> SocketType -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum "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
#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, *)])
#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, *)])
#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 :: SocketFamily -> SocketType -> SocketProtocol -> m Socket
socketNew family :: SocketFamily
family type_ :: SocketType
type_ protocol :: SocketProtocol
protocol = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Socket -> m Socket) -> IO Socket -> m Socket
forall a b. (a -> b) -> a -> b
$ do
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
Ptr Socket
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'
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketNew" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Socket -> Socket
Socket) Ptr Socket
result
Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result'
) (do
() -> IO ()
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 :: Int32 -> m Socket
socketNewFromFd fd :: Int32
fd = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Socket -> m Socket) -> IO Socket -> m Socket
forall a b. (a -> b) -> a -> b
$ do
IO Socket -> IO () -> IO Socket
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Socket
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
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketNewFromFd" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Socket -> Socket
Socket) Ptr Socket
result
Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result'
) (do
() -> IO ()
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 :: a -> Maybe b -> m Socket
socketAccept socket :: a
socket cancellable :: Maybe b
cancellable = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Socket -> m Socket) -> IO Socket -> m Socket
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Socket -> IO () -> IO Socket
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Socket
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
$ Ptr Socket
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Socket)
g_socket_accept Ptr Socket
socket' Ptr Cancellable
maybeCancellable
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketAccept" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Socket -> Socket
Socket) Ptr Socket
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketAcceptMethodInfo
instance (signature ~ (Maybe (b) -> m Socket), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketAcceptMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Bool -> m ()
socketBind socket :: a
socket address :: b
address allowReuse :: Bool
allowReuse = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr SocketAddress
address' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
let allowReuse' :: CInt
allowReuse' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
allowReuse
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr SocketAddress -> CInt -> Ptr (Ptr GError) -> IO CInt
g_socket_bind Ptr Socket
socket' Ptr SocketAddress
address' CInt
allowReuse'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketBindMethodInfo
instance (signature ~ (b -> Bool -> m ()), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b) => O.MethodInfo SocketBindMethodInfo a signature where
overloadedMethod = 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 :: a -> m ()
socketCheckConnectResult socket :: a
socket = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO CInt
g_socket_check_connect_result Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketCheckConnectResultMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.MethodInfo SocketCheckConnectResultMethodInfo a signature where
overloadedMethod = 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 :: a -> m ()
socketClose socket :: a
socket = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO CInt
g_socket_close Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.MethodInfo SocketCloseMethodInfo a signature where
overloadedMethod = 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 :: a -> [IOCondition] -> m [IOCondition]
socketConditionCheck socket :: a
socket condition :: [IOCondition]
condition = IO [IOCondition] -> m [IOCondition]
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' :: CUInt
condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
CUInt
result <- Ptr Socket -> CUInt -> IO CUInt
g_socket_condition_check Ptr Socket
socket' CUInt
condition'
let result' :: [IOCondition]
result' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
[IOCondition] -> IO [IOCondition]
forall (m :: * -> *) a. Monad m => a -> m a
return [IOCondition]
result'
#if defined(ENABLE_OVERLOADING)
data SocketConditionCheckMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> m [GLib.Flags.IOCondition]), MonadIO m, IsSocket a) => O.MethodInfo SocketConditionCheckMethodInfo a signature where
overloadedMethod = 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 :: a -> [IOCondition] -> Int64 -> Maybe b -> m ()
socketConditionTimedWait socket :: a
socket condition :: [IOCondition]
condition timeoutUs :: Int64
timeoutUs cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' :: CUInt
condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> CUInt -> Int64 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_socket_condition_timed_wait Ptr Socket
socket' CUInt
condition' Int64
timeoutUs Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConditionTimedWaitMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> Int64 -> Maybe (b) -> m ()), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketConditionTimedWaitMethodInfo a signature where
overloadedMethod = 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 :: a -> [IOCondition] -> Maybe b -> m ()
socketConditionWait socket :: a
socket condition :: [IOCondition]
condition cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
let condition' :: CUInt
condition' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
condition
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> CUInt -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_socket_condition_wait Ptr Socket
socket' CUInt
condition' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConditionWaitMethodInfo
instance (signature ~ ([GLib.Flags.IOCondition] -> Maybe (b) -> m ()), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketConditionWaitMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Maybe c -> m ()
socketConnect socket :: a
socket address :: b
address cancellable :: Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr SocketAddress
address' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr SocketAddress
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_socket_connect Ptr Socket
socket' Ptr SocketAddress
address' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketConnectMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsSocket a, Gio.SocketAddress.IsSocketAddress b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SocketConnectMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketConnection
socketConnectionFactoryCreateConnection socket :: a
socket = IO SocketConnection -> m SocketConnection
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr SocketConnection
result <- Ptr Socket -> IO (Ptr SocketConnection)
g_socket_connection_factory_create_connection Ptr Socket
socket'
Text -> Ptr SocketConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketConnectionFactoryCreateConnection" Ptr SocketConnection
result
SocketConnection
result' <- ((ManagedPtr SocketConnection -> SocketConnection)
-> Ptr SocketConnection -> IO SocketConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketConnection -> SocketConnection
Gio.SocketConnection.SocketConnection) Ptr SocketConnection
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketConnection -> IO SocketConnection
forall (m :: * -> *) a. Monad m => a -> m a
return SocketConnection
result'
#if defined(ENABLE_OVERLOADING)
data SocketConnectionFactoryCreateConnectionMethodInfo
instance (signature ~ (m Gio.SocketConnection.SocketConnection), MonadIO m, IsSocket a) => O.MethodInfo SocketConnectionFactoryCreateConnectionMethodInfo a signature where
overloadedMethod = socketConnectionFactoryCreateConnection
#endif
foreign import ccall "g_socket_get_available_bytes" g_socket_get_available_bytes ::
Ptr Socket ->
IO Int64
socketGetAvailableBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a) =>
a
-> m Int64
socketGetAvailableBytes :: a -> m Int64
socketGetAvailableBytes socket :: a
socket = IO Int64 -> m Int64
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Int64
result <- Ptr Socket -> IO Int64
g_socket_get_available_bytes Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
#if defined(ENABLE_OVERLOADING)
data SocketGetAvailableBytesMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsSocket a) => O.MethodInfo SocketGetAvailableBytesMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketGetBlocking socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_get_blocking Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetBlockingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketGetBlockingMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketGetBroadcast socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_get_broadcast Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetBroadcastMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketGetBroadcastMethodInfo a signature where
overloadedMethod = 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 :: a -> m Credentials
socketGetCredentials socket :: a
socket = IO Credentials -> m Credentials
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO Credentials -> IO () -> IO Credentials
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Credentials
result <- (Ptr (Ptr GError) -> IO (Ptr Credentials)) -> IO (Ptr Credentials)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials))
-> (Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials)
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO (Ptr Credentials)
g_socket_get_credentials Ptr Socket
socket'
Text -> Ptr Credentials -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketGetCredentials" Ptr Credentials
result
Credentials
result' <- ((ManagedPtr Credentials -> Credentials)
-> Ptr Credentials -> IO Credentials
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Credentials -> Credentials
Gio.Credentials.Credentials) Ptr Credentials
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Credentials -> IO Credentials
forall (m :: * -> *) a. Monad m => a -> m a
return Credentials
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetCredentialsMethodInfo
instance (signature ~ (m Gio.Credentials.Credentials), MonadIO m, IsSocket a) => O.MethodInfo SocketGetCredentialsMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketFamily
socketGetFamily socket :: a
socket = IO SocketFamily -> m SocketFamily
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CUInt
result <- Ptr Socket -> IO CUInt
g_socket_get_family Ptr Socket
socket'
let result' :: SocketFamily
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
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketFamily -> IO SocketFamily
forall (m :: * -> *) a. Monad m => a -> m a
return SocketFamily
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetFamilyMethodInfo
instance (signature ~ (m Gio.Enums.SocketFamily), MonadIO m, IsSocket a) => O.MethodInfo SocketGetFamilyMethodInfo a signature where
overloadedMethod = 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 :: a -> m Int32
socketGetFd socket :: a
socket = IO Int32 -> m Int32
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Int32
result <- Ptr Socket -> IO Int32
g_socket_get_fd Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data SocketGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSocket a) => O.MethodInfo SocketGetFdMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketGetKeepalive socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_get_keepalive Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetKeepaliveMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketGetKeepaliveMethodInfo a signature where
overloadedMethod = 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 :: a -> m Int32
socketGetListenBacklog socket :: a
socket = IO Int32 -> m Int32
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Int32
result <- Ptr Socket -> IO Int32
g_socket_get_listen_backlog Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data SocketGetListenBacklogMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSocket a) => O.MethodInfo SocketGetListenBacklogMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketAddress
socketGetLocalAddress socket :: a
socket = IO SocketAddress -> m SocketAddress
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO SocketAddress -> IO () -> IO SocketAddress
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SocketAddress
result <- (Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress))
-> (Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress)
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO (Ptr SocketAddress)
g_socket_get_local_address Ptr Socket
socket'
Text -> Ptr SocketAddress -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketGetLocalAddress" Ptr SocketAddress
result
SocketAddress
result' <- ((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
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketAddress -> IO SocketAddress
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetLocalAddressMethodInfo
instance (signature ~ (m Gio.SocketAddress.SocketAddress), MonadIO m, IsSocket a) => O.MethodInfo SocketGetLocalAddressMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketGetMulticastLoopback socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_get_multicast_loopback Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetMulticastLoopbackMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketGetMulticastLoopbackMethodInfo a signature where
overloadedMethod = 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 :: a -> m Word32
socketGetMulticastTtl socket :: a
socket = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Word32
result <- Ptr Socket -> IO Word32
g_socket_get_multicast_ttl Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data SocketGetMulticastTtlMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.MethodInfo SocketGetMulticastTtlMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> Int32 -> m Int32
socketGetOption socket :: a
socket level :: Int32
level optname :: Int32
optname = IO Int32 -> m Int32
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr Int32
value <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Int32 -> Int32 -> Ptr Int32 -> Ptr (Ptr GError) -> IO CInt
g_socket_get_option Ptr Socket
socket' Int32
level Int32
optname Ptr Int32
value
Int32
value' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
value
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
value
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
value'
) (do
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
value
)
#if defined(ENABLE_OVERLOADING)
data SocketGetOptionMethodInfo
instance (signature ~ (Int32 -> Int32 -> m (Int32)), MonadIO m, IsSocket a) => O.MethodInfo SocketGetOptionMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketProtocol
socketGetProtocol socket :: a
socket = IO SocketProtocol -> m SocketProtocol
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_get_protocol Ptr Socket
socket'
let result' :: SocketProtocol
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
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketProtocol -> IO SocketProtocol
forall (m :: * -> *) a. Monad m => a -> m a
return SocketProtocol
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetProtocolMethodInfo
instance (signature ~ (m Gio.Enums.SocketProtocol), MonadIO m, IsSocket a) => O.MethodInfo SocketGetProtocolMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketAddress
socketGetRemoteAddress socket :: a
socket = IO SocketAddress -> m SocketAddress
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO SocketAddress -> IO () -> IO SocketAddress
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SocketAddress
result <- (Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress))
-> (Ptr (Ptr GError) -> IO (Ptr SocketAddress))
-> IO (Ptr SocketAddress)
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO (Ptr SocketAddress)
g_socket_get_remote_address Ptr Socket
socket'
Text -> Ptr SocketAddress -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketGetRemoteAddress" Ptr SocketAddress
result
SocketAddress
result' <- ((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
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketAddress -> IO SocketAddress
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketGetRemoteAddressMethodInfo
instance (signature ~ (m Gio.SocketAddress.SocketAddress), MonadIO m, IsSocket a) => O.MethodInfo SocketGetRemoteAddressMethodInfo a signature where
overloadedMethod = 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 :: a -> m SocketType
socketGetSocketType socket :: a
socket = IO SocketType -> m SocketType
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
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CUInt
result <- Ptr Socket -> IO CUInt
g_socket_get_socket_type Ptr Socket
socket'
let result' :: SocketType
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
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
SocketType -> IO SocketType
forall (m :: * -> *) a. Monad m => a -> m a
return SocketType
result'
#if defined(ENABLE_OVERLOADING)
data SocketGetSocketTypeMethodInfo
instance (signature ~ (m Gio.Enums.SocketType), MonadIO m, IsSocket a) => O.MethodInfo SocketGetSocketTypeMethodInfo a signature where
overloadedMethod = 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 :: a -> m Word32
socketGetTimeout socket :: a
socket = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Word32
result <- Ptr Socket -> IO Word32
g_socket_get_timeout Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data SocketGetTimeoutMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.MethodInfo SocketGetTimeoutMethodInfo a signature where
overloadedMethod = 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 :: a -> m Word32
socketGetTtl socket :: a
socket = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Word32
result <- Ptr Socket -> IO Word32
g_socket_get_ttl Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data SocketGetTtlMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSocket a) => O.MethodInfo SocketGetTtlMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketIsClosed socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_is_closed Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketIsClosedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketIsClosedMethodInfo a signature where
overloadedMethod = 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 :: a -> m Bool
socketIsConnected socket :: a
socket = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
CInt
result <- Ptr Socket -> IO CInt
g_socket_is_connected Ptr Socket
socket'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SocketIsConnectedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSocket a) => O.MethodInfo SocketIsConnectedMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Bool -> Maybe Text -> m ()
socketJoinMulticastGroup socket :: a
socket group :: b
group sourceSpecific :: Bool
sourceSpecific iface :: Maybe Text
iface = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr InetAddress
group' <- b -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
group
let sourceSpecific' :: CInt
sourceSpecific' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
sourceSpecific
Ptr CChar
maybeIface <- case Maybe Text
iface of
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just jIface :: Text
jIface -> do
Ptr CChar
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jIface'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr InetAddress
-> CInt
-> Ptr CChar
-> Ptr (Ptr GError)
-> IO CInt
g_socket_join_multicast_group Ptr Socket
socket' Ptr InetAddress
group' CInt
sourceSpecific' Ptr CChar
maybeIface
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
group
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketJoinMulticastGroupMethodInfo
instance (signature ~ (b -> Bool -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) => O.MethodInfo SocketJoinMulticastGroupMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Maybe c -> Maybe Text -> m ()
socketJoinMulticastGroupSsm socket :: a
socket group :: b
group sourceSpecific :: Maybe c
sourceSpecific iface :: Maybe Text
iface = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr InetAddress
group' <- b -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
group
Ptr InetAddress
maybeSourceSpecific <- case Maybe c
sourceSpecific of
Nothing -> Ptr InetAddress -> IO (Ptr InetAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
forall a. Ptr a
nullPtr
Just jSourceSpecific :: c
jSourceSpecific -> do
Ptr InetAddress
jSourceSpecific' <- c -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceSpecific
Ptr InetAddress -> IO (Ptr InetAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
jSourceSpecific'
Ptr CChar
maybeIface <- case Maybe Text
iface of
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just jIface :: Text
jIface -> do
Ptr CChar
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jIface'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr InetAddress
-> Ptr InetAddress
-> Ptr CChar
-> Ptr (Ptr GError)
-> IO CInt
g_socket_join_multicast_group_ssm Ptr Socket
socket' Ptr InetAddress
group' Ptr InetAddress
maybeSourceSpecific Ptr CChar
maybeIface
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
group
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
sourceSpecific c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
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.MethodInfo SocketJoinMulticastGroupSsmMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Bool -> Maybe Text -> m ()
socketLeaveMulticastGroup socket :: a
socket group :: b
group sourceSpecific :: Bool
sourceSpecific iface :: Maybe Text
iface = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr InetAddress
group' <- b -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
group
let sourceSpecific' :: CInt
sourceSpecific' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
sourceSpecific
Ptr CChar
maybeIface <- case Maybe Text
iface of
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just jIface :: Text
jIface -> do
Ptr CChar
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jIface'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr InetAddress
-> CInt
-> Ptr CChar
-> Ptr (Ptr GError)
-> IO CInt
g_socket_leave_multicast_group Ptr Socket
socket' Ptr InetAddress
group' CInt
sourceSpecific' Ptr CChar
maybeIface
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
group
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
)
#if defined(ENABLE_OVERLOADING)
data SocketLeaveMulticastGroupMethodInfo
instance (signature ~ (b -> Bool -> Maybe (T.Text) -> m ()), MonadIO m, IsSocket a, Gio.InetAddress.IsInetAddress b) => O.MethodInfo SocketLeaveMulticastGroupMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> Maybe c -> Maybe Text -> m ()
socketLeaveMulticastGroupSsm socket :: a
socket group :: b
group sourceSpecific :: Maybe c
sourceSpecific iface :: Maybe Text
iface = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr InetAddress
group' <- b -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
group
Ptr InetAddress
maybeSourceSpecific <- case Maybe c
sourceSpecific of
Nothing -> Ptr InetAddress -> IO (Ptr InetAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
forall a. Ptr a
nullPtr
Just jSourceSpecific :: c
jSourceSpecific -> do
Ptr InetAddress
jSourceSpecific' <- c -> IO (Ptr InetAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceSpecific
Ptr InetAddress -> IO (Ptr InetAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InetAddress
jSourceSpecific'
Ptr CChar
maybeIface <- case Maybe Text
iface of
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just jIface :: Text
jIface -> do
Ptr CChar
jIface' <- Text -> IO (Ptr CChar)
textToCString Text
jIface
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jIface'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr InetAddress
-> Ptr InetAddress
-> Ptr CChar
-> Ptr (Ptr GError)
-> IO CInt
g_socket_leave_multicast_group_ssm Ptr Socket
socket' Ptr InetAddress
group' Ptr InetAddress
maybeSourceSpecific Ptr CChar
maybeIface
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
group
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
sourceSpecific c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeIface
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
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.MethodInfo SocketLeaveMulticastGroupSsmMethodInfo a signature where
overloadedMethod = 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 :: a -> m ()
socketListen socket :: a
socket = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Socket -> Ptr (Ptr GError) -> IO CInt
g_socket_listen Ptr Socket
socket'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocket a) => O.MethodInfo SocketListenMethodInfo a signature where
overloadedMethod = socketListen
#endif
foreign import ccall "g_socket_receive" g_socket_receive ::
Ptr Socket ->
Ptr Word8 ->
Word64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int64
socketReceive ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (b)
-> m Int64
socketReceive :: a -> ByteString -> Maybe b -> m Int64
socketReceive socket :: a
socket buffer :: ByteString
buffer cancellable :: Maybe b
cancellable = IO Int64 -> m Int64
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 :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Int64 -> IO () -> IO Int64
forall a b. IO a -> IO b -> IO a
onException (do
Int64
result <- (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int64) -> IO Int64)
-> (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr Word8
-> Word64
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO Int64
g_socket_receive Ptr Socket
socket' Ptr Word8
buffer' Word64
size Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m Int64), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketReceiveMethodInfo a signature where
overloadedMethod = socketReceive
#endif
foreign import ccall "g_socket_receive_from" g_socket_receive_from ::
Ptr Socket ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
Ptr Word8 ->
Word64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int64
socketReceiveFrom ::
(B.CallStack.HasCallStack, MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Maybe (b)
-> m ((Int64, Gio.SocketAddress.SocketAddress))
socketReceiveFrom :: a -> ByteString -> Maybe b -> m (Int64, SocketAddress)
socketReceiveFrom socket :: a
socket buffer :: ByteString
buffer cancellable :: Maybe b
cancellable = IO (Int64, SocketAddress) -> m (Int64, SocketAddress)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int64, SocketAddress) -> m (Int64, SocketAddress))
-> IO (Int64, SocketAddress) -> m (Int64, SocketAddress)
forall a b. (a -> b) -> a -> b
$ do
let size :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
Ptr Socket
socket' <- a -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
socket
Ptr (Ptr SocketAddress)
address <- IO (Ptr (Ptr SocketAddress))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO (Int64, SocketAddress) -> IO () -> IO (Int64, SocketAddress)
forall a b. IO a -> IO b -> IO a
onException (do
Int64
result <- (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int64) -> IO Int64)
-> (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a b. (a -> b) -> a -> b
$ Ptr Socket
-> Ptr (Ptr SocketAddress)
-> Ptr Word8
-> Word64
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO Int64
g_socket_receive_from Ptr Socket
socket' Ptr (Ptr SocketAddress)
address Ptr Word8
buffer' Word64
size Ptr Cancellable
maybeCancellable
Ptr SocketAddress
address' <- Ptr (Ptr SocketAddress) -> IO (Ptr SocketAddress)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr SocketAddress)
address
SocketAddress
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'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
socket
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr SocketAddress) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr SocketAddress)
address
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
(Int64, SocketAddress) -> IO (Int64, SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int64
result, SocketAddress
address'')
) (do
Ptr (Ptr SocketAddress) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr SocketAddress)
address
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
)
#if defined(ENABLE_OVERLOADING)
data SocketReceiveFromMethodInfo
instance (signature ~ (ByteString -> Maybe (b) -> m ((Int64, Gio.SocketAddress.SocketAddress))), MonadIO m, IsSocket a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketReceiveFromMethodInfo a signature where
overloadedMethod = 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 Int64