| network-2.1.0.0: Networking-related facilities | Source code | Contents | Index

Network.BSD |

Portability | non-portable
Stability | experimental
Maintainer | libraries@haskell.org

Contents

Host names
Service names
Protocol names
Port numbers
Network names

Description
The Network.BSD module defines Haskell bindings to network programming functionality provided by BSD Unix derivatives.
Synopsis

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
data ServiceEntry = ServiceEntry {

serviceName :: ServiceName
serviceAliases :: [ServiceName]
servicePort :: PortNumber
serviceProtocol :: ProtocolName

}
type ServiceName = String
getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry
getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry
getServicePortNumber :: ServiceName -> IO PortNumber
type ProtocolName = String
type ProtocolNumber = CInt
data ProtocolEntry = ProtocolEntry {

protoName :: ProtocolName
protoAliases :: [ProtocolName]
protoNumber :: ProtocolNumber

}
getProtocolByName :: ProtocolName -> IO ProtocolEntry
getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry
getProtocolNumber :: ProtocolName -> IO ProtocolNumber
defaultProtocol :: ProtocolNumber
data PortNumber
type NetworkName = String
type NetworkAddr = CULong
data NetworkEntry = NetworkEntry {

networkName :: NetworkName
networkAliases :: [NetworkName]
networkFamily :: Family
networkAddress :: NetworkAddr

}

Host names

type HostName = String | Source

getHostName :: IO HostName | Source

Calling getHostName returns the standard host name for the current processor, as set at boot time.

data HostEntry | Source

Constructors

HostEntry |

hostName :: HostName |
hostAliases :: [HostName] |
hostFamily :: Family |
hostAddresses :: [HostAddress] |

Instances

Read HostEntry
Show HostEntry
Storable HostEntry
Typeable HostEntry

getHostByName :: HostName -> IO HostEntry | Source

Resolve a `HostName` to IPv4 address.

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

Service names

data ServiceEntry | Source

Constructors

ServiceEntry |

serviceName :: ServiceName |
serviceAliases :: [ServiceName] |
servicePort :: PortNumber |
serviceProtocol :: ProtocolName |

Instances

Show ServiceEntry
Storable ServiceEntry
Typeable ServiceEntry

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`.
Protocol names

type ProtocolName = String | Source

type ProtocolNumber = CInt | Source

data ProtocolEntry | Source

Constructors

ProtocolEntry |

protoName :: ProtocolName |
protoAliases :: [ProtocolName] |
protoNumber :: ProtocolNumber |

Instances

Read ProtocolEntry
Show ProtocolEntry
Storable ProtocolEntry
Typeable ProtocolEntry

getProtocolByName :: ProtocolName -> IO ProtocolEntry | Source

getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry | Source

getProtocolNumber :: ProtocolName -> IO ProtocolNumber | Source

defaultProtocol :: ProtocolNumber | Source

This is the default protocol for a given service.
Port numbers

data PortNumber | Source

Instances

Enum PortNumber
Eq PortNumber
Integral PortNumber
Num PortNumber
Ord PortNumber
Real PortNumber
Show PortNumber
Storable PortNumber
Typeable PortNumber

Network names

type NetworkName = String | Source

type NetworkAddr = CULong | Source

data NetworkEntry | Source

Constructors

NetworkEntry |

networkName :: NetworkName |
networkAliases :: [NetworkName] |
networkFamily :: Family |
networkAddress :: NetworkAddr |

Instances

Read NetworkEntry
Show NetworkEntry
Storable NetworkEntry
Typeable NetworkEntry

Produced by Haddock version 0.8