Copyright | (c) Lars Petersen 2015 |
---|---|
License | MIT |
Maintainer | info@lars-petersen.net |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
System.Socket.Family.Inet
Contents
Description
Synopsis
- data Inet
- data InetAddress
- data InetPort
- data family SocketAddress f
- inetAddressFromTuple :: (Word8, Word8, Word8, Word8) -> InetAddress
- inetAddressToTuple :: InetAddress -> (Word8, Word8, Word8, Word8)
- inetAllHostsGroup :: InetAddress
- inetAny :: InetAddress
- inetBroadcast :: InetAddress
- inetLoopback :: InetAddress
- inetMaxLocalGroup :: InetAddress
- inetNone :: InetAddress
- inetUnspecificGroup :: InetAddress
Inet
Instances
InetAddress
data InetAddress Source #
To avoid errors with endianess it was decided to keep this type abstract.
Use inetAddressFromTuple
and inetAddressToTuple
for constructing and
deconstructing custom addresses.
Hint: Use the Storable
instance.
It exposes it exactly as found within an IP packet (big endian if you insist
on interpreting it as a number).
Another hint: Use getAddressInfo
for parsing and suppress
nameserver lookups:
> getAddressInfo (Just "127.0.0.1") Nothing aiNumericHost :: IO [AddressInfo Inet Stream TCP] [AddressInfo {addressInfoFlags = AddressInfoFlags 4, socketAddress = SocketAddressInet {inetAddress = InetAddress 127.0.0.1, inetPort = InetPort 0}, canonicalName = Nothing}]
Instances
Eq InetAddress Source # | |
Defined in System.Socket.Family.Inet | |
Show InetAddress Source # | |
Defined in System.Socket.Family.Inet Methods showsPrec :: Int -> InetAddress -> ShowS # show :: InetAddress -> String # showList :: [InetAddress] -> ShowS # | |
Storable InetAddress Source # | |
Defined in System.Socket.Family.Inet Methods sizeOf :: InetAddress -> Int # alignment :: InetAddress -> Int # peekElemOff :: Ptr InetAddress -> Int -> IO InetAddress # pokeElemOff :: Ptr InetAddress -> Int -> InetAddress -> IO () # peekByteOff :: Ptr b -> Int -> IO InetAddress # pokeByteOff :: Ptr b -> Int -> InetAddress -> IO () # peek :: Ptr InetAddress -> IO InetAddress # poke :: Ptr InetAddress -> InetAddress -> IO () # |
InetPort
Instances
Enum InetPort Source # | |
Defined in System.Socket.Family.Inet | |
Eq InetPort Source # | |
Integral InetPort Source # | |
Defined in System.Socket.Family.Inet | |
Num InetPort Source # | |
Ord InetPort Source # | |
Defined in System.Socket.Family.Inet | |
Real InetPort Source # | |
Defined in System.Socket.Family.Inet Methods toRational :: InetPort -> Rational # | |
Show InetPort Source # | |
Storable InetPort Source # | |
Defined in System.Socket.Family.Inet |
data family SocketAddress f Source #
The SocketAddress
type is a data family.
This allows to provide different data constructors depending on the socket
family without knowing all of them in advance or the need to extend this
core library.
SocketAddressInet inetLoopback 8080 :: SocketAddress Inet SocketAddressInet6 inet6Loopback 8080 0 0 :: SocketAddress Inet6
Instances
Custom addresses
inetAddressFromTuple
inetAddressFromTuple :: (Word8, Word8, Word8, Word8) -> InetAddress Source #
Constructs a custom InetAddress
.
inetAddressFromTuple (127,0,0,1) == inetLoopback
inetAddressToTuple
inetAddressToTuple :: InetAddress -> (Word8, Word8, Word8, Word8) Source #
Deconstructs an InetAddress
.
Special addresses
inetAllHostsGroup
inetAllHostsGroup :: InetAddress Source #
224.0.0.1
inetAny
inetAny :: InetAddress Source #
0.0.0.0
inetBroadcast
inetBroadcast :: InetAddress Source #
255.255.255.255
inetLoopback
inetLoopback :: InetAddress Source #
127.0.0.1
inetMaxLocalGroup
inetMaxLocalGroup :: InetAddress Source #
224.0.0.255
inetNone
inetNone :: InetAddress Source #
255.255.255.255
inetUnspecificGroup
inetUnspecificGroup :: InetAddress Source #
224.0.0.0