BIND 10 trac2095, updated. 3b36e5f7abbd29ddfb5b4033b62af924b16c2aa1 [2095] update comments based on review feedback

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jul 31 16:47:00 UTC 2012


The branch, trac2095 has been updated
       via  3b36e5f7abbd29ddfb5b4033b62af924b16c2aa1 (commit)
      from  84e7463c44719b7f4e97ad176c6861bd1c8b0a81 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3b36e5f7abbd29ddfb5b4033b62af924b16c2aa1
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jul 31 09:45:26 2012 -0700

    [2095] update comments based on review feedback
    
    - make assumptions in the spec more accurate
    - move some block of comments closer to the corresponding code for readability

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/rdata_encoder.cc |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/rdata_encoder.cc b/src/lib/datasrc/memory/rdata_encoder.cc
index 05ecfb5..f3c364c 100644
--- a/src/lib/datasrc/memory/rdata_encoder.cc
+++ b/src/lib/datasrc/memory/rdata_encoder.cc
@@ -67,10 +67,11 @@ struct RdataFieldSpec {
 /// Specification of RDATA in terms of internal encoding.
 ///
 /// The fields must be a sequence of:
-/// <0 or more fixed/var-len data fields>,
-/// <0 or more domain name fields>,
-/// <0 or more fixed/var-len data fields>,
-/// <0 or more domain name fields>,
+/// <0 or 1 fixed/var-len data field>,
+/// <1 or more domain name fields>,
+/// <1 fixed/var-len data field>,
+/// <1 or more domain name fields>,
+/// <1 fixed/var-len data field>,
 /// ...and so on.
 /// There must not be more than one consecutive data fields (i.e., without
 /// interleaved by a domain name); it would just be inefficient in terms of
@@ -80,7 +81,7 @@ struct RdataFieldSpec {
 /// should be combined into a single fixed-length field (like the last 20
 /// bytes of SOA RDATA).  If there's a variable length field, they should be
 /// combined into a single variable-length field (such as DNSKEY, which has
-/// 3 fixed-length field followed by one variable-length field).
+/// 3 fixed-length fields followed by one variable-length field).
 struct RdataEncodeSpec {
     const uint16_t field_count; // total number of fields (# of fields member)
     const uint16_t name_count;  // number of domain name fields
@@ -306,11 +307,8 @@ public:
         // buffer, and handle it appropriately.
         updateOtherData();
 
-        // Then, we still have a field in the spec, and it must be a domain
-        // name field.  Since we know we've passed any prior data field, the
-        // next field must be a domain name as long as it exists; otherwise
-        // it's a bug in the spec (not a bogus input).  So we assert() that
-        // condition.
+        // Then, we should still have a field in the spec, and it must be a
+        // domain name field.
         if (current_field_ >= encode_spec_->field_count) {
             isc_throw(BadValue,
                       "RDATA encoder encounters an unexpected name data: " <<
@@ -318,6 +316,9 @@ public:
         }
         const RdataFieldSpec& field =
             encode_spec_->fields[current_field_++];
+        // Since we know we've passed any prior data field, the next field
+        // must be a domain name as long as it exists; otherwise it's a bug
+        // in the spec (not a bogus input).  So we assert() that condition.
         assert(field.type == RdataFieldSpec::DOMAIN_NAME);
 
         // It would be compressed iff the field has that attribute.



More information about the bind10-changes mailing list