From: Michael Orlitzky Date: Thu, 20 May 2010 21:21:17 +0000 (-0400) Subject: Started updating the max_host function to use record syntax. X-Git-Tag: 0.0.1~32 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=1599e475dc2e0c9926843c356d5ef49680ed10fd;p=hath.git Started updating the max_host function to use record syntax. --- diff --git a/src/Cidr.hs b/src/Cidr.hs index 0ea2ba2..14cefff 100644 --- a/src/Cidr.hs +++ b/src/Cidr.hs @@ -187,15 +187,35 @@ max_host Cidr.None = IPv4Address.None max_host (Cidr IPv4Address.None _) = IPv4Address.None max_host (Cidr _ Maskbits.None) = IPv4Address.None max_host (Cidr addr mask) - | mask == ThirtyTwo = ipv4address_from_octets oct1 oct2 oct3 oct4 - | mask == ThirtyOne = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 a27 a28 a29 a30 a31 B.One) - | mask == Thirty = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 a27 a28 a29 a30 B.One B.One) - | mask == TwentyNine = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 a27 a28 a29 B.One B.One B.One) - | mask == TwentyEight = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 a27 a28 B.One B.One B.One B.One) - | mask == TwentySeven = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 a27 B.One B.One B.One B.One B.One) - | mask == TwentySix = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 a26 B.One B.One B.One B.One B.One B.One) - | mask == TwentyFive = ipv4address_from_octets oct1 oct2 oct3 (Octet a25 B.One B.One B.One B.One B.One B.One B.One) - | mask == TwentyFour = ipv4address_from_octets oct1 oct2 oct3 (max_octet) + | mask == ThirtyTwo = addr + | mask == ThirtyOne = addr { octet4 = oct4 { b8 = B.One } } + | mask == Thirty = addr { octet4 = oct4 { b7 = B.One, b8 = B.One } } + | mask == TwentyNine = addr { octet4 = oct4 { b6 = B.One, + b7 = B.One, + b8 = B.One } } + | mask == TwentyEight = addr { octet4 = oct4 { b5 = B.One, + b6 = B.One, + b7 = B.One, + b8 = B.One } } + | mask == TwentySeven = addr { octet4 = oct4 { b4 = B.One, + b5 = B.One, + b6 = B.One, + b7 = B.One, + b8 = B.One } } + | mask == TwentySix = addr { octet4 = oct4 { b3 = B.One, + b4 = B.One, + b5 = B.One, + b6 = B.One, + b7 = B.One, + b8 = B.One } } + | mask == TwentyFive = addr { octet4 = oct4 { b2 = B.One, + b3 = B.One, + b4 = B.One, + b5 = B.One, + b6 = B.One, + b7 = B.One, + b8 = B.One } } + | mask == TwentyFour = addr { octet4 = max_octet } | mask == TwentyThree = ipv4address_from_octets oct1 oct2 (Octet a17 a18 a19 a20 a21 a22 a23 B.One) (max_octet) | mask == TwentyTwo = ipv4address_from_octets oct1 oct2 (Octet a17 a18 a19 a20 a21 a22 B.One B.One) (max_octet) | mask == TwentyOne = ipv4address_from_octets oct1 oct2 (Octet a17 a18 a19 a20 a21 B.One B.One B.One) (max_octet) @@ -243,13 +263,6 @@ max_host (Cidr addr mask) a21 = (b5 oct3) a22 = (b6 oct3) a23 = (b7 oct3) - a25 = (b1 oct4) - a26 = (b2 oct4) - a27 = (b3 oct4) - a28 = (b4 oct4) - a29 = (b5 oct4) - a30 = (b6 oct4) - a31 = (b7 oct4) oct1 = (octet1 addr) oct2 = (octet2 addr) oct3 = (octet3 addr)