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

Copyright | (c) The University of Glasgow 2001
License | BSD-3-Clause
Maintainer | libraries@haskell.org
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Network.BSD

Contents

- Host names and network addresses
  - Low level functionality
- Service names
  - Low level functionality
- Protocol names
  - Low level functionality
- Network names
  - Low level functionality
- Interface names

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:

- `getHostEntries`, `setHostEntry`, `getHostEntry`, `endHostEntry`
- `getServiceEntries`, `getServiceEntry`, `setServiceEntry`, `endServiceEntry`
- `getProtocolEntries`, `setProtocolEntry`, `getProtocolEntry`, `endProtocolEntry`
- `getNetworkByName`, `getNetworkByAddr`, `getNetworkEntries`, `setNetworkEntry`, `getNetworkEntry`, `endNetworkEntry`

Synopsis

- type HostName = String
- type HostAddress = Word32
- data Family where
  - 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
- 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
- getHostEntries :: Bool -> IO [HostEntry]
- setHostEntry :: Bool -> IO ()
- getHostEntry :: IO HostEntry
- endHostEntry :: IO ()
- data ServiceEntry = ServiceEntry {
  - serviceName :: ServiceName
  - serviceAliases :: [ServiceName]
  - servicePort :: PortNumber
  - serviceProtocol :: ProtocolName
  }
- type ServiceName = String
- data PortNumber
- getServiceByName :: ServiceName -> ProtocolName -> IO ServiceEntry
- getServiceByPort :: PortNumber -> ProtocolName -> IO ServiceEntry
- getServicePortNumber :: ServiceName -> IO PortNumber
- getServiceEntries :: Bool -> IO [ServiceEntry]
- getServiceEntry :: IO ServiceEntry
- setServiceEntry :: Bool -> IO ()
- endServiceEntry :: IO ()
- 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
- getProtocolEntries :: Bool -> IO [ProtocolEntry]
- setProtocolEntry :: Bool -> IO ()
- getProtocolEntry :: IO ProtocolEntry
- endProtocolEntry :: IO ()
- 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
- getNetworkEntries :: Bool -> IO [NetworkEntry]
- setNetworkEntry :: Bool -> IO ()
- getNetworkEntry :: IO NetworkEntry
- endNetworkEntry :: IO ()
- ifNameToIndex :: String -> IO (Maybe Int)

# Host names and network addresses

type HostName = String Source #

Either a host name e.g., `"haskell.org"` or a numeric host address string consisting of a dotted decimal IPv4 address or an IPv6 address e.g., `"192.168.0.1"`.

type HostAddress = Word32 Source #

The raw network byte order number is read using host byte order. Therefore on little-endian architectures the byte order is swapped. For example `127.0.0.1` is represented as `0x0100007f` on little-endian hosts and as `0x7f000001` on big-endian hosts.

For direct manipulation prefer `hostAddressToTuple` and `tupleToHostAddress`.

data Family where Source #

Address families. The `AF_xxxxx` constants are widely used as synonyms for the corresponding `PF_xxxxx` protocol family values, to which they are numerically equal in mainstream socket API implementations.

Strictly correct usage would be to pass the `PF_xxxxx` constants as the first argument when creating a `Socket`, while the `AF_xxxxx` constants should be used as `addrFamily` values with `getAddrInfo`. For now only the `AF_xxxxx` constants are provided.

Some of the defined patterns may be unsupported on some systems: see `isSupportedFamily`.

Bundled Patterns

pattern AF_UNSPEC :: Family | unspecified
pattern AF_UNIX :: Family | UNIX-domain
pattern AF_INET :: Family | Internet Protocol version 4
pattern AF_INET6 :: Family | Internet Protocol version 6
pattern AF_IMPLINK :: Family | Arpanet imp addresses
pattern AF_PUP :: Family | pup protocols: e.g. BSP
pattern AF_CHAOS :: Family | mit CHAOS protocols
pattern AF_NS :: Family | XEROX NS protocols
pattern AF_NBS :: Family | nbs protocols
pattern AF_ECMA :: Family | european computer manufacturers
pattern AF_DATAKIT :: Family | datakit protocols
pattern AF_CCITT :: Family | CCITT protocols, X.25 etc
pattern AF_SNA :: Family | IBM SNA
pattern AF_DECnet :: Family | DECnet
pattern AF_DLI :: Family | Direct data link interface
pattern AF_LAT :: Family | LAT
pattern AF_HYLINK :: Family | NSC Hyperchannel
pattern AF_APPLETALK :: Family | Apple Talk
pattern AF_ROUTE :: Family | Internal Routing Protocol (aka AF_NETLINK)
pattern AF_NETBIOS :: Family | NetBios-style addresses
pattern AF_NIT :: Family | Network Interface Tap
pattern AF_802 :: Family | IEEE 802.2, also ISO 8802
pattern AF_ISO :: Family | ISO protocols
pattern AF_OSI :: Family | umbrella of all families used by OSI
pattern AF_NETMAN :: Family | DNA Network Management
pattern AF_X25 :: Family | CCITT X.25
pattern AF_AX25 :: Family | AX25
pattern AF_OSINET :: Family | AFI
pattern AF_GOSSIP :: Family | US Government OSI
pattern AF_IPX :: Family | Novell Internet Protocol
pattern Pseudo_AF_XTP :: Family | eXpress Transfer Protocol (no AF)
pattern AF_CTF :: Family | Common Trace Facility
pattern AF_WAN :: Family | Wide Area Network protocols
pattern AF_SDL :: Family | SGI Data Link for DLPI
pattern AF_NETWARE :: Family | Netware
pattern AF_NDD :: Family | NDD
pattern AF_INTF :: Family | Debugging use only
pattern AF_COIP :: Family | connection-oriented IP, aka ST II
pattern AF_CNT :: Family | Computer Network Technology
pattern Pseudo_AF_RTIP :: Family | Help Identify RTIP packets
pattern Pseudo_AF_PIP :: Family | Help Identify PIP packets
pattern AF_SIP :: Family | Simple Internet Protocol
pattern AF_ISDN :: Family | Integrated Services Digital Network
pattern Pseudo_AF_KEY :: Family | Internal key-management function
pattern AF_NATM :: Family | native ATM access
pattern AF_ARP :: Family | ARP (RFC 826)
pattern Pseudo_AF_HDRCMPLT :: Family | Used by BPF to not rewrite hdrs in iface output
pattern AF_ENCAP :: Family | ENCAP
pattern AF_LINK :: Family | Link layer interface
pattern AF_RAW :: Family | Link layer interface
pattern AF_RIF :: Family | raw interface
pattern AF_NETROM :: Family | Amateur radio NetROM
pattern AF_BRIDGE :: Family | multiprotocol bridge
pattern AF_ATMPVC :: Family | ATM PVCs
pattern AF_ROSE :: Family | Amateur Radio X.25 PLP
pattern AF_NETBEUI :: Family | Netbeui 802.2LLC
pattern AF_SECURITY :: Family | Security callback pseudo AF
pattern AF_PACKET :: Family | Packet family
pattern AF_ASH :: Family | Ash
pattern AF_ECONET :: Family | Acorn Econet
pattern AF_ATMSVC :: Family | ATM SVCs
pattern AF_IRDA :: Family | IRDA sockets
pattern AF_PPPOX :: Family | PPPoX sockets
pattern AF_WANPIPE :: Family | Wanpipe API sockets
pattern AF_BLUETOOTH :: Family | bluetooth sockets
pattern AF_CAN :: Family | Controller Area Network

#### Instances

Instances details

Read Family |
Instance details Defined in Network.Socket.Types Methods readsPrec :: Int -> ReadS Family Source # readList :: ReadS [Family] Source # readPrec :: ReadPrec Family Source # readListPrec :: ReadPrec [Family] Source #
Show Family |
Instance details Defined in Network.Socket.Types Methods showsPrec :: Int -> Family -> ShowS Source # show :: Family -> String Source # showList :: [Family] -> ShowS Source #
Eq Family |
Instance details Defined in Network.Socket.Types Methods (==) :: Family -> Family -> Bool Source # (/=) :: Family -> Family -> Bool Source #
Ord Family |
Instance details Defined in Network.Socket.Types Methods compare :: Family -> Family -> Ordering Source # (<) :: Family -> Family -> Bool Source # (<=) :: Family -> Family -> Bool Source # (>) :: Family -> Family -> Bool Source # (>=) :: Family -> Family -> Bool Source # max :: Family -> Family -> Family Source # min :: Family -> Family -> Family Source #

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

- hostName :: HostName

  Official name of the host

- hostAliases :: [HostName]

  Alternative names of the host

- hostFamily :: Family

  Address type (currently `AF_INET`)

- hostAddresses :: [HostAddress]

  Set of network addresses for the host

#### Instances

Instances details

NFData HostEntry Source # | Since: 2.8.1.0
Instance details Defined in Network.BSD Methods rnf :: HostEntry -> () Source #
Storable HostEntry Source # |

Instance details

Defined in Network.BSD

Methods

sizeOf :: HostEntry -> Int Source #

alignment :: HostEntry -> Int Source #

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

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

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

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

peek :: Ptr HostEntry -> IO HostEntry Source #

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

Read HostEntry Source # |
Instance details Defined in Network.BSD Methods readsPrec :: Int -> ReadS HostEntry Source # readList :: ReadS [HostEntry] Source # readPrec :: ReadPrec HostEntry Source # readListPrec :: ReadPrec [HostEntry] Source #
Show HostEntry Source # |
Instance details Defined in Network.BSD Methods showsPrec :: Int -> HostEntry -> ShowS Source # show :: HostEntry -> String Source # showList :: [HostEntry] -> ShowS Source #

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

- serviceName :: ServiceName

  Official service name

- serviceAliases :: [ServiceName]

  aliases

- servicePort :: PortNumber

  Port Number

- serviceProtocol :: ProtocolName

  Protocol to use

#### Instances

Instances details

NFData ServiceEntry Source # | Since: 2.8.1.0
Instance details Defined in Network.BSD Methods rnf :: ServiceEntry -> () Source #
Storable ServiceEntry Source # |

Instance details

Defined in Network.BSD

Methods

sizeOf :: ServiceEntry -> Int Source #

alignment :: ServiceEntry -> Int Source #

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

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

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

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

peek :: Ptr ServiceEntry -> IO ServiceEntry Source #

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

Show ServiceEntry Source # |
Instance details Defined in Network.BSD Methods showsPrec :: Int -> ServiceEntry -> ShowS Source # show :: ServiceEntry -> String Source # showList :: [ServiceEntry] -> ShowS Source #

type ServiceName = String Source #

Either a service name e.g., `"http"` or a numeric port number.

data PortNumber Source #

Port number. Use the `Num` instance (i.e. use a literal) to create a `PortNumber` value.

    >>> 1 :: PortNumber
    1
    >>> read "1" :: PortNumber
    1
    >>> show (12345 :: PortNumber)
    "12345"
    >>> 50000 < (51000 :: PortNumber)
    True
    >>> 50000 < (52000 :: PortNumber)
    True
    >>> 50000 + (10000 :: PortNumber)
    60000

#### Instances

Instances details

Bounded PortNumber |
Instance details Defined in Network.Socket.Types Methods minBound :: PortNumber Source # maxBound :: PortNumber Source #
Enum PortNumber |

Instance details

Defined in Network.Socket.Types

Methods

succ :: PortNumber -> PortNumber Source #

pred :: PortNumber -> PortNumber Source #

toEnum :: Int -> PortNumber Source #

fromEnum :: PortNumber -> Int Source #

enumFrom :: PortNumber -> [PortNumber] Source #

enumFromThen :: PortNumber -> PortNumber -> [PortNumber] Source #

enumFromTo :: PortNumber -> PortNumber -> [PortNumber] Source #

enumFromThenTo :: PortNumber -> PortNumber -> PortNumber -> [PortNumber] Source #

Storable PortNumber |

Instance details

Defined in Network.Socket.Types

Methods

sizeOf :: PortNumber -> Int Source #

alignment :: PortNumber -> Int Source #

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

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

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

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

peek :: Ptr PortNumber -> IO PortNumber Source #

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

Num PortNumber |
Instance details Defined in Network.Socket.Types Methods (+) :: PortNumber -> PortNumber -> PortNumber Source # (-) :: PortNumber -> PortNumber -> PortNumber Source # (*) :: PortNumber -> PortNumber -> PortNumber Source # negate :: PortNumber -> PortNumber Source # abs :: PortNumber -> PortNumber Source # signum :: PortNumber -> PortNumber Source # fromInteger :: Integer -> PortNumber Source #
Read PortNumber |
Instance details Defined in Network.Socket.Types Methods readsPrec :: Int -> ReadS PortNumber Source # readList :: ReadS [PortNumber] Source # readPrec :: ReadPrec PortNumber Source # readListPrec :: ReadPrec [PortNumber] Source #
Integral PortNumber |

Instance details

Defined in Network.Socket.Types

Methods

quot :: PortNumber -> PortNumber -> PortNumber Source #

rem :: PortNumber -> PortNumber -> PortNumber Source #

div :: PortNumber -> PortNumber -> PortNumber Source #

mod :: PortNumber -> PortNumber -> PortNumber Source #

quotRem :: PortNumber -> PortNumber -> (PortNumber, PortNumber) Source #

divMod :: PortNumber -> PortNumber -> (PortNumber, PortNumber) Source #

toInteger :: PortNumber -> Integer Source #

Real PortNumber |
Instance details Defined in Network.Socket.Types Methods toRational :: PortNumber -> Rational Source #
Show PortNumber |
Instance details Defined in Network.Socket.Types Methods showsPrec :: Int -> PortNumber -> ShowS Source # show :: PortNumber -> String Source # showList :: [PortNumber] -> ShowS Source #
Eq PortNumber |
Instance details Defined in Network.Socket.Types Methods (==) :: PortNumber -> PortNumber -> Bool Source # (/=) :: PortNumber -> PortNumber -> Bool Source #
Ord PortNumber |

Instance details

Defined in Network.Socket.Types

Methods

compare :: PortNumber -> PortNumber -> Ordering Source #

(<) :: PortNumber -> PortNumber -> Bool Source #

(<=) :: PortNumber -> PortNumber -> Bool Source #

(>) :: PortNumber -> PortNumber -> Bool Source #

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

max :: PortNumber -> PortNumber -> PortNumber Source #

min :: PortNumber -> PortNumber -> PortNumber 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`.

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 Source #

Protocol number.

data ProtocolEntry Source #

Representation of the POSIX `protoent` structure defined in netdb.h.

Constructors

ProtocolEntry |

Fields

- protoName :: ProtocolName

  Official name

- protoAliases :: [ProtocolName]

  aliases

- protoNumber :: ProtocolNumber

  Protocol number

#### Instances

Instances details

NFData ProtocolEntry Source # | Since: 2.8.1.0
Instance details Defined in Network.BSD Methods rnf :: ProtocolEntry -> () Source #
Storable ProtocolEntry Source # |

Instance details

Defined in Network.BSD

Methods

sizeOf :: ProtocolEntry -> Int Source #

alignment :: ProtocolEntry -> Int Source #

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

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

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

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

peek :: Ptr ProtocolEntry -> IO ProtocolEntry Source #

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

Read ProtocolEntry Source # |
Instance details Defined in Network.BSD Methods readsPrec :: Int -> ReadS ProtocolEntry Source # readList :: ReadS [ProtocolEntry] Source # readPrec :: ReadPrec ProtocolEntry Source # readListPrec :: ReadPrec [ProtocolEntry] Source #
Show ProtocolEntry Source # |
Instance details Defined in Network.BSD Methods showsPrec :: Int -> ProtocolEntry -> ShowS Source # show :: ProtocolEntry -> String Source # showList :: [ProtocolEntry] -> ShowS Source #

getProtocolByName :: ProtocolName -> IO ProtocolEntry Source #

`getprotobyname(3)`.

getProtocolByNumber :: ProtocolNumber -> IO ProtocolEntry Source #

`getprotobynumber(3)`.

getProtocolNumber :: ProtocolName -> IO ProtocolNumber Source #

`getprotobyname(3)`.

defaultProtocol :: ProtocolNumber Source #

This is the default protocol for a given service.

    >>> defaultProtocol
    0

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

- networkName :: NetworkName

  Official network name

- networkAliases :: [NetworkName]

  aliases

- networkFamily :: Family

  Network address type

- networkAddress :: NetworkAddr

  Network number

#### Instances

Instances details

NFData NetworkEntry Source # | Since: 2.8.1.0
Instance details Defined in Network.BSD Methods rnf :: NetworkEntry -> () Source #
Storable NetworkEntry Source # |

Instance details

Defined in Network.BSD

Methods

sizeOf :: NetworkEntry -> Int Source #

alignment :: NetworkEntry -> Int Source #

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

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

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

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

peek :: Ptr NetworkEntry -> IO NetworkEntry Source #

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

Read NetworkEntry Source # |
Instance details Defined in Network.BSD Methods readsPrec :: Int -> ReadS NetworkEntry Source # readList :: ReadS [NetworkEntry] Source # readPrec :: ReadPrec NetworkEntry Source # readListPrec :: ReadPrec [NetworkEntry] Source #
Show NetworkEntry Source # |
Instance details Defined in Network.BSD Methods showsPrec :: Int -> NetworkEntry -> ShowS Source # show :: NetworkEntry -> String Source # showList :: [NetworkEntry] -> ShowS Source #

getNetworkByName :: NetworkName -> IO NetworkEntry Source #

`getnetbyname(3)`.

getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry Source #

`getnetbyaddr(3)`.

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)`.

getNetworkEntry :: IO NetworkEntry Source #

`getnetent(3)`.

endNetworkEntry :: IO () Source #

Close the connection to the network name database.

`endnetent(3)`.

# Interface names

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

Returns the index corresponding to the interface name.

Since 2.7.0.0.