X-Git-Url: http://www.average.org/gitweb/?p=pdns-pipe-nmc.git;a=blobdiff_plain;f=PowerDns.hs;h=9a2a4987443c9d052a40257f005a04dcd1aa8343;hp=1c1e420c6e13c0c61d25e1dc98537933f802bad0;hb=0d59aa176c8ca6665f59426a436671099a393d3f;hpb=1ee19d546701efde4b4b2f2f70bedae907a5266d diff --git a/PowerDns.hs b/PowerDns.hs index 1c1e420..9a2a498 100644 --- a/PowerDns.hs +++ b/PowerDns.hs @@ -1,6 +1,7 @@ module PowerDns ( RRType(..) , PdnsRequest(..) , pdnsParse + , pdnsReport , pdnsOut ) where @@ -63,8 +64,16 @@ pdnsParse ver s = }) _ -> Left $ "Unparseable PDNS Request: " ++ s -pdnsOut :: Int -> RRType -> Either String NmcDom -> String -pdnsOut ver rrtype edom = +pdnsReport :: String -> String +pdnsReport err = + "LOG\tError: " ++ err ++ "\nFAIL\n" + +pdnsOut :: Int -> String -> RRType -> Either String NmcDom -> String +pdnsOut ver id rrtype edom = case edom of - Left err -> "LOG Error: " ++ err ++ "\nFAIL\n" - Right dom -> "DATA\n" ++ (show dom) ++ "\nEND\n" --FIXME + Left err -> pdnsReport err + Right dom -> pdnsAmend ver id rrtype dom "END\n" + +pdnsAmend :: Int -> String -> RRType -> NmcDom -> String -> String +pdnsAmend ver id rrtype dom accum = + "DATA\t" ++ (show dom) ++ "\n" ++ accum --FIXME