]> www.average.org Git - pdns-pipe-nmc.git/blobdiff - PowerDns.hs
make pdnsOut more composable
[pdns-pipe-nmc.git] / PowerDns.hs
index d93214f98d33352cfc2702ea8ba9e4e1889c7bb8..165b80ed5303681b0c63c0e82f8a2b36b1371ca4 100644 (file)
@@ -1,4 +1,4 @@
-module PowerDns ( RRType
+module PowerDns ( RRType(..)
                 , PdnsRequest(..)
                 , pdnsParse
                 , pdnsOut
@@ -61,7 +61,10 @@ pdnsParse ver s =
                                             , localIpAddress = getLIp ver xs
                                             , ednsSubnetAddress = getRIp ver xs
                                             })
-      _                         -> Left s
+      _                         -> Left $ "Unparseable PDNS Request: " ++ s
 
-pdnsOut :: NmcDom -> String
-pdnsOut d = show d
+pdnsOut :: Int -> RRType -> Either String NmcDom -> String
+pdnsOut ver _ d =
+  case d of
+    Left  err -> "LOG Error: " ++ err ++ "\nFAIL\n"
+    Right dom -> "DATA\n" ++ (show dom) ++ "\nEND\n" --FIXME