]> granicus.if.org Git - pdns/commitdiff
migrate to rapidjson, away from difficult to source libjsoncpp
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 3 Dec 2012 15:52:42 +0000 (15:52 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 3 Dec 2012 15:52:42 +0000 (15:52 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2952 d19b8d6e-7fed-0310-83ef-9ca221ded41b

configure.ac
pdns/Makefile.am
pdns/ws.cc

index 66be75a1ade6c782a1f94c881fcc7862c43ac612..6e51bd509887d8f3f8fa0fa72cb4a2835713f366 100644 (file)
@@ -498,10 +498,6 @@ then
         AC_DEFINE(HAVE_SQLITE3,1,[If we have sqlite3])
 fi
 
-PKG_CHECK_MODULES(JSONCPP, jsoncpp, HAVE_JSONCPP=yes, AC_MSG_ERROR([Could not find jsoncpp])
-AC_SUBST(JSONCPP_LIBS)
-AC_SUBST(JSONCPP_CFLAGS))
-
 if test "$needcdb"
 then
        PKG_CHECK_MODULES(CDB, libcdb, HAVE_CDB=yes, AC_MSG_ERROR([+Could not find libcdb/tinycdb]))
index 14473602795663e79f55a2b245b1bcd75cbab71a..0e81941551fe7bdf3837ed3732ebb68984633e4c 100644 (file)
@@ -1,9 +1,10 @@
 if HAVE_LIBPOLARSSL
-AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS)
+AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS) -I ext/rapidjson/include
 else
-AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS) -Iext/polarssl-1.1.2/include
+AM_CXXFLAGS=-DSYSCONFDIR=\"@sysconfdir@\" -DLIBDIR=\"@libdir@\" -DLOCALSTATEDIR=\"@socketdir@\" -Ibackends/bind @THREADFLAGS@ $(LUA_CFLAGS) $(SQLITE3_CFLAGS) -Iext/polarssl-1.1.2/include -Iext/rapidjson/include
+
 endif
-AM_CPPFLAGS=-Ibackends/bind $(BOOST_CPPFLAGS) @THREADFLAGS@ $(JSONCPP_CPPFLAGS)
+AM_CPPFLAGS=-Ibackends/bind $(BOOST_CPPFLAGS) @THREADFLAGS@ 
 
 if BOTAN110
 AM_CPPFLAGS += $(BOTAN110_CFLAGS)
@@ -64,10 +65,10 @@ aes/aestab.c aes/aestab.h aes/brg_endian.h aes/brg_types.h aes/dns_random.cc \
 randomhelper.cc namespaces.hh nsecrecords.cc base32.cc dbdnsseckeeper.cc dnssecinfra.cc \
 dnsseckeeper.hh dnssecinfra.hh base32.hh dns.cc dnssecsigner.cc polarrsakeyinfra.cc md5.cc \
 md5.hh signingpipe.cc signingpipe.hh dnslabeltext.cc lua-pdns.cc lua-auth.cc lua-auth.hh serialtweaker.cc \
-ednssubnet.cc ednssubnet.hh cachecleaner.hh json.cc json.hh
+ednssubnet.cc ednssubnet.hh cachecleaner.hh json.cc json.hh 
 
 #
-pdns_server_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@  $(BOOST_SERIALIZATION_LDFLAGS) $(JSONCPP_LIBS) -rdynamic
+pdns_server_LDFLAGS=@moduleobjects@ @modulelibs@ @DYNLINKFLAGS@ @LIBDL@ @THREADFLAGS@  $(BOOST_SERIALIZATION_LDFLAGS) -rdynamic
 pdns_server_LDADD= ext/polarssl-1.1.2/library/libpolarssl.a $(BOOST_SERIALIZATION_LIBS) $(LUA_LIBS) $(SQLITE3_LIBS)
 
 if BOTAN110
index 7ca54b28d6bb3d630dc23f8d1862ef721aa99d93..181d95c90d79e8b015bb5e8949e444f467060994 100644 (file)
@@ -28,7 +28,7 @@
 #include <boost/format.hpp>
 #include <boost/foreach.hpp>
 #include "namespaces.hh"
-#include <jsoncpp/json/json.h>
+#include "rapidjson/document.h"
 
 extern StatBag S;
 
@@ -400,25 +400,24 @@ string StatWebServer::jsonstat(const string& method, const string& post, const m
       
     }
     else if(method=="POST") {
-      Json::Value root;   // will contains the root value after parsing.
-      Json::Reader reader;
-      if(!reader.parse(post, root )) {
+      rapidjson::Document document;
+      if(document.Parse<0>(post.c_str()).HasParseError()) {
         return ret+"{\"error\": \"Unable to parse JSON\"";
       }
       
-      const Json::Value records=root["records"];
-      
+    
       DNSResourceRecord rr;
       vector<DNSResourceRecord> rrset;
-      for(unsigned int i = 0 ; i < records.size(); ++i) {
-        const Json::Value& record = records[i];
-        rr.qname=record["name"].asString();
-        rr.content=record["content"].asString();
-        rr.qtype=record["type"].asString();
+      const rapidjson::Value &records= document["records"];
+      for(rapidjson::SizeType i = 0; i < records.Size(); ++i) {
+        const rapidjson::Value& record = records[i];
+        rr.qname=record["name"].GetString();
+        rr.content=record["content"].GetString();
+        rr.qtype=record["type"].GetString();
         rr.domain_id = sd.domain_id;
         rr.auth=0;
-        rr.ttl=atoi(record["ttl"].asString().c_str());
-        rr.priority=atoi(record["priority"].asString().c_str());
+        rr.ttl=atoi(record["ttl"].GetString());
+        rr.priority=atoi(record["priority"].GetString());
         
         rrset.push_back(rr);