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

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

data NetworkInterface Source #

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

Instance details

Defined in Network.Info

Methods

sizeOf :: NetworkInterface -> Int Source #

alignment :: NetworkInterface -> Int Source #

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

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

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

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

peek :: Ptr NetworkInterface -> IO NetworkInterface Source #

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

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

data IPv4 Source #

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

Constructors

IPv4 !Word32 |

#### Instances

Instances details

Storable IPv4 Source # |

Instance details

Defined in Network.Info

Methods

sizeOf :: IPv4 -> Int Source #

alignment :: IPv4 -> Int Source #

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

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

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

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

peek :: Ptr IPv4 -> IO IPv4 Source #

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

Bounded IPv4 Source # |
Instance details Defined in Network.Info Methods minBound :: IPv4 Source # maxBound :: IPv4 Source #
Show IPv4 Source # |
Instance details Defined in Network.Info Methods showsPrec :: Int -> IPv4 -> ShowS Source # show :: IPv4 -> String Source # showList :: [IPv4] -> ShowS Source #
Eq IPv4 Source # |
Instance details Defined in Network.Info Methods (==) :: IPv4 -> IPv4 -> Bool Source # (/=) :: IPv4 -> IPv4 -> Bool Source #
Ord IPv4 Source # |
Instance details Defined in Network.Info Methods compare :: IPv4 -> IPv4 -> Ordering Source # (<) :: IPv4 -> IPv4 -> Bool Source # (<=) :: IPv4 -> IPv4 -> Bool Source # (>) :: IPv4 -> IPv4 -> Bool Source # (>=) :: IPv4 -> IPv4 -> Bool Source # max :: IPv4 -> IPv4 -> IPv4 Source # min :: IPv4 -> IPv4 -> IPv4 Source #

data IPv6 Source #

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

Constructors

IPv6 !Word32 !Word32 !Word32 !Word32 |

#### Instances

Instances details

Storable IPv6 Source # |

Instance details

Defined in Network.Info

Methods

sizeOf :: IPv6 -> Int Source #

alignment :: IPv6 -> Int Source #

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

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

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

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

peek :: Ptr IPv6 -> IO IPv6 Source #

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

Bounded IPv6 Source # |
Instance details Defined in Network.Info Methods minBound :: IPv6 Source # maxBound :: IPv6 Source #
Show IPv6 Source # | 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 Source # show :: IPv6 -> String Source # showList :: [IPv6] -> ShowS Source #
Eq IPv6 Source # |
Instance details Defined in Network.Info Methods (==) :: IPv6 -> IPv6 -> Bool Source # (/=) :: IPv6 -> IPv6 -> Bool Source #
Ord IPv6 Source # |
Instance details Defined in Network.Info Methods compare :: IPv6 -> IPv6 -> Ordering Source # (<) :: IPv6 -> IPv6 -> Bool Source # (<=) :: IPv6 -> IPv6 -> Bool Source # (>) :: IPv6 -> IPv6 -> Bool Source # (>=) :: IPv6 -> IPv6 -> Bool Source # max :: IPv6 -> IPv6 -> IPv6 Source # min :: IPv6 -> IPv6 -> IPv6 Source #

data MAC Source #

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

Constructors

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

#### Instances

Instances details

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