From: Eugene Crosser Date: Sat, 29 Mar 2014 18:56:03 +0000 (+0400) Subject: wip reorg responsibilities X-Git-Tag: 0.9.0.0~114 X-Git-Url: http://average.org/gitweb/?a=commitdiff_plain;h=bae658dcd2084b5f5be71987c6eba23f4106818a;p=pdns-pipe-nmc.git wip reorg responsibilities --- diff --git a/PowerDns.hs b/PowerDns.hs index d93214f..6800143 100644 --- a/PowerDns.hs +++ b/PowerDns.hs @@ -61,7 +61,7 @@ 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 :: RRType -> NmcDom -> String +pdnsOut _ d = show d diff --git a/pdns-pipe-nmc.hs b/pdns-pipe-nmc.hs index a933c9c..ee5bd37 100644 --- a/pdns-pipe-nmc.hs +++ b/pdns-pipe-nmc.hs @@ -49,9 +49,9 @@ qRsp rsp = -- NMC interface -queryNmc :: Manager -> Config -> String -> RRType -> String +queryNmc :: Manager -> Config -> String -> String -> IO (Either String NmcDom) -queryNmc mgr cfg fqdn qtype qid = do +queryNmc mgr cfg fqdn qid = do case reverse (splitOn "." fqdn) of "bit":dn:xs -> do rsp <- runResourceT $ @@ -89,11 +89,11 @@ main = do Left e -> putStrLn $ "ERROR\t" ++ e Right preq -> do case preq of - PdnsRequestQ qn qt id lip rip eip -> do - ncres <- queryNmc mgr cfg (qName preq) (qType preq) (iD preq) + PdnsRequestQ qname qtype id _ _ _ -> do + ncres <- queryNmc mgr cfg qname id case ncres of Left e -> putStrLn $ "ERROR\t" ++ e - Right dom -> putStrLn $ pdnsOut dom + Right dom -> putStrLn $ pdnsOut qtype dom PdnsRequestAXFR xfrreq -> - putStrLn ("ERROR\t No support for AXFR " ++ xfrreq) + putStrLn ("ERROR\tNo support for AXFR " ++ xfrreq) PdnsRequestPing -> putStrLn "OK"