Network.Info

network-info-0.2.1: Access the local computer's basic network configuration

Safe Haskell | Safe-Inferred
Language | Haskell2010

Network.Info

Synopsis

- getNetworkInterfaces :: IO [NetworkInterface]
- data NetworkInterface = NetworkInterface {
  - name :: String
  - ipv4 :: IPv4
  - ipv6 :: IPv6
  - mac :: MAC
  }
- data IPv4 = IPv4 !Word32
- data IPv6 = IPv6 !Word32 !Word32 !Word32 !Word32
- data MAC = MAC !Word8 !Word8 !Word8 !Word8 !Word8 !Word8

# Documentation

getNetworkInterfaces :: IO [NetworkInterface] #

Gets the address information for each of the network interfaces on the local computer.

data NetworkInterface #

Describes the basic configuration of a network interface. This definition is currently limited to just one address per family.

Constructors

NetworkInterface |
Fields name :: String Interface name (e.g. "eth0", "lo", "Local Area Connection") ipv4 :: IPv4 IPv4 address ipv6 :: IPv6 IPv6 address mac :: MAC MAC address

#### Instances

Instances details

Storable NetworkInterface # |
Instance details Defined in Network.Info Methods sizeOf :: NetworkInterface -> Int # alignment :: NetworkInterface -> Int # peekElemOff :: Ptr NetworkInterface -> Int -> IO NetworkInterface # pokeElemOff :: Ptr NetworkInterface -> Int -> NetworkInterface -> IO () # peekByteOff :: Ptr b -> Int -> IO NetworkInterface # pokeByteOff :: Ptr b -> Int -> NetworkInterface -> IO () # peek :: Ptr NetworkInterface -> IO NetworkInterface # poke :: Ptr NetworkInterface -> NetworkInterface -> IO () #
Show NetworkInterface # |
Instance details Defined in Network.Info Methods showsPrec :: Int -> NetworkInterface -> ShowS # show :: NetworkInterface -> String # showList :: [NetworkInterface] -> ShowS #

data IPv4 #

Represents an IPv4 address (e.g. `172.23.21.1`, `127.0.0.1`)

Constructors

IPv4 !Word32 |

#### Instances

Instances details

Bounded IPv4 # |
Instance details Defined in Network.Info Methods minBound :: IPv4 # maxBound :: IPv4 #
Storable IPv4 # |
Instance details Defined in Network.Info Methods sizeOf :: IPv4 -> Int # alignment :: IPv4 -> Int # peekElemOff :: Ptr IPv4 -> Int -> IO IPv4 # pokeElemOff :: Ptr IPv4 -> Int -> IPv4 -> IO () # peekByteOff :: Ptr b -> Int -> IO IPv4 # pokeByteOff :: Ptr b -> Int -> IPv4 -> IO () # peek :: Ptr IPv4 -> IO IPv4 # poke :: Ptr IPv4 -> IPv4 -> IO () #
Show IPv4 # |
Instance details Defined in Network.Info Methods showsPrec :: Int -> IPv4 -> ShowS # show :: IPv4 -> String # showList :: [IPv4] -> ShowS #
Eq IPv4 # |
Instance details Defined in Network.Info Methods (==) :: IPv4 -> IPv4 -> Bool # (/=) :: IPv4 -> IPv4 -> Bool #
Ord IPv4 # |
Instance details Defined in Network.Info Methods compare :: IPv4 -> IPv4 -> Ordering # (<) :: IPv4 -> IPv4 -> Bool # (<=) :: IPv4 -> IPv4 -> Bool # (>) :: IPv4 -> IPv4 -> Bool # (>=) :: IPv4 -> IPv4 -> Bool # max :: IPv4 -> IPv4 -> IPv4 # min :: IPv4 -> IPv4 -> IPv4 #

data IPv6 #

Represents an IPv6 address (e.g. `2001:db8:85a3::8a2e:370:7334`, `::1`)

Constructors

IPv6 !Word32 !Word32 !Word32 !Word32 |

#### Instances

Instances details

Bounded IPv6 # |
Instance details Defined in Network.Info Methods minBound :: IPv6 # maxBound :: IPv6 #
Storable IPv6 # |
Instance details Defined in Network.Info Methods sizeOf :: IPv6 -> Int # alignment :: IPv6 -> Int # peekElemOff :: Ptr IPv6 -> Int -> IO IPv6 # pokeElemOff :: Ptr IPv6 -> Int -> IPv6 -> IO () # peekByteOff :: Ptr b -> Int -> IO IPv6 # pokeByteOff :: Ptr b -> Int -> IPv6 -> IO () # peek :: Ptr IPv6 -> IO IPv6 # poke :: Ptr IPv6 -> IPv6 -> IO () #
Show IPv6 # | Not yet capable of collapsing groups of zeros, will still generate valid addresses however.
Instance details Defined in Network.Info Methods showsPrec :: Int -> IPv6 -> ShowS # show :: IPv6 -> String # showList :: [IPv6] -> ShowS #
Eq IPv6 # |
Instance details Defined in Network.Info Methods (==) :: IPv6 -> IPv6 -> Bool # (/=) :: IPv6 -> IPv6 -> Bool #
Ord IPv6 # |
Instance details Defined in Network.Info Methods compare :: IPv6 -> IPv6 -> Ordering # (<) :: IPv6 -> IPv6 -> Bool # (<=) :: IPv6 -> IPv6 -> Bool # (>) :: IPv6 -> IPv6 -> Bool # (>=) :: IPv6 -> IPv6 -> Bool # max :: IPv6 -> IPv6 -> IPv6 # min :: IPv6 -> IPv6 -> IPv6 #

data MAC #

Represents a MAC address (e.g. `01:23:45:67:89:ab`)

Constructors

MAC !Word8 !Word8 !Word8 !Word8 !Word8 !Word8 |

#### Instances

Instances details

Bounded MAC # |
Instance details Defined in Network.Info Methods minBound :: MAC # maxBound :: MAC #
Storable MAC # |
Instance details Defined in Network.Info Methods sizeOf :: MAC -> Int # alignment :: MAC -> Int # peekElemOff :: Ptr MAC -> Int -> IO MAC # pokeElemOff :: Ptr MAC -> Int -> MAC -> IO () # peekByteOff :: Ptr b -> Int -> IO MAC # pokeByteOff :: Ptr b -> Int -> MAC -> IO () # peek :: Ptr MAC -> IO MAC # poke :: Ptr MAC -> MAC -> IO () #
Show MAC # |
Instance details Defined in Network.Info Methods showsPrec :: Int -> MAC -> ShowS # show :: MAC -> String # showList :: [MAC] -> ShowS #
Eq MAC # |
Instance details Defined in Network.Info Methods (==) :: MAC -> MAC -> Bool # (/=) :: MAC -> MAC -> Bool #
Ord MAC # |
Instance details Defined in Network.Info Methods compare :: MAC -> MAC -> Ordering # (<) :: MAC -> MAC -> Bool # (<=) :: MAC -> MAC -> Bool # (>) :: MAC -> MAC -> Bool # (>=) :: MAC -> MAC -> Bool # max :: MAC -> MAC -> MAC # min :: MAC -> MAC -> MAC #