X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FIPv4Address.hs;h=d15f88f0775eb3140e63bba29e48c0a6c4d160f1;hb=1e69264c4a60fef95d0ad013f95b082b3db106ab;hp=f52a423a8ffc39894cfbdd01175cbc21fa4a24bb;hpb=75038b45b9c379d8313511e58c3c0fe680810883;p=hath.git diff --git a/src/IPv4Address.hs b/src/IPv4Address.hs index f52a423..d15f88f 100644 --- a/src/IPv4Address.hs +++ b/src/IPv4Address.hs @@ -2,6 +2,8 @@ module IPv4Address ( ipv4address_from_octets, ipv4address_tests, IPv4Address(None), + max_address, + min_address, most_sig_bit_different, octet1, octet2, @@ -105,6 +107,16 @@ ipv4address_from_octets oct1 oct2 oct3 oct4 | otherwise = IPv4Address oct1 oct2 oct3 oct4 +-- The minimum possible IPv4 address, 0.0.0.0. +min_address :: IPv4Address +min_address = IPv4Address min_octet min_octet min_octet min_octet + + +-- The maximum possible IPv4 address, 255.255.255.255. +max_address :: IPv4Address +max_address = IPv4Address max_octet max_octet max_octet max_octet + + -- Given two addresses, find the number of the most significant bit -- where they differ. If the addresses are the same, return -- Maskbits.Zero.