import Octet
-data Cidr = Cidr { ipv4address :: IPv4Address,
- maskbits :: Maskbits }
+data Cidr = None | Cidr { ipv4address :: IPv4Address,
+ maskbits :: Maskbits }
deriving (Eq, Show)
-- Will return True if the passed String is in CIDR notation, False
cidr_from_string :: String -> Cidr
-cidr_from_string s = Cidr addr mbits
+cidr_from_string s
+ | addr == IPv4Address.None = Cidr.None
+ | otherwise = Cidr addr mbits
where
- addr = IPv4Address (oct1) (oct2) (oct3) (oct4)
+ addr = ipv4address_from_octets (oct1) (oct2) (oct3) (oct4)
oct1 = octet_from_int (octs !! 0)
oct2 = octet_from_int (octs !! 1)
oct3 = octet_from_int (octs !! 2)