-- 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 0.5 -- | Dealing with IPv6 address text representations, canonization and -- manipulations. module Text.IPv6Addr.Types data IPv6Addr IPv6Addr :: Text -> 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 instance Eq IPv6AddrToken instance Show IPv6AddrToken instance Show IPv6Addr -- | Dealing with IPv6 address text representations, canonization and -- manipulations. module Text.IPv6Addr.Internal expandTokens :: [IPv6AddrToken] -> [IPv6AddrToken] macAddr :: Parser (Maybe [IPv6AddrToken]) -- | Tokenize a Text into Just a list of -- IPv6AddrToken, or Nothing. maybeIPv6AddrTokens :: Text -> Maybe [IPv6AddrToken] -- | Rewrites Just an embedded IPv4Addr into the -- corresponding list of pure IPv6Addr tokens. -- --
-- ipv4AddrToIPv6AddrTokens (IPv4Addr "127.0.0.1") == [SixteenBits "7f0",Colon,SixteenBits "1"] --ipv4AddrToIPv6AddrTokens :: IPv6AddrToken -> [IPv6AddrToken] -- | Given an arbitrary list of IPv6AddrToken, returns the -- corresponding Text. ipv6TokensToText :: [IPv6AddrToken] -> Text ipv6TokensToIPv6Addr :: [IPv6AddrToken] -> Maybe IPv6Addr -- | Returns True if a list of IPv6AddrToken constitutes a -- valid IPv6 Address. isIPv6Addr :: [IPv6AddrToken] -> Bool -- | This is the main function which returns Just the list of a -- tokenized IPv6 address text representation validated against RFC 4291 -- and canonized in conformation with RFC 5952, or Nothing. maybeTokIPv6Addr :: Text -> Maybe [IPv6AddrToken] -- | Returns Just the list of tokenized pure IPv6 address, always -- rewriting an embedded IPv4 address if present. maybeTokPureIPv6Addr :: Text -> Maybe [IPv6AddrToken] fromDoubleColon :: [IPv6AddrToken] -> [IPv6AddrToken] -- | Returns the Text of an IPv6 address. fromIPv6Addr :: IPv6Addr -> Text toDoubleColon :: [IPv6AddrToken] -> [IPv6AddrToken] networkInterfacesIPv6AddrList :: IO [(String, IPv6)] -- | Dealing with IPv6 address text representations, canonization and -- manipulations. module Text.IPv6Addr.Manip -- | Returns Just a random SixteenBit token based on a mask -- "____", each underscore being replaced by a random hexadecimal digit. -- --
-- randIPv6AddrChunk "_f__" == Just (SixteenBit "bfd4") --randIPv6AddrChunk :: String -> IO IPv6AddrToken -- | Generates a random partial IPv6Addr with n SixteenBit randPartialIPv6Addr :: Int -> IO [IPv6AddrToken] -- | Given a MAC address, returns the corresponding IPv6AddrToken -- list, or an empty list. -- --
-- macAddrToIPv6AddrTokens "fa:1d:58:cc:95:16" == [SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"] --macAddrToIPv6AddrTokens :: Text -> Maybe [IPv6AddrToken] -- | Given a valid name of a local network interface, returns Just -- the list of tokens of the interface's IPv6 address, or Nothing. -- --
-- getTokIPv6AddrOf "eth0" == Just [SixteenBit "fe80",DoubleColon,SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"] --getTokIPv6AddrOf :: String -> IO (Maybe [IPv6AddrToken]) -- | Given a valid name of a local network interface, returns Just -- the corresponding list of IPv6AddrToken of the interface's MAC -- Address, or Nothing. -- --
-- getTokMacAddrOf "eth0" == Just [SixteenBit "fa1d",Colon,SixteenBit "58cc",Colon,SixteenBit "9516"] --getTokMacAddrOf :: String -> IO (Maybe [IPv6AddrToken]) module Text.IPv6Addr data IPv6Addr IPv6Addr :: Text -> IPv6Addr -- | Returns Just the text representation of a canonized -- IPv6Addr in conformation with RFC 5952, or Nothing. -- --
-- maybeIPv6Addr "0:0::FFFF:192.0.2.128" == Just (IPv6Addr "::ffff:192.0.2.128") --maybeIPv6Addr :: Text -> Maybe IPv6Addr -- | Returns Just a pure IPv6Addr, or Nothing. -- --
-- mabePureIPv6Addr "::ffff:192.0.2.128" == Just (IPv6Addr "::ffff:c000:280") --maybePureIPv6Addr :: Text -> Maybe IPv6Addr -- | Returns Just a pure and fully expanded IPv6Addr, or -- Nothing. -- --
-- mayebFullIPv6Addr "::ffff:192.0.2.128" == Just (IPv6Addr "0000:0000:0000:0000:0000:ffff:c000:0280") --maybeFullIPv6Addr :: Text -> Maybe IPv6Addr -- | Returns True if arguments are two textual representations of -- the same IPv6 address. sameIPv6Addr :: Text -> Text -> Bool -- | Returns the Text of an IPv6 address. fromIPv6Addr :: IPv6Addr -> Text -- | Given an IPv6addr, returns the corresponding IPv6 -- address. toIPv6 :: IPv6Addr -> IPv6 -- | Given an IPv6Addr, returns the corresponding HostName. toHostName :: IPv6Addr -> HostName -- | Returns the reverse lookup domain name corresponding of the given IPv6 -- address (RFC 3596 Section 2.5). -- --
-- 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." --toIP6ARPA :: IPv6Addr -> Text -- | Returns Just the canonized IPv6Addr of the given local -- network interface, or Nothing. -- --
-- getIPv6AddrOf "eth0" --getIPv6AddrOf :: String -> IO (Maybe IPv6Addr) -- | Returns a random IPv6Addr. randIPv6Addr :: IO IPv6Addr instance Eq IPv6Addr