]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2377] Create Rdata
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Dec 2012 09:58:28 +0000 (10:58 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Dec 2012 10:20:09 +0000 (11:20 +0100)
And fill it into the rrset.

src/lib/dns/master_loader.cc

index d49070f6e9e4a76c08bf158a72c228d324351df2..4444afa37754b915bfc1c71c0e8714236c2ecd34 100644 (file)
@@ -19,6 +19,7 @@
 #include <dns/rrclass.h>
 #include <dns/rrtype.h>
 #include <dns/rrset.h>
+#include <dns/rdata.h>
 
 using std::string;
 
@@ -74,14 +75,26 @@ public:
             const RRClass rrclass(getString());
             const RRType rrtype(getString());
 
-            // Create the RRset. We don't need the RRSIG, so we are good
-            // with the basic one
-            RRsetPtr rrset(new BasicRRset(name, rrclass, rrtype, ttl));
-
-            // TODO: Create the RData
-
-            // OK now, so give the RRset with single RR to the caller
-            add_callback_(rrset);
+            // TODO: Origin handling
+            const rdata::RdataPtr data(rdata::createRdata(rrtype, rrclass,
+                                                          lexer_, NULL,
+                                                          options_,
+                                                          callbacks_));
+            // In case we get NULL, it means there was error creating
+            // the Rdata. The errors should have been reported by
+            // callbacks_ already, so we just need to not report the RR
+            if (data != rdata::RdataPtr()) {
+                // Create the RRset. We don't need the RRSIG, so we are good
+                // with the basic one
+                const RRsetPtr rrset(new BasicRRset(name, rrclass, rrtype,
+                                                    ttl));
+                rrset->addRdata(data);
+                // OK now, so give the RRset with single RR to the caller
+                add_callback_(rrset);
+
+                // Good, we loaded another one
+                ++count;
+            };
         }
         return (false);
     }