, SOAFields(..)
, WKSFields(..)
- , SomeQ
- , SomeRR
+ , SomeQ(..)
+ , SomeRR(..)
, A(..)
, NS(..)
, HS(..)
, mkDomainName
+ , mkDN
+ , rootName
+ , isRootName
+ , consLabel
+ , unconsLabel
+ , nameToLabels
+ , isZoneOf
+
, wrapQuestion
, wrapRecord
)
import Data.IntMap (IntMap)
import qualified Data.IntSet as IS
import Data.IntSet (IntSet)
+import Data.List
import qualified Data.Map as M
import Data.Map (Map)
import Data.Word
unconsLabel (DN (x:xs)) = (x, DN xs)
unconsLabel x = error ("Illegal use of unconsLabel: " ++ show x)
+nameToLabels :: DomainName -> [DomainLabel]
+nameToLabels (DN xs) = xs
+
+isZoneOf :: DomainName -> DomainName -> Bool
+isZoneOf (DN a) (DN b) = a `isSuffixOf` b
+
mkDomainName :: String -> DomainName
mkDomainName = DN . mkLabels [] . notEmpty
where
-> mkLabels (C8.pack l : soFar) rest
_ -> error ("Illegal domain name: " ++ xs)
+mkDN :: String -> DomainName
+mkDN = mkDomainName
+
class (Show rc, Eq rc, Typeable rc) => RecordClass rc where
rcToInt :: rc -> Int
wrapQuestion = SomeQ
wrapRecord :: (RecordType rt dt, RecordClass rc) => ResourceRecord rt rc dt -> SomeRR
-wrapRecord = SomeRR
\ No newline at end of file
+wrapRecord = SomeRR