-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Library to deal with IPv6 address text representations.
--   
--   Library to deal with IPv6 address text representations, canonization
--   and manipulations.
@package IPv6Addr
@version 1.0.4

module Text.IPv6Addr
data IPv6Addr
IPv6Addr :: !Text -> IPv6Addr

-- | Returns <a>Just</a> the text representation of a canonized
--   <a>IPv6Addr</a> in conformation with RFC 5952, or <a>Nothing</a>.
--   
--   <pre>
--   maybeIPv6Addr "0:0::FFFF:192.0.2.128" == Just (IPv6Addr "::ffff:192.0.2.128")
--   </pre>
maybeIPv6Addr :: Text -> Maybe IPv6Addr

-- | Returns <a>Just</a> a pure <a>IPv6Addr</a>, or <a>Nothing</a>.
--   
--   <pre>
--   maybePureIPv6Addr "::ffff:192.0.2.128" == Just (IPv6Addr "::ffff:c000:280")
--   </pre>
maybePureIPv6Addr :: Text -> Maybe IPv6Addr

-- | Returns <a>Just</a> a pure and fully expanded <a>IPv6Addr</a>, or
--   <a>Nothing</a>.
--   
--   <pre>
--   maybeFullIPv6Addr "::ffff:192.0.2.128" == Just (IPv6Addr "0000:0000:0000:0000:0000:ffff:c000:0280")
--   </pre>
maybeFullIPv6Addr :: Text -> Maybe IPv6Addr

-- | Returns <a>True</a> if arguments are two textual representations of a
--   same IPv6 address.
sameIPv6Addr :: Text -> Text -> Bool

-- | Returns the <a>Text</a> of an IPv6 address.
fromIPv6Addr :: IPv6Addr -> Text

-- | Given an <tt>IPv6addr</tt>, returns the corresponding <a>IPv6</a>
--   address.
toIPv6 :: IPv6Addr -> IPv6

-- | Given an <a>IPv6Addr</a>, returns the corresponding <a>HostName</a>.
toHostName :: IPv6Addr -> HostName

-- | Returns the reverse lookup domain name corresponding of the given IPv6
--   address (RFC 3596 Section 2.5).
--   
--   <pre>
--   toIP6ARPA (IPv6Addr "4321:0:1:2:3:4:567:89ab") == "b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.2.3.4.IP6.ARPA."
--   </pre>
toIP6ARPA :: IPv6Addr -> Text

-- | Returns the Windows UNC path name of the given IPv6 Address.
--   
--   <pre>
--   toUNC (IPv6Addr "2001:0DB8:002a:1005:230:48ff:fe73:989d") == "2001-db8-2a-1005-230-48ff-fe73-989d.ipv6-literal.net"
--   </pre>
toUNC :: IPv6Addr -> Text

-- | Returns <a>Just</a> the canonized <a>IPv6Addr</a> of the given local
--   network interface, or <a>Nothing</a>.
--   
--   <pre>
--   getIPv6AddrOf "eth0"
--   </pre>
getIPv6AddrOf :: String -> IO (Maybe IPv6Addr)

-- | Returns a random <a>IPv6Addr</a>.
randIPv6Addr :: IO IPv6Addr

-- | Returns a random <a>IPv6Addr</a>, optionally with the given prefix.
--   
--   <pre>
--   randIPv6AddrWithPrefix (Just "4321:0:1:2:3:4")
--   </pre>
randIPv6AddrWithPrefix :: Maybe Text -> IO (Maybe IPv6Addr)
data IPv6AddrToken

-- | A four hexadecimal digits group representing a 16-Bit chunk
SixteenBit :: !Text -> IPv6AddrToken

-- | An all zeros 16-Bit chunk
AllZeros :: IPv6AddrToken

-- | A separator between 16-Bit chunks
Colon :: IPv6AddrToken

-- | A double-colon stands for a unique compression of many consecutive
--   16-Bit chunks
DoubleColon :: IPv6AddrToken

-- | An embedded IPv4 address as representation of the last 32-Bit
IPv4Addr :: !Text -> IPv6AddrToken

-- | Returns <a>Just</a> a random <a>SixteenBit</a> token based on a mask
--   "____", each underscore being replaced by a random hexadecimal digit.
--   
--   <pre>
--   randIPv6AddrChunk "_f__" == Just (SixteenBit "bfd4")
--   </pre>
randIPv6AddrChunk :: String -> IO IPv6AddrToken

-- | Generates a random partial <a>IPv6Addr</a> with n <a>SixteenBit</a>.
randPartialIPv6Addr :: Int -> IO [IPv6AddrToken]

-- | Given a MAC address, returns <a>Just</a> the corresponding
--   <a>IPv6AddrToken</a> list, or <a>Nothing</a>.
--   
--   <pre>
--   macAddrToIPv6AddrTokens "fa:1d:58:cc:95:16" == Just [SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"]
--   </pre>
macAddrToIPv6AddrTokens :: Text -> Maybe [IPv6AddrToken]

-- | Given a valid name of a local network interface, returns <a>Just</a>
--   the list of tokens of the interface's IPv6 address, or <a>Nothing</a>.
--   
--   <pre>
--   getTokIPv6AddrOf "eth0" == Just [SixteenBit "fe80",DoubleColon,SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"]
--   </pre>
getTokIPv6AddrOf :: String -> IO (Maybe [IPv6AddrToken])

-- | Given a valid name of a local network interface, returns <a>Just</a>
--   the corresponding list of <a>IPv6AddrToken</a> of the interface's MAC
--   Address, or <a>Nothing</a>.
--   
--   <pre>
--   getTokMacAddrOf "eth0" == Just [SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"]
--   </pre>
getTokMacAddrOf :: String -> IO (Maybe [IPv6AddrToken])
instance GHC.Show.Show Text.IPv6Addr.IPv6AddrToken
instance GHC.Classes.Eq Text.IPv6Addr.IPv6AddrToken
instance GHC.Show.Show Text.IPv6Addr.IPv6Addr
instance GHC.Classes.Eq Text.IPv6Addr.IPv6Addr
instance Data.Aeson.Types.ToJSON.ToJSON Text.IPv6Addr.IPv6Addr
instance Data.Aeson.Types.FromJSON.FromJSON Text.IPv6Addr.IPv6Addr
