]> www.average.org Git - pdns-pipe-nmc.git/blobdiff - PowerDns.hs
handle empty 'value' as domain with no data
[pdns-pipe-nmc.git] / PowerDns.hs
index 7ed76e8a24bc046dcb42a96382d932f20c4210cb..6800143dcd243b8d595f1a78d329509b9fbdb3bc 100644 (file)
@@ -1,4 +1,10 @@
-module PowerDns where
+module PowerDns ( RRType
+                , PdnsRequest(..)
+                , pdnsParse
+                , pdnsOut
+                ) where
+
+import NmcJson
 
 data RRType = RRTypeSRV   | RRTypeA   | RRTypeAAAA | RRTypeCNAME
             | RRTypeDNAME | RRTypeSOA | RRTypeRP   | RRTypeLOC
@@ -55,18 +61,7 @@ pdnsParse ver s =
                                             , localIpAddress = getLIp ver xs
                                             , ednsSubnetAddress = getRIp ver xs
                                             })
-      _                         -> Left s
+      _                         -> Left $ "Unparseable PDNS Request: " ++ s
 
-{-
-pdnsOut :: String -> Either String PdnsRequest -> IO ()
-pdnsOut _   (Left e)   = putStrLn ("ERROR\tUnparseable request: " ++ e)
-pdnsOut uri (Right rq) = case rq of
-    PdnsRequestQ qn qt id lip rip eip -> do
-      dom <- queryNmc uri qn qt id
-      case dom of
-        Left  e      -> putStrLn ("ERROR\tNmc query error: " ++ e)
-        Right result -> print result
-    PdnsRequestAXFR xfrreq ->
-      putStrLn ("ERROR\t No support for AXFR " ++ xfrreq)
-    PdnsRequestPing -> putStrLn "OK"
--}
+pdnsOut :: RRType -> NmcDom -> String
+pdnsOut _ d = show d