|
@@ -1,6 +1,7 @@
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
{-# LANGUAGE ExistentialQuantification #-}
|
|
|
{-# LANGUAGE ForeignFunctionInterface #-}
|
|
|
+{-# LANGUAGE InterruptibleFFI #-}
|
|
|
|
|
|
module System.IO.Uniform.Targets (TlsSettings(..), UniformIO(..), SocketIO, FileIO, TlsStream, BoundedPort, SomeIO(..), connectTo, connectToHost, bindPort, accept, openFile, getPeer, closePort) where
|
|
|
|
|
@@ -245,24 +246,24 @@ getPeer s = allocaArray 16 (
|
|
|
closePort :: BoundedPort -> IO ()
|
|
|
closePort p = c_closePort (lis p)
|
|
|
|
|
|
-foreign import ccall "getPort" c_getPort :: CInt -> IO (Ptr Nethandler)
|
|
|
-foreign import ccall "createFromHandler" c_accept :: Ptr Nethandler -> IO (Ptr SockDs)
|
|
|
-foreign import ccall "createFromFileName" c_createFile :: CString -> IO (Ptr FileDs)
|
|
|
-foreign import ccall "createToIPv4Host" c_connect4 :: CUInt -> CInt -> IO (Ptr SockDs)
|
|
|
-foreign import ccall "createToIPv6Host" c_connect6 :: Ptr CUChar -> CInt -> IO (Ptr SockDs)
|
|
|
+foreign import ccall safe "getPort" c_getPort :: CInt -> IO (Ptr Nethandler)
|
|
|
+foreign import ccall safe "createFromHandler" c_accept :: Ptr Nethandler -> IO (Ptr SockDs)
|
|
|
+foreign import ccall safe "createFromFileName" c_createFile :: CString -> IO (Ptr FileDs)
|
|
|
+foreign import ccall safe "createToIPv4Host" c_connect4 :: CUInt -> CInt -> IO (Ptr SockDs)
|
|
|
+foreign import ccall safe "createToIPv6Host" c_connect6 :: Ptr CUChar -> CInt -> IO (Ptr SockDs)
|
|
|
|
|
|
-foreign import ccall "startSockTls" c_startSockTls :: Ptr SockDs -> CString -> CString -> IO (Ptr TlsDs)
|
|
|
-foreign import ccall "getPeer" c_getPeer :: Ptr SockDs -> Ptr CUInt -> Ptr CUChar -> Ptr CInt -> IO (CInt)
|
|
|
+foreign import ccall safe "startSockTls" c_startSockTls :: Ptr SockDs -> CString -> CString -> IO (Ptr TlsDs)
|
|
|
+foreign import ccall safe "getPeer" c_getPeer :: Ptr SockDs -> Ptr CUInt -> Ptr CUChar -> Ptr CInt -> IO (CInt)
|
|
|
|
|
|
-foreign import ccall "closeSockDs" c_closeSock :: Ptr SockDs -> IO ()
|
|
|
-foreign import ccall "closeFileDs" c_closeFile :: Ptr FileDs -> IO ()
|
|
|
-foreign import ccall "closeHandler" c_closePort :: Ptr Nethandler -> IO ()
|
|
|
-foreign import ccall "closeTlsDs" c_closeTls :: Ptr TlsDs -> IO ()
|
|
|
+foreign import ccall safe "closeSockDs" c_closeSock :: Ptr SockDs -> IO ()
|
|
|
+foreign import ccall safe "closeFileDs" c_closeFile :: Ptr FileDs -> IO ()
|
|
|
+foreign import ccall safe "closeHandler" c_closePort :: Ptr Nethandler -> IO ()
|
|
|
+foreign import ccall safe "closeTlsDs" c_closeTls :: Ptr TlsDs -> IO ()
|
|
|
|
|
|
-foreign import ccall "fileDsSend" c_sendFile :: Ptr FileDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
-foreign import ccall "sockDsSend" c_sendSock :: Ptr SockDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
-foreign import ccall "tlsDsSend" c_sendTls :: Ptr TlsDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "fileDsSend" c_sendFile :: Ptr FileDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "sockDsSend" c_sendSock :: Ptr SockDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "tlsDsSend" c_sendTls :: Ptr TlsDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
|
|
|
-foreign import ccall "fileDsRecv" c_recvFile :: Ptr FileDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
-foreign import ccall "sockDsRecv" c_recvSock :: Ptr SockDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
-foreign import ccall "tlsDsRecv" c_recvTls :: Ptr TlsDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "fileDsRecv" c_recvFile :: Ptr FileDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "sockDsRecv" c_recvSock :: Ptr SockDs -> Ptr CChar -> CInt -> IO CInt
|
|
|
+foreign import ccall interruptible "tlsDsRecv" c_recvTls :: Ptr TlsDs -> Ptr CChar -> CInt -> IO CInt
|