module Network.DNS.Cache.Types (
Hash
, Key(..)
, Prio
, Value(..)
, Entry
, Result(..)
, TTL
, HostAddress
, Domain
, DNSError(..)
) where
import Data.Array.Unboxed (UArray)
import Data.ByteString.Short (ShortByteString)
import Data.IORef (IORef)
import Data.Time (UTCTime)
import Network.DNS (Domain, DNSError(..))
import Network.Socket (HostAddress)
type Hash = Int
data Key = Key !Hash
!ShortByteString
deriving (Ord,Show)
instance Eq Key where
Key h1 k1 == Key h2 k2 = h1 == h2 && k1 == k2
type Prio = UTCTime
data Value = Value (UArray Int HostAddress) (IORef Int)
instance Show Value where
show (Value a _) = show a
type TTL = Int
data Result =
Hit HostAddress
| Resolved HostAddress
| Numeric HostAddress
deriving (Eq,Show)
type Entry = Either DNSError Value