-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | POSIX network database (<netdb.h>) API
--   
--   This package provides Haskell bindings to the the <a>POSIX network
--   database (netdb.h) API</a>.
--   
--   <h3>Relationship to the <tt>network</tt> package</h3>
--   
--   The <tt>network</tt> package version 2.* series provides
--   <a>Network.BSD</a> but it is removed starting with <tt>network</tt>
--   version 3.0.
--   
--   This package provides the <a>Network.BSD</a> module split off from the
--   <a>network package</a>.
--   
--   If in addition to the <tt>network</tt>'s modules also
--   <a>Network.BSD</a> is necessary, add <tt>network-bsd</tt> to your
--   dependencies like so:
--   
--   <pre>
--   library
--       build-depends: network     &gt;= 2.7 &amp;&amp; &lt; 3.2
--                    , network-bsd &gt;= 2.7 &amp;&amp; &lt; 2.9
--   </pre>
--   
--   I.e. you can control the version of the <tt>network</tt> package
--   independently.
--   
--   <b>NOTE</b>: Starting with <tt>network-bsd-2.8.1.0</tt> the APIs of
--   <tt>network</tt> and <tt>network-bsd</tt> evolve differently, and
--   consequently the versioning doesn't match up anymore! Moreover, also
--   starting with version <tt>network-bsd-2.8.1.0</tt> this package
--   requires <tt>network &gt;= 3</tt> in order to avoid module name
--   clashes with <tt>network &lt; 3</tt>'s <a>Network.BSD</a> module.
--   
--   However, <tt>network-bsd-2.7.0.0</tt> and <tt>network-bsd-2.8.0.0</tt>
--   passes thru the <a>Network.BSD</a> module from <tt>network-2.7.*</tt>
--   and <tt>network-2.8.*</tt> respectively in a non-clashing way via
--   Cabal's <a>reexported-modules</a> feature while ensuring a
--   well-defined <a>API versioning</a> of the observable API of
--   <tt>network-bsd</tt>. This is why the example above supporting a wide
--   range of <tt>network</tt> versions works by including version 2.7.0.0
--   in the required version range of <tt>network-bsd</tt>.
@package network-bsd
@version 2.8.1.0


-- | The <a>Network.BSD</a> module defines Haskell bindings to network
--   programming functionality (mostly <a>network database operations</a>)
--   provided by BSD Unix derivatives.
--   
--   <b>NOTE</b>: Some of the types are reexported from
--   <a>Network.Socket</a> in order to make the <tt>network-bsd</tt> API
--   self-contained.
--   
--   <h2>Windows compatibility</h2>
--   
--   The following functions are not exported by <a>Network.BSD</a> on the
--   Windows platform:
--   
--   <ul>
--   <li><a>getHostEntries</a>, <a>setHostEntry</a>, <a>getHostEntry</a>,
--   <a>endHostEntry</a></li>
--   <li><a>getServiceEntries</a>, <a>getServiceEntry</a>,
--   <a>setServiceEntry</a>, <a>endServiceEntry</a></li>
--   <li><a>getProtocolEntries</a>, <a>setProtocolEntry</a>,
--   <a>getProtocolEntry</a>, <a>endProtocolEntry</a></li>
--   <li><a>getNetworkByName</a>, <a>getNetworkByAddr</a>,
--   <a>getNetworkEntries</a>, <a>setNetworkEntry</a>,
--   <a>getNetworkEntry</a>, <a>endNetworkEntry</a></li>
--   </ul>
module Network.BSD
type HostName = String
type HostAddress = Word32
data Family
AF_UNSPEC :: Family
AF_UNIX :: Family
AF_INET :: Family
AF_INET6 :: Family
AF_IMPLINK :: Family
AF_PUP :: Family
AF_CHAOS :: Family
AF_NS :: Family
AF_NBS :: Family
AF_ECMA :: Family
AF_DATAKIT :: Family
AF_CCITT :: Family
AF_SNA :: Family
AF_DECnet :: Family
AF_DLI :: Family
AF_LAT :: Family
AF_HYLINK :: Family
AF_APPLETALK :: Family
AF_ROUTE :: Family
AF_NETBIOS :: Family
AF_NIT :: Family
AF_802 :: Family
AF_ISO :: Family
AF_OSI :: Family
AF_NETMAN :: Family
AF_X25 :: Family
AF_AX25 :: Family
AF_OSINET :: Family
AF_GOSSIP :: Family
AF_IPX :: Family
Pseudo_AF_XTP :: Family
AF_CTF :: Family
AF_WAN :: Family
AF_SDL :: Family
AF_NETWARE :: Family
AF_NDD :: Family
AF_INTF :: Family
AF_COIP :: Family
AF_CNT :: Family
Pseudo_AF_RTIP :: Family
Pseudo_AF_PIP :: Family
AF_SIP :: Family
AF_ISDN :: Family
Pseudo_AF_KEY :: Family
AF_NATM :: Family
AF_ARP :: Family
Pseudo_AF_HDRCMPLT :: Family
AF_ENCAP :: Family
AF_LINK :: Family
AF_RAW :: Family
AF_RIF :: Family
AF_NETROM :: Family
AF_BRIDGE :: Family
AF_ATMPVC :: Family
AF_ROSE :: Family
AF_NETBEUI :: Family
AF_SECURITY :: Family
AF_PACKET :: Family
AF_ASH :: Family
AF_ECONET :: Family
AF_ATMSVC :: Family
AF_IRDA :: Family
AF_PPPOX :: Family
AF_WANPIPE :: Family
AF_BLUETOOTH :: Family
AF_CAN :: Family

-- | Calling <a>getHostName</a> returns the standard host name for the
--   current processor, as set at boot time.
--   
--   <tt>gethostname(2)</tt>.
getHostName :: IO HostName

-- | Representation of the POSIX <tt>hostent</tt> structure defined in
--   <a><a>netdb.h</a></a>.
data HostEntry
HostEntry :: HostName -> [HostName] -> Family -> [HostAddress] -> HostEntry

-- | Official name of the host
[hostName] :: HostEntry -> HostName

-- | Alternative names of the host
[hostAliases] :: HostEntry -> [HostName]

-- | Address type (currently <tt>AF_INET</tt>)
[hostFamily] :: HostEntry -> Family

-- | Set of network addresses for the host
[hostAddresses] :: HostEntry -> [HostAddress]

-- | Resolve a <a>HostName</a> to IPv4 address.
getHostByName :: HostName -> IO HostEntry

-- | Get a <a>HostEntry</a> corresponding to the given address and family.
--   Note that only IPv4 is currently supported.
getHostByAddr :: Family -> HostAddress -> IO HostEntry

-- | Convenience function extracting one address in a <a>HostEntry</a>.
--   Returns <a>error</a> if <a>HostEntry</a> contains no addresses.
hostAddress :: HostEntry -> HostAddress

-- | Retrieve list of all <a>HostEntry</a> via <tt>gethostent(3)</tt>.
getHostEntries :: Bool -> IO [HostEntry]

-- | <tt>sethostent(3)</tt>.
setHostEntry :: Bool -> IO ()

-- | <tt>gethostent(3)</tt>.
getHostEntry :: IO HostEntry

-- | <tt>endhostent(3)</tt>.
endHostEntry :: IO ()

-- | Representation of the POSIX <tt>servent</tt> structure defined in
--   <a><a>netdb.h</a></a>.
data ServiceEntry
ServiceEntry :: ServiceName -> [ServiceName] -> PortNumber -> ProtocolName -> ServiceEntry

-- | Official service name
[serviceName] :: ServiceEntry -> ServiceName

-- | aliases
[serviceAliases] :: ServiceEntry -> [ServiceName]

-- | Port Number
[servicePort] :: ServiceEntry -> PortNumber

-- | Protocol to use
[serviceProtocol] :: ServiceEntry -> ProtocolName
type ServiceName = String
data PortNumber

-- | Get service by name.
getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry

-- | Get the service given a <a>PortNumber</a> and <a>ProtocolName</a>.
getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry

-- | Get the <a>PortNumber</a> corresponding to the <a>ServiceName</a>.
getServicePortNumber :: ServiceName -> IO PortNumber

-- | Retrieve list of all <a>ServiceEntry</a> via <tt>getservent(3)</tt>.
getServiceEntries :: Bool -> IO [ServiceEntry]

-- | <tt>getservent(3)</tt>.
getServiceEntry :: IO ServiceEntry

-- | <tt>setservent(3)</tt>.
setServiceEntry :: Bool -> IO ()

-- | <tt>endservent(3)</tt>.
endServiceEntry :: IO ()
type ProtocolName = String
type ProtocolNumber = CInt

-- | Representation of the POSIX <tt>protoent</tt> structure defined in
--   <a><a>netdb.h</a></a>.
data ProtocolEntry
ProtocolEntry :: ProtocolName -> [ProtocolName] -> ProtocolNumber -> ProtocolEntry

-- | Official name
[protoName] :: ProtocolEntry -> ProtocolName

-- | aliases
[protoAliases] :: ProtocolEntry -> [ProtocolName]

-- | Protocol number
[protoNumber] :: ProtocolEntry -> ProtocolNumber

-- | <tt>getprotobyname(3)</tt>.
getProtocolByName :: ProtocolName -> IO ProtocolEntry

-- | <tt>getprotobynumber(3)</tt>.
getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry

-- | <tt>getprotobyname(3)</tt>.
getProtocolNumber :: ProtocolName -> IO ProtocolNumber
defaultProtocol :: ProtocolNumber

-- | Retrieve list of all <a>ProtocolEntry</a> via <tt>getprotoent(3)</tt>.
getProtocolEntries :: Bool -> IO [ProtocolEntry]

-- | <tt>setprotoent(3)</tt>.
setProtocolEntry :: Bool -> IO ()

-- | <tt>getprotoent(3)</tt>.
getProtocolEntry :: IO ProtocolEntry

-- | <tt>endprotoent(3)</tt>.
endProtocolEntry :: IO ()
type NetworkName = String
type NetworkAddr = CULong

-- | Representation of the POSIX <tt>netent</tt> structure defined in
--   <a><a>netdb.h</a></a>.
data NetworkEntry
NetworkEntry :: NetworkName -> [NetworkName] -> Family -> NetworkAddr -> NetworkEntry

-- | Official network name
[networkName] :: NetworkEntry -> NetworkName

-- | aliases
[networkAliases] :: NetworkEntry -> [NetworkName]

-- | Network address type
[networkFamily] :: NetworkEntry -> Family

-- | Network number
[networkAddress] :: NetworkEntry -> NetworkAddr

-- | <tt>getnetbyname(3)</tt>.
getNetworkByName :: NetworkName -> IO NetworkEntry

-- | <tt>getnetbyaddr(3)</tt>.
getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry

-- | Get the list of network entries via <tt>getnetent(3)</tt>.
getNetworkEntries :: Bool -> IO [NetworkEntry]

-- | Open the network name database. The parameter specifies whether a
--   connection is maintained open between various networkEntry calls
--   
--   <tt>setnetent(3)</tt>.
setNetworkEntry :: Bool -> IO ()

-- | <tt>getnetent(3)</tt>.
getNetworkEntry :: IO NetworkEntry

-- | Close the connection to the network name database.
--   
--   <tt>endnetent(3)</tt>.
endNetworkEntry :: IO ()
ifNameToIndex :: String -> IO (Maybe Int)
instance GHC.Show.Show Network.BSD.ServiceEntry
instance GHC.Show.Show Network.BSD.ProtocolEntry
instance GHC.Read.Read Network.BSD.ProtocolEntry
instance GHC.Show.Show Network.BSD.HostEntry
instance GHC.Read.Read Network.BSD.HostEntry
instance GHC.Show.Show Network.BSD.NetworkEntry
instance GHC.Read.Read Network.BSD.NetworkEntry
instance Control.DeepSeq.NFData Network.BSD.NetworkEntry
instance Foreign.Storable.Storable Network.BSD.NetworkEntry
instance Control.DeepSeq.NFData Network.BSD.HostEntry
instance Foreign.Storable.Storable Network.BSD.HostEntry
instance Control.DeepSeq.NFData Network.BSD.ProtocolEntry
instance Foreign.Storable.Storable Network.BSD.ProtocolEntry
instance Control.DeepSeq.NFData Network.BSD.ServiceEntry
instance Foreign.Storable.Storable Network.BSD.ServiceEntry
