]> gitweb @ CieloNegro.org - haskell-dns.git/commitdiff
More unit tests
authorPHO <pho@cielonegro.org>
Sat, 23 May 2009 05:20:17 +0000 (14:20 +0900)
committerPHO <pho@cielonegro.org>
Sat, 23 May 2009 05:20:17 +0000 (14:20 +0900)
DNSUnitTest.hs
Network/DNS/Server.hs [new file with mode: 0644]
dns.cabal

index e907c3b8acd16c8029b880d235d144eebb88da05..c3975a4252c044e3bf45e6e70a79847a7006dd13 100644 (file)
@@ -96,6 +96,104 @@ messages = [ ( [ 0x22, 0x79, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00
                                   ]
                }
              )
+           , ( [ 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 = []
+               }
+             )
+           , ( [ 0xED, 0x68, 0x85, 0x00, 0x00, 0x01, 0x00, 0x01
+               , 0x00, 0x01, 0x00, 0x01, 0x0A, 0x63, 0x69, 0x65
+               , 0x6C, 0x6F, 0x6E, 0x65, 0x67, 0x72, 0x6F, 0x03
+               , 0x6F, 0x72, 0x67, 0x00, 0x00, 0x06, 0x00, 0x01
+               , 0xC0, 0x0C, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00
+               , 0x0E, 0x10, 0x00, 0x21, 0x03, 0x6E, 0x65, 0x6D
+               , 0xC0, 0x0C, 0x04, 0x72, 0x6F, 0x6F, 0x74, 0xC0
+               , 0x2C, 0x77, 0xAF, 0xFC, 0x84, 0x00, 0x00, 0x0E
+               , 0x10, 0x00, 0x00, 0x03, 0x84, 0x00, 0x36, 0xEE
+               , 0x80, 0x00, 0x00, 0x0E, 0x10, 0xC0, 0x0C, 0x00
+               , 0x02, 0x00, 0x01, 0x00, 0x00, 0x0E, 0x10, 0x00
+               , 0x02, 0xC0, 0x2C, 0xC0, 0x2C, 0x00, 0x01, 0x00
+               , 0x01, 0x00, 0x00, 0x0E, 0x10, 0x00, 0x04, 0xDB
+               , 0x5E, 0x82, 0x8B
+               ]
+             , Message {
+                 msgHeader = Header {
+                               hdMessageID             = 60776
+                             , hdMessageType           = Response
+                             , hdOpcode                = StandardQuery
+                             , hdIsAuthoritativeAnswer = True
+                             , hdIsTruncated           = False
+                             , hdIsRecursionDesired    = True
+                             , hdIsRecursionAvailable  = False
+                             , hdResponseCode          = NoError
+                             }
+               , msgQuestions   = [ wrapQuestion $
+                                    Question {
+                                      qName  = mkDomainName "cielonegro.org."
+                                    , qType  = SOA
+                                    , qClass = IN
+                                    }
+                                  ]
+               , msgAnswers     = [ wrapRecord $
+                                    ResourceRecord {
+                                      rrName  = mkDomainName "cielonegro.org."
+                                    , rrType  = SOA
+                                    , rrClass = IN
+                                    , rrTTL   = 3600
+                                    , rrData  = SOAFields {
+                                                  soaMasterNameServer   = mkDomainName "nem.cielonegro.org."
+                                                , soaResponsibleMailbox = mkDomainName "root.nem.cielonegro.org."
+                                                , soaSerialNumber       = 2008022148
+                                                , soaRefreshInterval    = 3600
+                                                , soaRetryInterval      = 900
+                                                , soaExpirationLimit    = 3600000
+                                                , soaMinimumTTL         = 3600
+                                                }
+                                    }
+                                  ]
+               , 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")
+                                    }
+                                  ]
+               }
+             )
            ]
 
 packMsg :: Message -> [Word8]
diff --git a/Network/DNS/Server.hs b/Network/DNS/Server.hs
new file mode 100644 (file)
index 0000000..10c9ca5
--- /dev/null
@@ -0,0 +1,4 @@
+module Network.DNS.Server
+    (
+    )
+    where
index 0702a10aa82063909a6b610573e8cad797311428..6792870be99817a16839e16e19449f6d16a9aca9 100644 (file)
--- a/dns.cabal
+++ b/dns.cabal
@@ -23,6 +23,7 @@ Library
     Exposed-Modules:
         Network.DNS.Message
         Network.DNS.Packer
+        Network.DNS.Server
         Network.DNS.Unpacker
 
     Extensions: