X-Git-Url: http://www.average.org/gitweb/?p=pdns-pipe-nmc.git;a=blobdiff_plain;f=PowerDns.hs;h=9a2a4987443c9d052a40257f005a04dcd1aa8343;hp=6800143dcd243b8d595f1a78d329509b9fbdb3bc;hb=0d59aa176c8ca6665f59426a436671099a393d3f;hpb=bae658dcd2084b5f5be71987c6eba23f4106818a diff --git a/PowerDns.hs b/PowerDns.hs index 6800143..9a2a498 100644 --- a/PowerDns.hs +++ b/PowerDns.hs @@ -1,6 +1,7 @@ -module PowerDns ( RRType +module PowerDns ( RRType(..) , PdnsRequest(..) , pdnsParse + , pdnsReport , pdnsOut ) where @@ -63,5 +64,16 @@ pdnsParse ver s = }) _ -> Left $ "Unparseable PDNS Request: " ++ s -pdnsOut :: RRType -> NmcDom -> String -pdnsOut _ d = show d +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 -> 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