-parseMsg :: [Word8] -> Message
-parseMsg = decode . LBS.pack
-
-
-testData :: [Test]
-testData = [ (parseMsg [ 0x22, 0x79, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00
- , 0x00, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x69
- , 0x6C, 0x0A, 0x63, 0x69, 0x65, 0x6C, 0x6F, 0x6E
- , 0x65, 0x67, 0x72, 0x6F, 0x03, 0x6F, 0x72, 0x67
- , 0x00, 0x00, 0x05, 0x00, 0x01
- ]
- ~?=
- Message {
- msgHeader = Header {
- hdMessageID = 8825
- , hdMessageType = Query
- , hdOpcode = StandardQuery
- , hdIsAuthoritativeAnswer = False
- , hdIsTruncated = False
- , hdIsRecursionDesired = True
- , hdIsRecursionAvailable = False
- , hdResponseCode = NoError
- }
- , msgQuestions = [ Question {
- qName = mkDomainName "mail.cielonegro.org."
- , qType = wrapQueryType CNAME
- , qClass = IN
- }
- ]
- , msgAnswers = []
- , msgAuthorities = []
- , msgAdditionals = []
- }
+messages :: [([Word8], Message)]
+messages = [ ( [ 0x22, 0x79, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00
+ , 0x00, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x69
+ , 0x6C, 0x0A, 0x63, 0x69, 0x65, 0x6C, 0x6F, 0x6E
+ , 0x65, 0x67, 0x72, 0x6F, 0x03, 0x6F, 0x72, 0x67
+ , 0x00, 0x00, 0x05, 0x00, 0x01
+ ]
+ , Message {
+ msgHeader = Header {
+ hdMessageID = 8825
+ , hdMessageType = Query
+ , hdOpcode = StandardQuery
+ , hdIsAuthoritativeAnswer = False
+ , hdIsTruncated = False
+ , hdIsRecursionDesired = True
+ , hdIsRecursionAvailable = False
+ , hdResponseCode = NoError
+ }
+ , msgQuestions = [ wrapQuestion $
+ Question {
+ qName = mkDomainName "mail.cielonegro.org."
+ , qType = CNAME
+ , qClass = IN
+ }
+ ]
+ , msgAnswers = []
+ , msgAuthorities = []
+ , msgAdditionals = []
+ }
+ )
+ , ( [ 0x22, 0x79, 0x85, 0x00, 0x00, 0x01, 0x00, 0x01
+ , 0x00, 0x01, 0x00, 0x01, 0x04, 0x6D, 0x61, 0x69
+ , 0x6C, 0x0A, 0x63, 0x69, 0x65, 0x6C, 0x6F, 0x6E
+ , 0x65, 0x67, 0x72, 0x6F, 0x03, 0x6F, 0x72, 0x67
+ , 0x00, 0x00, 0x05, 0x00, 0x01, 0xC0, 0x0C, 0x00
+ , 0x05, 0x00, 0x01, 0x00, 0x01, 0x51, 0x80, 0x00
+ , 0x06, 0x03, 0x6E, 0x65, 0x6D, 0xC0, 0x11, 0xC0
+ , 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x0E
+ , 0x10, 0x00, 0x02, 0xC0, 0x31, 0xC0, 0x31, 0x00
+ , 0x01, 0x00, 0x01, 0x00, 0x00, 0x0E, 0x10, 0x00
+ , 0x04, 0xDB, 0x5E, 0x82, 0x8B
+ ]
+ , Message {
+ msgHeader = Header {
+ hdMessageID = 8825
+ , hdMessageType = Response
+ , hdOpcode = StandardQuery
+ , hdIsAuthoritativeAnswer = True
+ , hdIsTruncated = False
+ , hdIsRecursionDesired = True
+ , hdIsRecursionAvailable = False
+ , hdResponseCode = NoError
+ }
+ , msgQuestions = [ wrapQuestion $
+ Question {
+ qName = mkDomainName "mail.cielonegro.org."
+ , qType = CNAME
+ , qClass = IN
+ }
+ ]
+ , msgAnswers = [ wrapRecord $
+ ResourceRecord {
+ rrName = mkDomainName "mail.cielonegro.org."
+ , rrType = CNAME
+ , rrClass = IN
+ , rrTTL = 86400
+ , rrData = mkDomainName "nem.cielonegro.org."
+ }
+ ]
+ , msgAuthorities = [ wrapRecord $
+ ResourceRecord {
+ rrName = mkDomainName "cielonegro.org."
+ , rrType = NS
+ , rrClass = IN
+ , rrTTL = 3600
+ , rrData = mkDomainName "nem.cielonegro.org."
+ }
+ ]
+ , msgAdditionals = [ wrapRecord $
+ ResourceRecord {
+ rrName = mkDomainName "nem.cielonegro.org."
+ , rrType = A
+ , rrClass = IN
+ , rrTTL = 3600
+ , rrData = unsafePerformIO (inet_addr "219.94.130.139")
+ }
+ ]
+ }
+ )
+ , ( [ 0xED, 0x68, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00
+ , 0x00, 0x00, 0x00, 0x00, 0x0A, 0x63, 0x69, 0x65
+ , 0x6C, 0x6F, 0x6E, 0x65, 0x67, 0x72, 0x6F, 0x03
+ , 0x6F, 0x72, 0x67, 0x00, 0x00, 0x06, 0x00, 0x01
+ ]
+ , Message {
+ msgHeader = Header {
+ hdMessageID = 60776
+ , hdMessageType = Query
+ , hdOpcode = StandardQuery
+ , hdIsAuthoritativeAnswer = False
+ , hdIsTruncated = False
+ , hdIsRecursionDesired = True
+ , hdIsRecursionAvailable = False
+ , hdResponseCode = NoError
+ }
+ , msgQuestions = [ wrapQuestion $
+ Question {
+ qName = mkDomainName "cielonegro.org."
+ , qType = SOA
+ , qClass = IN
+ }
+ ]
+ , msgAnswers = []
+ , msgAuthorities = []
+ , msgAdditionals = []
+ }