| Haskell Core Libraries (network package) | Contents | Index

Network.BSD

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

Contents

Host names
Service names
Protocol names
Port numbers
Network names
Symbolic links

Description

The Network.BSD module defines Haskell bindings to functionality provided by BSD Unix derivatives. Currently this covers network programming functionality and symbolic links. (OK, so the latter is pretty much supported by most Unixes today, but it was BSD that introduced them.)

The symlink stuff is really in the wrong place, at some point it will move to a generic Unix library somewhere else in the module tree.

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
setHostEntry :: Bool -> IO ()
getHostEntry :: IO HostEntry
endHostEntry :: IO ()
getHostEntries :: Bool -> IO [HostEntry]

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
getServiceEntry :: IO ServiceEntry
setServiceEntry :: Bool -> IO ()
endServiceEntry :: IO ()
getServiceEntries :: Bool -> IO [ServiceEntry]
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
setProtocolEntry :: Bool -> IO ()
getProtocolEntry :: IO ProtocolEntry
endProtocolEntry :: IO ()
getProtocolEntries :: Bool -> IO [ProtocolEntry]
data PortNumber
type NetworkName = String
type NetworkAddr = CULong

data NetworkEntry = NetworkEntry {

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

}

getNetworkByName :: NetworkName -> IO NetworkEntry
getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry
setNetworkEntry :: Bool -> IO ()
getNetworkEntry :: IO NetworkEntry
endNetworkEntry :: IO ()
getNetworkEntries :: Bool -> IO [NetworkEntry]
symlink :: String -> String -> IO ()
readlink :: String -> IO String

Host names
type HostName = String
getHostName :: IO HostName
data HostEntry

Constructors

HostEntry |

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

Instances

Read HostEntry
Show HostEntry
Storable HostEntry
Typeable HostEntry

getHostByName :: HostName -> IO HostEntry
getHostByAddr :: Family -> HostAddress -> IO HostEntry
hostAddress :: HostEntry -> HostAddress
setHostEntry :: Bool -> IO ()
getHostEntry :: IO HostEntry
endHostEntry :: IO ()
getHostEntries :: Bool -> IO [HostEntry]
Service names
data ServiceEntry

Constructors

ServiceEntry |

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

Instances

Show ServiceEntry
Storable ServiceEntry
Typeable ServiceEntry

type ServiceName = String
getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry
getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry
getServicePortNumber :: ServiceName -> IO PortNumber
getServiceEntry :: IO ServiceEntry
setServiceEntry :: Bool -> IO ()
endServiceEntry :: IO ()
getServiceEntries :: Bool -> IO [ServiceEntry]
Protocol names
type ProtocolName = String
type ProtocolNumber = CInt
data ProtocolEntry

Constructors

ProtocolEntry |

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

Instances

Read ProtocolEntry
Show ProtocolEntry
Storable ProtocolEntry
Typeable ProtocolEntry

getProtocolByName :: ProtocolName -> IO ProtocolEntry
getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry
getProtocolNumber :: ProtocolName -> IO ProtocolNumber
setProtocolEntry :: Bool -> IO ()
getProtocolEntry :: IO ProtocolEntry
endProtocolEntry :: IO ()
getProtocolEntries :: Bool -> IO [ProtocolEntry]
Port numbers
data PortNumber

Instances

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

Network names
type NetworkName = String
type NetworkAddr = CULong
data NetworkEntry

Constructors

NetworkEntry |

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

Instances

Read NetworkEntry
Show NetworkEntry
Storable NetworkEntry
Typeable NetworkEntry

getNetworkByName :: NetworkName -> IO NetworkEntry
getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry
setNetworkEntry :: Bool -> IO ()
getNetworkEntry :: IO NetworkEntry
endNetworkEntry :: IO ()
getNetworkEntries :: Bool -> IO [NetworkEntry]
Symbolic links
symlink :: String -> String -> IO ()
readlink :: String -> IO String
Produced by Haddock version 0.7