network-bsd-2.8.1.0: POSIX network database (<netdb.h>) API

Copyright(c) The University of Glasgow 2001
LicenseBSD-3-Clause
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Network.BSD

Contents

Description

The Network.BSD module defines Haskell bindings to network programming functionality (mostly network database operations) provided by BSD Unix derivatives.

NOTE: Some of the types are reexported from Network.Socket in order to make the network-bsd API self-contained.

Windows compatibility

The following functions are not exported by Network.BSD on the Windows platform:

Synopsis

Host names and network addresses

type HostName = String #

type HostAddress = Word32 #

getHostName :: IO HostName Source #

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

gethostname(2).

data HostEntry Source #

Representation of the POSIX hostent structure defined in <netdb.h>.

Constructors

HostEntry 

Fields

Instances
Read HostEntry Source # 
Instance details

Defined in Network.BSD

Methods

readsPrec :: Int -> ReadS HostEntry

readList :: ReadS [HostEntry]

readPrec :: ReadPrec HostEntry

readListPrec :: ReadPrec [HostEntry]

Show HostEntry Source # 
Instance details

Defined in Network.BSD

Methods

showsPrec :: Int -> HostEntry -> ShowS

show :: HostEntry -> String

showList :: [HostEntry] -> ShowS

Storable HostEntry Source # 
Instance details

Defined in Network.BSD

Methods

sizeOf :: HostEntry -> Int

alignment :: HostEntry -> Int

peekElemOff :: Ptr HostEntry -> Int -> IO HostEntry

pokeElemOff :: Ptr HostEntry -> Int -> HostEntry -> IO ()

peekByteOff :: Ptr b -> Int -> IO HostEntry

pokeByteOff :: Ptr b -> Int -> HostEntry -> IO ()

peek :: Ptr HostEntry -> IO HostEntry

poke :: Ptr HostEntry -> HostEntry -> IO ()

NFData HostEntry Source #

Since: 2.8.1.0

Instance details

Defined in Network.BSD

Methods

rnf :: 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 #

Convenience function extracting one address in a HostEntry. Returns error if HostEntry contains no addresses.

getHostEntries :: Bool -> IO [HostEntry] Source #

Retrieve list of all HostEntry via gethostent(3).

Low level functionality

setHostEntry :: Bool -> IO () Source #

sethostent(3).

getHostEntry :: IO HostEntry Source #

gethostent(3).

endHostEntry :: IO () Source #

endhostent(3).

Service names

data ServiceEntry Source #

Representation of the POSIX servent structure defined in <netdb.h>.

Constructors

ServiceEntry 

Fields

Instances
Show ServiceEntry Source # 
Instance details

Defined in Network.BSD

Methods

showsPrec :: Int -> ServiceEntry -> ShowS

show :: ServiceEntry -> String

showList :: [ServiceEntry] -> ShowS

Storable ServiceEntry Source # 
Instance details

Defined in Network.BSD

Methods

sizeOf :: ServiceEntry -> Int

alignment :: ServiceEntry -> Int

peekElemOff :: Ptr ServiceEntry -> Int -> IO ServiceEntry

pokeElemOff :: Ptr ServiceEntry -> Int -> ServiceEntry -> IO ()

peekByteOff :: Ptr b -> Int -> IO ServiceEntry

pokeByteOff :: Ptr b -> Int -> ServiceEntry -> IO ()

peek :: Ptr ServiceEntry -> IO ServiceEntry

poke :: Ptr ServiceEntry -> ServiceEntry -> IO ()

NFData ServiceEntry Source #

Since: 2.8.1.0

Instance details

Defined in Network.BSD

Methods

rnf :: ServiceEntry -> ()

type ServiceName = String #

data PortNumber #

Instances
Enum PortNumber 
Instance details

Defined in Network.Socket.Types

Eq PortNumber 
Instance details

Defined in Network.Socket.Types

Methods

(==) :: PortNumber -> PortNumber -> Bool

(/=) :: PortNumber -> PortNumber -> Bool

Integral PortNumber 
Instance details

Defined in Network.Socket.Types

Num PortNumber 
Instance details

Defined in Network.Socket.Types

Ord PortNumber 
Instance details

Defined in Network.Socket.Types

Read PortNumber 
Instance details

Defined in Network.Socket.Types

Methods

readsPrec :: Int -> ReadS PortNumber

readList :: ReadS [PortNumber]

readPrec :: ReadPrec PortNumber

readListPrec :: ReadPrec [PortNumber]

Real PortNumber 
Instance details

Defined in Network.Socket.Types

Methods

toRational :: PortNumber -> Rational

Show PortNumber 
Instance details

Defined in Network.Socket.Types

Methods

showsPrec :: Int -> PortNumber -> ShowS

show :: PortNumber -> String

showList :: [PortNumber] -> ShowS

Storable PortNumber 
Instance details

Defined in Network.Socket.Types

Methods

sizeOf :: PortNumber -> Int

alignment :: PortNumber -> Int

peekElemOff :: Ptr PortNumber -> Int -> IO PortNumber

pokeElemOff :: Ptr PortNumber -> Int -> PortNumber -> IO ()

peekByteOff :: Ptr b -> Int -> IO PortNumber

pokeByteOff :: Ptr b -> Int -> PortNumber -> IO ()

peek :: Ptr PortNumber -> IO PortNumber

poke :: Ptr PortNumber -> PortNumber -> IO ()

getServiceEntries :: Bool -> IO [ServiceEntry] Source #

Retrieve list of all ServiceEntry via getservent(3).

Low level functionality

getServiceEntry :: IO ServiceEntry Source #

getservent(3).

setServiceEntry :: Bool -> IO () Source #

setservent(3).

endServiceEntry :: IO () Source #

endservent(3).

Protocol names

type ProtocolName = String Source #

type ProtocolNumber = CInt #

data ProtocolEntry Source #

Representation of the POSIX protoent structure defined in <netdb.h>.

Constructors

ProtocolEntry 

Fields

Instances
Read ProtocolEntry Source # 
Instance details

Defined in Network.BSD

Methods

readsPrec :: Int -> ReadS ProtocolEntry

readList :: ReadS [ProtocolEntry]

readPrec :: ReadPrec ProtocolEntry

readListPrec :: ReadPrec [ProtocolEntry]

Show ProtocolEntry Source # 
Instance details

Defined in Network.BSD

Methods

showsPrec :: Int -> ProtocolEntry -> ShowS

show :: ProtocolEntry -> String

showList :: [ProtocolEntry] -> ShowS

Storable ProtocolEntry Source # 
Instance details

Defined in Network.BSD

Methods

sizeOf :: ProtocolEntry -> Int

alignment :: ProtocolEntry -> Int

peekElemOff :: Ptr ProtocolEntry -> Int -> IO ProtocolEntry

pokeElemOff :: Ptr ProtocolEntry -> Int -> ProtocolEntry -> IO ()

peekByteOff :: Ptr b -> Int -> IO ProtocolEntry

pokeByteOff :: Ptr b -> Int -> ProtocolEntry -> IO ()

peek :: Ptr ProtocolEntry -> IO ProtocolEntry

poke :: Ptr ProtocolEntry -> ProtocolEntry -> IO ()

NFData ProtocolEntry Source #

Since: 2.8.1.0

Instance details

Defined in Network.BSD

Methods

rnf :: ProtocolEntry -> ()

getProtocolEntries :: Bool -> IO [ProtocolEntry] Source #

Retrieve list of all ProtocolEntry via getprotoent(3).

Low level functionality

setProtocolEntry :: Bool -> IO () Source #

setprotoent(3).

getProtocolEntry :: IO ProtocolEntry Source #

getprotoent(3).

endProtocolEntry :: IO () Source #

endprotoent(3).

Network names

type NetworkName = String Source #

type NetworkAddr = CULong Source #

data NetworkEntry Source #

Representation of the POSIX netent structure defined in <netdb.h>.

Constructors

NetworkEntry 

Fields

Instances
Read NetworkEntry Source # 
Instance details

Defined in Network.BSD

Methods

readsPrec :: Int -> ReadS NetworkEntry

readList :: ReadS [NetworkEntry]

readPrec :: ReadPrec NetworkEntry

readListPrec :: ReadPrec [NetworkEntry]

Show NetworkEntry Source # 
Instance details

Defined in Network.BSD

Methods

showsPrec :: Int -> NetworkEntry -> ShowS

show :: NetworkEntry -> String

showList :: [NetworkEntry] -> ShowS

Storable NetworkEntry Source # 
Instance details

Defined in Network.BSD

Methods

sizeOf :: NetworkEntry -> Int

alignment :: NetworkEntry -> Int

peekElemOff :: Ptr NetworkEntry -> Int -> IO NetworkEntry

pokeElemOff :: Ptr NetworkEntry -> Int -> NetworkEntry -> IO ()

peekByteOff :: Ptr b -> Int -> IO NetworkEntry

pokeByteOff :: Ptr b -> Int -> NetworkEntry -> IO ()

peek :: Ptr NetworkEntry -> IO NetworkEntry

poke :: Ptr NetworkEntry -> NetworkEntry -> IO ()

NFData NetworkEntry Source #

Since: 2.8.1.0

Instance details

Defined in Network.BSD

Methods

rnf :: NetworkEntry -> ()

getNetworkEntries :: Bool -> IO [NetworkEntry] Source #

Get the list of network entries via getnetent(3).

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

setnetent(3).

endNetworkEntry :: IO () Source #

Close the connection to the network name database.

endnetent(3).

Interface names

ifNameToIndex :: String -> IO (Maybe Int) #