-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Bindings to the POSIX socket API
--
-- This package provides bindings to the POSIX socket API.
@package posix-socket
@version 0.2
-- | POSIX sockets.
module System.Posix.Socket
-- | Socket of a particular family.
data Socket f
-- | Lock the socket and pass the underlying file descriptor to the given
-- action.
withSocketFd :: MonadBase IO μ => Socket f -> (Fd -> IO α) -> μ α
-- | Get the underlying file descriptor.
unsafeSocketFd :: MonadBase IO μ => Socket f -> μ Fd
-- | Use file descriptor as a socket.
unsafeSocketFromFd :: MonadBase IO μ => Fd -> μ (Socket f)
-- | Socket family.
class SockAddr (SockFamilyAddr f) => SockFamily f where type SockFamilyAddr f where {
type family SockFamilyAddr f;
}
-- | Socket family code.
sockFamilyCode :: SockFamily f => f -> CInt
-- | Socket address.
class SockAddr a
-- | Maximum size of a socket address.
sockAddrMaxSize :: SockAddr a => Proxy a -> Int
-- | Size of a particular socket address.
sockAddrSize :: SockAddr a => a -> Int
-- | Read socket address from a memory buffer.
peekSockAddr :: SockAddr a => Ptr a -> Int -> IO a
-- | Write socket address to a memory buffer.
pokeSockAddr :: SockAddr a => Ptr a -> a -> IO ()
-- | Socket type.
newtype SockType
SockType :: CInt -> SockType
-- | See socket(2).
-- | See socket(2).
-- | See socket(2).
-- | See socket(2).
-- | See socket(2).
-- | Socket protocol.
newtype SockProto
SockProto :: CInt -> SockProto
-- | Default socket protocol (corresponds to 0).
defaultSockProto :: SockProto
-- | Socket option.
class Storable (SockOptRaw o) => SockOpt o where type SockOptValue o type SockOptRaw o type SockOptReadable o :: Bool type SockOptWritable o :: Bool where {
type family SockOptValue o;
type family SockOptRaw o;
type family SockOptReadable o :: Bool;
type family SockOptWritable o :: Bool;
}
-- | Convert to FFI-level value
sockOptRaw :: SockOpt o => o -> SockOptValue o -> SockOptRaw o
-- | Convert from FFI-level value
sockOptValue :: SockOpt o => o -> SockOptRaw o -> SockOptValue o
-- | Option protocol level
sockOptLevel :: SockOpt o => o -> CInt
-- | Option code
sockOptCode :: SockOpt o => o -> CInt
data SO_ERROR
SO_ERROR :: SO_ERROR
data SO_KEEPALIVE
SO_KEEPALIVE :: SO_KEEPALIVE
data SO_REUSEADDR
SO_REUSEADDR :: SO_REUSEADDR
-- | Socket operations.
data SockOps
NoSockOps :: SockOps
RecvSockOps :: SockOps
SendSockOps :: SockOps
AllSockOps :: SockOps
-- | Message flags.
newtype MsgFlags
MsgFlags :: CInt -> MsgFlags
-- | See recvmsg(2) and sendmsg(2).
-- | See recvmsg(2) and sendmsg(2).
-- | See recvmsg(2) and sendmsg(2).
-- | See recvmsg(2) and sendmsg(2).
-- | Create a socket. The underlying file descriptor is non-blocking. All
-- blocking operations are done via the GHC event manager. See
-- socket(2).
socket :: (SockFamily f, MonadBase IO μ) => f -> SockType -> SockProto -> μ (Socket f)
-- | Get socket option value. See getsockopt(2).
getSockOpt :: (SockOpt o, SockOptReadable o ~ True, MonadBase IO μ) => Socket f -> o -> μ (SockOptValue o)
-- | Set socket option value. See setsockopt(2).
setSockOpt :: (SockOpt o, SockOptWritable o ~ True, MonadBase IO μ) => Socket f -> o -> SockOptValue o -> μ ()
-- | Bind socket to the specified address. See bind(2).
bind :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> SockFamilyAddr f -> μ ()
-- | Connect socket to the specified address. This operation blocks. See
-- connect(2).
connect :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> SockFamilyAddr f -> μ ()
-- | Try to connect socket without blocking. On success True is
-- returned. If the connection did not succeed immediately, False
-- is returned. See connect(2).
tryConnect :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> SockFamilyAddr f -> μ Bool
-- | Listen for connections on the given socket. See listen(2).
listen :: MonadBase IO μ => Socket f -> Int -> μ ()
-- | Accept a connection on the given socket. This operation blocks. See
-- accept(2).
accept :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> μ (Socket f, SockFamilyAddr f)
-- | Try to accept a connection on the given socket without blocking. On
-- success the accepted socket and the peer address are returned. See
-- accept(2).
tryAccept :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> μ (Maybe (Socket f, SockFamilyAddr f))
-- | Get the local address. See getsockname(2).
getLocalAddr :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> μ (SockFamilyAddr f)
-- | Get the remote address. See getpeername(2).
getRemoteAddr :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> μ (SockFamilyAddr f)
-- | Check if socket has out-of-band data. See sockatmark(3).
hasOobData :: MonadBase IO μ => Socket f -> μ Bool
-- | Receive a message from a connected socket, possibly utilizing multiple
-- memory buffers. See recvmsg(2).
recvBufs :: (SockFamily f, MonadBase IO μ) => Socket f -> [(Ptr Word8, Int)] -> MsgFlags -> μ (Int, MsgFlags)
-- | Receive a message from a connected socket. This operation blocks. See
-- recvmsg(2).
recvBuf :: (SockFamily f, MonadBase IO μ) => Socket f -> Ptr α -> Int -> MsgFlags -> μ (Int, MsgFlags)
-- | Receive a message from a connected socket. This operation blocks. See
-- recvmsg(2).
recv' :: (SockFamily f, MonadBase IO μ) => Socket f -> Int -> MsgFlags -> μ (ByteString, MsgFlags)
-- | Receive a message from a connected socket. This operation blocks. See
-- recvmsg(2).
recv :: (SockFamily f, MonadBase IO μ) => Socket f -> Int -> μ ByteString
-- | Receive a message from an unconnected socket, possibly utilizing
-- multiple memory buffers. This operation blocks. See recvmsg(2).
recvBufsFrom :: forall f μ. (SockFamily f, MonadBase IO μ) => Socket f -> [(Ptr Word8, Int)] -> MsgFlags -> μ (SockFamilyAddr f, Int, MsgFlags)
-- | Receive a message from an unconnected socket. This operation blocks.
-- See recvmsg(2).
recvBufFrom :: (SockFamily f, MonadBase IO μ) => Socket f -> Ptr α -> Int -> MsgFlags -> μ (SockFamilyAddr f, Int, MsgFlags)
-- | Receive a message from an unconnected socket. This operation blocks.
-- See recvmsg(2).
recvFrom' :: (SockFamily f, MonadBase IO μ) => Socket f -> Int -> MsgFlags -> μ (SockFamilyAddr f, ByteString, MsgFlags)
-- | Receive a message from an unconnected socket. This operation blocks.
-- See recvmsg(2).
recvFrom :: (SockFamily f, MonadBase IO μ) => Socket f -> Int -> μ (SockFamilyAddr f, ByteString)
-- | Send a message split into several memory buffers on a connected
-- socket. This operation blocks. See sendmsg(2).
sendBufs :: (SockFamily f, MonadBase IO μ) => Socket f -> [(Ptr Word8, Int)] -> MsgFlags -> μ Int
-- | Send a message split into several ByteStrings on a connected
-- socket. This operation blocks. See sendmsg(2).
sendMany' :: (SockFamily f, MonadBase IO μ) => Socket f -> [ByteString] -> MsgFlags -> μ Int
-- | Send a message split into several ByteStrings on a connected
-- socket. This operation blocks. See sendmsg(2).
sendMany :: (SockFamily f, MonadBase IO μ) => Socket f -> [ByteString] -> μ Int
-- | Send a message on a connected socket. This operation blocks. See
-- sendmsg(2).
sendBuf :: (SockFamily f, MonadBase IO μ) => Socket f -> Ptr α -> Int -> MsgFlags -> μ Int
-- | Send a message on a connected socket. This operation blocks. See
-- sendmsg(2).
send' :: (SockFamily f, MonadBase IO μ) => Socket f -> ByteString -> MsgFlags -> μ Int
-- | Send a message on a connected socket. This operation blocks. See
-- sendmsg(2).
send :: (SockFamily f, MonadBase IO μ) => Socket f -> ByteString -> μ Int
-- | Send a message split into several memory buffers on an unconnected
-- socket. This operation blocks. See sendmsg(2).
sendBufsTo :: (SockFamily f, MonadBase IO μ) => Socket f -> [(Ptr Word8, Int)] -> MsgFlags -> SockFamilyAddr f -> μ Int
-- | Send a message split into several ByteStrings on an unconnected
-- socket. This operation blocks. See sendmsg(2).
sendManyTo' :: (SockFamily f, MonadBase IO μ) => Socket f -> [ByteString] -> MsgFlags -> SockFamilyAddr f -> μ Int
-- | Send a message split into several ByteStrings on an unconnected
-- socket. This operation blocks. See sendmsg(2).
sendManyTo :: (SockFamily f, MonadBase IO μ) => Socket f -> [ByteString] -> SockFamilyAddr f -> μ Int
-- | Send a message on an unconnected socket. This operation blocks. See
-- sendmsg(2).
sendBufTo :: (SockFamily f, MonadBase IO μ) => Socket f -> Ptr α -> Int -> MsgFlags -> SockFamilyAddr f -> μ Int
-- | Send a message on an unconnected socket. This operation blocks. See
-- sendmsg(2).
sendTo' :: (SockFamily f, MonadBase IO μ) => Socket f -> ByteString -> MsgFlags -> SockFamilyAddr f -> μ Int
-- | Send a message on an unconnected socket. This operation blocks. See
-- sendmsg(2).
sendTo :: (SockFamily f, MonadBase IO μ) => Socket f -> ByteString -> SockFamilyAddr f -> μ Int
-- | Shut down a part of a full-duplex connection. See shutdown(2).
shutdown :: MonadBase IO μ => Socket f -> SockOps -> μ ()
-- | Close the socket. See close(2).
close :: MonadBase IO μ => Socket f -> μ ()
instance Data.Flags.Base.Flags System.Posix.Socket.MsgFlags
instance Foreign.Storable.Storable System.Posix.Socket.MsgFlags
instance GHC.Show.Show System.Posix.Socket.MsgFlags
instance GHC.Classes.Eq System.Posix.Socket.MsgFlags
instance GHC.Classes.Eq System.Posix.Socket.SockOps
instance GHC.Read.Read System.Posix.Socket.SockOps
instance GHC.Show.Show System.Posix.Socket.SockOps
instance GHC.Show.Show System.Posix.Socket.SO_REUSEADDR
instance GHC.Classes.Eq System.Posix.Socket.SO_REUSEADDR
instance GHC.Show.Show System.Posix.Socket.SO_KEEPALIVE
instance GHC.Classes.Eq System.Posix.Socket.SO_KEEPALIVE
instance GHC.Show.Show System.Posix.Socket.SO_ERROR
instance GHC.Classes.Eq System.Posix.Socket.SO_ERROR
instance Foreign.Storable.Storable System.Posix.Socket.SockProto
instance GHC.Show.Show System.Posix.Socket.SockProto
instance GHC.Classes.Ord System.Posix.Socket.SockProto
instance GHC.Classes.Eq System.Posix.Socket.SockProto
instance Foreign.Storable.Storable System.Posix.Socket.SockType
instance GHC.Show.Show System.Posix.Socket.SockType
instance GHC.Classes.Ord System.Posix.Socket.SockType
instance GHC.Classes.Eq System.Posix.Socket.SockType
instance GHC.Classes.Eq (System.Posix.Socket.Socket f)
instance Data.Default.Class.Default System.Posix.Socket.SockProto
instance System.Posix.Socket.SockOpt System.Posix.Socket.SO_ERROR
instance System.Posix.Socket.SockOpt System.Posix.Socket.SO_KEEPALIVE
instance System.Posix.Socket.SockOpt System.Posix.Socket.SO_REUSEADDR
instance Data.Flags.Base.Flags System.Posix.Socket.SockOps
instance Data.Flags.Base.BoundedFlags System.Posix.Socket.SockOps
-- | Internet address families.
module System.Posix.Socket.Inet
-- | IPv4 socket family.
data AF_INET
AF_INET :: AF_INET
-- | IPv6 socket family.
data AF_INET6
AF_INET6 :: AF_INET6
instance GHC.Show.Show System.Posix.Socket.Inet.AF_INET6
instance GHC.Classes.Eq System.Posix.Socket.Inet.AF_INET6
instance GHC.Show.Show System.Posix.Socket.Inet.AF_INET
instance GHC.Classes.Eq System.Posix.Socket.Inet.AF_INET
instance System.Posix.Socket.SockAddr Network.IP.Addr.Inet4Addr
instance System.Posix.Socket.SockFamily System.Posix.Socket.Inet.AF_INET
instance System.Posix.Socket.SockAddr Network.IP.Addr.Inet6Addr
instance System.Posix.Socket.SockFamily System.Posix.Socket.Inet.AF_INET6
-- | Local address family.
module System.Posix.Socket.Local
-- | Local socket address.
data LocalAddr
LocalAddr :: ByteString -> LocalAddr
NoLocalAddr :: LocalAddr
-- | LocalAddr proxy value.
aLocalAddr :: Proxy LocalAddr
-- | Local socket family.
data AF_LOCAL
AF_LOCAL :: AF_LOCAL
instance GHC.Show.Show System.Posix.Socket.Local.LocalAddr
instance GHC.Classes.Ord System.Posix.Socket.Local.LocalAddr
instance GHC.Classes.Eq System.Posix.Socket.Local.LocalAddr
instance GHC.Show.Show System.Posix.Socket.Local.AF_LOCAL
instance GHC.Classes.Eq System.Posix.Socket.Local.AF_LOCAL
instance System.Posix.Socket.SockAddr System.Posix.Socket.Local.LocalAddr
instance System.Posix.Socket.SockFamily System.Posix.Socket.Local.AF_LOCAL