Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/network/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell98 |
The Network.BSD module defines Haskell bindings to network programming functionality provided by BSD Unix derivatives.
- type HostName = String
- getHostName :: IO HostName
- data HostEntry = HostEntry {
- hostName :: HostName
- hostAliases :: [HostName]
- hostFamily :: Family
- hostAddresses :: [HostAddress]
- getHostByName :: HostName -> IO HostEntry
- getHostByAddr :: Family -> HostAddress -> IO HostEntry
- hostAddress :: HostEntry -> HostAddress
- getHostEntries :: Bool -> IO [HostEntry]
- setHostEntry :: Bool -> IO ()
- getHostEntry :: IO HostEntry
- endHostEntry :: IO ()
- data ServiceEntry = ServiceEntry {}
- type ServiceName = String
- getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry
- getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry
- getServicePortNumber :: ServiceName -> IO PortNumber
- getServiceEntries :: Bool -> IO [ServiceEntry]
- getServiceEntry :: IO ServiceEntry
- setServiceEntry :: Bool -> IO ()
- endServiceEntry :: IO ()
- type ProtocolName = String
- type ProtocolNumber = CInt
- data ProtocolEntry = ProtocolEntry {}
- getProtocolByName :: ProtocolName -> IO ProtocolEntry
- getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry
- getProtocolNumber :: ProtocolName -> IO ProtocolNumber
- defaultProtocol :: ProtocolNumber
- getProtocolEntries :: Bool -> IO [ProtocolEntry]
- setProtocolEntry :: Bool -> IO ()
- getProtocolEntry :: IO ProtocolEntry
- endProtocolEntry :: IO ()
- data PortNumber
- type NetworkName = String
- type NetworkAddr = CULong
- data NetworkEntry = NetworkEntry {}
- getNetworkByName :: NetworkName -> IO NetworkEntry
- getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry
- getNetworkEntries :: Bool -> IO [NetworkEntry]
- setNetworkEntry :: Bool -> IO ()
- getNetworkEntry :: IO NetworkEntry
- endNetworkEntry :: IO ()
- ifNameToIndex :: String -> IO (Maybe Int)
Host names
type HostName = String Source #
Either a host name e.g., "haskell.org"
or a numeric host
address string consisting of a dotted decimal IPv4 address or an
IPv6 address e.g., "192.168.0.1"
.
getHostName :: IO HostName Source #
Calling getHostName returns the standard host name for the current processor, as set at boot time.
HostEntry | |
|
getHostByAddr :: Family -> HostAddress -> IO HostEntry Source #
Get a HostEntry
corresponding to the given address and family.
Note that only IPv4 is currently supported.
hostAddress :: HostEntry -> HostAddress Source #
Low level functionality
setHostEntry :: Bool -> IO () Source #
endHostEntry :: IO () Source #
Service names
type ServiceName = String Source #
getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry Source #
Get service by name.
getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry Source #
Get the service given a PortNumber
and ProtocolName
.
getServicePortNumber :: ServiceName -> IO PortNumber Source #
Get the PortNumber
corresponding to the ServiceName
.
getServiceEntries :: Bool -> IO [ServiceEntry] Source #
Low level functionality
setServiceEntry :: Bool -> IO () Source #
endServiceEntry :: IO () Source #
Protocol names
type ProtocolName = String Source #
type ProtocolNumber = CInt Source #
defaultProtocol :: ProtocolNumber Source #
This is the default protocol for a given service.
getProtocolEntries :: Bool -> IO [ProtocolEntry] Source #
Low level functionality
setProtocolEntry :: Bool -> IO () Source #
endProtocolEntry :: IO () Source #
Port numbers
data PortNumber Source #
Use the Num
instance (i.e. use a literal) to create a
PortNumber
value with the correct network-byte-ordering. You
should not use the PortNum constructor. It will be removed in the
next release.
>>>
1 :: PortNumber
1>>>
read "1" :: PortNumber
1
Network names
type NetworkName = String Source #
type NetworkAddr = CULong Source #
getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry Source #
getNetworkEntries :: Bool -> IO [NetworkEntry] Source #
Get the list of network entries.
Low level functionality
setNetworkEntry :: Bool -> IO () Source #
Open the network name database. The parameter specifies whether a connection is maintained open between various networkEntry calls
endNetworkEntry :: IO () Source #
Close the connection to the network name database.