2 import qualified Data.ByteString.Lazy as LBS
4 import Network.DNS.Message
6 import System.IO.Unsafe
10 parseMsg :: [Word8] -> Message
11 parseMsg = decode . LBS.pack
15 testData = [ (parseMsg [ 0x22, 0x79, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00
16 , 0x00, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x69
17 , 0x6C, 0x0A, 0x63, 0x69, 0x65, 0x6C, 0x6F, 0x6E
18 , 0x65, 0x67, 0x72, 0x6F, 0x03, 0x6F, 0x72, 0x67
19 , 0x00, 0x00, 0x05, 0x00, 0x01
25 , hdMessageType = Query
26 , hdOpcode = StandardQuery
27 , hdIsAuthoritativeAnswer = False
28 , hdIsTruncated = False
29 , hdIsRecursionDesired = True
30 , hdIsRecursionAvailable = False
31 , hdResponseCode = NoError
33 , msgQuestions = [ Question {
34 qName = mkDomainName "mail.cielonegro.org."
35 , qType = wrapQueryType CNAME
44 , (parseMsg [ 0x22, 0x79, 0x85, 0x00, 0x00, 0x01, 0x00, 0x01
45 , 0x00, 0x01, 0x00, 0x01, 0x04, 0x6D, 0x61, 0x69
46 , 0x6C, 0x0A, 0x63, 0x69, 0x65, 0x6C, 0x6F, 0x6E
47 , 0x65, 0x67, 0x72, 0x6F, 0x03, 0x6F, 0x72, 0x67
48 , 0x00, 0x00, 0x05, 0x00, 0x01, 0xC0, 0x0C, 0x00
49 , 0x05, 0x00, 0x01, 0x00, 0x01, 0x51, 0x80, 0x00
50 , 0x06, 0x03, 0x6E, 0x65, 0x6D, 0xC0, 0x11, 0xC0
51 , 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x0E
52 , 0x10, 0x00, 0x02, 0xC0, 0x31, 0xC0, 0x31, 0x00
53 , 0x01, 0x00, 0x01, 0x00, 0x00, 0x0E, 0x10, 0x00
54 , 0x04, 0xDB, 0x5E, 0x82, 0x8B
60 , hdMessageType = Response
61 , hdOpcode = StandardQuery
62 , hdIsAuthoritativeAnswer = True
63 , hdIsTruncated = False
64 , hdIsRecursionDesired = True
65 , hdIsRecursionAvailable = False
66 , hdResponseCode = NoError
68 , msgQuestions = [ Question {
69 qName = mkDomainName "mail.cielonegro.org."
70 , qType = wrapQueryType CNAME
74 , msgAnswers = [ wrapRecord $
76 rrName = mkDomainName "mail.cielonegro.org."
80 , rrData = mkDomainName "nem.cielonegro.org."
83 , msgAuthorities = [ wrapRecord $
85 rrName = mkDomainName "cielonegro.org."
89 , rrData = mkDomainName "nem.cielonegro.org."
92 , msgAdditionals = [ wrapRecord $
94 rrName = mkDomainName "nem.cielonegro.org."
98 , rrData = unsafePerformIO (inet_addr "219.94.130.139")
107 main = runTestTT (test testData) >> return ()