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".
Modulenetwork-bsd-2.8.1.0Haskell2010
Network.BSD
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:
- 13 types
- 30 values
- Packagenetwork-bsd-2.8.1.0
- Exports109
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceBSD.hsc
Host names and network addresses
75 declarationsThe 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.
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.
unspecified
UNIX-domain
Internet Protocol version 4
Internet Protocol version 6
Arpanet imp addresses
pup protocols: e.g. BSP
mit CHAOS protocols
XEROX NS protocols
nbs protocols
european computer manufacturers
datakit protocols
CCITT protocols, X.25 etc
IBM SNA
DECnet
Direct data link interface
LAT
NSC Hyperchannel
Apple Talk
Internal Routing Protocol (aka AF_NETLINK)
NetBios-style addresses
Network Interface Tap
IEEE 802.2, also ISO 8802
ISO protocols
umbrella of all families used by OSI
DNA Network Management
CCITT X.25
AX25
AFI
US Government OSI
Novell Internet Protocol
eXpress Transfer Protocol (no AF)
Common Trace Facility
Wide Area Network protocols
SGI Data Link for DLPI
Netware
NDD
Debugging use only
connection-oriented IP, aka ST II
Computer Network Technology
Help Identify RTIP packets
Help Identify PIP packets
Simple Internet Protocol
Integrated Services Digital Network
Internal key-management function
native ATM access
ARP (RFC 826)
Used by BPF to not rewrite hdrs in iface output
ENCAP
Link layer interface
Link layer interface
raw interface
Amateur radio NetROM
multiprotocol bridge
ATM PVCs
Amateur Radio X.25 PLP
Netbeui 802.2LLC
Security callback pseudo AF
Packet family
Ash
Acorn Econet
ATM SVCs
IRDA sockets
PPPoX sockets
Wanpipe API sockets
bluetooth sockets
Controller Area Network
Calling getHostName returns the standard host name for the current processor, as set at boot time.
gethostname(2).
Representation of the POSIX hostent structure defined in netdb.h.
Constructors
HostEntryhostName :: HostNameOfficial name of the host
hostAliases :: [HostName]Alternative names of the host
hostFamily :: FamilyAddress type (currently
AF_INET)hostAddresses :: [HostAddress]Set of network addresses for the host
Resolve a HostName to IPv4 address.
Get a HostEntry corresponding to the given address and family. Note that only IPv4 is currently supported.
Retrieve list of all HostEntry via gethostent(3).
Low level functionality
sethostent(3).
gethostent(3).
endhostent(3).
Service names
7 declarationsRepresentation of the POSIX servent structure defined in netdb.h.
Constructors
ServiceEntryserviceName :: ServiceNameOfficial service name
serviceAliases :: [ServiceName]aliases
servicePort :: PortNumberPort Number
serviceProtocol :: ProtocolNameProtocol to use
Instances3Show, Storable, NFData
Show ServiceEntryDefined in network-bsd-2.8.1.0 · Network.BSDStorable ServiceEntryDefined in network-bsd-2.8.1.0 · Network.BSDNFData ServiceEntryDefined in network-bsd-2.8.1.0 · Network.BSD
Either a service name e.g., "http" or a numeric port number.
Port number.
Use the Num instance (i.e. use a literal) to create a
PortNumber value.
1 :: PortNumber1read "1" :: PortNumber1show (12345 :: PortNumber)"12345"50000 < (51000 :: PortNumber)True50000 < (52000 :: PortNumber)True50000 + (10000 :: PortNumber)60000
Instances10Bounded, Enum, Eq, Integral, Num, Ord, …
Bounded PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesEnum PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesEq PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesIntegral PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesNum PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesOrd PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesRead PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesReal PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesShow PortNumberDefined in network-3.2.8.0 · Network.Socket.TypesStorable PortNumberDefined in network-3.2.8.0 · Network.Socket.Types
Get service by name.
Get the service given a PortNumber and ProtocolName.
Get the PortNumber corresponding to the ServiceName.
Retrieve list of all ServiceEntry via getservent(3).
Low level functionality
getservent(3).
setservent(3).
endservent(3).
Protocol names
8 declarationsProtocol number.
Representation of the POSIX protoent structure defined in netdb.h.
Constructors
ProtocolEntryprotoName :: ProtocolNameOfficial name
protoAliases :: [ProtocolName]aliases
protoNumber :: ProtocolNumberProtocol number
Instances4Read, Show, Storable, NFData
Read ProtocolEntryDefined in network-bsd-2.8.1.0 · Network.BSDShow ProtocolEntryDefined in network-bsd-2.8.1.0 · Network.BSDStorable ProtocolEntryDefined in network-bsd-2.8.1.0 · Network.BSDNFData ProtocolEntryDefined in network-bsd-2.8.1.0 · Network.BSD
getprotobyname(3).
getprotobynumber(3).
getprotobyname(3).
This is the default protocol for a given service.
defaultProtocol0
Retrieve list of all ProtocolEntry via getprotoent(3).
Low level functionality
setprotoent(3).
getprotoent(3).
endprotoent(3).
Network names
6 declarationsRepresentation of the POSIX netent structure defined in netdb.h.
Constructors
NetworkEntrynetworkName :: NetworkNameOfficial network name
networkAliases :: [NetworkName]aliases
networkFamily :: FamilyNetwork address type
networkAddress :: NetworkAddrNetwork number
Instances4Read, Show, Storable, NFData
Read NetworkEntryDefined in network-bsd-2.8.1.0 · Network.BSDShow NetworkEntryDefined in network-bsd-2.8.1.0 · Network.BSDStorable NetworkEntryDefined in network-bsd-2.8.1.0 · Network.BSDNFData NetworkEntryDefined in network-bsd-2.8.1.0 · Network.BSD
getnetbyname(3).
getnetbyaddr(3).
Get the list of network entries via getnetent(3).
Low level functionality
Open the network name database. The parameter specifies whether a connection is maintained open between various networkEntry calls
setnetent(3).
getnetent(3).
Close the connection to the network name database.
endnetent(3).
Interface names
1 declarationReturns the index corresponding to the interface name.
Since 2.7.0.0.