From: Michael Orlitzky Date: Thu, 20 May 2010 21:13:43 +0000 (-0400) Subject: Renamed the min/max_address functions to min/max_host respectively. X-Git-Tag: 0.0.1~33 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=dbaab71d14e62e2a4ef15ecaddfcf0af495f2bc8;p=hath.git Renamed the min/max_address functions to min/max_host respectively. --- diff --git a/src/Cidr.hs b/src/Cidr.hs index 06704fb..0ea2ba2 100644 --- a/src/Cidr.hs +++ b/src/Cidr.hs @@ -87,10 +87,11 @@ cidr_from_string s -min_address :: Cidr -> IPv4Address -min_address (Cidr IPv4Address.None _) = IPv4Address.None -min_address (Cidr _ Maskbits.None) = IPv4Address.None -min_address (Cidr addr mask) +min_host :: Cidr -> IPv4Address +min_host Cidr.None = IPv4Address.None +min_host (Cidr IPv4Address.None _) = IPv4Address.None +min_host (Cidr _ Maskbits.None) = IPv4Address.None +min_host (Cidr addr mask) | mask == ThirtyTwo = addr | mask == ThirtyOne = addr { octet4 = apply_mask oct4 Seven } | mask == Thirty = addr { octet4 = apply_mask oct4 Six } @@ -181,10 +182,11 @@ min_address (Cidr addr mask) -max_address :: Cidr -> IPv4Address -max_address (Cidr IPv4Address.None _) = IPv4Address.None -max_address (Cidr _ Maskbits.None) = IPv4Address.None -max_address (Cidr addr mask) +max_host :: Cidr -> IPv4Address +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) @@ -256,28 +258,28 @@ max_address (Cidr addr mask) min_octet1 :: Cidr -> Octet -min_octet1 cidr = octet1 (min_address cidr) +min_octet1 cidr = octet1 (min_host cidr) min_octet2 :: Cidr -> Octet -min_octet2 cidr = octet2 (min_address cidr) +min_octet2 cidr = octet2 (min_host cidr) min_octet3 :: Cidr -> Octet -min_octet3 cidr = octet3 (min_address cidr) +min_octet3 cidr = octet3 (min_host cidr) min_octet4 :: Cidr -> Octet -min_octet4 cidr = octet4 (min_address cidr) +min_octet4 cidr = octet4 (min_host cidr) max_octet1 :: Cidr -> Octet -max_octet1 cidr = octet1 (max_address cidr) +max_octet1 cidr = octet1 (max_host cidr) max_octet2 :: Cidr -> Octet -max_octet2 cidr = octet2 (max_address cidr) +max_octet2 cidr = octet2 (max_host cidr) max_octet3 :: Cidr -> Octet -max_octet3 cidr = octet3 (max_address cidr) +max_octet3 cidr = octet3 (max_host cidr) max_octet4 :: Cidr -> Octet -max_octet4 cidr = octet4 (max_address cidr) +max_octet4 cidr = octet4 (max_host cidr)