-- 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
pattern AF_UNSPEC :: Family
pattern AF_UNIX :: Family
pattern AF_INET :: Family
pattern AF_INET6 :: Family
pattern AF_IMPLINK :: Family
pattern AF_PUP :: Family
pattern AF_CHAOS :: Family
pattern AF_NS :: Family
pattern AF_NBS :: Family
pattern AF_ECMA :: Family
pattern AF_DATAKIT :: Family
pattern AF_CCITT :: Family
pattern AF_SNA :: Family
pattern AF_DECnet :: Family
pattern AF_DLI :: Family
pattern AF_LAT :: Family
pattern AF_HYLINK :: Family
pattern AF_APPLETALK :: Family
pattern AF_ROUTE :: Family
pattern AF_NETBIOS :: Family
pattern AF_NIT :: Family
pattern AF_802 :: Family
pattern AF_ISO :: Family
pattern AF_OSI :: Family
pattern AF_NETMAN :: Family
pattern AF_X25 :: Family
pattern AF_AX25 :: Family
pattern AF_OSINET :: Family
pattern AF_GOSSIP :: Family
pattern AF_IPX :: Family
pattern Pseudo_AF_XTP :: Family
pattern AF_CTF :: Family
pattern AF_WAN :: Family
pattern AF_SDL :: Family
pattern AF_NETWARE :: Family
pattern AF_NDD :: Family
pattern AF_INTF :: Family
pattern AF_COIP :: Family
pattern AF_CNT :: Family
pattern Pseudo_AF_RTIP :: Family
pattern Pseudo_AF_PIP :: Family
pattern AF_SIP :: Family
pattern AF_ISDN :: Family
pattern Pseudo_AF_KEY :: Family
pattern AF_NATM :: Family
pattern AF_ARP :: Family
pattern Pseudo_AF_HDRCMPLT :: Family
pattern AF_ENCAP :: Family
pattern AF_LINK :: Family
pattern AF_RAW :: Family
pattern AF_RIF :: Family
pattern AF_NETROM :: Family
pattern AF_BRIDGE :: Family
pattern AF_ATMPVC :: Family
pattern AF_ROSE :: Family
pattern AF_NETBEUI :: Family
pattern AF_SECURITY :: Family
pattern AF_PACKET :: Family
pattern AF_ASH :: Family
pattern AF_ECONET :: Family
pattern AF_ATMSVC :: Family
pattern AF_IRDA :: Family
pattern AF_PPPOX :: Family
pattern AF_WANPIPE :: Family
pattern AF_BLUETOOTH :: Family
pattern 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
